fansunited-sdk-esm 1.117.2 → 1.117.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +2 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var id=Object.create;var jp=Object.defineProperty;var ad=Object.getOwnPropertyDescriptor;var rd=Object.getOwnPropertyNames;var od=Object.getPrototypeOf,sd=Object.prototype.hasOwnProperty;var nd=(s,t,e)=>t in s?jp(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var ld=(s,t)=>()=>(s&&(t=s(s=0)),t);var An=(s,t)=>()=>(t||s((t={exports:{}}).exports,t),t.exports),pd=(s,t)=>{for(var e in t)jp(s,e,{get:t[e],enumerable:!0})},cd=(s,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of rd(t))!sd.call(s,a)&&a!==e&&jp(s,a,{get:()=>t[a],enumerable:!(i=ad(t,a))||i.enumerable});return s};var ud=(s,t,e)=>(e=s!=null?id(od(s)):{},cd(t||!s||!s.__esModule?jp(e,"default",{value:s,enumerable:!0}):e,s));var at=(s,t,e)=>(nd(s,typeof t!="symbol"?t+"":t,e),e);var Su={};pd(Su,{default:()=>yd});var gd,yd,vu=ld(()=>{gd={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},yd=gd});var Cu=An((Lf,ec)=>{var bd=function(){"use strict";function s(c,u){return u!=null&&c instanceof u}var t;try{t=Map}catch{t=function(){}}var e;try{e=Set}catch{e=function(){}}var i;try{i=Promise}catch{i=function(){}}function a(c,u,d,M,_){typeof u=="object"&&(d=u.depth,M=u.prototype,_=u.includeNonEnumerable,u=u.circular);var B=[],ui=[],di=typeof Buffer<"u";typeof u>"u"&&(u=!0),typeof d>"u"&&(d=1/0);function lt(g,zt){if(g===null)return null;if(zt===0)return g;var U,Sn;if(typeof g!="object")return g;if(s(g,t))U=new t;else if(s(g,e))U=new e;else if(s(g,i))U=new i(function(vn,P){g.then(function(Cn){vn(lt(Cn,zt-1))},function(Cn){P(lt(Cn,zt-1))})});else if(a.__isArray(g))U=[];else if(a.__isRegExp(g))U=new RegExp(g.source,p(g)),g.lastIndex&&(U.lastIndex=g.lastIndex);else if(a.__isDate(g))U=new Date(g.getTime());else{if(di&&Buffer.isBuffer(g))return Buffer.allocUnsafe?U=Buffer.allocUnsafe(g.length):U=new Buffer(g.length),g.copy(U),U;s(g,Error)?U=Object.create(g):typeof M>"u"?(Sn=Object.getPrototypeOf(g),U=Object.create(Sn)):(U=Object.create(M),Sn=M)}if(u){var gu=B.indexOf(g);if(gu!=-1)return ui[gu];B.push(g),ui.push(U)}s(g,t)&&g.forEach(function(vn,P){var Cn=lt(P,zt-1),ed=lt(vn,zt-1);U.set(Cn,ed)}),s(g,e)&&g.forEach(function(vn){var P=lt(vn,zt-1);U.add(P)});for(var Mt in g){var F;Sn&&(F=Object.getOwnPropertyDescriptor(Sn,Mt)),!(F&&F.set==null)&&(U[Mt]=lt(g[Mt],zt-1))}if(Object.getOwnPropertySymbols)for(var yu=Object.getOwnPropertySymbols(g),Mt=0;Mt<yu.length;Mt++){var Wp=yu[Mt],zi=Object.getOwnPropertyDescriptor(g,Wp);zi&&!zi.enumerable&&!_||(U[Wp]=lt(g[Wp],zt-1),zi.enumerable||Object.defineProperty(U,Wp,{enumerable:!1}))}if(_)for(var E=Object.getOwnPropertyNames(g),Mt=0;Mt<E.length;Mt++){var Kp=E[Mt],zi=Object.getOwnPropertyDescriptor(g,Kp);zi&&zi.enumerable||(U[Kp]=lt(g[Kp],zt-1),Object.defineProperty(U,Kp,{enumerable:!1}))}return U}return lt(c,d)}a.clonePrototype=function(u){if(u===null)return null;var d=function(){};return d.prototype=u,new d};function r(c){return Object.prototype.toString.call(c)}a.__objToStr=r;function o(c){return typeof c=="object"&&r(c)==="[object Date]"}a.__isDate=o;function n(c){return typeof c=="object"&&r(c)==="[object Array]"}a.__isArray=n;function l(c){return typeof c=="object"&&r(c)==="[object RegExp]"}a.__isRegExp=l;function p(c){var u="";return c.global&&(u+="g"),c.ignoreCase&&(u+="i"),c.multiline&&(u+="m"),u}return a.__getRegExpFlags=p,a}();typeof ec=="object"&&ec.exports&&(ec.exports=bd)});var Vu=An((Df,nu)=>{"use strict";var sa=typeof Reflect=="object"?Reflect:null,Au=sa&&typeof sa.apply=="function"?sa.apply:function(t,e,i){return Function.prototype.apply.call(t,e,i)},ic;sa&&typeof sa.ownKeys=="function"?ic=sa.ownKeys:Object.getOwnPropertySymbols?ic=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:ic=function(t){return Object.getOwnPropertyNames(t)};function Md(s){console&&console.warn&&console.warn(s)}var xu=Number.isNaN||function(t){return t!==t};function S(){S.init.call(this)}nu.exports=S;nu.exports.once=Pd;S.EventEmitter=S;S.prototype._events=void 0;S.prototype._eventsCount=0;S.prototype._maxListeners=void 0;var Ou=10;function ac(s){if(typeof s!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof s)}Object.defineProperty(S,"defaultMaxListeners",{enumerable:!0,get:function(){return Ou},set:function(s){if(typeof s!="number"||s<0||xu(s))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+s+".");Ou=s}});S.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};S.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||xu(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function Lu(s){return s._maxListeners===void 0?S.defaultMaxListeners:s._maxListeners}S.prototype.getMaxListeners=function(){return Lu(this)};S.prototype.emit=function(t){for(var e=[],i=1;i<arguments.length;i++)e.push(arguments[i]);var a=t==="error",r=this._events;if(r!==void 0)a=a&&r.error===void 0;else if(!a)return!1;if(a){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var n=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw n.context=o,n}var l=r[t];if(l===void 0)return!1;if(typeof l=="function")Au(l,this,e);else for(var p=l.length,c=Gu(l,p),i=0;i<p;++i)Au(c[i],this,e);return!0};function Du(s,t,e,i){var a,r,o;if(ac(e),r=s._events,r===void 0?(r=s._events=Object.create(null),s._eventsCount=0):(r.newListener!==void 0&&(s.emit("newListener",t,e.listener?e.listener:e),r=s._events),o=r[t]),o===void 0)o=r[t]=e,++s._eventsCount;else if(typeof o=="function"?o=r[t]=i?[e,o]:[o,e]:i?o.unshift(e):o.push(e),a=Lu(s),a>0&&o.length>a&&!o.warned){o.warned=!0;var n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");n.name="MaxListenersExceededWarning",n.emitter=s,n.type=t,n.count=o.length,Md(n)}return s}S.prototype.addListener=function(t,e){return Du(this,t,e,!1)};S.prototype.on=S.prototype.addListener;S.prototype.prependListener=function(t,e){return Du(this,t,e,!0)};function Id(){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 Bu(s,t,e){var i={fired:!1,wrapFn:void 0,target:s,type:t,listener:e},a=Id.bind(i);return a.listener=e,i.wrapFn=a,a}S.prototype.once=function(t,e){return ac(e),this.on(t,Bu(this,t,e)),this};S.prototype.prependOnceListener=function(t,e){return ac(e),this.prependListener(t,Bu(this,t,e)),this};S.prototype.removeListener=function(t,e){var i,a,r,o,n;if(ac(e),a=this._events,a===void 0)return this;if(i=a[t],i===void 0)return this;if(i===e||i.listener===e)--this._eventsCount===0?this._events=Object.create(null):(delete a[t],a.removeListener&&this.emit("removeListener",t,i.listener||e));else if(typeof i!="function"){for(r=-1,o=i.length-1;o>=0;o--)if(i[o]===e||i[o].listener===e){n=i[o].listener,r=o;break}if(r<0)return this;r===0?i.shift():wd(i,r),i.length===1&&(a[t]=i[0]),a.removeListener!==void 0&&this.emit("removeListener",t,n||e)}return this};S.prototype.off=S.prototype.removeListener;S.prototype.removeAllListeners=function(t){var e,i,a;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[t]),this;if(arguments.length===0){var r=Object.keys(i),o;for(a=0;a<r.length;++a)o=r[a],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(e=i[t],typeof e=="function")this.removeListener(t,e);else if(e!==void 0)for(a=e.length-1;a>=0;a--)this.removeListener(t,e[a]);return this};function Nu(s,t,e){var i=s._events;if(i===void 0)return[];var a=i[t];return a===void 0?[]:typeof a=="function"?e?[a.listener||a]:[a]:e?_d(a):Gu(a,a.length)}S.prototype.listeners=function(t){return Nu(this,t,!0)};S.prototype.rawListeners=function(t){return Nu(this,t,!1)};S.listenerCount=function(s,t){return typeof s.listenerCount=="function"?s.listenerCount(t):ku.call(s,t)};S.prototype.listenerCount=ku;function ku(s){var t=this._events;if(t!==void 0){var e=t[s];if(typeof e=="function")return 1;if(e!==void 0)return e.length}return 0}S.prototype.eventNames=function(){return this._eventsCount>0?ic(this._events):[]};function Gu(s,t){for(var e=new Array(t),i=0;i<t;++i)e[i]=s[i];return e}function wd(s,t){for(;t+1<s.length;t++)s[t]=s[t+1];s.pop()}function _d(s){for(var t=new Array(s.length),e=0;e<t.length;++e)t[e]=s[e].listener||s[e];return t}function Pd(s,t){return new Promise(function(e,i){function a(o){s.removeListener(t,r),i(o)}function r(){typeof s.removeListener=="function"&&s.removeListener("error",a),e([].slice.call(arguments))}Uu(s,t,r,{once:!0}),t!=="error"&&Td(s,a,{once:!0})})}function Td(s,t,e){typeof s.on=="function"&&Uu(s,"error",t,e)}function Uu(s,t,e,i){if(typeof s.on=="function")i.once?s.once(t,e):s.on(t,e);else if(typeof s.addEventListener=="function")s.addEventListener(t,function a(r){i.once&&s.removeEventListener(t,a),e(r)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof s)}});var zu=An((Hu,$u)=>{(function(){var s,t,e,i=[].splice,a=function(o,n){if(!(o instanceof n))throw new Error("Bound instance method accessed before binding")},r=[].indexOf;e=Cu(),s=Vu().EventEmitter,$u.exports=t=function(){class o extends s{constructor(l={}){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=l,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(p=>{var c;c=this[p],this[p]=function(...u){var d,M,_,B;if(_=u,[...u]=_,[d]=i.call(u,-1),typeof d=="function")try{B=c(...u),d(null,B)}catch(ui){M=ui,d(M)}else return c(...u,d)}})),this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this.validKeyTypes=["string","number"],this._checkData()}get(l){var p,c;if(a(this,o),(c=this._isInvalidKey(l))!=null)throw c;if(this.data[l]!=null&&this._check(l,this.data[l]))return this.stats.hits++,p=this._unwrap(this.data[l]),p;this.stats.misses++}mget(l){var p,c,u,d,M,_;if(a(this,o),!Array.isArray(l))throw p=this._error("EKEYSTYPE"),p;for(_={},u=0,M=l.length;u<M;u++){if(d=l[u],(c=this._isInvalidKey(d))!=null)throw c;this.data[d]!=null&&this._check(d,this.data[d])?(this.stats.hits++,_[d]=this._unwrap(this.data[d])):this.stats.misses++}return _}set(l,p,c){var u,d,M;if(a(this,o),this.options.maxKeys>-1&&this.stats.keys>=this.options.maxKeys)throw u=this._error("ECACHEFULL"),u;if(this.options.forceString&&!typeof p==="string"&&(p=JSON.stringify(p)),c==null&&(c=this.options.stdTTL),(d=this._isInvalidKey(l))!=null)throw d;return M=!1,this.data[l]&&(M=!0,this.stats.vsize-=this._getValLength(this._unwrap(this.data[l],!1))),this.data[l]=this._wrap(p,c),this.stats.vsize+=this._getValLength(p),M||(this.stats.ksize+=this._getKeyLength(l),this.stats.keys++),this.emit("set",l,p),!0}mset(l){var p,c,u,d,M,_,B,ui,di,lt;if(a(this,o),this.options.maxKeys>-1&&this.stats.keys+l.length>=this.options.maxKeys)throw p=this._error("ECACHEFULL"),p;for(u=0,B=l.length;u<B;u++){if(_=l[u],{key:M,val:lt,ttl:di}=_,di&&typeof di!="number")throw p=this._error("ETTLTYPE"),p;if((c=this._isInvalidKey(M))!=null)throw c}for(d=0,ui=l.length;d<ui;d++)_=l[d],{key:M,val:lt,ttl:di}=_,this.set(M,lt,di);return!0}del(l){var p,c,u,d,M,_;for(a(this,o),Array.isArray(l)||(l=[l]),p=0,u=0,M=l.length;u<M;u++){if(d=l[u],(c=this._isInvalidKey(d))!=null)throw c;this.data[d]!=null&&(this.stats.vsize-=this._getValLength(this._unwrap(this.data[d],!1)),this.stats.ksize-=this._getKeyLength(d),this.stats.keys--,p++,_=this.data[d],delete this.data[d],this.emit("del",d,_.v))}return p}take(l){var p;return a(this,o),p=this.get(l),p!=null&&this.del(l),p}ttl(l,p){var c;if(a(this,o),p||(p=this.options.stdTTL),!l)return!1;if((c=this._isInvalidKey(l))!=null)throw c;return this.data[l]!=null&&this._check(l,this.data[l])?(p>=0?this.data[l]=this._wrap(this.data[l].v,p,!1):this.del(l),!0):!1}getTtl(l){var p,c;if(a(this,o),!!l){if((c=this._isInvalidKey(l))!=null)throw c;if(this.data[l]!=null&&this._check(l,this.data[l]))return p=this.data[l].t,p}}keys(){var l;return a(this,o),l=Object.keys(this.data),l}has(l){var p;return a(this,o),p=this.data[l]!=null&&this._check(l,this.data[l]),p}getStats(){return a(this,o),this.stats}flushAll(l=!0){a(this,o),this.data={},this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this._killCheckPeriod(),this._checkData(l),this.emit("flush")}flushStats(){a(this,o),this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this.emit("flush_stats")}close(){a(this,o),this._killCheckPeriod()}_checkData(l=!0){var p,c,u;a(this,o),c=this.data;for(p in c)u=c[p],this._check(p,u);l&&this.options.checkperiod>0&&(this.checkTimeout=setTimeout(this._checkData,this.options.checkperiod*1e3,l),this.checkTimeout!=null&&this.checkTimeout.unref!=null&&this.checkTimeout.unref())}_killCheckPeriod(){if(this.checkTimeout!=null)return clearTimeout(this.checkTimeout)}_check(l,p){var c;return a(this,o),c=!0,p.t!==0&&p.t<Date.now()&&(this.options.deleteOnExpire&&(c=!1,this.del(l)),this.emit("expired",l,this._unwrap(p))),c}_isInvalidKey(l){var p;if(a(this,o),p=typeof l,r.call(this.validKeyTypes,p)<0)return this._error("EKEYTYPE",{type:typeof l})}_wrap(l,p,c=!0){var u,d,M,_;return a(this,o),this.options.useClones||(c=!1),d=Date.now(),u=0,_=1e3,p===0?u=0:p?u=d+p*_:this.options.stdTTL===0?u=this.options.stdTTL:u=d+this.options.stdTTL*_,M={t:u,v:c?e(l):l}}_unwrap(l,p=!0){return this.options.useClones||(p=!1),l.v!=null?p?e(l.v):l.v:null}_getKeyLength(l){return l.toString().length}_getValLength(l){return a(this,o),typeof l=="string"?l.length:this.options.forceString?JSON.stringify(l).length:Array.isArray(l)?this.options.arrayValueSize*l.length:typeof l=="number"?8:typeof l?.then=="function"?this.options.promiseValueSize:typeof Buffer<"u"&&Buffer!==null&&Buffer.isBuffer(l)?l.length:l!=null&&typeof l=="object"?this.options.objectValueSize*Object.keys(l).length:typeof l=="boolean"?8:0}_error(l,p={}){var c;return a(this,o),c=new Error,c.name=l,c.errorcode=l,c.message=this.ERRORS[l]!=null?this.ERRORS[l](p):"-",c.data=p,c}_initErrors(){var l,p,c;a(this,o),this.ERRORS={},c=this._ERRORS;for(p in c)l=c[p],this.ERRORS[p]=this.createErrorMessage(l)}createErrorMessage(l){return function(p){return l.replace("__key",p.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(Hu)});var Wu=An((Qu,qu)=>{(function(){var s;s=qu.exports=zu(),s.version="5.1.2"}).call(Qu)});var Zu=An((Qj,Od)=>{Od.exports={name:"fansunited-sdk-esm",version:"1.117.2",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}});var On=(_=>(_.EN="en",_.BG="bg",_.RO="ro",_.EL="el",_.SK="sk",_.PT="pt",_.SR="sr",_.HU="hu",_.SV="sv",_.ES="es",_.FR="fr",_.NL="nl",_.DE="de",_.IT="it",_))(On||{});var xn=class{validate=t=>{let e=this.validateField(t.lang),i=this.generateMessage(e);return{validation:e,message:i}};validateField=t=>{let e=Object.values(On),i=null;return t!=null&&t.length>0?e.includes(t)?i="valid":i="invalid":i="missing",i};generateMessage=t=>{let e=null,i="warning";return t==="missing"&&(e="If no lang is passed the default one will be set which is: en"),t==="invalid"&&(e="This lang value is not supported, the default one will be set which is: en"),t==="valid"&&(e=null,i=null),{text:e,type:i}}};var Qi=(o=>(o.DEV="dev",o.PROD="prod",o.STAGING="staging",o.WATG="watg",o.YOLO="yolo",o.CSKA="cska",o))(Qi||{});var Ln=class{validate(t){let e=this.validateField(t.environment),i=this.generateMessage(e);return{validation:e,message:i}}validateField=t=>{let e=Object.values(Qi),i=null;return t!=null&&t.length>0?e.includes(t)?i="valid":i="invalid":i="missing",i};generateMessage=t=>{let e=null,i="warning";return t==="missing"&&(e="If no environment is passed the default one will be set which is: prod"),t==="invalid"&&(e="This environment value is not supported, the default one will be set which is: prod"),t==="valid"&&(e=null,i=null),{text:e,type:i}}};var Dn=class{validate(t){let e=this.validateField(t.apiKey),i=this.generateMessage(e);return{validation:e,message:i}}validateField=t=>{let e=null;return t!=null&&t.length>0?e="valid":e="missing",e};generateMessage=t=>{let e=null,i="error";return t==="missing"&&(e="The field apiKey with valid value must be provided to use Fans United JS SDK"),t==="valid"&&(i=null),{text:e,type:i}}};var N=(r=>(r.NATIVE="native",r.ENETPULSE="enetpulse",r.SPORTRADAR="sportradar",r.SPORTAL_365="sportal365",r.API_FOOTBALL="api_football",r))(N||{});var Bn=class{validate(t){let e=this.validateField(t.idSchema),i=this.generateMessage(e);return{validation:e,message:i}}validateField=t=>{let e=Object.values(N),i=null;return t!=null&&t.length>0?e.includes(t)?i="valid":i="invalid":i="missing",i};generateMessage=t=>{let e=null,i="warning";return t==="missing"&&(e="If no idSchema is passed the default one will be set which is: native"),t==="invalid"&&(e="This idSchema value is not supported, the default one will be set which is: native"),t==="valid"&&(e=null,i=null),{text:e,type:i}}};var pe=class{getIdToken=null;logout=null};var pt=class{text=null;type=null};var qi=class{validation=null;message=new pt;getIdToken={validation:null,message:new pt};logout={validation:null,message:new pt}};var Nn=class{validate(t){if(t.cookieToken)return new qi;let e=this.validateAuthProvider(t.authProvider);return e.validation!=="missing"&&(e=this.validateAuthProviderConfigFields(t.authProvider,e),e=this.generateAuthProviderConfigMessages(e),e=this.checkAuthProviderConfigMessagesForErrors(e)),e}validateAuthProvider=t=>{let e=Object.keys(new pe),i=new qi;if(t){let r=Object.keys(t).filter(o=>!e.includes(o));r.length>0?(i.validation="invalid",i.message.type="warning",i.message.text=`${"You have passed a property which is not supported for the authentication provider:"} ${r.join(",")}`):i.validation="valid"}else i.validation="missing",i.message.type="error",i.message.text="The field authProvider must be provided to use this SDK";return i};validateAuthProviderConfigFields=(t,e)=>(Object.keys(new pe).forEach(a=>{t[a]?e[a].validation="valid":e[a].validation="missing"}),e);generateAuthProviderConfigMessages=t=>(Object.keys(t).filter(e=>e!=="validation"&&e!=="message").forEach(e=>{let i=t[e];i.validation==="missing"&&(i.message.text=`${"The following property is missing from the authProvider object:"} ${e}`,i.message.type="error")}),t);checkAuthProviderConfigMessagesForErrors=t=>(Object.keys(t).filter(e=>e!=="validation"&&e!=="message").forEach(e=>{t[e].validation==="missing"&&t.validation==="valid"&&(t.validation="invalid",t.message.type="error",t.message.text="The field authProvider has missing properties")}),t)};var ht=class{validation;message};var kn=class{apiKey=null;environment=null;idSchema=null;clientId=null;lang=null;errorHandlingMode=null;cookieToken={name:new ht,requestHeaders:new ht};oddClient=null;authProvider={getIdToken:new ht,logout:new ht};isValid=!1};var Gn=class{validate(t){let e=this.validateField(t.clientId),i=this.generateMessage(e);return{validation:e,message:i}}validateField=t=>{let e=null;return t!=null&&t.length>0?e="valid":e="missing",e};generateMessage=t=>{let e=null,i="error";return t==="missing"&&(e="The field clientId must be provided to use Fans United JS SDK"),t==="valid"&&(e=null,i=null),{text:e,type:i}}};var Yp=(e=>(e.DEFAULT="default",e.STANDARD="standard",e))(Yp||{});var Un=class{validate=t=>{let e=this.validateField(t.errorHandlingMode),i=this.generateMessage(e);return{validation:e,message:i}};validateField=t=>{let e=["default","standard"],i=null;return t?e.includes(t)?i="valid":i="invalid":i="missing",i};generateMessage=t=>{let e=null,i="warning";return t==="missing"&&(e="If no errorHandlingMode is passed the default one will be set which is: default"),t==="invalid"&&(e="This errorHandlingMode value is not supported, the default one will be set which is: default"),t==="valid"&&(e=null,i=null),{text:e,type:i}}};var Wi=class extends ht{name={validation:null,message:new pt};requestHeaders={validation:null,message:new pt}};var Vn=class{keys=["name","requestHeaders"];isServerSide=typeof document>"u";validate(t){if(!t.cookieToken){let i=new Wi;return i.message={type:null,text:null},i.validation="valid",i}let e=this.validateCookieToken(t.cookieToken);return e=this.validateCookieTokenConfigFields(t.cookieToken,e),e=this.generateCookieTokenConfigMessages(e),e=this.checkCookieTokenConfigMessagesForErrors(e),e}validateCookieToken=t=>{let e=new Wi;e.message={type:null,text:null};let a=Object.keys(t).filter(r=>!this.keys.includes(r));return a.length>0?(e.validation="invalid",e.message.type="warning",e.message.text=`${"You have passed properties which are not supported for the cookie token configuration property:"} ${a.join(",")}`):e.validation="valid",e};validateCookieTokenConfigFields=(t,e)=>(this.keys.forEach(i=>{t[i]?e[i].validation="valid":i==="requestHeaders"&&!this.isServerSide?e[i].validation="valid":e[i].validation="missing"}),e);generateCookieTokenConfigMessages=t=>(Object.keys(t).filter(e=>e!=="validation"&&e!=="message").forEach(e=>{let i=t[e];i.validation==="missing"&&(i.message.text=`${"The following property is missing from the cookieToken object:"} ${e}`,i.message.type="error")}),t);checkCookieTokenConfigMessagesForErrors=t=>(Object.keys(t).filter(e=>e!=="validation"&&e!=="message").forEach(e=>{t[e].validation==="missing"&&(t.validation="invalid",t.message.type="error",t.message.text="The field cookieToken has missing properties")}),t)};var Ki=class extends ht{name={validation:null,message:new pt};credentials={validation:null,message:new pt}};var Hn=class{keys=["name","credentials"];validate=t=>{if(!t.oddClient){let i=new Ki;return i.validation="missing",i.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#/"},i}let e=this.validateOddClient(t.oddClient);return e.message.type==="error"||(e=this.validateOddClientConfigFields(t.oddClient,e),e=this.checkOddClientMissingProperties(e),e.message.type==="error")||(e=this.validateOddClientCredentials(t.oddClient.credentials,e)),e};validateOddClient=t=>{let e=new Ki;if(e.message={type:null,text:null},!(t instanceof Object))return e.validation="invalid",e.message.type="error",e.message.text="The oddClient object is not valid. For more information check our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk#/",e;let a=Object.keys(t).filter(r=>!this.keys.includes(r));return a.length>0?(e.validation="invalid",e.message.type="warning",e.message.text=`${"You have passed properties which are not supported for the odd client configuration property:"} ${a.join(",")}`):e.validation="valid",e};validateOddClientConfigFields=(t,e)=>(this.keys.forEach(i=>{t[i]?e[i].validation="valid":e[i].validation="missing"}),e);validateOddClientCredentials=(t,e)=>{if(!(t instanceof Object))return e.credentials.validation="invalid",e.credentials.message.type="error",e.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#/",e;let i=Object.keys(t),a=["username","password"],r=a.filter(n=>!i.includes(n));r.length>0&&(e.credentials.validation="invalid",e.credentials.message.type="error",e.credentials.message.text=`${"The following property is missing from the odd client credentials object:"} ${r.join(", ")}`),i.length>0&&r.length===0&&(!t.username||!t.password)&&(e.credentials.validation="invalid",e.credentials.message.type="error",e.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 o=i.filter(n=>!a.includes(n));return o.length>0&&(e.credentials.validation="invalid",e.credentials.message.type="warning",e.credentials.message.text=`${"You have passed properties which are not supported for the odd client credentials configuration property:"} ${o.join(", ")}`),e};checkOddClientMissingProperties=t=>(Object.keys(t).filter(e=>e!=="validation"&&e!=="message").forEach(e=>{t[e].validation==="missing"&&(t.validation="invalid",t.message.type="error",t.message.text="The field oddClient has missing properties. For more information check our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk#/")}),t)};var $n=class{validate=t=>{let e=this.checkFieldsForValues(t);return e.isValid=this.containsErrorMessage(e),e};checkFieldsForValues=t=>{let e=new kn,i={apiKey:new Dn,environment:new Ln,idSchema:new Bn,clientId:new Gn,lang:new xn,errorHandlingMode:new Un,authProvider:new Nn,cookieToken:new Vn,oddClient:new Hn};for(let[a,r]of Object.entries(e))a!=="isValid"&&(r=i[a].validate(t));return Object.keys(i).forEach(a=>{e[a]=i[a].validate(t)}),e};containsErrorMessage=t=>{let e=!0;for(let[i,a]of Object.entries(t))if(i!=="authProvider"&&i!=="cookieToken"&&i!=="oddClient"){if(i!=="isValid"&&a.message.type==="error")return e=!1,e;if(i!=="isValid"&&a.message.type==="warning")return e=!0,e}else if(a.message.type==="error"||i==="oddClient"&&a.credentials.message.type==="error")return e=!1,e;return e}};var Xc=s=>{let t=200,e=[],i=0;return e[i]=[],s.forEach(a=>{e[i].length<=t-1?e[i].push(a):(i++,e[i]=[a])}),e},qt=(s,t)=>{let e=[];for(;s.length>t;){let i=s.splice(0,t);e.push(i)}return e.push(s),e},O=(s,t)=>{let e="",i={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"},a={profile:"https://profile.watg.fansunitedapi.com/v1",football:"https://football.watg.fansunitedapi.com/v1",idMapping:"https://id-mapping.watg.fansunitedapi.com/v1",predictor:"https://prediction.watg.fansunitedapi.com/v1",client:"https://client.watg.fansunitedapi.com/v1",loyalty:"https://loyalty.watg.fansunitedapi.com/v1",miniGames:"https://mini-games.watg.fansunitedapi.com/v1",discussions:"https://discussions.watg.fansunitedapi.com/v1",privateLeagues:"https://private-leagues.watg.fansunitedapi.com/v1",voting:"https://voting.watg.fansunitedapi.com/v1"},r={profile:"https://profile.yolo.fansunitedapi.com/v1",football:"https://football.yolo.fansunitedapi.com/v1",idMapping:"https://id-mapping.yolo.fansunitedapi.com/v1",predictor:"https://prediction.yolo.fansunitedapi.com/v1",client:"https://client.yolo.fansunitedapi.com/v1",loyalty:"https://loyalty.yolo.fansunitedapi.com/v1",miniGames:"https://mini-games.yolo.fansunitedapi.com/v1",discussions:"https://discussions.yolo.fansunitedapi.com/v1",privateLeagues:"https://private-leagues.yolo.fansunitedapi.com/v1",voting:"https://voting.yolo.fansunitedapi.com/v1"},o={profile:"https://profile.cska.fansunitedapi.com/v1",football:"https://football.cska.fansunitedapi.com/v1",idMapping:"https://id-mapping.cska.fansunitedapi.com/v1",predictor:"https://prediction.cska.fansunitedapi.com/v1",client:"https://client.cska.fansunitedapi.com/v1",loyalty:"https://loyalty.cska.fansunitedapi.com/v1",miniGames:"https://mini-games.cska.fansunitedapi.com/v1",discussions:"https://discussions.cska.fansunitedapi.com/v1",privateLeagues:"https://private-leagues.cska.fansunitedapi.com/v1",voting:"https://voting.cska.fansunitedapi.com/v1"},n={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"},l={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"};return s==="prod"?e=i[t]:s==="dev"?e=n[t]:s==="watg"?e=a[t]:s==="yolo"?e=r[t]:s==="cska"?e=o[t]:e=l[t],e},ce=s=>Array.from(new Set(s)),f=s=>s||!1,m=()=>`&disable_cache=${Date.now()}`,Xp=s=>JSON.parse(JSON.stringify(s.sort((t,e)=>t.localeCompare(e))));var rt=(P=>(P.FT_1X2="FT_1X2",P.HT_1X2="HT_1X2",P.BOTH_TEAMS_SCORE="BOTH_TEAMS_SCORE",P.DOUBLE_CHANCE="DOUBLE_CHANCE",P.HT_FT="HT_FT",P.PLAYER_SCORE="PLAYER_SCORE",P.PLAYER_YELLOW_CARD="PLAYER_YELLOW_CARD",P.PLAYER_RED_CARD="PLAYER_RED_CARD",P.RED_CARD_MATCH="RED_CARD_MATCH",P.PENALTY_MATCH="PENALTY_MATCH",P.PLAYER_SCORE_FIRST_GOAL="PLAYER_SCORE_FIRST_GOAL",P.CORNERS_MATCH="CORNERS_MATCH",P.CORRECT_SCORE="CORRECT_SCORE",P.CORRECT_SCORE_ADVANCED="CORRECT_SCORE_ADVANCED",P.CORRECT_SCORE_HT="CORRECT_SCORE_HT",P.PLAYER_SCORE_HATTRICK="PLAYER_SCORE_HATTRICK",P.PLAYER_SCORE_TWICE="PLAYER_SCORE_TWICE",P.OVER_GOALS_0_5="OVER_GOALS_0_5",P.OVER_GOALS_1_5="OVER_GOALS_1_5",P.OVER_GOALS_2_5="OVER_GOALS_2_5",P.OVER_GOALS_3_5="OVER_GOALS_3_5",P.OVER_GOALS_4_5="OVER_GOALS_4_5",P.OVER_GOALS_5_5="OVER_GOALS_5_5",P.OVER_GOALS_6_5="OVER_GOALS_6_5",P.OVER_CORNERS_6_5="OVER_CORNERS_6_5",P.OVER_CORNERS_7_5="OVER_CORNERS_7_5",P.OVER_CORNERS_8_5="OVER_CORNERS_8_5",P.OVER_CORNERS_9_5="OVER_CORNERS_9_5",P.OVER_CORNERS_10_5="OVER_CORNERS_10_5",P.OVER_CORNERS_11_5="OVER_CORNERS_11_5",P.OVER_CORNERS_12_5="OVER_CORNERS_12_5",P.OVER_CORNERS_13_5="OVER_CORNERS_13_5",P))(rt||{}),bu=["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"],Mu=["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"],It=["PLAYER_RED_CARD","PLAYER_SCORE","PLAYER_SCORE_FIRST_GOAL","PLAYER_SCORE_HATTRICK","PLAYER_SCORE_TWICE","PLAYER_YELLOW_CARD"],Iu=["FT_1X2","HT_1X2","HT_FT","DOUBLE_CHANCE","CORNERS_MATCH","CORRECT_SCORE","CORRECT_SCORE_HT","CORRECT_SCORE_ADVANCED"],ji="PLAYER_SCORE_FIRST_GOAL";var Yi=class{id="";achievedAt=""};var ue=class{participationCount=null;points=null};var de=class{totalPoints=null;postPoints=null;postsMade=null;reactionPoints=null;reactionCount=null};var me=class{participationCount=null};var mi=class{participations=0;points=0};var Wt=class{footballCompetitions=[];footballTeams=[]};var he=class{predictionsMade=0;correct=0;points=0;breakdown=new Wt};var fe=class{single=new he;topX=new mi;matchQuiz=new mi};var Xi=class{overallPercent;byFootballCompetition;byFootballTeam;byFootballMarket};var Ji=class{profileId;tier;points;predictionsMade;successRates=new Xi;predictions=new fe;tiers=[];badges=[];discussions=new de;classicQuizzes=new ue;eitherOr=new me};var Zi=class{entityId="";entityType="";entitySource="";model=null;predictionsMade=0;correct=0;points=0};var ta=class{successRatePercent;model=null};var Ct=class{content=null;tags=[];campaign=null};var ge=class{id=null;profileId=null;property=null;value=null;action=null;context=new Ct;points=0};var Y=class{currentPage=null;itemsPerPage=null;totalItems=null;numberOfPages=null};var k=class{pagination=new Y};var ea=class{meta=new k;data=[new ge]};var zn=class{remapSingleResponse=t=>{let e=new ge;return e.id=t.id,e.profileId=t.profile_id,e.property=t.property,e.value=t.value,e.action=t.action,e.context.content=t.context.content,e.context.tags=t.context.tags,e.context.campaign=t.context.campaign,e.points=t.points,e};remapActivitiesResponse=t=>{let e=new ea;return e.meta.pagination.currentPage=t.meta.pagination.current_page,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.numberOfPages=t.meta.pagination.number_of_pages,e.meta.pagination.totalItems=t.meta.pagination.total_items,e.data=t.data.map(i=>this.remapSingleResponse(i)),e};remapStatsResponse=t=>{let e=new Ji;return e.profileId=t.profile_id,e.tier=t.tier,e.points=t.points,e.predictionsMade=t.predictions_made,e.successRates.overallPercent=t.success_rates.overall_percent,e.successRates.byFootballCompetition=this.constructNewRecord(t.success_rates.by_competition),e.successRates.byFootballTeam=this.constructNewRecord(t.success_rates.by_team),e.successRates.byFootballMarket=this.constructNewRecord(t.success_rates.by_market),e.predictions=t.predictions?this.remapPredictionsStats(t.predictions):null,e.tiers=t.tiers?this.remapAchievementsStats(t.tiers):null,e.badges=t.badges?this.remapAchievementsStats(t.badges):null,e.discussions=t.discussions?this.remapDiscussionStats(t.discussions):null,e.classicQuizzes=t.classic_quizzes?this.remapClassicQuizStats(t.classic_quizzes):null,e.eitherOr=t.either_or?this.remapEitherOrStats(t.either_or):null,e};constructNewRecord=t=>{let e;if(Object.entries(t).length)Object.entries(t).forEach(([i,a])=>{e={...e,[i]:this.remapSuccessRatePercent(a)},rt[i]&&delete e[i].model});else return t;return e};remapSuccessRatePercent=t=>{let e=new ta;return e.successRatePercent=t.success_rate_percent,e};remapPredictionsStats=t=>{let e=new fe;return e.single=this.remapSinglePredictionsStats(t.single),e.topX=t.top_x,e.matchQuiz=t.match_quiz,e};remapSinglePredictionsStats=t=>{let e=new he;return e.predictionsMade=t.predictions_made,e.correct=t.correct,e.points=t.points,e.breakdown=this.remapBreakdownSinglePredictionsStats(t.breakdown),e};remapBreakdownSinglePredictionsStats=t=>{if(t&&Object.keys(t).length){let e=new Wt,i=[],a=[];return Object.keys(t).forEach(r=>{let o=new Zi;o.entityId=r,o.entityType=t[r].entity_type,o.entitySource=t[r].entity_source,o.predictionsMade=t[r].predictions_made,o.correct=t[r].correct,o.points=t[r].points,o.entityType==="competition"?i.push(o):o.entityType==="team"&&a.push(o)}),e.footballCompetitions=i,e.footballTeams=a,e}return new Wt};remapAchievementsStats=t=>t.map(e=>{let i=new Yi;return i.id=e.id,i.achievedAt=e.achieved_at,i});remapDiscussionStats=t=>{let e=new de;return e.totalPoints=t.total_points,e.postPoints=t.post_points,e.postsMade=t.posts_made,e.reactionPoints=t.reaction_points,e.reactionCount=t.reaction_count,e};remapClassicQuizStats=t=>{let e=new ue;return e.participationCount=t.participation_count,e.points=t.points,e};remapEitherOrStats=t=>{let e=new me;return e.participationCount=t.participation_count,e}};function Jc(s){this.message=s}Jc.prototype=new Error,Jc.prototype.name="InvalidCharacterError";var wu=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(s){var t=String(s).replace(/=+$/,"");if(t.length%4==1)throw new Jc("'atob' failed: The string to be decoded is not correctly encoded.");for(var e,i,a=0,r=0,o="";i=t.charAt(r++);~i&&(e=a%4?64*e+i:i,a++%4)?o+=String.fromCharCode(255&e>>(-2*a&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return o};function hd(s){var t=s.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(e){return decodeURIComponent(wu(e).replace(/(.)/g,function(i,a){var r=a.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r}))}(t)}catch{return wu(t)}}function Jp(s){this.message=s}function fd(s,t){if(typeof s!="string")throw new Jp("Invalid token specified");var e=(t=t||{}).header===!0?0:1;try{return JSON.parse(hd(s.split(".")[e]))}catch(i){throw new Jp("Invalid token specified: "+i.message)}}Jp.prototype=new Error,Jp.prototype.name="InvalidTokenError";var Zc=fd;var C=(a=>(a[a.BAD_METHOD_CALL=400]="BAD_METHOD_CALL",a[a.UNAUTHORIZED=401]="UNAUTHORIZED",a[a.NOT_FOUND=404]="NOT_FOUND",a[a.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",a))(C||{});var A=(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))(A||{});var G={native:"id",sportradar:"sportradar_id",sportal365:"sportal365_id",enetpulse:"enetpulse_id",api_football:"api_football_id"},tu={PREDICTOR_USER_RELATED_OPERATION:"https://docs.fansunitedmedia.com/docs/predictor-operations#user-related-operations"},eu=["matchId","matchType","market","prediction"],_u=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");var x=(w=>(w.INVALID_MATCH_ID="Match id is invalid!",w.INVALID_PLAYER_ID="Player id is invalid!",w.QUERY_PARAM_MATCH_IDS_EXCEEDED="Maximum matchIds in PredictionFilters should be 10 or less.",w.QUERY_PARAM_FILTERS_LIMIT_EXCEEDED="Maximum limit for filtering games is 50 or less.",w.INVALID_FIXTURES_FIELD="Fixtures field is invalid. For more information please visit our documentation",w.INVALID_TOKEN="Invalid JWT token is provided",w.EXPIRED_TOKEN="The provided JWT token is expired",w.ENTITIES_NEEDED="At least one of footballCompetitions, footballTeams or footballPlayers properties should be provided for filters.",w.ENTITIES_FOLLOWS_FILTERS_EXCEEDED="Maximum length per entity should be 24 or less.",w.INVALID_TYPE="You have provided invalid type. The valid type is ",w.INVALID_VALUE="You have provided invalid value. The valid value is ",w.INVALID_AVATAR="Invalid URL syntax for avatar image.",w.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.",w.INVALID_LIMIT="Invalid limit. The maximum limit is: ",w.INVALID_LIMIT_TYPE="Invalid limit type. The proper type is number.",w.FILTER_COMBINATION_ERROR="You need to use both 'entityIds' and 'entityType' filters together",w.INVALID_ENTITY_TYPE="Invalid 'entityType' filter. Please use one of the following valid options: competition, team, or player",w.INVALID_TEMPLATE_GROUP_ID="There is no group in this template with the provided groupId",w.INVALID_TEMPLATE_GROUP_FILTERS="The provided template group has no filters",w.INVALID_PAGE_NUMBER="Invalid page number provided. Use number between 1 and max number of pages.",w.INVALID_DISCUSSION_IDS="Invalid discussion ids argument. Please provide at least one discussion id in an array",w.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.",w.EXCEEDED_EXTENDED_DISCUSSION_IDS="Maximum number of discussion ids exceeded. The maximum number of discussion ids is: ",w.ID_MAPPING_NOT_FOUND="No ID mappings are available for the provided ID. ID argument: ",w.INVALID_PARAM="Invalid parameter provided. Please check the following parameter: ",w.INVALID_COMPETITION_ID="Invalid competition ID provided. Please provide a valid competition ID.",w.INVALID_TEAM_ID="Invalid team ID provided. Please provide a valid team ID.",w.INVALID_OR_EMPTY_IDS="Invalid or empty IDs provided. Please provide at least one ID.",w.INVALID_PROVIDER="Invalid provider. The valid providers are: 'native', 'enetpulse', 'sportal365', 'sportradar' and 'api_football'.",w.INVALID_OUTPUT_PROVIDER="Invalid output provider. The output can not be the same as the input provider.",w.MATCH_SUMMARY_REQUIRED="Match summary is required.",w.MATCH_SUMMARY_PREDICTIONS_REQUIRED="Predictions in match summary are required.",w.INVALID_MATCH_SUMMARY_PREDICTIONS_KEYS="Keys in predictions in match summary are invalid. The valid ones are: ",w.INVALID_COLLECT_LEAD_METHOD_CALL="The method 'collectLead' from Profile namespace is not called correctly. You need to provide 'requestBody' parameter to the method.",w.REQUIRED_FIXTURES_FIELD="Fixtures field is required and should contain at least one fixtures object. For more information please visit our documentation",w.INVALID_TIEBREAKER_FIELD="Tiebreaker field is invalid. It should contain statTotal key with integer value. For more information please visit our documentation",w.ENTITY_IDS_NOT_FOUND="Some of the sport entity IDs were not found for the provided id schema",w.MATCH_IDS_NOT_FOUND="Some of the match IDs were not found for the provided id schema",w.INVALID_STANDING_PREDICTION_ARGUMENT="The prediction argument is invalid. For more information please visit our documentation",w.INVALID_MAP_PLAYERS_ROLES_KEYS="The keys in the players roles map are not part of the valid keys. The valid keys are: ",w.INVALID_MAP_PLAYERS_ROLES_VALUES="The values in the map are not valid. The valid ones are: ",w.INVALID_MATCH_IDS="Match IDs are invalid!",w.MISSING_ODD_CLIENT_CONFIGURATION="Odds namespace requires oddClient configuration to be set",w.INVALID_COLLECT_CONSENTS_METHOD_CALL="The method 'collectConsents' from Profile namespace is not called correctly. You need to provide 'consents' parameter to the method.",w))(x||{}),iu={UNEXPECTED_STATUS_PROP:`Unexpected provided property 'status'. You can NOT use this property for this method. For more information visit our documentation:
1
+ var id=Object.create;var jp=Object.defineProperty;var ad=Object.getOwnPropertyDescriptor;var rd=Object.getOwnPropertyNames;var od=Object.getPrototypeOf,sd=Object.prototype.hasOwnProperty;var nd=(s,t,e)=>t in s?jp(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var ld=(s,t)=>()=>(s&&(t=s(s=0)),t);var An=(s,t)=>()=>(t||s((t={exports:{}}).exports,t),t.exports),pd=(s,t)=>{for(var e in t)jp(s,e,{get:t[e],enumerable:!0})},cd=(s,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of rd(t))!sd.call(s,a)&&a!==e&&jp(s,a,{get:()=>t[a],enumerable:!(i=ad(t,a))||i.enumerable});return s};var ud=(s,t,e)=>(e=s!=null?id(od(s)):{},cd(t||!s||!s.__esModule?jp(e,"default",{value:s,enumerable:!0}):e,s));var at=(s,t,e)=>(nd(s,typeof t!="symbol"?t+"":t,e),e);var Su={};pd(Su,{default:()=>yd});var gd,yd,vu=ld(()=>{gd={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},yd=gd});var Cu=An((Lf,ec)=>{var bd=function(){"use strict";function s(c,u){return u!=null&&c instanceof u}var t;try{t=Map}catch{t=function(){}}var e;try{e=Set}catch{e=function(){}}var i;try{i=Promise}catch{i=function(){}}function a(c,u,d,M,_){typeof u=="object"&&(d=u.depth,M=u.prototype,_=u.includeNonEnumerable,u=u.circular);var B=[],ui=[],di=typeof Buffer<"u";typeof u>"u"&&(u=!0),typeof d>"u"&&(d=1/0);function lt(g,zt){if(g===null)return null;if(zt===0)return g;var U,Sn;if(typeof g!="object")return g;if(s(g,t))U=new t;else if(s(g,e))U=new e;else if(s(g,i))U=new i(function(vn,P){g.then(function(Cn){vn(lt(Cn,zt-1))},function(Cn){P(lt(Cn,zt-1))})});else if(a.__isArray(g))U=[];else if(a.__isRegExp(g))U=new RegExp(g.source,p(g)),g.lastIndex&&(U.lastIndex=g.lastIndex);else if(a.__isDate(g))U=new Date(g.getTime());else{if(di&&Buffer.isBuffer(g))return Buffer.allocUnsafe?U=Buffer.allocUnsafe(g.length):U=new Buffer(g.length),g.copy(U),U;s(g,Error)?U=Object.create(g):typeof M>"u"?(Sn=Object.getPrototypeOf(g),U=Object.create(Sn)):(U=Object.create(M),Sn=M)}if(u){var gu=B.indexOf(g);if(gu!=-1)return ui[gu];B.push(g),ui.push(U)}s(g,t)&&g.forEach(function(vn,P){var Cn=lt(P,zt-1),ed=lt(vn,zt-1);U.set(Cn,ed)}),s(g,e)&&g.forEach(function(vn){var P=lt(vn,zt-1);U.add(P)});for(var Mt in g){var F;Sn&&(F=Object.getOwnPropertyDescriptor(Sn,Mt)),!(F&&F.set==null)&&(U[Mt]=lt(g[Mt],zt-1))}if(Object.getOwnPropertySymbols)for(var yu=Object.getOwnPropertySymbols(g),Mt=0;Mt<yu.length;Mt++){var Wp=yu[Mt],zi=Object.getOwnPropertyDescriptor(g,Wp);zi&&!zi.enumerable&&!_||(U[Wp]=lt(g[Wp],zt-1),zi.enumerable||Object.defineProperty(U,Wp,{enumerable:!1}))}if(_)for(var E=Object.getOwnPropertyNames(g),Mt=0;Mt<E.length;Mt++){var Kp=E[Mt],zi=Object.getOwnPropertyDescriptor(g,Kp);zi&&zi.enumerable||(U[Kp]=lt(g[Kp],zt-1),Object.defineProperty(U,Kp,{enumerable:!1}))}return U}return lt(c,d)}a.clonePrototype=function(u){if(u===null)return null;var d=function(){};return d.prototype=u,new d};function r(c){return Object.prototype.toString.call(c)}a.__objToStr=r;function o(c){return typeof c=="object"&&r(c)==="[object Date]"}a.__isDate=o;function n(c){return typeof c=="object"&&r(c)==="[object Array]"}a.__isArray=n;function l(c){return typeof c=="object"&&r(c)==="[object RegExp]"}a.__isRegExp=l;function p(c){var u="";return c.global&&(u+="g"),c.ignoreCase&&(u+="i"),c.multiline&&(u+="m"),u}return a.__getRegExpFlags=p,a}();typeof ec=="object"&&ec.exports&&(ec.exports=bd)});var Vu=An((Df,nu)=>{"use strict";var sa=typeof Reflect=="object"?Reflect:null,Au=sa&&typeof sa.apply=="function"?sa.apply:function(t,e,i){return Function.prototype.apply.call(t,e,i)},ic;sa&&typeof sa.ownKeys=="function"?ic=sa.ownKeys:Object.getOwnPropertySymbols?ic=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:ic=function(t){return Object.getOwnPropertyNames(t)};function Md(s){console&&console.warn&&console.warn(s)}var xu=Number.isNaN||function(t){return t!==t};function S(){S.init.call(this)}nu.exports=S;nu.exports.once=Pd;S.EventEmitter=S;S.prototype._events=void 0;S.prototype._eventsCount=0;S.prototype._maxListeners=void 0;var Ou=10;function ac(s){if(typeof s!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof s)}Object.defineProperty(S,"defaultMaxListeners",{enumerable:!0,get:function(){return Ou},set:function(s){if(typeof s!="number"||s<0||xu(s))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+s+".");Ou=s}});S.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};S.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||xu(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function Lu(s){return s._maxListeners===void 0?S.defaultMaxListeners:s._maxListeners}S.prototype.getMaxListeners=function(){return Lu(this)};S.prototype.emit=function(t){for(var e=[],i=1;i<arguments.length;i++)e.push(arguments[i]);var a=t==="error",r=this._events;if(r!==void 0)a=a&&r.error===void 0;else if(!a)return!1;if(a){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var n=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw n.context=o,n}var l=r[t];if(l===void 0)return!1;if(typeof l=="function")Au(l,this,e);else for(var p=l.length,c=Gu(l,p),i=0;i<p;++i)Au(c[i],this,e);return!0};function Du(s,t,e,i){var a,r,o;if(ac(e),r=s._events,r===void 0?(r=s._events=Object.create(null),s._eventsCount=0):(r.newListener!==void 0&&(s.emit("newListener",t,e.listener?e.listener:e),r=s._events),o=r[t]),o===void 0)o=r[t]=e,++s._eventsCount;else if(typeof o=="function"?o=r[t]=i?[e,o]:[o,e]:i?o.unshift(e):o.push(e),a=Lu(s),a>0&&o.length>a&&!o.warned){o.warned=!0;var n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");n.name="MaxListenersExceededWarning",n.emitter=s,n.type=t,n.count=o.length,Md(n)}return s}S.prototype.addListener=function(t,e){return Du(this,t,e,!1)};S.prototype.on=S.prototype.addListener;S.prototype.prependListener=function(t,e){return Du(this,t,e,!0)};function Id(){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 Bu(s,t,e){var i={fired:!1,wrapFn:void 0,target:s,type:t,listener:e},a=Id.bind(i);return a.listener=e,i.wrapFn=a,a}S.prototype.once=function(t,e){return ac(e),this.on(t,Bu(this,t,e)),this};S.prototype.prependOnceListener=function(t,e){return ac(e),this.prependListener(t,Bu(this,t,e)),this};S.prototype.removeListener=function(t,e){var i,a,r,o,n;if(ac(e),a=this._events,a===void 0)return this;if(i=a[t],i===void 0)return this;if(i===e||i.listener===e)--this._eventsCount===0?this._events=Object.create(null):(delete a[t],a.removeListener&&this.emit("removeListener",t,i.listener||e));else if(typeof i!="function"){for(r=-1,o=i.length-1;o>=0;o--)if(i[o]===e||i[o].listener===e){n=i[o].listener,r=o;break}if(r<0)return this;r===0?i.shift():wd(i,r),i.length===1&&(a[t]=i[0]),a.removeListener!==void 0&&this.emit("removeListener",t,n||e)}return this};S.prototype.off=S.prototype.removeListener;S.prototype.removeAllListeners=function(t){var e,i,a;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[t]),this;if(arguments.length===0){var r=Object.keys(i),o;for(a=0;a<r.length;++a)o=r[a],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(e=i[t],typeof e=="function")this.removeListener(t,e);else if(e!==void 0)for(a=e.length-1;a>=0;a--)this.removeListener(t,e[a]);return this};function Nu(s,t,e){var i=s._events;if(i===void 0)return[];var a=i[t];return a===void 0?[]:typeof a=="function"?e?[a.listener||a]:[a]:e?_d(a):Gu(a,a.length)}S.prototype.listeners=function(t){return Nu(this,t,!0)};S.prototype.rawListeners=function(t){return Nu(this,t,!1)};S.listenerCount=function(s,t){return typeof s.listenerCount=="function"?s.listenerCount(t):ku.call(s,t)};S.prototype.listenerCount=ku;function ku(s){var t=this._events;if(t!==void 0){var e=t[s];if(typeof e=="function")return 1;if(e!==void 0)return e.length}return 0}S.prototype.eventNames=function(){return this._eventsCount>0?ic(this._events):[]};function Gu(s,t){for(var e=new Array(t),i=0;i<t;++i)e[i]=s[i];return e}function wd(s,t){for(;t+1<s.length;t++)s[t]=s[t+1];s.pop()}function _d(s){for(var t=new Array(s.length),e=0;e<t.length;++e)t[e]=s[e].listener||s[e];return t}function Pd(s,t){return new Promise(function(e,i){function a(o){s.removeListener(t,r),i(o)}function r(){typeof s.removeListener=="function"&&s.removeListener("error",a),e([].slice.call(arguments))}Uu(s,t,r,{once:!0}),t!=="error"&&Td(s,a,{once:!0})})}function Td(s,t,e){typeof s.on=="function"&&Uu(s,"error",t,e)}function Uu(s,t,e,i){if(typeof s.on=="function")i.once?s.once(t,e):s.on(t,e);else if(typeof s.addEventListener=="function")s.addEventListener(t,function a(r){i.once&&s.removeEventListener(t,a),e(r)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof s)}});var zu=An((Hu,$u)=>{(function(){var s,t,e,i=[].splice,a=function(o,n){if(!(o instanceof n))throw new Error("Bound instance method accessed before binding")},r=[].indexOf;e=Cu(),s=Vu().EventEmitter,$u.exports=t=function(){class o extends s{constructor(l={}){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=l,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(p=>{var c;c=this[p],this[p]=function(...u){var d,M,_,B;if(_=u,[...u]=_,[d]=i.call(u,-1),typeof d=="function")try{B=c(...u),d(null,B)}catch(ui){M=ui,d(M)}else return c(...u,d)}})),this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this.validKeyTypes=["string","number"],this._checkData()}get(l){var p,c;if(a(this,o),(c=this._isInvalidKey(l))!=null)throw c;if(this.data[l]!=null&&this._check(l,this.data[l]))return this.stats.hits++,p=this._unwrap(this.data[l]),p;this.stats.misses++}mget(l){var p,c,u,d,M,_;if(a(this,o),!Array.isArray(l))throw p=this._error("EKEYSTYPE"),p;for(_={},u=0,M=l.length;u<M;u++){if(d=l[u],(c=this._isInvalidKey(d))!=null)throw c;this.data[d]!=null&&this._check(d,this.data[d])?(this.stats.hits++,_[d]=this._unwrap(this.data[d])):this.stats.misses++}return _}set(l,p,c){var u,d,M;if(a(this,o),this.options.maxKeys>-1&&this.stats.keys>=this.options.maxKeys)throw u=this._error("ECACHEFULL"),u;if(this.options.forceString&&!typeof p==="string"&&(p=JSON.stringify(p)),c==null&&(c=this.options.stdTTL),(d=this._isInvalidKey(l))!=null)throw d;return M=!1,this.data[l]&&(M=!0,this.stats.vsize-=this._getValLength(this._unwrap(this.data[l],!1))),this.data[l]=this._wrap(p,c),this.stats.vsize+=this._getValLength(p),M||(this.stats.ksize+=this._getKeyLength(l),this.stats.keys++),this.emit("set",l,p),!0}mset(l){var p,c,u,d,M,_,B,ui,di,lt;if(a(this,o),this.options.maxKeys>-1&&this.stats.keys+l.length>=this.options.maxKeys)throw p=this._error("ECACHEFULL"),p;for(u=0,B=l.length;u<B;u++){if(_=l[u],{key:M,val:lt,ttl:di}=_,di&&typeof di!="number")throw p=this._error("ETTLTYPE"),p;if((c=this._isInvalidKey(M))!=null)throw c}for(d=0,ui=l.length;d<ui;d++)_=l[d],{key:M,val:lt,ttl:di}=_,this.set(M,lt,di);return!0}del(l){var p,c,u,d,M,_;for(a(this,o),Array.isArray(l)||(l=[l]),p=0,u=0,M=l.length;u<M;u++){if(d=l[u],(c=this._isInvalidKey(d))!=null)throw c;this.data[d]!=null&&(this.stats.vsize-=this._getValLength(this._unwrap(this.data[d],!1)),this.stats.ksize-=this._getKeyLength(d),this.stats.keys--,p++,_=this.data[d],delete this.data[d],this.emit("del",d,_.v))}return p}take(l){var p;return a(this,o),p=this.get(l),p!=null&&this.del(l),p}ttl(l,p){var c;if(a(this,o),p||(p=this.options.stdTTL),!l)return!1;if((c=this._isInvalidKey(l))!=null)throw c;return this.data[l]!=null&&this._check(l,this.data[l])?(p>=0?this.data[l]=this._wrap(this.data[l].v,p,!1):this.del(l),!0):!1}getTtl(l){var p,c;if(a(this,o),!!l){if((c=this._isInvalidKey(l))!=null)throw c;if(this.data[l]!=null&&this._check(l,this.data[l]))return p=this.data[l].t,p}}keys(){var l;return a(this,o),l=Object.keys(this.data),l}has(l){var p;return a(this,o),p=this.data[l]!=null&&this._check(l,this.data[l]),p}getStats(){return a(this,o),this.stats}flushAll(l=!0){a(this,o),this.data={},this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this._killCheckPeriod(),this._checkData(l),this.emit("flush")}flushStats(){a(this,o),this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this.emit("flush_stats")}close(){a(this,o),this._killCheckPeriod()}_checkData(l=!0){var p,c,u;a(this,o),c=this.data;for(p in c)u=c[p],this._check(p,u);l&&this.options.checkperiod>0&&(this.checkTimeout=setTimeout(this._checkData,this.options.checkperiod*1e3,l),this.checkTimeout!=null&&this.checkTimeout.unref!=null&&this.checkTimeout.unref())}_killCheckPeriod(){if(this.checkTimeout!=null)return clearTimeout(this.checkTimeout)}_check(l,p){var c;return a(this,o),c=!0,p.t!==0&&p.t<Date.now()&&(this.options.deleteOnExpire&&(c=!1,this.del(l)),this.emit("expired",l,this._unwrap(p))),c}_isInvalidKey(l){var p;if(a(this,o),p=typeof l,r.call(this.validKeyTypes,p)<0)return this._error("EKEYTYPE",{type:typeof l})}_wrap(l,p,c=!0){var u,d,M,_;return a(this,o),this.options.useClones||(c=!1),d=Date.now(),u=0,_=1e3,p===0?u=0:p?u=d+p*_:this.options.stdTTL===0?u=this.options.stdTTL:u=d+this.options.stdTTL*_,M={t:u,v:c?e(l):l}}_unwrap(l,p=!0){return this.options.useClones||(p=!1),l.v!=null?p?e(l.v):l.v:null}_getKeyLength(l){return l.toString().length}_getValLength(l){return a(this,o),typeof l=="string"?l.length:this.options.forceString?JSON.stringify(l).length:Array.isArray(l)?this.options.arrayValueSize*l.length:typeof l=="number"?8:typeof l?.then=="function"?this.options.promiseValueSize:typeof Buffer<"u"&&Buffer!==null&&Buffer.isBuffer(l)?l.length:l!=null&&typeof l=="object"?this.options.objectValueSize*Object.keys(l).length:typeof l=="boolean"?8:0}_error(l,p={}){var c;return a(this,o),c=new Error,c.name=l,c.errorcode=l,c.message=this.ERRORS[l]!=null?this.ERRORS[l](p):"-",c.data=p,c}_initErrors(){var l,p,c;a(this,o),this.ERRORS={},c=this._ERRORS;for(p in c)l=c[p],this.ERRORS[p]=this.createErrorMessage(l)}createErrorMessage(l){return function(p){return l.replace("__key",p.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(Hu)});var Wu=An((Qu,qu)=>{(function(){var s;s=qu.exports=zu(),s.version="5.1.2"}).call(Qu)});var Zu=An((Qj,Od)=>{Od.exports={name:"fansunited-sdk-esm",version:"1.117.3",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}});var On=(_=>(_.EN="en",_.BG="bg",_.RO="ro",_.EL="el",_.SK="sk",_.PT="pt",_.SR="sr",_.HU="hu",_.SV="sv",_.ES="es",_.FR="fr",_.NL="nl",_.DE="de",_.IT="it",_))(On||{});var xn=class{validate=t=>{let e=this.validateField(t.lang),i=this.generateMessage(e);return{validation:e,message:i}};validateField=t=>{let e=Object.values(On),i=null;return t!=null&&t.length>0?e.includes(t)?i="valid":i="invalid":i="missing",i};generateMessage=t=>{let e=null,i="warning";return t==="missing"&&(e="If no lang is passed the default one will be set which is: en"),t==="invalid"&&(e="This lang value is not supported, the default one will be set which is: en"),t==="valid"&&(e=null,i=null),{text:e,type:i}}};var Qi=(o=>(o.DEV="dev",o.PROD="prod",o.STAGING="staging",o.WATG="watg",o.YOLO="yolo",o.CSKA="cska",o))(Qi||{});var Ln=class{validate(t){let e=this.validateField(t.environment),i=this.generateMessage(e);return{validation:e,message:i}}validateField=t=>{let e=Object.values(Qi),i=null;return t!=null&&t.length>0?e.includes(t)?i="valid":i="invalid":i="missing",i};generateMessage=t=>{let e=null,i="warning";return t==="missing"&&(e="If no environment is passed the default one will be set which is: prod"),t==="invalid"&&(e="This environment value is not supported, the default one will be set which is: prod"),t==="valid"&&(e=null,i=null),{text:e,type:i}}};var Dn=class{validate(t){let e=this.validateField(t.apiKey),i=this.generateMessage(e);return{validation:e,message:i}}validateField=t=>{let e=null;return t!=null&&t.length>0?e="valid":e="missing",e};generateMessage=t=>{let e=null,i="error";return t==="missing"&&(e="The field apiKey with valid value must be provided to use Fans United JS SDK"),t==="valid"&&(i=null),{text:e,type:i}}};var N=(r=>(r.NATIVE="native",r.ENETPULSE="enetpulse",r.SPORTRADAR="sportradar",r.SPORTAL_365="sportal365",r.API_FOOTBALL="api_football",r))(N||{});var Bn=class{validate(t){let e=this.validateField(t.idSchema),i=this.generateMessage(e);return{validation:e,message:i}}validateField=t=>{let e=Object.values(N),i=null;return t!=null&&t.length>0?e.includes(t)?i="valid":i="invalid":i="missing",i};generateMessage=t=>{let e=null,i="warning";return t==="missing"&&(e="If no idSchema is passed the default one will be set which is: native"),t==="invalid"&&(e="This idSchema value is not supported, the default one will be set which is: native"),t==="valid"&&(e=null,i=null),{text:e,type:i}}};var pe=class{getIdToken=null;logout=null};var pt=class{text=null;type=null};var qi=class{validation=null;message=new pt;getIdToken={validation:null,message:new pt};logout={validation:null,message:new pt}};var Nn=class{validate(t){if(t.cookieToken)return new qi;let e=this.validateAuthProvider(t.authProvider);return e.validation!=="missing"&&(e=this.validateAuthProviderConfigFields(t.authProvider,e),e=this.generateAuthProviderConfigMessages(e),e=this.checkAuthProviderConfigMessagesForErrors(e)),e}validateAuthProvider=t=>{let e=Object.keys(new pe),i=new qi;if(t){let r=Object.keys(t).filter(o=>!e.includes(o));r.length>0?(i.validation="invalid",i.message.type="warning",i.message.text=`${"You have passed a property which is not supported for the authentication provider:"} ${r.join(",")}`):i.validation="valid"}else i.validation="missing",i.message.type="error",i.message.text="The field authProvider must be provided to use this SDK";return i};validateAuthProviderConfigFields=(t,e)=>(Object.keys(new pe).forEach(a=>{t[a]?e[a].validation="valid":e[a].validation="missing"}),e);generateAuthProviderConfigMessages=t=>(Object.keys(t).filter(e=>e!=="validation"&&e!=="message").forEach(e=>{let i=t[e];i.validation==="missing"&&(i.message.text=`${"The following property is missing from the authProvider object:"} ${e}`,i.message.type="error")}),t);checkAuthProviderConfigMessagesForErrors=t=>(Object.keys(t).filter(e=>e!=="validation"&&e!=="message").forEach(e=>{t[e].validation==="missing"&&t.validation==="valid"&&(t.validation="invalid",t.message.type="error",t.message.text="The field authProvider has missing properties")}),t)};var ht=class{validation;message};var kn=class{apiKey=null;environment=null;idSchema=null;clientId=null;lang=null;errorHandlingMode=null;cookieToken={name:new ht,requestHeaders:new ht};oddClient=null;authProvider={getIdToken:new ht,logout:new ht};isValid=!1};var Gn=class{validate(t){let e=this.validateField(t.clientId),i=this.generateMessage(e);return{validation:e,message:i}}validateField=t=>{let e=null;return t!=null&&t.length>0?e="valid":e="missing",e};generateMessage=t=>{let e=null,i="error";return t==="missing"&&(e="The field clientId must be provided to use Fans United JS SDK"),t==="valid"&&(e=null,i=null),{text:e,type:i}}};var Yp=(e=>(e.DEFAULT="default",e.STANDARD="standard",e))(Yp||{});var Un=class{validate=t=>{let e=this.validateField(t.errorHandlingMode),i=this.generateMessage(e);return{validation:e,message:i}};validateField=t=>{let e=["default","standard"],i=null;return t?e.includes(t)?i="valid":i="invalid":i="missing",i};generateMessage=t=>{let e=null,i="warning";return t==="missing"&&(e="If no errorHandlingMode is passed the default one will be set which is: default"),t==="invalid"&&(e="This errorHandlingMode value is not supported, the default one will be set which is: default"),t==="valid"&&(e=null,i=null),{text:e,type:i}}};var Wi=class extends ht{name={validation:null,message:new pt};requestHeaders={validation:null,message:new pt}};var Vn=class{keys=["name","requestHeaders"];isServerSide=typeof document>"u";validate(t){if(!t.cookieToken){let i=new Wi;return i.message={type:null,text:null},i.validation="valid",i}let e=this.validateCookieToken(t.cookieToken);return e=this.validateCookieTokenConfigFields(t.cookieToken,e),e=this.generateCookieTokenConfigMessages(e),e=this.checkCookieTokenConfigMessagesForErrors(e),e}validateCookieToken=t=>{let e=new Wi;e.message={type:null,text:null};let a=Object.keys(t).filter(r=>!this.keys.includes(r));return a.length>0?(e.validation="invalid",e.message.type="warning",e.message.text=`${"You have passed properties which are not supported for the cookie token configuration property:"} ${a.join(",")}`):e.validation="valid",e};validateCookieTokenConfigFields=(t,e)=>(this.keys.forEach(i=>{t[i]?e[i].validation="valid":i==="requestHeaders"&&!this.isServerSide?e[i].validation="valid":e[i].validation="missing"}),e);generateCookieTokenConfigMessages=t=>(Object.keys(t).filter(e=>e!=="validation"&&e!=="message").forEach(e=>{let i=t[e];i.validation==="missing"&&(i.message.text=`${"The following property is missing from the cookieToken object:"} ${e}`,i.message.type="error")}),t);checkCookieTokenConfigMessagesForErrors=t=>(Object.keys(t).filter(e=>e!=="validation"&&e!=="message").forEach(e=>{t[e].validation==="missing"&&(t.validation="invalid",t.message.type="error",t.message.text="The field cookieToken has missing properties")}),t)};var Ki=class extends ht{name={validation:null,message:new pt};credentials={validation:null,message:new pt}};var Hn=class{keys=["name","credentials"];validate=t=>{if(!t.oddClient){let i=new Ki;return i.validation="missing",i.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#/"},i}let e=this.validateOddClient(t.oddClient);return e.message.type==="error"||(e=this.validateOddClientConfigFields(t.oddClient,e),e=this.checkOddClientMissingProperties(e),e.message.type==="error")||(e=this.validateOddClientCredentials(t.oddClient.credentials,e)),e};validateOddClient=t=>{let e=new Ki;if(e.message={type:null,text:null},!(t instanceof Object))return e.validation="invalid",e.message.type="error",e.message.text="The oddClient object is not valid. For more information check our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk#/",e;let a=Object.keys(t).filter(r=>!this.keys.includes(r));return a.length>0?(e.validation="invalid",e.message.type="warning",e.message.text=`${"You have passed properties which are not supported for the odd client configuration property:"} ${a.join(",")}`):e.validation="valid",e};validateOddClientConfigFields=(t,e)=>(this.keys.forEach(i=>{t[i]?e[i].validation="valid":e[i].validation="missing"}),e);validateOddClientCredentials=(t,e)=>{if(!(t instanceof Object))return e.credentials.validation="invalid",e.credentials.message.type="error",e.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#/",e;let i=Object.keys(t),a=["username","password"],r=a.filter(n=>!i.includes(n));r.length>0&&(e.credentials.validation="invalid",e.credentials.message.type="error",e.credentials.message.text=`${"The following property is missing from the odd client credentials object:"} ${r.join(", ")}`),i.length>0&&r.length===0&&(!t.username||!t.password)&&(e.credentials.validation="invalid",e.credentials.message.type="error",e.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 o=i.filter(n=>!a.includes(n));return o.length>0&&(e.credentials.validation="invalid",e.credentials.message.type="warning",e.credentials.message.text=`${"You have passed properties which are not supported for the odd client credentials configuration property:"} ${o.join(", ")}`),e};checkOddClientMissingProperties=t=>(Object.keys(t).filter(e=>e!=="validation"&&e!=="message").forEach(e=>{t[e].validation==="missing"&&(t.validation="invalid",t.message.type="error",t.message.text="The field oddClient has missing properties. For more information check our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk#/")}),t)};var $n=class{validate=t=>{let e=this.checkFieldsForValues(t);return e.isValid=this.containsErrorMessage(e),e};checkFieldsForValues=t=>{let e=new kn,i={apiKey:new Dn,environment:new Ln,idSchema:new Bn,clientId:new Gn,lang:new xn,errorHandlingMode:new Un,authProvider:new Nn,cookieToken:new Vn,oddClient:new Hn};for(let[a,r]of Object.entries(e))a!=="isValid"&&(r=i[a].validate(t));return Object.keys(i).forEach(a=>{e[a]=i[a].validate(t)}),e};containsErrorMessage=t=>{let e=!0;for(let[i,a]of Object.entries(t))if(i!=="authProvider"&&i!=="cookieToken"&&i!=="oddClient"){if(i!=="isValid"&&a.message.type==="error")return e=!1,e;if(i!=="isValid"&&a.message.type==="warning")return e=!0,e}else if(a.message.type==="error"||i==="oddClient"&&a.credentials.message.type==="error")return e=!1,e;return e}};var Xc=s=>{let t=200,e=[],i=0;return e[i]=[],s.forEach(a=>{e[i].length<=t-1?e[i].push(a):(i++,e[i]=[a])}),e},qt=(s,t)=>{let e=[];for(;s.length>t;){let i=s.splice(0,t);e.push(i)}return e.push(s),e},O=(s,t)=>{let e="",i={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"},a={profile:"https://profile.watg.fansunitedapi.com/v1",football:"https://football.watg.fansunitedapi.com/v1",idMapping:"https://id-mapping.watg.fansunitedapi.com/v1",predictor:"https://prediction.watg.fansunitedapi.com/v1",client:"https://client.watg.fansunitedapi.com/v1",loyalty:"https://loyalty.watg.fansunitedapi.com/v1",miniGames:"https://mini-games.watg.fansunitedapi.com/v1",discussions:"https://discussions.watg.fansunitedapi.com/v1",privateLeagues:"https://private-leagues.watg.fansunitedapi.com/v1",voting:"https://voting.watg.fansunitedapi.com/v1"},r={profile:"https://profile.yolo.fansunitedapi.com/v1",football:"https://football.yolo.fansunitedapi.com/v1",idMapping:"https://id-mapping.yolo.fansunitedapi.com/v1",predictor:"https://prediction.yolo.fansunitedapi.com/v1",client:"https://client.yolo.fansunitedapi.com/v1",loyalty:"https://loyalty.yolo.fansunitedapi.com/v1",miniGames:"https://mini-games.yolo.fansunitedapi.com/v1",discussions:"https://discussions.yolo.fansunitedapi.com/v1",privateLeagues:"https://private-leagues.yolo.fansunitedapi.com/v1",voting:"https://voting.yolo.fansunitedapi.com/v1"},o={profile:"https://profile.cska.fansunitedapi.com/v1",football:"https://football.cska.fansunitedapi.com/v1",idMapping:"https://id-mapping.cska.fansunitedapi.com/v1",predictor:"https://prediction.cska.fansunitedapi.com/v1",client:"https://client.cska.fansunitedapi.com/v1",loyalty:"https://loyalty.cska.fansunitedapi.com/v1",miniGames:"https://mini-games.cska.fansunitedapi.com/v1",discussions:"https://discussions.cska.fansunitedapi.com/v1",privateLeagues:"https://private-leagues.cska.fansunitedapi.com/v1",voting:"https://voting.cska.fansunitedapi.com/v1"},n={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"},l={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"};return s==="prod"?e=i[t]:s==="dev"?e=n[t]:s==="watg"?e=a[t]:s==="yolo"?e=r[t]:s==="cska"?e=o[t]:e=l[t],e},ce=s=>Array.from(new Set(s)),f=s=>s||!1,m=()=>`&disable_cache=${Date.now()}`,Xp=s=>JSON.parse(JSON.stringify(s.sort((t,e)=>t.localeCompare(e))));var rt=(P=>(P.FT_1X2="FT_1X2",P.HT_1X2="HT_1X2",P.BOTH_TEAMS_SCORE="BOTH_TEAMS_SCORE",P.DOUBLE_CHANCE="DOUBLE_CHANCE",P.HT_FT="HT_FT",P.PLAYER_SCORE="PLAYER_SCORE",P.PLAYER_YELLOW_CARD="PLAYER_YELLOW_CARD",P.PLAYER_RED_CARD="PLAYER_RED_CARD",P.RED_CARD_MATCH="RED_CARD_MATCH",P.PENALTY_MATCH="PENALTY_MATCH",P.PLAYER_SCORE_FIRST_GOAL="PLAYER_SCORE_FIRST_GOAL",P.CORNERS_MATCH="CORNERS_MATCH",P.CORRECT_SCORE="CORRECT_SCORE",P.CORRECT_SCORE_ADVANCED="CORRECT_SCORE_ADVANCED",P.CORRECT_SCORE_HT="CORRECT_SCORE_HT",P.PLAYER_SCORE_HATTRICK="PLAYER_SCORE_HATTRICK",P.PLAYER_SCORE_TWICE="PLAYER_SCORE_TWICE",P.OVER_GOALS_0_5="OVER_GOALS_0_5",P.OVER_GOALS_1_5="OVER_GOALS_1_5",P.OVER_GOALS_2_5="OVER_GOALS_2_5",P.OVER_GOALS_3_5="OVER_GOALS_3_5",P.OVER_GOALS_4_5="OVER_GOALS_4_5",P.OVER_GOALS_5_5="OVER_GOALS_5_5",P.OVER_GOALS_6_5="OVER_GOALS_6_5",P.OVER_CORNERS_6_5="OVER_CORNERS_6_5",P.OVER_CORNERS_7_5="OVER_CORNERS_7_5",P.OVER_CORNERS_8_5="OVER_CORNERS_8_5",P.OVER_CORNERS_9_5="OVER_CORNERS_9_5",P.OVER_CORNERS_10_5="OVER_CORNERS_10_5",P.OVER_CORNERS_11_5="OVER_CORNERS_11_5",P.OVER_CORNERS_12_5="OVER_CORNERS_12_5",P.OVER_CORNERS_13_5="OVER_CORNERS_13_5",P))(rt||{}),bu=["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"],Mu=["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"],It=["PLAYER_RED_CARD","PLAYER_SCORE","PLAYER_SCORE_FIRST_GOAL","PLAYER_SCORE_HATTRICK","PLAYER_SCORE_TWICE","PLAYER_YELLOW_CARD"],Iu=["FT_1X2","HT_1X2","HT_FT","DOUBLE_CHANCE","CORNERS_MATCH","CORRECT_SCORE","CORRECT_SCORE_HT","CORRECT_SCORE_ADVANCED"],ji="PLAYER_SCORE_FIRST_GOAL";var Yi=class{id="";achievedAt=""};var ue=class{participationCount=null;points=null};var de=class{totalPoints=null;postPoints=null;postsMade=null;reactionPoints=null;reactionCount=null};var me=class{participationCount=null};var mi=class{participations=0;points=0};var Wt=class{footballCompetitions=[];footballTeams=[]};var he=class{predictionsMade=0;correct=0;points=0;breakdown=new Wt};var fe=class{single=new he;topX=new mi;matchQuiz=new mi};var Xi=class{overallPercent;byFootballCompetition;byFootballTeam;byFootballMarket};var Ji=class{profileId;tier;points;predictionsMade;successRates=new Xi;predictions=new fe;tiers=[];badges=[];discussions=new de;classicQuizzes=new ue;eitherOr=new me};var Zi=class{entityId="";entityType="";entitySource="";model=null;predictionsMade=0;correct=0;points=0};var ta=class{successRatePercent;model=null};var Ct=class{content=null;tags=[];campaign=null};var ge=class{id=null;profileId=null;property=null;value=null;action=null;context=new Ct;points=0};var Y=class{currentPage=null;itemsPerPage=null;totalItems=null;numberOfPages=null};var k=class{pagination=new Y};var ea=class{meta=new k;data=[new ge]};var zn=class{remapSingleResponse=t=>{let e=new ge;return e.id=t.id,e.profileId=t.profile_id,e.property=t.property,e.value=t.value,e.action=t.action,e.context.content=t.context.content,e.context.tags=t.context.tags,e.context.campaign=t.context.campaign,e.points=t.points,e};remapActivitiesResponse=t=>{let e=new ea;return e.meta.pagination.currentPage=t.meta.pagination.current_page,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.numberOfPages=t.meta.pagination.number_of_pages,e.meta.pagination.totalItems=t.meta.pagination.total_items,e.data=t.data.map(i=>this.remapSingleResponse(i)),e};remapStatsResponse=t=>{let e=new Ji;return e.profileId=t.profile_id,e.tier=t.tier,e.points=t.points,e.predictionsMade=t.predictions_made,e.successRates.overallPercent=t.success_rates.overall_percent,e.successRates.byFootballCompetition=this.constructNewRecord(t.success_rates.by_competition),e.successRates.byFootballTeam=this.constructNewRecord(t.success_rates.by_team),e.successRates.byFootballMarket=this.constructNewRecord(t.success_rates.by_market),e.predictions=t.predictions?this.remapPredictionsStats(t.predictions):null,e.tiers=t.tiers?this.remapAchievementsStats(t.tiers):null,e.badges=t.badges?this.remapAchievementsStats(t.badges):null,e.discussions=t.discussions?this.remapDiscussionStats(t.discussions):null,e.classicQuizzes=t.classic_quizzes?this.remapClassicQuizStats(t.classic_quizzes):null,e.eitherOr=t.either_or?this.remapEitherOrStats(t.either_or):null,e};constructNewRecord=t=>{let e;if(Object.entries(t).length)Object.entries(t).forEach(([i,a])=>{e={...e,[i]:this.remapSuccessRatePercent(a)},rt[i]&&delete e[i].model});else return t;return e};remapSuccessRatePercent=t=>{let e=new ta;return e.successRatePercent=t.success_rate_percent,e};remapPredictionsStats=t=>{let e=new fe;return e.single=this.remapSinglePredictionsStats(t.single),e.topX=t.top_x,e.matchQuiz=t.match_quiz,e};remapSinglePredictionsStats=t=>{let e=new he;return e.predictionsMade=t.predictions_made,e.correct=t.correct,e.points=t.points,e.breakdown=this.remapBreakdownSinglePredictionsStats(t.breakdown),e};remapBreakdownSinglePredictionsStats=t=>{if(t&&Object.keys(t).length){let e=new Wt,i=[],a=[];return Object.keys(t).forEach(r=>{let o=new Zi;o.entityId=r,o.entityType=t[r].entity_type,o.entitySource=t[r].entity_source,o.predictionsMade=t[r].predictions_made,o.correct=t[r].correct,o.points=t[r].points,o.entityType==="competition"?i.push(o):o.entityType==="team"&&a.push(o)}),e.footballCompetitions=i,e.footballTeams=a,e}return new Wt};remapAchievementsStats=t=>t.map(e=>{let i=new Yi;return i.id=e.id,i.achievedAt=e.achieved_at,i});remapDiscussionStats=t=>{let e=new de;return e.totalPoints=t.total_points,e.postPoints=t.post_points,e.postsMade=t.posts_made,e.reactionPoints=t.reaction_points,e.reactionCount=t.reaction_count,e};remapClassicQuizStats=t=>{let e=new ue;return e.participationCount=t.participation_count,e.points=t.points,e};remapEitherOrStats=t=>{let e=new me;return e.participationCount=t.participation_count,e}};function Jc(s){this.message=s}Jc.prototype=new Error,Jc.prototype.name="InvalidCharacterError";var wu=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(s){var t=String(s).replace(/=+$/,"");if(t.length%4==1)throw new Jc("'atob' failed: The string to be decoded is not correctly encoded.");for(var e,i,a=0,r=0,o="";i=t.charAt(r++);~i&&(e=a%4?64*e+i:i,a++%4)?o+=String.fromCharCode(255&e>>(-2*a&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return o};function hd(s){var t=s.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(e){return decodeURIComponent(wu(e).replace(/(.)/g,function(i,a){var r=a.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r}))}(t)}catch{return wu(t)}}function Jp(s){this.message=s}function fd(s,t){if(typeof s!="string")throw new Jp("Invalid token specified");var e=(t=t||{}).header===!0?0:1;try{return JSON.parse(hd(s.split(".")[e]))}catch(i){throw new Jp("Invalid token specified: "+i.message)}}Jp.prototype=new Error,Jp.prototype.name="InvalidTokenError";var Zc=fd;var C=(a=>(a[a.BAD_METHOD_CALL=400]="BAD_METHOD_CALL",a[a.UNAUTHORIZED=401]="UNAUTHORIZED",a[a.NOT_FOUND=404]="NOT_FOUND",a[a.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",a))(C||{});var A=(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))(A||{});var G={native:"id",sportradar:"sportradar_id",sportal365:"sportal365_id",enetpulse:"enetpulse_id",api_football:"api_football_id"},tu={PREDICTOR_USER_RELATED_OPERATION:"https://docs.fansunitedmedia.com/docs/predictor-operations#user-related-operations"},eu=["matchId","matchType","market","prediction"],_u=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");var x=(w=>(w.INVALID_MATCH_ID="Match id is invalid!",w.INVALID_PLAYER_ID="Player id is invalid!",w.QUERY_PARAM_MATCH_IDS_EXCEEDED="Maximum matchIds in PredictionFilters should be 10 or less.",w.QUERY_PARAM_FILTERS_LIMIT_EXCEEDED="Maximum limit for filtering games is 50 or less.",w.INVALID_FIXTURES_FIELD="Fixtures field is invalid. For more information please visit our documentation",w.INVALID_TOKEN="Invalid JWT token is provided",w.EXPIRED_TOKEN="The provided JWT token is expired",w.ENTITIES_NEEDED="At least one of footballCompetitions, footballTeams or footballPlayers properties should be provided for filters.",w.ENTITIES_FOLLOWS_FILTERS_EXCEEDED="Maximum length per entity should be 24 or less.",w.INVALID_TYPE="You have provided invalid type. The valid type is ",w.INVALID_VALUE="You have provided invalid value. The valid value is ",w.INVALID_AVATAR="Invalid URL syntax for avatar image.",w.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.",w.INVALID_LIMIT="Invalid limit. The maximum limit is: ",w.INVALID_LIMIT_TYPE="Invalid limit type. The proper type is number.",w.FILTER_COMBINATION_ERROR="You need to use both 'entityIds' and 'entityType' filters together",w.INVALID_ENTITY_TYPE="Invalid 'entityType' filter. Please use one of the following valid options: competition, team, or player",w.INVALID_TEMPLATE_GROUP_ID="There is no group in this template with the provided groupId",w.INVALID_TEMPLATE_GROUP_FILTERS="The provided template group has no filters",w.INVALID_PAGE_NUMBER="Invalid page number provided. Use number between 1 and max number of pages.",w.INVALID_DISCUSSION_IDS="Invalid discussion ids argument. Please provide at least one discussion id in an array",w.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.",w.EXCEEDED_EXTENDED_DISCUSSION_IDS="Maximum number of discussion ids exceeded. The maximum number of discussion ids is: ",w.ID_MAPPING_NOT_FOUND="No ID mappings are available for the provided ID. ID argument: ",w.INVALID_PARAM="Invalid parameter provided. Please check the following parameter: ",w.INVALID_COMPETITION_ID="Invalid competition ID provided. Please provide a valid competition ID.",w.INVALID_TEAM_ID="Invalid team ID provided. Please provide a valid team ID.",w.INVALID_OR_EMPTY_IDS="Invalid or empty IDs provided. Please provide at least one ID.",w.INVALID_PROVIDER="Invalid provider. The valid providers are: 'native', 'enetpulse', 'sportal365', 'sportradar' and 'api_football'.",w.INVALID_OUTPUT_PROVIDER="Invalid output provider. The output can not be the same as the input provider.",w.MATCH_SUMMARY_REQUIRED="Match summary is required.",w.MATCH_SUMMARY_PREDICTIONS_REQUIRED="Predictions in match summary are required.",w.INVALID_MATCH_SUMMARY_PREDICTIONS_KEYS="Keys in predictions in match summary are invalid. The valid ones are: ",w.INVALID_COLLECT_LEAD_METHOD_CALL="The method 'collectLead' from Profile namespace is not called correctly. You need to provide 'requestBody' parameter to the method.",w.REQUIRED_FIXTURES_FIELD="Fixtures field is required and should contain at least one fixtures object. For more information please visit our documentation",w.INVALID_TIEBREAKER_FIELD="Tiebreaker field is invalid. It should contain statTotal key with integer value. For more information please visit our documentation",w.ENTITY_IDS_NOT_FOUND="Some of the sport entity IDs were not found for the provided id schema",w.MATCH_IDS_NOT_FOUND="Some of the match IDs were not found for the provided id schema",w.INVALID_STANDING_PREDICTION_ARGUMENT="The prediction argument is invalid. For more information please visit our documentation",w.INVALID_MAP_PLAYERS_ROLES_KEYS="The keys in the players roles map are not part of the valid keys. The valid keys are: ",w.INVALID_MAP_PLAYERS_ROLES_VALUES="The values in the map are not valid. The valid ones are: ",w.INVALID_MATCH_IDS="Match IDs are invalid!",w.MISSING_ODD_CLIENT_CONFIGURATION="Odds namespace requires oddClient configuration to be set",w.INVALID_COLLECT_CONSENTS_METHOD_CALL="The method 'collectConsents' from Profile namespace is not called correctly. You need to provide 'consents' parameter to the method.",w))(x||{}),iu={UNEXPECTED_STATUS_PROP:`Unexpected provided property 'status'. You can NOT use this property for this method. For more information visit our documentation:
2
2
  ${tu.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:
3
- ${tu.PREDICTOR_USER_RELATED_OPERATION}`},Pu=(s,t)=>`The prediction '${s}' 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`,Zp=s=>`The market '${s}' is not supported from Fans United. For more information please visit our documentation: https://docs.fansunitedmedia.com/docs/predictor-operations#make-football-prediction`,Tu=s=>`The market '${s}' is not valid for Top X game. The only available market is CORRECT_SCORE.`,Eu=s=>`The field/s '${s.length>1?s.join(", "):s[0]}' is/are invalid. For more information please visit our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk`,Ru=(s,t)=>`The following field/s is/are missing from ${s}: '${t.length>1?t.join(", "):t[0]}'. For more information please visit our documentation: https://docs.fansunitedmedia.com/docs/predictor-operations#make-football-prediction`,Fu=(s,t)=>`The field ${s} has incorrect type. The correct type is ${t}`;var Kt=class{data={error:{code:0,status:"",message:""}};status=0;statusText="";headers=null;constructor(t,e){this.data.error.code=e.code,this.data.error.status=e.status,this.data.error.message=e.message,this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}errorMessage=()=>this.data.error.message};var h=class{error={code:0,status:"",message:""};constructor(t,e,i){this.error.code=t,this.error.status=e,this.error.message=i}};var v=class{baseUrl=null;apiSignInUrl=null;jwtToken=null;idSchema=null;retryRequest=!1;headers=null;authHeaders=null;errorHandlingMode=null;configuration=null;constructor(t,e){this.baseUrl=e,this.configuration=t,this.apiSignInUrl=`?key=${t.apiKey}&client_id=${t.clientId}`,this.errorHandlingMode=t.errorHandlingMode,this.idSchema=t.idSchema,this.headers={"Content-Type":"application/json"}}getJwtToken=()=>{if(this.configuration.cookieToken){let t=[];typeof document>"u"?t=(this.configuration.cookieToken.requestHeaders.get("cookie")||"").split(";"):t=document.cookie.split(";");let e=t.find(r=>r.trim().startsWith(`${this.configuration.cookieToken.name}=`));if(!e)return"";let i=e.split("=")[1].trim(),a=decodeURIComponent(i);try{let r=JSON.parse(a);return r.token||r||""}catch{return a}}return this.configuration.authProvider?.getIdToken()||""};getAuthHeaders=()=>({"Content-Type":"application/json",Authorization:`Bearer ${this.getJwtToken()}`});fetchWithoutAuth=async(t,e,i,a)=>{let r=null;a?r=await fetch(this.baseUrl+t,{headers:this.headers,method:i||"GET",body:JSON.stringify(a)}):r=await fetch(this.baseUrl+t,{headers:this.headers,method:i||"GET"});let o=await r.json();if(!r.ok){let n=this.transformFetchException(r,o);throw console.warn(e,n),n}return o};fetchWithoutAuthAdditionalHeaders=async(t,e,i)=>{let a=await fetch(this.baseUrl+t,{headers:{...this.headers,...i}}),r=await a.json();if(!a.ok){let o=this.transformFetchException(a,r);throw console.warn(e,o),o}return r};fetchWithAuth=async(t,e,i,a)=>{this.validateJWTToken();let r=null,o=null;if(i&&a?r=await fetch(this.baseUrl+t,{method:i,headers:this.getAuthHeaders(),body:JSON.stringify(a)}):i&&!a?r=await fetch(this.baseUrl+t,{method:i,headers:this.getAuthHeaders()}):r=await fetch(this.baseUrl+t,{headers:this.getAuthHeaders()}),i!=="DELETE"&&(o=await r.json()),!r.ok){(r.status===401||r.status===403)&&!this.retryRequest&&(this.retryRequest=!0,await this.fetchWithAuth(t,e,i,a)),this.retryRequest=!1;let n=this.transformFetchException(r,o||await r.json());throw console.warn(e,n),n}return this.retryRequest=!1,o};fetchWithAuthNewBaseURL=async(t,e,i,a,r)=>{this.validateJWTToken();let o=null,n=null;if(a&&r?o=await fetch(t+e,{method:a,headers:this.getAuthHeaders(),body:JSON.stringify(r)}):a&&!r?o=await fetch(t+e,{method:a,headers:this.getAuthHeaders()}):o=await fetch(t+e,{headers:this.getAuthHeaders()}),a!=="DELETE"&&(n=await o.json()),!o.ok){(o.status===401||o.status===403)&&!this.retryRequest&&(this.retryRequest=!0,await this.fetchWithAuthNewBaseURL(t,e,i,a,r)),this.retryRequest=!1;let l=this.transformFetchException(o,n||await o.json());throw console.warn(i,l),l}return this.retryRequest=!1,n};transformFetchException=(t,e)=>{if(!e&&t.status===401){if(this.errorHandlingMode==="standard")return new h(401,"unauthorized","Invalid JWT token is provided");let o={code:401,status:"unauthorized",message:"Invalid JWT token is provided"};return new Kt(t,o)}let{code:i,status:a,message:r}=e.error;return this.errorHandlingMode==="standard"?new h(i,a,r):new Kt(t,e.error)};validateJWTToken=()=>{let t=null;try{t=Zc(this.getJwtToken())}catch(i){if(this.errorHandlingMode==="default"){let a={status:401,statusText:i.message,headers:{}},r={code:401,status:"invalid_token",message:"Invalid JWT token is provided"};throw new Kt(a,r)}else if(this.errorHandlingMode==="standard")throw new h(401,"invalid_token","Invalid JWT token is provided")}if(Date.now()>t.exp*1e3){if(this.errorHandlingMode==="default"){let i={status:401,statusText:"",headers:{}},a={code:401,status:"invalid_token",message:"The provided JWT token is expired"};throw new Kt(i,a)}else if(this.errorHandlingMode==="standard")throw new h(401,"invalid_token","The provided JWT token is expired")}};extractUserIdFromToken=()=>{try{return Zc(this.getJwtToken())?.sub||""}catch(t){return console.error(t),""}}};var hi=class extends v{activityRemapper=null;constructor(t){super(t,O(t.environment,"loyalty")),this.activityRemapper=new zn}createActivity=async t=>{let e=`/activities${this.apiSignInUrl}`,i="There was a problem with creating activity",a="POST",r=await this.fetchWithAuth(e,i,a,t);return this.activityRemapper.remapSingleResponse(r)};deleteActivity=async t=>{let e=`/activities/${t}${this.apiSignInUrl}`,i=`There was a problem deleting the following activity: ${t}`,a="DELETE";return await this.fetchWithAuth(e,i,a),!0};getOwnActivities=async(t,e)=>{let i=`/activities${this.apiSignInUrl}`,a=Date.now(),r="There was a problem with fetching own activities";t&&(i+=`${t.constructFilterUrl()}`),e&&(i+=`disable_cache=${a}`);let o=await this.fetchWithAuth(i,r);return this.activityRemapper.remapActivitiesResponse(o)};getActivitiesForUser=async(t,e,i)=>{let a=`/users/${t}/activities${this.apiSignInUrl}`,r=Date.now(),o=`There was a problem with fetching activities for user: ${t}`;e&&(a+=`${e.constructFilterUrl()}`),i&&(a+=`disable_cache=${r}`);let n=await this.fetchWithoutAuth(a,o);return this.activityRemapper.remapActivitiesResponse(n)};getStats=async(t,e)=>{let i="",a="",r=null;return t?(i+=f(e)?`/users/${t}/statistics${this.apiSignInUrl}${m()}`:`/users/${t}/statistics${this.apiSignInUrl}`,a=`There was a problem fetching statistics for profile: ${t}`,r=await this.fetchWithoutAuth(i,a)):(i+=`/statistics${this.apiSignInUrl}`,a="There was a problem fetching profile`s statistics",r=await this.fetchWithAuth(i,a)),this.activityRemapper.remapStatsResponse(r.data)}};var au=(g=>(g.LIKE="like",g.DISLIKE="dislike",g.PAGE_VIEW="page_view",g.CONTENT_CONSUMED="content_consumed",g.SHARE="share",g.COMMENT="comment",g.CLICK_AD="click_ad",g.PREDICTION_MADE="prediction_made",g.CONVERT="convert",g.MANAGE_INTERESTS="manage_interests",g.GAME_PARTICIPATION="game_participation",g.ARTICLE_CONSUMED="article_consumed",g.VIDEO_CONSUMED="video_consumed",g.SHORT_VIDEO_CONSUMED="short_video_consumed",g.LONG_VIDEO_CONSUMED="long_video_consumed",g.AUDIO_CONSUMED="audio_consumed",g.GALLERY_CONSUMED="gallery_consumed",g.IMAGE_CONSUMED="image_consumed",g.POLL_PARTICIPATION="poll_participation",g))(au||{});var fi=class{action=null;context=new Ct;constructor(t,e,i,a){this.action=t,this.context.tags=e,i&&(this.context.content=i),a&&(this.context.campaign=a)}};var Qn={player:"players",team:"teams",homeTeam:"teams",awayTeam:"teams",country:"countries",competition:"competitions",match:"matches"},qn=class extends v{constructor(t){super(t,O(t.environment,"idMapping"))}getEntityById=async(t,e)=>{let i=`/football${this.apiSignInUrl}&input_provider=${this.idSchema}&${Qn[t]}=${e}`,a=`There was a problem with id mapping request for the following id: ${e}`;return await this.fetchWithoutAuth(i,a)};getEntityByIdAndSchema=async(t,e,i)=>{let a=`/football${this.apiSignInUrl}&input_provider=${i}&${Qn[t]}=${e}`,r=`There was a problem with id mapping request for the following id: ${e}`;return await this.fetchWithoutAuth(a,r)};getEntityIdsByIdsAndSchema=async(t,e,i)=>{let a=`/football${this.apiSignInUrl}&input_provider=${i}&${Qn[t]}=${e.join(",")}`,r=`There was a problem with id mapping request for the following ids: ${e.join(",")}`;return await this.fetchWithoutAuth(a,r)};getEntitiesByIds=async(t,e,i)=>{e.sort((o,n)=>o.localeCompare(n));let a=Xc(e),r=[];for(let o of a){let n=`/football${this.apiSignInUrl}&input_provider=${i}&${Qn[t]}=${o.join(",")}`,l=`There was a problem with id mapping request for the following ids :${o.join(",")}`,p=await this.fetchWithoutAuth(n,l);r=[...r,...p.data]}return r};getEntitiesByIdObjs=async(t,e)=>{let i=[],a={},r=[];Object.keys(t).forEach(p=>{i.push.apply(i,t[p])});let o=ce(i),n=Xc(o);for(let p of n){let c="";if(Object.keys(t).forEach(u=>{a[u]=[];let d=p.filter(M=>t[u].includes(M));d&&d.length>0&&(a[u]=d)}),Object.keys(a).forEach(u=>{a[u].length>0&&(a[u].sort((d,M)=>d.localeCompare(M)),c+="&",c+=`${Qn[u]}=${a[u].join(",")}`)}),c&&c.length>0){let u=`/football${this.apiSignInUrl}&input_provider=${e||"native"}${c}`,d="There was a problem with id mapping request",M=await this.fetchWithoutAuth(u,d);r.push(M.data)}else r.push([])}return Array.prototype.concat.apply([],r)};getTopEntities=async()=>{let t=`/football/top${this.apiSignInUrl}`,e="There was a problem with top id mappings request";return(await this.fetchWithoutAuth(t,e)).data}};var ru="FansUnited",tc={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}}},ia=class{idSchema="";storageInstance=null;expirationProfileTimeout=600;expirationBadgesTimeout=3600;expirationClientFeaturesTimeout=14400;expirationFootballIdsTimeout=604800;constructor(t){this.idSchema=t,this.getStorageInstance()}static getInstance(t){return ia.instance||(ia.instance=new ia(t)),ia.instance}async getStorageInstance(){try{let t=await Promise.resolve().then(()=>(vu(),Su));this.storageInstance=t.default}catch(t){console.error(t)}}async getData(){try{let t=await this.storageInstance.getItem(ru);return t?JSON.parse(t):(await this.storageInstance.setItem(ru,JSON.stringify(tc)),tc)}catch(t){throw console.error("AsyncStorage error:",t),t}}async setData(t){await this.storageInstance.setItem(ru,JSON.stringify(t))}clearData=async()=>{await this.setData(tc)};getCompetitions=async t=>{let e=await this.getData();return t?t.competitionSearchFilter(e.football.competitions):e.football.competitions};setCompetitions=async t=>{let e=await this.getData(),i=[...e.football.competitions];i.push(...t),e.football.competitions=this.makeCompetitionsUnique(i),await this.setData(e)};getCompetitionsLength=async()=>(await this.getData()).football.competitions.length;getEntityById=async(t="",e="")=>(await this.getData()).football.ids.find(a=>{let r=G[this.idSchema];return a&&`${a[r]}`===e&&a.resource===t});getEntity=async(t,e,i)=>{let a=await this.getData();return Array.isArray(t)?a.football.ids.filter(r=>{let o=G[i];return r&&t.includes(`${r[o]}`)&&r.resource===e}):a.football.ids.find(r=>{let o=G[i];return r&&`${r[o]}`===t&&r.resource===e})};checkForExistingIdObjs=async(t,e)=>{let i=G[e],a={};for(let r of Object.keys(t)){let o=t[r],l=(await this.getEntity(o,r,e)).map(c=>c[i]),p=t[r].filter(c=>!l.includes(c));a[r]=o.map(c=>p.includes(c)?{id:c,exists:!1}:{id:c,exists:!0})}return a};getIdsByType=async(t,e,i)=>{let a=await this.getData(),r=G[i],o=G[e],n={};return Object.keys(t).forEach(l=>{let p=t[l],c=[];a.football.ids.forEach(u=>{p.forEach((d,M)=>{d===u[o]&&l===u.resource&&(c[M]=u[r])})}),n[l]=c}),n};addIdMapping=async t=>{let e=await this.getData();e.football.ids.push(t),await this.setData(e)};addIdMappings=async t=>{let e=await this.getData(),i=e.football.ids;i=[...i,...t],e.football.ids=i,await this.setData(e)};addTopIdMappings=async t=>{let e=await this.getData();if(e.football.ids.length){let i=JSON.parse(JSON.stringify(e.football.ids));i=i.filter(a=>a.resource!=="match"),t=t.filter(a=>a.resource==="match"),i=[...i,...t],e.football.ids=i}else e.football.ids=t;e.football.expirations.ids=Math.floor(Date.now()/1e3)+this.expirationFootballIdsTimeout,await this.setData(e)};setOwnProfile=async t=>{let e=await this.getData();e.profile.info=t,e.profile.expirations.profile=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,await this.setData(e)};getOwnProfile=async()=>(await this.getData()).profile.info;getProfileCountries=async()=>(await this.getData()).profile.countries;setProfileCountries=async t=>{let e=await this.getData();e.profile.countries=t,await this.setData(e)};getProfileStats=async()=>(await this.getData()).profile.statistics;setProfileStats=async t=>{let e=await this.getData();e.profile.statistics=t,e.profile.expirations.statistics=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,await this.setData(e)};getProfileBadges=async()=>(await this.getData()).profile.badges;setProfileBadges=async t=>{let e=await this.getData();e.profile.badges=t,e.profile.expirations.badges=Math.floor(Date.now()/1e3)+this.expirationBadgesTimeout,await this.setData(e)};getFootballCountries=async()=>(await this.getData()).football.countries;setFootballCountries=async t=>{let e=await this.getData();e.football.countries=t,await this.setData(e)};getClientFeatures=async()=>(await this.getData()).client.features;setClientFeatures=async t=>{let e=await this.getData(),i=JSON.parse(JSON.stringify(t));e.client.expirations.features=Math.floor(Date.now()/1e3)+this.expirationClientFeaturesTimeout,e.client.features=i,await this.setData(e)};deleteClientFeatures=async()=>{let t=await this.getData(),e=JSON.parse(JSON.stringify(t));e.client={features:{},expirations:{features:0}},await this.setData(e)};getExpiration=async(t,e)=>{await this.initialNewSchema(t,"expirations");let i=await this.getData();switch(e){case"profile":return i.profile.expirations.profile;case"statistics":return i.profile.expirations.statistics;case"badges":return i.profile.expirations.badges;case"features":return i.client.expirations.features;case"ids":return i.football.expirations.ids}};makeCompetitionsUnique=t=>{let e=new Set;return t.filter(i=>{let a=!e.has(i.id);return e.add(i.id),a})};initialNewSchema=async(t,e)=>{let i=await this.getData();(!i||!i[t]||!i[t][e])&&await this.setData(tc)}},aa=ia;at(aa,"instance");var ou="FansUnited",su={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}}},ra=class{idSchema="";expirationProfileTimeout=600;expirationBadgesTimeout=3600;expirationClientFeaturesTimeout=14400;expirationFootballIdsTimeout=604800;constructor(t){this.idSchema=t}static getInstance(t){return ra.instance||(ra.instance=new ra(t)),ra.instance}clearData=async()=>{this.setData(su)};getEntityById=async(t="",e="")=>this.getData().football.ids.find(i=>{let a=G[this.idSchema];return i&&`${i[a]}`===e&&i.resource===t});getEntity=(t,e,i)=>Array.isArray(t)?this.getData().football.ids.filter(a=>{let r=G[i];return a&&t.includes(`${a[r]}`)&&a.resource===e}):this.getData().football.ids.find(a=>{let r=G[i];return a&&`${a[r]}`===t&&a.resource===e});getEntityByNativeId=(t="",e="")=>this.getData().football.ids.find(i=>i&&`${i.id}`===e&&i.resource===t);checkForExistingIdObjs=async(t,e)=>{let i=G[e],a={};return Object.keys(t).forEach(r=>{let o=t[r],l=this.getEntity(o,r,e).map(c=>c[i]),p=t[r].filter(c=>!l.includes(c));a[r]=o.map(c=>p.includes(c)?{id:c,exists:!1}:{id:c,exists:!0})}),a};getIdsByType=async(t,e,i)=>{let a=G[i],r=G[e],o={};return Object.keys(t).forEach(n=>{let l=t[n],p=[];this.getData().football.ids.forEach(c=>{l.forEach((u,d)=>{u===c[r]&&n===c.resource&&(p[d]=c[a])})}),o[n]=p}),o};addIdMapping=t=>{let e=this.getData();e.football.ids.push(t),this.setData(e)};addIdMappings=async t=>{let e=this.getData(),i=e.football.ids;i=[...i,...t],e.football.ids=i,this.setData(e)};addTopIdMappings=async t=>{let e=this.getData();if(e.football.ids.length){let i=JSON.parse(JSON.stringify(e.football.ids));i=i.filter(a=>a.resource!=="match"),t=t.filter(a=>a.resource==="match"),i=[...i,...t],e.football.ids=i}else e.football.ids=t;e.football.expirations.ids=Math.floor(Date.now()/1e3)+this.expirationFootballIdsTimeout,this.setData(e)};setOwnProfile=async t=>{let e=this.getData();e.profile.info=t,e.profile.expirations.profile=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,this.setData(e)};getOwnProfile=()=>this.getData().profile.info;getProfileCountries=()=>this.getData().profile.countries;setProfileCountries=async t=>{let e=this.getData();e.profile.countries=t,this.setData(e)};getProfileStats=()=>this.getData().profile.statistics;setProfileStats=async t=>{let e=this.getData();e.profile.statistics=t,e.profile.expirations.statistics=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,this.setData(e)};getProfileBadges=()=>this.getData().profile.badges;setProfileBadges=async t=>{let e=this.getData();e.profile.badges=t,e.profile.expirations.badges=Math.floor(Date.now()/1e3)+this.expirationBadgesTimeout,this.setData(e)};getFootballCountries=()=>this.getData().football.countries;setFootballCountries=async t=>{let e=this.getData();e.football.countries=t,this.setData(e)};getCompetitions=t=>{let e=this.getData();return t?t.competitionSearchFilter(e.football.competitions):e.football.competitions};setCompetitions=async t=>{let e=this.getData(),i=[...e.football.competitions];i.push(...t),e.football.competitions=this.makeCompetitionsUnique(i),this.setData(e)};getCompetitionsLength=async()=>{let{football:t}=this.getData();return t.competitions.length};getClientFeatures=()=>this.getData().client.features;setClientFeatures=async t=>{let e=this.getData(),i=JSON.parse(JSON.stringify(t));e.client.expirations.features=Math.floor(Date.now()/1e3)+this.expirationClientFeaturesTimeout,e.client.features=i,this.setData(e)};deleteClientFeatures=async()=>{let t=this.getData(),e=JSON.parse(JSON.stringify(t));e.client={features:{},expirations:{features:0}},this.setData(e)};getExpiration=async(t,e)=>{this.initialNewSchema(t,"expirations");let i=this.getData();switch(e){case"profile":return i.profile.expirations.profile;case"statistics":return i.profile.expirations.statistics;case"badges":return i.profile.expirations.badges;case"features":return i.client.expirations.features;case"ids":return i.football.expirations.ids}};makeCompetitionsUnique=t=>{let e=new Set;return t.filter(i=>{let a=!e.has(i.id);return e.add(i.id),a})};getData=()=>(localStorage.getItem(ou)||this.setData(su),JSON.parse(localStorage.getItem(ou)));setData=t=>{localStorage.setItem(ou,JSON.stringify(t))};initialNewSchema=(t,e)=>{let i=this.getData();(!i||!i[t]||!i[t][e])&&this.setData(su)}},oa=ra;at(oa,"instance");var Ku=ud(Wu());var T=class{profileTTL=600;clientTTL=14400;profileBadgesTTL=3600;idMappingsExpiration=0;idSchema="";constructor(t){}static getInstance(t){return T.instance||(T.instance=new T(t),T.nodeCache.options.useClones=!1),T.instance}clearData=async()=>T.nodeCache.flushAll();getEntityById=async(t,e)=>{let i=T.nodeCache.get("ids");return i?i.find(a=>{let r=G[this.idSchema];return a&&`${a[r]}`===e&&a.resource===t}):null};getEntity=async(t,e,i)=>{let a=T.nodeCache.get("ids");return a?Array.isArray(t)?[]:null:Array.isArray(t)?a.filter(r=>{let o=G[i];return r&&t.includes(`${r[o]}`)&&r.resource===e}):a.find(r=>{let o=G[i];return r&&`${r[o]}`===t&&r.resource===e})};checkForExistingIdObjs=async(t,e)=>{let i=G[e],a={};for(let r of Object.keys(t)){let o=t[r],l=(await this.getEntity(o,r,e)).map(c=>c[i]),p=t[r].filter(c=>!l.includes(c));a[r]=o.map(c=>p.includes(c)?{id:c,exists:!1}:{id:c,exists:!0})}return a};getIdsByType=async(t,e,i)=>{let a=G[i],r=G[e],o=T.nodeCache.get("ids"),n={};return o?(Object.keys(t).forEach(l=>{let p=t[l],c=[];o.forEach(u=>{p.forEach((d,M)=>{d===u[r]&&l===u.resource&&(c[M]=u[a])})}),n[l]=c}),n):null};addIdMapping=async t=>{let e=T.nodeCache.get("ids");e.push(t),T.nodeCache.set("ids",e)};addIdMappings=async t=>{let e=T.nodeCache.get("ids");e=[...e,...t],T.nodeCache.set("ids",e)};addTopIdMappings=async t=>{let e=T.nodeCache.get("ids"),i=604800;if(e){let a=JSON.parse(JSON.stringify(e));a=a.filter(r=>r.resource!=="match"),t=t.filter(r=>r.resource==="match"),a=[...a,...t],T.nodeCache.set("ids",a)}else T.nodeCache.set("ids",t);this.idMappingsExpiration=Math.floor(Date.now()/1e3)+i};setOwnProfile=async t=>{T.nodeCache.set("profile",t,this.profileTTL)};getOwnProfile=async()=>T.nodeCache.get("profile");getProfileCountries=async()=>T.nodeCache.get("profile_countries");setProfileCountries=async t=>{T.nodeCache.set("profile_countries",t)};getProfileStats=async()=>T.nodeCache.get("profile_stats");setProfileStats=async t=>{T.nodeCache.set("profile_stats",t,this.profileTTL)};getProfileBadges=async()=>T.nodeCache.get("profile_badges");setProfileBadges=async t=>{T.nodeCache.set("profile_badges",t,this.profileBadgesTTL)};getFootballCountries=async()=>T.nodeCache.get("football_countries");setFootballCountries=async t=>{T.nodeCache.set("football_countries",t)};getCompetitions=async t=>{let e=T.nodeCache.get("football_competitions");return e?t?t.competitionSearchFilter(e):e:null};setCompetitions=async t=>{T.nodeCache.set("football_competitions",t)};getCompetitionsLength=async()=>{let t=T.nodeCache.get("football_competitions");return t?t.length:0};getClientFeatures=async()=>T.nodeCache.get("client");setClientFeatures=async t=>{T.nodeCache.set("client",t,this.clientTTL)};deleteClientFeatures=async()=>{T.nodeCache.del("client")};getExpiration=async(t,e)=>{let i=this.getKeyFromExpirationType(e);return i==="ids"?this.idMappingsExpiration:T.nodeCache.getTtl(i)};getKeyFromExpirationType=t=>{switch(t){case"profile":return"profile";case"statistics":return"profile_stats";case"badges":return"profile_badges";case"features":return"client";case"ids":return"ids"}}},gi=T;at(gi,"instance"),at(gi,"nodeCache",new Ku.default);var ct=class{createLocalCacheInstance=t=>typeof window>"u"?gi.getInstance(t):typeof __DEV__<"u"?aa.getInstance(t):oa.getInstance(t)};var yi=class{localCache=null;https=null;constructor(t){this.localCache=new ct().createLocalCacheInstance(t.idSchema),this.https=new qn(t)}getEntitiesByIds=async(t,e,i)=>{await this.setTopIdMappings();try{let a=await this.localCache.checkForExistingIdObjs(t,e),r=this.splitForRequestAndExisting(a),o=await this.https.getEntitiesByIdObjs(r.request,e);return await this.localCache.addIdMappings(o),await this.localCache.getIdsByType(t,e,i)}catch(a){return console.warn("There was a problem retrieving the entity ids ",a),Promise.resolve([])}};getEntitiesByIdsMap=async(t,e,i)=>{await this.setTopIdMappings();try{let a=JSON.parse(JSON.stringify(t)),r=await this.localCache.checkForExistingIdObjs(t,e),o=this.splitForRequestAndExisting(r),n=await this.https.getEntitiesByIdObjs(o.request,e);await this.localCache.addIdMappings(n);let l=await this.localCache.getIdsByType(t,e,i),p=new Map;return Object.keys(a).forEach(c=>{a[c].forEach((u,d)=>{let M=l[c].length&&l[c][d]?l[c][d]:"";p.set(u,M)})}),p}catch(a){return console.warn("There was a problem retrieving the entity ids ",a),Promise.resolve(new Map)}};getEntityById=async(t,e,i)=>{let a=await this.localCache.getEntity(t,e,i);if(a)return a;let r=await this.requestEntity(t,e,i);return await this.localCache.addIdMappings(r),r&&r.length>0?r[0]:null};splitForRequestAndExisting=t=>{let e={},i={};return Object.keys(t).forEach(a=>{e[a]=t[a].filter(r=>!r.exists).map(r=>r.id),i[a]=t[a].filter(r=>r.exists).map(r=>r.id)}),{existing:i,request:e}};requestEntity=async(t,e,i)=>{try{return t=Array.isArray(t)?t:[t],await this.https.getEntitiesByIds(e,t,i)}catch(a){return console.warn(`There was a problem retrieving the requested entity: ${a}`),null}};setTopIdMappings=async()=>{let t=Math.floor(Date.now()/1e3);if(await this.localCache.getExpiration("football","ids")>t)return Promise.resolve();let i=await this.https.getTopEntities();await this.localCache.addTopIdMappings(i)}};var rc=s=>{switch(s){case"competitions":return"competition";case"players":case"relatedPlayer":case"squad":return"player";case"teams":case"participants":case"homeTeam":case"awayTeam":case"timeline":case"teamId":return"team";default:return s}};var Wn=class{extractedObjIds={};traverse=(t,e)=>(e=rc(e),Array.isArray(t)?this.traverseArrExtract(t,e):t&&typeof t=="object"&&this.traverseObjExtract(t,e),this.extractedObjIds);traverseArrExtract=(t,e)=>{t&&t.length>0&&t.forEach(i=>{this.traverseObjExtract(i,e)})};traverseObjExtract=(t,e)=>{t&&Object.keys(t).length>0&&Object.keys(t).forEach(i=>{let a=t[i];i==="id"||i==="teamId"?(this.extractedObjIds.hasOwnProperty(e)||(this.extractedObjIds[e]=[]),a&&this.extractedObjIds[e].push(a)):t[i]&&this.traverse(t[i],i)})}};var Kn=class{replaceObjIdsIndex=null;remappedIdsObj={};traverse=(t,e,i)=>(e=rc(e),this.replaceObjIdsIndex===null&&(this.initReplaceObjIdsIndex(i),this.remappedIdsObj=i),Array.isArray(t)?this.traverseArrReplace(t,e):t&&typeof t=="object"&&this.traverseObjReplace(t,e),t);initReplaceObjIdsIndex=t=>{this.replaceObjIdsIndex={},Object.keys(t).forEach(e=>{this.replaceObjIdsIndex[e]=0})};traverseArrReplace=(t,e)=>{t&&t.length>0&&t.forEach(i=>{this.traverseObjReplace(i,e)})};traverseObjReplace=(t,e)=>{t&&Object.keys(t).length>0&&Object.keys(t).forEach(i=>{i==="id"||i==="teamId"?t[i]&&(t[i]=this.remappedIdsObj[e][this.replaceObjIdsIndex[e]],this.replaceObjIdsIndex[e]=this.replaceObjIdsIndex[e]+1):t[i]&&this.traverse(t[i],i,this.remappedIdsObj)})}};var R=class{idSchema="";idMappingFacade=null;constructor(t){this.idSchema=t.idSchema,this.idMappingFacade=new yi(t)}getEntityIdBySchemaId=(t,e)=>this.idMappingFacade.getEntityById(e,t,this.idSchema);remapEntities=async(t,e)=>{let i=JSON.parse(JSON.stringify(t));try{if(this.idSchema!=="native"){let r=new Wn().traverse(i,e);return this.idMappingFacade.getEntitiesByIds(r,"native",this.idSchema).then(o=>new Kn().traverse(i,e,o))}else return t}catch(a){return console.warn(`There was a problem remapping entity: ${e} with inner entity `,a),[]}};getEntityIdsBySchemaId=async(t,e,i)=>{let a={};return a[e]=t,this.idSchema!=="native"?await this.idMappingFacade.getEntitiesByIds(a,this.idSchema,i):a}};var wt=class{idSchema;idMapping;constructor(t){this.idSchema=t.idSchema,this.idMapping=new R(t)}remapTagsIds=async(t,e,i)=>{if(!t||!t.length)return t;let a={},r={},o=[];t.forEach(l=>{a.hasOwnProperty(l.type)||(a[l.type]=[],r[l.type]=[]),a[l.type].push(l.id),r[l.type].push(l)});let n=await this.idMapping.idMappingFacade.getEntitiesByIds(a,e,i);for(let[l,p]of Object.entries(r))p.forEach((c,u)=>{c.id=n[l][u],o.push(c)});return o}};var ye=class{page=null;limit=null;constructor(t){this.page=t.page?t.page:null,this.limit=t.limit?t.limit:null}};var na=class extends ye{action=null;constructor(t){super(t),this.action=t.action?t.action:null}constructFilterUrl(){let t="";return this.action&&(t+="&",t+=`action=${this.action}`),this.page&&(t+="&",t+=`page=${this.page}`),this.limit&&(t+="&",t+=`limit=${this.limit}`),t}};var la=class extends ye{action=null;constructor(t){super(t),this.action=t.action?t.action:null}constructFilterUrl(){let t="";return this.action&&(t+="&",t+=`action=${this.action}`),this.page&&(t+="&",t+=`page=${this.page}`),this.limit&&(t+="&",t+=`limit=${this.limit}`),t}};var jn=class{idSchema;activityHttps;activityService;constructor(t){this.idSchema=t.idSchema,this.activityHttps=new hi(t),this.activityService=new wt(t)}add=async(t,e,i,a)=>{if(this.idSchema!="native"){let o=JSON.parse(JSON.stringify(e)),n=await this.activityService.remapTagsIds(e,this.idSchema,"native"),l=new fi(t,n,i,a),p=await this.activityHttps.createActivity(l);return p.context.tags=o,p}let r=new fi(t,e,i,a);return this.activityHttps.createActivity(r)};delete=async t=>await this.activityHttps.deleteActivity(t);like=async(t,e,i)=>{let a="like";return await this.add(a,t,e,i)};dislike=async(t,e,i)=>{let a="dislike";return await this.add(a,t,e,i)};addPageview=async(t,e,i)=>{let a="page_view";return await this.add(a,t,e,i)};addContentConsumed=async(t,e,i)=>{let a="content_consumed";return await this.add(a,t,e,i)};addShare=async(t,e,i)=>{let a="share";return await this.add(a,t,e,i)};addComment=async(t,e,i)=>{let a="comment";return await this.add(a,t,e,i)};addClickAd=async(t,e,i)=>{let a="click_ad";return await this.add(a,t,e,i)};addConvert=async(t,e,i)=>{let a="convert";return await this.add(a,t,e,i)};getOwn=async(t,e)=>{if(e=e||!1,t&&(t=new na(t)),this.idSchema!="native"){let i=await this.activityHttps.getOwnActivities(t,e);for(let a of i.data)await this.activityService.remapTagsIds(a.context.tags,"native",this.idSchema);return i}return await this.activityHttps.getOwnActivities(t,e)};getForUser=async(t,e,i)=>{if(i=i||!1,e&&(e=new la(e)),this.idSchema!="native"){let a=await this.activityHttps.getActivitiesForUser(t,e,i),r=JSON.parse(JSON.stringify(a));for(let o of r.data)await this.activityService.remapTagsIds([...o.context.tags],"native",this.idSchema);return r}return await this.activityHttps.getActivitiesForUser(t,e,i)}};var Yn=class{activityFacade;constructor(t){this.activityFacade=new jn(t)}add=async(t,e,i,a)=>await this.activityFacade.add(t,e,i,a);delete=async t=>await this.activityFacade.delete(t);like=async(t,e,i)=>await this.activityFacade.like(t,e,i);dislike=async(t,e,i)=>await this.activityFacade.dislike(t,e,i);addPageview=async(t,e,i)=>await this.activityFacade.addPageview(t,e,i);addContentConsumed=async(t,e,i)=>await this.activityFacade.addContentConsumed(t,e,i);addShare=async(t,e,i)=>await this.activityFacade.addShare(t,e,i);addComment=async(t,e,i)=>await this.activityFacade.addComment(t,e,i);addClickAd=async(t,e,i)=>await this.activityFacade.addClickAd(t,e,i);addConvert=async(t,e,i)=>await this.activityFacade.addConvert(t,e,i);getOwn=async(t,e)=>await this.activityFacade.getOwn(t,e);getForUser=async(t,e,i)=>await this.activityFacade.getForUser(t,e,i)};var z=class{entityId=null;entityType=null;entityRelationship=null};var be=class{participantOne=null;participantTwo=null};var pa=class{matchId="";participantOne="";participantTwo="";winner="";homeParticipant="";startDate="";score=new be};var Me=class{participants=[]};var ca=class{id=null;name=null;group=null;image=null;undecided=!1};var ua=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 Me;fixtures=[];createdAt=null;updatedAt=null};var ut=class{nextPageStartsAfter=null;itemsPerPage=null};var y=class{pagination=new ut};var da=class{meta=new y;data=[]};var ma=class{meta=new y;data=[]};var ha=class{statTiebreakerEnabled;statTotal};var fa=class{matchId="";participantOne="";participantTwo="";winner;correct=null};var Ie=class{statTotal=0};var ju=(r=>(r.ACTIVE="ACTIVE",r.WON="WON",r.LOST="LOST",r.PARTIALLY_WON="PARTIALLY_WON",r.CANCELED="CANCELED",r))(ju||{}),ga=class{id="";profileId="";profileModel=null;gameId="";totalPoints=null;gamePoints=null;bonusPoints=null;position=null;status="ACTIVE";fixtures=[];tiebreaker=new Ie;createdAt="";updatedAt=""};var ya=class{meta=new y;data=[]};var Xn=class{remapBracketGames=t=>{let e=new ma;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapBracketGameById(i)),e};remapBracketGameById=t=>{let e=new ua;return e.id=t.id,e.title=t.title,e.description=t.description,e.rules=t.rules,e.customFields=t.custom_fields,e.images=t.images,e.type=t.type,e.status=t.status,e.points=t.points,e.related=t.related?this.remapRelated(t.related):t.related,e.tiebreaker=t.tiebreaker?this.remapBracketGameTiebreaker(t.tiebreaker):t.tiebreaker,e.predictionsCutoff=t.predictions_cutoff,e.meta=t.meta&&t.meta.participants?this.remapBracketGameMeta(t.meta):t.meta,e.fixtures=t.fixtures?this.remapBracketGameFixtures(t.fixtures):t.fixtures,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPredictionToRequestBody=t=>t.map(e=>({match_id:e.matchId,participant_one:e.participantOne,participant_two:e.participantTwo,winner:e.winner}));remapPrediction=t=>{let e=new ga;return e.id=t.id,e.profileId=t.profile_id,e.gameId=t.game_id,e.totalPoints=t.total_points,e.gamePoints=t.game_points,e.bonusPoints=t.bonus_points,e.position=t.position,e.status=t.status,e.fixtures=this.remapPredictionFixtures(t.fixtures),e.tiebreaker=t.tiebreaker?this.remapPredictionTiebreaker(t.tiebreaker):t.tiebreaker,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPredictionsForUser=t=>{let e=new da;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapPrediction(i)),e};remapRankings=t=>{let e=new ya;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapPrediction(i)),e};remapRelated=t=>t.map(e=>{let i=new z;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i});remapPredictionFixtures=t=>t.map(e=>{let i=new fa;return i.matchId=e.match_id,i.participantOne=e.participant_one,i.participantTwo=e.participant_two,i.winner=e.winner,i.correct=e.correct,i});remapPredictionTiebreaker=t=>{let e=new Ie;return e.statTotal=t.stat_total,e};remapBracketGameMeta=t=>{let e=new Me;return e.participants=t.participants.map(i=>{let a=new ca;return a.id=i.id,a.name=i.name,a.group=i.group,a.image=i.image,a.undecided=i.undecided,a}),e};remapBracketGameFixtures=t=>t.map(e=>{let i=new pa;return i.matchId=e.match_id,i.participantOne=e.participant_one,i.participantTwo=e.participant_two,i.winner=e.winner,i.homeParticipant=e.home_participant,i.startDate=e.start_date,i.score=e.score?this.remapBracketGameFixturesScore(e.score):e.score,i});remapBracketGameFixturesScore=t=>{let e=new be;return e.participantOne=t.participant_one,e.participantTwo=t.participant_two,e};remapBracketGameTiebreaker=t=>{let e=new ha;return e.statTiebreakerEnabled=t.stat_tiebreaker_enabled,e.statTotal=t.stat_total,e}};var we=class{participants=[]};var ba=class{id=null;title=null;description=null;rules=null;customFields=null;images=null;type="STANDING";status=null;points=null;related=[];predictionsCutoff="";meta=new we;outcomeCount=null;outcome=[];createdAt=null;updatedAt=null};var Ma=class{meta=new y;data=[]};var Ia=class{id=null;name=null;group=null;image=null;undecided=!1};var wa=class{id="";profileId="";profileModel=null;total=0;gameId="";totalPoints=null;gamePoints=null;bonusPoints=null;position=null;status="ACTIVE";standing=[];createdAt="";updatedAt=""};var _a=class{meta=new y;data=[]};var Pa=class{meta=new y;data=[]};var Jn=class{remapBracketGames=t=>{let e=new Ma;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapStandingGameById(i)),e};remapStandingGameById=t=>{let e=new ba;return e.id=t.id,e.title=t.title,e.description=t.description,e.rules=t.rules,e.customFields=t.custom_fields,e.images=t.images,e.type=t.type,e.status=t.status,e.points=t.points,e.related=t.related?this.remapRelated(t.related):t.related,e.predictionsCutoff=t.predictions_cutoff,e.meta=t.meta&&t.meta.participants?this.remapStandingGameMeta(t.meta):t.meta,e.outcomeCount=t.outcome_count,e.outcome=t.outcome,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPrediction=t=>{let e=new wa;return e.id=t.id,e.profileId=t.profile_id,e.gameId=t.game_id,e.totalPoints=t.total_points,e.gamePoints=t.game_points,e.bonusPoints=t.bonus_points,e.position=t.position,e.status=t.status,e.standing=t.standing,e.total=t.total,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPredictionsForUser=t=>{let e=new _a;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapPrediction(i)),e};remapRankings=t=>{let e=new Pa;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapPrediction(i)),e};remapRelated=t=>t.map(e=>{let i=new z;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i});remapStandingGameMeta=t=>{let e=new we;return e.participants=t.participants.map(i=>{let a=new Ia;return a.id=i.id,a.name=i.name,a.group=i.group,a.image=i.image,a.undecided=i.undecided,a}),e}};var Ta=class{meta=new y;data=[]};var Ea=class{statTiebreakerEnabled;statTotal};var _e=class{statTotal=0};var Yu=(r=>(r.ACTIVE="ACTIVE",r.WON="WON",r.LOST="LOST",r.PARTIALLY_WON="PARTIALLY_WON",r.CANCELED="CANCELED",r))(Yu||{}),Ra=class{id="";profileId="";profileModel=null;gameId="";gamePoints=null;bonusPoints=null;totalPoints=null;position=null;status="ACTIVE";fixtures=[];tiebreaker=new _e;createdAt="";updatedAt=""};var Fa=class{meta=new y;data=[]};var Sa=class{id=null;title=null;description=null;images=null;rules=null;customFields=null;type="EVENT";status=null;points=null;related=[];tiebreaker=null;predictionsCutoff=null;fixtures=[];createdAt=null;updatedAt=null};var oc=(a=>(a.BOOLEAN="BOOLEAN",a.NUMBER="NUMBER",a.ENUM="ENUM",a.FREE_INPUT="FREE_INPUT",a))(oc||{});var At=class{id="";question="";status="ACTIVE";voidReason=null;points=0;outcomeType=null;validOutcomes=null;outcome=null};var Ot=class{id="";predictionType;prediction;correct=null;points=0};var va=class{meta=new y;data=[]};var Zn=class{remapEventGames=t=>{let e=new Ta;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapEventGameById(i)),e};remapEventGameById=t=>{let e=new Sa;return e.id=t.id,e.title=t.title,e.description=t.description,e.rules=t.rules,e.customFields=t.custom_fields,e.images=t.images,e.type=t.type,e.status=t.status,e.points=t.points,e.related=t.related?this.remapRelated(t.related):t.related,e.tiebreaker=t.tiebreaker?this.remapEventGameTiebreaker(t.tiebreaker):t.tiebreaker,e.predictionsCutoff=t.predictions_cutoff,e.fixtures=t.fixtures?this.remapEventGameFixtures(t.fixtures):t.fixtures,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPredictionToRequestBody=t=>t.map(e=>({id:e.id,prediction_type:e.predictionType,prediction:e.prediction}));remapPrediction=t=>{let e=new Ra;return e.id=t.id,e.profileId=t.profile_id,e.gameId=t.game_id,e.totalPoints=t.total_points,e.gamePoints=t.game_points,e.bonusPoints=t.bonus_points,e.position=t.position,e.status=t.status,e.fixtures=this.remapPredictionFixtures(t.fixtures),e.tiebreaker=t.tiebreaker?this.remapPredictionTiebreaker(t.tiebreaker):t.tiebreaker,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPredictionsForUser=t=>{let e=new va;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapPrediction(i)),e};remapRankings=t=>{let e=new Fa;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapPrediction(i)),e};remapRelated=t=>t.map(e=>{let i=new z;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i});remapPredictionFixtures=t=>t.map(e=>{let i=new Ot;switch(e.prediction_type){case"BOOLEAN":i=new Ot;break;case"NUMBER":i=new Ot;break;case"ENUM":i=new Ot;break;case"FREE_INPUT":i=new Ot;break}return i.id=e.id,i.predictionType=e.prediction_type,i.prediction=e.prediction,i.points=e.points,i.correct=e.correct,i});remapPredictionTiebreaker=t=>{let e=new _e;return e.statTotal=t.stat_total,e};remapEventGameFixtures=t=>t.map(e=>{let i=new At;switch(e.outcome_type){case"BOOLEAN":i=new At;break;case"NUMBER":i=new At;break;case"ENUM":i=new At;break;case"FREE_INPUT":i=new At;break}return i.id=e.id,i.question=e.question,i.status=e.status,i.voidReason=e.void_reason,i.points=e.points,i.outcomeType=e.outcome_type,i.validOutcomes=e.valid_outcomes,i.outcome=e.outcome,i});remapEventGameTiebreaker=t=>{let e=new Ea;return e.statTiebreakerEnabled=t.stat_tiebreaker_enabled,e.statTotal=t.stat_total,e}};var Ed={id:"",profile_id:"",total_points:null,game_points:null,bonus_points:null,position:null,status:"ACTIVE",game_id:"",fixtures:[],tiebreaker:{stat_total:0},updated_at:"",created_at:""},jt=class extends v{bracketGameRemapper=null;standingGameRemapper=null;eventGameRemapper=null;constructor(t){super(t,O(t.environment,"predictor")),this.bracketGameRemapper=new Xn,this.standingGameRemapper=new Jn,this.eventGameRemapper=new Zn}getBracketGames=async(t,e)=>{let i=t?`/custom/bracket${this.apiSignInUrl}${t.constructMainFiltersUrl()}`:`/custom/bracket${this.apiSignInUrl}`;f(e)&&(i+=m());let a="There was a problem with fetching bracket games list",r=await this.fetchWithoutAuth(i,a);return this.bracketGameRemapper.remapBracketGames(r)};getBracketGameById=async(t,e)=>{let i=f(e)?`/custom/bracket/${t}${this.apiSignInUrl}${m()}`:`/custom/bracket/${t}${this.apiSignInUrl}`,a="There was a problem with fetching bracket game with the following ID: "+t,r=await this.fetchWithoutAuth(i,a);return this.bracketGameRemapper.remapBracketGameById(r)};makeBracketGamePrediction=async(t,e)=>{let i=`/custom/bracket/${t}/predictions${this.apiSignInUrl}`,a="There was a problem with making prediction for bracket game with the following ID: "+t,r="POST",o=JSON.parse(JSON.stringify(e));o.fixtures=this.bracketGameRemapper.remapPredictionToRequestBody(e.fixtures),e.tiebreaker&&(o.tiebreaker={stat_total:e.tiebreaker.statTotal});let n=await this.fetchWithAuth(i,a,r,o);return this.bracketGameRemapper.remapPrediction(n)};updateBracketGamePrediction=async(t,e,i)=>{let a=`/custom/bracket/${t}/predictions/${e}${this.apiSignInUrl}`,r="There was a problem with updating prediction for bracket game with the following ID: "+t,o="PUT",n=JSON.parse(JSON.stringify(i));n.fixtures=this.bracketGameRemapper.remapPredictionToRequestBody(i.fixtures),i.tiebreaker&&(n.tiebreaker={stat_total:i.tiebreaker.statTotal});let l=await this.fetchWithAuth(a,r,o,n);return this.bracketGameRemapper.remapPrediction(l)};getBracketGamePredictionsForUser=async(t,e,i,a)=>{let r=i?`/custom/bracket/${t}/predictions${this.apiSignInUrl}&profile_id=${e}${i.constructMainFiltersUrl()}`:`/custom/bracket/${t}/predictions${this.apiSignInUrl}&profile_id=${e}`;f(a)&&(r+=m());let o=`There was a problem with getting all predictions for user with ID ${e} for bracket game with ID ${t}`,n=await this.fetchWithoutAuth(r,o);return this.bracketGameRemapper.remapPredictionsForUser(n)};getBracketGamePredictionById=async(t,e,i)=>{let a=f(i)?`/custom/bracket/${t}/predictions/${e}/${this.apiSignInUrl}${m()}`:`/custom/bracket/${t}/predictions/${e}/${this.apiSignInUrl}`,r=`There was a problem with getting prediction with ID ${e} for bracket game with ID ${t}`,o=JSON.parse(JSON.stringify(Ed));return o.id=e,o.game_id=t,o.tiebreaker=null,Promise.resolve(this.bracketGameRemapper.remapPrediction(o))};getBracketGameRankings=async(t,e,i)=>{let a=e?`/custom/bracket/${t}/ranking${this.apiSignInUrl}${e.constructMainFiltersUrl()}`:`/custom/bracket/${t}/ranking${this.apiSignInUrl}`;f(i)&&(a+=m());let r=`There was a problem with getting rankings for bracket game with ID ${t}`,o=await this.fetchWithoutAuth(a,r);return this.bracketGameRemapper.remapRankings(o)};getStandingsGames=async(t,e)=>{let i=t?`/custom/standing${this.apiSignInUrl}${t.constructMainFiltersUrl()}`:`/custom/standing${this.apiSignInUrl}`;f(e)&&(i+=m());let a="There was a problem with fetching standings games list",r=await this.fetchWithoutAuth(i,a);return this.standingGameRemapper.remapBracketGames(r)};getStandingGameById=async(t,e)=>{let i=f(e)?`/custom/standing/${t}${this.apiSignInUrl}${m()}`:`/custom/standing/${t}${this.apiSignInUrl}`,a="There was a problem with fetching standing game with the following ID: "+t,r=await this.fetchWithoutAuth(i,a);return this.standingGameRemapper.remapStandingGameById(r)};makeStandingGamePrediction=async(t,e)=>{let i=`/custom/standing/${t}/predictions${this.apiSignInUrl}`,a="There was a problem with making prediction for standing game with the following ID: "+t,r="POST",o={standing:e},n=await this.fetchWithAuth(i,a,r,o);return this.standingGameRemapper.remapPrediction(n)};updateStandingGamePrediction=async(t,e,i)=>{let a=`/custom/standing/${t}/predictions/${e}${this.apiSignInUrl}`,r="There was a problem with updating prediction for standing game with the following ID: "+t,o="PUT",n={standing:i},l=await this.fetchWithAuth(a,r,o,n);return this.standingGameRemapper.remapPrediction(l)};getStandingGamePredictionsForUser=async(t,e,i)=>{let a=`/custom/standing/${t}/predictions${this.apiSignInUrl}&profile_id=${e}`;f(i)&&(a+=m());let r=`There was a problem with getting prediction for user with ID ${e} for standing game with ID ${t}`,o=await this.fetchWithoutAuth(a,r);return this.standingGameRemapper.remapPredictionsForUser(o)};getStandingGameRankings=async(t,e,i)=>{let a=e?`/custom/standing/${t}/ranking${this.apiSignInUrl}${e.constructMainFiltersUrl()}`:`/custom/standing/${t}/ranking${this.apiSignInUrl}`;f(i)&&(a+=m());let r=`There was a problem with getting rankings for standing game with ID ${t}`,o=await this.fetchWithoutAuth(a,r);return this.standingGameRemapper.remapRankings(o)};getEventGames=async(t,e)=>{let i=t?`/custom/event${this.apiSignInUrl}${t.constructMainFiltersUrl()}`:`/custom/event${this.apiSignInUrl}`;f(e)&&(i+=m());let a="There was a problem with fetching event games list",r=await this.fetchWithoutAuth(i,a);return this.eventGameRemapper.remapEventGames(r)};getEventGameById=async(t,e)=>{let i=f(e)?`/custom/event/${t}${this.apiSignInUrl}${m()}`:`/custom/event/${t}${this.apiSignInUrl}`,a="There was a problem with fetching event game with the following ID: "+t,r=await this.fetchWithoutAuth(i,a);return this.eventGameRemapper.remapEventGameById(r)};makeEventGamePrediction=async(t,e)=>{let i=`/custom/event/${t}/predictions${this.apiSignInUrl}`,a="There was a problem with making prediction for event game with the following ID: "+t,r="POST",o=JSON.parse(JSON.stringify(e));o.fixtures=this.eventGameRemapper.remapPredictionToRequestBody(e.fixtures),e.tiebreaker&&(o.tiebreaker={stat_total:e.tiebreaker.statTotal});let n=await this.fetchWithAuth(i,a,r,o);return this.eventGameRemapper.remapPrediction(n)};updateEventGamePrediction=async(t,e,i)=>{let a=`/custom/event/${t}/predictions/${e}${this.apiSignInUrl}`,r="There was a problem with updating prediction for event game with the following ID: "+t,o="PUT",n=JSON.parse(JSON.stringify(i));n.fixtures=this.eventGameRemapper.remapPredictionToRequestBody(i.fixtures),i.tiebreaker&&(n.tiebreaker={stat_total:i.tiebreaker.statTotal});let l=await this.fetchWithAuth(a,r,o,n);return this.eventGameRemapper.remapPrediction(l)};getEventGamePredictionsForUser=async(t,e,i,a)=>{let r=i?`/custom/event/${t}/predictions${this.apiSignInUrl}&profile_id=${e}${i.constructMainFiltersUrl()}`:`/custom/event/${t}/predictions${this.apiSignInUrl}&profile_id=${e}`;f(a)&&(r+=m());let o=`There was a problem with getting all predictions for user with ID ${e} for event game with ID ${t}`,n=await this.fetchWithoutAuth(r,o);return this.eventGameRemapper.remapPredictionsForUser(n)};getEventGameRankings=async(t,e,i)=>{let a=e?`/custom/event/${t}/ranking${this.apiSignInUrl}${e.constructMainFiltersUrl()}`:`/custom/event/${t}/ranking${this.apiSignInUrl}`;f(i)&&(a+=m());let r=`There was a problem with getting rankings for event game with ID ${t}`,o=await this.fetchWithoutAuth(a,r);return this.eventGameRemapper.remapRankings(o)}};var Pe=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};var Ca=class extends Pe{email=null;phoneNumber=null;phoneCountryCode=null;preferences=null;consentIds=null};var tl=class{profilesFromResponse=t=>t?t.map(e=>this.publicProfileFromResponse(e)):null;fullProfileFromResponse=t=>{let e=new Ca;return e.id=t.id,e.name=t.name,e.email=t.email,e.nickname=t.nickname,e.avatar=t.avatar,e.gender=t.gender,e.country=t.country,e.birthDate=t.birth_date,e.phoneCountryCode=t.phone_country_code,e.phoneNumber=t.phone_number,e.verified=t.verified,e.staffMember=t.staff_member,e.anonymous=t.anonymous,e.disabled=t.disabled,e.interests=t.interests?t.interests:[],e.preferences=t.preferences?this.remapPreferences(t.preferences):[],e.consentIds=t.consent_ids?t.consent_ids:[],e.followingCount=t.following_count,e.followersCount=t.followers_count,e};publicProfileFromResponse=t=>{let e=new Pe;return e.id=t.id,e.name=t.name,e.nickname=t.nickname,e.avatar=t.avatar,e.gender=t.gender,e.country=t.country,e.birthDate=t.birth_date,e.verified=t.verified,e.staffMember=t.staff_member,e.anonymous=t.anonymous,e.disabled=t.disabled,e.interests=t.interests?t.interests:[],e.followingCount=t.following_count,e.followersCount=t.followers_count,e};remapPreferences=t=>t.map(e=>({preferenceId:e.preference_id,categories:e.categories,source:e.source}))};var H=class{meta=new y;data=[]};var Aa=class{avatar=null;followingId=null;name=null;nickname=null;profileId=null};var el=class{followResponse=t=>t.map(e=>this.remapResponse(e));followingFromResponse=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapResponse(i)),e};remapResponse=t=>{let e=new Aa;return e.avatar=t.avatar,e.followingId=t.following_id,e.name=t.name,e.profileId=t.profile_id,e.nickname=t.nickname,e}};var Oa=class{avatar=null;followerId=null;name=null;nickname=null;profileId=null};var xa=class{followsMe=[];iFollow=[];followsMeBack=[]};var il=class{followersFromResponse=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapResponse(i)),e};followStatusFromResponse=t=>{let e=new xa;return e.iFollow=t.i_follow,e.followsMe=t.follows_me,e.followsMeBack=t.follows_me_back,e};remapResponse=t=>{let e=new Oa;return e.avatar=t.avatar,e.followerId=t.follower_id,e.name=t.name,e.profileId=t.profile_id,e}};var bi=class{profile_ids=[]};var La=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};var al=class{toRequest(t){return{first_name:t.firstName||null,last_name:t.lastName||null,full_name:t.fullName||null,email:t.email||null,gender:t.gender||null,country:t.country||null,phone_country_code:t.phoneCountryCode||null,phone_number:t.phoneNumber||null,campaign_id:t.campaignId||null,campaign_name:t.campaignName||null,content_type:t.contentType||null,content_id:t.contentId||null,content_name:t.contentName||null,custom_fields:t.customFields||null}}fromResponse(t){let e=new La;return e.leadId=t.lead_id,e.profileId=t.profile_id,e.firstName=t.first_name,e.lastName=t.last_name,e.fullName=t.full_name,e.email=t.email,e.gender=t.gender,e.country=t.country,e.phoneCountryCode=t.phone_country_code,e.phoneNumber=t.phone_number,e.campaignId=t.campaign_id,e.campaignName=t.campaign_name,e.contentId=t.content_id,e.contentType=t.content_type,e.contentName=t.content_name,e.customFields=t.custom_fields,e}};var Da=class{consentId="";entityId=null;entityType=null;content=null;consentedAt=""};var rl=class{toRequest(t){return{consent_data:t.map(i=>({consent_id:i.consentId,entity_id:i.entityId||null,entity_type:i.entityType||null,content:i.content||null}))}}fromResponse(t){return t.map(e=>{let i=new Da;return i.consentId=e.consent_id,i.entityId=e.entity_id,i.entityType=e.entity_type,i.content=e.content,i.consentedAt=e.consented_at,i})}};var Ba=class{id="";datetime="";status="available"};var ol=class{fromResponse(t){return t.map(e=>{let i=new Ba;return i.id=e.id,i.datetime=e.datetime,i.status=e.status,i})}};var Rd="/countries",J="/profile",sc="/profiles",Mi=class extends v{profileRemapper=null;followingRemapper=null;followersRemapper=null;leadRemapper=null;consentRemapper=null;externalActivityRemapper=null;lang=null;limitIds=100;constructor(t){super(t,O(t.environment,"profile")),this.lang=t.lang,this.profileRemapper=new tl,this.followingRemapper=new el,this.followersRemapper=new il,this.leadRemapper=new al,this.consentRemapper=new rl,this.externalActivityRemapper=new ol}getCountries=async t=>{let e=`&lang=${this.lang}`,i=`${Rd}${this.apiSignInUrl}${e}`,a=Date.now(),r="There was a problem fetching profile countries";return t&&(i+=`&disable_cache=${a}`),(await this.fetchWithoutAuth(i,r)).data};getProfile=async t=>{let e=`${J}${this.apiSignInUrl}`,i="";if(t){e=`${sc}/${t}${this.apiSignInUrl}`,i=`There was a problem fetching the following profile: ${t}`;let a=await this.fetchWithoutAuth(e,i);return this.profileRemapper.publicProfileFromResponse(a.data)}else{i="There was a problem fetching your profile from API";let a=await this.fetchWithAuth(e,i);return this.profileRemapper.fullProfileFromResponse(a.data)}};getProfiles=async(t,e,i)=>{let a=Date.now(),r=`There was a problem fetching the following profiles: ${t.join(",")}`;if(t&&t.length){if(t.length>this.limitIds){let c=[],u=qt(t,this.limitIds);for(let d of u){let M=`${sc}${this.apiSignInUrl}&profile_ids=${d.join(",")}`;r=`There was a problem fetching the following profiles: ${d.join(",")}`,i&&(M+=`&disable_cache=${a}`);let _=await this.fetchWithoutAuth(M,r);c.push(...this.profileRemapper.profilesFromResponse(_.data))}return c}let l=`${sc}${this.apiSignInUrl}&profile_ids=${t.join(",")}`;i&&(l+=`&disable_cache=${a}`);let p=await this.fetchWithoutAuth(l,r);return this.profileRemapper.profilesFromResponse(p.data)}let o=`${sc}${this.apiSignInUrl}&search=${e}`;i&&(o+=`&disable_cache=${a}`);let n=await this.fetchWithoutAuth(o,r);return this.profileRemapper.profilesFromResponse(n.data)};getFollowers=async(t,e)=>{let i=`${J}/followers${this.apiSignInUrl}`,a="There was a problem fetching the followers for own profile";if(t&&!e){i=`${J}/followers${this.apiSignInUrl}${t.constructFilterUrl()}`;let o=await this.fetchWithAuth(i,a);return this.followersRemapper.followersFromResponse(o)}else if(!t&&!e){let o=await this.fetchWithAuth(i,a);return this.followersRemapper.followersFromResponse(o)}t&&e?i=`${J}/${e}/followers${this.apiSignInUrl}${t.constructFilterUrl()}`:!t&&e&&(i=`${J}/${e}/followers${this.apiSignInUrl}`),a=`There was a problem fetching the followers for profile: ${e}`;let r=await this.fetchWithoutAuth(i,a);return this.followersRemapper.followersFromResponse(r)};getFollowing=async(t,e)=>{let i=`${J}/following${this.apiSignInUrl}`,a="There was a problem fetching the followers of own profile";if(t&&!e){i=`${J}/following${this.apiSignInUrl}${t.constructFilterUrl()}`;let o=await this.fetchWithAuth(i,a);return this.followingRemapper.followingFromResponse(o)}else if(!t&&!e){let o=await this.fetchWithAuth(i,a);return this.followingRemapper.followingFromResponse(o)}t&&e?i=`${J}/${e}/following${this.apiSignInUrl}${t.constructFilterUrl()}`:!t&&e&&(i=`${J}/${e}/following${this.apiSignInUrl}`),a=`There was a problem fetching the followers of the following profile: ${e}`;let r=await this.fetchWithoutAuth(i,a);return this.followingRemapper.followingFromResponse(r)};follow=async t=>{let e=new bi;e.profile_ids=t;let i=J+`/follow${this.apiSignInUrl}`,a=`There was a problem with following profiles: ${t.join(",")}`,r="POST",o=await this.fetchWithAuth(i,a,r,e);return this.followingRemapper.followResponse(o.data)};unfollow=async t=>{let e=new bi;e.profile_ids=t;let i=J+`/follow${this.apiSignInUrl}`,a=`There was a problem with unfollowing profiles: ${t.join(",")}`,r="DELETE";return await this.fetchWithAuth(i,a,r,e),!0};getBadges=async t=>{let e=`${J}/badges${this.apiSignInUrl}`,i="There was a problem with fetching own badges";return t?(e=`${J}/${t}/badges${this.apiSignInUrl}`,i="There was a problem with fetching the badges",(await this.fetchWithoutAuth(e,i)).data):(await this.fetchWithAuth(e,i)).data};updateProfile=async t=>{let e=J+this.apiSignInUrl,i="There was a problem updating the own profile",a="PATCH",r=await this.fetchWithAuth(e,i,a,t);return this.profileRemapper.fullProfileFromResponse(r.data)};collectLead=async t=>{let e=`/leads${this.apiSignInUrl}`,i="There was a problem collecting lead",a="POST",r=await this.fetchWithAuth(e,i,a,this.leadRemapper.toRequest(t));return this.leadRemapper.fromResponse(r.data)};collectConsents=async t=>{let e=J+`/consents${this.apiSignInUrl}`,i="There was a problem collecting consents",a="POST",r=await this.fetchWithAuth(e,i,a,this.consentRemapper.toRequest(t));return this.consentRemapper.fromResponse(Array.isArray(r)?r:r.data)};checkFollowStatus=async t=>{let e=`/profile/followers/check-follow-status${this.apiSignInUrl}&profile_ids=${t.join(",")}`,i="There was a problem checking follow status for profiles",a=await this.fetchWithAuth(e,i);return this.followersRemapper.followStatusFromResponse(a.data)};deleteOwnProfile=async()=>{let t=`/profile${this.apiSignInUrl}`,e="There was a problem deleting own profile",i="DELETE";await this.fetchWithAuth(t,e,i)};deleteUserData=async()=>{let t=`/user-data${this.apiSignInUrl}`,e="There was a problem deleting profile data",i="DELETE";await this.fetchWithAuth(t,e,i)};getOwnExternalActivities=async()=>{let t=`/external-activities${this.apiSignInUrl}`,e="There was a problem getting own profile's external activities",i=await this.fetchWithAuth(t,e);return this.externalActivityRemapper.fromResponse(i.data?i.data.external_activities:i.external_activities)}};var Z=class{completed=!1;percentage;constructor(t){this.percentage=t}};var Na=class{teamFollowed=new Z(10);teamFavourite=new Z(15);playerFollowed=new Z(10);playerFavourite=new Z(10);competitionFollowed=new Z(10);competitionFavourite=new Z(5);addedBirthdate=new Z(10);addedGender=new Z(10);addedCountry=new Z(10);addedAvatar=new Z(10)};var ka=class{totalPercentage;breakdown=new Na};var Ii=class{limit=0;startAfter=null;constructor(t){this.limit=t.limit?t.limit:20,this.startAfter=t.startAfter?t.startAfter:null}constructFilterUrl=()=>{let t="";return this.limit&&(t=t+"&",t=t+`limit=${this.limit}`),this.startAfter&&(t=t+"&",t=t+`start_after=${this.startAfter}`),t}};var b=class extends Error{code=0;status=null;message=null;constructor(t,e,i){super(),this.code=t,this.status=e,this.message=i}errorMessage=()=>this.message};var _t=class{localCache;profileHttps=null;activityHttps=null;errorHandlingMode=null;constructor(t,e,i,a){this.localCache=t,this.profileHttps=e,this.activityHttps=i,this.errorHandlingMode=a}getOwn=async()=>{let t=await this.getLocalStorageData("profile");if(t&&Object.keys(t).length)return JSON.parse(JSON.stringify(t));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}};getOwnProfileFromCache=async()=>await this.localCache.getOwnProfile();updateOwnProfile=async()=>{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}};getByIds=async(t,e,i)=>{if(t&&t.length>0&&e||!t&&t.length===0&&!e)throw new h(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(t,e,i)}catch(a){throw console.warn(`There was a problem retrieving the selected profiles: ${t.join(",")} `,a),a}};getById=async t=>{try{return await this.profileHttps.getProfile(t)}catch(e){throw console.warn(`There was a problem retrieving the selected profile: ${t} `,e),e}};getCountries=async t=>{t=t||!1;let e=await this.localCache.getProfileCountries();if(e&&e.length>0)return e;try{let i=await this.profileHttps.getCountries(t);return await this.localCache.setProfileCountries(i),i}catch(i){throw console.warn("There was a problem retrieving profile countries: ",i),i}};getFollowers=async(t,e)=>{try{t&&(t=new Ii(t));let i=await this.profileHttps.getFollowers(t,e),a=i.data.map(r=>r.followerId);if(a.length){let r=await this.getByIds(a),o=i.data.map(n=>(r.forEach(l=>{n.followerId===l.id&&(n.name=l.name,n.nickname=l.nickname,n.avatar=l.avatar)}),n));return i.data=o,i}return i}catch(i){throw console.warn("There was a problem retrieving your followers: ",i),i}};getFollowing=async(t,e)=>{try{t&&(t=new Ii(t));let i=await this.profileHttps.getFollowing(t,e),a=i.data.map(r=>r.followingId);if(a.length){let r=await this.getByIds(a),o=i.data.map(n=>(r.forEach(l=>{n.followingId===l.id&&(n.name=l.name,n.nickname=l.nickname,n.avatar=l.avatar)}),n));return i.data=o,i}return i}catch(i){throw console.warn("There was a problem retrieving your following profiles: ",i),i}};follow=async t=>{try{return await this.profileHttps.follow(t)}catch(e){throw console.warn(`There was a problem following profiles: ${t.join(",")} `,e),e}};unfollow=async t=>{try{return await this.profileHttps.unfollow(t)}catch(e){throw console.warn(`There was a problem unfollowing profiles: ${t.join(",")} `,e),e}};showFullnessProfile=t=>{let e=new ka,i=0;return t.avatar&&(e.breakdown.addedAvatar.completed=!0,i+=e.breakdown.addedAvatar.percentage),t.birthDate&&(e.breakdown.addedBirthdate.completed=!0,i+=e.breakdown.addedBirthdate.percentage),t.country&&(e.breakdown.addedCountry.completed=!0,i+=e.breakdown.addedCountry.percentage),t.gender&&(e.breakdown.addedGender.completed=!0,i+=e.breakdown.addedGender.percentage),t.interests&&t.interests.length>0&&(t.interests.find(c=>c.type==="team"&&c.favourite)&&(e.breakdown.teamFavourite.completed=!0,i+=e.breakdown.teamFavourite.percentage),t.interests.find(c=>c.type==="team")&&(e.breakdown.teamFollowed.completed=!0,i+=e.breakdown.teamFollowed.percentage),t.interests.find(c=>c.type==="player"&&c.favourite)&&(e.breakdown.playerFavourite.completed=!0,i+=e.breakdown.playerFavourite.percentage),t.interests.find(c=>c.type==="player")&&(e.breakdown.playerFollowed.completed=!0,i+=e.breakdown.playerFollowed.percentage),t.interests.find(c=>c.type==="competition"&&c.favourite)&&(e.breakdown.competitionFavourite.completed=!0,i+=e.breakdown.competitionFavourite.percentage),t.interests.find(c=>c.type==="competition")&&(e.breakdown.competitionFollowed.completed=!0,i+=e.breakdown.competitionFollowed.percentage)),e.totalPercentage=i,e};getStats=async()=>{let t=await this.getLocalStorageData("statistics");if(t&&Object.keys(t).length)return JSON.parse(JSON.stringify(t));try{let e=await this.activityHttps.getStats();return await this.localCache.setProfileStats(e),e}catch(e){throw console.warn("There was a problem retrieving own profile statistics: ",e),e}};getBadges=async t=>{if(t)try{return await this.profileHttps.getBadges()}catch(i){throw console.warn("There was a problem retrieving own profile badges: ",i),i}let e=await this.getLocalStorageData("badges");if(e)return e;try{let i=await this.profileHttps.getBadges();return await this.localCache.setProfileBadges(i),i}catch(i){throw console.warn("There was a problem retrieving own profile badges: ",i),i}};clearLocalStorageData=async()=>{await this.localCache.setOwnProfile({}),await this.localCache.setProfileStats({}),await this.localCache.setProfileBadges(null)};collectLead=async t=>{if(this.errorHandlingMode&&!t)throw this.errorHandlingMode==="standard"?new h(400,"invalid_method_call","The method 'collectLead' from Profile namespace is not called correctly. You need to provide 'requestBody' parameter to the method."):new b(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(t)};collectConsents=async t=>{if(this.errorHandlingMode&&!t)throw this.errorHandlingMode==="standard"?new h(400,"invalid_method_call","The method 'collectConsents' from Profile namespace is not called correctly. You need to provide 'consents' parameter to the method."):new b(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(t)};checkFollowStatus=async t=>{if(!t||!Array.isArray(t)||t.length===0)throw this.errorHandlingMode==="standard"?new h(400,"invalid_method_call","Invalid or empty IDs provided. Please provide at least one ID."):new b(400,"invalid_method_call","Invalid or empty IDs provided. Please provide at least one ID.");return await this.profileHttps.checkFollowStatus(t)};getLocalStorageData=async t=>{let e=Math.floor(Date.now()/1e3),i=await this.localCache.getExpiration("profile",t);switch(t){case"profile":if(i>e)return await this.localCache.getOwnProfile();case"statistics":if(i>e)return await this.localCache.getProfileStats();case"badges":if(i>e)return await this.localCache.getProfileBadges();default:return null}}};var Ga=class{id=null;name=null;assets=null};var sl=class{extractUpdatedProps=(t,e)=>{let i=["name","nickname","gender","avatar","email"],a={};return Object.keys(t).forEach(r=>{if(i.includes(r)&&t[r]!==e[r])a[r]=e[r];else if(r==="phoneCountryCode")t[r]&&e[r]===null?a.phone_country_code=null:(t[r]===null&&e[r]||t[r]!==e[r])&&(a.phone_country_code=e[r]);else if(r==="phoneNumber")(t[r]&&e[r]===null||t[r]===null&&e[r]||t[r]!==e[r])&&(a.phone_number=e[r]);else if(r==="birthDate")(e[r]===null||t[r]===null&&e[r]||t[r]!==e[r])&&(a.birth_date=e[r]);else if(r==="country")e[r]===null?a.country_id=e[r]:(t[r]===null&&e[r]||t[r].id!==e[r].id)&&(a.country_id=e[r].id);else if(r==="interests"){let o=t[r],n=e[r];n.length&&this.isNewInterest(o,n)?a[r]=this.updateInterests(o,n):(!n.length&&o.length||o.length!==n.length&&!this.isNewInterest(o,n))&&(a[r]=n)}}),a};updateInterests=(t,e)=>{if(t.length===e.length){let[i,a]=this.extractSameAndNewInterests(t,e);return[...a,...i]}else return e};isNewInterest=(t,e)=>{let i=!1,[a]=this.extractSameAndNewInterests(t,e);return a.length&&(i=!0),i};extractSameAndNewInterests=(t,e)=>{let i=e.filter(r=>t.some(o=>r.id===o.id&&r.type===o.type&&r.source===o.source&&r.favourite===o.favourite));return[e.filter(r=>!t.some(o=>r.id===o.id&&r.type===o.type&&r.source===o.source&&r.favourite===o.favourite)),i]};isAvatarValidURL=t=>{try{return new URL(t),!0}catch{return!1}}};var nl=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(t,e,i,a,r){this.configuration=t,this.idsRemapper=e,this.localCache=i,this.profileHttps=a,this.profileService=new sl,this.profileFacade=new _t(i,a,r)}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 t=Math.floor(Date.now()/1e3);if(this.newProfileCheckResult===null&&(this.newProfileCheckResult=await this.isNewProfileRequested()),!this.ownProfile||this.expireAt<t||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 t=await this.profileFacade.getOwn();return this.setOwnProfile(t),this.modified=!1,this.isFetching=!1,this.ownProfile}catch(t){throw this.isFetching=!1,t}};delay=t=>new Promise(e=>{setTimeout(e,t)});setOwnProfile=t=>{this.ownProfile=t};resetProfileCheckResult=()=>{this.newProfileCheckResult=null};getInfo=async()=>{this.resetProfileCheckResult();let t=await this.getOwnProfile(),e=JSON.parse(JSON.stringify(t));return delete e.interests,e};showInterests=async()=>{this.resetProfileCheckResult();let t=await this.getOwnProfile(),e=JSON.parse(JSON.stringify(t));return await this.idsRemapper.remapInterests(e.interests)};showFullInterests=async()=>{this.resetProfileCheckResult();let t=await this.getOwnProfile(),e=JSON.parse(JSON.stringify(t));return await this.idsRemapper.showFullInterests(e.interests)};getFollowers=async t=>await this.profileFacade.getFollowers(t);getFollowing=async t=>await this.profileFacade.getFollowing(t);follow=async t=>{let e=await this.profileFacade.follow(t),i=await this.profileFacade.updateOwnProfile();return this.setOwnProfile(i),e};unfollow=async t=>{let e=await this.profileFacade.unfollow(t),i=await this.profileFacade.updateOwnProfile();return this.setOwnProfile(i),e};getStats=async()=>{await this.clearAllProfileData();let t=await this.profileFacade.getStats();return await this.idsRemapper.remapProfileStats(t)};getBadges=async t=>(await this.clearAllProfileData(),await this.profileFacade.getBadges(t));addInterestPromise=async t=>{this.modified=!0;let e={...t};await this.getOwnProfile();let i=null;t.source!=="custom"?i=await this.idsRemapper.remapInterestToNative(e):i=e;let a=this.ownProfile.interests.filter(r=>r.id!==i.id||r.type!==i.type||r.source!==i.source);return this.ownProfile.interests=[...a],this.ownProfile.interests.push(i),this};addInterest=t=>(this.promises.push(this.addInterestPromise(t)),this);removeInterestPromise=async t=>{this.modified=!0;let e={...t};await this.getOwnProfile();let i=null;return t.source!=="custom"?i=await this.idsRemapper.remapInterestToNative(e):i=e,this.ownProfile.interests=this.ownProfile.interests.filter(a=>a.id!==i.id||a.type!==i.type||a.source!==i.source),this};removeInterest=t=>(this.promises.push(this.removeInterestPromise(t)),this);setBirthdatePromise=async t=>(this.modified=!0,await this.getOwnProfile(),t?this.ownProfile.birthDate=t:this.ownProfile.birthDate=null,this);setBirthdate=t=>(this.promises.push(this.setBirthdatePromise(t)),this);setGenderPromise=async t=>(this.modified=!0,await this.getOwnProfile(),t==="male"||t==="female"?this.ownProfile.gender=t:this.ownProfile.gender="unspecified",this);setGender=t=>(this.promises.push(this.setGenderPromise(t)),this);setNicknamePromise=async t=>(this.modified=!0,await this.getOwnProfile(),this.ownProfile.nickname=t,this);setNickname=t=>(this.promises.push(this.setNicknamePromise(t)),this);setNamePromise=async t=>(this.modified=!0,await this.getOwnProfile(),this.ownProfile.name=t,this);setName=t=>(this.promises.push(this.setNamePromise(t)),this);setCountryPromise=async t=>(this.modified=!0,await this.getOwnProfile(),t&&!this.ownProfile.country?(this.ownProfile.country=new Ga,this.ownProfile.country.id=t):t&&this.ownProfile.country?this.ownProfile.country.id=t:this.ownProfile.country=null,this);setCountry=t=>(this.promises.push(this.setCountryPromise(t)),this);showFullnessProfile=async()=>{this.resetProfileCheckResult();let t=await this.getOwnProfile(),e=JSON.parse(JSON.stringify(t));return this.profileFacade.showFullnessProfile(e)};setAvatarPromise=async t=>{if(this.modified=!0,await this.getOwnProfile(),this.profileService.isAvatarValidURL(t))this.ownProfile.avatar=t;else{if(this.configuration.errorHandlingMode==="default")throw new b(400,"invalid_avatar","Invalid URL syntax for avatar image.");if(this.configuration.errorHandlingMode==="standard")throw new h(400,"invalid_avatar","Invalid URL syntax for avatar image.")}return this};setAvatar=t=>(this.promises.push(this.setAvatarPromise(t)),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 t=>(this.modified=!0,await this.getOwnProfile(),typeof t=="string"&&t?this.ownProfile.email=t:console.warn(`Wrong email argument: ${t}. Will be ignored when updating profile`),this);setEmail=t=>(this.promises.push(this.setEmailPromise(t)),this);setPhoneCountryCodePromise=async t=>(this.modified=!0,await this.getOwnProfile(),t===null||typeof t=="string"&&t?this.ownProfile.phoneCountryCode=t:console.warn(`Wrong phoneCountryCode argument: ${t}. Will be ignored when updating profile`),this);setPhoneCountryCode=t=>(this.promises.push(this.setPhoneCountryCodePromise(t)),this);setPhoneNumberPromise=async t=>(this.modified=!0,await this.getOwnProfile(),t===null||typeof t=="string"&&t?this.ownProfile.phoneNumber=t:console.warn(`Wrong phoneNumber argument: ${t}. Will be ignored when updating profile`),this);setPhoneNumber=t=>(this.promises.push(this.setPhoneNumberPromise(t)),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 t=await this.profileFacade.getOwn(),e=await this.getOwnProfile(),i=this.profileService.extractUpdatedProps(t,e);if(this.modified=!1,this.expireAt=0,Object.keys(i).length){let r=await this.profileHttps.updateProfile(i),o=JSON.parse(JSON.stringify(r));return this.setOwnProfile(o),await this.localCache.setOwnProfile(o),delete r.interests,r}let a=JSON.parse(JSON.stringify(this.ownProfile));return delete a.interests,a};clearAllProfileData=async()=>{this.newProfileCheckResult===!0&&await this.profileFacade.clearLocalStorageData()};isNewProfileRequested=async()=>{let t=this.profileHttps.extractUserIdFromToken();if(!t)return!1;if(!this.ownProfile){let e=await this.profileFacade.getOwnProfileFromCache();return!!(e&&Object.keys(e).length&&e.id!==t)}return this.ownProfile.id!==t}};var wi=class{idsRemapper=null;profileHttps=null;activityHttps=null;profileFacade=null;profileId="";localCache=null;constructor(t,e,i,a){this.idsRemapper=t,this.profileHttps=i,this.activityHttps=a,this.localCache=e,this.profileFacade=new _t(e,i,a)}getById=t=>new wi(this.idsRemapper,this.localCache,this.profileHttps,this.activityHttps).setId(t);setId=t=>(this.profileId=t,this);getProfile=async()=>await this.profileFacade.getById(this.profileId);getInfo=async()=>{let t=await this.getProfile();return delete t.interests,t};showInterests=async()=>{let t=await this.getProfile(),e=JSON.parse(JSON.stringify(t));return await this.idsRemapper.remapInterests(e.interests)};showFullInterests=async()=>{let t=await this.getProfile(),e=JSON.parse(JSON.stringify(t));return await this.idsRemapper.showFullInterests(e.interests)};getFollowers=async t=>await this.profileFacade.getFollowers(t,this.profileId);getFollowing=async t=>await this.profileFacade.getFollowing(t,this.profileId);showFullnessProfile=async()=>{let t=await this.getProfile();return this.profileFacade.showFullnessProfile(t)};getStats=async t=>{let e=await this.activityHttps.getStats(this.profileId,t);return await this.idsRemapper.remapProfileStats(e)};getBadges=async()=>await this.profileHttps.getBadges(this.profileId)};var ll=class{localCache=null;https=null;idMapping=null;constructor(t,e,i){this.localCache=t,this.idMapping=i,this.https=e}getCountriesWithIdMapping=async t=>{try{let e=await this.getCountries(t);return this.idMapping.remapEntities(e,"country")}catch(e){throw console.warn("There was a problem browsing countries as football entities",e),e}};getCountries=async t=>{t=t||!1;let e=await this.localCache.getFootballCountries();if(e&&e.length>0)return e;try{let i=await this.https.getCountries(t);return await this.localCache.setFootballCountries(i),i}catch(i){throw console.warn("There was a problem retrieving countries as football entities",i),i}}};var _i=class{countryId=null;name=null;gender=null;type=null;sortField=null;sortOrder=null;competitionIds=null;constructor(t){this.countryId=t.countryId?`${t.countryId}`:null,this.name=t.name?t.name:null,this.gender=t.gender?t.gender:null,this.type=t.type?t.type:null,this.sortField=t.sortField?`${t.sortField}`:null,this.sortOrder=t.sortOrder?`${t.sortOrder}`:null,this.competitionIds=t.competitionIds?t.competitionIds:null}constructFilterUrl=()=>{let t="";return this.countryId&&(t=t+"&",t=t+`country_id=${this.countryId}`),this.gender&&(t=t+"&",t=t+`gender=${this.gender}`),this.type&&(t=t+"&",t=t+`type=${this.type}`),this.sortField&&(t=t+"&",t=t+`sort_field=${this.sortField}`),this.sortOrder&&(t=t+"&",t=t+`sort_order=${this.sortOrder}`),this.name&&(t=t+"&",t=t+`name=${this.name}`),this.competitionIds&&this.competitionIds.length>0&&(t=t+"&",t=t+`competition_ids=${this.competitionIds.join(",")}`),t};competitionSearchFilter=t=>{try{let e=this.filter(t);return this.sortField||this.sortOrder?this.sort(e):e}catch(e){return console.warn("There was a problem filtering the local competitions",e),[]}};filter=t=>{let e=this.entitiesToSearchWith();return t.filter(i=>{let a=!0;return e.forEach(r=>{r!=="sortOrder"&&r!=="sortField"&&(r==="countryId"?a&&=i.country.id===this[r]:r==="name"?a&&=i.name.toLocaleLowerCase().includes(this[r].toLocaleLowerCase()):r==="competitionIds"?a&&=this[r].some(o=>i.id===o):a&&=i[r].toLocaleLowerCase()===this[r].toLocaleLowerCase())}),a})};entitiesToSearchWith=()=>{let t=[];return this.countryId&&t.push("countryId"),this.name&&t.push("name"),this.gender&&t.push("gender"),this.type&&t.push("type"),this.sortField&&t.push("sortField"),this.sortOrder&&t.push("sortOrder"),this.competitionIds&&t.push("competitionIds"),t};sort=t=>{let e=[];return this.sortField==="name"?e=t.sort((i,a)=>this.sortOrder&&this.sortOrder==="desc"?a.name.localeCompare(i.name):i.name.localeCompare(a.name)):this.sortField==="country"?e=t.sort((i,a)=>this.sortOrder&&this.sortOrder==="desc"?a.country.name.localeCompare(i.country.name):i.country.name.localeCompare(a.country.name)):this.sortField==="scope"?t.forEach(i=>e[this.competitionIds.indexOf(i.id)]=i):!this.sortField&&this.sortOrder==="desc"&&(e=t.sort((i,a)=>a.id.localeCompare(i.id))),e}};var pl=class{localStorage=null;https=null;idMapping=null;constructor(t,e,i){this.localStorage=t,this.idMapping=i,this.https=e}getCompetitionsIdMapping=async(t,e)=>{try{let i=!1;if(t){if(t=new _i(t),t.countryId){let r=await this.idMapping.getEntityIdsBySchemaId([`${t.countryId}`],"country","native");r.country.length===0&&(i=!0),t.countryId=r.country[0]}if(t.competitionIds){let r=await this.idMapping.getEntityIdsBySchemaId(t.competitionIds,"competition","native");r.competition.length===0&&(i=!0),t.competitionIds=r.competition}if(i)return[]}let a=await this.getCompetitions(t,e);return await this.idMapping.remapEntities(a,"competition")}catch(i){throw console.warn("There was a problem browsing all of the competitions",i),i}};getCompetitionsMapWithNativeIds=async t=>{let e=new Map,i=t.length,a=new _i({competitionIds:t,limit:i}),r=await this.getCompetitions(a);r.sort((l,p)=>l.id.localeCompare(p.id));let o=Xp(t),n=await this.idMapping.remapEntities(r,"competition");return o.forEach((l,p)=>e.set(l,n[p])),e};getCompetitions=async(t,e)=>{let i=null;if(e=e||!1,!await this.localStorage.getCompetitionsLength()){try{i=await this.https.getCompetitions()}catch(a){throw console.warn("There was a problem retrieving all competitions",a),a}await this.localStorage.setCompetitions(i)}return await this.localStorage.getCompetitions(t)};getCompetitionByIdIdMapping=async(t,e)=>{try{let a=(await this.idMapping.getEntityIdsBySchemaId([t],"competition","native")).competition[0],r=await this.getCompetitionById(a,e);return await this.idMapping.remapEntities(r,"competition")}catch(i){throw console.warn(`There was a problem browsing the following competition:${t}`,i),i}};getCompetitionById=async(t,e)=>{try{return e=e||!1,await this.https.getCompetitionById(t,e)}catch(i){throw console.warn(`There was a problem retrieving the competition with the following id: ${t}`,i),i}};getTopCompetitionsIdMapping=async t=>{try{let e=await this.getTopCompetitions(t);return await this.idMapping.remapEntities(e,"competition")}catch(e){throw console.warn("There was a problem browsing the top competitions",e),e}};getTopCompetitions=async t=>{try{return t=t||!1,await this.https.getTopCompetitions(t)}catch(e){throw console.warn("There was a problem retrieving the top competitions",e),e}}};var Pi=class{name=null;countryId=null;national=!1;gender=null;limit=null;page=null;scope=null;sortField=null;sortOrder=null;teamIds=null;constructor(t){this.name=t.name?t.name:null,this.countryId=t.countryId?`${t.countryId}`:null,this.national=t.national?t.national:!1,this.gender=t.gender?t.gender:null,this.limit=t.limit?t.limit:null,this.page=t.page?t.page:null,this.scope=t.scope?t.scope:null,this.sortField=t.sortField?`${t.sortField}`:null,this.sortOrder=t.sortOrder?`${t.sortOrder}`:null,this.teamIds=t.teamIds?t.teamIds:null}constructFilterUrl=()=>{let t="";return this.name&&(t=t+"&",t=t+`name=${this.name}`),this.countryId&&(t=t+"&",t=t+`country_id=${this.countryId}`),this.national&&(t=t+"&",t=t+`national=${this.national}`),this.gender&&(t=t+"&",t=t+`gender=${this.gender}`),this.limit&&(t=t+"&",t=t+`limit=${this.limit}`),this.scope&&this.scope.length>0&&(t=t+"&",t=t+`scope=${this.scope.join(",")}`),this.page&&(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}`),this.teamIds&&this.teamIds.length>0&&(t=t+"&",t=t+`team_ids=${this.teamIds.join(",")}`),t}};var Ua=class{reason="";words=[]};var Te=class{enabled=!1;moderateLinks=!1;linksWhitelist=[];moderatorProfileId="";dictionary=new Ua};var Va=class{enabled=!1;clientId=null;automaticModeration=new Te};var xt=class{points=null;gameParticipationCount=null;entityId=null;entityType=null;predictionsMade=null;correctPredictions=null};var Ee=class{id;weight;multiplier;conditions};var Re=class{value=[new Ee]};var Fe=class{points=null;tiers=null;badges=null};var Ha=class{enabled=!1;clientId=null;conditions={list:null};actions=new Re;rewards=new Fe};var $a=class{general=null;predictor=null;activity=null;topX=null;matchQuiz=null;discussionPost=null};var Se=class{enabled=!1;clientId=null;defaultMarkets=null;competitionsWhitelist=null;authRequirement=null};var ve=class{enabled=!1;clientId=null;minFixtures=null;maxFixtures=null;competitionsWhitelist=null;authRequirement=null};var za=class{competitions=[];teams=[];markets=[]};var Ce=class{enabled=!1;clientId=null;fullCoverageCompetitions=null;markets=null;successRateScopes=new za;userDataConfig=null};var Qa=class{storeIp=!1;storeDeviceId=!1;storeAgent=!1};var qa=class{potm=[];poll=[]};var Wa=class{predictor=[];topX=[];matchQuiz=[];games=[];football=[];classicQuizzes=[];eitherOr=[];discussions=[];voting=new qa};var q=class{id;label;description;flags;assets={mainImageUrl:""};enabled};var Ka=class{predictionsNumber;correctPredictions;points;fromDate;toDate};var ja=class extends q{requirements=new Ka};var Ya=class{participationCount;points;fromDate;toDate};var Xa=class extends q{requirements=new Ya};var Ja=class{participationCount;points;specificGames;fromDate;toDate};var Za=class extends q{requirements=new Ja};var tr=class{predictionsNumber;correctPredictions;points;entityId;entityType;entityModel=null};var er=class extends q{requirements=new tr};var ir=class{participationCount;fromDate;toDate};var ar=class extends q{requirements=new ir};var rr=class{totalDiscussionPoints;postsCount;postPoints;reactionsCount};var or=class extends q{requirements=new rr};var sr=class{points;voteCount;entityId;entityType;entityModel};var Ae=class extends q{requirements=new sr};var Oe=class{points=null;tiers=null;badges=null};var nr=class{enabled=!1;clientId=null;conditions={list:null};actions=new Re;rewards=new Oe};var lr=class{general=[];predictor=[];topX=[];matchQuiz=[]};var pr=class{id;label;assets={mainImageUrl:""};enabled;requirements=new xt};var xe=class extends xt{postPoints=null;postsCount=null;reactionsCount=null;totalDiscussionPoints=null};var cr=class{id;label;assets={mainImageUrl:""};enabled;requirements=new xe};var Le=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};var De=class{total=null;minGoalkeepers=null;maxGoalkeepers=null;minDefenders=null;maxDefenders=null;minMidfielders=null;maxMidfielders=null;minStrikers=null;maxStrikers=null};var ur=class{enabled=!1;clientId=null;addPointsToProfileTotal=!1;coefficients=new Le;players=new De;multipliers=null;competitionsWhitelist=[]};var dr=class{captain=null;viceCaptain=null};var cl=class{remapPredictorConfig=t=>{let e=new Ce;return e.enabled=t.enabled,e.clientId=t.client_id,e.fullCoverageCompetitions=t.full_coverage_competitions,e.markets=t.markets,e.successRateScopes=t.success_rate_scopes,e.userDataConfig=t.user_data_config?this.remapUserDataConfig(t.user_data_config):null,e};remapTopXConfig=t=>{let e=new ve;return e.enabled=t.enabled,e.clientId=t.client_id,e.minFixtures=t.min_fixtures,e.maxFixtures=t.max_fixtures,e.competitionsWhitelist=t.competitions_whitelist,e.authRequirement=t.auth_requirement,e};remapMatchQuizConfig=t=>{let e=new Se;return e.enabled=t.enabled,e.clientId=t.client_id,e.defaultMarkets=t.default_markets,e.competitionsWhitelist=t.competitions_whitelist,e.authRequirement=t.auth_requirement,e};remapLoyaltyConfig=t=>{let e=new Ha;return e.enabled=t.enabled,e.clientId=t.client_id,e.conditions.list=t.conditions.list,e.actions.value=t.actions.value,e.rewards=this.remapRewards(t.rewards),e};remapLoyaltyNewConfig=t=>{let e=new nr;return e.enabled=t.enabled,e.clientId=t.client_id,e.conditions.list=t.conditions.list,e.actions.value=t.actions.value,e.rewards=this.remapNewRewards(t.rewards),e};remapDiscussionsConfig=t=>{let e=new Va;return e.enabled=t.enabled,e.clientId=t.client_id,e.automaticModeration=t.automatic_moderation?this.remapAutomaticModeration(t.automatic_moderation):null,e};remapFantasyConfig=t=>{let e=new ur;return e.enabled=t.enabled,e.clientId=t.client_id,e.addPointsToProfileTotal=t.add_points_to_profile_total,e.competitionsWhitelist=t.competitions_whitelist,e.multipliers=t.multipliers?this.remapMultipliers(t.multipliers):null,e.players=this.remapFantasyPlayers(t.players),e.coefficients=this.remapFantasyCoefficients(t.coefficients),e};remapFantasyPlayers=t=>{let e=new De;return e.total=t.total,e.minGoalkeepers=t.min_goalkeepers,e.maxGoalkeepers=t.max_goalkeepers,e.minDefenders=t.min_defenders,e.maxDefenders=t.max_defenders,e.minMidfielders=t.min_midfielders,e.maxMidfielders=t.max_midfielders,e.minStrikers=t.min_strikers,e.maxStrikers=t.max_strikers,e};remapFantasyCoefficients=t=>{let e=new Le;return e.assists=t.assists,e.shots=t.shots,e.offsides=t.offsides,e.tackles=t.tackles,e.saves=t.saves,e.minutesEqualOrOver60=t.minutes_equal_or_over_60,e.minutesUnder60=t.minutes_under_60,e.yellowCards=t.yellow_cards,e.redCards=t.red_cards,e.goalsGoalkeeper=t.goals_goalkeeper,e.goalsDefender=t.goals_defender,e.goalsMidfielder=t.goals_midfielder,e.goalsForwards=t.goals_forwards,e.penaltyGoals=t.penalty_goals,e.ownGoals=t.own_goals,e.cleanSheetsGoalkeeper=t.clean_sheets_goalkeeper,e.cleanSheetsDefender=t.clean_sheets_defender,e.cleanSheetsMidfielder=t.clean_sheets_midfielder,e.cleanSheetsForwards=t.clean_sheets_forwards,e.shotsOn=t.shots_on,e.foulsCommitted=t.fouls_committed,e.penaltyCommitted=t.penalty_committed,e.penaltyWon=t.penalty_won,e.penaltyMissed=t.penalty_missed,e.concededGoals=t.conceded_goals,e.caughtBall=t.caught_ball,e};remapAutomaticModeration=t=>{let e=new Te;return e.enabled=t.enabled,e.moderateLinks=t.moderate_links,e.linksWhitelist=t.links_whitelist,e.moderatorProfileId=t.moderator_profile_id,e.dictionary=t.dictionary,e};remapNewRewards=t=>{let e=new Oe;return e.points=this.remapPoints(t.points),e.tiers=t.tiers,e.badges=this.remapNewBadges(t.badges),e};remapRewards=t=>{let e=new Fe;return e.points=this.remapPoints(t.points),e.tiers=t.tiers,e.badges=this.remapBadges(t.badges),e};remapPoints=t=>{let e=new $a;return e.general=t.general,e.discussionPost=t.discussion_post,e.predictor=t.predictor,e.activity=t.activity,e.topX=t.top_x,e.matchQuiz=t.match_quiz,e};remapBadges=t=>{let e=new lr;return e.general=t.general?this.remapGeneralBadgeValues(t.general):[],e.predictor=this.remapBadgeValues(t.predictor),e.topX=this.remapBadgeValues(t.top_x),e.matchQuiz=this.remapBadgeValues(t.match_quiz),e};remapNewBadges=t=>{let e=new Wa;return e.predictor=this.remapBadgeValuesPredictor(t.predictor),e.topX=this.remapBadgeValuesGame(t.top_x),e.matchQuiz=this.remapBadgeValuesGame(t.match_quiz),t.games&&(e.games=this.remapBadgeValuesGames(t.games)),t.football&&(e.football=this.remapBadgeValuesFootball(t.football)),t.classic_quizzes&&(e.classicQuizzes=this.remapBadgeValuesMiniGames(t.classic_quizzes)),t.either_or&&(e.eitherOr=this.remapBadgeValuesMiniGames(t.either_or)),t.discussions&&(e.discussions=this.remapBadgeValuesDiscussions(t.discussions)),t.voting&&t.voting.potm&&(e.voting.potm=this.remapBadgeValuesVoting(t.voting.potm)),t.voting&&t.voting.poll&&(e.voting.poll=this.remapBadgeValuesVoting(t.voting.poll)),e};remapBadgeValuesPredictor=t=>t.map(e=>{let i=new ja;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.predictionsNumber=e.requirements.predictions_number,i.requirements.correctPredictions=e.requirements.correct_predictions,i.requirements.points=e.requirements.points,i.requirements.fromDate=e.requirements.from_date,i.requirements.toDate=e.requirements.to_date),i});remapBadgeValuesGame=t=>t.map(e=>{let i=new Xa;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.participationCount=e.requirements.participation_count,i.requirements.points=e.requirements.points,i.requirements.fromDate=e.requirements.from_date,i.requirements.toDate=e.requirements.to_date),i});remapBadgeValuesGames=t=>t.map(e=>{let i=new Za;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.participationCount=e.requirements.participation_count,i.requirements.points=e.requirements.points,i.requirements.fromDate=e.requirements.from_date,i.requirements.toDate=e.requirements.to_date,i.requirements.specificGames=e.requirements.specific_games?this.remapSpecificGamesRequirement(e.requirements.specific_games):null),i});remapSpecificGamesRequirement=t=>t.map(e=>({gameId:e.game_id,gameType:e.game_type,gameModel:null}));remapBadgeValuesFootball=t=>t.map(e=>{let i=new er;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.predictionsNumber=e.requirements.predictions_number,i.requirements.correctPredictions=e.requirements.correct_predictions,i.requirements.points=e.requirements.points,i.requirements.entityId=e.requirements.entity_id,i.requirements.entityType=e.requirements.entity_type),i});remapBadgeValuesMiniGames=t=>t.map(e=>{let i=new ar;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.participationCount=e.requirements.participation_count,i.requirements.fromDate=e.requirements.from_date,i.requirements.toDate=e.requirements.to_date),i});remapBadgeValuesDiscussions=t=>t.map(e=>{let i=new or;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.totalDiscussionPoints=e.requirements.total_discussion_points,i.requirements.postsCount=e.requirements.posts_count,i.requirements.postPoints=e.requirements.post_points,i.requirements.reactionsCount=e.requirements.reactions_count),i});remapBadgeValuesVoting=t=>t.map(e=>{let i=new Ae;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.points=e.requirements.points,i.requirements.voteCount=e.requirements.vote_count,i.requirements.entityId=e.requirements.entity_id,i.requirements.entityType=e.requirements.entity_type),i});remapBadgeValues=t=>t.map(e=>{let i=new pr;return i.id=e.id,i.label=e.label,i.enabled=e.enabled,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,i.requirements=this.remapRequirements(e.requirements),i});remapRequirements=t=>{let e=new xt;return e.points=t.points,e.gameParticipationCount=t.game_participation_count,e.entityId=t.entity_id,e.entityType=t.entity_type,e.predictionsMade=t.predictions_made,e.correctPredictions=t.correct_predictions,e};remapUserDataConfig=t=>{let e=new Qa;return e.storeIp=t.store_ip,e.storeDeviceId=t.store_device_id,e.storeAgent=t.store_agent,e};remapGeneralBadgeValues=t=>t.map(e=>{let i=new cr;return i.id=e.id,i.label=e.label,i.enabled=e.enabled,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,i.requirements=this.remapGeneralRequirements(e.requirements),i});remapGeneralRequirements=t=>{let e=new xe;return e.points=t.points,e.gameParticipationCount=t.game_participation_count,e.entityId=t.entity_id,e.entityType=t.entity_type,e.predictionsMade=t.predictions_made,e.correctPredictions=t.correct_predictions,e.postPoints=t.post_points,e.postsCount=t.posts_count,e.reactionsCount=t.reactions_count,e.totalDiscussionPoints=t.total_discussion_points,e};remapMultipliers=t=>{let e=new dr;return e.captain=t.captain,e.viceCaptain=t.vice_captain,e}};var mr=class{entityId;entityType;entityModel=null};var nc=class{totalItems=0};var lc=class{id=null;label=null};var pc=class{type=null;id=null;label=null};var hr=class{id=null;source=null;type=null};var I=class{limit;startAfter;constructor(t){this.limit=t&&t.limit?t.limit:null,this.startAfter=t&&t.startAfter?t.startAfter:null}constructMainFiltersUrl(){let t="";return this.limit&&(t+="&",t+=`limit=${this.limit}`),this.startAfter&&(t+="&",t+=`start_after=${this.startAfter}`),t}};var fr=class extends I{};var cc=class{fixtures=[];tiebreaker};var lu=(i=>(i.PARTICIPANT_ONE="PARTICIPANT_ONE",i.PARTICIPANT_TWO="PARTICIPANT_TWO",i.DRAW="DRAW",i))(lu||{});var gr=class{matchId="";participantOne="";participantTwo="";winner="PARTICIPANT_ONE"};var ft=(o=>(o.OPEN="OPEN",o.LIVE="LIVE",o.PENDING="PENDING",o.CANCELED="CANCELED",o.CLOSED="CLOSED",o.SETTLED="SETTLED",o))(ft||{});var yr=class extends I{status=null;sortOrder=null;gameIds=null;constructor(t){super(t),this.status=t?.status||null,this.sortOrder=t?.sortOrder||null,this.gameIds=t?.gameIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.status&&Object.values(ft).includes(this.status)?(t+="&",t+=`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")?(t+="&",t+=`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?(t+="&",t+=`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.`),t}};var br=class{profileId="";profileModel=null;challengeId="";challengeModel=null;message=""};var Be=class{name="";description="";invitation_code="";template_id="";users_can_invite_users=!1;administrators=[];scoring_starts_at=""};var Mr=class extends Be{type="ONE_VS_ONE"};var Ne=class{name="";description="";invitation_code="";template_id="";users_can_invite_users=!1;administrators=[];pinned_posts=[];scoring_starts_at=""};var Ir=class extends Ne{type="ONE_VS_ONE"};var wr=class{limit=null;page=null;challengeId=null;templateId=null;sortOrder=null;constructor(t){this.limit=t&&t.limit?t.limit:null,this.page=t&&t.page?t.page:null,this.challengeId=t&&t.challengeId?t.challengeId:null,this.templateId=t&&t.templateId?t.templateId:null,this.sortOrder=t&&t.sortOrder?t.sortOrder:null}constructFiltersUrl=()=>{let t="";return this.limit&&(t+=`&limit=${this.limit}`),this.page&&(t+=`&page=${this.page}`),this.challengeId&&(t+=`&league_id=${this.challengeId}`),this.templateId&&(t+=`&template_id=${this.templateId}`),this.sortOrder&&(t+=`&sort_order=${this.sortOrder}`),t}};var _r=class{type="ONE_VS_ONE";userRole=null;constructor(t){this.userRole=t?.userRole||null}constructFiltersUrl=()=>{let t=`&type=${this.type}`;return this.userRole&&(t+=`&user_role=${this.userRole}`),t}};var Pr=class{templateId="";templateModel=null;challengeId="";challengeModel=null;position="";points=0;type="challenge"};var Tr=class{id="";label="";discussionType="LEAGUE";discussionUrl=null;moderationType="USER";postsCount=0;pinnedPosts=[];lastPostId="";status="";deleted=!1;deletedAt="";deletedBy="";customFields=null;context=null;createdAt="";updatedAt=""};var uc=class{content="";replyId="";discussionLabel="";discussionUrl="";userNickname="";context=null};var ke=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=""};var Er=class extends ke{userModel=null};var Rr=class{content="";reply_id="";discussion_label="";discussion_url="";anonymous_nickname="";context=null};var Fr=class{id="";postsCount=0};var Lt=class{pagination={totalItems:0,nextPageStartsAfter:"",lastCommentCreateTimestamp:""}};var Sr=class{meta=new Lt;data=[]};var vr=class{meta=new Lt;data=[]};var Cr=class{meta=new y;data=[]};var Ar=class{type="";userIds=[];reactionCount=0};var Or=class{userId=null;reason="AD";reasonDetails=null};var xr=class{updatedAt="";content=""};var Fd=["CREATED_AT_ASC","CREATED_AT_DESC","POSTS_COUNT_ASC","POSTS_COUNT_DESC"],Sd=["ACTIVE","INACTIVE"],Lr=class extends I{discussionIds;label;discussionUrl;fromDate;toDate;fromCount;toCount;sort;status;skipDeleted;constructor(t){super(t),this.discussionIds=t&&t.discussionIds?t.discussionIds:null,this.label=t&&t.label?t.label:null,this.discussionUrl=t&&t.discussionUrl?t.discussionUrl:null,this.fromDate=t&&t.fromDate?t.fromDate:null,this.toDate=t&&t.toDate?t.toDate:null,this.fromCount=t&&t.fromCount?t.fromCount:null,this.toCount=t&&t.toCount?t.toCount:null,this.sort=t&&t.sort?t.sort:null,this.status=t?.status||null,this.skipDeleted=t&&t.skipDeleted!==void 0?t.skipDeleted:null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.discussionIds!==null&&(t+=`&discussion_ids=${this.discussionIds.join(",")}`),this.label!==null&&(t+=`&label=${this.label}`),this.discussionUrl!==null&&(t+=`&discussion_url=${this.discussionUrl}`),this.fromDate!==null&&(t+=`&from_date=${this.fromDate}`),this.toDate!==null&&(t+=`&to_date=${this.toDate}`),this.fromCount!==null&&(t+=`&from_count=${this.fromCount}`),this.toCount!==null&&(t+=`&to_count=${this.toCount}`),this.sort&&Fd.includes(this.sort.toUpperCase())&&(t+=`&sort=${this.sort.toUpperCase()}`),this.status&&Sd.includes(this.status.toUpperCase())&&(t+=`&status=${this.status.toUpperCase()}`),this.skipDeleted!==null&&(t+=`&skip_deleted=${this.skipDeleted}`),t}};var Yt=class extends I{skipDeleted;skipModerated;sort;constructor(t){super(t),this.skipDeleted=t&&t.skipDeleted!==void 0?t.skipDeleted:null,this.skipModerated=t&&t.skipModerated!==void 0?t.skipModerated:null,this.sort=t&&t.sort?t.sort.toLocaleLowerCase():null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.skipDeleted!==null&&(t+=`&skip_deleted=${this.skipDeleted}`),this.skipModerated!==null&&(t+=`&skip_moderated=${this.skipModerated}`),this.sort&&(t+=`&sort=${this.sort}`),t}};var Dr=class extends I{fromDate;toDate;entityIds;entityType;contentType;constructor(t){super(t),this.fromDate=t?.fromDate||null,this.toDate=t?.toDate||null,this.entityIds=t?.entityIds||null,this.entityType=t?.entityType||null,this.contentType=t?.contentType||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.fromDate!==null&&(t+=`&from_date=${this.fromDate}`),this.toDate!==null&&(t+=`&to_date=${this.toDate}`),this.entityIds!==null&&this.entityIds.length>0&&(t+=`&entity_ids=${this.entityIds}`),this.contentType!==null&&(t+=`&content_type=${this.contentType}`),t}};var Br=class extends I{status=null;sortOrder=null;gameIds=null;constructor(t){super(t),this.status=t?.status||null,this.sortOrder=t?.sortOrder||null,this.gameIds=t?.gameIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.status&&Object.values(ft).includes(this.status)?(t+="&",t+=`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")?(t+="&",t+=`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?(t+="&",t+=`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.`),t}};var Nr=class extends I{};var kr=class extends I{};var dc=class{id="";predictionType;prediction};var mc=class{fixtures=[];tiebreaker};var hc=class{options=[]};var fc=class{min=0;max=0};var Gr=class{templateId=null;playerId=null};var Ur=class{filters=new Gr};var Vr=class{meta=new Ur;data=[]};var Hr=class{key=null;label=null;value=null};var $r=class{templateId=null};var zr=class{filters=new $r};var Qr=class{meta=new zr;data=[]};var Ge=class{template_id=null;group_id=null;fixtures=[]};var Ue=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};var Dt=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};var qr=class{matchId=null;matchModel=null;points=new Ue;stats=new Dt};var Wr=class{playerId=null;playerModel=null;points=null;rank=null};var Kr=class{id="";country=null;gender="";assets=null;type="";name=""};var jr=class{id="";country=null;gender="";assets=null;type="";name="";participants=[]};var Yr=class{id="";alias="";countryCode="";assets=null;name=""};var X=class{type=null;subType=null};var Xr=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 X};var Jr=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 X;lineups=null};var gt=class{countryIds=null;competitionIds=null;matchIds=null;status=null;teamIds=null;fromDate=null;toDate=null;limit=null;page=null;sortField=null;sortOrder=null;constructor(t){this.countryIds=t.countryIds?t.countryIds:null,this.competitionIds=t.competitionIds?t.competitionIds:null,this.matchIds=t.matchIds?t.matchIds:null,this.status=t.status?t.status:null,this.teamIds=t.teamIds?t.teamIds:null,this.fromDate=t.fromDate?t.fromDate:null,this.toDate=t.toDate?t.toDate:null,this.limit=t.limit?t.limit:null,this.page=t.page?t.page:null,this.sortField=t.sortField?t.sortField:null,this.sortOrder=t.sortOrder?t.sortOrder:null}constructFilterUrl=t=>{let e="";return this.countryIds&&(e=e+"&",e=e+`countries=${this.countryIds.join(",")}`),this.competitionIds&&this.competitionIds.length>0&&(e=e+"&",e=e+`competitions=${this.competitionIds.join(",")}`),this.matchIds&&this.matchIds.length>0&&(e=e+"&",e=e+`matches=${this.matchIds.join(",")}`),this.status&&(e=e+"&",e=e+`status=${this.status}`),this.teamIds&&this.teamIds.length>0&&(e=e+"&",e=e+`teams=${this.teamIds.join(",")}`),this.fromDate&&(e=e+"&",e=e+`from_date=${this.fromDate}`),this.toDate&&(e=e+"&",e=e+`to_date=${this.toDate}`),this.limit&&!t&&(e=e+"&",e=e+`limit=${this.limit}`),this.page&&!t&&(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}};var Zr=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};var to=class{ftScore=null;htScore=null;aetScore=null;aggScore=null;penScore=null};var Ve=class{homeTeam={players:[]};awayTeam={players:[]}};var eo=class{minute="";type="";teamId="";player=null;relatedPlayer=null;updatedAt=""};var io=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};var ao=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;isDeleted=!1;teams=[]};var ro=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;isDeleted=!1;competitions=[];teams=[]};var oo=class{id="";startDate="";endDate="";shirtNumber;loan=!1;position="";country=null;name="";assets=null;birthDate=""};var so=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null};var Ti=class{countryId=null;scope=null;name=null;playerIds=null;limit=null;page=null;sortField=null;sortOrder=null;constructor(t){this.countryId=t.countryId?t.countryId:null,this.scope=t.scope?t.scope:null,this.name=t.name?t.name:null,this.playerIds=t.playerIds?t.playerIds:null,this.limit=t.limit?t.limit:null,this.page=t.page?t.page:null,this.sortField=t.sortField?t.sortField:null,this.sortOrder=t.sortOrder?t.sortOrder:null}constructFilterUrl=()=>{let t="";return this.countryId&&(t=t+"&",t=t+`country_id=${this.countryId}`),this.scope&&this.scope.length>0&&(t=t+"&",t=t+`scope=${this.scope.join(",")}`),this.name&&(t=t+"&",t=t+`name=${this.name}`),this.playerIds&&this.playerIds.length>0&&(t=t+"&",t=t+`player_ids=${this.playerIds.join(",")}`),this.limit&&(t=t+"&",t=t+`limit=${this.limit}`),this.page&&(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}};var gc=class{headshot=null};var yc=class{id=null;name=null;country=null};var no=class{id="";name="";position="";shirtNumber;assets=null;type=""};var lo=class{id="";country=null;gender="";assets=null;name="";code="";national=!1;undecided=!1;fullName="";shortName="";isDeleted=!1};var po=class{primary=null;secondary=null;tertiary=null};var co=class{id="";country=null;gender="";assets=null;name="";competitions=[];code="";national=!1;fullName="";shortName="";isDeleted=!1;undecided=!1;colors=new po;squad=[]};var bc=class{teamId=null;matches=[]};var uo=class{teams=null;players=null;competitions=null};var mo=class{entities=null;query=null;scope=null;constructor(t){this.entities=t.entities?t.entities:null,this.query=t.query?t.query:null,this.scope=t.scope?t.scope:null}constructFilterUrl=()=>{let t="";return this.entities&&(t=t+"&",t=t+`entities=${this.entities.join(",")}`),this.query&&(t=t+"&",t=t+`q=${this.query}`),this.scope&&(t=t+"&",t=t+`scope=${this.scope.join(",")}`),t}};var Xt=class{meta=new k;data=[]};var Mc=class{logo=null};var Ic=class{profile=null;football=null;predictor=null;loyalty=null;topX=null;matchQuiz=null;activity=null;miniGames=null;discussions=null;privateLeagues=null;challenges=null;progress=null;voting=null;fantasy=null;helpers=null;idMapping=null;bracketGame=null;lists=null;standingGame=null;eventGame=null;odds=null;getVersion=null};var ul=class{apiKey;clientId;environment;idSchema;lang;errorHandlingMode;oddClient;cookieToken;authProvider};var W=class{main=null;cover=null;mobile=null};var ho=class{colors=null;urls=null;images=null};var fo=class{primaryColor=null;secondaryColor=null;contentColor=null;backgroundColor=null;borderColor=null;additionalColor=null};var go=class{primaryUrl=null;secondaryUrl=null;privacyPolicyUrl=null;termsAndConditionsUrl=null;additionalUrl=null};var yo=class{mainLogo=null;mobileLogo=null;backgroundImage=null;mobileBackgroundImage=null;additionalImage=null};var wc=class{preferenceId="";categories=[];source=""};var bo=class{input=null;output=null};var Mo=class{meta=new bo;data=[]};var Io=class{limit=null;page=null;constructor(t){this.limit=t&&t.limit?t.limit:null,this.page=t&&t.page?t.page:null}constructFiltersUrl=()=>{let t="";return this.limit&&(t+=`&limit=${this.limit}`),this.page&&(t+=`&page=${this.page}`),t}};var wo=class{general;predictor;topX;matchQuiz};var _o=class{predictor;topX;matchQuiz;games;football;classicQuizzes;eitherOr;discussions;potm;poll};var _c=class extends Ae{};var Pc=class{count=0;breakdown=[]};var Tc=class{footballCompetitions;footballTeams;footballPlayers};var Po=class{market;fromDate;toDate;usersCount;minimumPredictions;constructor(t){this.market=t.market?t.market:null,this.fromDate=t.fromDate?t.fromDate:null,this.toDate=t.toDate?t.toDate:null,this.usersCount=t.usersCount?t.usersCount:null,this.minimumPredictions=t.minimumPredictions?t.minimumPredictions:null}constructFiltersUrl(){let t="";return this.market&&(t+="&",t+=`market=${this.market}`),this.fromDate&&(t+="&",t+=`from_date=${this.fromDate}`),this.toDate&&(t+="&",t+=`to_date=${this.toDate}`),this.usersCount&&(t+="&",t+=`users_count=${this.usersCount}`),this.minimumPredictions&&(t+="&",t+=`minimum_predictions=${this.minimumPredictions}`),t}};var To=class{templateId=null;limit=null;page=null;groupId=null;constructor(t){this.templateId=t?.templateId||null,this.limit=t?.limit||null,this.page=t?.page||null,t?.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 t="";return this.templateId&&(t+=`&template_id=${this.templateId}`),this.limit&&(t+=`&limit=${this.limit}`),this.page&&(t+=`&page=${this.page}`),t}};var Eo=class{groupId=null;limit=null;page=null;constructor(t){this.groupId=t.groupId?t.groupId:null,this.limit=t.limit?t.limit:null,this.page=t.page?t.page:null}constructFiltersUrl(){let t="";return this.groupId&&(t+="&",t+=`group_id=${this.groupId}`),this.limit&&(t+="&",t+=`limit=${this.limit}`),this.page&&(t+="&",t+=`page=${this.page}`),t}};var Ro=class{sortOrder=null;rankType=null;leaderboardIds=null;gameType=null;limit=null;page=null;groupId=null;constructor(t){this.sortOrder=t.sortOrder,this.rankType=t.rankType,this.leaderboardIds=t.leaderboardIds,this.limit=t.limit,this.page=t.page,t.gameType&&(t.rankType==="GAME"?this.gameType=t.gameType:console.warn(`RankingsFilters: gameType "${t.gameType}" ignored because rankType is "${t.rankType}". gameType can only be used when rankType is "GAME".`)),t.groupId&&(t.rankType==="TEMPLATE"?this.groupId=t.groupId:console.warn(`RankingsFilters: groupId "${t.groupId}" ignored because rankType is "${t.rankType}". groupId can only be used when rankType is "TEMPLATE".`))}constructFiltersUrl=()=>{let t="";return this.sortOrder&&(t+="&",t+=`sort_order=${this.sortOrder}`),this.rankType&&(t+="&",t+=`rank_type=${this.rankType}`),this.leaderboardIds&&(t+="&",t+=`type_ids=${this.leaderboardIds.join(",")}`),this.gameType&&this.rankType==="GAME"&&(t+="&",t+=`game_type=${this.gameType}`),this.limit&&(t+="&",t+=`limit=${this.limit}`),this.page&&(t+="&",t+=`page=${this.page}`),this.groupId&&this.rankType==="TEMPLATE"&&(t+="&",t+=`group_id=${this.groupId}`),t}};var Fo=class{flags=null;status=null;type=null;activeFrom=null;activeTo=null;createdFrom=null;createdTo=null;updatedFrom=null;updatedTo=null;constructor(t){this.flags=t.flags?t.flags:null,this.status=t.status?t.status:null,this.type=t.type?t.type:null,this.activeFrom=t.activeFrom?t.activeFrom:null,this.activeTo=t.activeTo?t.activeTo:null,this.createdFrom=t.createdFrom?t.createdFrom:null,this.createdTo=t.createdTo?t.createdTo:null,this.updatedFrom=t.updatedFrom?t.updatedFrom:null,this.updatedTo=t.updatedTo?t.updatedTo:null}constructFiltersUrl(){let t="";return this.flags&&this.flags.length>0&&(t+="&",t+=`flags=${this.flags.join(",")}`),this.status&&(t+="&",t+=`status=${this.status}`),this.type&&(t+="&",t+=`type=${this.type}`),this.activeFrom&&(t+="&",t+=`active_from=${this.activeFrom}`),this.activeTo&&(t+="&",t+=`active_to=${this.activeTo}`),this.createdFrom&&(t+="&",t+=`created_from=${this.createdFrom}`),this.createdTo&&(t+="&",t+=`created_to=${this.createdTo}`),this.updatedFrom&&(t+="&",t+=`updated_from=${this.updatedFrom}`),this.updatedTo&&(t+="&",t+=`updated_to=${this.updatedTo}`),t}};var So=class{position=null;points=null;predictionsMade=null;profileId=null;profileModel=null;successRatePercent=null};var He=class{templateId=null;privateLeagueId=null;fromDate=null;toDate=null;pagination=new Y};var Ec=class{meta=new He;data=[]};var Bt=class{rankType=null;fromDate=null;toDate=null;pagination=new Y};var Rc=class{meta=new Bt;data=[]};var $e=class{position=null;profileId=null;profileModel=null;points=null;predictionsMade=null};var vo=class{flags="";status="";type="";activeFrom="";activeTo="";createdFrom="";createdTo="";updatedFrom="";updatedTo=""};var Co=class{pagination=new Y;filters=new vo};var Fc=class{id=null;points=null};var Sc=class extends Ee{points;alternative;constructor(){super(),delete this.weight}};var Ao=class extends $e{id=null;rankType=null;model=null;gameType=null};var vc=class{meta=new Bt;data=[]};var Oo=class{groupId;averagePoints;highestPoints};var Nt=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;flags=null;images=new W;status=null;automaticallyChangeStatus=!0;createdAt=null;updatedAt=null;related=null};var xo=class extends Nt{adContent=null};var Lo=class{groupId=null;label=null;flags=[];filters=null};var Do=class{fromDate=null;toDate=null;matchIds=[]};var Cc=class{enabled=!1;id=null;label=null;points=null};var Bo=class{value=null;target=null;playerId=null;playerModel=null;result=null};var No=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new X;prediction=new Bo};var ko=class{gameId=null;results=null;tieBreakers=null};var yt=class{timeTiebreaker=!1};var Pt=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;outcome=null;predictionsCutoff=null;fixtures=[];tiebreaker=new yt;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};var ze=class{id=null;title=null;alternativeTitle=null;description=null;type=null;images=new W;participationCount=null;questionsCount=null;status=null;language=null;authRequirement=null;flags=null;customFields=null;labels=null;branding=null;related=[];time=null;points=null;scored=!1;maxAttempts=null;averageScore=null;perfectScore=null;adContent=null;context=null;createdAt=null;updatedAt=null};var kt=class extends I{flags=null;status=null;entityIds=null;entityType=null;sort=null;groupByStatus=null;language=null;title=null;constructor(t){super(t),this.flags=t&&t.flags?t.flags:null,this.status=t&&t.status?t.status:null,this.entityIds=t&&t.entityIds?t.entityIds:null,this.entityType=t&&t.entityType?t.entityType:null,this.sort=t&&t.sort?t.sort:null,this.groupByStatus=t&&t.groupByStatus!==void 0?t.groupByStatus:null,this.language=t&&t.language?t.language:null,this.title=t&&t.title?t.title:null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.flags&&this.flags.length>0&&(t+=`&flags=${this.flags.join(",")}`),this.status&&(t+=`&status=${this.status}`),this.entityIds&&this.entityIds.length>0&&(t+=`&entity_ids=${this.entityIds}`),this.sort&&(t+=`&sort=${this.sort}`),this.groupByStatus!==null&&(t+=`&group_by_status=${this.groupByStatus}`),this.language!==null&&(t+=`&language=${this.language}`),this.title!==null&&(t+=`&title=${this.title}`),t}};var Go=class extends kt{classicQuizIds=null;constructor(t){super(t),this.classicQuizIds=t&&t.classicQuizIds?t.classicQuizIds:null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.classicQuizIds&&this.classicQuizIds.length>0&&(t+=`&classic_quiz_ids=${this.classicQuizIds.join(",")}`),t}};var Uo=class extends ze{rules=null;questions=[]};var Vo=class{questionId=null;question=null;images=null;embedCode=null;explanation=null;options=[]};var Ho=class{optionId=null;option=null;images=null;correct=null};var Ac=class{questionId=0;optionId=0};var $o=class{classicQuizId=null;userId=null;questions=[];correctOptions=null;personalBest=null;points=null;attempts=null};var zo=class{questionId=null;optionId=null;correct=null;correctOptionId=null};var Ei=class extends I{classicQuizIds=null;constructor(t){super(t),this.classicQuizIds=t?.classicQuizIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.classicQuizIds&&this.classicQuizIds.length>0&&(t+=`&classic_quiz_ids=${this.classicQuizIds.join(",")}`),t}};var Ri=class{classicQuizId=null;classicQuizModel=null;correct=null;classicQuizQuestions=null;personalBest=null;points=null;answers=[];attempts=0};var Qo=class{meta=new y;data=[]};var Oc=class{meta=new y;data=[]};var qo=class{questionId=null;questionModel=null;wrong=null;correct=null;skipped=null;total=null};var Qe=class{classicQuizIds=null};var qe=class{limit=null;page=null;constructor(t){this.limit=t?.limit||null,this.page=t?.page||null}constructMainFiltersUrl(){let t="";return this.limit&&(t+=`&limit=${this.limit}`),this.page&&(t+=`&page=${this.page}`),t}};var Wo=class extends qe{classicQuizIds=null;constructor(t){super(t),this.classicQuizIds=t?.classicQuizIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.classicQuizIds&&this.classicQuizIds.length>0&&(t+=`&classic_quiz_ids=${this.classicQuizIds.join(",")}`),t}};var We=class{pagination=new Y;filters=new Qe};var Ko=class{position=null;profileId=null;profileModel=null;points=null};var jo=class{position=null;classicQuizId=null;classicQuizModel=null;points=null};var xc=class{meta=new k;data=[]};var Lc=class{meta=new We;data=[]};var Ke=class{id="";title="";alternativeTitle="";description="";images=new W;flags=[];status="";language="";authRequirement=null;winningCondition="";lives=0;time=0;points=[];customFields=null;branding=null;labels=null;adContent="";context=null;type="";related=[];totalParticipationsCount=0;totalUsersCount=0;finishedParticipationsCount=0;averageStartedParticipationsCount=0;averageFinishedParticipationsCount=0;createdAt="";updatedAt=""};var Yo=class extends kt{eitherOrIds=null;constructor(t){super(t),this.eitherOrIds=t&&t.eitherOrIds?t.eitherOrIds:null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.eitherOrIds&&this.eitherOrIds.length>0&&(t+=`&either_or_ids=${this.eitherOrIds.join(",")}`),t}};var Xo=class extends Ke{rules=""};var Jo=class{correctSteps=0;score=0};var Dc=class{meta=new y;data=[]};var Zo=class{eitherOrId="";personalBest=0;betterThan=0};var ts=class{instanceId="";eitherOrId="";gameStartedAt="";currentStep=0;currentStreak=0;remainingSteps=0;currentLives=0;currentPoints=0;personalBest=0;participationCount=0;finishedParticipationsCount=0;steps=[]};var es=class{pair="";answer=""};var is=class extends es{expired=!1;time=0};var as=class{main;mobile};var Fi=class{id="";label="";images=new as;value=null};var rs=class{pairId="";userSelection="";correct=null;played=null;timestamp="";optionOne=new Fi;optionTwo=new Fi};var os=class{rangeStartInclusive=0;rangeEndInclusive=0;totalUsers=0};var ss=class{standings=[];breakdown=[]};var ns=class{userId="";userModel=null;personalBest=""};var Gt=class{content=null;tags=[];campaign=null};var Ut=class{id=null;model=null;source=null;type=null};var ls=class{questions=null;correctAnswers=null};var je=class{id=null;title=null;alternativeTitle=null;description=null;images=new W;participationCount=null;status=null;language=null;authRequirement=null;flags=null;customFields=null;labels=null;branding=null;related=[];time=null;preferencesEnabled=!1;maxAttempts=null;adContent=null;context=null;createdAt=null;updatedAt=null};var Bc=class{meta=new y;data=[]};var ps=class{personaId=null;title=null;description=null;images=null};var cs=class{questionId=null;question=null;images=null;explanation=null;options=[]};var us=class{personaId=null;points=null};var ds=class{optionId=null;option=null;images=null;personaPoints=[];preferenceMapping=[]};var ms=class extends je{rules=null;questions=[];personaResults=[]};var hs=class extends kt{personalityQuizIds=null;constructor(t){super(t),this.personalityQuizIds=t&&t.personalityQuizIds?t.personalityQuizIds:null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.personalityQuizIds&&this.personalityQuizIds.length>0&&(t+=`&personality_quiz_ids=${this.personalityQuizIds.join(",")}`),t}};var Nc=class{questionId=0;optionId=0};var fs=class{personalityQuizId=null;userId=null;questions=[];personas=[];attempts=null};var gs=class{questionId=null;optionId=null};var ys=class{personaId=null;percent=null};var bs=class extends I{personalityQuizIds=null;constructor(t){super(t),this.personalityQuizIds=t?.personalityQuizIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.personalityQuizIds&&this.personalityQuizIds.length>0&&(t+=`&personality_quiz_ids=${this.personalityQuizIds.join(",")}`),t}};var Ms=class{meta=new y;data=[]};var Is=class{id=null;name=null;url=null;assets=[];links=[];branding=null;eventUrls=[];stakesDisclaimer=null;domainName=null};var ws=class{backgroundColor=null;textColor=null};var kc=class{appType=null;selectionTemplateUrl=null;eventTemplateUrl=null;homepageUrl=null};var _s=class{logo=null;type=null;transparentBackgroundUrl=null;backgroundColor=null};var Ps=class{url=null;appType=null};var pu=(i=>(i.PRE_EVENT="PRE_EVENT",i.LIVE="LIVE",i.ALL="ALL",i))(pu||{}),cu=(e=>(e.ORDINARY_TIME="ORDINARY_TIME",e.FULL_TIME="FULL_TIME",e))(cu||{}),uu=(i=>(i.DECIMAL="DECIMAL",i.MONEYLINE="MONEYLINE",i.FRACTIONAL="FRACTIONAL",i))(uu||{});var du=(B=>(B.FT_1X2="FT_1X2",B.DOUBLE_CHANCE="DOUBLE_CHANCE",B.HT_FT="HT_FT",B.BOTH_TEAMS_SCORE="BOTH_TEAMS_SCORE",B.CORRECT_SCORE="CORRECT_SCORE",B.PLAYER_SCORE_FIRST_GOAL="PLAYER_SCORE_FIRST_GOAL",B.PLAYER_SCORE="PLAYER_SCORE",B.PLAYER_RED_CARD="PLAYER_RED_CARD",B.PLAYER_YELLOW_CARD="PLAYER_YELLOW_CARD",B.OVER_GOALS_0_5="OVER_GOALS_0_5",B.OVER_GOALS_1_5="OVER_GOALS_1_5",B.OVER_GOALS_2_5="OVER_GOALS_2_5",B.OVER_GOALS_3_5="OVER_GOALS_3_5",B.OVER_GOALS_4_5="OVER_GOALS_4_5",B.OVER_GOALS_5_5="OVER_GOALS_5_5",B))(du||{}),vd={["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"},Ts=class{oddType="PRE_EVENT";scopeType="ORDINARY_TIME";oddFormat="DECIMAL";marketTypes=["FT_1X2"];constructor(t){this.validateFilters(t)}constructFiltersUrl(){let t=this.marketTypes.map(e=>this.mapToSportal365Market(e));return`&odd_type=${this.oddType}&scope_type=${this.scopeType}&odd_format=${this.oddFormat}&market_types=${t.join(",")}`}validateFilters(t){let e=Object.values(pu),i=Object.values(cu),a=Object.values(uu),r=Object.values(du);t?.oddType&&(e.includes(t.oddType)?this.oddType=t.oddType:console.warn(`The filter "oddType" is NOT valid and therefore it will be set to PRE_EVENT. The VALID values are : ${e.join(", ")}`)),t?.scopeType&&(i.includes(t.scopeType)?this.scopeType=t.scopeType:console.warn(`The filter "scopeType" is NOT valid and therefore it will be set to ORDINARY_TIME. The VALID values are : ${i.join(", ")}`)),t?.oddFormat&&(a.includes(t.oddFormat)?this.oddFormat=t.oddFormat:console.warn(`The filter "oddFormat" is NOT valid and therefore it will be set to DECIMAL. The VALID values are : ${a.join(", ")}`)),t?.marketTypes&&Array.isArray(t?.marketTypes)&&t?.marketTypes.length>0&&(t.marketTypes.every(o=>r.includes(o))?this.marketTypes=t.marketTypes:console.warn(`The filter "marketTypes" is NOT valid and therefore it will be set to FT_1X2. The VALID values are : ${r.join(", ")}`))}mapToSportal365Market(t){return t.startsWith("OVER_GOALS_")?"OVER_UNDER":vd[t]}};var Es=class{type=null;scope=null;selections=[]};var Rs=class{id=null;type=null;name=null;entityType=null};var Fs=class{id=null;name=null;code=null;value=null;odds=null;urls=[];movement=null;oddsOld=null;entityType=null;additionalInfo=null;providerInfo=null};var Ss=class{id=null;name=null;code=null;entityType=null};var vs=class{selectionId=null;eventId=null;marketId=null;competitionId=null};var Cs=class{bookmaker=null;type=null;markets=[]};var Gc=class{main=null;all=null};var As=class{value=null;playerId=null;playerModel=null;playerRole};var Ye=class{market=null;matchId=null;matchType=null;matchModel=null;prediction=new As;result=null};var Xe=class{settledAt=null;resettledAt=null;status=null;outcome=null;points=0};var ot=class{value=!1};var Os=class{matchId=null;market="BOTH_TEAMS_SCORE";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new ot,this.prediction.value=e}};var xs=class{value};var Ls=class{matchId=null;market="CORNERS_MATCH";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new xs,this.prediction.value=e}};var Ds=class{value=null};var Vt=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new Ds,this.prediction.value=i}};var Bs=class{value=null};var Ns=class{matchId=null;market="DOUBLE_CHANCE";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new Bs,this.prediction.value=e}};var ks=class{value=null};var Gs=class{matchId=null;market="HT_FT";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new ks,this.prediction.value=e}};var Us=class{value=null};var Vs=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new Us,this.prediction.value=i}};var Je=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new ot,this.prediction.value=i}};var Ze=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new ot,this.prediction.value=i}};var Hs=class{matchId=null;market="PENALTY_MATCH";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new ot,this.prediction.value=e}};var $s=class{value=!1;playerId=null};var st=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i,a){this.matchId=t,this.market=e,this.prediction=new $s,this.prediction.value=i,this.prediction.playerId=a}};var zs=class{matchId=null;market="RED_CARD_MATCH";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new ot,this.prediction.value=e}};var Uc=class{home=null;draw=null;away=null};var Vc=class{score=null;percentage=null};var ti=class{homeGoals=null;awayGoals=null};var Qs=class{playerId=null;playerModel=null};var qs=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 Qs;PLAYER_SCORE=[];PLAYER_SCORE_TWICE=[];PLAYER_SCORE_HATTRICK=[];CORRECT_SCORE=new ti;CORRECT_SCORE_ADVANCED=new ti;CORRECT_SCORE_HT=new ti;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};var L=class{no=0;yes=0};var ei=class{gameInstanceId=null;fixtures=null};var bt=class{goldenGoal=null};var Si=class{id=null;gameInstanceId=null;gameType=null;wager=null;totalFixtures=null;settledFixtures=null;userId=null;fixtures=[];status=null;tiebreaker=new bt;points=null;templateId=null;groupId=null;profileLastUpdatedAt=null;createdAt=null;updatedAt=null};var dl=(r=>(r.ACTIVE="ACTIVE",r.WON="WON",r.LOST="LOST",r.PARTIALLY_WON="PARTIALLY_WON",r.CANCELED="CANCELED",r))(dl||{}),mu=["WON","LOST","PARTIALLY_WON","CANCELED"];var V=class{limit=null;startAfter=null;status=null;type=null;matchIds=null;gameIds=null;constructor(t){this.limit=t?.limit||null,this.startAfter=t?.startAfter||null,this.status=t?.status||null,this.type=t?.type||null,this.matchIds=t?.matchIds||null,this.gameIds=t?.gameIds||null}constructFiltersUrl=()=>{let t="",e=!1;return this.status&&(e=Object.values(dl).some(i=>this.status.includes(i))),this.limit&&(t+="&",t+=`limit=${this.limit}`),this.startAfter&&(t+="&",t+=`start_after=${this.startAfter}`),this.status&&e&&(t+="&",t+=`status=${this.status.join(",")}`),this.type&&(t+="&",t+=`game_types=${this.type}`),this.matchIds&&this.matchIds.length>0&&(t+="&",t+=`match_ids=${this.matchIds.join(",")}`),this.gameIds&&this.gameIds.length>0&&(t+="&",t+=`game_ids=${this.gameIds.join(",")}`),t}};var Ws=class{fullTimeOneXTwo={};halfTimeOneXTwo={};bothTeamsScore=new L;doubleChance={};halfTimeFullTime={};playerScore={};playerYellowCard={};playerRedCard={};redCardMatch=new L;penaltyMatch=new L;playerScoreFirstGoal={};cornersMatch={};correctScore={};correctScoreHalfTime={};correctScoreAdvanced={};playerScoreHattrick={};playerScoreTwice={};overZeroPointFiveGoals=new L;overOnePointFiveGoals=new L;overTwoPointFiveGoals=new L;overThreePointFiveGoals=new L;overFourPointFiveGoals=new L;overFivePointFiveGoals=new L;overSixPointFiveGoals=new L;overSixPointFiveCorners=new L;overSevenPointFiveCorners=new L;overEightPointFiveCorners=new L;overNinePointFiveCorners=new L;overTenPointFiveCorners=new L;overElevenPointFiveCorners=new L;overTwelvePointFiveCorners=new L;overThirteenPointFiveCorners=new L};var Ks=class{matchId=null;matchType=null;predictions=null};var js=class{profileId="";profileModel=null;leagueId="";leagueModel=null;message=""};var Hc=class{id=null;name=null;model=new Nt};var ii=class{id="";name="";description="";type="";banned=[];invites=[];administrators=[];membersCount=0;invitationCode="";templateId="";templateModel=null;pastTemplates=[];usersCanInviteUsers=!1;scoringStartsAt="";pinnedPosts=[]};var Ys=class extends ii{members=[]};var $c=class{name="";description="";invitationCode="";templateId="";usersCanInviteUsers=!1;administrators=[];scoringStartsAt=""};var zc=class{name="";description="";invitationCode="";templateId="";usersCanInviteUsers=!1;administrators=[];pinnedPosts=[];scoringStartsAt=""};var Xs=class{predictionId=null;predictionModel=null;profileId=null;profileModel=null};var Qc=class{meta=new k;data=[]};var qc=class{meta=new y;data=[]};var ai=class extends I{type=null;constructor(t){super(t),this.type=t&&t.type?t.type:null}constructMainFiltersUrl=()=>{let t=super.constructMainFiltersUrl();return this.type&&(t+=`&type=${this.type}`),t}};var Js=class{type="PRIVATE";userRole=null;constructor(t){this.userRole=t?.userRole||null}constructFiltersUrl=()=>{let t=`&type=${this.type}`;return this.userRole&&(t+=`&user_role=${this.userRole}`),t}};var Zs=class{limit=null;page=null;leagueId=null;templateId=null;sortOrder=null;constructor(t){this.limit=t&&t.limit?t.limit:null,this.page=t&&t.page?t.page:null,this.leagueId=t&&t.leagueId?t.leagueId:null,this.templateId=t&&t.templateId?t.templateId:null,this.sortOrder=t&&t.sortOrder?t.sortOrder:null}constructFiltersUrl=()=>{let t="";return this.limit&&(t+=`&limit=${this.limit}`),this.page&&(t+=`&page=${this.page}`),this.leagueId&&(t+=`&private_league_id=${this.leagueId}`),this.templateId&&(t+=`&template_id=${this.templateId}`),this.sortOrder&&(t+=`&sort_order=${this.sortOrder}`),t}};var ri=class extends I{reportsCount=null;constructor(t){super(t),this.reportsCount=t.reportsCount?t.reportsCount:null}constructMainFiltersUrl=()=>{let t=super.constructMainFiltersUrl();return this.reportsCount&&(t+=`&reports_count=${this.reportsCount}`),t}};var oi=class{limit=null;page=null;profileIds=null;constructor(t){this.limit=t&&t.limit?t.limit:null,this.page=t&&t.page?t.page:null,this.profileIds=t&&t.profileIds?t.leagueId:null}constructFiltersUrl=()=>{let t="";return this.limit&&(t+=`&limit=${this.limit}`),this.page&&(t+=`&page=${this.page}`),this.profileIds&&(t+=`&profile_ids=${this.profileIds.join(",")}`),t}};var tn=class{templateId="";templateModel=null;privateLeagueId="";privateLeagueModel=null;position="";points=0;type="private_league"};var en=class extends Be{type="PRIVATE"};var an=class extends Ne{type="PRIVATE"};var rn=class{id="";source="";type="";favourite=!1};var on=class extends rn{model=null};var Wc=class{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};var Kc=class{consentId="";entityId=null;entityType=null;content=null};var sn=class extends I{status=null;sortOrder=null;gameIds=null;constructor(t){super(t),this.status=t?.status||null,this.sortOrder=t?.sortOrder||null,this.gameIds=t?.gameIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.status&&Object.values(ft).includes(this.status)?(t+="&",t+=`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")?(t+="&",t+=`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?(t+="&",t+=`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.`),t}};var nn=class extends I{};var ln=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new X};var pn=class{value=null;result=null};var cn=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new X;prediction=new pn};var Tt=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;scheduleOpenAt=null;predictionsCutoff=null;fixtures=[];tiebreaker=new yt;participantsCount=0;related=[];excludedProfileIds=null;rules=null;labels=null;customFields=null;branding=null;flags=null;images=new W;createdAt=null;updatedAt=null};var si=class extends Tt{adContent=null};var Jt=class{userId=null;points=null;results=[];tiebreaker=null};var un=class{matchId=null;matchModel=null;outcome=null};var nt=class extends I{status=null;type=null;gameIds=null;sortOrder=null;constructor(t){super(t),this.status=t?.status||null,this.type=t?.type||null,this.gameIds=t?.gameIds||null,this.sortOrder=t?.sortOrder||null}constructFiltersUrl=()=>{let t=super.constructMainFiltersUrl();return this.status&&Object.values(ft).includes(this.status)&&(t+="&",t+=`status=${this.status}`),this.type&&(t+="&",t+=`type=${this.type}`),this.gameIds&&this.gameIds.length>0&&(t+="&",t+=`game_ids=${this.gameIds.join(",")}`),this.sortOrder&&(t+="&",t+=`sort_order=${this.sortOrder}`),t}};var Ht=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;outcome=null;predictionsCutoff=null;fixtures=[];tiebreaker=new yt;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 bt;branding=null};var dn=class{contestId="";contestType="GAME";contestModel=null;description="";userList=[]};var mn=class{position="";profileId="";profileModel=null;note="";tags=[]};var ni=class{gameInstanceId=null;fixtures=[];tiebreaker=null;constructor(t){this.gameInstanceId=t.gameInstanceId,t.fixtures.forEach(e=>this.fixtures.push(new Vt(e.matchId,e.market,e.prediction.value))),this.tiebreaker=t.tiebreaker?t.tiebreaker:null}};var li=class extends I{flags=null;status=null;entityIds=null;entityType=null;pollIds=null;sortOrder=null;minVotes=null;language=null;constructor(t){super(t),this.flags=t?.flags||null,this.status=t?.status||null,this.entityIds=t?.entityIds||null,this.entityType=t?.entityType||null,this.pollIds=t?.pollIds||null,this.sortOrder=t?.sortOrder||null,this.minVotes=t&&t.minVotes!==void 0?t.minVotes:null,this.language=t?.language||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.flags&&this.flags.length>0&&(t+=`&flags=${this.flags.join(",")}`),this.status&&(t+=`&status=${this.status}`),this.entityIds&&this.entityIds.length>0&&(t+=`&entity_ids=${this.entityIds.join(",")}`),this.pollIds&&this.pollIds.length>0&&(t+=`&poll_ids=${this.pollIds.join(",")}`),this.sortOrder&&(t+=`&sort_order=${this.sortOrder}`),this.minVotes&&(t+=`&min_votes=${this.minVotes}`),this.language&&(t+=`&language=${this.language}`),t}};var pi=class{id=null;title=null;alternativeTitle=null;description=null;type=null;images=new W;status=null;language=null;authRequirement=null;totalVotes=null;flags=[];customFields=null;branding=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};var hn=class extends pi{rules=null};var fn=class{id=null;title=null;description=null;images=new W;votes=null;embedCode=null;preferencesMapping=[]};var ci=class{preferenceId=""};var $t=class{id=null;pollId=null;optionId=null;optionIds=[];userId=null;createdAt=null};var gn=class extends $t{pollModel=null;optionModel=null;optionsModels=[];previousVotes=[];attempts=null};var yn=class extends $t{previousVotes=[];attempts=null};var bn=class{meta=new y;data=[]};var Mn=class{meta=new y;data=[]};var In=class extends I{matchIds=null;constructor(t){super(t),this.matchIds=t&&t.matchIds?t.matchIds:null}constructFiltersUrl(){let t=super.constructMainFiltersUrl();return this.matchIds&&this.matchIds.length>0&&(t+="&",t+=`match_ids=${this.matchIds.join(",")}`),t}};var wn=class{meta=new y;data=[]};var _n=class{matchId=null;matchModel=null;playerId=null;playerModel=null;createdAt=null};var Pn=class{total};var Tn=class{meta=new Pn;data=[]};var En=class{teamId=null;teamModel=null;playerId=null;playerModel=null;votes=null;winner=null};var Rn=class{meta=new k;data=[]};var ml=class{remapListContent=t=>{let e=new Rn;return e.meta=this.remapMeta(t.meta),e.data=t.data.map(i=>{let a=new mr;return a.entityId=i.entity_id,a.entityType=i.entity_type,a}),e};remapMeta=t=>{let e=new k;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.totalItems=t.pagination.total_items,e.pagination.numberOfPages=t.pagination.number_of_pages,e}};var Q=class extends v{featureConfigRemapper=null;listContentRemapper=null;localStorage=null;clientId=null;constructor(t){super(t,O(t.environment,"client")),this.clientId=t.clientId,this.localStorage=new ct().createLocalCacheInstance(t.idSchema),this.featureConfigRemapper=new cl,this.listContentRemapper=new ml}getConfig=async t=>{let e=await this.getCachedFeatures();if(!e){let i=`/clients/${this.clientId}/features`,a=this.apiSignInUrl.split("&")[0],r=i+a,o="There was a problem fetching client features from Client API";e=(await this.fetchWithoutAuth(r,o)).data,await this.localStorage.setClientFeatures(e)}switch(t){case"predictor":return this.featureConfigRemapper.remapPredictorConfig(e.predictor);case"topX":return this.featureConfigRemapper.remapTopXConfig(e.top_x);case"matchQuiz":return this.featureConfigRemapper.remapMatchQuizConfig(e.match_quiz);case"loyalty":return this.featureConfigRemapper.remapLoyaltyConfig(e.loyalty);case"discussions":return this.featureConfigRemapper.remapDiscussionsConfig(e.discussions);case"fantasy":return this.featureConfigRemapper.remapFantasyConfig(e.football_fantasy)}};getNewLoyaltyConfig=async t=>{let e=`/clients/${this.clientId}/features`,i=this.apiSignInUrl.split("&")[0],a="There was a problem fetching client features from Client API";if(t){let o=e+i+m(),n=await this.fetchWithoutAuthAdditionalHeaders(o,a,{"x-api-version":"2"});await this.localStorage.setClientFeatures(n.data)}let r=await this.getCachedFeatures();if(!r){let o=e+i;r=(await this.fetchWithoutAuthAdditionalHeaders(o,a,{"x-api-version":"2"})).data,await this.localStorage.setClientFeatures(r)}return this.featureConfigRemapper.remapLoyaltyNewConfig(r.loyalty)};getListContent=async(t,e,i)=>{let a=`/clients/${this.clientId}/lists/${t}/content${this.apiSignInUrl}`;e&&(a+=e.constructFiltersUrl()),f(i)&&(a+=m());let r="There was a problem fetching client list content",o=await this.fetchWithoutAuth(a,r);return this.listContentRemapper.remapListContent(o)};getCachedFeatures=async()=>{let t=await this.getLocalStorageData();if(!(!t||!Object.keys(t).length))return t.predictor.client_id&&t.predictor.client_id!==this.clientId?(await this.localStorage.deleteClientFeatures(),null):t};getLocalStorageData=async()=>{let t=Math.floor(Date.now()/1e3);return await this.localStorage.getExpiration("client","features")>t?await this.localStorage.getClientFeatures():null}};var Et=class{clientHttps=null;errorHandlingMode=null;constructor(t){this.clientHttps=new Q(t),this.errorHandlingMode=t.errorHandlingMode}setAvailableMarketsForMatch=async t=>{let{fullCoverageCompetitions:e,markets:i}=await this.clientHttps.getConfig("predictor");if(Array.isArray(t))return t.map(a=>this.setAvailableMarkets(a,e,i));if(typeof t=="object"&&Object.keys(t).length)return this.setAvailableMarkets(t,e,i)};setAvailableMarkets=(t,e,i)=>{let a=t.context.competition?.id;return a&&this.isMatchInCoverageCompetition(a,e)?(t.availableMarkets=i.all,t):(t.availableMarkets=i.main,t)};setMetaDataBatchRequest=(t,e,i)=>{let a=new k;if(a.pagination.totalItems=t,a.pagination.itemsPerPage=e,a.pagination.numberOfPages=t?Math.ceil(t/e):0,a.pagination.currentPage=i,a.pagination.numberOfPages>0&&i>a.pagination.numberOfPages)throw this.errorHandlingMode==="standard"?new h(400,"invalid_page_number","Invalid page number provided. Use number between 1 and max number of pages."):new b(400,"invalid_page_number","Invalid page number provided. Use number between 1 and max number of pages.");return a};finalizeMatchesDataBatchRequest=(t,e)=>{t=t.sort((a,r)=>new Date(a.kickoffAt).getTime()-new Date(r.kickoffAt).getTime());let i=e.limit||20;if(e.page){let a=e.page>1?i*(e.page-1):0;t=t.slice(a,a+i)}return!e.page&&t.length>i&&(t=t.slice(0,i)),t};isMatchInCoverageCompetition=(t,e)=>{let i=!1;return e.includes(t)&&(i=!0),i}};var hl=class{footballService=null;https=null;idMapping=null;constructor(t,e,i){this.idMapping=i,this.https=e,this.footballService=new Et(t)}getTeamsIdMapping=async(t,e)=>{try{let i=!1;if(t){if(t=new Pi(t),t.countryId){let r=await this.idMapping.getEntityIdsBySchemaId([`${t.countryId}`],"country","native");r.country.length===0&&(i=!0),t.countryId=r.country[0]}if(t.scope){let r=await this.idMapping.getEntityIdsBySchemaId(t.scope,"competition","native");r.competition.length===0&&(i=!0),t.scope=r.competition}if(t.teamIds){let r=await this.idMapping.getEntityIdsBySchemaId(t.teamIds,"team","native");r.team.length===0&&(i=!0),t.teamIds=r.team}}if(i)return[];let a=await this.getTeams(t,e);return a.data=await this.idMapping.remapEntities(a.data,"team"),a}catch(i){throw console.warn("There was a problem browsing all teams",i),i}};getTeamsMapWithNativeIds=async t=>{let e=new Map,i=t.length,a=new Pi({teamIds:t,limit:i}),{data:r}=await this.getTeams(a);r.sort((l,p)=>l.id.localeCompare(p.id));let o=Xp(t),n=await this.idMapping.remapEntities(r,"team");return o.forEach((l,p)=>e.set(l,n[p])),e};getTeams=async(t,e)=>{try{return e=e||!1,await this.https.getTeams(t,e)}catch(i){throw console.warn("There was a problem retrieving all teams",i),i}};getTeamByIdIdMapping=async(t,e)=>{try{t=(await this.idMapping.getEntityIdsBySchemaId([t],"team","native")).team[0];let a=await this.getTeamById(t,e);return await this.idMapping.remapEntities(a,"team")}catch(i){throw console.warn(`There was a problem browsing the following team:${t}`,i),i}};getTeamById=async(t,e)=>{try{return e=e||!1,await this.https.getTeamById(t,e)}catch(i){throw console.warn(`There was a problem retrieving the following team: ${t}`,i),i}};getTopTeamsIdMapping=async t=>{try{let e=await this.getTopTeams(t);return await this.idMapping.remapEntities(e,"team")}catch(e){throw console.warn("There was a problem browsing the top teams",e),e}};getTopTeams=async t=>{try{return t=t||!1,await this.https.getTopTeams(t)}catch(e){throw console.warn("There was a problem retrieving the top teams",e),e}};getNextMatchForTeamIdMapping=async(t,e)=>{try{t=(await this.idMapping.getEntityIdsBySchemaId([t],"team","native")).team[0];let a=await this.getNextMatchForTeam(t,e);return await this.idMapping.remapEntities(a,"match")}catch(i){throw console.warn(`There was a problem browsing the next match for the following team:${t}`,i),i}};getNextMatchForTeam=async(t,e)=>{try{e=e||!1;let i=await this.https.getNextMatchForTeam(t,e);return await this.footballService.setAvailableMarketsForMatch(i)}catch(i){throw console.warn(`There was a problem retrieving the next match for the following team: ${t}`,i),i}};getPrevMatchForTeamIdMapping=async(t,e)=>{try{t=(await this.idMapping.getEntityIdsBySchemaId([t],"team","native")).team[0];let a=await this.getPrevMatchForTeam(t,e);return await this.idMapping.remapEntities(a,"match")}catch(i){throw console.warn(`There was a problem browsing the previous match for the following team:${t}`,i),i}};getPrevMatchForTeam=async(t,e)=>{try{e=e||!1;let i=await this.https.getPrevMatchForTeam(t,e);return await this.footballService.setAvailableMarketsForMatch(i)}catch(i){throw console.warn(`There was a problem retrieving the previous match for the following team: ${t}`,i),i}}};var Zt=class{https=null;footballService=null;idMapping=null;constructor(t,e,i){this.idMapping=i,this.https=e,this.footballService=new Et(t)}getPlayersIdMapping=async(t,e)=>{try{let i=!1;if(t){if(t=new Ti(t),t.countryId){let r=await this.idMapping.getEntityIdsBySchemaId([t.countryId],"country","native");r.country.length===0&&(i=!0),t.countryId=r.country[0]}if(t.playerIds){let r=await this.idMapping.getEntityIdsBySchemaId(t.playerIds,"player","native");r.player.length===0&&(i=!0),t.playerIds=r.player}if(t.scope){let r=await this.idMapping.getEntityIdsBySchemaId(t.scope,"competition","native");r.competition.length===0&&(i=!0),t.scope=r.competition}if(i)return[]}let a=await this.getPlayers(t,e);return a.data=await this.idMapping.remapEntities(a.data,"player"),a}catch(i){throw console.warn("There was a problem browsing the players",i),i}};getPlayersWithNativeIds=async t=>{let e=t.length,i=new Ti({playerIds:t,limit:e}),a=await this.getPlayers(i);return a.data.sort((r,o)=>r.id.localeCompare(o.id)),await this.idMapping.remapEntities(a.data,"player")};getPlayersMapWithNativeIds=async t=>{let e={},i=ce(t);i.sort((r,o)=>r.localeCompare(o));let a=await this.getPlayersWithNativeIds(Array.from(i));return i.forEach((r,o)=>e[r]=a[o]),e};getPlayers=async(t,e)=>{try{return e=e||!1,await this.https.getPlayers(t,e)}catch(i){throw console.warn("There was a problem retrieving the players",i),i}};getPlayerIdMapping=async(t,e)=>{try{let i=await this.idMapping.getEntityIdsBySchemaId([t],"player","native"),a=await this.getPlayerById(i.player[0],e);return await this.idMapping.remapEntities(a,"player")}catch(i){throw console.warn(`There was a problem browsing the following player:${t}`,i),i}};getPlayerById=async(t,e)=>{try{return e=e||!1,await this.https.getPlayerById(t,e)}catch(i){throw console.warn(`There was a problem retrieving the following player: ${t}`,i),i}};getTopPlayersIdMapping=async t=>{try{let e=await this.getTopPlayers(t);return await this.idMapping.remapEntities(e,"player")}catch(e){throw console.warn("There was a problem browsing the top players",e),e}};getTopPlayers=async t=>{try{return t=t||!1,await this.https.getTopPlayers(t)}catch(e){throw console.warn("There was a problem retrieving the top players",e),e}};getNextMatchForPlayerIdMapping=async(t,e)=>{try{t=(await this.idMapping.getEntityIdsBySchemaId([t],"player","native")).player[0];let a=await this.getNextMatchForPlayer(t,e);return await this.idMapping.remapEntities(a,"match")}catch(i){throw console.warn(`There was a problem browsing the next match for player:${t}`,i),i}};getNextMatchForPlayer=async(t,e)=>{try{e=e||!1;let i=await this.https.getNextMatchForPlayer(t,e);return await this.footballService.setAvailableMarketsForMatch(i)}catch(i){throw console.warn(`There was a problem retrieving the next match for player: ${t}`,i),i}};getPrevMatchForPlayerIdMapping=async(t,e)=>{try{t=(await this.idMapping.getEntityIdsBySchemaId([t],"player","native")).player[0];let a=await this.getPrevMatchForPlayer(t,e);return await this.idMapping.remapEntities(a,"match")}catch(i){throw console.warn(`There was a problem browsing the previous match for player:${t}`,i),i}};getPrevMatchForPlayer=async(t,e)=>{try{e=e||!1;let i=await this.https.getPrevMatchForPlayer(t,e);return await this.footballService.setAvailableMarketsForMatch(i)}catch(i){throw console.warn(`There was a problem retrieving the previous match for player: ${t}`,i),i}}};var te=class{https=null;idMapping=null;footballService=null;constructor(t,e,i){this.https=e,this.idMapping=i,this.footballService=new Et(t)}getMatchesIdMapping=async(t,e)=>{try{if(t){if(t=new gt(t),t.countryIds&&t.countryIds.length>0){let a=await this.idMapping.getEntityIdsBySchemaId(t.countryIds,"country","native");t.countryIds=a.country}if(t.competitionIds&&t.competitionIds.length>0){let a=await this.idMapping.getEntityIdsBySchemaId(t.competitionIds,"competition","native");t.competitionIds=a.competition}if(t.matchIds&&t.matchIds.length>0){let a=await this.idMapping.getEntityIdsBySchemaId(t.matchIds,"match","native");t.matchIds=a.match}if(t.teamIds&&t.teamIds.length>0){let a=await this.idMapping.getEntityIdsBySchemaId(t.teamIds,"team","native");t.teamIds=a.team}}let i=await this.getMatches(t,e);return i.data=await this.footballService.setAvailableMarketsForMatch([...i.data]),i.data=await this.idMapping.remapEntities(i.data,"match"),i}catch(i){throw console.warn("There was a problem browsing the matches",i),i}};getMatchesWithNativeIds=async t=>{let e=t.length,i=new gt({matchIds:t,limit:e}),a=await this.getMatches(i);return a.data.sort((r,o)=>r.id.localeCompare(o.id)),await this.idMapping.remapEntities(a.data,"match")};getMatchesMapWithNativeIds=async t=>{let e={},i=ce(t);i.sort((r,o)=>r.localeCompare(o));let a=await this.getMatchesWithNativeIds(Array.from(i));if(i.length!==a.length){let r=new gt({matchIds:i,limit:i.length}),o=await this.getMatches(r),n=i.filter(l=>{if(o.data.every(p=>p.id!==l))return l});i=i.filter(l=>{if(!n.includes(l))return l})}return i.forEach((r,o)=>e[r]=a[o]),e};getMatches=async(t,e)=>{try{return e=e||!1,await this.https.getMatches(t,e)}catch(i){throw console.warn("There was a problem retrieving the matches",i),i}};getMatchIdMapping=async(t,e)=>{try{let i=await this.idMapping.getEntityIdsBySchemaId([t],"match","native"),a=await this.getMatchById(i.match[0],e),r=await this.footballService.setAvailableMarketsForMatch(a);return await this.idMapping.remapEntities(r,"match")}catch(i){throw console.warn(`There was a problem browsing the following match: ${t}`,i),i}};getMatchById=async(t,e)=>{try{return e=e||!1,await this.https.getMatchById(t,e)}catch(i){throw console.warn(`There was a problem retrieving the following match: ${t}`,i),i}}};var fl=class{https=null;idMapping=null;constructor(t,e){this.https=t,this.idMapping=e}searchIdMapping=async(t,e)=>{try{if(t=new mo(t),t.scope){let a=await this.idMapping.getEntityIdsBySchemaId(t.scope,"competition","native");t.scope=a.competition}let i=await this.search(t,e);if(i.teams&&i.teams.length>0){let a=await this.idMapping.remapEntities(i.teams,"team");i.teams=a}if(i.players&&i.players.length>0){let a=await this.idMapping.remapEntities(i.players,"player");i.players=a}if(i.competitions&&i.competitions.length>0){let a=await this.idMapping.remapEntities(i.competitions,"competition");i.competitions=a}return i}catch(i){throw console.warn("There was a problem with browsing the search result",i),i}};search=async(t,e)=>{try{return await this.https.search(t,e)}catch(i){throw console.warn("There was a problem retrieving the search response",i),i}}};var K=class{errorHandlingModel=null;constructor(t){this.errorHandlingModel=t}throwException=(t,e,i)=>{throw this.errorHandlingModel==="standard"?new h(t,e,i):new b(t,e,i)}};var gl=class extends K{limit=50;constructor(t){super(t.errorHandlingMode)}validateTeamFormArguments=(t,e)=>{(!t||typeof t!="string")&&this.throwException(400,"invalid_team_id","Invalid team ID provided. Please provide a valid team ID."),e&&(e.competitionId&&typeof e.competitionId!="string"&&this.throwException(400,"invalid_competition_id","Invalid competition ID provided. Please provide a valid competition ID."),e.limit&&typeof e.limit!="number"&&this.throwException(400,"invalid_limit","Invalid limit type. The proper type is number."),e.limit&&e.limit>this.limit&&this.throwException(400,"invalid_limit","Invalid limit. The maximum limit is: "+this.limit.toString()))}};var vi=class{countriesFacade=null;competitionsFacade=null;teamsFacade=null;playerFacade=null;matchFacade=null;searchFacade=null;validator=null;constructor(t,e,i,a){this.countriesFacade=new ll(e,i,a),this.competitionsFacade=new pl(e,i,a),this.teamsFacade=new hl(t,i,a),this.playerFacade=new Zt(t,i,a),this.matchFacade=new te(t,i,a),this.searchFacade=new fl(i,a),this.validator=new gl(t)}getCountries=async t=>this.countriesFacade.getCountriesWithIdMapping(t);getCompetitions=async(t,e)=>this.competitionsFacade.getCompetitionsIdMapping(t,e);getCompetitionById=async(t,e)=>this.competitionsFacade.getCompetitionByIdIdMapping(t,e);getTopCompetitions=async t=>this.competitionsFacade.getTopCompetitionsIdMapping(t);getCompetitionsMapWithNativeIds=async t=>await this.competitionsFacade.getCompetitionsMapWithNativeIds(t);getTeams=async(t,e)=>this.teamsFacade.getTeamsIdMapping(t,e);getTeamById=async(t,e)=>this.teamsFacade.getTeamByIdIdMapping(t,e);getTopTeams=async t=>this.teamsFacade.getTopTeamsIdMapping(t);getNextMatchForTeam=async(t,e)=>this.teamsFacade.getNextMatchForTeamIdMapping(t,e);getPrevMatchForTeam=async(t,e)=>this.teamsFacade.getPrevMatchForTeamIdMapping(t,e);getTeamsMapWithNativeIds=async t=>await this.teamsFacade.getTeamsMapWithNativeIds(t);getPlayers=async(t,e)=>this.playerFacade.getPlayersIdMapping(t,e);getPlayerById=async(t,e)=>this.playerFacade.getPlayerIdMapping(t,e);getTopPlayers=async t=>this.playerFacade.getTopPlayersIdMapping(t);getNextMatchForPlayer=async(t,e)=>this.playerFacade.getNextMatchForPlayerIdMapping(t,e);getPrevMatchForPlayer=async(t,e)=>this.playerFacade.getPrevMatchForPlayerIdMapping(t,e);getPlayersMapWithNativeIds=async t=>this.playerFacade.getPlayersMapWithNativeIds(t);getMatches=async(t,e)=>this.matchFacade.getMatchesIdMapping(t,e);getMatchesMapWithNativeIds=async t=>this.matchFacade.getMatchesMapWithNativeIds(t);getMatchById=async(t,e)=>this.matchFacade.getMatchIdMapping(t,e);search=async(t,e)=>this.searchFacade.searchIdMapping(t,e);getTeamForm=async(t,e,i)=>{this.validator.validateTeamFormArguments(t,e);let a=e?.direction||"ltr",r={teamIds:[t],competitionIds:e&&e.competitionId?[e.competitionId]:null,status:"finished",limit:e?.limit||5,sortField:"date",sortOrder:"desc"},o=await this.matchFacade.getMatchesIdMapping(r,i),n={teamId:t,matches:[]};if(n.matches=o.data.map(l=>{let p=l.homeTeam.id===t,c=l.scores.ftScore.homeGoals??0,u=l.scores.ftScore.awayGoals??0,d;return p?d=c>u?"W":c<u?"L":"D":d=u>c?"W":u<c?"L":"D",{matchModel:l,isHomeGame:p,result:d}}),a==="ltr"){let l=Array.from(n.matches);n.matches=l.reverse()}return n}};var $=class{countriesFromResponse=t=>{if(t)return t.map(e=>this.countryFromResponse(e))};countryFromResponse=t=>{try{if(t){let e=new Yr;return e.id=t.id,e.alias=t.alias,e.assets=t.assets,e.countryCode=t.country_code,e.name=t.name,e}}catch(e){throw e}return null}};var tt=class{countryRemapper=null;constructor(){this.countryRemapper=new $}fromResponse(t){try{let e=new Kr;return e.id=t.id,e.country=this.countryRemapper.countryFromResponse(t.country),e.gender=t.gender,e.assets=t.assets,e.type=t.type,e.name=t.name,e}catch(e){throw console.warn("There was a problem remapping the competition response",e),e}}};var j=class{countryRemapper=null;constructor(){this.countryRemapper=new $}fromResponse(t){try{let e=new lo;return e.id=t.id,e.country=this.countryRemapper.countryFromResponse(t.country),e.gender=t.gender,e.assets=t.assets,e.code=t.code,e.national=t.national,e.fullName=t.full_name,e.shortName=t.short_name,e.name=t.name,e.isDeleted=t.is_deleted,e.undecided=t.undecided,e}catch(e){throw console.warn("There was a problem remapping teams response",e),e}}};var yl=class{countryRemapper=null;teamBasicRemapper=null;constructor(){this.countryRemapper=new $,this.teamBasicRemapper=new j}fromResponse(t){try{let e=new jr;return e.id=t.id,e.country=this.countryRemapper.countryFromResponse(t.country),e.gender=t.gender,e.assets=t.assets,e.type=t.type,e.name=t.name,e.participants=t.participants.map(i=>this.teamBasicRemapper.fromResponse(i)),e}catch(e){throw console.warn("There was a problem remapping the competition response",e),e}}};var bl=class{countryRemapper=null;constructor(){this.countryRemapper=new $}fromResponse(t){try{let e=new oo;return e.id=t.id,e.startDate=t.start_date,e.endDate=t.end_date,e.shirtNumber=t.shirt_number,e.loan=t.loan,e.position=t.position,e.country=this.countryRemapper.countryFromResponse(t.country),e.name=t.name,e.assets=t.assets,e.birthDate=t.birth_date,e}catch(e){throw console.warn("There was a problem remapping the player from squad",e),e}}};var Ml=class{countryRemapper=null;competitionRemapper=null;playerRemapper=null;constructor(){this.countryRemapper=new $,this.competitionRemapper=new tt,this.playerRemapper=new bl}fromResponse(t){try{let e=new co;return e.id=t.id,e.country=this.countryRemapper.countryFromResponse(t.country),e.gender=t.gender,e.assets=t.assets,e.code=t.code,e.national=t.national,e.fullName=t.full_name,e.shortName=t.short_name,e.name=t.name,e.isDeleted=t.is_deleted,e.undecided=t.undecided,e.competitions=t.competitions?t.competitions.map(i=>this.competitionRemapper.fromResponse(i)):[],e.colors=t.colors?t.colors:e.colors,e.squad=t.squad?t.squad.map(i=>this.playerRemapper.fromResponse(i)):[],e}catch(e){throw console.warn("There was a problem remapping team response",e),e}}};var Ci=class{fromResponse(t){try{let e=new to;return e.ftScore=this.statEntityFromResponse(t.ft_score),e.htScore=this.statEntityFromResponse(t.ht_score),e.aetScore=this.statEntityFromResponse(t.aet_score),e.aggScore=this.statEntityFromResponse(t.agg_score),e.penScore=this.statEntityFromResponse(t.pen_score),e}catch(e){throw console.warn("There was a problem remapping the scores",e),e}}statEntityFromResponse=t=>({homeGoals:t.home_goals,awayGoals:t.away_goals})};var Il=class{teamRemapper=null;competitionRemapper=null;scoresRemapper=null;constructor(){this.teamRemapper=new j,this.competitionRemapper=new tt,this.scoresRemapper=new Ci}fromResponse(t){try{let e=new Xr;return e.id=t.id,e.kickoffAt=t.kickoff_at,e.finishedAt=t.finished_at,e.updatedAt=t.updated_at,e.isDeleted=t.is_deleted,e.undecided=t.undecided,e.homeTeam=this.teamRemapper.fromResponse(t.home_team),e.awayTeam=this.teamRemapper.fromResponse(t.away_team),e.lineupsConfirmed=t.lineups_confirmed,e.startedAt=t.started_at,e.minute=t.minute,e.scores=this.scoresRemapper.fromResponse(t.scores),e.context={competition:t.context.competition?this.competitionRemapper.fromResponse(t.context.competition):null},e.status={type:t.status.type,subType:t.status.sub_type},e}catch(e){throw console.warn("There was a problem remapping the match response",e),e}}};var wl=class{fromResponse(t){try{let e=new Zr;return e.corners=this.statEntityFromResponse(t.corners),e.cornersFirstHalf=this.statEntityFromResponse(t.corners_1h),e.cornersSecondHalf=this.statEntityFromResponse(t.corners_2h),e.cornersExtraTime=this.statEntityFromResponse(t.corners_et),e.crosses=this.statEntityFromResponse(t.crosses),e.crossesFirstHalf=this.statEntityFromResponse(t.crosses_1h),e.crossesSecondHalf=this.statEntityFromResponse(t.crosses_2h),e.crossesExtraTime=this.statEntityFromResponse(t.crosses_et),e.offside=this.statEntityFromResponse(t.offside),e.offsideFirstHalf=this.statEntityFromResponse(t.offside_1h),e.offsideSecondHalf=this.statEntityFromResponse(t.offside_2h),e.offsideExtraTime=this.statEntityFromResponse(t.offside_et),e.shotsOn=this.statEntityFromResponse(t.shots_on),e.shotsOnFirstHalf=this.statEntityFromResponse(t.shots_on_1h),e.shotsOnSecondHalf=this.statEntityFromResponse(t.shots_on_2h),e.shotsOnExtraTime=this.statEntityFromResponse(t.shots_on_et),e.throwIn=this.statEntityFromResponse(t.throw_in),e.throwInFirstHalf=this.statEntityFromResponse(t.throw_in_1h),e.throwInSecondHalf=this.statEntityFromResponse(t.throw_in_2h),e.throwInExtraTime=this.statEntityFromResponse(t.throw_in_et),e.redCards=this.statEntityFromResponse(t.red_cards),e.redCardsFirstHalf=this.statEntityFromResponse(t.red_cards_1h),e.redCardsSecondHalf=this.statEntityFromResponse(t.red_cards_2h),e.redCardsExtraTime=this.statEntityFromResponse(t.red_cards_et),e.shotsOff=this.statEntityFromResponse(t.shots_off),e.shotsOffFirstHalf=this.statEntityFromResponse(t.shots_off_1h),e.shotsOffSecondHalf=this.statEntityFromResponse(t.shots_off_2h),e.shotsOffExtraTime=this.statEntityFromResponse(t.shots_off_et),e.goalKicks=this.statEntityFromResponse(t.goal_kicks),e.goalKicksFirstHalf=this.statEntityFromResponse(t.goal_kicks_1h),e.goalKicksSecondHalf=this.statEntityFromResponse(t.goal_kicks_2h),e.goalKicksExtraTime=this.statEntityFromResponse(t.goal_kicks_et),e.possession=this.statEntityFromResponse(t.possession),e.possessionFirstHalf=this.statEntityFromResponse(t.possession_1h),e.possessionSecondHalf=this.statEntityFromResponse(t.possession_2h),e.possessionExtraTime=this.statEntityFromResponse(t.possession_et),e.treatments=this.statEntityFromResponse(t.treatments),e.treatmentsFirstHalf=this.statEntityFromResponse(t.treatments_1h),e.treatmentsSecondHalf=this.statEntityFromResponse(t.treatments_2h),e.treatmentsExtraTime=this.statEntityFromResponse(t.treatments_et),e.yellowCards=this.statEntityFromResponse(t.yellow_cards),e.yellowCardsFirstHalf=this.statEntityFromResponse(t.yellow_cards_1h),e.yellowCardsSecondHalf=this.statEntityFromResponse(t.yellow_cards_2h),e.yellowCardsExtraTime=this.statEntityFromResponse(t.yellow_cards_et),e.shotsBlocked=this.statEntityFromResponse(t.shots_blocked),e.shotsBlockedFirstHalf=this.statEntityFromResponse(t.shots_blocked_1h),e.shotsBlockedSecondHalf=this.statEntityFromResponse(t.shots_blocked_2h),e.shotsBlockedExtraTime=this.statEntityFromResponse(t.shots_blocked_et),e.substitutions=this.statEntityFromResponse(t.substitutions),e.substitutionsFirstHalf=this.statEntityFromResponse(t.substitutions_1h),e.substitutionsSecondHalf=this.statEntityFromResponse(t.substitutions_2h),e.substitutionsExtraTime=this.statEntityFromResponse(t.substitutions_et),e.counterAttacks=this.statEntityFromResponse(t.counter_attacks),e.counterAttacksFirstHalf=this.statEntityFromResponse(t.counter_attacks_1h),e.counterAttacksSecondHalf=this.statEntityFromResponse(t.counter_attacks_2h),e.counterAttacksExtraTime=this.statEntityFromResponse(t.counter_attacks_et),e.foulsCommitted=this.statEntityFromResponse(t.fouls_committed),e.foulsCommittedFirstHalf=this.statEntityFromResponse(t.fouls_committed_1h),e.foulsCommittedSecondHalf=this.statEntityFromResponse(t.fouls_committed_2h),e.foulsCommittedExtraTime=this.statEntityFromResponse(t.fouls_committed_et),e}catch(e){throw console.warn("There was a problem remapping the stats",e),e}}statEntityFromResponse=t=>({homeTeam:t?t.home_team:null,awayTeam:t?t.away_team:null})};var Ai=class{fromResponse(t){try{let e=new no;return e.id=t.id,e.name=t.name,e.position=t.position,e.shirtNumber=t.shirt_number,e.assets=t.assets,e.type=t.type,e}catch(e){throw console.warn("There was a problem remapping the player from timeline",e),e}}};var _l=class{playerRemapper=null;constructor(){this.playerRemapper=new Ai}fromResponse(t){try{let e=new Ve;return e.homeTeam.players=t.home_team&&t.home_team.players?t.home_team.players.map(i=>this.playerRemapper.fromResponse(i)):[],e.awayTeam.players=t.away_team&&t.away_team.players?t.away_team.players.map(i=>this.playerRemapper.fromResponse(i)):[],e}catch(e){throw console.warn("There was a problem remapping the lineups",e),e}}};var Pl=class{playerRemapper=null;constructor(){this.playerRemapper=new Ai}fromResponse(t){try{let e=new eo;return e.minute=t.minute,e.type=t.type,e.teamId=t.team_id,e.player=this.playerRemapper.fromResponse(t.player),e.relatedPlayer=t.related_player?this.playerRemapper.fromResponse(t.related_player):null,e.updatedAt=t.updated_at,e}catch(e){throw console.warn("There was a problem remapping timeline",e),e}}};var Tl=class{fromResponse(t){try{let e=new io;return e.playerId=t.player_id,e.position=t.position,e.minutesPlayed=t.minutes_played,e.yellowCards=t.yellow_cards,e.redCards=t.red_cards,e.goals=t.goals,e.penaltyGoals=t.penalty_goals,e.penaltyCommitted=t.penalty_committed,e.penaltyWon=t.penalty_won,e.penaltyMissed=t.penalty_missed,e.penaltySaved=t.penalty_saved,e.penaltyReceived=t.penalty_received,e.ownGoals=t.own_goals,e.assists=t.assists,e.cleanSheets=t.clean_sheets,e.shots=t.shots,e.shotsOn=t.shots_on,e.shotsBlocked=t.shots_blocked,e.offsides=t.offsides,e.foulsCommitted=t.fouls_committed,e.foulsWon=t.fouls_won,e.tackles=t.tackles,e.tacklesBlocks=t.tackles_blocks,e.tacklesInterceptions=t.tackles_interceptions,e.concededGoals=t.conceded_goals,e.caughtBall=t.caught_ball,e.saves=t.saves,e.passes=t.passes,e.crosses=t.crosses,e.interceptions=t.interceptions,e.keyPasses=t.key_passes,e.passesAccuracy=t.passes_accuracy,e.duels=t.duels,e.duelsWon=t.duels_won,e.dribblesAttempts=t.dribbles_attempts,e.dribblesSuccess=t.dribbles_success,e.dribblesPast=t.dribbles_past,e.updatedAt=t.updated_at,e}catch(e){throw console.warn("There was a problem remapping the player stats",e),e}}};var El=class{teamMapper=null;competitionsMapper=null;lineupsMapper=null;scoresMapper=null;statsMapper=null;timelineMapper=null;playerStatsMapper=null;constructor(){this.teamMapper=new j,this.competitionsMapper=new tt,this.lineupsMapper=new _l,this.scoresMapper=new Ci,this.statsMapper=new wl,this.timelineMapper=new Pl,this.playerStatsMapper=new Tl}fromResponse(t){try{let e=new Jr;return e.id=t.id,e.kickoffAt=t.kickoff_at,e.finishedAt=t.finished_at,e.updatedAt=t.updated_at,e.isDeleted=t.is_deleted,e.undecided=t.undecided,e.homeTeam=t.home_team?this.teamMapper.fromResponse(t.home_team):null,e.awayTeam=t.away_team?this.teamMapper.fromResponse(t.away_team):null,e.lineupsConfirmed=t.lineups_confirmed,e.startedAt=t.started_at,e.minute=t.minute,e.scores=this.scoresMapper.fromResponse(t.scores),e.stats=this.statsMapper.fromResponse(t.stats),e.playerStats=t.player_stats?t.player_stats.map(i=>this.playerStatsMapper.fromResponse(i)):t.player_stats,e.context={competition:this.competitionsMapper.fromResponse(t.context.competition)},e.timeline=t.timeline?t.timeline.map(i=>this.timelineMapper.fromResponse(i)):[],e.status={type:t.status.type,subType:t.status.sub_type},e.lineups=t.lineups?this.lineupsMapper.fromResponse(t.lineups):new Ve,e}catch(e){throw console.warn("There was a problem remapping the match response",e),e}}};var Rl=class{countryRemapper=null;constructor(){this.countryRemapper=new $}fromResponse(t){try{let e=new so;return e.id=t.id,e.firstName=t.first_name?t.first_name:null,e.lastName=t.last_name?t.last_name:null,e.name=t.name?t.name:null,e.birthDate=t.birth_date,e.country=this.countryRemapper.countryFromResponse(t.country),e.assets=t.assets,e.position=t.position,e}catch(e){throw console.warn("There was a problem remapping top player response",e),e}}};var Oi=class{countryRemapper=null;teamRemapper=null;constructor(){this.countryRemapper=new $,this.teamRemapper=new j}fromResponse(t){try{let e=new ao;return e.id=t.id,e.firstName=t.first_name?t.first_name:null,e.lastName=t.last_name?t.last_name:null,e.name=t.name?t.name:null,e.birthDate=t.birth_date,e.country=this.countryRemapper.countryFromResponse(t.country),e.assets=t.assets,e.teams=t.teams?t.teams.map(i=>this.teamRemapper.fromResponse(i)):[],e.position=t.position,e.isDeleted=t.is_deleted,e}catch(e){throw console.warn("There was a problem remapping players response",e),e}}};var Fl=class{countryRemapper=null;teamRemapper=null;competitionRemapper=null;constructor(){this.countryRemapper=new $,this.teamRemapper=new j,this.competitionRemapper=new tt}fromResponse(t){try{let e=new ro;return e.id=t.id,e.firstName=t.first_name?t.first_name:null,e.lastName=t.last_name?t.last_name:null,e.name=t.name?t.name:null,e.birthDate=t.birth_date,e.country=this.countryRemapper.countryFromResponse(t.country),e.assets=t.assets,e.teams=t.teams?t.teams.map(i=>this.teamRemapper.fromResponse(i)):[],e.position=t.position,e.isDeleted=t.is_deleted,e.competitions=t.competitions?t.competitions.map(i=>this.competitionRemapper.fromResponse(i)):[],e}catch(e){throw console.warn("There was a problem remapping player response",e),e}}};var Sl=class{teamRemapper=null;playerRemapper=null;competitionremapper=null;constructor(){this.teamRemapper=new j,this.playerRemapper=new Oi,this.competitionremapper=new tt}fromResponse(t){try{let e=new uo;return e.teams=t.teams?t.teams.map(i=>this.teamRemapper.fromResponse(i)):[],e.players=t.players?t.players.map(i=>this.playerRemapper.fromResponse(i)):[],e.competitions=t.competitions?t.competitions.map(i=>this.competitionremapper.fromResponse(i)):[],e}catch(e){throw console.warn("There was a problem remapping search response",e),e}}};var vl=class{remapMetaProp=t=>{let e=new k;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.totalItems=t.pagination.total_items,e.pagination.numberOfPages=t.pagination.number_of_pages,e}};var Cl=class{remapPlayersPoints=t=>{let e=new Qr;return e.meta.filters.templateId=t.meta.filters.template_id,e.data=t.data.map(i=>this.remapPlayersPointsData(i)),e};remapPlayersPointsData=t=>{let e=new Wr;return e.playerId=t.player_id,e.points=t.points,e.rank=t.rank,e};remapPlayerDetailedStats=t=>{let e=new Vr;return e.meta.filters.templateId=t.meta.filters.template_id,e.meta.filters.playerId=t.meta.filters.player_id,e.data=t.data.map(i=>this.remapPlayerDetailedData(i)),e};remapPlayerDetailedData=t=>{let e=new qr;return e.matchId=t.match_id,e.points=t.points?this.remapPlayerDetailedPoints(t.points):null,e.stats=t.stats?this.remapPlayerDetailedStatsData(t.stats):null,e};remapPlayerDetailedPoints=t=>{let e=new Ue;return e.total=t.total,e.minutesPlayed=t.minutes_played,e.yellowCards=t.yellow_cards,e.redCards=t.red_cards,e.goals=t.goals,e.penaltyGoals=t.penalty_goals,e.ownGoals=t.own_goals,e.assists=t.assists,e.cleanSheets=t.clean_sheets,e.shots=t.shots,e.shotsOn=t.shots_on,e.offsides=t.offsides,e.foulsCommitted=t.fouls_committed,e.penaltyCommitted=t.penalty_committed,e.penaltyWon=t.penalty_won,e.penaltyMissed=t.penalty_missed,e.tackles=t.tackles,e.concededGoals=t.conceded_goals,e.caughtBall=t.caught_ball,e.saves=t.saves,e};remapPlayerDetailedStatsData=t=>{let e=new Dt;return e.minutesPlayed=t.minutes_played,e.yellowCards=t.yellow_cards,e.redCards=t.red_cards,e.goals=t.goals,e.penaltyGoals=t.penalty_goals,e.penaltyCommitted=t.penalty_committed,e.penaltyWon=t.penalty_won,e.penaltyMissed=t.penalty_missed,e.penaltySaved=t.penalty_saved,e.penaltyReceived=t.penalty_received,e.ownGoals=t.own_goals,e.assists=t.assists,e.cleanSheets=t.clean_sheets,e.shots=t.shots,e.shotsOn=t.shots_on,e.shotsBlocked=t.shots_blocked,e.offsides=t.offsides,e.foulsCommitted=t.fouls_committed,e.foulsWon=t.fouls_won,e.tackles=t.tackles,e.tacklesBlocks=t.tackles_blocks,e.tacklesInterceptions=t.tackles_interceptions,e.concededGoals=t.conceded_goals,e.caughtBall=t.caught_ball,e.saves=t.saves,e.passes=t.passes,e.crosses=t.crosses,e.interceptions=t.interceptions,e.keyPasses=t.key_passes,e.passesAccuracy=t.passes_accuracy,e.duels=t.duels,e.duelsWon=t.duels_won,e.dribblesAttempts=t.dribbles_attempts,e.dribblesSuccess=t.dribbles_success,e.dribblesPast=t.dribbles_past,e}};var dt=class extends v{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(t){super(t,O(t.environment,"football")),this.apiSignInUrl=t.lang!=="en"?this.apiSignInUrl+`&lang=${t.lang}`:this.apiSignInUrl,this.countryRemapper=new $,this.competitionBasicRemapper=new tt,this.competitionFullRemapper=new yl,this.teamBasicRemapper=new j,this.teamFullRemapper=new Ml,this.matchBasicRemapper=new Il,this.matchFullRemapper=new El,this.playerBasicRemapper=new Oi,this.playerFullRemapper=new Fl,this.topPlayerRemapper=new Rl,this.searchRemapper=new Sl,this.footballMetaRemapper=new vl,this.footballService=new Et(t),this.fantasyRemapper=new Cl}getCountries=async t=>{let e="There was a problem with the football countries request",i=`/countries${this.apiSignInUrl}`,a=Date.now();t&&(i+=`&disable_cache=${a}`);let r=await this.fetchWithoutAuth(i,e);return this.countryRemapper.countriesFromResponse(r.data)};getCompetitions=async(t,e)=>{let i=Date.now(),a="There was a problem with football competitions request";if(e=e||!1,t&&t.competitionIds&&t.competitionIds.length>this.limitIds-1){let r=[],o=qt(t.competitionIds,this.limitIds);for(let l of o){t.competitionIds=l;let p=`/competitions${this.apiSignInUrl}${t.constructFilterUrl()}`;e&&(p+=`&disable_cache=${i}`);let c=await this.fetchWithoutAuth(p,a);r.push(c.data.map(u=>this.competitionBasicRemapper.fromResponse(u)))}return Array.prototype.concat.apply([],r)}else{let r=`/competitions${this.apiSignInUrl}`;return t&&(r+=`${t.constructFilterUrl()}`),e&&(r+=`&disable_cache=${i}`),(await this.fetchWithoutAuth(r,a)).data.map(n=>this.competitionBasicRemapper.fromResponse(n))}};getCompetitionById=async(t,e)=>{let i=`/competitions/${t}${this.apiSignInUrl}`,a="There was a problem with football competition by ID request",r=Date.now();e&&(i+=`&disable_cache=${r}`);let o=await this.fetchWithoutAuth(i,a);return this.competitionFullRemapper.fromResponse(o.data)};getTopCompetitions=async t=>{let e="There was a problem with top football competitions request",i=`/competitions/top${this.apiSignInUrl}`,a=Date.now();return t&&(i+=`&disable_cache=${a}`),(await this.fetchWithoutAuth(i,e)).data.map(o=>this.competitionBasicRemapper.fromResponse(o))};getTeams=async(t,e)=>{let i=Date.now(),a="There was a problem with football teams request";if(t&&t.teamIds&&t.teamIds.length>this.limitIds){let r=[],o=qt(t.teamIds,this.limitIds);for(let l of o){t.teamIds=l,t.limit=l.length;let p=`/teams${this.apiSignInUrl}${t.constructFilterUrl()}`;e&&(p+=`&disable_cache=${i}`);let c=await this.fetchWithoutAuth(p,a);r.push(c.data.map(u=>this.teamBasicRemapper.fromResponse(u)))}return Array.prototype.concat.apply([],r)}else{let r=new Xt,o=`/teams${this.apiSignInUrl}`;t&&(o+=`${t.constructFilterUrl()}`),e&&(o+=`&disable_cache=${i}`);let n=await this.fetchWithoutAuth(o,a);return r.meta=this.footballMetaRemapper.remapMetaProp(n.meta),r.data=n.data.map(l=>this.teamBasicRemapper.fromResponse(l)),r}};getTeamById=async(t,e)=>{let i="There was a problem with football team by ID request",a=`/teams/${t}${this.apiSignInUrl}`,r=Date.now();e&&(a+=`&disable_cache=${r}`);let o=await this.fetchWithoutAuth(a,i);return this.teamFullRemapper.fromResponse(o.data)};getTopTeams=async t=>{let e=`/teams/top${this.apiSignInUrl}`,i="There was a problem with top football teams request",a=Date.now();t&&(e+=`$disable_cache=${a}`);let r=await this.fetchWithoutAuth(e,i);return r.data?r.data.map(o=>this.teamBasicRemapper.fromResponse(o)):[]};getNextMatchForTeam=async(t,e)=>{let i=`/teams/${t}/next-match${this.apiSignInUrl}`,a=Date.now(),r="There was a problem with next match for team request";e&&(i+=`&disable_cache=${a}`);let o=await this.fetchWithoutAuth(i,r);return this.matchFullRemapper.fromResponse(o.data)};getPrevMatchForTeam=async(t,e)=>{let i=`/teams/${t}/previous-match${this.apiSignInUrl}`,a=Date.now(),r="There was a problem with previous match for team request";e&&(i+=`&disable_cache=${a}`);let o=await this.fetchWithoutAuth(i,r);return this.matchFullRemapper.fromResponse(o.data)};getPlayers=async(t,e)=>{let i=Date.now(),a="There was a problem with football players request";if(t&&t.playerIds&&t.playerIds.length>this.limitIds-1){let r=[],o=qt(t.playerIds,this.limitIds);for(let p of o){t.playerIds=p,t.limit=p.length;let c=`/players${this.apiSignInUrl}${t.constructFilterUrl()}`;e&&(c+=`&disable_cache=${i}`);let u=await this.fetchWithoutAuth(c,a);r.push(u.data.map(d=>this.playerBasicRemapper.fromResponse(d)))}let n=Array.prototype.concat.apply([],r),l=new Xt;return l.data=n,l}else{let r=new Xt,o=`/players${this.apiSignInUrl}`;t&&(o+=`${t.constructFilterUrl()}`),e&&(o+=`&disable_cache=${i}`);let n=await this.fetchWithoutAuth(o,a);return r.meta=this.footballMetaRemapper.remapMetaProp(n.meta),r.data=n.data.map(l=>this.playerBasicRemapper.fromResponse(l)),r}};getPlayerById=async(t,e)=>{let i=`/players/${t}${this.apiSignInUrl}`,a=Date.now(),r="There was a problem with football player by ID request";e&&(i+=`&disable_cache=${a}`);let o=await this.fetchWithoutAuth(i,r);return this.playerFullRemapper.fromResponse(o.data)};getTopPlayers=async t=>{let e=`/players/top${this.apiSignInUrl}`,i=Date.now(),a="There was a problem with top football players request";return t&&(e+=`&disable_cache=${i}`),(await this.fetchWithoutAuth(e,a)).data.map(o=>this.topPlayerRemapper.fromResponse(o))};getNextMatchForPlayer=async(t,e)=>{let i=`/players/${t}/next-match${this.apiSignInUrl}`,a=Date.now(),r="There was a problem with next match for player request";e&&(i+=`&disable_cache=${a}`);let o=await this.fetchWithoutAuth(i,r);return this.matchFullRemapper.fromResponse(o.data)};getPrevMatchForPlayer=async(t,e)=>{let i=`/players/${t}/previous-match${this.apiSignInUrl}`,a=Date.now(),r="There was a problem with previous match for player request";e&&(i+=`&disable_cache=${a}`);let o=await this.fetchWithoutAuth(i,r);return this.matchFullRemapper.fromResponse(o.data)};getMatchById=async(t,e)=>{let i=`/matches/${t}${this.apiSignInUrl}`,a=Date.now(),r="There was a problem with match by ID request";e&&(i+=`&disable_cache=${a}`);let o=await this.fetchWithoutAuth(i,r);return this.matchFullRemapper.fromResponse(o.data)};getMatches=async(t,e)=>{let i=new Xt,a="There was a problem with football matches request";if(t&&t.matchIds&&t.matchIds.length>this.limitIds){let r=[],o=qt(t.matchIds,this.limitIds);for(let l of o){let p=new gt({...t,matchIds:l,limit:l.length}),c=!0,u=`/matches${this.apiSignInUrl}${p.constructFilterUrl(c)}&limit=${l.length}`;e&&(u+=m());let d=await this.fetchWithoutAuth(u,a);r.push(d.data.map(M=>this.matchBasicRemapper.fromResponse(M)))}let n=Array.prototype.concat.apply([],r);return i.meta=this.footballService.setMetaDataBatchRequest(n.length,t.limit||20,t.page||1),i.data=this.footballService.finalizeMatchesDataBatchRequest(n,t),i}else{let r=`/matches${this.apiSignInUrl}`;t&&(r+=`${t.constructFilterUrl()}`),e&&(r+=m());let o=await this.fetchWithoutAuth(r,a);return i.meta=this.footballMetaRemapper.remapMetaProp(o.meta),i.data=o.data.map(n=>this.matchBasicRemapper.fromResponse(n)),i}};search=async(t,e)=>{let i=`/search${this.apiSignInUrl}${t.constructFilterUrl()}`,a=Date.now(),r="There was a problem with football search request";e&&(i+=`&disable_cache=${a}`);let o=await this.fetchWithoutAuth(i,r);return this.searchRemapper.fromResponse(o.data)};getPlayersPoints=async(t,e,i)=>{let a=`/players/points/${t}${this.apiSignInUrl}`,r=Date.now(),o="There was a problem with players points request";e&&(a+=`&position=${e.toLocaleLowerCase()}`),i&&(a+=`&disable_cache=${r}`);let n=await this.fetchWithoutAuth(a,o);return this.fantasyRemapper.remapPlayersPoints(n)};getPlayerDetailedStatistics=async(t,e,i)=>{let a=`/players/${e}/points/${t}${this.apiSignInUrl}`,r=Date.now(),o="There was a problem with detailed player points request";i&&(a+=`&disable_cache=${r}`);let n=await this.fetchWithoutAuth(a,o);return this.fantasyRemapper.remapPlayerDetailedStats(n)}};var Al=class{idMapping=null;idSchema=null;native="native";footballFacade=null;constructor(t,e,i){this.idMapping=i,this.idSchema=t.idSchema,this.footballFacade=e}remapProfileStats=async t=>{if(!t.predictions)return t;let{successRates:e,predictions:i}=t,a={competition:this.getIdsKeys(e.byFootballCompetition,i.single.breakdown.footballCompetitions),team:this.getIdsKeys(e.byFootballTeam,i.single.breakdown.footballTeams)};if(Object.values(a.competition).length){let r=JSON.parse(JSON.stringify(t.successRates.byFootballCompetition)),o=await this.getEntitiesMap(a.competition,"competition"),n=await this.setSuccessRatesModels(r,o);t.successRates.byFootballCompetition=n,i.single.breakdown.footballCompetitions=this.reconstructBreakdown(i.single.breakdown.footballCompetitions,o)}if(Object.values(a.team).length){let r=JSON.parse(JSON.stringify(t.successRates.byFootballTeam)),o=await this.getEntitiesMap(a.team,"team"),n=await this.setSuccessRatesModels(r,o);t.successRates.byFootballTeam=n,i.single.breakdown.footballTeams=this.reconstructBreakdown(i.single.breakdown.footballTeams,o)}return t};setSuccessRatesModels=async(t,e)=>{let i;return this.reconstructRecords(t,i,e)};getEntitiesMap=async(t,e)=>{switch(e){case"competition":return await this.footballFacade.getCompetitionsMapWithNativeIds(t);case"team":return await this.footballFacade.getTeamsMapWithNativeIds(t)}};reconstructRecords=(t,e,i)=>t&&Object.keys(t).length?(Object.keys(t).forEach(a=>{let r=i.get(a);e={...e,[r.id]:t[a]},e[r.id].model=r}),e):t;reconstructBreakdown=(t,e)=>t.length?t.map(i=>{let a=e.get(i.entityId);return i.entityId=a.id,i.model=a,i}):t;getIdsKeys=(t,e)=>{let i=Object.keys(t);if(e.length){let a=e.map(r=>r.entityId);return Array.from(new Set([...i,...a]))}return i};remapInterestsToIdSchema=async t=>{if(this.idSchema!==this.native)if(t&&t.length>0){let e={},i={},a=t.filter(l=>l.source.toLocaleUpperCase()==="FOOTBALL"),r=t.filter(l=>l.source.toLocaleUpperCase()!=="FOOTBALL");a.forEach(l=>{e.hasOwnProperty(l.type)||(e[l.type]=[],i[l.type]=[]),e[l.type].push(l.id),i[l.type].push(l)});let o=await this.remapIdsObj(e,this.native,this.idSchema),n=[];for(let[l,p]of Object.entries(i))p.forEach((c,u)=>{c.id=o[l][u],n.push(c)});return n.concat(r)}else return t;return t};remapInterestToNative=async t=>{if(this.idSchema!==this.native&&t.source.toLocaleUpperCase()==="FOOTBALL"){let e={},{id:i,type:a}=t;e[a]=[i];let r=await this.remapIdsObj(e,this.idSchema,this.native);return t.id=r[a][0],t}return t};inquiryCustomInterests=(t,e)=>{let i=[];return t&&t.length>0&&(i=t.filter(a=>a.source.toLocaleUpperCase()==="CUSTOM"),e)?i.map(a=>{let r=new on;return r.id=a.id,r.type=a.type,r.source=a.source,r.favourite=a.favourite,r}):i};remapInterests=async t=>{let i=this.inquiryCustomInterests(t,!1);if(i&&i.length>0){let a=t.filter(o=>o.source.toLocaleUpperCase()!=="CUSTOM"),r=await this.remapInterestsToIdSchema(a);return i.forEach(o=>r.push(o)),r}return await this.remapInterestsToIdSchema(t)};showFullInterests=async t=>{let e=[];if(t&&t.length>0){let a=this.inquiryCustomInterests(t,!0);e.push(a);let r=t.filter(c=>c.source.toLocaleUpperCase()!=="CUSTOM"),{competitionsMap:o,teamsMap:n,playersMap:l}=await this.getInterestsEntitiesMap(r),p=r.map(c=>{let u=null;if(c.source.toLocaleUpperCase()==="FOOTBALL"){if(c.type==="competition")return u=o.get(c.id),u&&(c.id=u.id),c.model=u,c;if(c.type==="team")return u=n.get(c.id),u&&(c.id=u.id),c.model=u,c;if(c.type==="player")return l?(c.model=l[c.id],c.id=l[c.id].id):c.model=u,c}else return c.model=u,c});return e.push(p),e.flat()}return e};getInterestsEntitiesMap=async t=>{let e=[],i=[],a=[],r=new Map,o=new Map,n=null;return t.forEach(l=>{l.type==="competition"&&l.source.toLocaleUpperCase()==="FOOTBALL"?e.push(l.id):l.type==="team"&&l.source.toLocaleUpperCase()==="FOOTBALL"?i.push(l.id):l.type==="player"&&l.source.toLocaleUpperCase()==="FOOTBALL"&&a.push(l.id)}),e.length&&(r=await this.footballFacade.getCompetitionsMapWithNativeIds(e)),i.length&&(o=await this.footballFacade.getTeamsMapWithNativeIds(i)),a.length&&(n=await this.footballFacade.getPlayersMapWithNativeIds(a)),{competitionsMap:r,teamsMap:o,playersMap:n}};remapIdsObj=async(t,e,i)=>await this.idMapping.idMappingFacade.getEntitiesByIds(t,e,i)};var Ol=class{idMapping=null;profileOperations=null;constructor(t,e){this.idMapping=new R(t),this.profileOperations=new Al(t,e,this.idMapping)}remapProfileStats=async t=>await this.profileOperations.remapProfileStats(t);remapInterestToNative=async t=>await this.profileOperations.remapInterestToNative(t);remapInterests=async t=>await this.profileOperations.remapInterests(t);showFullInterests=async t=>await this.profileOperations.showFullInterests(t)};var D=class{idsRemapper=null;profileHttps=null;activityHttps=null;footballHttps=null;footballFacade=null;idMapping=null;localCache=null;profileFacade=null;ownProfileBuilder=null;profileBuilder=null;constructor(t){this.profileHttps=new Mi(t),this.activityHttps=new hi(t),this.footballHttps=new dt(t),this.idMapping=new R(t),this.localCache=new ct().createLocalCacheInstance(t.idSchema),this.footballFacade=new vi(t,this.localCache,this.footballHttps,this.idMapping),this.profileFacade=new _t(this.localCache,this.profileHttps,this.activityHttps,t.errorHandlingMode),this.idsRemapper=new Ol(t,this.footballFacade),this.ownProfileBuilder=new nl(t,this.idsRemapper,this.localCache,this.profileHttps,this.activityHttps),this.profileBuilder=new wi(this.idsRemapper,this.localCache,this.profileHttps,this.activityHttps)}getOwn=()=>this.ownProfileBuilder;getById=t=>this.profileBuilder.getById(t);getCountries=async t=>await this.profileFacade.getCountries(t);getByIds=async(t,e,i)=>await this.profileFacade.getByIds(t,e,i);collectLead=async t=>await this.profileFacade.collectLead(t);checkFollowStatus=async t=>await this.profileFacade.checkFollowStatus(t);getOwnStats=async()=>await this.ownProfileBuilder.getStats();getStats=async(t,e)=>await this.profileBuilder.getById(t).getStats(e);getOwnBadges=async()=>await this.ownProfileBuilder.getBadges();getBadges=async t=>await this.profileBuilder.getById(t).getBadges();collectConsents=async t=>await this.profileFacade.collectConsents(t)};var xl=class extends I{};var Xu=(r=>(r.LIKE="like",r.DISLIKE="dislike",r.SHARE="share",r.COMMENT="comment",r.PREDICTION_MADE="prediction_made",r))(Xu||{});var Ju=(a=>(a.CORRECT="CORRECT",a.INCORRECT="INCORRECT",a.PARTIALLY_CORRECT="PARTIALLY_CORRECT",a.NOT_VERIFIED="NOT_VERIFIED",a))(Ju||{});var Ll=(i=>(i.ONE="1",i.X="x",i.TWO="2",i))(Ll||{}),Dl=(i=>(i.ONE_X="1x",i.X_TWO="x2",i.ONE_TWO="12",i))(Dl||{}),Bl=(p=>(p.ONE_ONE="1/1",p.ONE_X="1/x",p.ONE_TWO="1/2",p.X_ONE="x/1",p.X_X="x/x",p.X_TWO="x/2",p.TWO_ONE="2/1",p.TWO_X="2/x",p.TWO_TWO="2/2",p))(Bl||{});var hu=(F=>(F.NONE="none",F.FINISHED="finished",F.CANCELLED="cancelled",F.POSTPONED="postponed",F.NOT_STARTED="not_started",F.FIRST_HALF="1st_half",F.SECOND_HALF="2nd_half",F.FINISHED_AFTER_AWARDED_WIN="finished_after_awarded_win",F.TO_FINISH="to_finish",F.FINISHED_AET="finished_aet",F.HALFTIME="halftime",F.FINISHED_AP="finished_ap",F.INTERRUPTED="interrupted",F.KICK_OFF_DELAYED="kick_off_delayed",F.ABANDONED="abandoned",F.WAITING_FOR_PENALTY="waiting_for_penalty",F.PENALTY="penalty",F.PAUSE="pause",F.EXTRA_TIME_1ST_HALF="extra_time_1st_half",F.EXTRA_TIME_END_OF_1ST_HALF="extra_time_end_of_1st_half",F.EXTRA_TIME_2ND_HALF="extra_time_2nd_half",F.WAITING_FOR_EXTRA_TIME="waiting_for_extra_time",F.NO_INFO_YET="no_info_yet",F.AWAITING_INFO="awaiting_info",F.FINISHED_ASG="finished_asg",F))(hu||{});var Nl=class extends K{constructor(t){super(t)}validatePrediction=t=>{(!t.fixtures||!Array.isArray(t.fixtures)||t.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 e=Object.keys(new gr);for(let i of t.fixtures)(Object.keys(i).length!==e.length||Object.keys(i).some(a=>!e.includes(a)))&&this.throwException(400,"invalid_method_call","Fixtures field is invalid. For more information please visit our documentation");t.tiebreaker&&(!t.tiebreaker.statTotal||!Number.isInteger(t.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")}};var kl=class{https=null;validator=null;profile=null;constructor(t){this.https=new jt(t),this.profile=new D(t),this.validator=new Nl(t.errorHandlingMode)}getGames=async(t,e)=>(t&&(t=new yr(t)),await this.https.getBracketGames(t,e));getGameById=async(t,e)=>await this.https.getBracketGameById(t,e);makePrediction=async(t,e)=>(this.validator.validatePrediction(e),await this.https.makeBracketGamePrediction(t,e));updatePrediction=async(t,e,i)=>(this.validator.validatePrediction(i),await this.https.updateBracketGamePrediction(t,e,i));getGamePredictionsForUser=async(t,e,i,a)=>{i&&(i=new fr(i));let r=await this.https.getBracketGamePredictionsForUser(t,e,i,a),o=null;try{o=await this.profile.getById(e).getInfo()}catch(n){console.error(n)}return r.data.forEach(n=>{n.profileModel=o}),r};getGamePredictionById=async(t,e,i)=>await this.https.getBracketGamePredictionById(t,e,i);getRankings=async(t,e,i)=>{e&&(e=new xl(e));let a=await this.https.getBracketGameRankings(t,e,i),r=a.data.map(n=>n.profileId),o=[];return r.length>0&&(o=await this.profile.getByIds(r),a.data=a.data.map(n=>(n.profileModel=o.find(l=>l.id===n.profileId)||null,n))),a}};var Gl=class{facade=null;constructor(t){this.facade=new kl(t)}getGames=async(t,e)=>await this.facade.getGames(t,e);getGameById=async(t,e)=>await this.facade.getGameById(t,e);makePrediction=async(t,e)=>await this.facade.makePrediction(t,e);updatePrediction=async(t,e,i)=>await this.facade.updatePrediction(t,e,i);getGamePredictionsForUser=async(t,e,i,a)=>await this.facade.getGamePredictionsForUser(t,e,i,a);getGamePredictionById=async(t,e,i)=>await this.facade.getGamePredictionById(t,e,i);getRankings=async(t,e,i)=>await this.facade.getRankings(t,e,i)};var Ul=class{remapResponse=t=>(t.meta=this.remapMeta(t.meta),t.data=this.remapData(t.data),t);remapLeagueLeaderboardResponse=t=>(t.meta=this.remapLeagueLeaderboardMeta(t.meta),t.data=this.remapData(t.data),t);remapTemplateBreakdown=t=>(t.meta=this.remapMeta(t.meta),t.data=t.data.map(e=>this.remapTemplatePoints(e)),t);remapMeta=t=>{let e=new Bt;return e.rankType=t.rank_type,e.fromDate=t.from_date,e.toDate=t.to_date,e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.totalItems=t.pagination.total_items,e.pagination.numberOfPages=t.pagination.number_of_pages,e};remapLeagueLeaderboardMeta=t=>{let e=new He;return e.templateId=t.template_id,e.privateLeagueId=t.private_league_id,e.fromDate=t.from_date,e.toDate=t.to_date,e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.totalItems=t.pagination.total_items,e.pagination.numberOfPages=t.pagination.number_of_pages,e};remapData=t=>{let e=[];return t.forEach(i=>{let a=new $e;a.position=i.position,a.profileId=i.profile_id,a.points=i.points,a.predictionsMade=i.predictions_made,e.push(a)}),e};remapTemplatePoints=t=>{let e=new Oo;return e.groupId=t.group_id,e.averagePoints=t.average_points,e.highestPoints=t.highest_points,e}};var Vl=class{remapRankings=t=>(t.meta=this.remapMeta(t.meta),t.data=this.remapData(t.data),t);remapRankingsPrivateLeague=t=>(t.meta=this.remapMeta(t.meta),t.data=this.remapDataUserRankingPrivateLeague(t.data),t);remapRankingsChallenge=t=>(t.meta=this.remapMeta(t.meta),t.data=this.remapDataUserRankingChallenge(t.data),t);remapMeta=t=>{let e=new k;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.numberOfPages=t.pagination.number_of_pages,e.pagination.totalItems=t.pagination.total_items,e};remapData(t){let e=[];return t.forEach(i=>{let a=new Ao;a.id=i.id,a.rankType=i.rank_type,a.position=i.position,a.points=i.points,a.gameType=i.game_type,delete a.profileId,delete a.profileModel,delete a.predictionsMade,e.push(a)}),e}remapDataUserRankingPrivateLeague(t){let e=[];return t.forEach(i=>{let a=new tn;a.templateId=i.template_id,a.privateLeagueId=i.private_league_id,a.position=i.position,a.points=i.points,e.push(a)}),e}remapDataUserRankingChallenge(t){let e=[];return t.forEach(i=>{let a=new Pr;a.templateId=i.template_id,a.challengeId=i.private_league_id,a.position=i.position,a.points=i.points,e.push(a)}),e}};var Hl=class{entityId=null;entityType=null};var et=class{remapBranding=t=>{let e=new ho;return t.colors&&(e.colors=new fo,e.colors.primaryColor=t.colors.primary_color,e.colors.secondaryColor=t.colors.secondary_color,e.colors.contentColor=t.colors.content_color,e.colors.backgroundColor=t.colors.background_color,e.colors.borderColor=t.colors.border_color,e.colors.additionalColor=t.colors.additional_color),t.urls&&(e.urls=new go,e.urls.primaryUrl=t.urls.primary_url,e.urls.secondaryUrl=t.urls.secondary_url,e.urls.privacyPolicyUrl=t.urls.privacy_policy_url,e.urls.termsAndConditionsUrl=t.urls.terms_and_conditions_url,e.urls.additionalUrl=t.urls.additional_url),t.images&&(e.images=new yo,e.images.mainLogo=t.images.main_logo,e.images.mobileLogo=t.images.mobile_logo,e.images.backgroundImage=t.images.background_image,e.images.mobileBackgroundImage=t.images.mobile_background_image,e.images.additionalImage=t.images.additional_image),e}};var $l=class extends et{remapResponse=t=>{let e=[];return t.forEach(i=>{let a=new Nt;a.id=i.id,a.name=i.name,a.description=i.description,a.type=i.type,a.fromDate=i.from_date,a.toDate=i.to_date,a.markets=i.markets?i.markets:null,a.teamIds=i.team_ids?i.team_ids:null,a.matchIds=i.match_ids?i.match_ids:null,a.groups=i.groups?this.remapGroups(i.groups):null,a.gameIds=i.game_ids?i.game_ids:null,a.gameTypes=i.game_types?i.game_types:null,a.competitionIds=i.competition_ids?i.competition_ids:null,a.excludedProfileIds=i.excluded_profile_ids?i.excluded_profile_ids:null,a.rules=i.rules?i.rules:null,a.labels=i.labels?i.labels:null,a.customFields=i.custom_fields?i.custom_fields:null,a.branding=i.branding?this.remapBranding(i.branding):null,a.flags=i.flags?i.flags:null,a.images=i.images?i.images:null,a.status=i.status?i.status:null,a.automaticallyChangeStatus=i.automatically_change_status,a.createdAt=i.created_at,a.updatedAt=i.updated_at,a.related=i.related?this.remapRelated(i.related):null,e.push(a)}),e};remapResponseId=t=>{let e=new xo;return e.id=t.id,e.name=t.name,e.description=t.description,e.type=t.type,e.fromDate=t.from_date,e.toDate=t.to_date,e.markets=t.markets?t.markets:null,e.teamIds=t.team_ids?t.team_ids:null,e.matchIds=t.match_ids?t.match_ids:null,e.groups=t.groups?this.remapGroups(t.groups):null,e.gameIds=t.game_ids?t.game_ids:null,e.gameTypes=t.game_types?t.game_types:null,e.competitionIds=t.competition_ids?t.competition_ids:null,e.excludedProfileIds=t.excluded_profile_ids?t.excluded_profile_ids:null,e.rules=t.rules?t.rules:null,e.flags=t.flags?t.flags:null,e.images=t.images?t.images:null,e.status=t.status?t.status:null,e.automaticallyChangeStatus=t.automatically_change_status,e.related=t.related?this.remapRelated(t.related):null,e.labels=t.labels,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.adContent=t.ad_content,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapMeta=t=>{let e=new Co;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.totalItems=t.pagination.total_items,e.pagination.numberOfPages=t.pagination.number_of_pages,e.filters.flags=t.filters.flags,e.filters.status=t.filters.status,e.filters.type=t.filters.type,e.filters.activeFrom=t.filters.active_from,e.filters.activeTo=t.filters.active_to,e.filters.createdFrom=t.filters.created_from,e.filters.createdTo=t.filters.created_to,e.filters.updatedFrom=t.filters.updated_from,e.filters.updatedTo=t.filters.updated_to,e};remapRelated=t=>t.map(e=>{let i=new Hl;return i.entityId=e.entity_id,i.entityType=e.entity_type,i});remapGroups=t=>t.map(e=>{let i=new Lo;return i.groupId=e.group_id,i.label=e.label,i.flags=e.flags,i.filters=this.remapGroupFilters(e.filters),i});remapGroupFilters=t=>{let e=new Do;return e.fromDate=t.from_date,e.toDate=t.to_date,e.matchIds=t.match_ids,e}};var zl=class{remapHighestSuccessRate=t=>t.map(e=>{let i=new So;return i.position=e.position,i.points=e.points,i.predictionsMade=e.predictions_made,i.profileId=e.profile_id,i.successRatePercent=e.success_rate_percent,i})};var Rt=class extends v{templateRemapper=null;leaderboardRemapper=null;rankingsRemapper=null;highestSuccessRateRemapper=null;constructor(t){super(t,O(t.environment,"loyalty")),this.templateRemapper=new $l,this.leaderboardRemapper=new Ul,this.rankingsRemapper=new Vl,this.highestSuccessRateRemapper=new zl}getTemplates=async(t,e)=>{let i=t?`/leaderboard/templates/${this.apiSignInUrl}${t.constructFiltersUrl()}`:`/leaderboard/templates/${this.apiSignInUrl}`;i+=f(e)?m():"";let a="There was a problem fetching the list of templates",r=await this.fetchWithoutAuth(i,a),o=JSON.parse(JSON.stringify(r));return o.meta=this.templateRemapper.remapMeta(r.meta),o.data=this.templateRemapper.remapResponse(r.data),o};getTemplateById=async(t,e)=>{let i=f(e)?`/leaderboard/templates/${t}${this.apiSignInUrl}${m()}`:`/leaderboard/templates/${t}${this.apiSignInUrl}`,a=`There was a problem requesting the following template: ${t}`,r=await this.fetchWithoutAuth(i,a);return this.templateRemapper.remapResponseId(r.data)};getLeaderboard=async(t,e,i)=>{let a=f(e)?`/leaderboard/${t}${this.apiSignInUrl}${m()}`:`/leaderboard/${t}${this.apiSignInUrl}`,r=`There was a problem fetching the leaderboard for the following template: ${t}`;i&&(a+=`${i.constructFiltersUrl()}`);let o=await this.fetchWithoutAuth(a,r),n=JSON.parse(JSON.stringify(o));return this.leaderboardRemapper.remapResponse(n)};getLeaderboardForGame=async(t,e,i)=>{let a=f(e)?`/leaderboard/games/${t}${this.apiSignInUrl}${m()}`:`/leaderboard/games/${t}${this.apiSignInUrl}`,r=`There was a problem fetching the leaderboard for the following game: ${t}`;i&&(a+=`${i.constructFiltersUrl()}`);let o=await this.fetchWithoutAuth(a,r),n=JSON.parse(JSON.stringify(o));return this.leaderboardRemapper.remapResponse(n)};getLeaderboardForLeague=async(t,e)=>{let i=`/private-league/${t}${this.apiSignInUrl}`,a=`There was a problem fetching the leaderboard for the following league: ${t}`;e&&(i+=`${e.constructFiltersUrl()}`);let r=await this.fetchWithoutAuth(i,a);return this.leaderboardRemapper.remapLeagueLeaderboardResponse(r)};getUserRankings=async(t,e,i)=>{let a=`/leaderboard/users/${t}/rankings${this.apiSignInUrl}`,r=`There was a problem fetching the rankings for the following user: ${t}`;e&&(a+=`${e.constructFiltersUrl()}`),f(i)&&(a+=`${m()}`);let o=await this.fetchWithoutAuth(a,r);return this.rankingsRemapper.remapRankings(o)};getHighestSuccessRate=async(t,e)=>{let i=`/statistics/top${this.apiSignInUrl}`,a="There was a problem fetching highest success rate";t&&(i+=`${t.constructFiltersUrl()}`),f(e)&&(i+=`${m()}`);let r=await this.fetchWithoutAuth(i,a);return this.highestSuccessRateRemapper.remapHighestSuccessRate(r.data)};getEntitiesFollows=async(t,e)=>{let i=f(e)?`/statistics/follows${this.apiSignInUrl}${m()}`:`/statistics/follows${this.apiSignInUrl}`,a="There was a problem fetching follows for entities";return t.footballCompetitions&&(i+=`&competitions=${t.footballCompetitions.join(",")}`),t.footballTeams&&(i+=`&teams=${t.footballTeams.join(",")}`),t.footballPlayers&&(i+=`&players=${t.footballPlayers.join(",")}`),(await this.fetchWithoutAuth(i,a)).data};getUserRankingsForPrivateLeagueAndChallenges=async(t,e,i)=>{let a=`/private-league/users/${t}/rankings${this.apiSignInUrl}&private_league_type=${e==="PRIVATE_LEAGUE"?"private":"one_vs_one"}`,r=`There was a problem fetching user rankings for ${e}`;i&&(a+=`${i.constructFiltersUrl()}`);let o=await this.fetchWithoutAuth(a,r);return e==="PRIVATE_LEAGUE"?this.rankingsRemapper.remapRankingsPrivateLeague(o):this.rankingsRemapper.remapRankingsChallenge(o)};getTemplateBreakdownPoints=async t=>{let e=`/leaderboard/${t}/breakdown${this.apiSignInUrl}`,i=`There was a problem fetching template breakdown points for: ${t}`,a=await this.fetchWithoutAuth(e,i);return this.leaderboardRemapper.remapTemplateBreakdown(a)}};var Ql=class{remapToPrivateLeagues=t=>(t.meta=this.remapMetaPrivateLeagues(t.meta.pagination),t.data=t.data.map(e=>this.remapToPrivateLeagueById(e)),t);remapMetaPrivateLeagues=t=>{let e=new y;return e.pagination.itemsPerPage=t.items_per_page,e.pagination.nextPageStartsAfter=t.next_page_starts_after,e};remapToPrivateLeagueById=t=>{let e=new Ys;return e.id=t.id,e.name=t.name,e.description=t.description,e.type=t.type,e.members=t.members,e.administrators=t.administrators,e.banned=t.banned,e.invites=t.invites,e.membersCount=t.members_count,e.usersCanInviteUsers=t.users_can_invite_users,e.invitationCode=t.invitation_code,e.templateId=t.template_id,e.pastTemplates=t.past_templates,e.pinnedPosts=t.pinned_posts,e.scoringStartsAt=t.scoring_starts_at,e};remapToMyPrivateLeagues=t=>{let e=new ii;return e.id=t.id,e.name=t.name,e.description=t.description,e.type=t.type,e.administrators=t.administrators,e.banned=t.banned,e.invites=t.invites,e.membersCount=t.members_count,e.usersCanInviteUsers=t.users_can_invite_users,e.invitationCode=t.invitation_code,e.templateId=t.template_id,e.pastTemplates=t.past_templates,e.pinnedPosts=t.pinned_posts,e.scoringStartsAt=t.scoring_starts_at,e};remapToAcceptPrivateLeague=t=>{let e=new js;return e.profileId=t.profile_id,e.leagueId=t.league_id,e.message=t.message,e};remapToAcceptChallenge=t=>{let e=new br;return e.profileId=t.profile_id,e.challengeId=t.league_id,e.message=t.message,e};remapPredictions=t=>(t.meta=this.remapMeta(t.meta),t.data=this.remapPredictionsData(t.data),t);remapMeta=t=>{let e=new k;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.numberOfPages=t.pagination.number_of_pages,e.pagination.totalItems=t.pagination.total_items,e};remapPredictionsData=t=>t.map(e=>{let i=new Xs;return i.predictionId=e.prediction_id,i.profileId=e.profile_id,i})};var xi=class{remapToDiscussions=t=>(t.meta=this.remapToMeta(t.meta),t.data=t.data.map(e=>this.remapToDiscussionById(e)),t);remapToDiscussionById=t=>{let e=new Tr;return e.id=t.id,e.label=t.label,e.status=t.status,e.deleted=t.deleted,e.deletedAt=t.deleted_at,e.deletedBy=t.deleted_by,e.discussionType=t.discussion_type,e.discussionUrl=t.discussion_url,e.moderationType=t.moderation_type,e.postsCount=t.posts_count,e.pinnedPosts=t.pinned_posts,e.lastPostId=t.last_post_id,e.customFields=t.custom_fields,e.context=t.context,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapToPostsForDiscussion=(t,e)=>{let i=new Sr,a=new vr;return i.meta=this.remapToPostMeta(t.meta),i.data=t.data.map(r=>this.remapToPostByIdBasic(r)),a.meta=this.remapToPostMeta(t.meta),a.data=t.data.map(r=>this.remapToPostByIdFull(r)),e==="basic"?i:a};remapToPosts=t=>{let e=new Cr;return e.meta=this.remapToMeta(t.meta),e.data=t.data.map(i=>this.remapToPostByIdBasic(i)),e};remapToPostMeta=t=>{let e=new Lt;return e.pagination.totalItems=t.pagination.total_items,e.pagination.nextPageStartsAfter=t.pagination.next_page_starts_after,e.pagination.lastCommentCreateTimestamp=t.pagination.last_comment_create_timestamp,e};remapToMeta=t=>{let e=new y;return e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.nextPageStartsAfter=t.pagination.next_page_starts_after,e};remapToPostByIdBasic=t=>{let e=new ke;return e.id=t.id,e.userId=t.user_id,e.discussionId=t.discussion_id,e.content=t.content,e.anonymousNickname=t.anonymous_nickname,e.reactionsCount=t.reactions_count,e.replyId=t.reply_id,e.reactions=t.reactions.length?t.reactions.map(i=>this.remapReactionsPost(i)):t.reactions,e.repliesCount=t.replies_count,e.reports=t.reports.length?t.reports.map(i=>this.remapReportPost(i)):t.reports,e.reportsCount=t.reports_count,e.versions=t.versions.length?t.versions.map(i=>this.remapVersionsPost(i)):t.versions,e.privatePost=t.private_post,e.deleted=t.deleted,e.deletedAt=t.deleted_at,e.deletedBy=t.deleted_by,e.moderated=t.moderated,e.moderatedAt=t.moderated_at,e.moderatedBy=t.moderated_by,e.moderatedReason=t.moderated_reason,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapToPostByIdFull=t=>{let e=new Er;return e.id=t.id,e.userId=t.user_id,e.discussionId=t.discussion_id,e.content=t.content,e.anonymousNickname=t.anonymous_nickname,e.reactionsCount=t.reactions_count,e.replyId=t.reply_id,e.reactions=t.reactions.length?t.reactions.map(i=>this.remapReactionsPost(i)):t.reactions,e.repliesCount=t.replies_count,e.reports=t.reports.length?t.reports.map(i=>this.remapReportPost(i)):t.reports,e.reportsCount=t.reports_count,e.versions=t.versions.length?t.versions.map(i=>this.remapVersionsPost(i)):t.versions,e.privatePost=t.private_post,e.deleted=t.deleted,e.deletedAt=t.deleted_at,e.deletedBy=t.deleted_by,e.moderated=t.moderated,e.moderatedAt=t.moderated_at,e.moderatedBy=t.moderated_by,e.moderatedReason=t.moderated_reason,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapToPostCount=t=>t.map(e=>{let i=new Fr;return i.id=e.id,i.postsCount=e.posts_count,i});remapReactionsPost=t=>{let e=new Ar;return e.type=t.type,e.userIds=t.user_ids,e.reactionCount=t.reaction_count,e};remapVersionsPost=t=>{let e=new xr;return e.content=t.content,e.updatedAt=t.updated_at,e};remapReportPost=t=>{let e=new Or;return e.userId=t.user_id,e.reason=t.reason,e.reasonDetails=t.reason_details,e}};var Li=class extends v{remapper=null;discussionsRemapper=null;discussionsBaseURL=null;constructor(t){super(t,O(t.environment,"privateLeagues")),this.discussionsBaseURL=O(t.environment,"discussions"),this.remapper=new Ql,this.discussionsRemapper=new xi}create=async(t,e)=>{let i="/leagues"+this.apiSignInUrl,r=`There was a problem ${e==="PRIVATE_LEAGUE"?"creating private league":"issuing challenge"}`,o="POST",n=await this.fetchWithAuth(i,r,o,t);return this.remapper.remapToPrivateLeagueById(n.data)};update=async(t,e,i)=>{let a=`/leagues/${t}`+this.apiSignInUrl,o=`There was a problem updating ${i==="PRIVATE_LEAGUE"?"private league":"challenge"}`,n="PUT",l=await this.fetchWithAuth(a,o,n,e);return this.remapper.remapToPrivateLeagueById(l.data)};updateLeagueTemplate=async(t,e,i,a)=>{let r=`/leagues/${t}/template`+this.apiSignInUrl,n=`There was a problem updating template for the ${a==="PRIVATE_LEAGUE"?"private league":"challenge"}`,l="POST",p={new_template_id:e,past_template_name:i},c=await this.fetchWithAuth(r,n,l,p);return this.remapper.remapToPrivateLeagueById(c.data)};getById=async(t,e,i)=>{let a=`/leagues/${t}`+this.apiSignInUrl;f(i)&&(a+=m());let o=`There was a problem getting ${e==="PRIVATE_LEAGUE"?"private league":"challenge"}`,n=await this.fetchWithAuth(a,o);return this.remapper.remapToPrivateLeagueById(n.data)};getMyLeagues=async(t,e)=>{let i="/leagues"+this.apiSignInUrl+t.constructFiltersUrl(),r=`There was a problem getting user's ${e==="PRIVATE_LEAGUE"?"private leagues":"challenges"}`;return(await this.fetchWithAuth(i,r)).data.map(n=>this.remapper.remapToMyPrivateLeagues(n))};delete=async(t,e)=>{let i=`/leagues/${t}`+this.apiSignInUrl,r=`There was a problem deleting ${e==="PRIVATE_LEAGUE"?"private league":"challenge"}`,o="DELETE";return await this.fetchWithAuth(i,r,o),!0};invite=async(t,e)=>{let i=`/membership/invite/${t}`+this.apiSignInUrl,a=`There was a problem inviting the following users: ${e.join(",")}`,r="POST",o={profiles:e};return(await this.fetchWithAuth(i,a,r,o)).data};deleteInvitation=async(t,e)=>{let i=`/membership/invite/${t}`+this.apiSignInUrl,a=`There was a problem deleting invitation for the following users: ${e.join(",")}`,r="DELETE",o={profiles:e};return await this.fetchWithAuth(i,a,r,o),!0};accept=async(t,e,i)=>{let a=`/membership/accept/${t}`+this.apiSignInUrl+`&accept=${e?"ACCEPT":"REJECT"}`,o=`There was a problem ${e?"accepting":"rejecting"} invitation for ${i==="PRIVATE_LEAGUE"?"private league":"challenge"}: ${t}`,n="POST",l=await this.fetchWithAuth(a,o,n);return i==="PRIVATE_LEAGUE"?this.remapper.remapToAcceptPrivateLeague(l.data):this.remapper.remapToAcceptChallenge(l.data)};ban=async(t,e)=>{let i=`/membership/ban/${t}`+this.apiSignInUrl,a=`There was a problem banning the following users: ${e.join(",")}`,r="POST",o={profiles:e};return(await this.fetchWithAuth(i,a,r,o)).data};unban=async(t,e)=>{let i=`/membership/unban/${t}`+this.apiSignInUrl,a=`There was a problem unbanning the following users: ${e.join(",")}`,r="POST",o={profiles:e};return(await this.fetchWithAuth(i,a,r,o)).data};join=async t=>{let e="/membership/join"+this.apiSignInUrl+`&invitation_code=${t}`,i="There was a problem joining league",a="POST",r=await this.fetchWithAuth(e,i,a);return this.remapper.remapToAcceptPrivateLeague(r.data)};leave=async(t,e)=>{let i=`/membership/leave/${t}`+this.apiSignInUrl,r=`There was a problem leaving the following ${e==="PRIVATE_LEAGUE"?"league":"challenge"}: ${t}`,o="POST";return(await this.fetchWithAuth(i,r,o)).data};getInvitations=async(t,e)=>{let i="/membership/invitations"+this.apiSignInUrl+e.constructMainFiltersUrl(),r=`There was a problem getting invitations for ${t==="PRIVATE_LEAGUE"?"leagues":"challenges"}`,o=await this.fetchWithAuth(i,r);return this.remapper.remapToPrivateLeagues(o)};getReportedPosts=async(t,e)=>{let i=`/discussions/${t}/posts/reported${this.apiSignInUrl}`,a=`There was a problem fetching posts for the following: ${t}`;e&&(i+=e.constructMainFiltersUrl());let r=await this.fetchWithAuthNewBaseURL(this.discussionsBaseURL,i,a);return this.discussionsRemapper.remapToPostsForDiscussion(r,"full")};getPredictions=async(t,e)=>{let i=`/leagues/${t}/predictions`+this.apiSignInUrl,a=`There was a problem getting predictions for private league: ${t}`;e&&(i+=e.constructFiltersUrl());let r=await this.fetchWithAuth(i,a);return this.remapper.remapPredictions(r)};moderatePost=async(t,e)=>{let i=`/posts/${t}/admin/moderate${this.apiSignInUrl}`,a=`There was a problem moderating the following post: ${t}`,r="POST",o={moderation_reason:e},n=await this.fetchWithAuthNewBaseURL(this.discussionsBaseURL,i,a,r,o);return this.discussionsRemapper.remapToPostByIdBasic(n.data)}};var Di=class{createRequestBodyFromParam=(t,e)=>{let i=e==="PRIVATE"?new en:new Mr;return i.name=t.name,i.description=t.description,i.invitation_code=t.invitationCode,i.template_id=t.templateId,i.users_can_invite_users=t.usersCanInviteUsers,t.administrators?i.administrators=t.administrators:delete i.administrators,t.scoringStartsAt?i.scoring_starts_at=t.scoringStartsAt:delete i.scoring_starts_at,i};createUpdateRequestBodyFromParam=(t,e)=>{let i=e==="PRIVATE"?new an:new Ir;return i.name=t.name,i.description=t.description,i.invitation_code=t.invitationCode,i.template_id=t.templateId,i.users_can_invite_users=t.usersCanInviteUsers,i.administrators=t.administrators,i.pinned_posts=t.pinnedPosts,i.scoring_starts_at=t.scoringStartsAt,i}};var ql=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(t){if(!t||!t.type||!t.subType)return"no_info_yet";let e=t.type.toLowerCase(),i=t.subType.toLowerCase();return e==="finished"?i==="awarded_win"?"finished_after_awarded_win":i==="aet"?"finished_aet":i==="ap"?"finished_ap":i==="asg"?"finished_asg":"finished":e==="notstarted"?i==="postponed"?"postponed":i==="delayed"?"kick_off_delayed":"not_started":e==="inprogress"?i==="1st_half"?"1st_half":i==="2nd_half"?"2nd_half":i==="halftime"?"halftime":i==="penalty"?"penalty":i==="waiting_penalty"?"waiting_for_penalty":i==="pause"?"pause":i==="extra_time_1st_half"?"extra_time_1st_half":i==="extra_time_2nd_half"?"extra_time_2nd_half":i==="extra_time_halftime"?"extra_time_end_of_1st_half":i==="waiting_extra_time"?"waiting_for_extra_time":"awaiting_info":e==="interrupted"?i==="abandoned"?"abandoned":i==="to_finish"?"to_finish":"interrupted":e==="cancelled"?"cancelled":"no_info_yet"}isUpcoming(t){if(!t)return!1;let e=this.getMatchEventStatus(t);return this.ALL_UPCOMING_STATUSES.includes(e)}isLive(t){if(!t)return!1;let e=this.getMatchEventStatus(t);return this.ALL_LIVE_STATUSES.includes(e)}isFinished(t){if(!t)return!1;let e=this.getMatchEventStatus(t);return this.ALL_FINISHED_STATUSES.includes(e)}};var Wl=class{matchStatusHelper;constructor(){this.matchStatusHelper=new ql}getMatchStatusEnum(t){return this.matchStatusHelper.getMatchEventStatus(t)}isMatchUpcoming(t){return this.matchStatusHelper.isUpcoming(t)}isMatchLive(t){return this.matchStatusHelper.isLive(t)}isMatchFinished(t){return this.matchStatusHelper.isFinished(t)}};var it=class{https=null;idMapping=null;localCache=null;footballFacade=null;footballHelpers;constructor(t){this.https=new dt(t),this.idMapping=new R(t),this.localCache=new ct().createLocalCacheInstance(t.idSchema),this.footballFacade=new vi(t,this.localCache,this.https,this.idMapping),this.footballHelpers=new Wl}getCountries=async t=>await this.footballFacade.getCountries(t);getCompetitions=async(t,e)=>await this.footballFacade.getCompetitions(t,e);getCompetitionById=async(t,e)=>await this.footballFacade.getCompetitionById(t,e);getTopCompetitions=async t=>await this.footballFacade.getTopCompetitions(t);getTeams=async(t,e)=>await this.footballFacade.getTeams(t,e);getTeamById=async(t,e)=>await this.footballFacade.getTeamById(t,e);getTopTeams=async t=>await this.footballFacade.getTopTeams(t);getNextMatchForTeam=async(t,e)=>await this.footballFacade.getNextMatchForTeam(t,e);getPrevMatchForTeam=async(t,e)=>await this.footballFacade.getPrevMatchForTeam(t,e);getPlayers=async(t,e)=>await this.footballFacade.getPlayers(t,e);getPlayerById=async(t,e)=>await this.footballFacade.getPlayerById(t,e);getTopPlayers=async t=>await this.footballFacade.getTopPlayers(t);getNextMatchForPlayer=async(t,e)=>await this.footballFacade.getNextMatchForPlayer(t,e);getPrevMatchForPlayer=async(t,e)=>await this.footballFacade.getPrevMatchForPlayer(t,e);getMatches=async(t,e)=>await this.footballFacade.getMatches(t,e);getMatchById=async(t,e)=>await this.footballFacade.getMatchById(t,e);search=async(t,e)=>await this.footballFacade.search(t,e);getTeamForm=async(t,e,i)=>await this.footballFacade.getTeamForm(t,e,i);get helpers(){return this.footballHelpers}};var Kl=class{matchFacade=null;playerFacade=null;predictorService=null;constructor(t,e,i){this.matchFacade=t,this.playerFacade=e,this.predictorService=i}remapFixturesRequest=t=>{let e={};if(e.match_id=t.matchId,e.match_type="FOOTBALL",t instanceof st)e.market=t.market,e.prediction=t.prediction.value,e.player_id=t.prediction.playerId;else if(t instanceof Je||t instanceof Ze)e.market=t.market,e.prediction=t.prediction.value;else if(t instanceof Vt){e.market=t.market;let i=t.prediction.value.split(":");e.goals_home=Number(i[0]),e.goals_away=Number(i[1])}else e.market=t.market,e.prediction=t.prediction.value;return e};remapFixturesResponse=async t=>{let e="OWN_GOAL",i=[],a=[],r=null,o=[];t.length>1&&t.sort((l,p)=>l.match_id.localeCompare(p.match_id));for(let l of t)i.push(l.match_id),l.player_id&&!a.includes(l.player_id)&&a.push(l.player_id);let n=await this.matchFacade.getMatchesMapWithNativeIds(i);a.sort((l,p)=>l.localeCompare(p)),a&&a.length>0&&!a.includes(e)&&(r=await this.playerFacade.getPlayersMapWithNativeIds(a));for(let l of t){let p=new Ye;l.target?p.market=this.predictorService.convertMarketForResponseModel(l.market,l.target):p.market=l.market,p.matchId=n[l.match_id].id,p.matchType=l.match_type,p.matchModel=n?n[l.match_id]:null,delete p.matchModel.availableMarkets,l.prediction!==void 0?p.prediction.value=l.prediction:l.goals_home!==void 0&&l.goals_away!==void 0&&(p.prediction.value=l.goals_home.toString()+":"+l.goals_away.toString()),p.prediction.playerId=l.player_id?l.player_id:null,l.market==="PLAYER_PERFORMANCE"&&(p.prediction.playerRole=l.role),p.prediction.playerId&&p.prediction.playerId!==e&&(p.prediction.playerModel=r[l.player_id],p.prediction.playerId=r[l.player_id].id),p.result=this.remapResult(l.result),o.push(p)}return o};remapResult=t=>{let e=new Xe;return e.settledAt=t.settled_at,e.resettledAt=t.resettled_at,e.status=t.status,e.outcome=t.outcome,e.points=t.points,e}};var jc=class{constructor(){}static createMatchMarketsResultsModel(t,e){return{FT_1X2:this.createOneXTwoResult(t.scores,"full_time"),HT_1X2:this.createOneXTwoResult(t.scores,"half_time"),BOTH_TEAMS_SCORE:t.scores.ftScore.homeGoals>0&&t.scores.ftScore.awayGoals>0,DOUBLE_CHANCE:this.createDoubleChanceResult(t.scores),HT_FT:this.createHalfTimeFullTimeResult(t.scores),RED_CARD_MATCH:this.createMarketResultByCriteria(t,"red_card"),PENALTY_MATCH:this.createMarketResultByCriteria(t,"penalty"),CORNERS_MATCH:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam,PLAYER_YELLOW_CARD:this.createPlayersMarketsResults(t,e,"yellow_card"),PLAYER_RED_CARD:this.createPlayersMarketsResults(t,e,"red_card"),PLAYER_SCORE_FIRST_GOAL:this.createPlayersMarketsResults(t,e,"first_goal"),PLAYER_SCORE:this.createPlayersMarketsResults(t,e,"one_goal"),PLAYER_SCORE_TWICE:this.createPlayersMarketsResults(t,e,"two_goals"),PLAYER_SCORE_HATTRICK:this.createPlayersMarketsResults(t,e,"hattrick"),CORRECT_SCORE:{homeGoals:t.scores.ftScore.homeGoals,awayGoals:t.scores.ftScore.awayGoals},CORRECT_SCORE_ADVANCED:{homeGoals:t.scores.ftScore.homeGoals,awayGoals:t.scores.ftScore.awayGoals},CORRECT_SCORE_HT:{homeGoals:t.scores.htScore.homeGoals,awayGoals:t.scores.htScore.awayGoals},OVER_GOALS_0_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>0,OVER_GOALS_1_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>1,OVER_GOALS_2_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>2,OVER_GOALS_3_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>3,OVER_GOALS_4_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>4,OVER_GOALS_5_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>5,OVER_GOALS_6_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>6,OVER_CORNERS_6_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>6,OVER_CORNERS_7_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>7,OVER_CORNERS_8_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>8,OVER_CORNERS_9_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>9,OVER_CORNERS_10_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>10,OVER_CORNERS_11_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>11,OVER_CORNERS_12_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>12,OVER_CORNERS_13_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>13}}},Ft=jc;at(Ft,"createOneXTwoResult",(t,e)=>e==="full_time"?t.ftScore.homeGoals>t.ftScore.awayGoals?"1":t.ftScore.homeGoals===t.ftScore.awayGoals?"x":"2":t?.htScore?.homeGoals>t?.htScore?.awayGoals?"1":t?.htScore?.homeGoals===t?.htScore?.awayGoals?"x":"2"),at(Ft,"createDoubleChanceResult",t=>t?.ftScore?.homeGoals>t?.ftScore?.awayGoals?["1x","12"]:t?.ftScore?.homeGoals===t?.ftScore?.awayGoals?["1x","x2"]:["x2","12"]),at(Ft,"createHalfTimeFullTimeResult",t=>{if(t?.htScore?.homeGoals>t?.htScore?.awayGoals){if(t?.ftScore?.homeGoals>t?.ftScore?.awayGoals)return"1/1";if(t?.ftScore?.homeGoals===t?.ftScore?.awayGoals)return"1/x";if(t?.ftScore?.homeGoals<t?.ftScore?.awayGoals)return"1/2"}if(t?.htScore?.homeGoals===t?.htScore?.awayGoals){if(t?.ftScore?.homeGoals>t?.ftScore?.awayGoals)return"x/1";if(t?.ftScore?.homeGoals===t?.ftScore?.awayGoals)return"x/x";if(t?.ftScore?.homeGoals<t?.ftScore?.awayGoals)return"x/2"}if(t?.htScore?.homeGoals<t?.htScore?.awayGoals){if(t?.ftScore?.homeGoals>t?.ftScore?.awayGoals)return"2/1";if(t?.ftScore?.homeGoals===t?.ftScore?.awayGoals)return"2/x";if(t?.ftScore?.homeGoals<t?.ftScore?.awayGoals)return"2/2"}}),at(Ft,"createMarketResultByCriteria",(t,e)=>!t.timeline||!t.timeline.length?null:e==="red_card"?t.timeline.filter(i=>Number(i.minute)<=90).some(i=>i.type==="red_card"):t.timeline.filter(i=>Number(i.minute)<=90).some(i=>i.type.startsWith(e))),at(Ft,"createPlayersMarketsResults",(t,e,i)=>{if(!t.timeline||!t.timeline.length)return i==="first_goal"?null:[];if(i==="first_goal"){let n=t.timeline.find(l=>l.type==="goal"||l.type==="penalty_goal"||l.type==="own_goal")||null;if(n){let l=e[n.player.id];return{playerId:n.type==="goal"||n.type==="penalty_goal"?n.player.id:"OWN_GOAL",playerModel:l}}return null}if(i==="yellow_card"||i==="red_card")return jc.transformPlayerMarketResult(t.timeline.filter(n=>Number(n.minute)<=90).filter(n=>n.type===i).map(n=>e[n.player.id]));let a=new Map,r=i==="one_goal"?1:i==="two_goals"?2:3,o=[];return t.timeline.filter(n=>Number(n.minute)<=90).filter(n=>n.type==="goal"||n.type==="penalty_goal").forEach(n=>{let l=e[n.player.id];if(a.has(n.player.id)){let p=a.get(n.player.id);p.push(l),a.set(n.player.id,p)}else a.set(n.player.id,[l])}),a.forEach(n=>{n.length>=r&&o.push(n[0])}),jc.transformPlayerMarketResult(o)}),at(Ft,"transformPlayerMarketResult",t=>t.map(e=>({playerId:e.id,playerModel:e})));var St=class{footballHttps=null;idMapping=null;matchFacade=null;playerFacade=null;profileNamespace=null;constructor(t,e){this.footballHttps=new dt(t),this.idMapping=e,this.matchFacade=new te(t,this.footballHttps,e),this.playerFacade=new Zt(t,this.footballHttps,e),this.profileNamespace=new D(t)}remapMatchIdToNative=async t=>(await this.idMapping.getEntityIdsBySchemaId(t,"match","native")).match;remapPlayerIdToNative=async t=>(await this.idMapping.getEntityIdsBySchemaId(t,"player","native")).player[0];remapPlayerIdMapToNative=async t=>{let e={},i=ce(t),r=(await this.idMapping.getEntityIdsBySchemaId(i,"player","native")).player;return i.forEach((o,n)=>e[o]=r[n]),e};remapPlayerIdToIdSchema=async t=>{let e=["playerScore","playerYellowCard","playerRedCard","playerScoreFirstGoal","playerScoreHattrick","playerScoreTwice"],i=[];for(let[r,o]of Object.entries(t))if(e.includes(r))for(let n of Object.keys(o))n!=="NOBODY"&&n!=="OWN_GOAL"&&i.push(n);if(!i.length)return t;let a=await this.playerFacade.getPlayersMapWithNativeIds(i);for(let[r,o]of Object.entries(t))if(e.includes(r))for(let n of Object.keys(o))n!=="NOBODY"&&n!=="OWN_GOAL"&&(o[a[n].id]=o[n],o[a[n].id].model=a[n],this.idMapping.idSchema!=="native"&&delete o[n]);return t};convertMarketForResponseModel=(t,e)=>{let i=e.toString();return t+"_"+i};getMarketSummary=async(t,e,i)=>{let a=_u.get(e),r={};if(r.matchId=t.matchId,r.matchType=t.matchType,Object.keys(t.predictions).includes(a))r[a]=t.predictions[a];else throw new Error("You have passed invalid market");if(It.includes(e)&&i){let n="";if(i!=="OWN_GOAL"&&i!=="NOBODY"&&(n=(await this.idMapping.idMappingFacade.getEntitiesByIds({player:[i]},this.idMapping.idSchema,"native")).player[0]),n&&r[a][n]){let l=await this.playerFacade.getPlayersMapWithNativeIds([n]);return r[a][n].model=l[n],r[a][n]}else return n?(r[a][n]=new L,r[a][n]):r[a][i]}else if(It.includes(e)&&!i){let n=Object.keys(r[a]).filter(p=>p!=="NOBODY"&&p!=="OWN_GOAL"),l=n.length?await this.playerFacade.getPlayersMapWithNativeIds(n):{};Object.keys(l).length&&Object.keys(r[a]).forEach(p=>{p!=="NOBODY"&&p!=="OWN_GOAL"&&(r[a][l[p].id]=r[a][p],r[a][l[p].id].model=l[p],this.idMapping.idSchema!=="native"&&delete r[a][p])})}return r};remapCompetitionsFromConfig=async t=>{if(t instanceof Ce){let e={competition:t.fullCoverageCompetitions},i={competition:t.successRateScopes.competitions},a={team:t.successRateScopes.teams},r=await this.idMapping.idMappingFacade.getEntitiesByIds(e,"native",this.idMapping.idSchema),o=await this.idMapping.idMappingFacade.getEntitiesByIds(i,"native",this.idMapping.idSchema),n=await this.idMapping.idMappingFacade.getEntitiesByIds(a,"native",this.idMapping.idSchema);return t.fullCoverageCompetitions=r.competition,t.successRateScopes.competitions=o.competition,t.successRateScopes.teams=n.team,t}if(t instanceof ve||t instanceof Se){let e={competition:t.competitionsWhitelist},i=await this.idMapping.idMappingFacade.getEntitiesByIds(e,"native",this.idMapping.idSchema);return t.competitionsWhitelist=i.competition,t}};remapMatchIdsFixtures=async t=>{if(Array.isArray(t.data))if(t.data.length>0){let e=[],i=[];return t.data.forEach(a=>{a instanceof Tt||a instanceof Ht||a instanceof Pt||a instanceof si?(a.fixtures.forEach(r=>e.push(r.matchId)),a instanceof Pt&&a.fixtures.forEach(r=>{r.prediction.playerId&&r.prediction.playerId!=="OWN_GOAL"&&i.push(r.prediction.playerId)})):a instanceof Jt&&a.results.forEach(r=>e.push(r.matchId))}),await this.refactorResponseArrModel(t,e,i)}else return t;else return await this.refactorResponseObjModel(t)};refactorResponseArrModel=async(t,e,i)=>{let a=[],r=await this.matchFacade.getMatchesMapWithNativeIds(e),o={};return i.length>0&&(o=await this.playerFacade.getPlayersMapWithNativeIds(i)),t.data.forEach(n=>{n instanceof Tt||n instanceof Ht||n instanceof Pt?(n.fixtures.forEach(l=>{this.handleMatchModel(r,l),n instanceof Pt&&l.prediction.playerId&&l.prediction.playerId!=="OWN_GOAL"&&(l.prediction.playerModel=o[l.prediction.playerId],l.prediction.playerId=o[l.prediction.playerId].id)}),a.push(n)):n instanceof Jt&&(n.results.forEach(l=>{l.matchModel=r[l.matchId],delete l.matchModel.availableMarkets,l.matchId=l.matchModel.id}),a.push(n))}),t.data=a,t};refactorResponseObjModel=async t=>{let e=[];t.fixtures.forEach(a=>e.push(a.matchId));let i=await this.matchFacade.getMatchesMapWithNativeIds(e);return t.fixtures.forEach(a=>this.handleMatchModel(i,a)),t};getCurrentGameId=t=>{let e=new Date;if(t.data.length>1){let i=[];return t.data.forEach(r=>i.push(r.predictionsCutoff)),t.data.sort((r,o)=>{let[n,l]=[r.predictionsCutoff,o.predictionsCutoff].map(p=>Math.abs(new Date(p)-e));return n-l})[0].id}else return t.data[0].id};initGameTypePredictions=(t,e)=>{let i={type:t,limit:null,startAfter:null};return e&&(i={...i,limit:e.limit,startAfter:e.startAfter}),i=new V(i),i};initGameFilters=(t,e,i)=>{if(e&&i)return e.type=t,e.gameIds=i,e=new nt(e),e;if(e&&!i)return e.type=t,e=new nt(e),e;if(!e&&i){let a={type:t,gameIds:i};return a=new nt(a),a}else{let a={type:t};return a=new nt(a),a}};addPredictionProp=async(t,e)=>(e.data.forEach(i=>{let a=i.fixtures.map(r=>r.matchId);t.data.forEach(r=>{i.id===r.game_instance_id&&(i.fixtures.sort((o,n)=>o.matchId.localeCompare(n.matchId)),r.fixtures.sort((o,n)=>o.match_id.localeCompare(n.match_id)),i.predictionId=r.id,i.outcome=r.status,i.fixtures.forEach((o,n)=>{r.fixtures[n].goals_home!==void 0&&r.fixtures[n].goals_away!==void 0?o.prediction.value=r.fixtures[n].goals_home+":"+r.fixtures[n].goals_away:o.prediction.value=r.fixtures[n].prediction,r.fixtures[n].player_id?o.prediction.playerId=r.fixtures[n].player_id:r.fixtures[n].target&&(o.prediction.target=r.fixtures[n].target),o.prediction.result=this.remapResult(r.fixtures[n].result)}),i.predictionsMadeAt=r.created_at,i.predictionsUpdatedAt=r.profile_last_updated_at,i.points=r.points,i instanceof Ht&&(r.tiebreaker?i.predictionTiebreaker.goldenGoal=r.tiebreaker.golden_goal:i.predictionTiebreaker=r.tiebreaker))}),i.fixtures.sort((r,o)=>a.indexOf(r.matchId)-a.indexOf(o.matchId))}),e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,await this.remapMatchIdsFixtures(e));remapResult=t=>{let e=new Xe;return e.settledAt=t.settled_at,e.resettledAt=t.resettled_at,e.status=t.status,e.outcome=t.outcome,e.points=t.points,e};areIdsExceeded=t=>t.length>10;initPredictionsFilters=(t,e,i)=>{switch(e){case"user":t&&(t=new V(t));break;case"current":if(t)this.deleteUnexpectedProperties(t),t.status=["ACTIVE"],t=new V(t);else{let a={status:["ACTIVE"]};t=new V(a)}break;case"past":if(t)this.deleteUnexpectedProperties(t),t.status=mu,t=new V(t);else{let a={status:mu};t=new V(a)}break;case"matches":if(t)this.deleteUnexpectedProperties(t),t.matchIds=i,t=new V(t);else{let a={matchIds:i};t=new V(a)}break}return t};completeGameMarketResults=async(t,e)=>{switch(e){case"MATCH_QUIZ":let i={},a=t.results[0].matchId,r=t.results.map(p=>It.includes(p.market)&&!p.result.includes("OWN_GOAL")?[...p.result]:[]).flat(),o=await this.matchFacade.getMatchesMapWithNativeIds([a]);return r.length&&(i=await this.playerFacade.getPlayersMapWithNativeIds(r)),t.results=t.results.map(p=>{if(p.matchModel=o[p.matchId]?o[p.matchId]:null,p.playerModels&&Object.keys(i).length&&p.result.forEach(u=>{let d=i[u];p.playerModels.push(d)}),this.idMapping.idSchema!=="native"&&(this.remapMatchIdForResultsMarkets(o,p),p.playerModels&&Object.keys(i).length)){let c=p.result;p.result=c.map(u=>i[u].id)}return p}),t;case"TOP_X":let n=t.results.map(p=>p.matchId),l=await this.matchFacade.getMatchesMapWithNativeIds(n);if(t.results=t.results.map(p=>(p.matchModel=l[p.matchId]?l[p.matchId]:null,this.idMapping.idSchema!=="native"&&this.remapMatchIdForResultsMarkets(l,p),p)),t.tieBreakers.goldenGoals.length){let p=t.tieBreakers.goldenGoals.map(u=>u.playerId),c=await this.playerFacade.getPlayersMapWithNativeIds(p);t.tieBreakers.goldenGoals=t.tieBreakers.goldenGoals.map(u=>(u.matchModel=l[u.matchId],u.playerModel=c[u.playerId],this.idMapping.idSchema!=="native"&&(u.matchId=l[u.matchId].id,u.playerId=c[u.playerId].id),u))}return t}};completeContestWinners=async t=>{if(t.userList&&t.userList.length){let e=t.userList.map(a=>a.profileId),i=await this.profileNamespace.getByIds(e);t.userList.forEach(a=>{let r=i.filter(o=>o.id===a.profileId)[0];delete r.interests,a.profileModel=r})}return t};handleMatchModel=(t,e)=>{t[e.matchId]?(e.matchModel=t[e.matchId],delete e.matchModel.availableMarkets,e.matchId=e.matchModel.id):(e.matchModel=null,this.idMapping.idSchema!=="native"&&this.idMapping.idMappingFacade.getEntityById(e.matchId,"match","native").then(i=>{e.matchId=i[G[this.idMapping.idSchema]]}))};remapMatchIdForResultsMarkets=(t,e)=>{t[e.matchId]?e.matchId=t[e.matchId].id:this.idMapping.idMappingFacade.getEntityById(e.matchId,"match","native").then(i=>{e.matchId=i[G[this.idMapping.idSchema]]})};deleteUnexpectedProperties=t=>(t.status&&(console.warn(iu.UNEXPECTED_STATUS_PROP),delete t.status),t.type&&(console.warn(iu.UNEXPECTED_TYPE_PROP),delete t.type),t);getMatchMarketsResults=async t=>{let e=await this.footballHttps.getMatchById(t,!0);if(e.status.type!=="finished"||!e.finishedAt)return new qs;let i=[];e.timeline.filter(r=>Number(r.minute)<=90).filter(r=>r.type==="goal"||r.type==="penalty_goal"||r.type==="yellow_card"||r.type==="red_card").forEach(r=>{i.push(r.player.id)});let a={};return i.length&&(a=await this.playerFacade.getPlayersMapWithNativeIds(i)),Ft.createMatchMarketsResultsModel(e,a)}};var Bi=class{fixturesRemapper=null;footballHttps=null;matchFacade=null;playerFacade=null;predictorService=null;constructor(t,e){this.footballHttps=new dt(t),this.matchFacade=new te(t,this.footballHttps,e),this.playerFacade=new Zt(t,this.footballHttps,e),this.predictorService=new St(t,e),this.fixturesRemapper=new Kl(this.matchFacade,this.playerFacade,this.predictorService)}remapRequestBody=t=>{if(t instanceof Ge)return t;let e={};return e.game_instance_id=t.gameInstanceId,e.fixtures=t.fixtures.map(i=>this.fixturesRemapper.remapFixturesRequest(i)),t instanceof ni&&t.tiebreaker&&(e.tiebreaker={},e.tiebreaker.golden_goal=t.tiebreaker.goldenGoal?t.tiebreaker.goldenGoal:null),e};remapResponseArrayBody=async t=>{if(t.length){let e="OWN_GOAL",i=[],a=[],r={},o=[];t.forEach(l=>{l.fixtures.forEach(p=>{i.push(p.match_id),p.player_id&&p.player_id!==e&&a.push(p.player_id)})});let n=await this.matchFacade.getMatchesMapWithNativeIds(i);return a.length>0&&(r=await this.playerFacade.getPlayersMapWithNativeIds(a)),t.forEach(l=>{let p=new Si,c=[];p.id=l.id,p.gameInstanceId=l.game_instance_id,p.gameType=l.game_type,p.wager=l.wager,p.totalFixtures=l.total_fixtures,p.settledFixtures=l.settled_fixtures,p.userId=l.user_id,p.templateId=l.template_id,p.groupId=l.group_id,p.profileLastUpdatedAt=l.profile_last_updated_at,l.fixtures.forEach(u=>{let d=new Ye;u.target?d.market=this.predictorService.convertMarketForResponseModel(u.market,u.target):d.market=u.market,d.matchId=n[u.match_id].id,d.matchType=u.match_type,d.matchModel=n[u.match_id],delete d.matchModel.availableMarkets,u.prediction!==void 0?d.prediction.value=u.prediction:u.goals_home!==void 0&&u.goals_away!==void 0&&(d.prediction.value=u.goals_home.toString()+":"+u.goals_away.toString()),d.prediction.playerId=u.player_id?u.player_id:null,d.prediction.playerId&&d.prediction.playerId!==e&&(d.prediction.playerModel=r[d.prediction.playerId],d.prediction.playerId=r[d.prediction.playerId].id),u.market==="PLAYER_PERFORMANCE"&&(d.prediction.playerRole=u.role),d.result=this.fixturesRemapper.remapResult(u.result),c.push(d)}),p.fixtures=c,p.status=l.status,l.tiebreaker?p.tiebreaker.goldenGoal=l.tiebreaker.golden_goal:p.tiebreaker=null,p.points=l.points,p.createdAt=l.created_at,p.updatedAt=l.updated_at,o.push(p)}),o}return t};remapResponseObjBody=async t=>{let e=new Si;return e.id=t.id,e.gameInstanceId=t.game_instance_id,e.gameType=t.game_type,e.wager=t.wager,e.totalFixtures=t.total_fixtures,e.settledFixtures=t.settled_fixtures,e.userId=t.user_id,e.templateId=t.template_id,e.groupId=t.group_id,e.profileLastUpdatedAt=t.profile_last_updated_at,e.fixtures=await this.fixturesRemapper.remapFixturesResponse(t.fixtures),e.status=t.status,t.tiebreaker?e.tiebreaker.goldenGoal=t.tiebreaker.golden_goal:e.tiebreaker=null,e.points=t.points,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPredictionModel=t=>{let e=new Ws;return e.fullTimeOneXTwo=t.FT_1X2,e.halfTimeOneXTwo=t.HT_1X2,e.bothTeamsScore=t.BOTH_TEAMS_SCORE,e.overZeroPointFiveGoals=t.OVER_GOALS_0_5,e.overOnePointFiveGoals=t.OVER_GOALS_1_5,e.overTwoPointFiveGoals=t.OVER_GOALS_2_5,e.overThreePointFiveGoals=t.OVER_GOALS_3_5,e.overFourPointFiveGoals=t.OVER_GOALS_4_5,e.overFivePointFiveGoals=t.OVER_GOALS_5_5,e.overSixPointFiveGoals=t.OVER_GOALS_6_5,e.overSixPointFiveCorners=t.OVER_CORNERS_6_5,e.overSevenPointFiveCorners=t.OVER_CORNERS_7_5,e.overEightPointFiveCorners=t.OVER_CORNERS_8_5,e.overNinePointFiveCorners=t.OVER_CORNERS_9_5,e.overTenPointFiveCorners=t.OVER_CORNERS_10_5,e.overElevenPointFiveCorners=t.OVER_CORNERS_11_5,e.overTwelvePointFiveCorners=t.OVER_CORNERS_12_5,e.overThirteenPointFiveCorners=t.OVER_CORNERS_13_5,e.doubleChance=t.DOUBLE_CHANCE,e.halfTimeFullTime=t.HT_FT,e.playerScore=t.PLAYER_SCORE,e.playerYellowCard=t.PLAYER_YELLOW_CARD,e.playerRedCard=t.PLAYER_RED_CARD,e.redCardMatch=t.RED_CARD_MATCH,e.penaltyMatch=t.PENALTY_MATCH,e.playerScoreFirstGoal=t.PLAYER_SCORE_FIRST_GOAL,e.cornersMatch=t.CORNERS_MATCH,e.correctScore=t.CORRECT_SCORE,e.correctScoreHalfTime=t.CORRECT_SCORE_HT,e.correctScoreAdvanced=t.CORRECT_SCORE_ADVANCED,e.playerScoreHattrick=t.PLAYER_SCORE_HATTRICK,e.playerScoreTwice=t.PLAYER_SCORE_TWICE,e}};var jl=class{remapPredictions=null;constructor(t,e){this.remapPredictions=new Bi(t,e)}remapResponse=t=>{let e=new Ks;return e.matchId=t.match_id,e.matchType=t.match_type,e.predictions=this.remapPredictions.remapPredictionModel(t.predictions),e}};var Yl=class extends et{remapPaginatedGames=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapGamesListResponse(i)),e};remapGamesListResponse=t=>{let e=new Tt;return e.id=t.id,e.title=t.title,e.description=t.description,e.type=t.type,e.status=t.status,e.authRequirement=t.auth_requirement||null,e.scheduleOpenAt=t.schedule_open_at,e.predictionsCutoff=t.predictions_cutoff,e.fixtures=t.fixtures.map(i=>this.remapFixturesResponse(i)),e.tiebreaker=t.tiebreaker?this.remapTimeTiebreaker(t.tiebreaker.time_tiebreaker):null,e.participantsCount=t.participants_count,e.related=t.related?this.remapRelated(t.related):[],e.excludedProfileIds=t.excluded_profile_ids,e.rules=t.rules,e.labels=t.labels,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.flags=t.flags,e.images=t.images,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapGameByIdResponse=t=>{let e=new si;return e.id=t.id,e.title=t.title,e.description=t.description,e.type=t.type,e.status=t.status,e.authRequirement=t.auth_requirement||null,e.scheduleOpenAt=t.schedule_open_at,e.predictionsCutoff=t.predictions_cutoff,e.fixtures=t.fixtures.map(i=>this.remapFixturesResponse(i)),e.tiebreaker=t.tiebreaker?this.remapTimeTiebreaker(t.tiebreaker.time_tiebreaker):null,e.participantsCount=t.participants_count,e.related=t.related?this.remapRelated(t.related):[],e.excludedProfileIds=t.excluded_profile_ids,e.rules=t.rules,e.flags=t.flags,e.adContent=t.ad_content,e.labels=t.labels,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.images=t.images,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapFixturesResponse=t=>{let e=new ln;return e.matchId=t.match_id,e.matchType=t.match_type,e.market=t.market,e.matchStatus.type=t.match_status?t.match_status.type:null,e.matchStatus.subType=t.match_status?t.match_status.sub_type:null,e};remapPaginatedUserTopXEditions=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapUserTopXEditionsResponse(i)),e};remapUserTopXEditionsResponse=t=>{let e=new Ht;return e.id=t.id,e.title=t.title,e.description=t.description,e.type=t.type,e.status=t.status,e.authRequirement=t.auth_requirement||null,e.predictionsCutoff=t.predictions_cutoff,e.scheduleOpenAt=t.schedule_open_at,e.fixtures=t.fixtures.map(i=>this.remapTopXFixturesResponse(i)),e.tiebreaker=t.tiebreaker?this.remapTimeTiebreaker(t.tiebreaker.time_tiebreaker):null,e.participantsCount=t.participants_count,e.related=t.related?this.remapRelated(t.related):[],e.excludedProfileIds=t.excluded_profile_ids,e.rules=t.rules,e.flags=t.flags,e.images=t.images,e.branding=t.branding?this.remapBranding(t.branding):null,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapTopXFixturesResponse=t=>{let e=new cn;return e.matchId=t.match_id,e.matchType=t.match_type,e.market=t.market,e.matchStatus.type=t.match_status?t.match_status.type:null,e.matchStatus.subType=t.match_status?t.match_status.sub_type:null,e};remapPaginatedUserMathQuizEditions=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapUserMatchQuizEditionsResponse(i)),e};remapUserMatchQuizEditionsResponse=t=>{let e=new Pt;return e.id=t.id,e.title=t.title,e.description=t.description,e.type=t.type,e.status=t.status,e.authRequirement=t.auth_requirement||null,e.predictionsCutoff=t.predictions_cutoff,e.scheduleOpenAt=t.schedule_open_at,e.fixtures=t.fixtures.map(i=>this.remapMatchQuizFixturesResponse(i)),e.tiebreaker=t.tiebreaker?this.remapTimeTiebreaker(t.tiebreaker.time_tiebreaker):null,e.participantsCount=t.participants_count,e.related=t.related?this.remapRelated(t.related):[],e.excludedProfileIds=t.excluded_profile_ids,e.rules=t.rules,e.flags=t.flags,e.images=t.images,e.branding=t.branding?this.remapBranding(t.branding):null,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapMatchQuizFixturesResponse=t=>{let e=new No;return e.matchId=t.match_id,e.matchType=t.match_type,e.market=t.market,e.matchStatus.type=t.match_status?t.match_status.type:null,e.matchStatus.subType=t.match_status?t.match_status.sub_type:null,e};remapPaginatedGameResults=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapGameResults(i)),e};remapGameResults=t=>{let e=new Jt;return e.userId=t.user_id,e.points=t.points?t.points:0,e.results=t.results.map(i=>this.remapResults(i)),e.tiebreaker=t.tiebreaker?this.remapTiebreaker(t.tiebreaker):null,e};remapGameMarketsResults=t=>{let e=new ko;return e.gameId=t.game_id,e.results=this.remapMarketsResults(t.results),e.tieBreakers=t.tie_breakers?this.remapTieBreakers(t.tie_breakers):null,e};remapContestWinners=t=>{let e=new dn;return e.contestId=t.contest_id,e.contestType=t.contest_type,e.description=t.description,e.userList=t.user_list?t.user_list.map(i=>this.remapUserListWinners(i)):null,e};remapUserListWinners=t=>{let e=new mn;return e.position=t.position,e.profileId=t.profile_id,e.note=t.note,e.tags=t.tags,e};remapTieBreakers=t=>{let e={goldenGoals:[]};return e.goldenGoals=t.golden_goals.map(i=>({minute:i.minute,matchId:i.match_id,matchModel:null,playerId:i.player_id,playerModel:null,goalType:i.goal_type})),e};remapMarketsResults=t=>{let e=[];return t.forEach(i=>{let a={matchId:i.match_id,market:i.market,result:this.remapMarketResult(i.market,i.result),matchModel:null,playerModels:[],matchStatus:this.remapMarketsResultsMatchStatus(i.match_status)};e.push(this.deleteUnusefulField(a))}),e};remapMarketsResultsMatchStatus=t=>{let e=new X;return t&&(e.type=t.type,e.subType=t.sub_type),e};remapMarketResult=(t,e)=>{if(Iu.includes(t))return e[0];if(It.includes(t))return e;if(e[0]==="true")return!0;if(e[0]==="false")return!1};deleteUnusefulField=t=>((!It.includes(t.market)||this.isPlayerMarketWithNoResult(t.market,t.result))&&delete t.playerModels,t);isPlayerMarketWithNoResult=(t,e)=>It.includes(t)&&e.length===0;remapResults=t=>{let e=new un;return e.matchId=t.match_id,e.outcome=t.outcome,e};remapTiebreaker=t=>{let e=new bt;return e.goldenGoal=t.golden_goal,e};remapTimeTiebreaker=t=>{let e=new yt;return e.timeTiebreaker=t,e};remapRelated=t=>t.map(e=>{let i=new z;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i})};var Xl=class{remapMetaData=t=>{let e=new y;return e.pagination.nextPageStartsAfter=t.pagination.next_page_starts_after,e.pagination.itemsPerPage=t.pagination.items_per_page,e}};var mt=class extends v{predictionRemapper=null;matchSummaryRemapper=null;gamesRemapper=null;metaRemapper=null;idMapping=null;constructor(t){super(t,O(t.environment,"predictor")),this.idMapping=new R(t),this.predictionRemapper=new Bi(t,this.idMapping),this.matchSummaryRemapper=new jl(t,this.idMapping),this.gamesRemapper=new Yl,this.metaRemapper=new Xl}makeFootballPrediction=async t=>{let e=`/predictions${this.apiSignInUrl}`,i="There was a problem making POST request",a="POST",r=await this.fetchWithAuth(e,i,a,this.predictionRemapper.remapRequestBody(t));return await this.predictionRemapper.remapResponseObjBody(r)};getMatchSummary=async(t,e)=>{let i=f(e)?`/predictions/summary/${t}${this.apiSignInUrl}${m()}`:`/predictions/summary/${t}${this.apiSignInUrl}`,a=`There was a problem fetching predictions for match: ${t}`,r=await this.fetchWithoutAuth(i,a);return this.matchSummaryRemapper.remapResponse(r)};deleteFootballPrediction=async t=>{let e=`/predictions/${t}${this.apiSignInUrl}`,i=`There was a problem deleting your prediction: ${t}`,a="DELETE";return await this.fetchWithAuth(e,i,a),!0};getMyPredictions=async t=>{let e=new H,i=`/predictions${this.apiSignInUrl}`,a="There was a problem fetching own predictions";t&&(i+=`${t.constructFiltersUrl()}`);let r=await this.fetchWithAuth(i,a);return e.meta=this.metaRemapper.remapMetaData(r.meta),e.data=await this.predictionRemapper.remapResponseArrayBody(r.data),e};getMyPredictionsNoRemap=async t=>{let e=`/predictions${this.apiSignInUrl}${t.constructFiltersUrl()}`,i="There was a problem fetching own predictions";return await this.fetchWithAuth(e,i)};getUserPredictions=async(t,e,i)=>{let a=new H,r=f(e)?`/predictions/users/${t}${this.apiSignInUrl}${m()}`:`/predictions/users/${t}${this.apiSignInUrl}`,o=`There was a problem fetching predictions for user: ${t}`;i&&(r+=`${i.constructFiltersUrl()}`);let n=await this.fetchWithoutAuth(r,o);return a.meta=this.metaRemapper.remapMetaData(n.meta),a.data=await this.predictionRemapper.remapResponseArrayBody(n.data),a};getUserPredictionsNoRemap=async(t,e)=>{let i=`/predictions/users/${t}${this.apiSignInUrl}${e.constructFiltersUrl()}`,a=`There was a problem fetching predictions for user: ${t}`;return await this.fetchWithoutAuth(i,a)};getGames=async(t,e)=>{let i=f(e)?`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}${m()}`:`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}`,a="There was a problem fetching the games list",r=await this.fetchWithoutAuth(i,a);return this.gamesRemapper.remapPaginatedGames(r)};getGamesNoRemap=async(t,e)=>{let i=f(e)?`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}${m()}`:`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}`,a="There was a problem fetching the games list";return await this.fetchWithoutAuth(i,a)};getGameById=async(t,e)=>{let i=f(e)?`/games/${t}${this.apiSignInUrl}${m()}`:`/games/${t}${this.apiSignInUrl}`,a=`There was a problem fetching the following game: ${t}`,r=await this.fetchWithoutAuth(i,a);return this.gamesRemapper.remapGameByIdResponse(r)};getGamePredictions=async(t,e,i)=>{let a=new H,r=f(e)?`/games/${t}/predictions${this.apiSignInUrl}${m()}`:`/games/${t}/predictions${this.apiSignInUrl}`,o=`There was a problem fetching the predictions for game: ${t}`;i&&(r+=`${i.constructFiltersUrl()}`);let n=await this.fetchWithoutAuth(r,o);return a.meta=this.metaRemapper.remapMetaData(n.meta),a.data=await this.predictionRemapper.remapResponseArrayBody(n.data),a};getUserGameEditions=async(t,e)=>{let i=null,a=f(e)?`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}${m()}`:`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}`,r="There was a problem fetching the games list",o=await this.fetchWithoutAuth(a,r);return o.data.forEach(n=>{n.type==="TOP_X"?i=this.gamesRemapper.remapPaginatedUserTopXEditions(o):n.type==="MATCH_QUIZ"&&(i=this.gamesRemapper.remapPaginatedUserMathQuizEditions(o))}),i};getGameResults=async(t,e,i)=>{let a=f(e)?`/games/${t}/results/${this.apiSignInUrl}${m()}`:`/games/${t}/results/${this.apiSignInUrl}`,r=`There was a problem fetching the results for the following game: ${t}`;i&&(a+=`${i.constructMainFiltersUrl()}`);let o=await this.fetchWithoutAuth(a,r);return this.gamesRemapper.remapPaginatedGameResults(o)};getMarketResultsForGame=async(t,e)=>{let i=`/games/${t}/correct-results/${this.apiSignInUrl}`,a=`There was a problem fetching the markets correct results for the following game: ${t}`;f(e)&&(i+=`${m()}`);let r=await this.fetchWithoutAuth(i,a);return this.gamesRemapper.remapGameMarketsResults(r.data)};getContestWinners=async(t,e)=>{let i=`/winners/${this.apiSignInUrl}&contest_id=${t}`,a=`There was a problem fetching winners for the following game: ${t}`;e&&(i+=m());let r=await this.fetchWithoutAuth(i,a);return this.gamesRemapper.remapContestWinners(r)};getPredictionById=async t=>{let e=`/predictions/${t}${this.apiSignInUrl}`,i=`There was a problem fetching info for the following prediction: ${t}`,a=await this.fetchWithoutAuth(e,i);return(await this.predictionRemapper.remapResponseArrayBody([a.data]))[0]};getPredictionsByIds=async t=>{let e=`/predictions/by-ids${this.apiSignInUrl}&prediction_ids=${t.join(",")}`,i="There was a problem fetching predictions",a=await this.fetchWithoutAuth(e,i);return await this.predictionRemapper.remapResponseArrayBody(a.data)}};var ee=class{errorHandlingMode=null;constructor(t){this.errorHandlingMode=t}validateBodyFields=(t,e)=>{let i=Object.keys(e),a=Object.keys(new ei);switch(t){case"MATCH_QUIZ":i.forEach(l=>{a.includes(l)||this.throwInvalidParamException([l])});break;case"TOP_X":let o=e;o.fixtures.forEach(l=>this.validateMarketTopX(l.market));let n="tiebreaker";i.includes(n)&&o.tiebreaker&&this.validateTiebreaker(o.tiebreaker),i.forEach(l=>{l!=="tiebreaker"&&!a.includes(l)&&this.throwInvalidParamException([l])});break}let r=a.filter(o=>!i.includes(o));return r.length&&this.throwMissingFieldsException("game prediction body",r),e.fixtures.forEach(o=>{this.validateFixtureFields(o)}),e};validateFixture=(t,e,i,a)=>{this.validateMarket(e);let r=Object.values(Ll),o=Object.values(Bl),n=Object.values(Dl);if(e==="FT_1X2"||e==="HT_1X2"){if(r.includes(i))return new Vs(t,e,i)}else if(e==="HT_FT"){if(o.includes(i))return new Gs(t,i)}else if(e==="DOUBLE_CHANCE"){if(n.includes(i))return new Ns(t,i)}else if(e==="CORRECT_SCORE"||e==="CORRECT_SCORE_ADVANCED"||e==="CORRECT_SCORE_HT"){if(typeof i=="string"&&/\d+:\d+/.test(i))return new Vt(t,e,i)}else if(e==="CORNERS_MATCH"){if(typeof i=="number")return new Ls(t,i)}else if(e==="BOTH_TEAMS_SCORE"){if(this.isPredictionBoolean(i))return new Os(t,i)}else if(e==="RED_CARD_MATCH"){if(this.isPredictionBoolean(i))return new zs(t,i)}else if(e==="PENALTY_MATCH"){if(this.isPredictionBoolean(i))return new Hs(t,i)}else if(It.includes(e)){let l="OWN_GOAL";if(this.validatePlayerId(e,a),e===ji&&this.isPredictionBoolean(i)){let p=a&&a===l?l:a;return new st(t,e,i,p)}if(a&&this.isPredictionBoolean(i))return new st(t,e,i,a)}else if(bu.includes(e)){if(this.isPredictionBoolean(i))return new Ze(t,e,i)}else if(Mu.includes(e)&&this.isPredictionBoolean(i))return new Je(t,e,i);this.throwInvalidPredictionException(i,e)};validateFixtureFields=t=>{let e=Object.keys(t);e.forEach(a=>{eu.includes(a)||this.throwInvalidParamException([a])});let i=eu.filter(a=>{if(a!=="matchType"&&!e.includes(a))return a});i.length&&this.throwMissingFieldsException("fixtures",i),this.validatePredictionKey(t.market,t.prediction)};validateTiebreaker=t=>{let e=Object.keys(t);(!e.length||typeof t!="object")&&this.throwInvalidType("tiebreaker","object");let i=Object.keys(new bt)[0];e.forEach(a=>{i!==a&&this.throwInvalidParamException([a])}),e.includes(i)||this.throwMissingFieldsException("tiebreaker",[i]),typeof t.goldenGoal!="number"&&this.throwInvalidType("goldenGoal","number")};validatePredictionKey=(t,e)=>{if(typeof e=="object"){let i=Object.keys(e),a=["value"];if(i.length||this.throwMissingFieldsException("prediction",a),i.length===1&&!i.includes(a[0])&&this.throwInvalidParamException(i),i.length>1){It.includes(t)&&a.push("playerId");let r=i.filter(o=>!a.includes(o));r.length&&this.throwInvalidParamException(r)}}else this.throwInvalidType("prediction","object")};validatePlayerId=(t,e)=>{let i="playerId";t!==ji&&(e||this.throwInvalidParamException([i]),typeof e!="string"&&this.throwInvalidType(i,"string"))};validateMarket=t=>{Object.values(rt).includes(t)||this.throwInvalidMarketException(t)};validateMarketTopX=t=>{t!=="CORRECT_SCORE"&&t!=="CORRECT_SCORE_ADVANCED"&&this.throwInvalidMarketException(t,"TOP_X")};isPredictionBoolean=t=>typeof t=="boolean";throwInvalidPredictionException=(t,e)=>{let i=Pu(t,e);throw this.errorHandlingMode==="default"?new b(400,"INVALID_PREDICTION",i):new h(400,"INVALID_TYPE",i)};throwInvalidMarketException=(t,e)=>{let i=null;throw e&&e==="TOP_X"?i=Tu(t):i=Zp(t),this.errorHandlingMode==="default"?new b(400,"INVALID_MARKET",i):new h(400,"INVALID_TYPE",i)};throwInvalidParamException=t=>{let e=Eu(t);throw this.errorHandlingMode==="default"?new b(400,"INVALID_FIELD",e):new h(400,"INVALID_TYPE",e)};throwMissingFieldsException=(t,e)=>{let i=Ru(t,e);throw this.errorHandlingMode==="default"?new b(400,"INVALID_FIELD",i):new h(400,"INVALID_TYPE",i)};throwInvalidType=(t,e)=>{let i=Fu(t,e);throw this.errorHandlingMode==="default"?new b(400,"INVALID_TYPE",i):new h(400,"INVALID_TYPE",i)}};var ie=class{predictorHttps=null;predictorService=null;idMapping=null;clientHttps=null;predictorValidator=null;errorHandlingMode=null;constructor(t){this.predictorValidator=new ee(t.errorHandlingMode),this.idMapping=new R(t),this.predictorHttps=new mt(t),this.predictorService=new St(t,this.idMapping),this.clientHttps=new Q(t),this.errorHandlingMode=t.errorHandlingMode}getConfig=async()=>{let t=await this.clientHttps.getConfig("matchQuiz");return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(t):t};play=async t=>{t=this.predictorValidator.validateBodyFields("MATCH_QUIZ",t);let e=t.fixtures.map(i=>this.predictorValidator.validateFixture(i.matchId,i.market,i.prediction.value,i.prediction.playerId));if(e&&e.length&&this.idMapping.idSchema!=="native"){let i=[],a=[];e.forEach(n=>{i.push(n.matchId),n instanceof st&&n.prediction.playerId&&n.prediction.playerId!=="OWN_GOAL"&&a.push(n.prediction.playerId)});let r=await this.predictorService.remapMatchIdToNative(i),o={};a&&a.length>0&&(o=await this.predictorService.remapPlayerIdMapToNative(a)),e.forEach((n,l)=>{n.matchId=r[l],n instanceof st&&n.prediction.playerId!=="OWN_GOAL"&&(n.prediction.playerId=o[n.prediction.playerId])})}return t.fixtures=e,await this.predictorHttps.makeFootballPrediction(t)};delete=async t=>await this.predictorHttps.deleteFootballPrediction(t);getGames=async(t,e)=>{e=e||!1;let i=this.predictorService.initGameFilters("MATCH_QUIZ",t),a=await this.predictorHttps.getGames(i,e);return await this.predictorService.remapMatchIdsFixtures(a)};getGamesNoRemap=async(t,e)=>{e=e||!1;let i=this.predictorService.initGameFilters("MATCH_QUIZ",t);return await this.predictorHttps.getGamesNoRemap(i,e)};getGameById=async(t,e)=>{e=e||!1;let i=await this.predictorHttps.getGameById(t,e);return await this.predictorService.remapMatchIdsFixtures(i)};getGamePredictions=async(t,e,i)=>(i=i||!1,e&&(e.type&&delete e.type,e.status&&delete e.status,e=new V(e)),await this.predictorHttps.getGamePredictions(t,i,e));getGameResults=async(t,e,i)=>{i=i||!1,e&&(e=new I(e));let a=await this.predictorHttps.getGameResults(t,i,e);return await this.predictorService.remapMatchIdsFixtures(a)};getCurrentGameResults=async t=>{t=t||!1;let e=new nt(null);e.status="OPEN",e.type="MATCH_QUIZ";let i=await this.predictorHttps.getGames(e,t),a=this.predictorService.getCurrentGameId(i);return(await this.getGameResults(a,null,t)).data[0]};getMyGameEditions=async(t,e)=>{t&&t.limit&&this.validateLimitFilterOnGames(t.limit),e=e||!1;let i=this.predictorService.initGameTypePredictions("MATCH_QUIZ",t),a=[],r=await this.predictorHttps.getMyPredictionsNoRemap(i);if(r.data.length>0){r.data.forEach(p=>{p.game_instance_id&&a.push(p.game_instance_id)});let o=t?.limit?{limit:t.limit}:null,n=this.predictorService.initGameFilters("MATCH_QUIZ",o,a),l=await this.predictorHttps.getUserGameEditions(n,e);return await this.predictorService.addPredictionProp(r,l)}else return new H};getMyGamePrediction=async t=>{let e=new V({gameIds:[t]}),i=await this.predictorHttps.getMyPredictions(e);if(i.data.length>0){let a=i.data.filter(r=>r.gameInstanceId===t);return a.length?a[0]:null}return null};getUserGameEditions=async(t,e,i)=>{e&&e.limit&&this.validateLimitFilterOnGames(e.limit),i=i||!1;let a=this.predictorService.initGameTypePredictions("MATCH_QUIZ",e),r=[],o=await this.predictorHttps.getUserPredictionsNoRemap(t,a);if(o.data.length>0){o.data.forEach(c=>{c.game_instance_id&&r.push(c.game_instance_id)});let n=e?.limit?{limit:e.limit}:null,l=this.predictorService.initGameFilters("MATCH_QUIZ",n,r),p=await this.predictorHttps.getUserGameEditions(l,i);return await this.predictorService.addPredictionProp(o,p)}else return new H};getUserGamePrediction=async(t,e,i)=>{i=i||!1;let a=new V({gameIds:[e]}),r=await this.predictorHttps.getUserPredictions(t,i,a);if(r.data.length>0){let o=r.data.filter(n=>n.gameInstanceId===e);return o.length?o[0]:null}else return null};getMarketsResultsForGame=async(t,e)=>{let i=await this.predictorHttps.getMarketResultsForGame(t,e);return await this.predictorService.completeGameMarketResults(i,"MATCH_QUIZ")};getGameWinners=async(t,e)=>{let i=await this.predictorHttps.getContestWinners(t,e),a=await this.getGameById(t);return i.contestModel=a,this.predictorService.completeContestWinners(i)};validateLimitFilterOnGames=t=>{if(this.errorHandlingMode==="default"&&t>50)throw new b(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.");if(this.errorHandlingMode==="standard"&&t>50)throw new h(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.")}};var Jl=class extends et{remapClassicQuizzes=t=>(t.meta.pagination=this.remapMetaPagination(t.meta.pagination),t.data=t.data.map(e=>this.remapBasicClassicQuiz(e)),t);remapClassicQuizById=t=>{let e=new Uo;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.participationCount=t.participation_count,e.questionsCount=t.questions_count,e.status=t.status,e.language=t.language,e.authRequirement=t.auth_requirement,e.flags=t.flags,e.adContent=t.ad_content,e.rules=t.rules,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.labels=t.labels,e.time=t.time,e.points=t.points,e.related=t.related?this.remapRelated(t.related):[],e.scored=t.scored,e.maxAttempts=t.max_attempts,e.context=t.context?this.remapContext(t.context):t.context,e.averageScore=t.average_score,e.perfectScore=t.perfect_score,e.questions=t.questions.map(i=>this.remapQuestions(i)),e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapClassicQuizParticipation=t=>{let e=new $o;return e.classicQuizId=t.classic_quiz_id,e.userId=t.user_id,e.questions=t.questions?t.questions.map(i=>this.remapParticipationQuestions(i)):null,e.correctOptions=t.correct_options,e.personalBest=t.personal_best,e.points=t.points,e.attempts=t.attempts,e};remapClassicQuizParticipationBody=t=>t.map(e=>({question_id:e.questionId,option_id:e.optionId}));remapUserClassicQuizParticipationsWithPagination=t=>{let e=new Qo;return e.meta.pagination=this.remapMetaPagination(t.meta.pagination),e.data=t.data.map(i=>{let a=new Ri;return a.classicQuizId=i.classic_quiz_id,a.correct=i.correct,a.classicQuizQuestions=i.classic_quiz_questions,a.personalBest=i.personal_best,a.points=i.points,a.attempts=i.attempts,a.answers=i.answers?i.answers.map(r=>this.remapParticipationQuestions(r)):i.answers,a}),e};remapUserClassicQuizParticipations=t=>t.map(e=>{let i=new Ri;return i.classicQuizId=e.classic_quiz_id,i.correct=e.correct,i.classicQuizQuestions=e.classic_quiz_questions,i.personalBest=e.personal_best,i.points=e.points,i.attempts=e.attempts,i.answers=e.answers?e.answers.map(a=>this.remapParticipationQuestions(a)):e.answers,i});remapClassicQuizzesLeaderboard=t=>(t.meta=this.remapClassicQuizLeaderboardMeta(t.meta),t.data=t.data.map(e=>this.remapClassicQuizLeaderboard(e)),t);remapClassicQuizUserRankings=t=>(t.meta.pagination=this.remapMetaPaginationRank(t.meta.pagination),t.data=t.data.map(e=>this.remapClassicQuizUserRanking(e)),t);remapClassicQuizQuestionsReport=t=>t.map(e=>{let i=new qo;return i.questionId=e.question_id,i.correct=e.correct,i.wrong=e.wrong,i.skipped=e.skipped,i.total=e.total,i});remapClassicQuizResultsSummary=t=>t.map(e=>{let i=new ls;return i.questions=e.questions,i.correctAnswers=e.correct_answers,i});remapMetaPagination=t=>{let e=new ut;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapClassicQuizLeaderboardMeta=t=>{let e=new We;return e.pagination=this.remapMetaPaginationRank(t.pagination),e.filters=this.remapLeaderboardMetaFilters(t.filters),e};remapMetaPaginationRank=t=>{let e=new Y;return e.currentPage=t.current_page,e.itemsPerPage=t.items_per_page,e.numberOfPages=t.number_of_pages,e.totalItems=t.total_items,e};remapLeaderboardMetaFilters=t=>{let e=new Qe;return e.classicQuizIds=t?.classic_quiz_ids||null,e};remapClassicQuizUserRanking=t=>{let e=new jo;return e.position=t.position,e.classicQuizId=t.classic_quiz_id,e.points=t.points,e};remapBasicClassicQuiz=t=>{let e=new ze;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.participationCount=t.participation_count,e.questionsCount=t.questions_count,e.status=t.status,e.language=t.language,e.authRequirement=t.auth_requirement,e.flags=t.flags,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.labels=t.labels,e.time=t.time,e.related=t.related?this.remapRelated(t.related):[],e.averageScore=t.average_score,e.perfectScore=t.perfect_score,e.points=t.points,e.scored=t.scored,e.maxAttempts=t.max_attempts,e.context=t.context?this.remapContext(t.context):t.context,e.adContent=t.ad_content,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapQuestions=t=>{let e=new Vo;return e.questionId=t.question_id,e.question=t.question,e.images=t.images,e.embedCode=t.embed_code,e.explanation=t.explanation,e.options=t.options.map(i=>this.remapOptions(i)),e};remapOptions=t=>{let e=new Ho;return e.optionId=t.option_id,e.option=t.option,e.images=t.images,e.correct=t.correct,e};remapParticipationQuestions=t=>{let e=new zo;return e.questionId=t.question_id,e.optionId=t.option_id,e.correct=t.correct,e.correctOptionId=t.correct_option_id,e};remapClassicQuizLeaderboard=t=>{let e=new Ko;return e.position=t.position,e.profileId=t.profile_id,e.points=t.points,e};remapContext=t=>{let e=new Gt;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new Ut;return a.id=i.id,a.type=i.type,a.source=i.source,a}):null,e.campaign=t.campaign,e};remapRelated=t=>t.map(e=>{let i=new z;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i})};var Zl=class extends et{remapEitherOrs=t=>(t.meta.pagination=this.remapMetaPagination(t.meta.pagination),t.data=t.data.map(e=>this.remapBasicEitherOr(e)),t);remapEitherOrById=t=>{let e=new Xo;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.status=t.status,e.language=t.language,e.authRequirement=t.auth_requirement,e.winningCondition=t.winning_condition,e.lives=t.lives,e.flags=t.flags,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.labels=t.labels,e.time=t.time,e.related=t.related?this.remapRelated(t.related):[],e.context=t.context?this.remapContext(t.context):t.context,e.points=t.points?t.points.map(i=>this.remapPoints(i)):t.points,e.rules=t.rules,e.adContent=t.ad_content,e.totalParticipationsCount=t.total_participations_count,e.totalUsersCount=t.total_users_count,e.finishedParticipationsCount=t.finished_participations_count,e.averageStartedParticipationsCount=t.average_started_participations_count,e.averageFinishedParticipationsCount=t.average_finished_participations_count,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapEitherOrOwnStats=t=>{let e=new Zo;return e.eitherOrId=t.either_or_id,e.personalBest=t.personal_best,e.betterThan=t.better_than,e};remapEitherOrResults=t=>{let e=new ss;return e.standings=t.standings?t.standings.map(i=>this.remapResultsStandings(i)):t.standings,e.breakdown=t.breakdown?t.breakdown.map(i=>this.remapResultsBreakdown(i)):t.breakdown,e};remapEitherOrParticipation=t=>{let e=new ts;return e.instanceId=t.instance_id,e.eitherOrId=t.either_or_id,e.gameStartedAt=t.game_started_at,e.currentStep=t.current_step,e.currentStreak=t.current_streak,e.remainingSteps=t.remaining_steps,e.currentLives=t.current_lives,e.currentPoints=t.current_points,e.personalBest=t.personal_best,e.participationCount=t.participation_count,e.finishedParticipationsCount=t.finished_participations_count,e.steps=t.steps?t.steps.map(i=>this.remapParticipationSteps(i)):t.steps,e};remapBasicEitherOr=t=>{let e=new Ke;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.status=t.status,e.language=t.language,e.winningCondition=t.winning_condition,e.authRequirement=t.auth_requirement,e.lives=t.lives,e.flags=t.flags,e.related=t.related?this.remapRelated(t.related):[],e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.labels=t.labels,e.adContent=t.ad_content,e.context=t.context?this.remapContext(t.context):t.context,e.time=t.time,e.points=t.points?t.points.map(i=>this.remapPoints(i)):t.points,e.totalParticipationsCount=t.total_participations_count,e.totalUsersCount=t.total_users_count,e.finishedParticipationsCount=t.finished_participations_count,e.averageStartedParticipationsCount=t.average_started_participations_count,e.averageFinishedParticipationsCount=t.average_finished_participations_count,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapMetaPagination=t=>{let e=new ut;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapPoints=t=>{let e=new Jo;return e.correctSteps=t.correct_steps,e.score=t.score,e};remapResultsStandings=t=>{let e=new ns;return e.userId=t.user_id,e.personalBest=t.personal_best,e};remapResultsBreakdown=t=>{let e=new os;return e.rangeStartInclusive=t.range_start_inclusive,e.rangeEndInclusive=t.range_end_inclusive,e.totalUsers=t.total_users,e};remapParticipationSteps=t=>{let e=new rs;return e.pairId=t.pair_id,e.userSelection=t.user_selection,e.correct=t.correct,e.played=t.played,e.timestamp=t.timestamp,e.optionOne=t.option_one,e.optionTwo=t.option_two,e};remapContext=t=>{let e=new Gt;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new Ut;return a.id=i.id,a.type=i.type,a.source=i.source,a}):null,e.campaign=t.campaign,e};remapRelated=t=>t.map(e=>{let i=new z;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i})};var tp=class extends et{remapPersonalityQuizzes=t=>(t.meta.pagination=this.remapMetaPagination(t.meta.pagination),t.data=t.data.map(e=>this.remapBasicPersonalityQuiz(e)),t);remapPersonalityQuizById=t=>{let e=new ms;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.images=t.images,e.participationCount=t.participation_count,e.status=t.status,e.language=t.language,e.authRequirement=t.auth_requirement,e.flags=t.flags,e.adContent=t.ad_content,e.preferencesEnabled=t.preferences_enabled||!1,e.rules=t.rules||null,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.labels=t.labels,e.time=t.time,e.related=t.related?this.remapRelated(t.related):[],e.maxAttempts=t.max_attempts,e.context=t.context?this.remapContext(t.context):t.context,e.questions=t.questions?t.questions.map(i=>this.remapQuestions(i)):[],e.personaResults=t.persona_results?t.persona_results.map(i=>this.remapPersonaResults(i)):[],e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPersonalityQuizParticipation=t=>{let e=new fs;return e.personalityQuizId=t.personality_quiz_id,e.userId=t.user_id,e.questions=t.questions?this.remapParticipationQuestions(t.questions):[],e.personas=t.personas?this.remapParticipationPersonas(t.personas):[],e.attempts=t.attempts,e};remapUserPersonalityQuizParticipations=t=>{let e=new Ms;return e.meta.pagination=this.remapMetaPagination(t.meta.pagination),e.data=t.data.map(i=>this.remapPersonalityQuizParticipation(i)),e};remapParticipationQuestions=t=>t.map(e=>{let i=new gs;return i.questionId=e.question_id,i.optionId=e.option_id,i});remapParticipationPersonas=t=>t.map(e=>{let i=new ys;return i.personaId=e.persona_id,i.percent=e.percent,i});remapPersonalityQuizParticipationBody=t=>t.map(e=>({question_id:e.questionId,option_id:e.optionId}));remapMetaPagination=t=>{let e=new ut;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapBasicPersonalityQuiz=t=>{let e=new je;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.images=t.images,e.participationCount=t.participation_count,e.status=t.status,e.language=t.language,e.authRequirement=t.auth_requirement,e.flags=t.flags,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.labels=t.labels,e.time=t.time,e.related=t.related?this.remapRelated(t.related):[],e.maxAttempts=t.max_attempts,e.preferencesEnabled=t.preferences_enabled||!1,e.context=t.context?this.remapContext(t.context):t.context,e.adContent=t.ad_content,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPersonaResults=t=>{let e=new ps;return e.personaId=t.persona_id,e.title=t.title,e.description=t.description,e.images=t.images,e};remapQuestions=t=>{let e=new cs;return e.questionId=t.question_id,e.question=t.question,e.images=t.images,e.explanation=t.explanation,e.options=t.options.map(i=>this.remapOptions(i)),e};remapOptions=t=>{let e=new ds;return e.optionId=t.option_id,e.option=t.option,e.images=t.images,e.preferenceMapping=t.preference_mapping?this.remapPreferencesMapping(t.preference_mapping):[],e.personaPoints=t.persona_points?this.remapPersonaPoints(t.persona_points):[],e};remapPreferencesMapping=t=>t.map(e=>{let i=new ci;return i.preferenceId=e.preference_id,i});remapPersonaPoints=t=>t.map(e=>{let i=new us;return i.personaId=e.persona_id,i.points=e.points,i});remapContext=t=>{let e=new Gt;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new Ut;return a.id=i.id,a.type=i.type,a.source=i.source,a}):null,e.campaign=t.campaign,e};remapRelated=t=>t.map(e=>{let i=new z;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i})};var Ni=class extends v{classicQuizRemapper=null;eitherOrRemapper=null;personalityQuizRemapper=null;constructor(t){super(t,O(t.environment,"miniGames")),this.classicQuizRemapper=new Jl,this.eitherOrRemapper=new Zl,this.personalityQuizRemapper=new tp}getClassicQuizzes=async(t,e)=>{let i=`/classic-quizzes${this.apiSignInUrl}`;t&&(i+=t.constructMainFiltersUrl()),i+=f(e)?m():"";let a="There was a problem with fetching classic quizzes",r=await this.fetchWithoutAuth(i,a);return this.classicQuizRemapper.remapClassicQuizzes(r)};getClassicQuizById=async(t,e,i)=>{let a=`/classic-quizzes/${t}${this.apiSignInUrl}`;e&&(a+=`&include_correct_options=${e}`),f(i)&&(a+=m());let r="There was a problem with fetching classic quiz by ID",o=await this.fetchWithoutAuth(a,r);return this.classicQuizRemapper.remapClassicQuizById(o.data)};participateInClassicQuiz=async(t,e,i)=>{let a=`/classic-quizzes/${t}/participate${this.apiSignInUrl}`,r=`There was a problem with participating in the following classic quiz: ${t}`,o="POST",n={questions:this.classicQuizRemapper.remapClassicQuizParticipationBody(e),include_correct_options:!!i},l=await this.fetchWithAuth(a,r,o,n);return this.classicQuizRemapper.remapClassicQuizParticipation(l.data)};getMyClassicQuizParticipations=async(t,e)=>{let i=`/classic-quizzes/participations${this.apiSignInUrl}`;t&&(i+=`${t.constructMainFiltersUrl()}`);let a="There was a problem with fetching user's own Classic Quiz participations",r=await this.fetchWithAuth(i,a);return e?this.classicQuizRemapper.remapUserClassicQuizParticipationsWithPagination(r):this.classicQuizRemapper.remapUserClassicQuizParticipations(r.data)};getLeaderboardForClassicQuizzes=async(t,e)=>{let i=`/classic-quizzes/rank${this.apiSignInUrl}`;t&&(i+=`${t.constructMainFiltersUrl()}`),i+=f(e)?m():"";let a="There was a problem with fetching classic quizzes leaderboard",r=await this.fetchWithoutAuth(i,a);return this.classicQuizRemapper.remapClassicQuizzesLeaderboard(r)};getClassicQuizzesUserRanking=async(t,e,i)=>{let a=`/classic-quizzes/users/${t}/rank${this.apiSignInUrl}`;e&&(a+=`${e.constructMainFiltersUrl()}`),a+=f(i)?m():"";let r="There was a problem with fetching user's rankings for classic quizzes",o=await this.fetchWithoutAuth(a,r);return this.classicQuizRemapper.remapClassicQuizUserRankings(o)};getClassicQuizQuestionsReport=async t=>{let e=`/classic-quizzes/${t}/questions-report${this.apiSignInUrl}`,i=`There was a problem with fetching questions report for quiz: ${t}`,a=await this.fetchWithoutAuth(e,i);return this.classicQuizRemapper.remapClassicQuizQuestionsReport(a.data)};getClassicQuizResultsSummary=async(t,e)=>{let i=`/classic-quizzes/${t}/results-summary${this.apiSignInUrl}`;f(e)&&(i+=m());let a="There was a problem with fetching classic quiz results summary",r=await this.fetchWithoutAuth(i,a);return this.classicQuizRemapper.remapClassicQuizResultsSummary(r.data)};getEitherOrs=async(t,e)=>{let i=`/either-or${this.apiSignInUrl}`;t&&(i+=t.constructMainFiltersUrl()),i+=f(e)?m():"";let a="There was a problem with fetching list of Either/Ors",r=await this.fetchWithoutAuth(i,a);return this.eitherOrRemapper.remapEitherOrs(r)};getEitherOrById=async(t,e)=>{let i=`/either-or/${t}${this.apiSignInUrl}`;f(e)&&(i+=m());let a="There was a problem with fetching Either/Or by ID",r=await this.fetchWithoutAuth(i,a);return this.eitherOrRemapper.remapEitherOrById(r.data)};getMyEitherOrStats=async t=>{let e=`/either-or/${t}/own-stats${this.apiSignInUrl}`,i="There was a problem with fetching Either/Or own statistics",a=await this.fetchWithAuth(e,i);return this.eitherOrRemapper.remapEitherOrOwnStats(a.data)};getEitherOrResults=async(t,e)=>{let i=`/either-or/${t}/results${this.apiSignInUrl}${f(e)?m():""}`,a="There was a problem with fetching Either/Or results",r=await this.fetchWithoutAuth(i,a);return this.eitherOrRemapper.remapEitherOrResults(r.data)};participateInEitherOr=async(t,e)=>{let i=`/either-or/${t}/participate${this.apiSignInUrl}`,a="There was a problem with participating in Either/Or",r="POST",o=await this.fetchWithAuth(i,a,r,e);return this.eitherOrRemapper.remapEitherOrParticipation(o.data)};getPersonalityQuizzes=async(t,e)=>{let i=`/personality-quizzes${this.apiSignInUrl}`;t&&(i+=t.constructMainFiltersUrl()),i+=f(e)?m():"";let a="There was a problem with fetching personality quizzes",r=await this.fetchWithoutAuth(i,a);return this.personalityQuizRemapper.remapPersonalityQuizzes(r)};getPersonalityQuizById=async(t,e)=>{let i=`/personality-quizzes/${t}${this.apiSignInUrl}`;f(e)&&(i+=m());let a="There was a problem with fetching personality quiz by ID",r=await this.fetchWithoutAuth(i,a);return this.personalityQuizRemapper.remapPersonalityQuizById(r.data)};participateInPersonalityQuiz=async(t,e)=>{let i=`/personality-quizzes/${t}/participate${this.apiSignInUrl}`,a=`There was a problem with participating in the following personality quiz: ${t}`,r="POST",o={questions:this.personalityQuizRemapper.remapPersonalityQuizParticipationBody(e)},n=await this.fetchWithAuth(i,a,r,o);return this.personalityQuizRemapper.remapPersonalityQuizParticipation(n.data)};getPersonalityQuizUserParticipation=async(t,e,i)=>{let a=`/personality-quizzes/${t}/participations/${e}${this.apiSignInUrl}`;f(i)&&(a+=m());let r="There was a problem with fetching user personality quiz participation",o=await this.fetchWithoutAuth(a,r);return this.personalityQuizRemapper.remapPersonalityQuizParticipation(o.data)};getMyPersonalityQuizParticipations=async t=>{let e=`/personality-quizzes/participations${this.apiSignInUrl}`;t&&(e+=`${t.constructMainFiltersUrl()}`);let i="There was a problem with fetching user's own Personality Quiz participations",a=await this.fetchWithAuth(e,i);return this.personalityQuizRemapper.remapUserPersonalityQuizParticipations(a)}};var ae=class extends K{entityTypes=["competition","team","player"];constructor(t){super(t.errorHandlingMode)}validateFilters=t=>{!t.entityIds&&!t.entityType||(t.entityIds&&!t.entityType&&this.throwException(400,"invalid_filters","You need to use both 'entityIds' and 'entityType' filters together"),!t.entityIds&&t.entityType&&this.throwException(400,"invalid_filters","You need to use both 'entityIds' and 'entityType' filters together"),this.entityTypes.includes(t.entityType)||this.throwException(400,"invalid_filters","Invalid 'entityType' filter. Please use one of the following valid options: competition, team, or player"))}};var ep=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(t){this.idSchema=t.idSchema,this.idMapping=new R(t),this.validator=new ae(t),this.profile=new D(t),this.football=new it(t),this.https=new Ni(t)}finalizeMiniGamesFilters=async t=>{if(this.idSchema!=="native"&&t.entityIds&&t.entityIds.length>0){this.validator.validateFilters(t);let e=await this.idMapping.getEntityIdsBySchemaId(Array.from(t.entityIds),t.entityType,"native");t.entityIds=e[t.entityType]}};setProfileModelsForEitherOrStandings=async t=>{let e=t.standings.map(a=>a.userId);if(!e.length)return t;let i=await this.profile.getByIds(e);return t.standings.forEach(a=>a.userModel=i.find(r=>r.id===a.userId)||null),t};setProfileModelsForClassicQuizLeaderboards=async t=>{let e=t.map(a=>a.profileId);if(!e.length)return t;let i=await this.profile.getByIds(e);return t.forEach(a=>a.profileModel=i.find(r=>r.id===a.profileId)||null),t};defaultEitherOrParticipation=async(t,e)=>{if(!this.eitherOrTime&&!e){let r=await this.https.getEitherOrById(t,!0);this.eitherOrTime=r.time;let o=await this.https.participateInEitherOr(t,null);return this.participationStartTimestamp=Date.now(),o}let i=0;if(this.participationStartTimestamp)i=(Date.now()-this.participationStartTimestamp)/1e3;else{if(!this.eitherOrTime){let r=await this.https.getEitherOrById(t,!0);this.eitherOrTime=r.time}i=this.eitherOrTime+1}let a=this.createNewParticipation(i,e);try{let r=await this.https.participateInEitherOr(t,a);return!r.currentLives||!r.remainingSteps?this.resetDefaultParticipationTimers():this.participationStartTimestamp=Date.now(),r}catch(r){throw this.resetDefaultParticipationTimers(),r}};handleEitherOrParticipationWithCallback=async(t,e,i)=>e?await this.eitherOrParticipationWithCallback(t,e,i):await this.initialEitherOrParticipationWithCallback(t,i);initialEitherOrParticipationWithCallback=async(t,e)=>{let i=await this.https.getEitherOrById(t,!0);this.eitherOrTime=i.time;let a=await this.https.participateInEitherOr(t,null);return this.participationStartTimestamp=Date.now(),this.countdownTimer=this.eitherOrTime,this.setCurrentPairId(a),await this.handleEitherOrParticipationCallbackInterface(t,e),a};eitherOrParticipationWithCallback=async(t,e,i)=>{this.intervalId&&clearInterval(this.intervalId);let a=0;if(this.participationStartTimestamp)a=(Date.now()-this.participationStartTimestamp)/1e3;else{if(!this.eitherOrTime){let o=await this.https.getEitherOrById(t,!0);this.eitherOrTime=o.time}a=this.eitherOrTime+1}let r=this.createNewParticipation(a,e);try{let o=await this.https.participateInEitherOr(t,r);return!o.currentLives||!o.remainingSteps?(this.resetCallbackParticipationTimers(),i.onElapsedResponse(o),clearInterval(this.intervalId)):(this.participationStartTimestamp=Date.now(),this.countdownTimer=this.eitherOrTime,this.setCurrentPairId(o),await this.handleEitherOrParticipationCallbackInterface(t,i)),o}catch(o){throw this.resetCallbackParticipationTimers(),clearInterval(this.intervalId),o}};setCurrentPairId=t=>{this.currentPairId=t.steps.find(e=>!e.played).pairId||""};handleEitherOrParticipationCallbackInterface=async(t,e)=>{this.intervalId=setInterval(async()=>{if(this.countdownTimer>0)this.countdownTimer--,e.onTimerTick(this.countdownTimer);else{clearInterval(this.intervalId);let i=(Date.now()-this.participationStartTimestamp)/1e3,a={pair:this.currentPairId,answer:this.currentPairId.split("_")[0]},r=this.createNewParticipation(i,a),o=await this.eitherOrParticipationWithCallback(t,r,e);e.onElapsedResponse(o)}},1e3)};createNewParticipation=(t,e)=>{let i=new is;return i.expired=t>this.eitherOrTime,i.time=Number(t.toFixed(3)),i.pair=e.pair,i.answer=e.answer,i};resetCallbackParticipationTimers=()=>{this.resetDefaultParticipationTimers(),this.countdownTimer=0,this.currentPairId=""};resetDefaultParticipationTimers=()=>{this.eitherOrTime=0,this.participationStartTimestamp=0};setContextTagsModels=async t=>{let e={competitions:[],teams:[],players:[]};if(t.forEach(i=>{i.context&&i.context.tags&&i.context.tags.length>0&&(e.competitions=[...e.competitions,...this.extractEntityIdsFromTags(i.context.tags,"competition")],e.competitions=Array.from(new Set(e.competitions)),e.teams=[...e.teams,...this.extractEntityIdsFromTags(i.context.tags,"team")],e.teams=Array.from(new Set(e.teams)),e.players=[...e.players,...this.extractEntityIdsFromTags(i.context.tags,"player")],e.players=Array.from(new Set(e.players)))}),e.competitions.length){let i=await this.football.footballFacade.getCompetitionsMapWithNativeIds(e.competitions);this.setModelsForContextTags(t,i,"competition")}if(e.teams.length){let i=await this.football.footballFacade.getTeamsMapWithNativeIds(e.teams);this.setModelsForContextTags(t,i,"team")}if(e.players.length){let i=await this.football.footballFacade.getPlayersMapWithNativeIds(e.players);this.setModelsForContextTags(t,i,"player")}};extractEntityIdsFromTags=(t,e)=>t.filter(i=>i.type===e).map(i=>i.id);setModelsForContextTags=(t,e,i)=>{t.forEach(a=>{a.context&&a.context.tags&&a.context.tags.length>0&&a.context.tags.forEach(r=>{r.type===i&&(r.model=i==="player"?e[r.id]:e.get(r.id),r.id=r.model.id)})})};setQuestionModelsInQuestionsReport=async(t,e)=>t.map(i=>(i.questionModel=e.questions.find(a=>a.questionId.toString()===i.questionId),i))};var ip=class{https=null;service=null;activityService=null;idSchema=null;constructor(t){this.https=new Ni(t),this.service=new ep(t),this.activityService=new wt(t),this.idSchema=t.idSchema}getClassicQuizzes=async(t,e,i)=>{t&&(t=new Go(t),await this.service.finalizeMiniGamesFilters(t));let a=await this.https.getClassicQuizzes(t,i);if(e)await this.service.setContextTagsModels(a.data);else for(let r of a.data)await this.remapTags(r,"native",this.idSchema);return a};getClassicQuizById=async(t,e,i)=>{let a=await this.https.getClassicQuizById(t,e,i);return await this.service.setContextTagsModels([a]),a};participateInClassicQuiz=async(t,e,i)=>await this.https.participateInClassicQuiz(t,e,i);getMyClassicQuizParticipations=async t=>{t&&(t=new Ei(t));let i=await this.https.getMyClassicQuizParticipations(t,!1),a=i.map(o=>o.classicQuizId),r=await this.getClassicQuizzes({classicQuizIds:a});return i.forEach(o=>{o.classicQuizModel=r.data.find(n=>n.id===o.classicQuizId)||null}),i};getMyClassicQuizParticipationsWithPagination=async t=>{t&&(t=new Ei(t));let i=await this.https.getMyClassicQuizParticipations(t,!0),a=i.data.map(o=>o.classicQuizId),r=await this.getClassicQuizzes({classicQuizIds:a});return i.data.forEach(o=>{o.classicQuizModel=r.data.find(n=>n.id===o.classicQuizId)||null}),i};getLeaderboardForClassicQuizzes=async(t,e)=>{t&&(t=new Wo(t));let i=await this.https.getLeaderboardForClassicQuizzes(t,e);return i.data=await this.service.setProfileModelsForClassicQuizLeaderboards(i.data),i};getClassicQuizzesUserRanking=async(t,e,i)=>{e&&(e=new qe(e));let a=await this.https.getClassicQuizzesUserRanking(t,e,i),r=a.data.map(n=>n.classicQuizId),o=await this.getClassicQuizzes({classicQuizIds:r});return a.data=a.data.map(n=>{let l=o.data.find(p=>p.id===n.classicQuizId)||null;return{...n,classicQuizModel:l}}),a};getClassicQuizQuestionsReport=async(t,e)=>{e=e||!1;let i=await this.https.getClassicQuizQuestionsReport(t),a=await this.getClassicQuizById(t,e,!0);return this.service.setQuestionModelsInQuestionsReport(i,a)};getClassicQuizResultsSummary=async(t,e)=>await this.https.getClassicQuizResultsSummary(t,e);getEitherOrs=async(t,e,i)=>{t&&(t=new Yo(t),await this.service.finalizeMiniGamesFilters(t));let a=await this.https.getEitherOrs(t,i);if(e)await this.service.setContextTagsModels(a.data);else for(let r of a.data)await this.remapTags(r,"native",this.idSchema);return a};getEitherOrById=async(t,e)=>{let i=await this.https.getEitherOrById(t,e);return await this.service.setContextTagsModels([i]),i};getMyEitherOrStats=async t=>await this.https.getMyEitherOrStats(t);getEitherOrResults=async(t,e)=>{let i=await this.https.getEitherOrResults(t,e);return await this.service.setProfileModelsForEitherOrStandings(i)};participateInEitherOr=async(t,e,i)=>i?await this.service.handleEitherOrParticipationWithCallback(t,e,i):await this.service.defaultEitherOrParticipation(t,e);calculateEitherOrResultPercentile=async(t,e)=>{if(e==null||isNaN(e)||e<0)return null;if(e===0)return e;let i=await this.getEitherOrResults(t,!0),a=i.breakdown.reduce((o,n)=>o+n.totalUsers,0),r=0;for(let o of i.breakdown)if(r+=o.totalUsers,e>=o.rangeStartInclusive&&e<=o.rangeEndInclusive)return parseFloat((r/a*100).toFixed(1));return null};getPersonalityQuizzes=async(t,e,i)=>{t&&(t=new hs(t),await this.service.finalizeMiniGamesFilters(t));let a=await this.https.getPersonalityQuizzes(t,i);if(e)await this.service.setContextTagsModels(a.data);else for(let r of a.data)await this.remapTags(r,"native",this.idSchema);return a};getPersonalityQuizById=async(t,e)=>{let i=await this.https.getPersonalityQuizById(t,e);return await this.service.setContextTagsModels([i]),i};participateInPersonalityQuiz=async(t,e)=>await this.https.participateInPersonalityQuiz(t,e);getPersonalityQuizUserParticipation=async(t,e,i)=>await this.https.getPersonalityQuizUserParticipation(t,e,i);getMyPersonalityQuizParticipations=async t=>(t&&(t=new bs(t)),await this.https.getMyPersonalityQuizParticipations(t));remapTags=async(t,e,i)=>{if(this.idSchema!="native"&&t.context&&t.context.tags&&t.context.tags.length){let a=JSON.parse(JSON.stringify(t.context.tags)),r=await this.activityService.remapTagsIds(a,e,i);t.context.tags=r}}};var re=class{facade=null;constructor(t){this.facade=new ip(t)}getClassicQuizzes=async(t,e,i)=>await this.facade.getClassicQuizzes(t,e,i);getClassicQuizById=async(t,e,i)=>await this.facade.getClassicQuizById(t,e,i);participateInClassicQuiz=async(t,e,i)=>await this.facade.participateInClassicQuiz(t,e,i);getMyClassicQuizParticipations=async t=>await this.facade.getMyClassicQuizParticipations(t);getMyClassicQuizParticipationsWithPagination=async t=>await this.facade.getMyClassicQuizParticipationsWithPagination(t);getLeaderboardForClassicQuizzes=async(t,e)=>await this.facade.getLeaderboardForClassicQuizzes(t,e);getClassicQuizzesUserRanking=async(t,e,i)=>await this.facade.getClassicQuizzesUserRanking(t,e,i);getClassicQuizQuestionsReport=async(t,e)=>await this.facade.getClassicQuizQuestionsReport(t,e);getClassicQuizResultsSummary=async(t,e)=>await this.facade.getClassicQuizResultsSummary(t,e);getEitherOrs=async(t,e,i)=>await this.facade.getEitherOrs(t,e,i);getEitherOrById=async(t,e)=>await this.facade.getEitherOrById(t,e);getMyEitherOrStats=async t=>await this.facade.getMyEitherOrStats(t);getEitherOrResults=async(t,e)=>await this.facade.getEitherOrResults(t,e);participateInEitherOr=async(t,e,i)=>await this.facade.participateInEitherOr(t,e,i);calculateEitherOrResultPercentile=async(t,e)=>await this.facade.calculateEitherOrResultPercentile(t,e);getPersonalityQuizzes=async(t,e,i)=>await this.facade.getPersonalityQuizzes(t,e,i);getPersonalityQuizById=async(t,e)=>await this.facade.getPersonalityQuizById(t,e);participateInPersonalityQuiz=async(t,e)=>await this.facade.participateInPersonalityQuiz(t,e);getPersonalityQuizUserParticipation=async(t,e,i)=>await this.facade.getPersonalityQuizUserParticipation(t,e,i);getMyPersonalityQuizParticipations=async t=>await this.facade.getMyPersonalityQuizParticipations(t)};var oe=class{idMapping=null;predictorHttps=null;predictorService=null;predictorValidator=null;clientHttps=null;errorHandlingMode=null;constructor(t){this.idMapping=new R(t),this.errorHandlingMode=t.errorHandlingMode,this.predictorValidator=new ee(t.errorHandlingMode),this.predictorHttps=new mt(t),this.predictorService=new St(t,this.idMapping),this.clientHttps=new Q(t)}getConfig=async()=>{let t=await this.clientHttps.getConfig("topX");return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(t):t};getGames=async(t,e)=>{e=e||!1;let i=this.predictorService.initGameFilters("TOP_X",t),a=await this.predictorHttps.getGames(i,e);return await this.predictorService.remapMatchIdsFixtures(a)};getGamesNoRemap=async(t,e)=>{e=e||!1;let i=this.predictorService.initGameFilters("TOP_X",t);return await this.predictorHttps.getGamesNoRemap(i,e)};getGameById=async(t,e)=>{e=e||!1;let i=await this.predictorHttps.getGameById(t,e);return await this.predictorService.remapMatchIdsFixtures(i)};getGamePredictions=async(t,e,i)=>(i=i||!1,e&&(e.type&&delete e.type,e.status&&delete e.status,e=new V(e)),await this.predictorHttps.getGamePredictions(t,i,e));getGameResults=async(t,e,i)=>{i=i||!1,e&&(e=new nt(e));let a=await this.predictorHttps.getGameResults(t,i,e);return await this.predictorService.remapMatchIdsFixtures(a)};getCurrentGameResults=async t=>{t=t||!1;let e=new nt(null);e.status="OPEN",e.type="TOP_X";let i=await this.predictorHttps.getGames(e,t),a=this.predictorService.getCurrentGameId(i);return(await this.getGameResults(a,null,t)).data[0]};play=async t=>{let e=new ni(t);if(e=this.predictorValidator.validateBodyFields("TOP_X",e),e.fixtures=e.fixtures.map(a=>this.predictorValidator.validateFixture(a.matchId,a.market,a.prediction.value)),this.idMapping.idSchema!=="native"){let a=[];e.fixtures.forEach(o=>a.push(o.matchId));let r=await this.predictorService.remapMatchIdToNative(a);e.fixtures.forEach(o=>o.matchId=r.shift())}let i=await this.predictorHttps.makeFootballPrediction(e);return i.fixtures.forEach(a=>{a.matchId=a.matchModel.id}),i};delete=async t=>await this.predictorHttps.deleteFootballPrediction(t);getMyGameEditions=async(t,e)=>{t&&t.limit&&this.validateLimitFilterOnGames(t.limit),e=e||!1;let i=this.predictorService.initGameTypePredictions("TOP_X",t),a=[],r=await this.predictorHttps.getMyPredictionsNoRemap(i);if(r.data.length>0){r.data.forEach(p=>{p.game_instance_id&&a.push(p.game_instance_id)});let o=t?.limit?{limit:t.limit}:null,n=this.predictorService.initGameFilters("TOP_X",o,a),l=await this.predictorHttps.getUserGameEditions(n,e);return await this.predictorService.addPredictionProp(r,l)}else return new H};getMyGamePrediction=async t=>{let e=new V({gameIds:[t]}),i=await this.predictorHttps.getMyPredictions(e);if(i.data.length>0){let a=i.data.filter(r=>r.gameInstanceId===t);return a.length?a[0]:null}return null};getUserGameEditions=async(t,e,i)=>{e&&e.limit&&this.validateLimitFilterOnGames(e.limit),i=i||!1;let a=this.predictorService.initGameTypePredictions("TOP_X",e),r=[],o=await this.predictorHttps.getUserPredictionsNoRemap(t,a);if(o.data.length>0){o.data.forEach(c=>{c.game_instance_id&&r.push(c.game_instance_id)});let n=e?.limit?{limit:e.limit}:null,l=this.predictorService.initGameFilters("TOP_X",n,r),p=await this.predictorHttps.getUserGameEditions(l,i);return await this.predictorService.addPredictionProp(o,p)}else return new H};getUserGamePrediction=async(t,e,i)=>{i=i||!1;let a=new V({gameIds:[e]}),r=await this.predictorHttps.getUserPredictions(t,i,a);if(r.data.length>0){let o=r.data.filter(n=>n.gameInstanceId===e);return o.length?o[0]:null}else return null};getMarketsResultsForGame=async(t,e)=>{let i=await this.predictorHttps.getMarketResultsForGame(t,e);return await this.predictorService.completeGameMarketResults(i,"TOP_X")};getGameWinners=async(t,e)=>{let i=await this.predictorHttps.getContestWinners(t,e),a=await this.getGameById(t);return i.contestModel=a,this.predictorService.completeContestWinners(i)};validateLimitFilterOnGames=t=>{if(this.errorHandlingMode==="default"&&t>50)throw new b(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.");if(this.errorHandlingMode==="standard"&&t>50)throw new h(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.")}};var ap=class{idMappingService=null;profileNamespace=null;footballNamespace=null;topXFacade=null;matchQuizFacade=null;miniGamesNamespace=null;errorHandlingMode=null;constructor(t){this.idMappingService=new R(t),this.profileNamespace=new D(t),this.footballNamespace=new it(t),this.topXFacade=new oe(t),this.matchQuizFacade=new ie(t),this.miniGamesNamespace=new re(t),this.errorHandlingMode=t.errorHandlingMode}remapTemplatesIds=async t=>{if(t.length>0){let e=[],i=[],a=[],r=[],o=[],n=[];t.forEach(c=>{c.teamIds&&c.teamIds.length>0&&(e=[...e,...c.teamIds]),c.matchIds&&c.matchIds.length>0&&(a=[...a,...c.matchIds]),c.competitionIds&&c.competitionIds.length>0&&(o=[...o,...c.competitionIds])});let l={team:e,match:a,competition:o},p=await this.idMappingService.idMappingFacade.getEntitiesByIds(l,"native",this.idMappingService.idSchema);return i=[...p.team],r=[...p.match],n=[...p.competition],t.forEach(c=>{c.teamIds&&c.teamIds.length>0&&(c.teamIds=c.teamIds.map(u=>u=p.team.shift())),c.matchIds&&c.matchIds.length>0&&(c.matchIds=c.matchIds.map(u=>u=p.match.shift())),c.competitionIds&&c.competitionIds.length>0&&(c.competitionIds=c.competitionIds.map(u=>u=p.competition.shift()))}),t}return t};remapTemplateGroupMatchIds=async t=>{if(t&&t.length>0){for(let e of t)if(!(!e.filters.matchIds||!e.filters.matchIds.every(a=>a))&&e.filters.matchIds.length>0){let a={match:Array.from(e.filters.matchIds)},r=await this.idMappingService.idMappingFacade.getEntitiesByIds(a,"native",this.idMappingService.idSchema);e.filters.matchIds=Array.from(r.match)}}};addProfileModelToLeaderboard=async t=>{if(t.length>0){let e=[],i=t.map(r=>r.profileId);if(!i.length)return t;let a=await this.profileNamespace.getByIds(i);return t.forEach(r=>{a.forEach(o=>{o.id===r.profileId&&(delete o.interests,r.profileModel=o)}),r.profileModel||(r.profileModel=null),e.push(r)}),e}return t};buildOldClientBadges=t=>{let e=new wo;return e.general=this.extractEnabledBadgesId(t.general),e.predictor=this.extractEnabledBadgesId(t.predictor),e.topX=this.extractEnabledBadgesId(t.topX),e.matchQuiz=this.extractEnabledBadgesId(t.matchQuiz),e};buildNewClientBadges=t=>{let e=new _o;return e.predictor=this.extractEnabledBadgesId(t.predictor),e.topX=this.extractEnabledBadgesId(t.topX),e.matchQuiz=this.extractEnabledBadgesId(t.matchQuiz),e.games=this.extractEnabledBadgesId(t.games),e.football=this.extractEnabledBadgesId(t.football),e.classicQuizzes=this.extractEnabledBadgesId(t.classicQuizzes),e.eitherOr=this.extractEnabledBadgesId(t.eitherOr),e.discussions=this.extractEnabledBadgesId(t.discussions),e.potm=this.extractEnabledBadgesId(t.voting.potm),e.poll=this.extractEnabledBadgesId(t.voting.poll),e};initFilters=(t,e)=>{switch(e){case"loyalty":t&&(t=new Eo(t));break;case"rankings":t&&(t=new Ro(t));break;case"league_leaderboard":t&&(t=new To(t))}return t};addProfileModelToHighestSuccessRate=async t=>{let e=t.map(a=>a.profileId);if(!e.length)return t;let i=await this.profileNamespace.getByIds(e);return t.map(a=>(i.forEach(r=>{r.id===a.profileId&&(delete r.interests,a.profileModel=r)}),a))};extractRankingsIdsMap=t=>{let e=[],i=[],a=[];return t.forEach(r=>{r.rankType==="GAME"&&r.gameType==="TOP_X"?e.push(r.id):r.rankType==="GAME"&&r.gameType==="MATCH_QUIZ"?i.push(r.id):r.rankType==="TEMPLATE"&&a.push(r.id)}),[e,i,a]};setModelsForUserRankings=(t,e,i,a)=>(a.data.forEach(r=>{r.gameType==="MATCH_QUIZ"&&e?r.model=e.filter(o=>o.id===r.id)[0]:r.gameType==="TOP_X"&&t?r.model=t.filter(o=>o.id===r.id)[0]:r.rankType==="TEMPLATE"&&i&&(r.model=i.filter(o=>o.id===r.id)[0])}),a);completeContestWinners=async t=>{if(t.userList&&t.userList.length){let e=t.userList.map(a=>a.profileId),i=await this.profileNamespace.getByIds(e);t.userList.forEach(a=>{let r=i.filter(o=>o.id===a.profileId)[0];delete r.interests,a.profileModel=r})}return t};validateEntitiesFollowsFilters=t=>{if(!t||(!t.footballCompetitions||!t.footballCompetitions.length)&&(!t.footballTeams||!t.footballTeams.length)&&(!t.footballPlayers||!t.footballPlayers.length))throw this.errorHandlingMode==="default"?new b(400,"invalid_filters","At least one of footballCompetitions, footballTeams or footballPlayers properties should be provided for filters."):new h(400,"invalid_filters","At least one of footballCompetitions, footballTeams or footballPlayers properties should be provided for filters.");if(t.footballCompetitions&&t.footballCompetitions.length>24||t.footballTeams&&t.footballTeams.length>24||t.footballPlayers&&t.footballPlayers.length>24)throw this.errorHandlingMode==="default"?new b(400,"EXCEEDED_LENGTH","Maximum length per entity should be 24 or less."):new h(400,"EXCEEDED_LENGTH","Maximum length per entity should be 24 or less.")};remapEntitiesFollowsFilters=async t=>{let e=JSON.parse(JSON.stringify(t)),i={},a={};e.footballCompetitions&&e.footballCompetitions.length&&(a.competition=e.footballCompetitions),e.footballTeams&&e.footballTeams.length&&(a.team=e.footballTeams),e.footballPlayers&&e.footballPlayers.length&&(a.player=e.footballPlayers);let r=await this.idMappingService.idMappingFacade.getEntitiesByIds(a,this.idMappingService.idSchema,"native");return Object.keys(r).forEach(o=>{o==="competition"?i.footballCompetitions=r[o]:o==="team"?i.footballTeams=r[o]:o==="player"&&(i.footballPlayers=r[o])}),i};addModelsToEntitiesFollows=async t=>{let e=[],i="fb:c:",a=new Map,r=[],o="fb:t:",n=new Map,l=[],p="fb:p:",c=null;return t.breakdown.forEach(u=>{u.id.includes(i)?e.push(u.id):u.id.includes(o)?r.push(u.id):u.id.includes(p)&&l.push(u.id)}),e.length&&(a=await this.footballNamespace.footballFacade.competitionsFacade.getCompetitionsMapWithNativeIds(e)),r.length&&(n=await this.footballNamespace.footballFacade.teamsFacade.getTeamsMapWithNativeIds(r)),l.length&&(c=await this.footballNamespace.footballFacade.playerFacade.getPlayersMapWithNativeIds(l)),t.breakdown.forEach(u=>{u.id.includes(i)?(u.model=a.get(u.id),u.id=u.model.id):u.id.includes(o)?(u.model=n.get(u.id),u.id=u.model.id):u.id.includes(p)&&(u.model=c[u.id],u.id=u.model.id)}),t};getMatchIdsFromGamesInTemplates=async(t,e)=>{if(t&&t.length>0){let o=qt(t,100),n=[];if(e&&e.length===1){if(e.includes("TOP_X"))try{n=(await Promise.all(o.map(c=>this.topXFacade.getGamesNoRemap({gameIds:c,limit:c.length},!0)))).reduce((c,u)=>[...c,...u.data],[])}catch(p){throw console.error("There was a problem fetching match IDs from Top X games",p),p}if(e.includes("MATCH_QUIZ"))try{n=(await Promise.all(o.map(c=>this.matchQuizFacade.getGamesNoRemap({gameIds:c,limit:c.length},!0)))).reduce((c,u)=>[...c,...u.data],[])}catch(p){throw console.error("There was a problem fetching match IDs from Match Quiz games",p),p}}try{n=(await Promise.all(o.map(c=>{let u=this.topXFacade.getGamesNoRemap({gameIds:c,limit:c.length},!0),d=this.matchQuizFacade.getGamesNoRemap({gameIds:c,limit:c.length},!0);return Promise.all([u,d])}))).reduce((c,[u,d])=>[...c,...u.data,...d.data],[])}catch(p){throw console.error("There was a problem fetching match IDs from both Top X and Match Quiz games",p),p}let l=new Set;return n.forEach(p=>{p.fixtures.map(u=>u.match_id).forEach(u=>l.add(u))}),Array.from(l)}let i=[],a=100;try{for(let o of e){let n=!0,l="",p=0;for(;n;){let c,u={limit:a,startAfter:l};o==="TOP_X"?(c=await this.topXFacade.getGamesNoRemap(u,!0),i=[...i,...c.data],l=c.meta.pagination.next_page_starts_after||null):o==="MATCH_QUIZ"&&(c=await this.matchQuizFacade.getGamesNoRemap(u,!0),i=[...i,...c.data],l=c.meta.pagination.next_page_starts_after||null),n=!!l,p++,p>=5&&(n=!1)}}let r=new Set;return i.forEach(o=>{o.fixtures.map(l=>l.match_id).forEach(l=>r.add(l))}),Array.from(r)}catch(r){throw console.error("There was a problem fetching match IDs from games",r),r}};initMatchFiltersForTemplates=async(t,e)=>{let i=[],a=[],r=[],o=t.fromDate?this.reformatDate(t.fromDate):null,n=t.toDate?this.reformatDate(t.toDate,!0):null,l=500;if(t.competitionIds&&t.competitionIds.length>0&&(i=Array.from(t.competitionIds)),t.teamIds&&t.teamIds.length>0&&(a=Array.from(t.teamIds)),t.matchIds&&t.matchIds.length>0&&(r=Array.from(t.matchIds)),this.isGameTemplate(t)&&(r=await this.getMatchIdsFromGamesInTemplates(t.gameIds,t.gameTypes)),e){let c=t.groups.find(d=>d.groupId===e);if(!c)throw this.errorHandlingMode==="default"?new b(400,"invalid_template_group_id","There is no group in this template with the provided groupId"):new h(400,"invalid_template_group_id","There is no group in this template with the provided groupId");if(!c.filters)throw this.errorHandlingMode==="default"?new b(400,"invalid_template_group_filters","The provided template group has no filters"):new h(400,"invalid_template_group_filters","The provided template group has no filters");o=c.filters.fromDate?this.reformatDate(c.filters.fromDate):null,n=c.filters.toDate?this.reformatDate(c.filters.toDate,!0):null;let u=c.filters.matchIds.every(d=>d);c.filters.matchIds.length>0&&u&&(r=Array.from(c.filters.matchIds))}return new gt({competitionIds:i,teamIds:a,matchIds:r,fromDate:o,toDate:n,limit:l})};isGameTemplate=t=>!!(t.gameIds&&t.gameIds.length>0||t.gameTypes&&t.gameTypes.length>0&&(t.gameTypes.includes("TOP_X")||t.gameTypes.includes("MATCH_QUIZ")));reformatDate=(t,e)=>{let i=new Date(t);e&&i.setUTCHours(23,59,59);let a=i.toISOString();return a=a.slice(0,-5)+"Z",a};extractEnabledBadgesId=t=>{let e=[];return t.forEach(i=>{i.enabled&&e.push(i.id)}),e};addEntityModelToFootballBadges=async t=>{let e=[],i=[],a=[],r=[];if(t.football&&t.football.length>0&&(e=t.football.filter(n=>n.requirements.entityType.toLocaleLowerCase()==="competition").map(n=>n.requirements.entityId),i=t.football.filter(n=>n.requirements.entityType.toLocaleLowerCase()==="team").map(n=>n.requirements.entityId),a=t.football.filter(n=>n.requirements.entityType.toLocaleLowerCase()==="player").map(n=>n.requirements.entityId),r=t.football.filter(n=>n.requirements.entityType.toLocaleLowerCase()==="match").map(n=>n.requirements.entityId)),t.voting&&t.voting.poll&&t.voting.poll.length>0){let[n,l,p,c]=this.extractEntityIdsFromBadges(t.voting.poll);e=e.concat(n),e=Array.from(new Set(e)),i=i.concat(l),i=Array.from(new Set(i)),a=a.concat(p),a=Array.from(new Set(a)),r=r.concat(c),r=Array.from(new Set(r))}if(t.voting&&t.voting.potm&&t.voting.potm.length>0){let[n,l,p,c]=this.extractEntityIdsFromBadges(t.voting.potm);e=e.concat(n),e=Array.from(new Set(e)),i=i.concat(l),i=Array.from(new Set(i)),a=a.concat(p),a=Array.from(new Set(a)),r=r.concat(c),r=Array.from(new Set(r))}let o=await this.fetchFootballEntities(e,i,a,r);t.football&&t.football.length>0&&t.football.forEach(n=>{this.setEntityModelsFromMap(n.requirements,"competition",o.competitions),this.setEntityModelsFromMap(n.requirements,"team",o.teams),this.setEntityModelsFromObject(n.requirements,"player",o.players),this.setEntityModelsFromObject(n.requirements,"match",o.matches)}),t.voting&&t.voting.poll&&t.voting.poll.length>0&&t.voting.poll.forEach(n=>{this.setEntityModelsFromMap(n.requirements,"competition",o.competitions),this.setEntityModelsFromMap(n.requirements,"team",o.teams),this.setEntityModelsFromObject(n.requirements,"player",o.players),this.setEntityModelsFromObject(n.requirements,"match",o.matches)}),t.voting&&t.voting.potm&&t.voting.potm.length>0&&t.voting.potm.forEach(n=>{this.setEntityModelsFromMap(n.requirements,"competition",o.competitions),this.setEntityModelsFromMap(n.requirements,"team",o.teams),this.setEntityModelsFromObject(n.requirements,"player",o.players),this.setEntityModelsFromObject(n.requirements,"match",o.matches)})};setEntityModelsFromMap=(t,e,i)=>{t.entityType===e&&(t.entityModel=i&&i.get(t.entityId)||null,t.entityModel&&(t.entityId=t.entityModel.id))};setEntityModelsFromObject=(t,e,i)=>{t.entityType===e&&(t.entityModel=i[t.entityId]?i[t.entityId]:null,t.entityModel&&(t.entityId=t.entityModel.id))};fetchFootballEntities=async(t,e,i,a)=>{let r={competitions:null,teams:null,players:null,matches:null};if(t.length){let o=await this.footballNamespace.footballFacade.getCompetitionsMapWithNativeIds(t);r.competitions=o}if(e.length){let o=await this.footballNamespace.footballFacade.getTeamsMapWithNativeIds(e);r.teams=o}if(i.length){let o=await this.footballNamespace.footballFacade.getPlayersMapWithNativeIds(i);r.players=o}if(a.length){let o=await this.footballNamespace.footballFacade.getMatchesMapWithNativeIds(a);r.matches=o}return r};extractEntityIdsFromBadges=t=>{let e=t.filter(o=>o.requirements.entityType&&o.requirements.entityType.toLocaleLowerCase()==="competition").map(o=>o.requirements.entityId),i=t.filter(o=>o.requirements.entityType&&o.requirements.entityType.toLocaleLowerCase()==="team").map(o=>o.requirements.entityId),a=t.filter(o=>o.requirements.entityType&&o.requirements.entityType.toLocaleLowerCase()==="player").map(o=>o.requirements.entityId),r=t.filter(o=>o.requirements.entityType&&o.requirements.entityType.toLocaleLowerCase()==="match").map(o=>o.requirements.entityId);return[e,i,a,r]};addGameModelToGamesBadges=async t=>{if(!t.games||t.games.length===0)return;let e=this.getGameIdsFromGamesBadge(t.games,"top_x"),i=this.getGameIdsFromGamesBadge(t.games,"match_quiz"),a=this.getGameIdsFromGamesBadge(t.games,"classic_quiz"),r=this.getGameIdsFromGamesBadge(t.games,"either_or"),o=await this.fetchGamesEntities(e,i,a,r);t.games.forEach(n=>{n.requirements.specificGames&&n.requirements.specificGames.forEach(l=>{l.gameModel=o.find(p=>p.id===l.gameId)||null})})};getGameIdsFromGamesBadge=(t,e)=>{let i=t.filter(a=>a.requirements.specificGames?a.requirements.specificGames.some(r=>r.gameType.toLocaleLowerCase()===e):!1).map(a=>a.requirements.specificGames.map(r=>r.gameId));return Array.prototype.concat.apply([],i)};fetchGamesEntities=async(t,e,i,a)=>{let r=[];if(t.length){let o=await this.topXFacade.getGames({gameIds:t});r=[...r,...o.data]}if(e.length){let o=await this.matchQuizFacade.getGames({gameIds:e});r=[...r,...o.data]}if(i.length){let o=await this.miniGamesNamespace.getClassicQuizzes({classicQuizIds:i});r=[...r,...o.data]}if(a.length){let o=await this.miniGamesNamespace.getEitherOrs({eitherOrIds:a});r=[...r,...o.data]}return r}};var rp=class{validate=(t,e)=>{t.market&&this.validateMarket(t.market,e),t.fromDate&&this.validateDate(t.fromDate,"fromDate",e),t.toDate&&this.validateDate(t.toDate,"toDate",e),t.usersCount&&this.validateNumberFilters(t.usersCount,"usersCount",e),t.minimumPredictions&&this.validateNumberFilters(t.minimumPredictions,"minimumPredictions",e)};validateMarket=(t,e)=>{if(!Object.keys(rt).includes(t)){let a=Zp(t);throw e==="default"?new b(400,"INVALID_MARKET",a):new h(400,"INVALID_MARKET",a)}};validateDate=(t,e,i)=>{let a=/^\d{4}-\d{2}-\d{2}$/;if(typeof t!="string")throw i==="default"?new b(400,"invalid_filters","You have provided invalid type. The valid type is "+`string for ${e} filter`):new h(400,"invalid_filters","You have provided invalid type. The valid type is "+`string for ${e} filter`);if(!a.test(t))throw i==="default"?new b(400,"invalid_filters","You have provided invalid value. The valid value is "+`YYYY-MM-DD for ${e}`):new h(400,"invalid_filters","You have provided invalid value. The valid value is "+`YYYY-MM-DD for ${e}`)};validateNumberFilters=(t,e,i)=>{let a=e==="usersCount"?1:0,r=e==="usersCount"?1e3:1e6;if(typeof t!="number")throw i==="default"?new b(400,"invalid_filters","You have provided invalid type. The valid type is "+`number for ${e} filter`):new h(400,"invalid_filters","You have provided invalid type. The valid type is "+`number for ${e} filter`);if(t<a||t>r)throw i==="default"?new b(400,"invalid_filters","You have provided invalid value. The valid value is "+`between ${a} and ${r}`):new h(400,"invalid_filters","You have provided invalid value. The valid value is "+`between ${a} and ${r}`)}};var op=class{limit=null;page=null;groupId=null;constructor(t){this.limit=t?.limit||null,this.page=t?.page||null,t?.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 t="";return this.limit&&(t+="&",t+=`limit=${this.limit}`),this.page&&(t+="&",t+=`page=${this.page}`),t}};var sp=class{config=null;clientHttps=null;loyaltyHttps=null;loyaltyService=null;profileFacade=null;loyaltyValidator=null;topXFacade=null;matchQuizFacade=null;predictorHttps=null;errorHandlingMode=null;football=null;constructor(t,e,i,a,r){this.config=t,this.clientHttps=e,this.loyaltyHttps=i,this.profileFacade=new _t(r,a),this.loyaltyService=new ap(this.config),this.loyaltyValidator=new rp,this.topXFacade=new oe(t),this.matchQuizFacade=new ie(t),this.predictorHttps=new mt(t),this.errorHandlingMode=t.errorHandlingMode,this.football=new it(t)}getConfig=async()=>await this.clientHttps.getConfig("loyalty");getConfigV2=async t=>{let e=await this.clientHttps.getNewLoyaltyConfig(t);return await this.loyaltyService.addEntityModelToFootballBadges(e.rewards.badges),await this.loyaltyService.addGameModelToGamesBadges(e.rewards.badges),e};getClientBadges=async()=>{let t=await this.getConfig();return this.loyaltyService.buildOldClientBadges(t.rewards.badges)};getClientBadgesV2=async t=>{let e=await this.clientHttps.getNewLoyaltyConfig(t);return this.loyaltyService.buildNewClientBadges(e.rewards.badges)};getTemplates=async(t,e)=>{if(t&&(t=new Fo(t)),this.config.idSchema==="native")return await this.loyaltyHttps.getTemplates(t,e);let i=await this.loyaltyHttps.getTemplates(t,e);i.data=await this.loyaltyService.remapTemplatesIds([...i.data]);for(let a of i.data)await this.loyaltyService.remapTemplateGroupMatchIds(a.groups);return i};getTemplateById=async(t,e)=>{let i=await this.loyaltyHttps.getTemplateById(t,e);if(this.config.idSchema==="native")return i;let a=await this.loyaltyService.remapTemplatesIds([i]);return await this.loyaltyService.remapTemplateGroupMatchIds(a[0].groups),a[0]};getLeaderboard=async(t,e,i)=>{e=this.loyaltyService.initFilters(e,"loyalty");let a=await this.loyaltyHttps.getLeaderboard(t,i,e);return a.data=await this.loyaltyService.addProfileModelToLeaderboard(a.data),a};getLeaderboardForGame=async(t,e,i)=>{e&&(e=new op(e));let a=await this.loyaltyHttps.getLeaderboardForGame(t,i,e);return a.data=await this.loyaltyService.addProfileModelToLeaderboard(a.data),a};getLeaderboardForLeague=async(t,e)=>{e=this.loyaltyService.initFilters(e,"league_leaderboard");let i=await this.loyaltyHttps.getLeaderboardForLeague(t,e);return i.data=await this.loyaltyService.addProfileModelToLeaderboard(i.data),i};getOwnRankings=async(t,e)=>{let{id:i}=await this.profileFacade.getOwn();return this.getUserRankings(i,t,e)};getUserRankings=async(t,e,i)=>{e=this.loyaltyService.initFilters(e,"rankings");let a=await this.loyaltyHttps.getUserRankings(t,e,i);return await this.getModelsForUserRankings(a)};getHighestSuccessRate=async(t,e)=>{t&&(t=new Po(t),this.loyaltyValidator.validate(t,this.errorHandlingMode));let i=await this.loyaltyHttps.getHighestSuccessRate(t,e);return this.loyaltyService.addProfileModelToHighestSuccessRate(i)};getTemplateWinners=async(t,e)=>{let i=await this.predictorHttps.getContestWinners(t,e),a=await this.getTemplateById(t);return i.contestModel=a,this.loyaltyService.completeContestWinners(i)};getEntitiesFollows=async(t,e)=>{this.loyaltyService.validateEntitiesFollowsFilters(t),this.config.idSchema!=="native"&&(t=await this.loyaltyService.remapEntitiesFollowsFilters(t));let i=await this.loyaltyHttps.getEntitiesFollows(t,e);return await this.loyaltyService.addModelsToEntitiesFollows(i)};getModelsForUserRankings=async t=>{let e=null,i=null,a=null,[r,o,n]=this.loyaltyService.extractRankingsIdsMap(t.data);if(n.length&&(e=(await this.getTemplates()).data.filter(p=>n.includes(p.id))),r.length){let l={gameIds:r};i=(await this.topXFacade.getGames(l)).data}if(o.length){let l={gameIds:o};a=(await this.matchQuizFacade.getGames(l)).data}return this.loyaltyService.setModelsForUserRankings(i,a,e,t)};getTemplateMatches=async(t,e,i)=>{let a=await this.getTemplateById(t,i);if((!a.competitionIds||a.competitionIds.length===0)&&(!a.teamIds||a.teamIds.length===0)&&(!a.matchIds||a.matchIds.length===0)&&(!a.gameIds||a.gameIds.length===0)&&(!a.gameTypes||a.gameTypes.length===0)&&(!a.groups||a.groups.length===0))return[];let r=await this.loyaltyService.initMatchFiltersForTemplates(a,e);return(await this.football.getMatches(r,i)).data}};var se=class{clientHttps=null;profileHttps=null;loyaltyHttps=null;loyaltyFacade=null;localCache=null;constructor(t){this.clientHttps=new Q(t),this.profileHttps=new Mi(t),this.loyaltyHttps=new Rt(t),this.localCache=new ct().createLocalCacheInstance(t.idSchema),this.loyaltyFacade=new sp(t,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 t=>await this.loyaltyFacade.getConfigV2(t);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 t=>await this.loyaltyFacade.getClientBadgesV2(t);getTemplates=async(t,e)=>await this.loyaltyFacade.getTemplates(t,e);getTemplateById=async(t,e)=>await this.loyaltyFacade.getTemplateById(t,e);getLeaderboard=async(t,e,i)=>await this.loyaltyFacade.getLeaderboard(t,e,i);getLeaderboardForGame=async(t,e,i)=>await this.loyaltyFacade.getLeaderboardForGame(t,e,i);getLeaderboardForLeague=async(t,e)=>await this.loyaltyFacade.getLeaderboardForLeague(t,e);getOwnRankings=async(t,e)=>await this.loyaltyFacade.getOwnRankings(t,e);getUserRankings=async(t,e,i)=>await this.loyaltyFacade.getUserRankings(t,e,i);getHighestSuccessRate=async(t,e)=>await this.loyaltyFacade.getHighestSuccessRate(t,e);getTemplateWinners=async(t,e)=>await this.loyaltyFacade.getTemplateWinners(t,e);getEntitiesFollows=async(t,e)=>await this.loyaltyFacade.getEntitiesFollows(t,e);getTemplateMatches=async(t,e,i)=>await this.loyaltyFacade.getTemplateMatches(t,e,i)};var np=class{predictorHttps=null;clientHttps=null;idMapping=null;predictorService=null;predictorValidator=null;errorHandlingMode=null;constructor(t,e,i,a){this.predictorHttps=e,this.idMapping=a,this.clientHttps=i,this.errorHandlingMode=t.errorHandlingMode,this.predictorValidator=new ee(t.errorHandlingMode),this.predictorService=new St(t,a)}makeFootballPrediction=async(t,e,i,a)=>{let r=this.predictorValidator.validateFixture(t,e,i,a),o=new ei;if(this.idMapping.idSchema!=="native"){let n=r.matchId,l="",p=await this.predictorService.remapMatchIdToNative([n]);if(r.matchId=p[0],this.errorHandlingMode==="default"&&!r.matchId)throw new b(400,"INVALID_FIELD","Match id is invalid!").errorMessage();if(this.errorHandlingMode==="standard"&&!r.matchId)throw new h(400,"INVALID_FIELD","Match id is invalid!");if(r instanceof st&&r.prediction.playerId!=="OWN_GOAL"){if(r.prediction.playerId&&(l=r.prediction.playerId,r.prediction.playerId=await this.predictorService.remapPlayerIdToNative([l])),this.errorHandlingMode==="default"&&r.market!==ji&&!r.prediction.playerId)throw new b(400,"INVALID_FIELD","Player id is invalid!").errorMessage();if(this.errorHandlingMode==="standard"&&r.market!==ji&&!r.prediction.playerId)throw new h(400,"INVALID_FIELD","Player id is invalid!")}o.fixtures=[r];let c=await this.predictorHttps.makeFootballPrediction(o);return c.fixtures.forEach(u=>{u.prediction.playerId&&u.prediction.playerId!=="OWN_GOAL"&&(u.prediction.playerId=l),u.matchId=n}),c}else return o.fixtures=[r],await this.predictorHttps.makeFootballPrediction(o)};getMatchSummary=async(t,e)=>{let i=await this.getMatchSummaryBase(t,e),a=JSON.parse(JSON.stringify(i.predictions)),r=await this.predictorService.remapPlayerIdToIdSchema(a);return i.predictions=r,i};getMarketSummary=async(t,e,i,a)=>{try{let r=await this.getMatchSummaryBase(t,a);return await this.predictorService.getMarketSummary(r,e,i)}catch(r){throw r}};getMatchSummaryBase=async(t,e)=>{if(this.idMapping.idSchema!=="native"){let a=(await this.predictorService.remapMatchIdToNative([t]))[0],r=await this.predictorHttps.getMatchSummary(a,e);return r.matchId=t,r}else return await this.predictorHttps.getMatchSummary(t,e)};getConfig=async()=>{let t=await this.clientHttps.getConfig("predictor");return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(t):t};deleteFootballPrediction=async t=>await this.predictorHttps.deleteFootballPrediction(t);getMyPredictions=async t=>{let e=this.predictorService.initPredictionsFilters(t,"user");return await this.predictorHttps.getMyPredictions(e)};getMyPredictionsForMatches=async(t,e)=>{if(this.errorHandlingMode==="default"&&this.predictorService.areIdsExceeded(t))throw new b(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.").errorMessage();if(this.errorHandlingMode==="standard"&&this.predictorService.areIdsExceeded(t))throw new h(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.");this.idMapping.idSchema!=="native"&&(t=await this.predictorService.remapMatchIdToNative([...t]));let i=this.predictorService.initPredictionsFilters(e,"matches",t);return await this.predictorHttps.getMyPredictions(i)};getMyCurrentPredictions=async t=>{let e=this.predictorService.initPredictionsFilters(t,"current");return await this.predictorHttps.getMyPredictions(e)};getMyPastPredictions=async t=>{let e=this.predictorService.initPredictionsFilters(t,"past");return await this.predictorHttps.getMyPredictions(e)};getUserPredictions=async(t,e,i)=>{let a=this.predictorService.initPredictionsFilters(e,"user");return await this.predictorHttps.getUserPredictions(t,i,a)};getUserCurrentPredictions=async(t,e,i)=>{let a=this.predictorService.initPredictionsFilters(e,"current");return await this.predictorHttps.getUserPredictions(t,i,a)};getUserPastPredictions=async(t,e,i)=>{let a=this.predictorService.initPredictionsFilters(e,"past");return await this.predictorHttps.getUserPredictions(t,i,a)};getUserPredictionsForMatches=async(t,e,i,a)=>{if(this.errorHandlingMode==="default"&&this.predictorService.areIdsExceeded(e))throw new b(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.").errorMessage();if(this.errorHandlingMode==="standard"&&this.predictorService.areIdsExceeded(e))throw new h(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.");this.idMapping.idSchema!=="native"&&(e=await this.predictorService.remapMatchIdToNative([...e]));let r=this.predictorService.initPredictionsFilters(i,"matches",e);return await this.predictorHttps.getUserPredictions(t,a,r)};getPredictionById=async t=>await this.predictorHttps.getPredictionById(t);getPredictionsByIds=async t=>await this.predictorHttps.getPredictionsByIds(t);getMatchMarketsResults=async t=>(this.idMapping.idSchema!=="native"&&(t=(await this.predictorService.remapMatchIdToNative([t]))[0]),await this.predictorService.getMatchMarketsResults(t))};var lp=class extends K{constructor(t){super(t.errorHandlingMode)}validateMatchSummary=t=>{t||this.throwException(400,"invalid_match_summary","Match summary is required."),t.predictions||this.throwException(400,"invalid_match_summary_predictions","Predictions in match summary are required."),(!t.predictions.correctScore||!t.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")}};var pp=class{validator=null;constructor(t){this.validator=new lp(t)}calculateOneXTwoFromScores=t=>{this.validator.validateMatchSummary(t);let{correctScore:e,correctScoreAdvanced:i}=t.predictions,a={...e,...i},r=0,o=0,n=0,l=0;return Object.entries(a).forEach(([p,c])=>{if(c===0)return;let u=c;r+=u;let[d,M]=p.split(":").map(Number);d>M?o+=u:d===M?n+=u:l+=u}),{home:r?Math.round(o/r*100):0,draw:r?Math.round(n/r*100):0,away:r?Math.round(l/r*100):0}};getTopCorrectScores=t=>{this.validator.validateMatchSummary(t);let{correctScore:e,correctScoreAdvanced:i}=t.predictions,a={...e,...i},r=0;return Object.values(a).forEach(o=>{r+=o}),Object.entries(a).filter(([o,n])=>n>0).map(([o,n])=>({score:o,percentage:Math.round(n/r*100)})).sort((o,n)=>n.percentage-o.percentage).slice(0,3)}};var ki=class{predictorHttps=null;clientHttps=null;predictorFacade=null;idMapping=null;helpers=null;constructor(t){this.idMapping=new R(t),this.predictorHttps=new mt(t),this.clientHttps=new Q(t),this.predictorFacade=new np(t,this.predictorHttps,this.clientHttps,this.idMapping),this.helpers=new pp(t)}makeFootballPrediction=async(t,e,i,a)=>await this.predictorFacade.makeFootballPrediction(t,e,i,a);getMatchSummary=async(t,e)=>await this.predictorFacade.getMatchSummary(t,e);getMarketSummary=async(t,e,i,a)=>await this.predictorFacade.getMarketSummary(t,e,i,a);getConfig=async()=>await this.predictorFacade.getConfig();deleteFootballPrediction=async t=>await this.predictorFacade.deleteFootballPrediction(t);getMyPredictions=async t=>await this.predictorFacade.getMyPredictions(t);getMyCurrentPredictions=async t=>await this.predictorFacade.getMyCurrentPredictions(t);getMyPastPredictions=async t=>await this.predictorFacade.getMyPastPredictions(t);getMyPredictionsForMatches=async(t,e)=>await this.predictorFacade.getMyPredictionsForMatches(t,e);getUserPredictions=async(t,e,i)=>await this.predictorFacade.getUserPredictions(t,e,i);getUserCurrentPredictions=async(t,e,i)=>await this.predictorFacade.getUserCurrentPredictions(t,e,i);getUserPastPredictions=async(t,e,i)=>await this.predictorFacade.getUserPastPredictions(t,e,i);getUserPredictionsForMatches=async(t,e,i,a)=>await this.predictorFacade.getUserPredictionsForMatches(t,e,i,a);getPredictionById=async t=>await this.predictorFacade.getPredictionById(t);getPredictionsByIds=async t=>await this.predictorFacade.getPredictionsByIds(t);getMatchMarketsResults=async t=>await this.predictorFacade.getMatchMarketsResults(t)};var Gi=class{loyalty=null;profile=null;predictor=null;constructor(t){this.loyalty=new se(t),this.profile=new D(t),this.predictor=new ki(t)}setTemplateModels=async t=>{let e=await this.loyalty.getTemplates();t.templateModel=e.data.find(i=>i.id===t.templateId),t.pastTemplates&&t.pastTemplates.length>0&&t.pastTemplates.forEach(i=>{i.model=e.data.find(a=>a.id===i.id)})};setTemplateModelsInLeagues=async t=>{if(!t.length)return;let e=await this.loyalty.getTemplates();t.forEach(i=>{i.templateModel=e.data.find(a=>a.id===i.templateId),i.pastTemplates&&i.pastTemplates.length>0&&i.pastTemplates.forEach(a=>{a.model=e.data.find(r=>r.id===a.id)})})};setTemplateModelsFromLeagueModels=(t,e)=>{if(e==="PRIVATE_LEAGUE"){t.forEach(i=>{i.templateModel=i.templateId===i.privateLeagueModel.templateId?i.privateLeagueModel.templateModel:i.privateLeagueModel.pastTemplates.find(a=>a.id===i.templateId).model});return}t.forEach(i=>{i.templateModel=i.templateId===i.challengeModel.templateId?i.challengeModel.templateModel:i.challengeModel.pastTemplates.find(a=>a.id===i.templateId).model})};setProfileModel=async t=>{let e=await this.profile.getById(t.profileId).getInfo();t.profileModel=e};setModelsForPredictions=async t=>{if(t.data.length){let e=t.data.map(o=>o.profileId),i=t.data.map(o=>o.predictionId),a=await this.getProfileModels(e),r=await this.getPredictionModels(i);t.data.forEach(o=>{o.profileModel=a.find(n=>n.id===o.profileId),o.predictionModel=r.find(n=>n.id===o.predictionId)})}return t};getProfileModels=async t=>await this.profile.getByIds(t);getPredictionModels=async t=>await this.predictor.getPredictionsByIds(t)};var ne=class{idSchema=null;profile=null;validator=null;idMapping=null;constructor(t){this.idSchema=t.idSchema,this.profile=new D(t),this.validator=new ae(t),this.idMapping=new R(t)}finalizePostFullModel=async t=>{let e=t.map(a=>a.userId),i=await this.profile.getByIds(e);return t.map(a=>(a.userModel=this.extractModelById(i,a.userId),a))};finalizeTopDiscussionsFilters=async t=>{if(this.idSchema!=="native"&&t.entityIds&&t.entityIds.length>0){this.validator.validateFilters(t);let e=await this.idMapping.getEntityIdsBySchemaId(Array.from(t.entityIds),t.entityType,"native");t.entityIds=e[t.entityType]}};extractModelById=(t,e)=>{if(t.length){let i=t.find(a=>a.id===e);return i?(delete i.interests,i):null}return null}};var cp=class{factory=null;https=null;loyaltyHttps=null;profile=null;service=null;discussionsService=null;constructor(t){this.factory=new Di,this.https=new Li(t),this.service=new Gi(t),this.loyaltyHttps=new Rt(t),this.profile=new D(t),this.discussionsService=new ne(t)}issue=async(t,e)=>{let i=this.factory.createRequestBodyFromParam(t,"ONE_VS_ONE"),a=await this.https.create(i,"CHALLENGE");await this.service.setTemplateModels(a);let r=await this.https.invite(a.id,[e]);return a.invites=[],a.invites.push(r[0]),a};update=async(t,e)=>{let i=this.factory.createUpdateRequestBodyFromParam(e,"ONE_VS_ONE"),a=await this.https.update(t,i,"CHALLENGE");return await this.service.setTemplateModels(a),a};updateTemplate=async(t,e,i)=>{let a=await this.https.updateLeagueTemplate(t,e,i,"CHALLENGE");return await this.service.setTemplateModels(a),a};delete=async t=>await this.https.delete(t,"CHALLENGE");getById=async(t,e)=>{let i=await this.https.getById(t,"CHALLENGE",e);return await this.service.setTemplateModels(i),i};getMyChallenges=async t=>{t=new _r(t);let e=await this.https.getMyLeagues(t,"CHALLENGE");return await this.service.setTemplateModelsInLeagues(e),e};accept=async t=>{let i=await this.https.accept(t,!0,"CHALLENGE");return await this.finalizeAcceptModel(i,!0)};reject=async t=>{let i=await this.https.accept(t,!1,"CHALLENGE");return await this.finalizeAcceptModel(i,!1)};leave=async t=>await this.https.leave(t,"CHALLENGE");finalizeAcceptModel=async(t,e)=>{if(e){let i=await this.getById(t.challengeId);t.challengeModel=i}return await this.service.setProfileModel(t),t};getMyChallengesStandings=async t=>{t&&(t=new wr(t));let e=await this.profile.getOwn().getInfo(),i=await this.loyaltyHttps.getUserRankingsForPrivateLeagueAndChallenges(e.id,"CHALLENGE",t);for(let a of i.data){let r=await this.getById(a.challengeId);a.challengeModel=r}return this.service.setTemplateModelsFromLeagueModels(i.data,"CHALLENGE"),i};getInvitations=async t=>{t=new ai(t),t.type="ONE_VS_ONE";let e=await this.https.getInvitations("CHALLENGE",t);return await this.service.setTemplateModelsInLeagues(e.data),e};getReportedPosts=async(t,e)=>{e&&(e=new ri(e));let i=await this.https.getReportedPosts(t,e);return i.data=await this.discussionsService.finalizePostFullModel(i.data),i};getPredictions=async(t,e)=>{if(e){if(e.limit&&e.limit>20)throw new h(400,"invalid_limit","Invalid limit. The maximum limit is: "+20 .toString());e=new oi(e)}let i=await this.https.getPredictions(t,e);return await this.service.setModelsForPredictions(i)};moderatePost=async(t,e)=>await this.https.moderatePost(t,e)};var up=class{facade=null;constructor(t){this.facade=new cp(t)}issue=async(t,e)=>await this.facade.issue(t,e);update=async(t,e)=>await this.facade.update(t,e);updateTemplate=async(t,e,i)=>await this.facade.updateTemplate(t,e,i);delete=async t=>await this.facade.delete(t);getById=async(t,e)=>await this.facade.getById(t,e);getMyChallenges=async t=>await this.facade.getMyChallenges(t);accept=async t=>await this.facade.accept(t);reject=async t=>await this.facade.reject(t);leave=async t=>await this.facade.leave(t);getMyChallengesStandings=async t=>await this.facade.getMyChallengesStandings(t);getInvitations=async t=>await this.facade.getInvitations(t);getReportedPosts=async(t,e)=>await this.facade.getReportedPosts(t,e);getPredictions=async(t,e)=>await this.facade.getPredictions(t,e);moderatePost=async(t,e)=>await this.facade.moderatePost(t,e)};var dp=class extends v{remapper=null;constructor(t){super(t,O(t.environment,"discussions")),this.remapper=new xi}getAll=async(t,e)=>{let i="/discussions"+this.apiSignInUrl;t&&(i+=`${t.constructMainFiltersUrl()}`),f(e)&&(i+=m());let a="There was a problem getting discussions",r=await this.fetchWithoutAuth(i,a);return this.remapper.remapToDiscussions(r)};getById=async t=>{let e=`/discussions/${t}`+this.apiSignInUrl,i="There was a problem getting discussion",a=await this.fetchWithoutAuth(e,i);return this.remapper.remapToDiscussionById(a.data)};createPost=async(t,e)=>{let i=`/discussions/${t}/posts`+this.apiSignInUrl,a="There was a problem creating post in discussion",r="POST",o=await this.fetchWithAuth(i,a,r,e);return this.remapper.remapToPostByIdBasic(o.data)};getPostById=async t=>{let e=`/posts/${t}`+this.apiSignInUrl,i="There was a problem getting post by ID in discussion",a=await this.fetchWithoutAuth(e,i);return this.remapper.remapToPostByIdFull(a.data)};updatePost=async(t,e)=>{let i=`/posts/${t}`+this.apiSignInUrl,a="There was a problem editing post in discussion",r="PUT",o={content:e},n=await this.fetchWithAuth(i,a,r,o);return this.remapper.remapToPostByIdBasic(n.data)};reactToPost=async(t,e)=>{let i=`/posts/${t}/reaction`+this.apiSignInUrl,a="There was a problem reacting to post in discussion",r="PUT",o={reaction:e.toLocaleLowerCase()},n=await this.fetchWithAuth(i,a,r,o);return this.remapper.remapToPostByIdFull(n.data)};deletePost=async t=>{let e=`/posts/${t}`+this.apiSignInUrl,i="There was a problem deleting post in discussion",a="DELETE";return await this.fetchWithAuth(e,i,a),!0};getPosts=async(t,e)=>{let i=`/discussions/${t}/posts`+this.apiSignInUrl;e&&(i+=`${e.constructMainFiltersUrl()}`);let a="There was a problem getting posts in discussion",r=await this.fetchWithoutAuth(i,a);return this.remapper.remapToPostsForDiscussion(r,"full")};getPostReplies=async(t,e)=>{let i=`/posts/${t}/replies`+this.apiSignInUrl;e&&(i+=`${e.constructMainFiltersUrl()}`);let a="There was a problem getting post's replies in discussion",r=await this.fetchWithoutAuth(i,a);return this.remapper.remapToPostsForDiscussion(r,"full")};reportPost=async(t,e,i)=>{let a=`/posts/${t}/report`+this.apiSignInUrl,r="There was a problem reporting post in discussion",o="POST",n={reason:e.toLocaleUpperCase(),reason_details:i||null},l=await this.fetchWithAuth(a,r,o,n);return this.remapper.remapToPostByIdBasic(l.data)};getOwnPosts=async t=>{let e="/posts"+this.apiSignInUrl;t&&(e+=`${t.constructMainFiltersUrl()}`);let i="There was a problem getting own posts",a=await this.fetchWithAuth(e,i);return this.remapper.remapToPosts(a)};getUserPosts=async(t,e,i)=>{let a=`/posts/users/${t}`+this.apiSignInUrl;e&&(a+=`${e.constructMainFiltersUrl()}`),f(i)&&(a+=m());let r="There was a problem getting user's posts",o=await this.fetchWithoutAuth(a,r);return this.remapper.remapToPosts(o)};getPostsCount=async(t,e)=>{let i="/discussions/posts/count"+this.apiSignInUrl+`&discussion_ids=${t.join(",")}`;f(e)&&(i+=m());let a="There was a problem getting posts count for discussions",r=await this.fetchWithoutAuth(i,a);return this.remapper.remapToPostCount(r.data)};getTopDiscussions=async(t,e)=>{let i="/discussions/top"+this.apiSignInUrl;t&&(i+=`${t.constructMainFiltersUrl()}`),f(e)&&(i+=m());let a="There was a problem getting top discussions",r=await this.fetchWithoutAuth(i,a);return this.remapper.remapToDiscussions(r)};getPostsCountExtended=async t=>{let e="/discussions/posts/count"+this.apiSignInUrl,i={discussion_ids:Array.from(t)},a="POST",r="There was a problem getting posts count extended for discussions",o=await this.fetchWithoutAuth(e,r,a,i);return this.remapper.remapToPostCount(o.data)}};var mp=class{createRequestBodyFromParam=t=>{let e=new Rr;return e.content=t.content,e.reply_id=t.replyId,e.discussion_label=t.discussionLabel,e.discussion_url=t.discussionUrl,e.anonymous_nickname=t.userNickname,e.context=t.context,e}};var hp=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(t){this.idSchema=t.idSchema,this.errorHandlingMode=t.errorHandlingMode,this.https=new dp(t),this.clientHttps=new Q(t),this.activityService=new wt(t),this.service=new ne(t),this.factory=new mp}getAll=async(t,e)=>{t&&(t=new Lr(t));let i=await this.https.getAll(t,e);for(let a of i.data)await this.remapTags(a,"native",this.idSchema);return i};getById=async t=>{let e=await this.https.getById(t);return await this.remapTags(e,"native",this.idSchema),e};createPost=async(t,e)=>{let i=JSON.parse(JSON.stringify(e));await this.remapTags(i,this.idSchema,"native");let a=this.factory.createRequestBodyFromParam(i);return await this.https.createPost(t,a)};getPostById=async t=>{let e=await this.https.getPostById(t);return(await this.service.finalizePostFullModel([e]))[0]};updatePost=async(t,e)=>await this.https.updatePost(t,e);deletePost=async t=>await this.https.deletePost(t);getPosts=async(t,e)=>{e&&(e=new Yt(e));let i=await this.https.getPosts(t,e);return i.data=await this.service.finalizePostFullModel(i.data),i};getPostReplies=async(t,e)=>{e&&(e=new Yt(e));let i=await this.https.getPostReplies(t,e);return i.data=await this.service.finalizePostFullModel(i.data),i};reactToPost=async(t,e)=>{let i=await this.https.reactToPost(t,e);return(await this.service.finalizePostFullModel([i]))[0]};reportPost=async(t,e,i)=>await this.https.reportPost(t,e,i);getOwnPosts=async t=>(t&&(t=new Yt(t)),await this.https.getOwnPosts(t));getUserPosts=async(t,e,i)=>(e&&(e=new Yt(e)),await this.https.getUserPosts(t,e,i));getConfig=async()=>await this.clientHttps.getConfig("discussions");getPostsCount=async(t,e)=>{if(!t||!Array.isArray(t)||!t.length)throw this.errorHandlingMode==="standard"?new h(400,"invalid_discussion_ids","Invalid discussion ids argument. Please provide at least one discussion id in an array"):new b(400,"invalid_discussion_ids","Invalid discussion ids argument. Please provide at least one discussion id in an array");if(t.length>this.LIMIT_POSTS_COUNT)throw this.errorHandlingMode==="standard"?new h(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 b(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(t,e)};getTopDiscussions=async(t,e)=>{t&&(t=new Dr(t),await this.service.finalizeTopDiscussionsFilters(t));let i=await this.https.getTopDiscussions(t,e);for(let a of i.data)await this.remapTags(a,"native",this.idSchema);return i};getPostsCountExtended=async t=>{if(!t||!Array.isArray(t)||!t.length)throw this.errorHandlingMode==="standard"?new h(400,"invalid_discussion_ids","Invalid discussion ids argument. Please provide at least one discussion id in an array"):new b(400,"invalid_discussion_ids","Invalid discussion ids argument. Please provide at least one discussion id in an array");if(t.length>this.LIMIT_POSTS_COUNT_EXTENDED)throw this.errorHandlingMode==="standard"?new h(400,"invalid_discussion_ids","Maximum number of discussion ids exceeded. The maximum number of discussion ids is: "+this.LIMIT_POSTS_COUNT_EXTENDED):new b(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(t)};remapTags=async(t,e,i)=>{if(this.idSchema!="native"&&t.context&&t.context.tags&&t.context.tags.length){let a=JSON.parse(JSON.stringify(t.context.tags)),r=await this.activityService.remapTagsIds(a,e,i);t.context.tags=r}}};var fp=class{facade=null;constructor(t){this.facade=new hp(t)}getAll=async(t,e)=>await this.facade.getAll(t,e);getById=async t=>await this.facade.getById(t);createPost=async(t,e)=>await this.facade.createPost(t,e);getPostById=async t=>await this.facade.getPostById(t);updatePost=async(t,e)=>await this.facade.updatePost(t,e);deletePost=async t=>await this.facade.deletePost(t);getPosts=async(t,e)=>await this.facade.getPosts(t,e);getPostReplies=async(t,e)=>await this.facade.getPostReplies(t,e);react=async(t,e)=>await this.facade.reactToPost(t,e);reportPost=async(t,e,i)=>await this.facade.reportPost(t,e,i);getOwnPosts=async t=>await this.facade.getOwnPosts(t);getUserPosts=async(t,e,i)=>await this.facade.getUserPosts(t,e,i);getConfig=async()=>await this.facade.getConfig();getPostsCount=async(t,e)=>await this.facade.getPostsCount(t,e);getTopDiscussions=async(t,e)=>await this.facade.getTopDiscussions(t,e);getPostsCountExtended=async t=>await this.facade.getPostsCountExtended(t)};var gp=class extends K{constructor(t){super(t)}validatePrediction=t=>{(!t.fixtures||!Array.isArray(t.fixtures)||t.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 e=["id","predictionType","prediction"];for(let i of t.fixtures)(Object.keys(i).length!==e.length||Object.keys(i).some(a=>!e.includes(a)))&&this.throwException(400,"invalid_method_call","Fixtures field is invalid. For more information please visit our documentation"),this.validatePredictionType(i.predictionType,i.prediction);t.tiebreaker&&(!t.tiebreaker.statTotal||!Number.isInteger(t.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=(t,e)=>{switch(t){case"BOOLEAN":typeof e!="boolean"&&this.throwException(400,"invalid_method_call",`Prediction must be a boolean for prediction type ${t}`);break;case"NUMBER":(typeof e!="number"||!Number.isFinite(e))&&this.throwException(400,"invalid_method_call",`Prediction must be a number for prediction type ${t}`);break;case"ENUM":case"FREE_INPUT":(typeof e!="string"||e.trim()==="")&&this.throwException(400,"invalid_method_call",`Prediction must be a non-empty string for prediction type ${t}`);break;default:this.throwException(400,"invalid_method_call",`Unknown prediction type: ${t}`)}}};var yp=class{https=null;validator=null;profile=null;constructor(t){this.https=new jt(t),this.profile=new D(t),this.validator=new gp(t.errorHandlingMode)}getGames=async(t,e)=>(t&&(t=new Br(t)),await this.https.getEventGames(t,e));getGameById=async(t,e)=>await this.https.getEventGameById(t,e);makePrediction=async(t,e)=>(this.validator.validatePrediction(e),await this.https.makeEventGamePrediction(t,e));updatePrediction=async(t,e,i)=>(this.validator.validatePrediction(i),await this.https.updateEventGamePrediction(t,e,i));getGamePredictionsForUser=async(t,e,i,a)=>{i&&(i=new Nr(i));let r=await this.https.getEventGamePredictionsForUser(t,e,i,a),o=null;try{o=await this.profile.getById(e).getInfo()}catch(n){console.error(n)}return r.data.forEach(n=>{n.profileModel=o}),r};getRankings=async(t,e,i)=>{e&&(e=new kr(e));let a=await this.https.getEventGameRankings(t,e,i),r=a.data.map(n=>n.profileId),o=[];return r.length>0&&(o=await this.profile.getByIds(r),a.data=a.data.map(n=>(n.profileModel=o.find(l=>l.id===n.profileId)||null,n))),a}};var bp=class{facade=null;constructor(t){this.facade=new yp(t)}getGames=async(t,e)=>await this.facade.getGames(t,e);getGameById=async(t,e)=>await this.facade.getGameById(t,e);makePrediction=async(t,e)=>await this.facade.makePrediction(t,e);updatePrediction=async(t,e,i)=>await this.facade.updatePrediction(t,e,i);getGamePredictionsForUser=async(t,e,i,a)=>await this.facade.getGamePredictionsForUser(t,e,i,a);getRankings=async(t,e,i)=>await this.facade.getRankings(t,e,i)};var Cd=Object.keys(new Dt),Ad=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"),Ui=class{static createFantasyPrediction(t,e,i,a){let r=new Ge;return r.template_id=t||null,r.group_id=e||null,r.fixtures=i?.map(o=>({player_id:o,match_type:"FOOTBALL",market:"PLAYER_PERFORMANCE",role:a?.get(o)?.toLocaleUpperCase()||null}))||[],r}static createFantasyPlayerStats(t){return Cd.map(e=>{let i=new Hr,a=t.data.reduce((r,o)=>r+o.stats[e],0);return i.key=e,i.label=Ad.get(e),i.value=a,i})}};var Mp=class{idMapping=null;idSchema=null;errorHandlingModel=null;football=null;constructor(t){this.idSchema=t.idSchema,this.errorHandlingModel=t.errorHandlingMode,this.football=new it(t),this.idMapping=new R(t)}remapCompetitions=async t=>{let e={competition:t};return(await this.idMapping.idMappingFacade.getEntitiesByIds(e,"native",this.idSchema)).competition};remapPlayers=async(t,e,i,a)=>{let r={player:Array.from(t)},o=await this.idMapping.idMappingFacade.getEntitiesByIdsMap(r,e,i);if(a){let n=new Map;for(let[l,p]of Array.from(a.entries())){let c=o.get(l);c&&n.set(c,p)}a.clear();for(let[l,p]of Array.from(n.entries()))a.set(l,p)}return Array.from(o.values())};addPlayerModels=async t=>{let e=t.map(a=>a.playerId),i=await this.football.footballFacade.getPlayersMapWithNativeIds(e);return t.forEach(a=>{a.playerModel=Object.keys(i).length&&i[a.playerId]||null,a.playerId=a.playerModel?.id||a.playerId}),t};remapPlayerIdToNative=async t=>{let e=await this.idMapping.getEntityIdBySchemaId("player",t);if(e)return e.id;this.throwException(404,"id_mapping_not_found","No ID mappings are available for the provided ID. ID argument: "+t)};addMatchModels=async t=>{let e=t.map(a=>a.matchId),i=await this.football.footballFacade.getMatchesMapWithNativeIds(e);return t.forEach(a=>{a.matchModel=Object.keys(i).length&&i[a.matchId]||null,a.matchId=a.matchModel?.id||a.matchId}),t};throwException=(t,e,i)=>{throw this.errorHandlingModel==="standard"?new h(t,e,i):new b(t,e,i)}};var Ip=class{idSchema=null;clientHttps=null;footballHttps=null;predictorHttps=null;loyaltyHttps=null;service=null;constructor(t){this.idSchema=t.idSchema,this.clientHttps=new Q(t),this.footballHttps=new dt(t),this.service=new Mp(t),this.predictorHttps=new mt(t),this.loyaltyHttps=new Rt(t)}getConfig=async()=>{let t=await this.clientHttps.getConfig("fantasy");return this.idSchema!=="native"&&(t.competitionsWhitelist=await this.service.remapCompetitions([...t.competitionsWhitelist])),t};getPlayersPoints=async(t,e,i)=>{let a=await this.footballHttps.getPlayersPoints(t,e,i);return a.data=await this.service.addPlayerModels(a.data),a};getPlayerDetailedStatistics=async(t,e,i)=>{let a="";this.idSchema!=="native"&&(a=await this.service.remapPlayerIdToNative(e));let r=await this.footballHttps.getPlayerDetailedStatistics(t,a||e,i);return r.meta.filters.playerId=e,r.data=await this.service.addMatchModels(r.data),r};play=async(t,e,i,a)=>{if((!i||!Array.isArray(i))&&this.service.throwException(400,"invalid_method_call","Invalid parameter provided. Please check the following parameter: "+"playerIds"),a){let o="playersRoles";a instanceof Map||this.service.throwException(400,"invalid_method_call","Invalid parameter provided. Please check the following parameter: "+o);let n=Array.from(a.keys());n.length||this.service.throwException(400,"invalid_method_call","Invalid parameter provided. Please check the following parameter: "+o),n.every(u=>!i.includes(u))&&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: "+i.join(","));let p=Array.from(a.values()),c=["CAPTAIN","VICE_CAPTAIN"];p.every(u=>c.includes(u.toLocaleUpperCase()))||this.service.throwException(400,"invalid_method_call","The values in the map are not valid. The valid ones are: "+c.join(",")+". Case insensitive.")}let r=null;if(this.idSchema!=="native"){let o=await this.service.remapPlayers(i,this.idSchema,"native",a);r=Ui.createFantasyPrediction(t,e,o,a)}else r=Ui.createFantasyPrediction(t,e,i,a);return await this.predictorHttps.makeFootballPrediction(r)};getMyPrediction=async(t,e)=>{let i=`${t}_${e}`,a=new V(null);a.gameIds=[i];let r=await this.predictorHttps.getMyPredictions(a);return r.data.length===0?null:r.data[0]};getPlayerStatistics=async(t,e,i)=>{let a=await this.getPlayerDetailedStatistics(t,e,i);return Ui.createFantasyPlayerStats(a)};getGameWeekStatistics=async t=>await this.loyaltyHttps.getTemplateBreakdownPoints(t)};var wp=class{facade=null;constructor(t){this.facade=new Ip(t)}getConfig=async()=>await this.facade.getConfig();getPlayersPoints=async(t,e,i)=>await this.facade.getPlayersPoints(t,e,i);getPlayerDetailedStatistics=async(t,e,i)=>await this.facade.getPlayerDetailedStatistics(t,e,i);play=async(t,e,i,a)=>await this.facade.play(t,e,i,a);getMyPrediction=async(t,e)=>await this.facade.getMyPrediction(t,e);getPlayerStatistics=async(t,e,i)=>await this.facade.getPlayerStatistics(t,e,i);getGameWeekStatistics=async t=>await this.facade.getGameWeekStatistics(t)};var _p=class{configuration;constructor(t){this.configuration=t}getSDKConfiguration(){return this.configuration}};var Pp=class{remapToResponseModel=(t,e,i)=>{let a=new Mo;return a.meta.input=e,a.meta.output=i,t.size===0||(a.data=Array.from(t).map(([r,o])=>({input:r,output:o}))),a}};var Tp=class{errorHandlingModel=null;constructor(t){this.errorHandlingModel=t.errorHandlingMode}validate=(t,e,i)=>{(!t||!Array.isArray(t)||t.length===0)&&this.throwException(400,"invalid_ids","Invalid or empty IDs provided. Please provide at least one ID."),(!e||e!=="native"&&e!=="enetpulse"&&e!=="sportal365"&&e!=="sportradar"&&e!=="api_football")&&this.throwException(400,"invalid_input_provider","Invalid provider. The valid providers are: 'native', 'enetpulse', 'sportal365', 'sportradar' and 'api_football'."),(!i||i!=="native"&&i!=="enetpulse"&&i!=="sportal365"&&i!=="sportradar"&&i!=="api_football")&&this.throwException(400,"invalid_output_provider","Invalid provider. The valid providers are: 'native', 'enetpulse', 'sportal365', 'sportradar' and 'api_football'."),e===i&&this.throwException(400,"invalid_output_provider","Invalid output provider. The output can not be the same as the input provider.")};throwException=(t,e,i)=>{throw this.errorHandlingModel==="standard"?new h(t,e,i):new b(t,e,i)}};var Ep=class{validator=null;idMappingFacade=null;factory=new Pp;constructor(t){this.validator=new Tp(t),this.idMappingFacade=new yi(t)}getMappedFootballCountryIds=async(t,e,i)=>{this.validator.validate(t,e,i);let a={country:Array.from(t)},r=await this.idMappingFacade.getEntitiesByIdsMap(a,e,i);return this.factory.remapToResponseModel(r,e,i)};getMappedFootballCompetitionIds=async(t,e,i)=>{this.validator.validate(t,e,i);let a={competition:Array.from(t)},r=await this.idMappingFacade.getEntitiesByIdsMap(a,e,i);return this.factory.remapToResponseModel(r,e,i)};getMappedFootballTeamIds=async(t,e,i)=>{this.validator.validate(t,e,i);let a={team:Array.from(t)},r=await this.idMappingFacade.getEntitiesByIdsMap(a,e,i);return this.factory.remapToResponseModel(r,e,i)};getMappedFootballPlayerIds=async(t,e,i)=>{this.validator.validate(t,e,i);let a={player:Array.from(t)},r=await this.idMappingFacade.getEntitiesByIdsMap(a,e,i);return this.factory.remapToResponseModel(r,e,i)};getFootballMappedMatchIds=async(t,e,i)=>{this.validator.validate(t,e,i);let a={match:Array.from(t)},r=await this.idMappingFacade.getEntitiesByIdsMap(a,e,i);return this.factory.remapToResponseModel(r,e,i)}};var Rp=class{facade=null;constructor(t){this.facade=new Ep(t)}getMappedFootballCountryIds=async(t,e,i)=>await this.facade.getMappedFootballCountryIds(t,e,i);getMappedFootballCompetitionIds=async(t,e,i)=>await this.facade.getMappedFootballCompetitionIds(t,e,i);getMappedFootballTeamIds=async(t,e,i)=>await this.facade.getMappedFootballTeamIds(t,e,i);getMappedFootballPlayerIds=async(t,e,i)=>await this.facade.getMappedFootballPlayerIds(t,e,i);getMappedFootballMatchIds=async(t,e,i)=>await this.facade.getFootballMappedMatchIds(t,e,i)};var Fp=class{findLastGame=t=>{if(!Array.isArray(t)||t.length===0)return null;let e=t.filter(r=>r.status==="SETTLED").sort((r,o)=>new Date(o.predictionsCutoff).getTime()-new Date(r.predictionsCutoff).getTime());if(e.length>0)return e[0];let i=new Date,a=t.filter(r=>new Date(r.predictionsCutoff)<i).sort((r,o)=>new Date(o.predictionsCutoff).getTime()-new Date(r.predictionsCutoff).getTime());return a.length>0?a[0]:null};findNextGame=t=>{if(!Array.isArray(t)||t.length===0)return null;let e=this.findCurrentGame(t);if(!e)return null;let i=[...t].sort((r,o)=>new Date(r.predictionsCutoff).getTime()-new Date(o.predictionsCutoff).getTime()),a=new Date(e.predictionsCutoff).getTime();return i.find(r=>new Date(r.predictionsCutoff).getTime()>a)||null};findCurrentGame=t=>{if(!Array.isArray(t)||t.length===0)return null;let e=t.find(o=>o.status==="LIVE");if(e)return e;let i=t.find(o=>o.status==="OPEN");if(i)return i;let a=new Date;return t.filter(o=>new Date(o.predictionsCutoff)>a).sort((o,n)=>new Date(o.predictionsCutoff).getTime()-new Date(n.predictionsCutoff).getTime())[0]||null}};var Vi=class{matchQuizFacade=null;helpers=new Fp;constructor(t){this.matchQuizFacade=new ie(t)}getConfig=async()=>await this.matchQuizFacade.getConfig();play=async t=>await this.matchQuizFacade.play(t);delete=async t=>await this.matchQuizFacade.delete(t);getGames=async(t,e)=>await this.matchQuizFacade.getGames(t,e);getGameById=async(t,e)=>await this.matchQuizFacade.getGameById(t,e);getGamePredictions=async(t,e,i)=>await this.matchQuizFacade.getGamePredictions(t,e,i);getGameResults=async(t,e,i)=>await this.matchQuizFacade.getGameResults(t,e,i);getCurrentGameResults=async t=>await this.matchQuizFacade.getCurrentGameResults(t);getMyGameEditions=async(t,e)=>await this.matchQuizFacade.getMyGameEditions(t,e);getMyGamePrediction=async t=>await this.matchQuizFacade.getMyGamePrediction(t);getUserGameEditions=async(t,e,i)=>await this.matchQuizFacade.getUserGameEditions(t,e,i);getUserGamePrediction=async(t,e,i)=>await this.matchQuizFacade.getUserGamePrediction(t,e,i);getMarketsResultsForGame=async(t,e)=>await this.matchQuizFacade.getMarketsResultsForGame(t,e);getGameWinners=async(t,e)=>await this.matchQuizFacade.getGameWinners(t,e)};var Sp=class{findLastGame=t=>{if(!Array.isArray(t)||t.length===0)return null;let e=t.filter(r=>r.status==="SETTLED").sort((r,o)=>new Date(o.predictionsCutoff).getTime()-new Date(r.predictionsCutoff).getTime());if(e.length>0)return e[0];let i=new Date,a=t.filter(r=>new Date(r.predictionsCutoff)<i).sort((r,o)=>new Date(o.predictionsCutoff).getTime()-new Date(r.predictionsCutoff).getTime());return a.length>0?a[0]:null};findNextGame=t=>{if(!Array.isArray(t)||t.length===0)return null;let e=this.findCurrentGame(t);if(!e)return null;let i=[...t].sort((r,o)=>new Date(r.predictionsCutoff).getTime()-new Date(o.predictionsCutoff).getTime()),a=new Date(e.predictionsCutoff).getTime();return i.find(r=>new Date(r.predictionsCutoff).getTime()>a)||null};findCurrentGame=t=>{if(!Array.isArray(t)||t.length===0)return null;let e=t.find(o=>o.status==="LIVE");if(e)return e;let i=t.find(o=>o.status==="OPEN");if(i)return i;let a=new Date;return t.filter(o=>new Date(o.predictionsCutoff)>a).sort((o,n)=>new Date(o.predictionsCutoff).getTime()-new Date(n.predictionsCutoff).getTime())[0]||null}};var Hi=class{topXFacade=null;helpers=new Sp;constructor(t){this.topXFacade=new oe(t)}getConfig=async()=>await this.topXFacade.getConfig();getGames=async(t,e)=>await this.topXFacade.getGames(t,e);getGameById=async(t,e)=>await this.topXFacade.getGameById(t,e);getGamePredictions=async(t,e,i)=>await this.topXFacade.getGamePredictions(t,e,i);getGameResults=async(t,e,i)=>await this.topXFacade.getGameResults(t,e,i);getCurrentGameResults=async t=>await this.topXFacade.getCurrentGameResults(t);play=async t=>await this.topXFacade.play(t);delete=async t=>await this.topXFacade.delete(t);getMyGameEditions=async(t,e)=>await this.topXFacade.getMyGameEditions(t,e);getMyGamePrediction=async t=>await this.topXFacade.getMyGamePrediction(t);getUserGameEditions=async(t,e,i)=>await this.topXFacade.getUserGameEditions(t,e,i);getUserGamePrediction=async(t,e,i)=>await this.topXFacade.getUserGamePrediction(t,e,i);getMarketsResultsForGame=async(t,e)=>await this.topXFacade.getMarketsResultsForGame(t,e);getGameWinners=async(t,e)=>await this.topXFacade.getGameWinners(t,e)};var vp=class{remapUserVotes=t=>{let e=new wn;return e.meta=this.remapMeta(t.meta.pagination),e.data=t.data.map(i=>this.remapUserVoteModel(i)),e};remapResults=t=>{let e=new Tn;return e.meta=t.meta,e.data=t.data.map(i=>this.remapResultsModel(i)),e};remapMeta=t=>{let e=new y;return e.pagination.itemsPerPage=t.items_per_page,e.pagination.nextPageStartsAfter=t.next_page_starts_after,e};remapUserVoteModel=t=>{let e=new _n;return e.matchId=t.match_id,e.playerId=t.player_id,e.createdAt=t.created_at,e};remapResultsModel=t=>{let e=new En;return e.teamId=t.team_id,e.playerId=t.player_id,e.votes=t.votes,e.winner=t.winner,e}};var Cp=class{id=null;pollId=null;optionIds=[];optionsModels=[];userId=null;createdAt=null};var Ap=class extends et{remapPolls=t=>{let e=new bn;return e.meta.pagination=this.remapMetaPagination(t.meta.pagination),e.data=t.data.map(i=>this.remapPoll(i)),e};remapPollById=t=>{let e=new hn;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.status=t.status,e.language=t.language,e.authRequirement=t.auth_requirement,e.flags=t.flags,e.totalVotes=t.total_votes,e.customFields=t.custom_fields,e.related=t.related?this.remapRelated(t.related):[],e.branding=t.branding?this.remapBranding(t.branding):null,e.embedCode=t.embed_code,e.labels=t.labels,e.rules=t.rules,e.adContent=t.ad_content,e.options=t.options?this.remapOptions(t.options):[],e.context=t.context?this.remapContext(t.context):t.context,e.preferencesEnabled=t.preferences_enabled,e.multipleChoice=t.multiple_choice,e.maxMultipleChoiceOptions=t.max_multiple_choice_options,e.participationCount=t.participation_count,e.maxAttempts=t.max_attempts,e.externalActivity=t.external_activity,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapUserVote=t=>{let e=new yn;return e.id=t.id,e.pollId=t.poll_id,e.optionId=t.option_id,e.optionIds=t.option_ids,e.userId=t.user_id,e.attempts=t.attempts||null,e.previousVotes=t.previous_votes?t.previous_votes.map(i=>this.remapPreviousVotes(i)):[],e.createdAt=t.created_at,e};remapPreviousVotes=t=>{let e=new Cp;return e.id=t.id,e.pollId=t.poll_id,e.optionIds=t.option_ids,e.userId=t.user_id,e.createdAt=t.created_at,e};remapPollsVotes=t=>{let e=new Mn;return e.meta.pagination=this.remapMetaPagination(t.meta.pagination),e.data=t.data.map(i=>this.remapAllPollsVotes(i)),e};remapAllPollsVotes=t=>{let e=new $t;return e.id=t.id,e.pollId=t.poll_id,e.optionId=t.option_id,e.optionIds=t.option_ids,e.userId=t.user_id,e.createdAt=t.created_at,e};remapSinglePollVote=t=>{let e=new gn;return e.id=t.id,e.pollId=t.poll_id,e.optionId=t.option_id,e.optionIds=t.option_ids,e.userId=t.user_id,e.attempts=t.attempts||null,e.createdAt=t.created_at,e.previousVotes=t.previous_votes?t.previous_votes.map(i=>this.remapPreviousVotes(i)):[],e};remapMetaPagination=t=>{let e=new ut;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapPoll=t=>{let e=new pi;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.status=t.status,e.language=t.language,e.authRequirement=t.auth_requirement,e.flags=t.flags,e.totalVotes=t.total_votes,e.customFields=t.custom_fields,e.related=t.related?this.remapRelated(t.related):[],e.branding=t.branding?this.remapBranding(t.branding):null,e.embedCode=t.embed_code,e.labels=t.labels,e.adContent=t.ad_content,e.options=t.options?this.remapOptions(t.options):[],e.context=t.context?this.remapContext(t.context):t.context,e.preferencesEnabled=t.preferences_enabled,e.multipleChoice=t.multiple_choice,e.maxMultipleChoiceOptions=t.max_multiple_choice_options,e.participationCount=t.participation_count,e.maxAttempts=t.max_attempts,e.externalActivity=t.external_activity,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapContext=t=>{let e=new Ct;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new hr;return a.id=i.id,a.type=i.type,a.source=i.source,a}):null,e.campaign=t.campaign,e};remapRelated=t=>t.map(e=>{let i=new z;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i});remapOptions=t=>t.map(e=>{let i=new fn;return i.id=e.id,i.title=e.title,i.description=e.description,i.images=e.images,i.votes=e.votes,i.embedCode=e.embed_code,i.preferencesMapping=e.preferences_mapping?this.remapPreferencesMapping(e.preferences_mapping):[],i});remapPreferencesMapping=t=>t.map(e=>{let i=new ci;return i.preferenceId=e.preference_id,i})};var Op=class extends v{pollRemapper=null;playerOfTheMatchRemapper=null;constructor(t){super(t,O(t.environment,"voting")),this.pollRemapper=new Ap,this.playerOfTheMatchRemapper=new vp}getPolls=async(t,e)=>{let i=`/polls${this.apiSignInUrl}`;t&&(i+=t.constructMainFiltersUrl()),f(e)&&(i+=m());let a="There was a problem fetching polls",r=await this.fetchWithoutAuth(i,a);return this.pollRemapper.remapPolls(r)};getPollById=async(t,e)=>{let i=`/polls/${t}${this.apiSignInUrl}`;f(e)&&(i+=m());let a="There was a problem fetching the following poll: "+t,r=await this.fetchWithoutAuth(i,a);return this.pollRemapper.remapPollById(r.data)};voteForPoll=async(t,e)=>{let i=`/polls/${t}/votes${this.apiSignInUrl}`,a="PUT",r={option_ids:e},o="There was a problem voting for the following poll: "+t,n=await this.fetchWithAuth(i,o,a,r);return this.pollRemapper.remapUserVote(n.data)};deleteVoteForPoll=async t=>{let e=`/polls/${t}/votes${this.apiSignInUrl}`,i="DELETE",a="There was a problem deleting vote for the following poll: "+t;return await this.fetchWithAuth(e,a,i),!0};getMyPollVote=async t=>{let e=`/polls/${t}/votes${this.apiSignInUrl}`,i="There was a problem fetching user's own vote for the following poll: "+t,a=await this.fetchWithAuth(e,i);return this.pollRemapper.remapSinglePollVote(a.data)};getMyPollsVotes=async t=>{let e=`/polls/votes${this.apiSignInUrl}`;t&&(e+=t.constructMainFiltersUrl());let i="There was a problem fetching user's votes for polls",a=await this.fetchWithAuth(e,i);return this.pollRemapper.remapPollsVotes(a)};voteForPlayerOfTheMatch=async(t,e)=>{let i=`/football/potm/${t}${this.apiSignInUrl}`,a="PUT",r={player_id:e},o="There was a problem voting for 'Player of the match'";return{playerId:(await this.fetchWithAuth(i,o,a,r)).data.player_id}};deleteVoteForPlayerOfTheMatch=async t=>{let e=`/football/potm/${t}${this.apiSignInUrl}`,i="DELETE",a="There was a problem with deleting vote for 'Player of the match'";await this.fetchWithAuth(e,a,i)};getOwnVotesForPlayerOfTheMatch=async t=>{let e=`/football/potm${this.apiSignInUrl}`;t&&(e+=t.constructFiltersUrl());let i="There was a problem fetching user's own votes for 'Player of the match'",a=await this.fetchWithAuth(e,i);return this.playerOfTheMatchRemapper.remapUserVotes(a)};getResultsForPlayerOfTheMatch=async(t,e)=>{let i=`/football/potm/${t}${this.apiSignInUrl}${f(e)?m():""}`,a="There was a problem fetching results for 'Player of the match'",r=await this.fetchWithoutAuth(i,a);return this.playerOfTheMatchRemapper.remapResults(r)}};var xp=class{idMappingService=null;idSchema=null;errorHandlingMode=null;validator=null;activityService=null;football=null;constructor(t){this.idSchema=t.idSchema,this.errorHandlingMode=t.errorHandlingMode,this.idMappingService=new R(t),this.validator=new ae(t),this.activityService=new wt(t),this.football=new it(t)}finalizePollsFilters=async t=>{if(this.idSchema!=="native"&&t.entityIds&&t.entityIds.length>0){this.validator.validateFilters(t);let e=await this.idMappingService.getEntityIdsBySchemaId(Array.from(t.entityIds),t.entityType,"native");t.entityIds=e[t.entityType]}};remapTags=async(t,e,i)=>{if(this.idSchema!="native"&&t.context&&t.context.tags&&t.context.tags.length){let a=JSON.parse(JSON.stringify(t.context.tags)),r=await this.activityService.remapTagsIds(a,e,i);t.context.tags=r}};remapMatchAndPlayerIds=async(t,e,i,a)=>{let r={match:[t],player:[e]},o=await this.idMappingService.idMappingFacade.getEntitiesByIds(r,i,a);if(o.match.length>0&&o.player.length>0){let n=o.match[0],l=o.player[0];return[n,l]}throw this.errorHandlingMode==="default"?new b(404,"entity_ids_not_found","Some of the sport entity IDs were not found for the provided id schema"):new h(404,"entity_ids_not_found","Some of the sport entity IDs were not found for the provided id schema")};remapMatchIds=async(t,e,i)=>{let a=Array.from(t),r={match:t},o=await this.idMappingService.idMappingFacade.getEntitiesByIds(r,e,i);if(o.match.length>0&&o.match.length===a.length)return o.match;throw this.errorHandlingMode==="default"?new b(404,"match_ids_not_found","Some of the match IDs were not found for the provided id schema"):new h(404,"match_ids_not_found","Some of the match IDs were not found for the provided id schema")};setModelsForUserVotes=async t=>{let e=t.data.map(a=>a.matchId),i=t.data.map(a=>a.playerId);if(e.length>0&&i.length>0){let a=await this.football.footballFacade.getMatchesMapWithNativeIds(e),r=await this.football.footballFacade.getPlayersMapWithNativeIds(i);t.data.forEach(o=>{o.matchModel=a[o.matchId]||null,o.playerModel=r[o.playerId]||null,o.matchId=o.matchModel?o.matchModel.id:o.matchId,o.playerId=o.playerModel?o.playerModel.id:o.playerId}),t.meta.pagination.nextPageStartsAfter&&(t.meta.pagination.nextPageStartsAfter=t.data[t.data.length-1].matchId)}return t};setModelsForPotmResults=async t=>{let e=t.map(a=>a.teamId),i=t.map(a=>a.playerId);if(e.length>0&&i.length>0){let a=await this.football.footballFacade.getTeamsMapWithNativeIds(e),r=await this.football.footballFacade.getPlayersMapWithNativeIds(i);t.forEach(o=>{o.teamModel=a.get(o.teamId)||null,o.playerModel=r[o.playerId]||null,o.teamId=o.teamModel?o.teamModel.id:o.teamId,o.playerId=o.playerModel?o.playerModel.id:o.playerId})}}};var Lp=class{https=null;service=null;idSchema=null;constructor(t){this.idSchema=t.idSchema,this.https=new Op(t),this.service=new xp(t)}getPolls=async(t,e)=>{t&&(t=new li(t),await this.service.finalizePollsFilters(t));let i=await this.https.getPolls(t,e);for(let a of i.data)await this.service.remapTags(a,"native",this.idSchema);return i};getPollById=async(t,e)=>{let i=await this.https.getPollById(t,e);return await this.service.remapTags(i,"native",this.idSchema),i};voteForPoll=async(t,e)=>(typeof e=="string"&&(console.warn("Passing a single optionId as a string will be deprecated. Please pass it as an array."),e=[e]),await this.https.voteForPoll(t,e));deleteVoteForPoll=async t=>await this.https.deleteVoteForPoll(t);getMyPollVote=async(t,e)=>{let i=await this.https.getMyPollVote(t);if(e){let a=await this.getPolls(new li({pollIds:[t]}),!0);i.pollModel=a.data.find(r=>r.id===t)||null,i.optionModel=a.data.find(r=>r.id===t)?.options.find(r=>r.id===i.optionId)||null,i.optionsModels=i.optionIds?a.data.find(r=>r.id===t)?.options.filter(r=>i.optionIds.includes(r.id))||[]:[],i.previousVotes.forEach(r=>{r.optionsModels=a.data.find(o=>o.id===r.pollId)?.options.filter(o=>r.optionIds.includes(o.id))||[]})}return i};getMyPollsVotes=async t=>{t&&(t=new I(t));let e=await this.https.getMyPollsVotes(t),i=e.data.map(r=>r.id),a=await this.getPolls(new li({pollIds:i}),!0);return e.data=e.data.map(r=>(r.pollModel=a.data.find(o=>o.id===r.pollId)||null,r.optionModel=r.pollModel?.options.find(o=>o.id===r.optionId)||null,r.optionsModels=r.optionIds?r.pollModel?.options.filter(o=>r.optionIds.includes(o.id))||[]:[],r)),e};voteForPlayerOfTheMatch=async(t,e)=>{if(this.idSchema!=="native"){let[i,a]=await this.service.remapMatchAndPlayerIds(t,e,this.idSchema,"native");return await this.https.voteForPlayerOfTheMatch(i,a),{playerId:e}}return await this.https.voteForPlayerOfTheMatch(t,e)};deleteVoteForPlayerOfTheMatch=async t=>{if(this.idSchema!=="native"){let e=await this.service.remapMatchIds([t],this.idSchema,"native");return await this.https.deleteVoteForPlayerOfTheMatch(e[0]),!0}return await this.https.deleteVoteForPlayerOfTheMatch(t),!0};getOwnVotesForPlayerOfTheMatch=async t=>{if(t&&(t=new In(t)),t&&t.matchIds&&t.matchIds.length>0&&this.idSchema!=="native"){let i=await this.service.remapMatchIds(t.matchIds,this.idSchema,"native");t.matchIds=i}let e=await this.https.getOwnVotesForPlayerOfTheMatch(t);return await this.service.setModelsForUserVotes(e)};getResultsForPlayerOfTheMatch=async(t,e)=>{if(this.idSchema!=="native"){let a=await this.service.remapMatchIds([t],this.idSchema,"native"),r=await this.https.getResultsForPlayerOfTheMatch(a[0],e);return await this.service.setModelsForPotmResults(r.data),r}let i=await this.https.getResultsForPlayerOfTheMatch(t,e);return await this.service.setModelsForPotmResults(i.data),i}};var $i=class{facade=null;constructor(t){this.facade=new Lp(t)}getPolls=async(t,e)=>await this.facade.getPolls(t,e);getPollById=async(t,e)=>await this.facade.getPollById(t,e);voteForPoll=async(t,e)=>await this.facade.voteForPoll(t,e);deleteVoteForPoll=async t=>await this.facade.deleteVoteForPoll(t);getMyPollVote=async(t,e)=>await this.facade.getMyPollVote(t,e);getMyPollsVotes=async t=>await this.facade.getMyPollsVotes(t);voteForPlayerOfTheMatch=async(t,e)=>await this.facade.voteForPlayerOfTheMatch(t,e);deleteVoteForPlayerOfTheMatch=async t=>await this.facade.deleteVoteForPlayerOfTheMatch(t);getOwnVotesForPlayerOfTheMatch=async t=>await this.facade.getOwnVotesForPlayerOfTheMatch(t);getResultsForPlayerOfTheMatch=async(t,e)=>await this.facade.getResultsForPlayerOfTheMatch(t,e)};var Dp=class{clientHttps=null;topX=null;matchQuiz=null;loyalty=null;miniGames=null;voting=null;constructor(t){this.clientHttps=new Q(t),this.topX=new Hi(t),this.matchQuiz=new Vi(t),this.loyalty=new se(t),this.miniGames=new re(t),this.voting=new $i(t)}getListContent=async(t,e,i)=>{e&&(e=new Io(e));let a=await this.clientHttps.getListContent(t,e,i);return await this.setModels(a.data,i),a};setModels=async(t,e)=>{let i=[],a=new Map;t.forEach(r=>{if(a.has(r.entityType)){let o=a.get(r.entityType);a.set(r.entityType,[...o,r.entityId])}else a.set(r.entityType,[r.entityId])});try{for(let[r,o]of Array.from(a.entries()))switch(r){case"TOP_X":let n=await this.topX.getGames({limit:o.length,gameIds:o},e);i=[...i,...n.data];break;case"MATCH_QUIZ":let l=await this.matchQuiz.getGames({limit:o.length,gameIds:o},e);i=[...i,...l.data];break;case"LEADERBOARD_TEMPLATES":let p=await this.loyalty.getTemplates(void 0,e);i=[...i,...p.data.filter(_=>o.includes(_.id))];break;case"CLASSIC_QUIZ":let c=await this.miniGames.getClassicQuizzes({limit:o.length,classicQuizIds:o},!1,e);i=[...i,...c.data];break;case"EITHER_OR":let u=await this.miniGames.getEitherOrs({limit:o.length,eitherOrIds:o},!1,e);i=[...i,...u.data];break;case"POLL":let d=await this.voting.getPolls({limit:o.length,pollIds:o},e);i=[...i,...d.data];break;case"PERSONALITY_QUIZ":let M=await this.miniGames.getPersonalityQuizzes({limit:o.length,personalityQuizIds:o},e);i=[...i,...M.data];break;default:}}catch(r){throw console.error("An error occurred while trying to set models for list content entities",r),r}t.forEach(r=>{let o=i.find(n=>n.id===r.entityId)||null;r.entityModel=o})}};var Bp=class{facade=null;constructor(t){this.facade=new Dp(t)}getListContent=async(t,e,i)=>await this.facade.getListContent(t,e,i)};var Np=class{fromResponse(t,e){let i=new Map;return t.matches.forEach(a=>{let r=a.odds.map(o=>{let n=new Cs;return n.bookmaker=o.bookmaker?this.remapBookmaker(o.bookmaker):null,n.type=o.type,n.markets=o.markets?this.remapMarkets(o.markets,e):[],n});i.set(a.id,r)}),i}remapBookmaker(t){let e=new Is;return e.id=t.id,e.name=t.name,e.assets=t.assets?this.remapAssets(t.assets):[],e.links=t.links||[],e.branding=t.branding?this.remapBranding(t.branding):null,e.eventUrls=t.event_urls?this.remapEventUrls(t.event_urls):[],e.stakesDisclaimer=t.stakes_disclaimer,e.domainName=t.domain_name,e}remapMarkets(t,e){return t.map(i=>{let a=new Es;return a.type=i.type?this.remapMarketType(i.type):null,a.scope=i.scope?this.remapMarketScope(i.scope):null,a.selections=i.selections?this.remapMarketSelections(i.selections,a.type.code,e):[],a})}remapEventUrls(t){return t.map(e=>{let i=new Ps;return i.url=e.url,i.appType=e.app_type,i})}remapBranding(t){let e=new ws;return e.backgroundColor=t.background_color,e.textColor=t.text_color,e}remapAssets(t){return t.map(e=>{let i=new _s;return i.logo=e.logo,i.type=e.type,i.transparentBackgroundUrl=e.transparent_background_url,i.backgroundColor=e.background_color,i})}remapMarketType=t=>{let e=new Ss;return e.id=t.id,e.name=t.name,e.code=t.code,e.entityType=t.entity_type,e};remapMarketScope=t=>{let e=new Rs;return e.id=t.id,e.name=t.name,e.type=t.type,e.entityType=t.entity_type,e};remapMarketSelections=(t,e,i)=>{let a=Array.from(t);return i.length>0&&e==="OVER_UNDER"&&(a=a.filter(r=>r.code==="over"?i.some(o=>{switch(o){case"OVER_GOALS_0_5":return r.value==="0.5";case"OVER_GOALS_1_5":return r.value==="1.5";case"OVER_GOALS_2_5":return r.value==="2.5";case"OVER_GOALS_3_5":return r.value==="3.5";case"OVER_GOALS_4_5":return r.value==="4.5";case"OVER_GOALS_5_5":return r.value==="5.5";default:return!1}}):!1)),a.map(r=>{let o=new Fs;return o.id=r.id,o.name=r.name,o.code=r.code,o.value=r.value,o.odds=r.odds,o.urls=r.urls?this.remapEventUrls(r.urls):[],o.movement=r.movement,o.oddsOld=r.odds_old,o.entityType=r.entity_type,o.additionalInfo=r.additional_info,o.providerInfo=r.provider_info?this.remapProviderInfo(r.provider_info):null,o})};remapProviderInfo=t=>{let e=new vs;return e.selectionId=t.selection_id,e.eventId=t.event_id,e.marketId=t.market_id,e.competitionId=t.competition_id,e}};var kp=class{footballBaseUrl="https://football.api.sportal365.com/";retryRequest=!1;oddClient=null;remapper=null;constructor(t){this.oddClient=t.oddClient,this.remapper=new Np}getMatchOdds=async(t,e)=>{let i=`v2/matches/livescore?odd_client=${this.oddClient.name}&match_ids=${t.join(",")}${e.constructFiltersUrl()}`,a=`Error while fetching match odds for matchIds: ${t.join(",")}`,r=await this.fetchWithAuth(i,a),o=e.marketTypes&&e.marketTypes.length>0?e.marketTypes.filter(n=>n.includes("OVER")):[];return this.remapper.fromResponse(r,o)};getAuthHeaders=()=>{let t=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");return{"Content-Type":"application/json",Authorization:`Basic ${t}`}};fetchWithAuth=async(t,e)=>{let i=await fetch(this.footballBaseUrl+t,{headers:this.getAuthHeaders()}),a=await i.json();if(!i.ok)throw(i.status===401||i.status===403)&&!this.retryRequest&&(this.retryRequest=!0,await this.fetchWithAuth(t,e)),this.retryRequest=!1,console.warn(e,a),a;return this.retryRequest=!1,a}};var Gp=class{https;idSchema;oddClient;idMapping=null;validator;constructor(t){this.idSchema=t.idSchema,this.oddClient=t.oddClient,this.https=new kp(t),this.validator=new K(t.errorHandlingMode),this.idMapping=new R(t)}getByMatchIds=async(t,e)=>{this.validateOddClient(),(!t||!Array.isArray(t)||t.length===0)&&this.validator.throwException(400,"invalid_match_ids","Match IDs are invalid!");let i=Array.from(t);this.idSchema!=="sportal365"&&(i=(await this.idMapping.idMappingFacade.getEntitiesByIds({match:Array.from(t)},this.idSchema,"sportal365")).match);let a=new Ts(e),r=await this.https.getMatchOdds(i,a);if(this.idSchema!=="sportal365"){let o=await this.idMapping.idMappingFacade.getEntitiesByIdsMap({match:Array.from(r.keys())},"sportal365",this.idSchema),n=new Map;return Array.from(r.entries()).forEach(([l,p])=>{n.set(o.get(l),p)}),n}return r};validateOddClient=()=>{this.oddClient||this.validator.throwException(412,"odd_client_configuration_not_found","Odds namespace requires oddClient configuration to be set")}};var Up=class{facade;constructor(t){this.facade=new Gp(t)}getByMatchIds=async(t,e)=>await this.facade.getByMatchIds(t,e)};var Vp=class{factory=null;privateLeagueHttps=null;loyaltyHttps=null;profile=null;service=null;discussionsService=null;constructor(t){this.factory=new Di,this.privateLeagueHttps=new Li(t),this.loyaltyHttps=new Rt(t),this.profile=new D(t),this.service=new Gi(t),this.discussionsService=new ne(t)}create=async t=>{let e=this.factory.createRequestBodyFromParam(t,"PRIVATE"),i=await this.privateLeagueHttps.create(e,"PRIVATE_LEAGUE");return await this.service.setTemplateModels(i),i};getById=async(t,e)=>{let i=await this.privateLeagueHttps.getById(t,"PRIVATE_LEAGUE",e);return await this.service.setTemplateModels(i),i};getMyLeagues=async t=>{t=new Js(t);let e=await this.privateLeagueHttps.getMyLeagues(t,"PRIVATE_LEAGUE");return await this.service.setTemplateModelsInLeagues(e),e};update=async(t,e)=>{let i=this.factory.createUpdateRequestBodyFromParam(e,"PRIVATE"),a=await this.privateLeagueHttps.update(t,i,"PRIVATE_LEAGUE");return await this.service.setTemplateModels(a),a};updateTemplate=async(t,e,i)=>{let a=await this.privateLeagueHttps.updateLeagueTemplate(t,e,i,"PRIVATE_LEAGUE");return await this.service.setTemplateModels(a),a};delete=async t=>await this.privateLeagueHttps.delete(t,"PRIVATE_LEAGUE");invite=async(t,e)=>await this.privateLeagueHttps.invite(t,e);deleteInvitation=async(t,e)=>await this.privateLeagueHttps.deleteInvitation(t,e);accept=async t=>{let i=await this.privateLeagueHttps.accept(t,!0,"PRIVATE_LEAGUE");return await this.finalizeAcceptModel(i,!0)};reject=async t=>{let i=await this.privateLeagueHttps.accept(t,!1,"PRIVATE_LEAGUE");return await this.finalizeAcceptModel(i,!1)};banUsers=async(t,e)=>await this.privateLeagueHttps.ban(t,e);unbanUsers=async(t,e)=>await this.privateLeagueHttps.unban(t,e);join=async t=>{let e=await this.privateLeagueHttps.join(t);return await this.finalizeAcceptModel(e,!0)};leave=async t=>await this.privateLeagueHttps.leave(t,"PRIVATE_LEAGUE");finalizeAcceptModel=async(t,e)=>{if(e){let i=await this.getById(t.leagueId);t.leagueModel=i}return await this.service.setProfileModel(t),t};getMyLeaguesStandings=async t=>{t&&(t=new Zs(t));let e=await this.profile.getOwn().getInfo(),i=await this.loyaltyHttps.getUserRankingsForPrivateLeagueAndChallenges(e.id,"PRIVATE_LEAGUE",t);for(let a of i.data){let r=await this.getById(a.privateLeagueId);a.privateLeagueModel=r}return this.service.setTemplateModelsFromLeagueModels(i.data,"PRIVATE_LEAGUE"),i};getInvitations=async t=>{t=new ai(t),t.type="PRIVATE";let e=await this.privateLeagueHttps.getInvitations("PRIVATE_LEAGUE",t);return await this.service.setTemplateModelsInLeagues(e.data),e};getReportedPosts=async(t,e)=>{e&&(e=new ri(e));let i=await this.privateLeagueHttps.getReportedPosts(t,e);return i.data=await this.discussionsService.finalizePostFullModel(i.data),i};getPredictions=async(t,e)=>{if(e){if(e.limit&&e.limit>20)throw new h(400,"invalid_limit","Invalid limit. The maximum limit is: "+20 .toString());e=new oi(e)}let i=await this.privateLeagueHttps.getPredictions(t,e);return await this.service.setModelsForPredictions(i)};moderatePost=async(t,e)=>await this.privateLeagueHttps.moderatePost(t,e)};var Hp=class{privateLeaguesFacade=null;constructor(t){this.privateLeaguesFacade=new Vp(t)}create=async t=>await this.privateLeaguesFacade.create(t);update=async(t,e)=>await this.privateLeaguesFacade.update(t,e);updateTemplate=async(t,e,i)=>await this.privateLeaguesFacade.updateTemplate(t,e,i);delete=async t=>await this.privateLeaguesFacade.delete(t);getById=async(t,e)=>await this.privateLeaguesFacade.getById(t,e);getMyLeagues=async t=>await this.privateLeaguesFacade.getMyLeagues(t);invite=async(t,e)=>await this.privateLeaguesFacade.invite(t,e);deleteInvitation=async(t,e)=>await this.privateLeaguesFacade.deleteInvitation(t,e);accept=async t=>await this.privateLeaguesFacade.accept(t);reject=async t=>await this.privateLeaguesFacade.reject(t);banUsers=async(t,e)=>await this.privateLeaguesFacade.banUsers(t,e);unbanUsers=async(t,e)=>await this.privateLeaguesFacade.unbanUsers(t,e);join=async t=>await this.privateLeaguesFacade.join(t);leave=async t=>await this.privateLeaguesFacade.leave(t);getMyLeaguesStandings=async t=>await this.privateLeaguesFacade.getMyLeaguesStandings(t);getInvitations=async t=>await this.privateLeaguesFacade.getInvitations(t);getReportedPosts=async(t,e)=>await this.privateLeaguesFacade.getReportedPosts(t,e);getPredictions=async(t,e)=>await this.privateLeaguesFacade.getPredictions(t,e);moderatePost=async(t,e)=>await this.privateLeaguesFacade.moderatePost(t,e)};var $p=class{KEY_PREFIX="fu-progress-";get=(t,e)=>{let i=localStorage.getItem(`${this.KEY_PREFIX}${t}-${e}`);return i&&JSON.parse(i)};set=(t,e,i)=>(localStorage.setItem(`${this.KEY_PREFIX}${t}-${e}`,JSON.stringify(i)),JSON.stringify(i));delete=(t,e)=>{localStorage.removeItem(`${this.KEY_PREFIX}${t}-${e}`)}};var zp=class extends K{validatePrediction=t=>{(!t||!Array.isArray(t)||t.length===0||t.some(e=>!e))&&this.throwException(400,"invalid_method_call","The prediction argument is invalid. For more information please visit our documentation")}};var Qp=class{https=null;profile=null;validator=null;constructor(t){this.https=new jt(t),this.profile=new D(t),this.validator=new zp(t.errorHandlingMode)}getGames=async(t,e)=>(t&&(t=new sn(t)),await this.https.getStandingsGames(t,e));getGameById=async(t,e)=>await this.https.getStandingGameById(t,e);makePrediction=async(t,e)=>(this.validator.validatePrediction(e),await this.https.makeStandingGamePrediction(t,e));updatePrediction=async(t,e,i)=>(this.validator.validatePrediction(i),await this.https.updateStandingGamePrediction(t,e,i));getGamePredictionForUser=async(t,e,i)=>{let a=await this.https.getStandingGamePredictionsForUser(t,e,i),r=null;try{r=await this.profile.getById(e).getInfo()}catch(o){console.error(o)}return a.data.forEach(o=>{o.profileModel=r}),a};getRankings=async(t,e,i)=>{e&&(e=new nn(e));let a=await this.https.getStandingGameRankings(t,e,i),r=a.data.map(n=>n.profileId),o=[];return r.length>0&&(o=await this.profile.getByIds(r),a.data=a.data.map(n=>(n.profileModel=o.find(l=>l.id===n.profileId)||null,n))),a}};var qp=class{facade=null;constructor(t){this.facade=new Qp(t)}getGames=async(t,e)=>await this.facade.getGames(t,e);getGameById=async(t,e)=>await this.facade.getGameById(t,e);makePrediction=async(t,e)=>await this.facade.makePrediction(t,e);updatePrediction=async(t,e,i)=>await this.facade.updatePrediction(t,e,i);getGamePredictionForUser=async(t,e,i)=>await this.facade.getGamePredictionForUser(t,e,i);getRankings=async(t,e,i)=>await this.facade.getRankings(t,e,i)};function td(){let s=Zu(),t="-RC",e=null,i=s.version.split("."),a=Number(i[0]),r=Number(i[1]),o=i[2];if(o.includes(t)){let n=o.split(t);o=Number(n[0]),e=Number(n[1])}else o=Number(o);return{version:s.version,major:a,minor:r,patch:o,releaseCandidate:e}}var Yc=null,fu=null;function xd(s){if(Ld(s)){let t=Dd(s);if(t.isValid)return Yc={profile:new D(s),football:new it(s),predictor:new ki(s),loyalty:new se(s),topX:new Hi(s),matchQuiz:new Vi(s),activity:new Yn(s),miniGames:new re(s),discussions:new fp(s),privateLeagues:new Hp(s),challenges:new up(s),progress:new $p,voting:new $i(s),fantasy:new wp(s),helpers:new _p(s),idMapping:new Rp(s),bracketGame:new Gl(s),lists:new Bp(s),standingGame:new qp(s),eventGame:new bp(s),odds:new Up(s),getVersion:td},fu={...s},Yc;Bd(t)}return Yc}var Ld=s=>!Yc||JSON.stringify(s)!==JSON.stringify(fu)||s.authProvider?.getIdToken()!==fu.authProvider?.getIdToken(),Dd=s=>{let e=new $n().validate(s);return(e.idSchema.validation==="missing"||e.idSchema.validation==="invalid")&&(console.warn(e.idSchema.message.text),s.idSchema="native"),(e.environment.validation==="missing"||e.environment.validation==="invalid")&&(console.warn(e.environment.message.text),s.environment="prod"),(e.lang.validation==="missing"||e.lang.validation==="invalid")&&(console.warn(e.lang.message.text),s.lang="en"),(e.errorHandlingMode.validation==="missing"||e.errorHandlingMode.validation==="invalid")&&(console.warn(e.errorHandlingMode.message.text),s.errorHandlingMode="default"),e.authProvider.validation==="invalid"&&console.warn(e.authProvider.message.text),(e.oddClient.message.type==="warning"||e.oddClient.credentials.message.type==="warning")&&console.warn(e.oddClient.message.text||e.oddClient.credentials.message.text),e},Bd=s=>{let t="isValid";Object.keys(s).forEach(e=>{let i=s[e];if(e!==t&&e!=="authProvider"){if(i.message.type==="error")throw new Error(i.message.text)}else if(e!==t&&e==="authProvider"){if(i?.message.type==="error")throw new Error(i.message.text);Object.keys(new pe).forEach(a=>{if(i[a].message.type==="error")throw new Error(i[a].message.text)})}if(e!==t&&e==="oddClient"){if(i?.message.type==="error")throw new Error(i.message.text);let a=i;if(a.credentials.message.type==="error")throw new Error(a.credentials.message.text)}})};export{br as AcceptChallengeModel,js as AcceptPrivateLeagueModel,Yi as AchievementsStats,Ee as ActionValueModel,au as ActionsEnum,Re as ActionsModel,ye as ActivityFilters,nc as ActivityMeta,ge as ActivityResponseBody,Mc as AssetsModel,Te as AutomaticModerationModel,lr as BadgesModel,Wa as BadgesModelV2,pr as BadgesValue,q as BadgesValueV2,_s as BookmakerAssetModel,ws as BookmakerBrandingModel,kc as BookmakerLinkModel,Is as BookmakerModel,Ps as BookmakerUrlModel,Os as BothTeamsFixtureModel,yr as BracketGameFilters,be as BracketGameFixtureScoreModel,gr as BracketGameFixtures,pa as BracketGameFixturesModel,Me as BracketGameMetaModel,ca as BracketGameMetaParticipantsModel,ua as BracketGameModel,fa as BracketGamePredictionFixturesModel,ga as BracketGamePredictionModel,cc as BracketGamePredictionRequestBody,ju as BracketGamePredictionStatusEnum,fr as BracketGamePredictionsFilters,da as BracketGamePredictionsModel,ya as BracketGameRankingsModel,Ie as BracketGameTiebreaker,ha as BracketGameTiebreakerModel,ma as BracketGamesModel,lu as BracketWinnerEnum,fo as BrandingColorsModel,yo as BrandingImagesModel,ho as BrandingModel,go as BrandingUrlsModel,Na as BreakdownModel,Uc as CalculatedOneXTwoFromScoresModel,lc as CampaignModel,Mr as ChallengeCreateModel,wr as ChallengeFilters,Pr as ChallengeRankingsModel,Ir as ChallengeUpdateModel,ze as ClassicQuizBasicModel,Go as ClassicQuizFilters,Qe as ClassicQuizFiltersMeta,Uo as ClassicQuizFullModel,Wo as ClassicQuizLeaderboardFilters,We as ClassicQuizLeaderboardMeta,Ho as ClassicQuizOptionModel,Ac as ClassicQuizParticipationBodyModel,$o as ClassicQuizParticipationModel,zo as ClassicQuizParticipationQuestionModel,Ei as ClassicQuizParticipationsFilters,Vo as ClassicQuizQuestionModel,qo as ClassicQuizQuestionsReportModel,qe as ClassicQuizRankFilters,Ko as ClassicQuizRankModel,Ri as ClassicQuizUserParticipationModel,Qo as ClassicQuizUserParticipationsModel,jo as ClassicQuizUserRank,xc as ClassicQuizUserRankModel,Lc as ClassicQuizzesLeaderboardModel,Oc as ClassicQuizzesModel,ue as ClassicQuizzesStats,wo as ClientBadges,_o as ClientBadgesV2,Kr as CompetitionBasicModel,_i as CompetitionFilters,jr as CompetitionFullModel,Z as CompletedModel,Da as ConsentModel,Kc as ConsentRequestBody,pc as ContentModel,dn as ContestWinners,Ct as ContextModel,Ls as CornersFixtureModel,Vt as CorrectScoreFixtureModel,fi as CreateActivityRequestBody,uc as CreatePostParamBody,Ca as DetailedProfileModel,Ua as DictionaryModel,Tr as DiscussionModel,de as DiscussionStats,rr as DiscussionsBadgeRequirements,or as DiscussionsBadgesValue,Va as DiscussionsConfigModel,Lr as DiscussionsFilters,Dl as DoubleChanceEnum,Ns as DoubleChanceFixtureModel,Ke as EitherOrBasicModel,Yo as EitherOrFilters,Xo as EitherOrFullModel,ts as EitherOrParticipationModel,is as EitherOrParticipationRequestFullModel,es as EitherOrParticipationRequestModel,rs as EitherOrParticipationStepsModel,Fi as EitherOrParticipationStepsOptionModel,Jo as EitherOrPointsModel,os as EitherOrResultsBreakdownModel,ss as EitherOrResultsModel,ns as EitherOrResultsStandingsModel,me as EitherOrStats,Zo as EitherOrStatsModel,Dc as EitherOrsModel,Pc as EntitiesFollows,Tc as EntitiesFollowsFilters,Qi as EnvironmentEnum,C as ErrorCodes,Yp as ErrorHandlingModeEnum,x as ErrorMessages,A as ErrorStatuses,Br as EventGameFilters,hc as EventGameFixtureEnumModel,fc as EventGameFixtureNumberModel,dc as EventGameFixtures,At as EventGameFixturesModel,Sa as EventGameModel,oc as EventGameOutcomeTypeEnum,Ot as EventGamePredictionFixturesModel,Ra as EventGamePredictionModel,mc as EventGamePredictionRequestBody,Yu as EventGamePredictionStatusEnum,Nr as EventGamePredictionsFilters,va as EventGamePredictionsModel,kr as EventGameRankingsFilters,Fa as EventGameRankingsModel,_e as EventGameTiebreaker,Ea as EventGameTiebreakerModel,Ta as EventGamesModel,Ba as ExternalActivityModel,xd as FansUnitedSDK,Ic as FansUnitedSDKModel,Kt as FansUnitedSdkFetchException,Le as FantasyCoefficientsModel,ur as FantasyConfigModel,dr as FantasyMultipliersModel,Ur as FantasyPlayerDetailedStatsMetaModel,Vr as FantasyPlayerDetailedStatsModel,Hr as FantasyPlayerStatsModel,zr as FantasyPlayersMetaModel,De as FantasyPlayersModel,Qr as FantasyPlayersPointsModel,Ge as FantasyPredictionRequestBody,vo as FiltersMetaModel,ln as FixturesGamesModel,No as FixturesMatchQuizModel,As as FixturesPredictionModel,Ye as FixturesResponseModel,cn as FixturesTopXModel,Ii as FollowFilters,bi as FollowModel,xa as FollowStatusModel,Oa as FollowersModel,Aa as FollowingModel,tr as FootballBadgeRequirements,er as FootballBadgesValue,Yr as FootballCountryModel,hu as FootballMatchStatusEnum,Xt as FootballPaginationModel,on as FullInterestModel,ka as FullnessProfile,Ya as GameBadgeRequirements,Xa as GameBadgesValue,si as GameByIdModel,ko as GameMarketsResults,Jt as GameModel,mi as GamePredictionsStats,un as GameResultsModel,ft as GameStatusEnum,Ja as GamesBadgeRequirements,Za as GamesBadgesValue,nt as GamesFilters,Tt as GamesListModel,Pt as GamesMatchQuizListModel,Ht as GamesTopXListModel,cr as GeneralBadgesValue,xe as GeneralRequirementModel,Bl as HalfTimeFullTimeEnum,Gs as HalfTimeFullTimeFixtureModel,Po as HighestSuccessRateFilters,So as HighestSuccessRateModel,N as IdSchemaEnum,W as ImagesModel,rn as InterestModel,ai as InvitationFilters,On as LangEnum,La as LeadModel,Wc as LeadRequestBody,Ec as LeaderboardLeagueResponse,$e as LeaderboardModel,Rc as LeaderboardResponseModel,To as LeagueLeaderboardFilters,He as LeagueLeaderboardMetaModel,Ve as LineupsModel,Io as ListContentFilters,mr as ListContentModel,Rn as ListContentResponseModel,Ha as LoyaltyConfigModel,nr as LoyaltyConfigModelV2,Eo as LoyaltyFilters,Bt as LoyaltyMeta,bo as MappingModel,Mo as MappingResponseModel,rt as MarketEnum,Gc as MarketsConfigModel,Xr as MatchBasicModel,ti as MatchCorrectScoreMarketResultModel,gt as MatchFilters,Jr as MatchFullModel,qs as MatchMarketsResultsModel,Ts as MatchOddsFilters,du as MatchOddsMarketEnum,Es as MatchOddsMarketModel,Rs as MatchOddsMarketScopeModel,Fs as MatchOddsMarketSelectionModel,Ss as MatchOddsMarketTypeModel,Cs as MatchOddsModel,Qs as MatchPlayerMarketResultModel,Se as MatchQuizConfigModel,X as MatchStatus,Ks as MatchSummaryModel,k as MetaFootballModel,as as MiniGameImages,ir as MiniGamesBadgeRequirements,ar as MiniGamesBadgesValue,Gt as MiniGamesContext,Ut as MiniGamesContextTag,kt as MiniGamesFilters,_r as MyChallengesFilters,Js as MyLeaguesFilters,L as NoYesModel,uu as OddFormatEnum,pu as OddTypeEnum,Ll as OneXTwoEnum,Vs as OneXTwoFixtureModel,Ju as OutcomeEnum,Je as OverCornersFixtureModel,Ze as OverGoalsFixtureModel,na as OwnActivityFilters,ea as PaginationActivities,Y as PaginationFootballProperties,Hc as PastTemplateModel,Hs as PenaltyMatchFixtureModel,je as PersonalityQuizBasicModel,hs as PersonalityQuizFilters,ms as PersonalityQuizFullModel,ds as PersonalityQuizOptionModel,Nc as PersonalityQuizParticipationBodyModel,fs as PersonalityQuizParticipationModel,gs as PersonalityQuizParticipationQuestionModel,bs as PersonalityQuizParticipationsFilters,ys as PersonalityQuizPersonaPercentsModel,us as PersonalityQuizPersonaPointsModel,ps as PersonalityQuizPersonaResultsModel,cs as PersonalityQuizQuestionModel,Ms as PersonalityQuizUserParticipationsModel,Bc as PersonalityQuizzesModel,gc as PlayerAssetsModel,ao as PlayerBasicModel,Ue as PlayerDetailedPointsModel,Gr as PlayerDetailedStatsFilters,qr as PlayerDetailedStatsModel,Ti as PlayerFilters,st as PlayerFixtureModel,ro as PlayerFullModel,yc as PlayerMarketResultModel,Wr as PlayerPointsModel,no as PlayerShortModel,oo as PlayerSquadModel,Dt as PlayerStatsMatchModel,io as PlayerStatsModel,$r as PlayersPointsFilters,Fc as Points,$a as PointsModel,Sc as PointsValueModel,_c as PollBadgesValue,pi as PollBasicModel,hn as PollFullModel,fn as PollOptionModel,$t as PollVoteBasicModel,gn as PollVoteFullModel,li as PollsFilters,bn as PollsModel,Mn as PollsUserVotesModel,ke as PostByIdBasicModel,Er as PostByIdFullModel,Rr as PostCreateModel,Fr as PostsCountDiscussionModel,Sr as PostsDiscussionBasicModel,Yt as PostsFilters,vr as PostsFullModel,Lt as PostsMetaModel,Cr as PostsModel,Ae as PotmBadgesValue,Pn as PotmResultsMetaModel,En as PotmResultsModel,Tn as PotmResultsResponseModel,In as PotmUserVotesFilters,_n as PotmUserVotesModel,wn as PotmUserVotesResponseModel,Bo as PredictionMatchQuizModel,ei as PredictionRequestModel,Si as PredictionResponseModel,pn as PredictionTopXModel,V as PredictionsFilters,Ws as PredictionsModel,fe as PredictionsStats,Ka as PredictorBadgeRequirements,ja as PredictorBadgesValue,Ce as PredictorConfigModel,ci as PreferenceMappingModel,wc as PreferenceModel,Be as PrivateLeagueBasicCreateModel,Ne as PrivateLeagueBasicUpdateRequestBody,en as PrivateLeagueCreateModel,Zs as PrivateLeagueFilters,Ys as PrivateLeagueFullModel,ii as PrivateLeagueModel,$c as PrivateLeagueParamCreateBody,zc as PrivateLeagueParamUpdateBody,ri as PrivateLeaguePostsFilters,Xs as PrivateLeaguePredictionModel,oi as PrivateLeaguePredictionsFilters,Qc as PrivateLeaguePredictionsModel,tn as PrivateLeagueRankingsModel,an as PrivateLeagueUpdateModel,qc as PrivateLeaguesModel,Ga as ProfileCountryModel,Pe as ProfileModel,Ji as ProfileStatsModel,Ro as RankingsFilters,Ao as RankingsModel,Ar as ReactionModel,zs as RedCardFixtureModel,z as RelatedEntityRelationship,Or as ReportModel,xt as RequirementModel,Xe as ResultModel,ls as ResultsSummaryModel,Fe as RewardsModel,Oe as RewardsModelV2,ul as SDKConfiguraitonModel,ul as SDKConfigurationModel,cu as ScopeTypeEnum,to as ScoresModel,mo as SearchFilters,uo as SearchModel,vs as SelectionProviderInfoModel,yn as SinglePollVoteModel,Zi as SinglePredictionsBreakdown,he as SinglePredictionsStats,h as StandardFansUnitedException,we as StandingGameMetaModel,Ia as StandingGameMetaParticipantsModel,ba as StandingGameModel,wa as StandingGamePredictionModel,_a as StandingGamePredictionsModel,nn as StandingGameRankingsFilters,Pa as StandingGameRankingsModel,sn as StandingGamesFilters,Ma as StandingGamesModel,Zr as StatsModel,dl as StatusEnum,ta as SuccessRatePercent,za as SuccessRateScopeModel,Xi as SuccessRates,Wt as SummarizedBreakdown,hr as TagsModel,lo as TeamBasicModel,po as TeamColors,Pi as TeamFilters,bc as TeamFormModel,co as TeamFullModel,vc as TemplateBreakdownModel,Oo as TemplateBreakdownPointsModel,xo as TemplateByIdModel,Fo as TemplateFilters,Do as TemplateGroupFilter,Lo as TemplateGroups,Co as TemplateMeta,Nt as TemplateModel,bt as TiebreakerModel,Cc as TiersModel,yt as TimeTiebreaker,eo as TimelineModel,Vc as TopCorrectScoresModel,Dr as TopDiscussionsFilters,so as TopPlayerModel,ve as TopXConfigModel,ni as TopXPredictionRequestModel,Xu as UserActionsEnum,la as UserActivityFilters,Qa as UserDataConfigModel,mn as UserListWinners,$s as ValueAndPlayerId,ot as ValueBoolean,xs as ValueCorners,Ds as ValueCorrectScore,Bs as ValueDoubleChance,ks as ValueHalfTimeFullTime,Us as ValueOneXTwo,xr as VersionsModel,sr as VotingBadgeRequirements,qa as VotingBadgesValue};
3
+ ${tu.PREDICTOR_USER_RELATED_OPERATION}`},Pu=(s,t)=>`The prediction '${s}' 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`,Zp=s=>`The market '${s}' is not supported from Fans United. For more information please visit our documentation: https://docs.fansunitedmedia.com/docs/predictor-operations#make-football-prediction`,Tu=s=>`The market '${s}' is not valid for Top X game. The only available market is CORRECT_SCORE.`,Eu=s=>`The field/s '${s.length>1?s.join(", "):s[0]}' is/are invalid. For more information please visit our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk`,Ru=(s,t)=>`The following field/s is/are missing from ${s}: '${t.length>1?t.join(", "):t[0]}'. For more information please visit our documentation: https://docs.fansunitedmedia.com/docs/predictor-operations#make-football-prediction`,Fu=(s,t)=>`The field ${s} has incorrect type. The correct type is ${t}`;var Kt=class{data={error:{code:0,status:"",message:""}};status=0;statusText="";headers=null;constructor(t,e){this.data.error.code=e.code,this.data.error.status=e.status,this.data.error.message=e.message,this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}errorMessage=()=>this.data.error.message};var h=class{error={code:0,status:"",message:""};constructor(t,e,i){this.error.code=t,this.error.status=e,this.error.message=i}};var v=class{baseUrl=null;apiSignInUrl=null;jwtToken=null;idSchema=null;retryRequest=!1;headers=null;authHeaders=null;errorHandlingMode=null;configuration=null;constructor(t,e){this.baseUrl=e,this.configuration=t,this.apiSignInUrl=`?key=${t.apiKey}&client_id=${t.clientId}`,this.errorHandlingMode=t.errorHandlingMode,this.idSchema=t.idSchema,this.headers={"Content-Type":"application/json"}}getJwtToken=()=>{if(this.configuration.cookieToken){let t=[];typeof document>"u"?t=(this.configuration.cookieToken.requestHeaders.get("cookie")||"").split(";"):t=document.cookie.split(";");let e=t.find(r=>r.trim().startsWith(`${this.configuration.cookieToken.name}=`));if(!e)return"";let i=e.split("=")[1].trim(),a=decodeURIComponent(i);try{let r=JSON.parse(a);return r.token||r||""}catch{return a}}return this.configuration.authProvider?.getIdToken()||""};getAuthHeaders=()=>({"Content-Type":"application/json",Authorization:`Bearer ${this.getJwtToken()}`});fetchWithoutAuth=async(t,e,i,a)=>{let r=null;a?r=await fetch(this.baseUrl+t,{headers:this.headers,method:i||"GET",body:JSON.stringify(a)}):r=await fetch(this.baseUrl+t,{headers:this.headers,method:i||"GET"});let o=await r.json();if(!r.ok){let n=this.transformFetchException(r,o);throw console.warn(e,n),n}return o};fetchWithoutAuthAdditionalHeaders=async(t,e,i)=>{let a=await fetch(this.baseUrl+t,{headers:{...this.headers,...i}}),r=await a.json();if(!a.ok){let o=this.transformFetchException(a,r);throw console.warn(e,o),o}return r};fetchWithAuth=async(t,e,i,a)=>{this.validateJWTToken();let r=null,o=null;if(i&&a?r=await fetch(this.baseUrl+t,{method:i,headers:this.getAuthHeaders(),body:JSON.stringify(a)}):i&&!a?r=await fetch(this.baseUrl+t,{method:i,headers:this.getAuthHeaders()}):r=await fetch(this.baseUrl+t,{headers:this.getAuthHeaders()}),i!=="DELETE"&&(o=await r.json()),!r.ok){(r.status===401||r.status===403)&&!this.retryRequest&&(this.retryRequest=!0,await this.fetchWithAuth(t,e,i,a)),this.retryRequest=!1;let n=this.transformFetchException(r,o||await r.json());throw console.warn(e,n),n}return this.retryRequest=!1,o};fetchWithAuthNewBaseURL=async(t,e,i,a,r)=>{this.validateJWTToken();let o=null,n=null;if(a&&r?o=await fetch(t+e,{method:a,headers:this.getAuthHeaders(),body:JSON.stringify(r)}):a&&!r?o=await fetch(t+e,{method:a,headers:this.getAuthHeaders()}):o=await fetch(t+e,{headers:this.getAuthHeaders()}),a!=="DELETE"&&(n=await o.json()),!o.ok){(o.status===401||o.status===403)&&!this.retryRequest&&(this.retryRequest=!0,await this.fetchWithAuthNewBaseURL(t,e,i,a,r)),this.retryRequest=!1;let l=this.transformFetchException(o,n||await o.json());throw console.warn(i,l),l}return this.retryRequest=!1,n};transformFetchException=(t,e)=>{if(!e&&t.status===401){if(this.errorHandlingMode==="standard")return new h(401,"unauthorized","Invalid JWT token is provided");let o={code:401,status:"unauthorized",message:"Invalid JWT token is provided"};return new Kt(t,o)}let{code:i,status:a,message:r}=e.error;return this.errorHandlingMode==="standard"?new h(i,a,r):new Kt(t,e.error)};validateJWTToken=()=>{let t=null;try{t=Zc(this.getJwtToken())}catch(i){if(this.errorHandlingMode==="default"){let a={status:401,statusText:i.message,headers:{}},r={code:401,status:"invalid_token",message:"Invalid JWT token is provided"};throw new Kt(a,r)}else if(this.errorHandlingMode==="standard")throw new h(401,"invalid_token","Invalid JWT token is provided")}if(Date.now()>t.exp*1e3){if(this.errorHandlingMode==="default"){let i={status:401,statusText:"",headers:{}},a={code:401,status:"invalid_token",message:"The provided JWT token is expired"};throw new Kt(i,a)}else if(this.errorHandlingMode==="standard")throw new h(401,"invalid_token","The provided JWT token is expired")}};extractUserIdFromToken=()=>{try{return Zc(this.getJwtToken())?.sub||""}catch(t){return console.error(t),""}}};var hi=class extends v{activityRemapper=null;constructor(t){super(t,O(t.environment,"loyalty")),this.activityRemapper=new zn}createActivity=async t=>{let e=`/activities${this.apiSignInUrl}`,i="There was a problem with creating activity",a="POST",r=await this.fetchWithAuth(e,i,a,t);return this.activityRemapper.remapSingleResponse(r)};deleteActivity=async t=>{let e=`/activities/${t}${this.apiSignInUrl}`,i=`There was a problem deleting the following activity: ${t}`,a="DELETE";return await this.fetchWithAuth(e,i,a),!0};getOwnActivities=async(t,e)=>{let i=`/activities${this.apiSignInUrl}`,a=Date.now(),r="There was a problem with fetching own activities";t&&(i+=`${t.constructFilterUrl()}`),e&&(i+=`disable_cache=${a}`);let o=await this.fetchWithAuth(i,r);return this.activityRemapper.remapActivitiesResponse(o)};getActivitiesForUser=async(t,e,i)=>{let a=`/users/${t}/activities${this.apiSignInUrl}`,r=Date.now(),o=`There was a problem with fetching activities for user: ${t}`;e&&(a+=`${e.constructFilterUrl()}`),i&&(a+=`disable_cache=${r}`);let n=await this.fetchWithoutAuth(a,o);return this.activityRemapper.remapActivitiesResponse(n)};getStats=async(t,e)=>{let i="",a="",r=null;return t?(i+=f(e)?`/users/${t}/statistics${this.apiSignInUrl}${m()}`:`/users/${t}/statistics${this.apiSignInUrl}`,a=`There was a problem fetching statistics for profile: ${t}`,r=await this.fetchWithoutAuth(i,a)):(i+=`/statistics${this.apiSignInUrl}`,a="There was a problem fetching profile`s statistics",r=await this.fetchWithAuth(i,a)),this.activityRemapper.remapStatsResponse(r.data)}};var au=(g=>(g.LIKE="like",g.DISLIKE="dislike",g.PAGE_VIEW="page_view",g.CONTENT_CONSUMED="content_consumed",g.SHARE="share",g.COMMENT="comment",g.CLICK_AD="click_ad",g.PREDICTION_MADE="prediction_made",g.CONVERT="convert",g.MANAGE_INTERESTS="manage_interests",g.GAME_PARTICIPATION="game_participation",g.ARTICLE_CONSUMED="article_consumed",g.VIDEO_CONSUMED="video_consumed",g.SHORT_VIDEO_CONSUMED="short_video_consumed",g.LONG_VIDEO_CONSUMED="long_video_consumed",g.AUDIO_CONSUMED="audio_consumed",g.GALLERY_CONSUMED="gallery_consumed",g.IMAGE_CONSUMED="image_consumed",g.POLL_PARTICIPATION="poll_participation",g))(au||{});var fi=class{action=null;context=new Ct;constructor(t,e,i,a){this.action=t,this.context.tags=e,i&&(this.context.content=i),a&&(this.context.campaign=a)}};var Qn={player:"players",team:"teams",homeTeam:"teams",awayTeam:"teams",country:"countries",competition:"competitions",match:"matches"},qn=class extends v{constructor(t){super(t,O(t.environment,"idMapping"))}getEntityById=async(t,e)=>{let i=`/football${this.apiSignInUrl}&input_provider=${this.idSchema}&${Qn[t]}=${e}`,a=`There was a problem with id mapping request for the following id: ${e}`;return await this.fetchWithoutAuth(i,a)};getEntityByIdAndSchema=async(t,e,i)=>{let a=`/football${this.apiSignInUrl}&input_provider=${i}&${Qn[t]}=${e}`,r=`There was a problem with id mapping request for the following id: ${e}`;return await this.fetchWithoutAuth(a,r)};getEntityIdsByIdsAndSchema=async(t,e,i)=>{let a=`/football${this.apiSignInUrl}&input_provider=${i}&${Qn[t]}=${e.join(",")}`,r=`There was a problem with id mapping request for the following ids: ${e.join(",")}`;return await this.fetchWithoutAuth(a,r)};getEntitiesByIds=async(t,e,i)=>{e.sort((o,n)=>o.localeCompare(n));let a=Xc(e),r=[];for(let o of a){let n=`/football${this.apiSignInUrl}&input_provider=${i}&${Qn[t]}=${o.join(",")}`,l=`There was a problem with id mapping request for the following ids :${o.join(",")}`,p=await this.fetchWithoutAuth(n,l);r=[...r,...p.data]}return r};getEntitiesByIdObjs=async(t,e)=>{let i=[],a={},r=[];Object.keys(t).forEach(p=>{i.push.apply(i,t[p])});let o=ce(i),n=Xc(o);for(let p of n){let c="";if(Object.keys(t).forEach(u=>{a[u]=[];let d=p.filter(M=>t[u].includes(M));d&&d.length>0&&(a[u]=d)}),Object.keys(a).forEach(u=>{a[u].length>0&&(a[u].sort((d,M)=>d.localeCompare(M)),c+="&",c+=`${Qn[u]}=${a[u].join(",")}`)}),c&&c.length>0){let u=`/football${this.apiSignInUrl}&input_provider=${e||"native"}${c}`,d="There was a problem with id mapping request",M=await this.fetchWithoutAuth(u,d);r.push(M.data)}else r.push([])}return Array.prototype.concat.apply([],r)};getTopEntities=async()=>{let t=`/football/top${this.apiSignInUrl}`,e="There was a problem with top id mappings request";return(await this.fetchWithoutAuth(t,e)).data}};var ru="FansUnited",tc={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}}},ia=class{idSchema="";storageInstance=null;expirationProfileTimeout=600;expirationBadgesTimeout=3600;expirationClientFeaturesTimeout=14400;expirationFootballIdsTimeout=604800;constructor(t){this.idSchema=t,this.getStorageInstance()}static getInstance(t){return ia.instance||(ia.instance=new ia(t)),ia.instance}async getStorageInstance(){try{let t=await Promise.resolve().then(()=>(vu(),Su));this.storageInstance=t.default}catch(t){console.error(t)}}async getData(){try{let t=await this.storageInstance.getItem(ru);return t?JSON.parse(t):(await this.storageInstance.setItem(ru,JSON.stringify(tc)),tc)}catch(t){throw console.error("AsyncStorage error:",t),t}}async setData(t){await this.storageInstance.setItem(ru,JSON.stringify(t))}clearData=async()=>{await this.setData(tc)};getCompetitions=async t=>{let e=await this.getData();return t?t.competitionSearchFilter(e.football.competitions):e.football.competitions};setCompetitions=async t=>{let e=await this.getData(),i=[...e.football.competitions];i.push(...t),e.football.competitions=this.makeCompetitionsUnique(i),await this.setData(e)};getCompetitionsLength=async()=>(await this.getData()).football.competitions.length;getEntityById=async(t="",e="")=>(await this.getData()).football.ids.find(a=>{let r=G[this.idSchema];return a&&`${a[r]}`===e&&a.resource===t});getEntity=async(t,e,i)=>{let a=await this.getData();return Array.isArray(t)?a.football.ids.filter(r=>{let o=G[i];return r&&t.includes(`${r[o]}`)&&r.resource===e}):a.football.ids.find(r=>{let o=G[i];return r&&`${r[o]}`===t&&r.resource===e})};checkForExistingIdObjs=async(t,e)=>{let i=G[e],a={};for(let r of Object.keys(t)){let o=t[r],l=(await this.getEntity(o,r,e)).map(c=>c[i]),p=t[r].filter(c=>!l.includes(c));a[r]=o.map(c=>p.includes(c)?{id:c,exists:!1}:{id:c,exists:!0})}return a};getIdsByType=async(t,e,i)=>{let a=await this.getData(),r=G[i],o=G[e],n={};return Object.keys(t).forEach(l=>{let p=t[l],c=[];a.football.ids.forEach(u=>{p.forEach((d,M)=>{d===u[o]&&l===u.resource&&(c[M]=u[r])})}),n[l]=c}),n};addIdMapping=async t=>{let e=await this.getData();e.football.ids.push(t),await this.setData(e)};addIdMappings=async t=>{let e=await this.getData(),i=e.football.ids;i=[...i,...t],e.football.ids=i,await this.setData(e)};addTopIdMappings=async t=>{let e=await this.getData();if(e.football.ids.length){let i=JSON.parse(JSON.stringify(e.football.ids));i=i.filter(a=>a.resource!=="match"),t=t.filter(a=>a.resource==="match"),i=[...i,...t],e.football.ids=i}else e.football.ids=t;e.football.expirations.ids=Math.floor(Date.now()/1e3)+this.expirationFootballIdsTimeout,await this.setData(e)};setOwnProfile=async t=>{let e=await this.getData();e.profile.info=t,e.profile.expirations.profile=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,await this.setData(e)};getOwnProfile=async()=>(await this.getData()).profile.info;getProfileCountries=async()=>(await this.getData()).profile.countries;setProfileCountries=async t=>{let e=await this.getData();e.profile.countries=t,await this.setData(e)};getProfileStats=async()=>(await this.getData()).profile.statistics;setProfileStats=async t=>{let e=await this.getData();e.profile.statistics=t,e.profile.expirations.statistics=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,await this.setData(e)};getProfileBadges=async()=>(await this.getData()).profile.badges;setProfileBadges=async t=>{let e=await this.getData();e.profile.badges=t,e.profile.expirations.badges=Math.floor(Date.now()/1e3)+this.expirationBadgesTimeout,await this.setData(e)};getFootballCountries=async()=>(await this.getData()).football.countries;setFootballCountries=async t=>{let e=await this.getData();e.football.countries=t,await this.setData(e)};getClientFeatures=async()=>(await this.getData()).client.features;setClientFeatures=async t=>{let e=await this.getData(),i=JSON.parse(JSON.stringify(t));e.client.expirations.features=Math.floor(Date.now()/1e3)+this.expirationClientFeaturesTimeout,e.client.features=i,await this.setData(e)};deleteClientFeatures=async()=>{let t=await this.getData(),e=JSON.parse(JSON.stringify(t));e.client={features:{},expirations:{features:0}},await this.setData(e)};getExpiration=async(t,e)=>{await this.initialNewSchema(t,"expirations");let i=await this.getData();switch(e){case"profile":return i.profile.expirations.profile;case"statistics":return i.profile.expirations.statistics;case"badges":return i.profile.expirations.badges;case"features":return i.client.expirations.features;case"ids":return i.football.expirations.ids}};makeCompetitionsUnique=t=>{let e=new Set;return t.filter(i=>{let a=!e.has(i.id);return e.add(i.id),a})};initialNewSchema=async(t,e)=>{let i=await this.getData();(!i||!i[t]||!i[t][e])&&await this.setData(tc)}},aa=ia;at(aa,"instance");var ou="FansUnited",su={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}}},ra=class{idSchema="";expirationProfileTimeout=600;expirationBadgesTimeout=3600;expirationClientFeaturesTimeout=14400;expirationFootballIdsTimeout=604800;constructor(t){this.idSchema=t}static getInstance(t){return ra.instance||(ra.instance=new ra(t)),ra.instance}clearData=async()=>{this.setData(su)};getEntityById=async(t="",e="")=>this.getData().football.ids.find(i=>{let a=G[this.idSchema];return i&&`${i[a]}`===e&&i.resource===t});getEntity=(t,e,i)=>Array.isArray(t)?this.getData().football.ids.filter(a=>{let r=G[i];return a&&t.includes(`${a[r]}`)&&a.resource===e}):this.getData().football.ids.find(a=>{let r=G[i];return a&&`${a[r]}`===t&&a.resource===e});getEntityByNativeId=(t="",e="")=>this.getData().football.ids.find(i=>i&&`${i.id}`===e&&i.resource===t);checkForExistingIdObjs=async(t,e)=>{let i=G[e],a={};return Object.keys(t).forEach(r=>{let o=t[r],l=this.getEntity(o,r,e).map(c=>c[i]),p=t[r].filter(c=>!l.includes(c));a[r]=o.map(c=>p.includes(c)?{id:c,exists:!1}:{id:c,exists:!0})}),a};getIdsByType=async(t,e,i)=>{let a=G[i],r=G[e],o={};return Object.keys(t).forEach(n=>{let l=t[n],p=[];this.getData().football.ids.forEach(c=>{l.forEach((u,d)=>{u===c[r]&&n===c.resource&&(p[d]=c[a])})}),o[n]=p}),o};addIdMapping=t=>{let e=this.getData();e.football.ids.push(t),this.setData(e)};addIdMappings=async t=>{let e=this.getData(),i=e.football.ids;i=[...i,...t],e.football.ids=i,this.setData(e)};addTopIdMappings=async t=>{let e=this.getData();if(e.football.ids.length){let i=JSON.parse(JSON.stringify(e.football.ids));i=i.filter(a=>a.resource!=="match"),t=t.filter(a=>a.resource==="match"),i=[...i,...t],e.football.ids=i}else e.football.ids=t;e.football.expirations.ids=Math.floor(Date.now()/1e3)+this.expirationFootballIdsTimeout,this.setData(e)};setOwnProfile=async t=>{let e=this.getData();e.profile.info=t,e.profile.expirations.profile=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,this.setData(e)};getOwnProfile=()=>this.getData().profile.info;getProfileCountries=()=>this.getData().profile.countries;setProfileCountries=async t=>{let e=this.getData();e.profile.countries=t,this.setData(e)};getProfileStats=()=>this.getData().profile.statistics;setProfileStats=async t=>{let e=this.getData();e.profile.statistics=t,e.profile.expirations.statistics=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,this.setData(e)};getProfileBadges=()=>this.getData().profile.badges;setProfileBadges=async t=>{let e=this.getData();e.profile.badges=t,e.profile.expirations.badges=Math.floor(Date.now()/1e3)+this.expirationBadgesTimeout,this.setData(e)};getFootballCountries=()=>this.getData().football.countries;setFootballCountries=async t=>{let e=this.getData();e.football.countries=t,this.setData(e)};getCompetitions=t=>{let e=this.getData();return t?t.competitionSearchFilter(e.football.competitions):e.football.competitions};setCompetitions=async t=>{let e=this.getData(),i=[...e.football.competitions];i.push(...t),e.football.competitions=this.makeCompetitionsUnique(i),this.setData(e)};getCompetitionsLength=async()=>{let{football:t}=this.getData();return t.competitions.length};getClientFeatures=()=>this.getData().client.features;setClientFeatures=async t=>{let e=this.getData(),i=JSON.parse(JSON.stringify(t));e.client.expirations.features=Math.floor(Date.now()/1e3)+this.expirationClientFeaturesTimeout,e.client.features=i,this.setData(e)};deleteClientFeatures=async()=>{let t=this.getData(),e=JSON.parse(JSON.stringify(t));e.client={features:{},expirations:{features:0}},this.setData(e)};getExpiration=async(t,e)=>{this.initialNewSchema(t,"expirations");let i=this.getData();switch(e){case"profile":return i.profile.expirations.profile;case"statistics":return i.profile.expirations.statistics;case"badges":return i.profile.expirations.badges;case"features":return i.client.expirations.features;case"ids":return i.football.expirations.ids}};makeCompetitionsUnique=t=>{let e=new Set;return t.filter(i=>{let a=!e.has(i.id);return e.add(i.id),a})};getData=()=>(localStorage.getItem(ou)||this.setData(su),JSON.parse(localStorage.getItem(ou)));setData=t=>{localStorage.setItem(ou,JSON.stringify(t))};initialNewSchema=(t,e)=>{let i=this.getData();(!i||!i[t]||!i[t][e])&&this.setData(su)}},oa=ra;at(oa,"instance");var Ku=ud(Wu());var T=class{profileTTL=600;clientTTL=14400;profileBadgesTTL=3600;idMappingsExpiration=0;idSchema="";constructor(t){}static getInstance(t){return T.instance||(T.instance=new T(t),T.nodeCache.options.useClones=!1),T.instance}clearData=async()=>T.nodeCache.flushAll();getEntityById=async(t,e)=>{let i=T.nodeCache.get("ids");return i?i.find(a=>{let r=G[this.idSchema];return a&&`${a[r]}`===e&&a.resource===t}):null};getEntity=async(t,e,i)=>{let a=T.nodeCache.get("ids");return a?Array.isArray(t)?[]:null:Array.isArray(t)?a.filter(r=>{let o=G[i];return r&&t.includes(`${r[o]}`)&&r.resource===e}):a.find(r=>{let o=G[i];return r&&`${r[o]}`===t&&r.resource===e})};checkForExistingIdObjs=async(t,e)=>{let i=G[e],a={};for(let r of Object.keys(t)){let o=t[r],l=(await this.getEntity(o,r,e)).map(c=>c[i]),p=t[r].filter(c=>!l.includes(c));a[r]=o.map(c=>p.includes(c)?{id:c,exists:!1}:{id:c,exists:!0})}return a};getIdsByType=async(t,e,i)=>{let a=G[i],r=G[e],o=T.nodeCache.get("ids"),n={};return o?(Object.keys(t).forEach(l=>{let p=t[l],c=[];o.forEach(u=>{p.forEach((d,M)=>{d===u[r]&&l===u.resource&&(c[M]=u[a])})}),n[l]=c}),n):null};addIdMapping=async t=>{let e=T.nodeCache.get("ids");e.push(t),T.nodeCache.set("ids",e)};addIdMappings=async t=>{let e=T.nodeCache.get("ids");e=[...e,...t],T.nodeCache.set("ids",e)};addTopIdMappings=async t=>{let e=T.nodeCache.get("ids"),i=604800;if(e){let a=JSON.parse(JSON.stringify(e));a=a.filter(r=>r.resource!=="match"),t=t.filter(r=>r.resource==="match"),a=[...a,...t],T.nodeCache.set("ids",a)}else T.nodeCache.set("ids",t);this.idMappingsExpiration=Math.floor(Date.now()/1e3)+i};setOwnProfile=async t=>{T.nodeCache.set("profile",t,this.profileTTL)};getOwnProfile=async()=>T.nodeCache.get("profile");getProfileCountries=async()=>T.nodeCache.get("profile_countries");setProfileCountries=async t=>{T.nodeCache.set("profile_countries",t)};getProfileStats=async()=>T.nodeCache.get("profile_stats");setProfileStats=async t=>{T.nodeCache.set("profile_stats",t,this.profileTTL)};getProfileBadges=async()=>T.nodeCache.get("profile_badges");setProfileBadges=async t=>{T.nodeCache.set("profile_badges",t,this.profileBadgesTTL)};getFootballCountries=async()=>T.nodeCache.get("football_countries");setFootballCountries=async t=>{T.nodeCache.set("football_countries",t)};getCompetitions=async t=>{let e=T.nodeCache.get("football_competitions");return e?t?t.competitionSearchFilter(e):e:null};setCompetitions=async t=>{T.nodeCache.set("football_competitions",t)};getCompetitionsLength=async()=>{let t=T.nodeCache.get("football_competitions");return t?t.length:0};getClientFeatures=async()=>T.nodeCache.get("client");setClientFeatures=async t=>{T.nodeCache.set("client",t,this.clientTTL)};deleteClientFeatures=async()=>{T.nodeCache.del("client")};getExpiration=async(t,e)=>{let i=this.getKeyFromExpirationType(e);return i==="ids"?this.idMappingsExpiration:T.nodeCache.getTtl(i)};getKeyFromExpirationType=t=>{switch(t){case"profile":return"profile";case"statistics":return"profile_stats";case"badges":return"profile_badges";case"features":return"client";case"ids":return"ids"}}},gi=T;at(gi,"instance"),at(gi,"nodeCache",new Ku.default);var ct=class{createLocalCacheInstance=t=>typeof window>"u"?gi.getInstance(t):typeof __DEV__<"u"?aa.getInstance(t):oa.getInstance(t)};var yi=class{localCache=null;https=null;constructor(t){this.localCache=new ct().createLocalCacheInstance(t.idSchema),this.https=new qn(t)}getEntitiesByIds=async(t,e,i)=>{await this.setTopIdMappings();try{let a=await this.localCache.checkForExistingIdObjs(t,e),r=this.splitForRequestAndExisting(a),o=await this.https.getEntitiesByIdObjs(r.request,e);return await this.localCache.addIdMappings(o),await this.localCache.getIdsByType(t,e,i)}catch(a){return console.warn("There was a problem retrieving the entity ids ",a),Promise.resolve([])}};getEntitiesByIdsMap=async(t,e,i)=>{await this.setTopIdMappings();try{let a=JSON.parse(JSON.stringify(t)),r=await this.localCache.checkForExistingIdObjs(t,e),o=this.splitForRequestAndExisting(r),n=await this.https.getEntitiesByIdObjs(o.request,e);await this.localCache.addIdMappings(n);let l=await this.localCache.getIdsByType(t,e,i),p=new Map;return Object.keys(a).forEach(c=>{a[c].forEach((u,d)=>{let M=l[c].length&&l[c][d]?l[c][d]:"";p.set(u,M)})}),p}catch(a){return console.warn("There was a problem retrieving the entity ids ",a),Promise.resolve(new Map)}};getEntityById=async(t,e,i)=>{let a=await this.localCache.getEntity(t,e,i);if(a)return a;let r=await this.requestEntity(t,e,i);return await this.localCache.addIdMappings(r),r&&r.length>0?r[0]:null};splitForRequestAndExisting=t=>{let e={},i={};return Object.keys(t).forEach(a=>{e[a]=t[a].filter(r=>!r.exists).map(r=>r.id),i[a]=t[a].filter(r=>r.exists).map(r=>r.id)}),{existing:i,request:e}};requestEntity=async(t,e,i)=>{try{return t=Array.isArray(t)?t:[t],await this.https.getEntitiesByIds(e,t,i)}catch(a){return console.warn(`There was a problem retrieving the requested entity: ${a}`),null}};setTopIdMappings=async()=>{let t=Math.floor(Date.now()/1e3);if(await this.localCache.getExpiration("football","ids")>t)return Promise.resolve();let i=await this.https.getTopEntities();await this.localCache.addTopIdMappings(i)}};var rc=s=>{switch(s){case"competitions":return"competition";case"players":case"relatedPlayer":case"squad":return"player";case"teams":case"participants":case"homeTeam":case"awayTeam":case"timeline":case"teamId":return"team";default:return s}};var Wn=class{extractedObjIds={};traverse=(t,e)=>(e=rc(e),Array.isArray(t)?this.traverseArrExtract(t,e):t&&typeof t=="object"&&this.traverseObjExtract(t,e),this.extractedObjIds);traverseArrExtract=(t,e)=>{t&&t.length>0&&t.forEach(i=>{this.traverseObjExtract(i,e)})};traverseObjExtract=(t,e)=>{t&&Object.keys(t).length>0&&Object.keys(t).forEach(i=>{let a=t[i];i==="id"||i==="teamId"?(this.extractedObjIds.hasOwnProperty(e)||(this.extractedObjIds[e]=[]),a&&this.extractedObjIds[e].push(a)):t[i]&&this.traverse(t[i],i)})}};var Kn=class{replaceObjIdsIndex=null;remappedIdsObj={};traverse=(t,e,i)=>(e=rc(e),this.replaceObjIdsIndex===null&&(this.initReplaceObjIdsIndex(i),this.remappedIdsObj=i),Array.isArray(t)?this.traverseArrReplace(t,e):t&&typeof t=="object"&&this.traverseObjReplace(t,e),t);initReplaceObjIdsIndex=t=>{this.replaceObjIdsIndex={},Object.keys(t).forEach(e=>{this.replaceObjIdsIndex[e]=0})};traverseArrReplace=(t,e)=>{t&&t.length>0&&t.forEach(i=>{this.traverseObjReplace(i,e)})};traverseObjReplace=(t,e)=>{t&&Object.keys(t).length>0&&Object.keys(t).forEach(i=>{i==="id"||i==="teamId"?t[i]&&(t[i]=this.remappedIdsObj[e][this.replaceObjIdsIndex[e]],this.replaceObjIdsIndex[e]=this.replaceObjIdsIndex[e]+1):t[i]&&this.traverse(t[i],i,this.remappedIdsObj)})}};var R=class{idSchema="";idMappingFacade=null;constructor(t){this.idSchema=t.idSchema,this.idMappingFacade=new yi(t)}getEntityIdBySchemaId=(t,e)=>this.idMappingFacade.getEntityById(e,t,this.idSchema);remapEntities=async(t,e)=>{let i=JSON.parse(JSON.stringify(t));try{if(this.idSchema!=="native"){let r=new Wn().traverse(i,e);return this.idMappingFacade.getEntitiesByIds(r,"native",this.idSchema).then(o=>new Kn().traverse(i,e,o))}else return t}catch(a){return console.warn(`There was a problem remapping entity: ${e} with inner entity `,a),[]}};getEntityIdsBySchemaId=async(t,e,i)=>{let a={};return a[e]=t,this.idSchema!=="native"?await this.idMappingFacade.getEntitiesByIds(a,this.idSchema,i):a}};var wt=class{idSchema;idMapping;constructor(t){this.idSchema=t.idSchema,this.idMapping=new R(t)}remapTagsIds=async(t,e,i)=>{if(!t||!t.length)return t;let a={},r={},o=[];t.forEach(l=>{a.hasOwnProperty(l.type)||(a[l.type]=[],r[l.type]=[]),a[l.type].push(l.id),r[l.type].push(l)});let n=await this.idMapping.idMappingFacade.getEntitiesByIds(a,e,i);for(let[l,p]of Object.entries(r))p.forEach((c,u)=>{c.id=n[l][u],o.push(c)});return o}};var ye=class{page=null;limit=null;constructor(t){this.page=t.page?t.page:null,this.limit=t.limit?t.limit:null}};var na=class extends ye{action=null;constructor(t){super(t),this.action=t.action?t.action:null}constructFilterUrl(){let t="";return this.action&&(t+="&",t+=`action=${this.action}`),this.page&&(t+="&",t+=`page=${this.page}`),this.limit&&(t+="&",t+=`limit=${this.limit}`),t}};var la=class extends ye{action=null;constructor(t){super(t),this.action=t.action?t.action:null}constructFilterUrl(){let t="";return this.action&&(t+="&",t+=`action=${this.action}`),this.page&&(t+="&",t+=`page=${this.page}`),this.limit&&(t+="&",t+=`limit=${this.limit}`),t}};var jn=class{idSchema;activityHttps;activityService;constructor(t){this.idSchema=t.idSchema,this.activityHttps=new hi(t),this.activityService=new wt(t)}add=async(t,e,i,a)=>{if(this.idSchema!="native"){let o=JSON.parse(JSON.stringify(e)),n=await this.activityService.remapTagsIds(e,this.idSchema,"native"),l=new fi(t,n,i,a),p=await this.activityHttps.createActivity(l);return p.context.tags=o,p}let r=new fi(t,e,i,a);return this.activityHttps.createActivity(r)};delete=async t=>await this.activityHttps.deleteActivity(t);like=async(t,e,i)=>{let a="like";return await this.add(a,t,e,i)};dislike=async(t,e,i)=>{let a="dislike";return await this.add(a,t,e,i)};addPageview=async(t,e,i)=>{let a="page_view";return await this.add(a,t,e,i)};addContentConsumed=async(t,e,i)=>{let a="content_consumed";return await this.add(a,t,e,i)};addShare=async(t,e,i)=>{let a="share";return await this.add(a,t,e,i)};addComment=async(t,e,i)=>{let a="comment";return await this.add(a,t,e,i)};addClickAd=async(t,e,i)=>{let a="click_ad";return await this.add(a,t,e,i)};addConvert=async(t,e,i)=>{let a="convert";return await this.add(a,t,e,i)};getOwn=async(t,e)=>{if(e=e||!1,t&&(t=new na(t)),this.idSchema!="native"){let i=await this.activityHttps.getOwnActivities(t,e);for(let a of i.data)await this.activityService.remapTagsIds(a.context.tags,"native",this.idSchema);return i}return await this.activityHttps.getOwnActivities(t,e)};getForUser=async(t,e,i)=>{if(i=i||!1,e&&(e=new la(e)),this.idSchema!="native"){let a=await this.activityHttps.getActivitiesForUser(t,e,i),r=JSON.parse(JSON.stringify(a));for(let o of r.data)await this.activityService.remapTagsIds([...o.context.tags],"native",this.idSchema);return r}return await this.activityHttps.getActivitiesForUser(t,e,i)}};var Yn=class{activityFacade;constructor(t){this.activityFacade=new jn(t)}add=async(t,e,i,a)=>await this.activityFacade.add(t,e,i,a);delete=async t=>await this.activityFacade.delete(t);like=async(t,e,i)=>await this.activityFacade.like(t,e,i);dislike=async(t,e,i)=>await this.activityFacade.dislike(t,e,i);addPageview=async(t,e,i)=>await this.activityFacade.addPageview(t,e,i);addContentConsumed=async(t,e,i)=>await this.activityFacade.addContentConsumed(t,e,i);addShare=async(t,e,i)=>await this.activityFacade.addShare(t,e,i);addComment=async(t,e,i)=>await this.activityFacade.addComment(t,e,i);addClickAd=async(t,e,i)=>await this.activityFacade.addClickAd(t,e,i);addConvert=async(t,e,i)=>await this.activityFacade.addConvert(t,e,i);getOwn=async(t,e)=>await this.activityFacade.getOwn(t,e);getForUser=async(t,e,i)=>await this.activityFacade.getForUser(t,e,i)};var z=class{entityId=null;entityType=null;entityRelationship=null};var be=class{participantOne=null;participantTwo=null};var pa=class{matchId="";participantOne="";participantTwo="";winner="";homeParticipant="";startDate="";score=new be};var Me=class{participants=[]};var ca=class{id=null;name=null;group=null;image=null;undecided=!1};var ua=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 Me;fixtures=[];createdAt=null;updatedAt=null};var ut=class{nextPageStartsAfter=null;itemsPerPage=null};var y=class{pagination=new ut};var da=class{meta=new y;data=[]};var ma=class{meta=new y;data=[]};var ha=class{statTiebreakerEnabled;statTotal};var fa=class{matchId="";participantOne="";participantTwo="";winner;correct=null};var Ie=class{statTotal=0};var ju=(r=>(r.ACTIVE="ACTIVE",r.WON="WON",r.LOST="LOST",r.PARTIALLY_WON="PARTIALLY_WON",r.CANCELED="CANCELED",r))(ju||{}),ga=class{id="";profileId="";profileModel=null;gameId="";totalPoints=null;gamePoints=null;bonusPoints=null;position=null;status="ACTIVE";fixtures=[];tiebreaker=new Ie;createdAt="";updatedAt=""};var ya=class{meta=new y;data=[]};var Xn=class{remapBracketGames=t=>{let e=new ma;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapBracketGameById(i)),e};remapBracketGameById=t=>{let e=new ua;return e.id=t.id,e.title=t.title,e.description=t.description,e.rules=t.rules,e.customFields=t.custom_fields,e.images=t.images,e.type=t.type,e.status=t.status,e.points=t.points,e.related=t.related?this.remapRelated(t.related):t.related,e.tiebreaker=t.tiebreaker?this.remapBracketGameTiebreaker(t.tiebreaker):t.tiebreaker,e.predictionsCutoff=t.predictions_cutoff,e.meta=t.meta&&t.meta.participants?this.remapBracketGameMeta(t.meta):t.meta,e.fixtures=t.fixtures?this.remapBracketGameFixtures(t.fixtures):t.fixtures,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPredictionToRequestBody=t=>t.map(e=>({match_id:e.matchId,participant_one:e.participantOne,participant_two:e.participantTwo,winner:e.winner}));remapPrediction=t=>{let e=new ga;return e.id=t.id,e.profileId=t.profile_id,e.gameId=t.game_id,e.totalPoints=t.total_points,e.gamePoints=t.game_points,e.bonusPoints=t.bonus_points,e.position=t.position,e.status=t.status,e.fixtures=this.remapPredictionFixtures(t.fixtures),e.tiebreaker=t.tiebreaker?this.remapPredictionTiebreaker(t.tiebreaker):t.tiebreaker,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPredictionsForUser=t=>{let e=new da;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapPrediction(i)),e};remapRankings=t=>{let e=new ya;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapPrediction(i)),e};remapRelated=t=>t.map(e=>{let i=new z;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i});remapPredictionFixtures=t=>t.map(e=>{let i=new fa;return i.matchId=e.match_id,i.participantOne=e.participant_one,i.participantTwo=e.participant_two,i.winner=e.winner,i.correct=e.correct,i});remapPredictionTiebreaker=t=>{let e=new Ie;return e.statTotal=t.stat_total,e};remapBracketGameMeta=t=>{let e=new Me;return e.participants=t.participants.map(i=>{let a=new ca;return a.id=i.id,a.name=i.name,a.group=i.group,a.image=i.image,a.undecided=i.undecided,a}),e};remapBracketGameFixtures=t=>t.map(e=>{let i=new pa;return i.matchId=e.match_id,i.participantOne=e.participant_one,i.participantTwo=e.participant_two,i.winner=e.winner,i.homeParticipant=e.home_participant,i.startDate=e.start_date,i.score=e.score?this.remapBracketGameFixturesScore(e.score):e.score,i});remapBracketGameFixturesScore=t=>{let e=new be;return e.participantOne=t.participant_one,e.participantTwo=t.participant_two,e};remapBracketGameTiebreaker=t=>{let e=new ha;return e.statTiebreakerEnabled=t.stat_tiebreaker_enabled,e.statTotal=t.stat_total,e}};var we=class{participants=[]};var ba=class{id=null;title=null;description=null;rules=null;customFields=null;images=null;type="STANDING";status=null;points=null;related=[];predictionsCutoff="";meta=new we;outcomeCount=null;outcome=[];createdAt=null;updatedAt=null};var Ma=class{meta=new y;data=[]};var Ia=class{id=null;name=null;group=null;image=null;undecided=!1};var wa=class{id="";profileId="";profileModel=null;total=0;gameId="";totalPoints=null;gamePoints=null;bonusPoints=null;position=null;status="ACTIVE";standing=[];createdAt="";updatedAt=""};var _a=class{meta=new y;data=[]};var Pa=class{meta=new y;data=[]};var Jn=class{remapBracketGames=t=>{let e=new Ma;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapStandingGameById(i)),e};remapStandingGameById=t=>{let e=new ba;return e.id=t.id,e.title=t.title,e.description=t.description,e.rules=t.rules,e.customFields=t.custom_fields,e.images=t.images,e.type=t.type,e.status=t.status,e.points=t.points,e.related=t.related?this.remapRelated(t.related):t.related,e.predictionsCutoff=t.predictions_cutoff,e.meta=t.meta&&t.meta.participants?this.remapStandingGameMeta(t.meta):t.meta,e.outcomeCount=t.outcome_count,e.outcome=t.outcome,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPrediction=t=>{let e=new wa;return e.id=t.id,e.profileId=t.profile_id,e.gameId=t.game_id,e.totalPoints=t.total_points,e.gamePoints=t.game_points,e.bonusPoints=t.bonus_points,e.position=t.position,e.status=t.status,e.standing=t.standing,e.total=t.total,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPredictionsForUser=t=>{let e=new _a;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapPrediction(i)),e};remapRankings=t=>{let e=new Pa;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapPrediction(i)),e};remapRelated=t=>t.map(e=>{let i=new z;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i});remapStandingGameMeta=t=>{let e=new we;return e.participants=t.participants.map(i=>{let a=new Ia;return a.id=i.id,a.name=i.name,a.group=i.group,a.image=i.image,a.undecided=i.undecided,a}),e}};var Ta=class{meta=new y;data=[]};var Ea=class{statTiebreakerEnabled;statTotal};var _e=class{statTotal=0};var Yu=(r=>(r.ACTIVE="ACTIVE",r.WON="WON",r.LOST="LOST",r.PARTIALLY_WON="PARTIALLY_WON",r.CANCELED="CANCELED",r))(Yu||{}),Ra=class{id="";profileId="";profileModel=null;gameId="";gamePoints=null;bonusPoints=null;totalPoints=null;position=null;status="ACTIVE";fixtures=[];tiebreaker=new _e;createdAt="";updatedAt=""};var Fa=class{meta=new y;data=[]};var Sa=class{id=null;title=null;description=null;images=null;rules=null;customFields=null;type="EVENT";status=null;points=null;related=[];tiebreaker=null;predictionsCutoff=null;fixtures=[];createdAt=null;updatedAt=null};var oc=(a=>(a.BOOLEAN="BOOLEAN",a.NUMBER="NUMBER",a.ENUM="ENUM",a.FREE_INPUT="FREE_INPUT",a))(oc||{});var At=class{id="";question="";status="ACTIVE";voidReason=null;points=0;outcomeType=null;validOutcomes=null;outcome=null};var Ot=class{id="";predictionType;prediction;correct=null;points=0};var va=class{meta=new y;data=[]};var Zn=class{remapEventGames=t=>{let e=new Ta;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapEventGameById(i)),e};remapEventGameById=t=>{let e=new Sa;return e.id=t.id,e.title=t.title,e.description=t.description,e.rules=t.rules,e.customFields=t.custom_fields,e.images=t.images,e.type=t.type,e.status=t.status,e.points=t.points,e.related=t.related?this.remapRelated(t.related):t.related,e.tiebreaker=t.tiebreaker?this.remapEventGameTiebreaker(t.tiebreaker):t.tiebreaker,e.predictionsCutoff=t.predictions_cutoff,e.fixtures=t.fixtures?this.remapEventGameFixtures(t.fixtures):t.fixtures,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPredictionToRequestBody=t=>t.map(e=>({id:e.id,prediction_type:e.predictionType,prediction:e.prediction}));remapPrediction=t=>{let e=new Ra;return e.id=t.id,e.profileId=t.profile_id,e.gameId=t.game_id,e.totalPoints=t.total_points,e.gamePoints=t.game_points,e.bonusPoints=t.bonus_points,e.position=t.position,e.status=t.status,e.fixtures=this.remapPredictionFixtures(t.fixtures),e.tiebreaker=t.tiebreaker?this.remapPredictionTiebreaker(t.tiebreaker):t.tiebreaker,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPredictionsForUser=t=>{let e=new va;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapPrediction(i)),e};remapRankings=t=>{let e=new Fa;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapPrediction(i)),e};remapRelated=t=>t.map(e=>{let i=new z;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i});remapPredictionFixtures=t=>t.map(e=>{let i=new Ot;switch(e.prediction_type){case"BOOLEAN":i=new Ot;break;case"NUMBER":i=new Ot;break;case"ENUM":i=new Ot;break;case"FREE_INPUT":i=new Ot;break}return i.id=e.id,i.predictionType=e.prediction_type,i.prediction=e.prediction,i.points=e.points,i.correct=e.correct,i});remapPredictionTiebreaker=t=>{let e=new _e;return e.statTotal=t.stat_total,e};remapEventGameFixtures=t=>t.map(e=>{let i=new At;switch(e.outcome_type){case"BOOLEAN":i=new At;break;case"NUMBER":i=new At;break;case"ENUM":i=new At;break;case"FREE_INPUT":i=new At;break}return i.id=e.id,i.question=e.question,i.status=e.status,i.voidReason=e.void_reason,i.points=e.points,i.outcomeType=e.outcome_type,i.validOutcomes=e.valid_outcomes,i.outcome=e.outcome,i});remapEventGameTiebreaker=t=>{let e=new Ea;return e.statTiebreakerEnabled=t.stat_tiebreaker_enabled,e.statTotal=t.stat_total,e}};var Ed={id:"",profile_id:"",total_points:null,game_points:null,bonus_points:null,position:null,status:"ACTIVE",game_id:"",fixtures:[],tiebreaker:{stat_total:0},updated_at:"",created_at:""},jt=class extends v{bracketGameRemapper=null;standingGameRemapper=null;eventGameRemapper=null;constructor(t){super(t,O(t.environment,"predictor")),this.bracketGameRemapper=new Xn,this.standingGameRemapper=new Jn,this.eventGameRemapper=new Zn}getBracketGames=async(t,e)=>{let i=t?`/custom/bracket${this.apiSignInUrl}${t.constructMainFiltersUrl()}`:`/custom/bracket${this.apiSignInUrl}`;f(e)&&(i+=m());let a="There was a problem with fetching bracket games list",r=await this.fetchWithoutAuth(i,a);return this.bracketGameRemapper.remapBracketGames(r)};getBracketGameById=async(t,e)=>{let i=f(e)?`/custom/bracket/${t}${this.apiSignInUrl}${m()}`:`/custom/bracket/${t}${this.apiSignInUrl}`,a="There was a problem with fetching bracket game with the following ID: "+t,r=await this.fetchWithoutAuth(i,a);return this.bracketGameRemapper.remapBracketGameById(r)};makeBracketGamePrediction=async(t,e)=>{let i=`/custom/bracket/${t}/predictions${this.apiSignInUrl}`,a="There was a problem with making prediction for bracket game with the following ID: "+t,r="POST",o=JSON.parse(JSON.stringify(e));o.fixtures=this.bracketGameRemapper.remapPredictionToRequestBody(e.fixtures),e.tiebreaker&&(o.tiebreaker={stat_total:e.tiebreaker.statTotal});let n=await this.fetchWithAuth(i,a,r,o);return this.bracketGameRemapper.remapPrediction(n)};updateBracketGamePrediction=async(t,e,i)=>{let a=`/custom/bracket/${t}/predictions/${e}${this.apiSignInUrl}`,r="There was a problem with updating prediction for bracket game with the following ID: "+t,o="PUT",n=JSON.parse(JSON.stringify(i));n.fixtures=this.bracketGameRemapper.remapPredictionToRequestBody(i.fixtures),i.tiebreaker&&(n.tiebreaker={stat_total:i.tiebreaker.statTotal});let l=await this.fetchWithAuth(a,r,o,n);return this.bracketGameRemapper.remapPrediction(l)};getBracketGamePredictionsForUser=async(t,e,i,a)=>{let r=i?`/custom/bracket/${t}/predictions${this.apiSignInUrl}&profile_id=${e}${i.constructMainFiltersUrl()}`:`/custom/bracket/${t}/predictions${this.apiSignInUrl}&profile_id=${e}`;f(a)&&(r+=m());let o=`There was a problem with getting all predictions for user with ID ${e} for bracket game with ID ${t}`,n=await this.fetchWithoutAuth(r,o);return this.bracketGameRemapper.remapPredictionsForUser(n)};getBracketGamePredictionById=async(t,e,i)=>{let a=f(i)?`/custom/bracket/${t}/predictions/${e}/${this.apiSignInUrl}${m()}`:`/custom/bracket/${t}/predictions/${e}/${this.apiSignInUrl}`,r=`There was a problem with getting prediction with ID ${e} for bracket game with ID ${t}`,o=JSON.parse(JSON.stringify(Ed));return o.id=e,o.game_id=t,o.tiebreaker=null,Promise.resolve(this.bracketGameRemapper.remapPrediction(o))};getBracketGameRankings=async(t,e,i)=>{let a=e?`/custom/bracket/${t}/ranking${this.apiSignInUrl}${e.constructMainFiltersUrl()}`:`/custom/bracket/${t}/ranking${this.apiSignInUrl}`;f(i)&&(a+=m());let r=`There was a problem with getting rankings for bracket game with ID ${t}`,o=await this.fetchWithoutAuth(a,r);return this.bracketGameRemapper.remapRankings(o)};getStandingsGames=async(t,e)=>{let i=t?`/custom/standing${this.apiSignInUrl}${t.constructMainFiltersUrl()}`:`/custom/standing${this.apiSignInUrl}`;f(e)&&(i+=m());let a="There was a problem with fetching standings games list",r=await this.fetchWithoutAuth(i,a);return this.standingGameRemapper.remapBracketGames(r)};getStandingGameById=async(t,e)=>{let i=f(e)?`/custom/standing/${t}${this.apiSignInUrl}${m()}`:`/custom/standing/${t}${this.apiSignInUrl}`,a="There was a problem with fetching standing game with the following ID: "+t,r=await this.fetchWithoutAuth(i,a);return this.standingGameRemapper.remapStandingGameById(r)};makeStandingGamePrediction=async(t,e)=>{let i=`/custom/standing/${t}/predictions${this.apiSignInUrl}`,a="There was a problem with making prediction for standing game with the following ID: "+t,r="POST",o={standing:e},n=await this.fetchWithAuth(i,a,r,o);return this.standingGameRemapper.remapPrediction(n)};updateStandingGamePrediction=async(t,e,i)=>{let a=`/custom/standing/${t}/predictions/${e}${this.apiSignInUrl}`,r="There was a problem with updating prediction for standing game with the following ID: "+t,o="PUT",n={standing:i},l=await this.fetchWithAuth(a,r,o,n);return this.standingGameRemapper.remapPrediction(l)};getStandingGamePredictionsForUser=async(t,e,i)=>{let a=`/custom/standing/${t}/predictions${this.apiSignInUrl}&profile_id=${e}`;f(i)&&(a+=m());let r=`There was a problem with getting prediction for user with ID ${e} for standing game with ID ${t}`,o=await this.fetchWithoutAuth(a,r);return this.standingGameRemapper.remapPredictionsForUser(o)};getStandingGameRankings=async(t,e,i)=>{let a=e?`/custom/standing/${t}/ranking${this.apiSignInUrl}${e.constructMainFiltersUrl()}`:`/custom/standing/${t}/ranking${this.apiSignInUrl}`;f(i)&&(a+=m());let r=`There was a problem with getting rankings for standing game with ID ${t}`,o=await this.fetchWithoutAuth(a,r);return this.standingGameRemapper.remapRankings(o)};getEventGames=async(t,e)=>{let i=t?`/custom/event${this.apiSignInUrl}${t.constructMainFiltersUrl()}`:`/custom/event${this.apiSignInUrl}`;f(e)&&(i+=m());let a="There was a problem with fetching event games list",r=await this.fetchWithoutAuth(i,a);return this.eventGameRemapper.remapEventGames(r)};getEventGameById=async(t,e)=>{let i=f(e)?`/custom/event/${t}${this.apiSignInUrl}${m()}`:`/custom/event/${t}${this.apiSignInUrl}`,a="There was a problem with fetching event game with the following ID: "+t,r=await this.fetchWithoutAuth(i,a);return this.eventGameRemapper.remapEventGameById(r)};makeEventGamePrediction=async(t,e)=>{let i=`/custom/event/${t}/predictions${this.apiSignInUrl}`,a="There was a problem with making prediction for event game with the following ID: "+t,r="POST",o=JSON.parse(JSON.stringify(e));o.fixtures=this.eventGameRemapper.remapPredictionToRequestBody(e.fixtures),e.tiebreaker&&(o.tiebreaker={stat_total:e.tiebreaker.statTotal});let n=await this.fetchWithAuth(i,a,r,o);return this.eventGameRemapper.remapPrediction(n)};updateEventGamePrediction=async(t,e,i)=>{let a=`/custom/event/${t}/predictions/${e}${this.apiSignInUrl}`,r="There was a problem with updating prediction for event game with the following ID: "+t,o="PUT",n=JSON.parse(JSON.stringify(i));n.fixtures=this.eventGameRemapper.remapPredictionToRequestBody(i.fixtures),i.tiebreaker&&(n.tiebreaker={stat_total:i.tiebreaker.statTotal});let l=await this.fetchWithAuth(a,r,o,n);return this.eventGameRemapper.remapPrediction(l)};getEventGamePredictionsForUser=async(t,e,i,a)=>{let r=i?`/custom/event/${t}/predictions${this.apiSignInUrl}&profile_id=${e}${i.constructMainFiltersUrl()}`:`/custom/event/${t}/predictions${this.apiSignInUrl}&profile_id=${e}`;f(a)&&(r+=m());let o=`There was a problem with getting all predictions for user with ID ${e} for event game with ID ${t}`,n=await this.fetchWithoutAuth(r,o);return this.eventGameRemapper.remapPredictionsForUser(n)};getEventGameRankings=async(t,e,i)=>{let a=e?`/custom/event/${t}/ranking${this.apiSignInUrl}${e.constructMainFiltersUrl()}`:`/custom/event/${t}/ranking${this.apiSignInUrl}`;f(i)&&(a+=m());let r=`There was a problem with getting rankings for event game with ID ${t}`,o=await this.fetchWithoutAuth(a,r);return this.eventGameRemapper.remapRankings(o)}};var Pe=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};var Ca=class extends Pe{email=null;phoneNumber=null;phoneCountryCode=null;preferences=null;consentIds=null};var tl=class{profilesFromResponse=t=>t?t.map(e=>this.publicProfileFromResponse(e)):null;fullProfileFromResponse=t=>{let e=new Ca;return e.id=t.id,e.name=t.name,e.email=t.email,e.nickname=t.nickname,e.avatar=t.avatar,e.gender=t.gender,e.country=t.country,e.birthDate=t.birth_date,e.phoneCountryCode=t.phone_country_code,e.phoneNumber=t.phone_number,e.verified=t.verified,e.staffMember=t.staff_member,e.anonymous=t.anonymous,e.disabled=t.disabled,e.interests=t.interests?t.interests:[],e.preferences=t.preferences?this.remapPreferences(t.preferences):[],e.consentIds=t.consent_ids?t.consent_ids:[],e.followingCount=t.following_count,e.followersCount=t.followers_count,e};publicProfileFromResponse=t=>{let e=new Pe;return e.id=t.id,e.name=t.name,e.nickname=t.nickname,e.avatar=t.avatar,e.gender=t.gender,e.country=t.country,e.birthDate=t.birth_date,e.verified=t.verified,e.staffMember=t.staff_member,e.anonymous=t.anonymous,e.disabled=t.disabled,e.interests=t.interests?t.interests:[],e.followingCount=t.following_count,e.followersCount=t.followers_count,e};remapPreferences=t=>t.map(e=>({preferenceId:e.preference_id,categories:e.categories,source:e.source}))};var H=class{meta=new y;data=[]};var Aa=class{avatar=null;followingId=null;name=null;nickname=null;profileId=null};var el=class{followResponse=t=>t.map(e=>this.remapResponse(e));followingFromResponse=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapResponse(i)),e};remapResponse=t=>{let e=new Aa;return e.avatar=t.avatar,e.followingId=t.following_id,e.name=t.name,e.profileId=t.profile_id,e.nickname=t.nickname,e}};var Oa=class{avatar=null;followerId=null;name=null;nickname=null;profileId=null};var xa=class{followsMe=[];iFollow=[];followsMeBack=[]};var il=class{followersFromResponse=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapResponse(i)),e};followStatusFromResponse=t=>{let e=new xa;return e.iFollow=t.i_follow,e.followsMe=t.follows_me,e.followsMeBack=t.follows_me_back,e};remapResponse=t=>{let e=new Oa;return e.avatar=t.avatar,e.followerId=t.follower_id,e.name=t.name,e.profileId=t.profile_id,e}};var bi=class{profile_ids=[]};var La=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};var al=class{toRequest(t){return{first_name:t.firstName||null,last_name:t.lastName||null,full_name:t.fullName||null,email:t.email||null,gender:t.gender||null,country:t.country||null,phone_country_code:t.phoneCountryCode||null,phone_number:t.phoneNumber||null,campaign_id:t.campaignId||null,campaign_name:t.campaignName||null,content_type:t.contentType||null,content_id:t.contentId||null,content_name:t.contentName||null,custom_fields:t.customFields||null}}fromResponse(t){let e=new La;return e.leadId=t.lead_id,e.profileId=t.profile_id,e.firstName=t.first_name,e.lastName=t.last_name,e.fullName=t.full_name,e.email=t.email,e.gender=t.gender,e.country=t.country,e.phoneCountryCode=t.phone_country_code,e.phoneNumber=t.phone_number,e.campaignId=t.campaign_id,e.campaignName=t.campaign_name,e.contentId=t.content_id,e.contentType=t.content_type,e.contentName=t.content_name,e.customFields=t.custom_fields,e}};var Da=class{consentId="";entityId=null;entityType=null;content=null;consentedAt=""};var rl=class{toRequest(t){return{consent_data:t.map(i=>({consent_id:i.consentId,entity_id:i.entityId||null,entity_type:i.entityType||null,content:i.content||null}))}}fromResponse(t){return t.map(e=>{let i=new Da;return i.consentId=e.consent_id,i.entityId=e.entity_id,i.entityType=e.entity_type,i.content=e.content,i.consentedAt=e.consented_at,i})}};var Ba=class{id="";datetime="";status="available"};var ol=class{fromResponse(t){return t.map(e=>{let i=new Ba;return i.id=e.id,i.datetime=e.datetime,i.status=e.status,i})}};var Rd="/countries",J="/profile",sc="/profiles",Mi=class extends v{profileRemapper=null;followingRemapper=null;followersRemapper=null;leadRemapper=null;consentRemapper=null;externalActivityRemapper=null;lang=null;limitIds=100;constructor(t){super(t,O(t.environment,"profile")),this.lang=t.lang,this.profileRemapper=new tl,this.followingRemapper=new el,this.followersRemapper=new il,this.leadRemapper=new al,this.consentRemapper=new rl,this.externalActivityRemapper=new ol}getCountries=async t=>{let e=`&lang=${this.lang}`,i=`${Rd}${this.apiSignInUrl}${e}`,a=Date.now(),r="There was a problem fetching profile countries";return t&&(i+=`&disable_cache=${a}`),(await this.fetchWithoutAuth(i,r)).data};getProfile=async t=>{let e=`${J}${this.apiSignInUrl}`,i="";if(t){e=`${sc}/${t}${this.apiSignInUrl}`,i=`There was a problem fetching the following profile: ${t}`;let a=await this.fetchWithoutAuth(e,i);return this.profileRemapper.publicProfileFromResponse(a.data)}else{i="There was a problem fetching your profile from API";let a=await this.fetchWithAuth(e,i);return this.profileRemapper.fullProfileFromResponse(a.data)}};getProfiles=async(t,e,i)=>{let a=Date.now(),r=`There was a problem fetching the following profiles: ${t.join(",")}`;if(t&&t.length){if(t.length>this.limitIds){let c=[],u=qt(t,this.limitIds);for(let d of u){let M=`${sc}${this.apiSignInUrl}&profile_ids=${d.join(",")}`;r=`There was a problem fetching the following profiles: ${d.join(",")}`,i&&(M+=`&disable_cache=${a}`);let _=await this.fetchWithoutAuth(M,r);c.push(...this.profileRemapper.profilesFromResponse(_.data))}return c}let l=`${sc}${this.apiSignInUrl}&profile_ids=${t.join(",")}`;i&&(l+=`&disable_cache=${a}`);let p=await this.fetchWithoutAuth(l,r);return this.profileRemapper.profilesFromResponse(p.data)}let o=`${sc}${this.apiSignInUrl}&search=${e}`;i&&(o+=`&disable_cache=${a}`);let n=await this.fetchWithoutAuth(o,r);return this.profileRemapper.profilesFromResponse(n.data)};getFollowers=async(t,e)=>{let i=`${J}/followers${this.apiSignInUrl}`,a="There was a problem fetching the followers for own profile";if(t&&!e){i=`${J}/followers${this.apiSignInUrl}${t.constructFilterUrl()}`;let o=await this.fetchWithAuth(i,a);return this.followersRemapper.followersFromResponse(o)}else if(!t&&!e){let o=await this.fetchWithAuth(i,a);return this.followersRemapper.followersFromResponse(o)}t&&e?i=`${J}/${e}/followers${this.apiSignInUrl}${t.constructFilterUrl()}`:!t&&e&&(i=`${J}/${e}/followers${this.apiSignInUrl}`),a=`There was a problem fetching the followers for profile: ${e}`;let r=await this.fetchWithoutAuth(i,a);return this.followersRemapper.followersFromResponse(r)};getFollowing=async(t,e)=>{let i=`${J}/following${this.apiSignInUrl}`,a="There was a problem fetching the followers of own profile";if(t&&!e){i=`${J}/following${this.apiSignInUrl}${t.constructFilterUrl()}`;let o=await this.fetchWithAuth(i,a);return this.followingRemapper.followingFromResponse(o)}else if(!t&&!e){let o=await this.fetchWithAuth(i,a);return this.followingRemapper.followingFromResponse(o)}t&&e?i=`${J}/${e}/following${this.apiSignInUrl}${t.constructFilterUrl()}`:!t&&e&&(i=`${J}/${e}/following${this.apiSignInUrl}`),a=`There was a problem fetching the followers of the following profile: ${e}`;let r=await this.fetchWithoutAuth(i,a);return this.followingRemapper.followingFromResponse(r)};follow=async t=>{let e=new bi;e.profile_ids=t;let i=J+`/follow${this.apiSignInUrl}`,a=`There was a problem with following profiles: ${t.join(",")}`,r="POST",o=await this.fetchWithAuth(i,a,r,e);return this.followingRemapper.followResponse(o.data)};unfollow=async t=>{let e=new bi;e.profile_ids=t;let i=J+`/follow${this.apiSignInUrl}`,a=`There was a problem with unfollowing profiles: ${t.join(",")}`,r="DELETE";return await this.fetchWithAuth(i,a,r,e),!0};getBadges=async t=>{let e=`${J}/badges${this.apiSignInUrl}`,i="There was a problem with fetching own badges";return t?(e=`${J}/${t}/badges${this.apiSignInUrl}`,i="There was a problem with fetching the badges",(await this.fetchWithoutAuth(e,i)).data):(await this.fetchWithAuth(e,i)).data};updateProfile=async t=>{let e=J+this.apiSignInUrl,i="There was a problem updating the own profile",a="PATCH",r=await this.fetchWithAuth(e,i,a,t);return this.profileRemapper.fullProfileFromResponse(r.data)};collectLead=async t=>{let e=`/leads${this.apiSignInUrl}`,i="There was a problem collecting lead",a="POST",r=await this.fetchWithAuth(e,i,a,this.leadRemapper.toRequest(t));return this.leadRemapper.fromResponse(r.data)};collectConsents=async t=>{let e=J+`/consents${this.apiSignInUrl}`,i="There was a problem collecting consents",a="POST",r=await this.fetchWithAuth(e,i,a,this.consentRemapper.toRequest(t));return this.consentRemapper.fromResponse(Array.isArray(r)?r:r.data)};checkFollowStatus=async t=>{let e=`/profile/followers/check-follow-status${this.apiSignInUrl}&profile_ids=${t.join(",")}`,i="There was a problem checking follow status for profiles",a=await this.fetchWithAuth(e,i);return this.followersRemapper.followStatusFromResponse(a.data)};deleteOwnProfile=async()=>{let t=`/profile${this.apiSignInUrl}`,e="There was a problem deleting own profile",i="DELETE";await this.fetchWithAuth(t,e,i)};deleteUserData=async()=>{let t=`/user-data${this.apiSignInUrl}`,e="There was a problem deleting profile data",i="DELETE";await this.fetchWithAuth(t,e,i)};getOwnExternalActivities=async()=>{let t=`/external-activities${this.apiSignInUrl}`,e="There was a problem getting own profile's external activities",i=await this.fetchWithAuth(t,e);return this.externalActivityRemapper.fromResponse(i.data?i.data.external_activities:i.external_activities)}};var Z=class{completed=!1;percentage;constructor(t){this.percentage=t}};var Na=class{teamFollowed=new Z(10);teamFavourite=new Z(15);playerFollowed=new Z(10);playerFavourite=new Z(10);competitionFollowed=new Z(10);competitionFavourite=new Z(5);addedBirthdate=new Z(10);addedGender=new Z(10);addedCountry=new Z(10);addedAvatar=new Z(10)};var ka=class{totalPercentage;breakdown=new Na};var Ii=class{limit=0;startAfter=null;constructor(t){this.limit=t.limit?t.limit:20,this.startAfter=t.startAfter?t.startAfter:null}constructFilterUrl=()=>{let t="";return this.limit&&(t=t+"&",t=t+`limit=${this.limit}`),this.startAfter&&(t=t+"&",t=t+`start_after=${this.startAfter}`),t}};var b=class extends Error{code=0;status=null;message=null;constructor(t,e,i){super(),this.code=t,this.status=e,this.message=i}errorMessage=()=>this.message};var _t=class{localCache;profileHttps=null;activityHttps=null;errorHandlingMode=null;constructor(t,e,i,a){this.localCache=t,this.profileHttps=e,this.activityHttps=i,this.errorHandlingMode=a}getOwn=async()=>{let t=await this.getLocalStorageData("profile");if(t&&Object.keys(t).length)return JSON.parse(JSON.stringify(t));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}};getOwnProfileFromCache=async()=>await this.localCache.getOwnProfile();updateOwnProfile=async()=>{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}};getByIds=async(t,e,i)=>{if(t&&t.length>0&&e||!t&&t.length===0&&!e)throw new h(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(t,e,i)}catch(a){throw console.warn(`There was a problem retrieving the selected profiles: ${t.join(",")} `,a),a}};getById=async t=>{try{return await this.profileHttps.getProfile(t)}catch(e){throw console.warn(`There was a problem retrieving the selected profile: ${t} `,e),e}};getCountries=async t=>{t=t||!1;let e=await this.localCache.getProfileCountries();if(e&&e.length>0)return e;try{let i=await this.profileHttps.getCountries(t);return await this.localCache.setProfileCountries(i),i}catch(i){throw console.warn("There was a problem retrieving profile countries: ",i),i}};getFollowers=async(t,e)=>{try{t&&(t=new Ii(t));let i=await this.profileHttps.getFollowers(t,e),a=i.data.map(r=>r.followerId);if(a.length){let r=await this.getByIds(a),o=i.data.map(n=>(r.forEach(l=>{n.followerId===l.id&&(n.name=l.name,n.nickname=l.nickname,n.avatar=l.avatar)}),n));return i.data=o,i}return i}catch(i){throw console.warn("There was a problem retrieving your followers: ",i),i}};getFollowing=async(t,e)=>{try{t&&(t=new Ii(t));let i=await this.profileHttps.getFollowing(t,e),a=i.data.map(r=>r.followingId);if(a.length){let r=await this.getByIds(a),o=i.data.map(n=>(r.forEach(l=>{n.followingId===l.id&&(n.name=l.name,n.nickname=l.nickname,n.avatar=l.avatar)}),n));return i.data=o,i}return i}catch(i){throw console.warn("There was a problem retrieving your following profiles: ",i),i}};follow=async t=>{try{return await this.profileHttps.follow(t)}catch(e){throw console.warn(`There was a problem following profiles: ${t.join(",")} `,e),e}};unfollow=async t=>{try{return await this.profileHttps.unfollow(t)}catch(e){throw console.warn(`There was a problem unfollowing profiles: ${t.join(",")} `,e),e}};showFullnessProfile=t=>{let e=new ka,i=0;return t.avatar&&(e.breakdown.addedAvatar.completed=!0,i+=e.breakdown.addedAvatar.percentage),t.birthDate&&(e.breakdown.addedBirthdate.completed=!0,i+=e.breakdown.addedBirthdate.percentage),t.country&&(e.breakdown.addedCountry.completed=!0,i+=e.breakdown.addedCountry.percentage),t.gender&&(e.breakdown.addedGender.completed=!0,i+=e.breakdown.addedGender.percentage),t.interests&&t.interests.length>0&&(t.interests.find(c=>c.type==="team"&&c.favourite)&&(e.breakdown.teamFavourite.completed=!0,i+=e.breakdown.teamFavourite.percentage),t.interests.find(c=>c.type==="team")&&(e.breakdown.teamFollowed.completed=!0,i+=e.breakdown.teamFollowed.percentage),t.interests.find(c=>c.type==="player"&&c.favourite)&&(e.breakdown.playerFavourite.completed=!0,i+=e.breakdown.playerFavourite.percentage),t.interests.find(c=>c.type==="player")&&(e.breakdown.playerFollowed.completed=!0,i+=e.breakdown.playerFollowed.percentage),t.interests.find(c=>c.type==="competition"&&c.favourite)&&(e.breakdown.competitionFavourite.completed=!0,i+=e.breakdown.competitionFavourite.percentage),t.interests.find(c=>c.type==="competition")&&(e.breakdown.competitionFollowed.completed=!0,i+=e.breakdown.competitionFollowed.percentage)),e.totalPercentage=i,e};getStats=async()=>{let t=await this.getLocalStorageData("statistics");if(t&&Object.keys(t).length)return JSON.parse(JSON.stringify(t));try{let e=await this.activityHttps.getStats();return await this.localCache.setProfileStats(e),e}catch(e){throw console.warn("There was a problem retrieving own profile statistics: ",e),e}};getBadges=async t=>{if(t)try{return await this.profileHttps.getBadges()}catch(i){throw console.warn("There was a problem retrieving own profile badges: ",i),i}let e=await this.getLocalStorageData("badges");if(e)return e;try{let i=await this.profileHttps.getBadges();return await this.localCache.setProfileBadges(i),i}catch(i){throw console.warn("There was a problem retrieving own profile badges: ",i),i}};clearLocalStorageData=async()=>{await this.localCache.setOwnProfile({}),await this.localCache.setProfileStats({}),await this.localCache.setProfileBadges(null)};collectLead=async t=>{if(this.errorHandlingMode&&!t)throw this.errorHandlingMode==="standard"?new h(400,"invalid_method_call","The method 'collectLead' from Profile namespace is not called correctly. You need to provide 'requestBody' parameter to the method."):new b(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(t)};collectConsents=async t=>{if(this.errorHandlingMode&&!t)throw this.errorHandlingMode==="standard"?new h(400,"invalid_method_call","The method 'collectConsents' from Profile namespace is not called correctly. You need to provide 'consents' parameter to the method."):new b(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(t)};checkFollowStatus=async t=>{if(!t||!Array.isArray(t)||t.length===0)throw this.errorHandlingMode==="standard"?new h(400,"invalid_method_call","Invalid or empty IDs provided. Please provide at least one ID."):new b(400,"invalid_method_call","Invalid or empty IDs provided. Please provide at least one ID.");return await this.profileHttps.checkFollowStatus(t)};getLocalStorageData=async t=>{let e=Math.floor(Date.now()/1e3),i=await this.localCache.getExpiration("profile",t);switch(t){case"profile":if(i>e)return await this.localCache.getOwnProfile();case"statistics":if(i>e)return await this.localCache.getProfileStats();case"badges":if(i>e)return await this.localCache.getProfileBadges();default:return null}}};var Ga=class{id=null;name=null;assets=null};var sl=class{extractUpdatedProps=(t,e)=>{let i=["name","nickname","gender","avatar","email"],a={};return Object.keys(t).forEach(r=>{if(i.includes(r)&&t[r]!==e[r])a[r]=e[r];else if(r==="phoneCountryCode")t[r]&&e[r]===null?a.phone_country_code=null:(t[r]===null&&e[r]||t[r]!==e[r])&&(a.phone_country_code=e[r]);else if(r==="phoneNumber")(t[r]&&e[r]===null||t[r]===null&&e[r]||t[r]!==e[r])&&(a.phone_number=e[r]);else if(r==="birthDate")(e[r]===null||t[r]===null&&e[r]||t[r]!==e[r])&&(a.birth_date=e[r]);else if(r==="country")e[r]===null?a.country_id=e[r]:(t[r]===null&&e[r]||t[r].id!==e[r].id)&&(a.country_id=e[r].id);else if(r==="interests"){let o=t[r],n=e[r];n.length&&this.isNewInterest(o,n)?a[r]=this.updateInterests(o,n):(!n.length&&o.length||o.length!==n.length&&!this.isNewInterest(o,n))&&(a[r]=n)}}),a};updateInterests=(t,e)=>{if(t.length===e.length){let[i,a]=this.extractSameAndNewInterests(t,e);return[...a,...i]}else return e};isNewInterest=(t,e)=>{let i=!1,[a]=this.extractSameAndNewInterests(t,e);return a.length&&(i=!0),i};extractSameAndNewInterests=(t,e)=>{let i=e.filter(r=>t.some(o=>r.id===o.id&&r.type===o.type&&r.source===o.source&&r.favourite===o.favourite));return[e.filter(r=>!t.some(o=>r.id===o.id&&r.type===o.type&&r.source===o.source&&r.favourite===o.favourite)),i]};isAvatarValidURL=t=>{try{return new URL(t),!0}catch{return!1}}};var nl=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(t,e,i,a,r){this.configuration=t,this.idsRemapper=e,this.localCache=i,this.profileHttps=a,this.profileService=new sl,this.profileFacade=new _t(i,a,r)}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 t=Math.floor(Date.now()/1e3);if(this.newProfileCheckResult===null&&(this.newProfileCheckResult=await this.isNewProfileRequested()),!this.ownProfile||this.expireAt<t||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 t=await this.profileFacade.getOwn();return this.setOwnProfile(t),this.modified=!1,this.isFetching=!1,this.ownProfile}catch(t){throw this.isFetching=!1,t}};delay=t=>new Promise(e=>{setTimeout(e,t)});setOwnProfile=t=>{this.ownProfile=t};resetProfileCheckResult=()=>{this.newProfileCheckResult=null};getInfo=async()=>{this.resetProfileCheckResult();let t=await this.getOwnProfile(),e=JSON.parse(JSON.stringify(t));return delete e.interests,e};showInterests=async()=>{this.resetProfileCheckResult();let t=await this.getOwnProfile(),e=JSON.parse(JSON.stringify(t));return await this.idsRemapper.remapInterests(e.interests)};showFullInterests=async()=>{this.resetProfileCheckResult();let t=await this.getOwnProfile(),e=JSON.parse(JSON.stringify(t));return await this.idsRemapper.showFullInterests(e.interests)};getFollowers=async t=>await this.profileFacade.getFollowers(t);getFollowing=async t=>await this.profileFacade.getFollowing(t);follow=async t=>{let e=await this.profileFacade.follow(t),i=await this.profileFacade.updateOwnProfile();return this.setOwnProfile(i),e};unfollow=async t=>{let e=await this.profileFacade.unfollow(t),i=await this.profileFacade.updateOwnProfile();return this.setOwnProfile(i),e};getStats=async()=>{await this.clearAllProfileData();let t=await this.profileFacade.getStats();return await this.idsRemapper.remapProfileStats(t)};getBadges=async t=>(await this.clearAllProfileData(),await this.profileFacade.getBadges(t));addInterestPromise=async t=>{this.modified=!0;let e={...t};await this.getOwnProfile();let i=null;t.source!=="custom"?i=await this.idsRemapper.remapInterestToNative(e):i=e;let a=this.ownProfile.interests.filter(r=>r.id!==i.id||r.type!==i.type||r.source!==i.source);return this.ownProfile.interests=[...a],this.ownProfile.interests.push(i),this};addInterest=t=>(this.promises.push(this.addInterestPromise(t)),this);removeInterestPromise=async t=>{this.modified=!0;let e={...t};await this.getOwnProfile();let i=null;return t.source!=="custom"?i=await this.idsRemapper.remapInterestToNative(e):i=e,this.ownProfile.interests=this.ownProfile.interests.filter(a=>a.id!==i.id||a.type!==i.type||a.source!==i.source),this};removeInterest=t=>(this.promises.push(this.removeInterestPromise(t)),this);setBirthdatePromise=async t=>(this.modified=!0,await this.getOwnProfile(),t?this.ownProfile.birthDate=t:this.ownProfile.birthDate=null,this);setBirthdate=t=>(this.promises.push(this.setBirthdatePromise(t)),this);setGenderPromise=async t=>(this.modified=!0,await this.getOwnProfile(),t==="male"||t==="female"?this.ownProfile.gender=t:this.ownProfile.gender="unspecified",this);setGender=t=>(this.promises.push(this.setGenderPromise(t)),this);setNicknamePromise=async t=>(this.modified=!0,await this.getOwnProfile(),this.ownProfile.nickname=t,this);setNickname=t=>(this.promises.push(this.setNicknamePromise(t)),this);setNamePromise=async t=>(this.modified=!0,await this.getOwnProfile(),this.ownProfile.name=t,this);setName=t=>(this.promises.push(this.setNamePromise(t)),this);setCountryPromise=async t=>(this.modified=!0,await this.getOwnProfile(),t&&!this.ownProfile.country?(this.ownProfile.country=new Ga,this.ownProfile.country.id=t):t&&this.ownProfile.country?this.ownProfile.country.id=t:this.ownProfile.country=null,this);setCountry=t=>(this.promises.push(this.setCountryPromise(t)),this);showFullnessProfile=async()=>{this.resetProfileCheckResult();let t=await this.getOwnProfile(),e=JSON.parse(JSON.stringify(t));return this.profileFacade.showFullnessProfile(e)};setAvatarPromise=async t=>{if(this.modified=!0,await this.getOwnProfile(),this.profileService.isAvatarValidURL(t))this.ownProfile.avatar=t;else{if(this.configuration.errorHandlingMode==="default")throw new b(400,"invalid_avatar","Invalid URL syntax for avatar image.");if(this.configuration.errorHandlingMode==="standard")throw new h(400,"invalid_avatar","Invalid URL syntax for avatar image.")}return this};setAvatar=t=>(this.promises.push(this.setAvatarPromise(t)),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 t=>(this.modified=!0,await this.getOwnProfile(),typeof t=="string"&&t?this.ownProfile.email=t:console.warn(`Wrong email argument: ${t}. Will be ignored when updating profile`),this);setEmail=t=>(this.promises.push(this.setEmailPromise(t)),this);setPhoneCountryCodePromise=async t=>(this.modified=!0,await this.getOwnProfile(),t===null||typeof t=="string"&&t?this.ownProfile.phoneCountryCode=t:console.warn(`Wrong phoneCountryCode argument: ${t}. Will be ignored when updating profile`),this);setPhoneCountryCode=t=>(this.promises.push(this.setPhoneCountryCodePromise(t)),this);setPhoneNumberPromise=async t=>(this.modified=!0,await this.getOwnProfile(),t===null||typeof t=="string"&&t?this.ownProfile.phoneNumber=t:console.warn(`Wrong phoneNumber argument: ${t}. Will be ignored when updating profile`),this);setPhoneNumber=t=>(this.promises.push(this.setPhoneNumberPromise(t)),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 t=await this.profileFacade.getOwn(),e=await this.getOwnProfile(),i=this.profileService.extractUpdatedProps(t,e);if(this.modified=!1,this.expireAt=0,Object.keys(i).length){let r=await this.profileHttps.updateProfile(i),o=JSON.parse(JSON.stringify(r));return this.setOwnProfile(o),await this.localCache.setOwnProfile(o),delete r.interests,r}let a=JSON.parse(JSON.stringify(this.ownProfile));return delete a.interests,a};clearAllProfileData=async()=>{this.newProfileCheckResult===!0&&await this.profileFacade.clearLocalStorageData()};isNewProfileRequested=async()=>{let t=this.profileHttps.extractUserIdFromToken();if(!t)return!1;if(!this.ownProfile){let e=await this.profileFacade.getOwnProfileFromCache();return!!(e&&Object.keys(e).length&&e.id!==t)}return this.ownProfile.id!==t}};var wi=class{idsRemapper=null;profileHttps=null;activityHttps=null;profileFacade=null;profileId="";localCache=null;constructor(t,e,i,a){this.idsRemapper=t,this.profileHttps=i,this.activityHttps=a,this.localCache=e,this.profileFacade=new _t(e,i,a)}getById=t=>new wi(this.idsRemapper,this.localCache,this.profileHttps,this.activityHttps).setId(t);setId=t=>(this.profileId=t,this);getProfile=async()=>await this.profileFacade.getById(this.profileId);getInfo=async()=>{let t=await this.getProfile();return delete t.interests,t};showInterests=async()=>{let t=await this.getProfile(),e=JSON.parse(JSON.stringify(t));return await this.idsRemapper.remapInterests(e.interests)};showFullInterests=async()=>{let t=await this.getProfile(),e=JSON.parse(JSON.stringify(t));return await this.idsRemapper.showFullInterests(e.interests)};getFollowers=async t=>await this.profileFacade.getFollowers(t,this.profileId);getFollowing=async t=>await this.profileFacade.getFollowing(t,this.profileId);showFullnessProfile=async()=>{let t=await this.getProfile();return this.profileFacade.showFullnessProfile(t)};getStats=async t=>{let e=await this.activityHttps.getStats(this.profileId,t);return await this.idsRemapper.remapProfileStats(e)};getBadges=async()=>await this.profileHttps.getBadges(this.profileId)};var ll=class{localCache=null;https=null;idMapping=null;constructor(t,e,i){this.localCache=t,this.idMapping=i,this.https=e}getCountriesWithIdMapping=async t=>{try{let e=await this.getCountries(t);return this.idMapping.remapEntities(e,"country")}catch(e){throw console.warn("There was a problem browsing countries as football entities",e),e}};getCountries=async t=>{t=t||!1;let e=await this.localCache.getFootballCountries();if(e&&e.length>0)return e;try{let i=await this.https.getCountries(t);return await this.localCache.setFootballCountries(i),i}catch(i){throw console.warn("There was a problem retrieving countries as football entities",i),i}}};var _i=class{countryId=null;name=null;gender=null;type=null;sortField=null;sortOrder=null;competitionIds=null;constructor(t){this.countryId=t.countryId?`${t.countryId}`:null,this.name=t.name?t.name:null,this.gender=t.gender?t.gender:null,this.type=t.type?t.type:null,this.sortField=t.sortField?`${t.sortField}`:null,this.sortOrder=t.sortOrder?`${t.sortOrder}`:null,this.competitionIds=t.competitionIds?t.competitionIds:null}constructFilterUrl=()=>{let t="";return this.countryId&&(t=t+"&",t=t+`country_id=${this.countryId}`),this.gender&&(t=t+"&",t=t+`gender=${this.gender}`),this.type&&(t=t+"&",t=t+`type=${this.type}`),this.sortField&&(t=t+"&",t=t+`sort_field=${this.sortField}`),this.sortOrder&&(t=t+"&",t=t+`sort_order=${this.sortOrder}`),this.name&&(t=t+"&",t=t+`name=${this.name}`),this.competitionIds&&this.competitionIds.length>0&&(t=t+"&",t=t+`competition_ids=${this.competitionIds.join(",")}`),t};competitionSearchFilter=t=>{try{let e=this.filter(t);return this.sortField||this.sortOrder?this.sort(e):e}catch(e){return console.warn("There was a problem filtering the local competitions",e),[]}};filter=t=>{let e=this.entitiesToSearchWith();return t.filter(i=>{let a=!0;return e.forEach(r=>{r!=="sortOrder"&&r!=="sortField"&&(r==="countryId"?a&&=i.country.id===this[r]:r==="name"?a&&=i.name.toLocaleLowerCase().includes(this[r].toLocaleLowerCase()):r==="competitionIds"?a&&=this[r].some(o=>i.id===o):a&&=i[r].toLocaleLowerCase()===this[r].toLocaleLowerCase())}),a})};entitiesToSearchWith=()=>{let t=[];return this.countryId&&t.push("countryId"),this.name&&t.push("name"),this.gender&&t.push("gender"),this.type&&t.push("type"),this.sortField&&t.push("sortField"),this.sortOrder&&t.push("sortOrder"),this.competitionIds&&t.push("competitionIds"),t};sort=t=>{let e=[];return this.sortField==="name"?e=t.sort((i,a)=>this.sortOrder&&this.sortOrder==="desc"?a.name.localeCompare(i.name):i.name.localeCompare(a.name)):this.sortField==="country"?e=t.sort((i,a)=>this.sortOrder&&this.sortOrder==="desc"?a.country.name.localeCompare(i.country.name):i.country.name.localeCompare(a.country.name)):this.sortField==="scope"?t.forEach(i=>e[this.competitionIds.indexOf(i.id)]=i):!this.sortField&&this.sortOrder==="desc"&&(e=t.sort((i,a)=>a.id.localeCompare(i.id))),e}};var pl=class{localStorage=null;https=null;idMapping=null;constructor(t,e,i){this.localStorage=t,this.idMapping=i,this.https=e}getCompetitionsIdMapping=async(t,e)=>{try{let i=!1;if(t){if(t=new _i(t),t.countryId){let r=await this.idMapping.getEntityIdsBySchemaId([`${t.countryId}`],"country","native");r.country.length===0&&(i=!0),t.countryId=r.country[0]}if(t.competitionIds){let r=await this.idMapping.getEntityIdsBySchemaId(t.competitionIds,"competition","native");r.competition.length===0&&(i=!0),t.competitionIds=r.competition}if(i)return[]}let a=await this.getCompetitions(t,e);return await this.idMapping.remapEntities(a,"competition")}catch(i){throw console.warn("There was a problem browsing all of the competitions",i),i}};getCompetitionsMapWithNativeIds=async t=>{let e=new Map,i=t.length,a=new _i({competitionIds:t,limit:i}),r=await this.getCompetitions(a);r.sort((l,p)=>l.id.localeCompare(p.id));let o=Xp(t),n=await this.idMapping.remapEntities(r,"competition");return o.forEach((l,p)=>e.set(l,n[p])),e};getCompetitions=async(t,e)=>{let i=null;if(e=e||!1,!await this.localStorage.getCompetitionsLength()){try{i=await this.https.getCompetitions()}catch(a){throw console.warn("There was a problem retrieving all competitions",a),a}await this.localStorage.setCompetitions(i)}return await this.localStorage.getCompetitions(t)};getCompetitionByIdIdMapping=async(t,e)=>{try{let a=(await this.idMapping.getEntityIdsBySchemaId([t],"competition","native")).competition[0],r=await this.getCompetitionById(a,e);return await this.idMapping.remapEntities(r,"competition")}catch(i){throw console.warn(`There was a problem browsing the following competition:${t}`,i),i}};getCompetitionById=async(t,e)=>{try{return e=e||!1,await this.https.getCompetitionById(t,e)}catch(i){throw console.warn(`There was a problem retrieving the competition with the following id: ${t}`,i),i}};getTopCompetitionsIdMapping=async t=>{try{let e=await this.getTopCompetitions(t);return await this.idMapping.remapEntities(e,"competition")}catch(e){throw console.warn("There was a problem browsing the top competitions",e),e}};getTopCompetitions=async t=>{try{return t=t||!1,await this.https.getTopCompetitions(t)}catch(e){throw console.warn("There was a problem retrieving the top competitions",e),e}}};var Pi=class{name=null;countryId=null;national=!1;gender=null;limit=null;page=null;scope=null;sortField=null;sortOrder=null;teamIds=null;constructor(t){this.name=t.name?t.name:null,this.countryId=t.countryId?`${t.countryId}`:null,this.national=t.national?t.national:!1,this.gender=t.gender?t.gender:null,this.limit=t.limit?t.limit:null,this.page=t.page?t.page:null,this.scope=t.scope?t.scope:null,this.sortField=t.sortField?`${t.sortField}`:null,this.sortOrder=t.sortOrder?`${t.sortOrder}`:null,this.teamIds=t.teamIds?t.teamIds:null}constructFilterUrl=()=>{let t="";return this.name&&(t=t+"&",t=t+`name=${this.name}`),this.countryId&&(t=t+"&",t=t+`country_id=${this.countryId}`),this.national&&(t=t+"&",t=t+`national=${this.national}`),this.gender&&(t=t+"&",t=t+`gender=${this.gender}`),this.limit&&(t=t+"&",t=t+`limit=${this.limit}`),this.scope&&this.scope.length>0&&(t=t+"&",t=t+`scope=${this.scope.join(",")}`),this.page&&(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}`),this.teamIds&&this.teamIds.length>0&&(t=t+"&",t=t+`team_ids=${this.teamIds.join(",")}`),t}};var Ua=class{reason="";words=[]};var Te=class{enabled=!1;moderateLinks=!1;linksWhitelist=[];moderatorProfileId="";dictionary=new Ua};var Va=class{enabled=!1;clientId=null;automaticModeration=new Te};var xt=class{points=null;gameParticipationCount=null;entityId=null;entityType=null;predictionsMade=null;correctPredictions=null};var Ee=class{id;weight;multiplier;conditions};var Re=class{value=[new Ee]};var Fe=class{points=null;tiers=null;badges=null};var Ha=class{enabled=!1;clientId=null;conditions={list:null};actions=new Re;rewards=new Fe};var $a=class{general=null;predictor=null;activity=null;topX=null;matchQuiz=null;discussionPost=null};var Se=class{enabled=!1;clientId=null;defaultMarkets=null;competitionsWhitelist=null;authRequirement=null};var ve=class{enabled=!1;clientId=null;minFixtures=null;maxFixtures=null;competitionsWhitelist=null;authRequirement=null};var za=class{competitions=[];teams=[];markets=[]};var Ce=class{enabled=!1;clientId=null;fullCoverageCompetitions=null;markets=null;successRateScopes=new za;userDataConfig=null};var Qa=class{storeIp=!1;storeDeviceId=!1;storeAgent=!1};var qa=class{potm=[];poll=[]};var Wa=class{predictor=[];topX=[];matchQuiz=[];games=[];football=[];classicQuizzes=[];eitherOr=[];discussions=[];voting=new qa};var q=class{id;label;description;flags;assets={mainImageUrl:""};enabled};var Ka=class{predictionsNumber;correctPredictions;points;fromDate;toDate};var ja=class extends q{requirements=new Ka};var Ya=class{participationCount;points;fromDate;toDate};var Xa=class extends q{requirements=new Ya};var Ja=class{participationCount;points;specificGames;fromDate;toDate};var Za=class extends q{requirements=new Ja};var tr=class{predictionsNumber;correctPredictions;points;entityId;entityType;entityModel=null};var er=class extends q{requirements=new tr};var ir=class{participationCount;fromDate;toDate};var ar=class extends q{requirements=new ir};var rr=class{totalDiscussionPoints;postsCount;postPoints;reactionsCount};var or=class extends q{requirements=new rr};var sr=class{points;voteCount;entityId;entityType;entityModel};var Ae=class extends q{requirements=new sr};var Oe=class{points=null;tiers=null;badges=null};var nr=class{enabled=!1;clientId=null;conditions={list:null};actions=new Re;rewards=new Oe};var lr=class{general=[];predictor=[];topX=[];matchQuiz=[]};var pr=class{id;label;assets={mainImageUrl:""};enabled;requirements=new xt};var xe=class extends xt{postPoints=null;postsCount=null;reactionsCount=null;totalDiscussionPoints=null};var cr=class{id;label;assets={mainImageUrl:""};enabled;requirements=new xe};var Le=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};var De=class{total=null;minGoalkeepers=null;maxGoalkeepers=null;minDefenders=null;maxDefenders=null;minMidfielders=null;maxMidfielders=null;minStrikers=null;maxStrikers=null};var ur=class{enabled=!1;clientId=null;addPointsToProfileTotal=!1;coefficients=new Le;players=new De;multipliers=null;competitionsWhitelist=[]};var dr=class{captain=null;viceCaptain=null};var cl=class{remapPredictorConfig=t=>{let e=new Ce;return e.enabled=t.enabled,e.clientId=t.client_id,e.fullCoverageCompetitions=t.full_coverage_competitions,e.markets=t.markets,e.successRateScopes=t.success_rate_scopes,e.userDataConfig=t.user_data_config?this.remapUserDataConfig(t.user_data_config):null,e};remapTopXConfig=t=>{let e=new ve;return e.enabled=t.enabled,e.clientId=t.client_id,e.minFixtures=t.min_fixtures,e.maxFixtures=t.max_fixtures,e.competitionsWhitelist=t.competitions_whitelist,e.authRequirement=t.auth_requirement,e};remapMatchQuizConfig=t=>{let e=new Se;return e.enabled=t.enabled,e.clientId=t.client_id,e.defaultMarkets=t.default_markets,e.competitionsWhitelist=t.competitions_whitelist,e.authRequirement=t.auth_requirement,e};remapLoyaltyConfig=t=>{let e=new Ha;return e.enabled=t.enabled,e.clientId=t.client_id,e.conditions.list=t.conditions.list,e.actions.value=t.actions.value,e.rewards=this.remapRewards(t.rewards),e};remapLoyaltyNewConfig=t=>{let e=new nr;return e.enabled=t.enabled,e.clientId=t.client_id,e.conditions.list=t.conditions.list,e.actions.value=t.actions.value,e.rewards=this.remapNewRewards(t.rewards),e};remapDiscussionsConfig=t=>{let e=new Va;return e.enabled=t.enabled,e.clientId=t.client_id,e.automaticModeration=t.automatic_moderation?this.remapAutomaticModeration(t.automatic_moderation):null,e};remapFantasyConfig=t=>{let e=new ur;return e.enabled=t.enabled,e.clientId=t.client_id,e.addPointsToProfileTotal=t.add_points_to_profile_total,e.competitionsWhitelist=t.competitions_whitelist,e.multipliers=t.multipliers?this.remapMultipliers(t.multipliers):null,e.players=this.remapFantasyPlayers(t.players),e.coefficients=this.remapFantasyCoefficients(t.coefficients),e};remapFantasyPlayers=t=>{let e=new De;return e.total=t.total,e.minGoalkeepers=t.min_goalkeepers,e.maxGoalkeepers=t.max_goalkeepers,e.minDefenders=t.min_defenders,e.maxDefenders=t.max_defenders,e.minMidfielders=t.min_midfielders,e.maxMidfielders=t.max_midfielders,e.minStrikers=t.min_strikers,e.maxStrikers=t.max_strikers,e};remapFantasyCoefficients=t=>{let e=new Le;return e.assists=t.assists,e.shots=t.shots,e.offsides=t.offsides,e.tackles=t.tackles,e.saves=t.saves,e.minutesEqualOrOver60=t.minutes_equal_or_over_60,e.minutesUnder60=t.minutes_under_60,e.yellowCards=t.yellow_cards,e.redCards=t.red_cards,e.goalsGoalkeeper=t.goals_goalkeeper,e.goalsDefender=t.goals_defender,e.goalsMidfielder=t.goals_midfielder,e.goalsForwards=t.goals_forwards,e.penaltyGoals=t.penalty_goals,e.ownGoals=t.own_goals,e.cleanSheetsGoalkeeper=t.clean_sheets_goalkeeper,e.cleanSheetsDefender=t.clean_sheets_defender,e.cleanSheetsMidfielder=t.clean_sheets_midfielder,e.cleanSheetsForwards=t.clean_sheets_forwards,e.shotsOn=t.shots_on,e.foulsCommitted=t.fouls_committed,e.penaltyCommitted=t.penalty_committed,e.penaltyWon=t.penalty_won,e.penaltyMissed=t.penalty_missed,e.concededGoals=t.conceded_goals,e.caughtBall=t.caught_ball,e};remapAutomaticModeration=t=>{let e=new Te;return e.enabled=t.enabled,e.moderateLinks=t.moderate_links,e.linksWhitelist=t.links_whitelist,e.moderatorProfileId=t.moderator_profile_id,e.dictionary=t.dictionary,e};remapNewRewards=t=>{let e=new Oe;return e.points=this.remapPoints(t.points),e.tiers=t.tiers,e.badges=this.remapNewBadges(t.badges),e};remapRewards=t=>{let e=new Fe;return e.points=this.remapPoints(t.points),e.tiers=t.tiers,e.badges=this.remapBadges(t.badges),e};remapPoints=t=>{let e=new $a;return e.general=t.general,e.discussionPost=t.discussion_post,e.predictor=t.predictor,e.activity=t.activity,e.topX=t.top_x,e.matchQuiz=t.match_quiz,e};remapBadges=t=>{let e=new lr;return e.general=t.general?this.remapGeneralBadgeValues(t.general):[],e.predictor=this.remapBadgeValues(t.predictor),e.topX=this.remapBadgeValues(t.top_x),e.matchQuiz=this.remapBadgeValues(t.match_quiz),e};remapNewBadges=t=>{let e=new Wa;return e.predictor=this.remapBadgeValuesPredictor(t.predictor),e.topX=this.remapBadgeValuesGame(t.top_x),e.matchQuiz=this.remapBadgeValuesGame(t.match_quiz),t.games&&(e.games=this.remapBadgeValuesGames(t.games)),t.football&&(e.football=this.remapBadgeValuesFootball(t.football)),t.classic_quizzes&&(e.classicQuizzes=this.remapBadgeValuesMiniGames(t.classic_quizzes)),t.either_or&&(e.eitherOr=this.remapBadgeValuesMiniGames(t.either_or)),t.discussions&&(e.discussions=this.remapBadgeValuesDiscussions(t.discussions)),t.voting&&t.voting.potm&&(e.voting.potm=this.remapBadgeValuesVoting(t.voting.potm)),t.voting&&t.voting.poll&&(e.voting.poll=this.remapBadgeValuesVoting(t.voting.poll)),e};remapBadgeValuesPredictor=t=>t.map(e=>{let i=new ja;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.predictionsNumber=e.requirements.predictions_number,i.requirements.correctPredictions=e.requirements.correct_predictions,i.requirements.points=e.requirements.points,i.requirements.fromDate=e.requirements.from_date,i.requirements.toDate=e.requirements.to_date),i});remapBadgeValuesGame=t=>t.map(e=>{let i=new Xa;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.participationCount=e.requirements.participation_count,i.requirements.points=e.requirements.points,i.requirements.fromDate=e.requirements.from_date,i.requirements.toDate=e.requirements.to_date),i});remapBadgeValuesGames=t=>t.map(e=>{let i=new Za;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.participationCount=e.requirements.participation_count,i.requirements.points=e.requirements.points,i.requirements.fromDate=e.requirements.from_date,i.requirements.toDate=e.requirements.to_date,i.requirements.specificGames=e.requirements.specific_games?this.remapSpecificGamesRequirement(e.requirements.specific_games):null),i});remapSpecificGamesRequirement=t=>t.map(e=>({gameId:e.game_id,gameType:e.game_type,gameModel:null}));remapBadgeValuesFootball=t=>t.map(e=>{let i=new er;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.predictionsNumber=e.requirements.predictions_number,i.requirements.correctPredictions=e.requirements.correct_predictions,i.requirements.points=e.requirements.points,i.requirements.entityId=e.requirements.entity_id,i.requirements.entityType=e.requirements.entity_type),i});remapBadgeValuesMiniGames=t=>t.map(e=>{let i=new ar;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.participationCount=e.requirements.participation_count,i.requirements.fromDate=e.requirements.from_date,i.requirements.toDate=e.requirements.to_date),i});remapBadgeValuesDiscussions=t=>t.map(e=>{let i=new or;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.totalDiscussionPoints=e.requirements.total_discussion_points,i.requirements.postsCount=e.requirements.posts_count,i.requirements.postPoints=e.requirements.post_points,i.requirements.reactionsCount=e.requirements.reactions_count),i});remapBadgeValuesVoting=t=>t.map(e=>{let i=new Ae;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.points=e.requirements.points,i.requirements.voteCount=e.requirements.vote_count,i.requirements.entityId=e.requirements.entity_id,i.requirements.entityType=e.requirements.entity_type),i});remapBadgeValues=t=>t.map(e=>{let i=new pr;return i.id=e.id,i.label=e.label,i.enabled=e.enabled,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,i.requirements=this.remapRequirements(e.requirements),i});remapRequirements=t=>{let e=new xt;return e.points=t.points,e.gameParticipationCount=t.game_participation_count,e.entityId=t.entity_id,e.entityType=t.entity_type,e.predictionsMade=t.predictions_made,e.correctPredictions=t.correct_predictions,e};remapUserDataConfig=t=>{let e=new Qa;return e.storeIp=t.store_ip,e.storeDeviceId=t.store_device_id,e.storeAgent=t.store_agent,e};remapGeneralBadgeValues=t=>t.map(e=>{let i=new cr;return i.id=e.id,i.label=e.label,i.enabled=e.enabled,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,i.requirements=this.remapGeneralRequirements(e.requirements),i});remapGeneralRequirements=t=>{let e=new xe;return e.points=t.points,e.gameParticipationCount=t.game_participation_count,e.entityId=t.entity_id,e.entityType=t.entity_type,e.predictionsMade=t.predictions_made,e.correctPredictions=t.correct_predictions,e.postPoints=t.post_points,e.postsCount=t.posts_count,e.reactionsCount=t.reactions_count,e.totalDiscussionPoints=t.total_discussion_points,e};remapMultipliers=t=>{let e=new dr;return e.captain=t.captain,e.viceCaptain=t.vice_captain,e}};var mr=class{entityId;entityType;entityModel=null};var nc=class{totalItems=0};var lc=class{id=null;label=null};var pc=class{type=null;id=null;label=null};var hr=class{id=null;source=null;type=null};var I=class{limit;startAfter;constructor(t){this.limit=t&&t.limit?t.limit:null,this.startAfter=t&&t.startAfter?t.startAfter:null}constructMainFiltersUrl(){let t="";return this.limit&&(t+="&",t+=`limit=${this.limit}`),this.startAfter&&(t+="&",t+=`start_after=${this.startAfter}`),t}};var fr=class extends I{};var cc=class{fixtures=[];tiebreaker};var lu=(i=>(i.PARTICIPANT_ONE="PARTICIPANT_ONE",i.PARTICIPANT_TWO="PARTICIPANT_TWO",i.DRAW="DRAW",i))(lu||{});var gr=class{matchId="";participantOne="";participantTwo="";winner="PARTICIPANT_ONE"};var ft=(o=>(o.OPEN="OPEN",o.LIVE="LIVE",o.PENDING="PENDING",o.CANCELED="CANCELED",o.CLOSED="CLOSED",o.SETTLED="SETTLED",o))(ft||{});var yr=class extends I{status=null;sortOrder=null;gameIds=null;constructor(t){super(t),this.status=t?.status||null,this.sortOrder=t?.sortOrder||null,this.gameIds=t?.gameIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.status&&Object.values(ft).includes(this.status)?(t+="&",t+=`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")?(t+="&",t+=`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?(t+="&",t+=`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.`),t}};var br=class{profileId="";profileModel=null;challengeId="";challengeModel=null;message=""};var Be=class{name="";description="";invitation_code="";template_id="";users_can_invite_users=!1;administrators=[];scoring_starts_at=""};var Mr=class extends Be{type="ONE_VS_ONE"};var Ne=class{name="";description="";invitation_code="";template_id="";users_can_invite_users=!1;administrators=[];pinned_posts=[];scoring_starts_at=""};var Ir=class extends Ne{type="ONE_VS_ONE"};var wr=class{limit=null;page=null;challengeId=null;templateId=null;sortOrder=null;constructor(t){this.limit=t&&t.limit?t.limit:null,this.page=t&&t.page?t.page:null,this.challengeId=t&&t.challengeId?t.challengeId:null,this.templateId=t&&t.templateId?t.templateId:null,this.sortOrder=t&&t.sortOrder?t.sortOrder:null}constructFiltersUrl=()=>{let t="";return this.limit&&(t+=`&limit=${this.limit}`),this.page&&(t+=`&page=${this.page}`),this.challengeId&&(t+=`&league_id=${this.challengeId}`),this.templateId&&(t+=`&template_id=${this.templateId}`),this.sortOrder&&(t+=`&sort_order=${this.sortOrder}`),t}};var _r=class{type="ONE_VS_ONE";userRole=null;constructor(t){this.userRole=t?.userRole||null}constructFiltersUrl=()=>{let t=`&type=${this.type}`;return this.userRole&&(t+=`&user_role=${this.userRole}`),t}};var Pr=class{templateId="";templateModel=null;challengeId="";challengeModel=null;position="";points=0;type="challenge"};var Tr=class{id="";label="";discussionType="LEAGUE";discussionUrl=null;moderationType="USER";postsCount=0;pinnedPosts=[];lastPostId="";status="";deleted=!1;deletedAt="";deletedBy="";customFields=null;context=null;createdAt="";updatedAt=""};var uc=class{content="";replyId="";discussionLabel="";discussionUrl="";userNickname="";context=null};var ke=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=""};var Er=class extends ke{userModel=null};var Rr=class{content="";reply_id="";discussion_label="";discussion_url="";anonymous_nickname="";context=null};var Fr=class{id="";postsCount=0};var Lt=class{pagination={totalItems:0,nextPageStartsAfter:"",lastCommentCreateTimestamp:""}};var Sr=class{meta=new Lt;data=[]};var vr=class{meta=new Lt;data=[]};var Cr=class{meta=new y;data=[]};var Ar=class{type="";userIds=[];reactionCount=0};var Or=class{userId=null;reason="AD";reasonDetails=null};var xr=class{updatedAt="";content=""};var Fd=["CREATED_AT_ASC","CREATED_AT_DESC","POSTS_COUNT_ASC","POSTS_COUNT_DESC"],Sd=["ACTIVE","INACTIVE"],Lr=class extends I{discussionIds;label;discussionUrl;fromDate;toDate;fromCount;toCount;sort;status;skipDeleted;constructor(t){super(t),this.discussionIds=t&&t.discussionIds?t.discussionIds:null,this.label=t&&t.label?t.label:null,this.discussionUrl=t&&t.discussionUrl?t.discussionUrl:null,this.fromDate=t&&t.fromDate?t.fromDate:null,this.toDate=t&&t.toDate?t.toDate:null,this.fromCount=t&&t.fromCount?t.fromCount:null,this.toCount=t&&t.toCount?t.toCount:null,this.sort=t&&t.sort?t.sort:null,this.status=t?.status||null,this.skipDeleted=t&&t.skipDeleted!==void 0?t.skipDeleted:null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.discussionIds!==null&&(t+=`&discussion_ids=${this.discussionIds.join(",")}`),this.label!==null&&(t+=`&label=${this.label}`),this.discussionUrl!==null&&(t+=`&discussion_url=${this.discussionUrl}`),this.fromDate!==null&&(t+=`&from_date=${this.fromDate}`),this.toDate!==null&&(t+=`&to_date=${this.toDate}`),this.fromCount!==null&&(t+=`&from_count=${this.fromCount}`),this.toCount!==null&&(t+=`&to_count=${this.toCount}`),this.sort&&Fd.includes(this.sort.toUpperCase())&&(t+=`&sort=${this.sort.toUpperCase()}`),this.status&&Sd.includes(this.status.toUpperCase())&&(t+=`&status=${this.status.toUpperCase()}`),this.skipDeleted!==null&&(t+=`&skip_deleted=${this.skipDeleted}`),t}};var Yt=class extends I{skipDeleted;skipModerated;sort;constructor(t){super(t),this.skipDeleted=t&&t.skipDeleted!==void 0?t.skipDeleted:null,this.skipModerated=t&&t.skipModerated!==void 0?t.skipModerated:null,this.sort=t&&t.sort?t.sort.toLocaleLowerCase():null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.skipDeleted!==null&&(t+=`&skip_deleted=${this.skipDeleted}`),this.skipModerated!==null&&(t+=`&skip_moderated=${this.skipModerated}`),this.sort&&(t+=`&sort=${this.sort}`),t}};var Dr=class extends I{fromDate;toDate;entityIds;entityType;contentType;constructor(t){super(t),this.fromDate=t?.fromDate||null,this.toDate=t?.toDate||null,this.entityIds=t?.entityIds||null,this.entityType=t?.entityType||null,this.contentType=t?.contentType||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.fromDate!==null&&(t+=`&from_date=${this.fromDate}`),this.toDate!==null&&(t+=`&to_date=${this.toDate}`),this.entityIds!==null&&this.entityIds.length>0&&(t+=`&entity_ids=${this.entityIds}`),this.contentType!==null&&(t+=`&content_type=${this.contentType}`),t}};var Br=class extends I{status=null;sortOrder=null;gameIds=null;constructor(t){super(t),this.status=t?.status||null,this.sortOrder=t?.sortOrder||null,this.gameIds=t?.gameIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.status&&Object.values(ft).includes(this.status)?(t+="&",t+=`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")?(t+="&",t+=`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?(t+="&",t+=`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.`),t}};var Nr=class extends I{};var kr=class extends I{};var dc=class{id="";predictionType;prediction};var mc=class{fixtures=[];tiebreaker};var hc=class{options=[]};var fc=class{min=0;max=0};var Gr=class{templateId=null;playerId=null};var Ur=class{filters=new Gr};var Vr=class{meta=new Ur;data=[]};var Hr=class{key=null;label=null;value=null};var $r=class{templateId=null};var zr=class{filters=new $r};var Qr=class{meta=new zr;data=[]};var Ge=class{template_id=null;group_id=null;fixtures=[]};var Ue=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};var Dt=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};var qr=class{matchId=null;matchModel=null;points=new Ue;stats=new Dt};var Wr=class{playerId=null;playerModel=null;points=null;rank=null};var Kr=class{id="";country=null;gender="";assets=null;type="";name=""};var jr=class{id="";country=null;gender="";assets=null;type="";name="";participants=[]};var Yr=class{id="";alias="";countryCode="";assets=null;name=""};var X=class{type=null;subType=null};var Xr=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 X};var Jr=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 X;lineups=null};var gt=class{countryIds=null;competitionIds=null;matchIds=null;status=null;teamIds=null;fromDate=null;toDate=null;limit=null;page=null;sortField=null;sortOrder=null;constructor(t){this.countryIds=t.countryIds?t.countryIds:null,this.competitionIds=t.competitionIds?t.competitionIds:null,this.matchIds=t.matchIds?t.matchIds:null,this.status=t.status?t.status:null,this.teamIds=t.teamIds?t.teamIds:null,this.fromDate=t.fromDate?t.fromDate:null,this.toDate=t.toDate?t.toDate:null,this.limit=t.limit?t.limit:null,this.page=t.page?t.page:null,this.sortField=t.sortField?t.sortField:null,this.sortOrder=t.sortOrder?t.sortOrder:null}constructFilterUrl=t=>{let e="";return this.countryIds&&(e=e+"&",e=e+`countries=${this.countryIds.join(",")}`),this.competitionIds&&this.competitionIds.length>0&&(e=e+"&",e=e+`competitions=${this.competitionIds.join(",")}`),this.matchIds&&this.matchIds.length>0&&(e=e+"&",e=e+`matches=${this.matchIds.join(",")}`),this.status&&(e=e+"&",e=e+`status=${this.status}`),this.teamIds&&this.teamIds.length>0&&(e=e+"&",e=e+`teams=${this.teamIds.join(",")}`),this.fromDate&&(e=e+"&",e=e+`from_date=${this.fromDate}`),this.toDate&&(e=e+"&",e=e+`to_date=${this.toDate}`),this.limit&&!t&&(e=e+"&",e=e+`limit=${this.limit}`),this.page&&!t&&(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}};var Zr=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};var to=class{ftScore=null;htScore=null;aetScore=null;aggScore=null;penScore=null};var Ve=class{homeTeam={players:[]};awayTeam={players:[]}};var eo=class{minute="";type="";teamId="";player=null;relatedPlayer=null;updatedAt=""};var io=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};var ao=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;isDeleted=!1;teams=[]};var ro=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;isDeleted=!1;competitions=[];teams=[]};var oo=class{id="";startDate="";endDate="";shirtNumber;loan=!1;position="";country=null;name="";assets=null;birthDate=""};var so=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null};var Ti=class{countryId=null;scope=null;name=null;playerIds=null;limit=null;page=null;sortField=null;sortOrder=null;constructor(t){this.countryId=t.countryId?t.countryId:null,this.scope=t.scope?t.scope:null,this.name=t.name?t.name:null,this.playerIds=t.playerIds?t.playerIds:null,this.limit=t.limit?t.limit:null,this.page=t.page?t.page:null,this.sortField=t.sortField?t.sortField:null,this.sortOrder=t.sortOrder?t.sortOrder:null}constructFilterUrl=()=>{let t="";return this.countryId&&(t=t+"&",t=t+`country_id=${this.countryId}`),this.scope&&this.scope.length>0&&(t=t+"&",t=t+`scope=${this.scope.join(",")}`),this.name&&(t=t+"&",t=t+`name=${this.name}`),this.playerIds&&this.playerIds.length>0&&(t=t+"&",t=t+`player_ids=${this.playerIds.join(",")}`),this.limit&&(t=t+"&",t=t+`limit=${this.limit}`),this.page&&(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}};var gc=class{headshot=null};var yc=class{id=null;name=null;country=null};var no=class{id="";name="";position="";shirtNumber;assets=null;type=""};var lo=class{id="";country=null;gender="";assets=null;name="";code="";national=!1;undecided=!1;fullName="";shortName="";isDeleted=!1};var po=class{primary=null;secondary=null;tertiary=null};var co=class{id="";country=null;gender="";assets=null;name="";competitions=[];code="";national=!1;fullName="";shortName="";isDeleted=!1;undecided=!1;colors=new po;squad=[]};var bc=class{teamId=null;matches=[]};var uo=class{teams=null;players=null;competitions=null};var mo=class{entities=null;query=null;scope=null;constructor(t){this.entities=t.entities?t.entities:null,this.query=t.query?t.query:null,this.scope=t.scope?t.scope:null}constructFilterUrl=()=>{let t="";return this.entities&&(t=t+"&",t=t+`entities=${this.entities.join(",")}`),this.query&&(t=t+"&",t=t+`q=${this.query}`),this.scope&&(t=t+"&",t=t+`scope=${this.scope.join(",")}`),t}};var Xt=class{meta=new k;data=[]};var Mc=class{logo=null};var Ic=class{profile=null;football=null;predictor=null;loyalty=null;topX=null;matchQuiz=null;activity=null;miniGames=null;discussions=null;privateLeagues=null;challenges=null;progress=null;voting=null;fantasy=null;helpers=null;idMapping=null;bracketGame=null;lists=null;standingGame=null;eventGame=null;odds=null;getVersion=null};var ul=class{apiKey;clientId;environment;idSchema;lang;errorHandlingMode;oddClient;cookieToken;authProvider};var W=class{main=null;cover=null;mobile=null};var ho=class{colors=null;urls=null;images=null};var fo=class{primaryColor=null;secondaryColor=null;contentColor=null;backgroundColor=null;borderColor=null;additionalColor=null};var go=class{primaryUrl=null;secondaryUrl=null;privacyPolicyUrl=null;termsAndConditionsUrl=null;additionalUrl=null};var yo=class{mainLogo=null;mobileLogo=null;backgroundImage=null;mobileBackgroundImage=null;additionalImage=null};var wc=class{preferenceId="";categories=[];source=""};var bo=class{input=null;output=null};var Mo=class{meta=new bo;data=[]};var Io=class{limit=null;page=null;constructor(t){this.limit=t&&t.limit?t.limit:null,this.page=t&&t.page?t.page:null}constructFiltersUrl=()=>{let t="";return this.limit&&(t+=`&limit=${this.limit}`),this.page&&(t+=`&page=${this.page}`),t}};var wo=class{general;predictor;topX;matchQuiz};var _o=class{predictor;topX;matchQuiz;games;football;classicQuizzes;eitherOr;discussions;potm;poll};var _c=class extends Ae{};var Pc=class{count=0;breakdown=[]};var Tc=class{footballCompetitions;footballTeams;footballPlayers};var Po=class{market;fromDate;toDate;usersCount;minimumPredictions;constructor(t){this.market=t.market?t.market:null,this.fromDate=t.fromDate?t.fromDate:null,this.toDate=t.toDate?t.toDate:null,this.usersCount=t.usersCount?t.usersCount:null,this.minimumPredictions=t.minimumPredictions?t.minimumPredictions:null}constructFiltersUrl(){let t="";return this.market&&(t+="&",t+=`market=${this.market}`),this.fromDate&&(t+="&",t+=`from_date=${this.fromDate}`),this.toDate&&(t+="&",t+=`to_date=${this.toDate}`),this.usersCount&&(t+="&",t+=`users_count=${this.usersCount}`),this.minimumPredictions&&(t+="&",t+=`minimum_predictions=${this.minimumPredictions}`),t}};var To=class{templateId=null;limit=null;page=null;groupId=null;constructor(t){this.templateId=t?.templateId||null,this.limit=t?.limit||null,this.page=t?.page||null,t?.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 t="";return this.templateId&&(t+=`&template_id=${this.templateId}`),this.limit&&(t+=`&limit=${this.limit}`),this.page&&(t+=`&page=${this.page}`),t}};var Eo=class{groupId=null;limit=null;page=null;constructor(t){this.groupId=t.groupId?t.groupId:null,this.limit=t.limit?t.limit:null,this.page=t.page?t.page:null}constructFiltersUrl(){let t="";return this.groupId&&(t+="&",t+=`group_id=${this.groupId}`),this.limit&&(t+="&",t+=`limit=${this.limit}`),this.page&&(t+="&",t+=`page=${this.page}`),t}};var Ro=class{sortOrder=null;rankType=null;leaderboardIds=null;gameType=null;limit=null;page=null;groupId=null;constructor(t){this.sortOrder=t.sortOrder,this.rankType=t.rankType,this.leaderboardIds=t.leaderboardIds,this.limit=t.limit,this.page=t.page,t.gameType&&(t.rankType==="GAME"?this.gameType=t.gameType:console.warn(`RankingsFilters: gameType "${t.gameType}" ignored because rankType is "${t.rankType}". gameType can only be used when rankType is "GAME".`)),t.groupId&&(t.rankType==="TEMPLATE"?this.groupId=t.groupId:console.warn(`RankingsFilters: groupId "${t.groupId}" ignored because rankType is "${t.rankType}". groupId can only be used when rankType is "TEMPLATE".`))}constructFiltersUrl=()=>{let t="";return this.sortOrder&&(t+="&",t+=`sort_order=${this.sortOrder}`),this.rankType&&(t+="&",t+=`rank_type=${this.rankType}`),this.leaderboardIds&&(t+="&",t+=`type_ids=${this.leaderboardIds.join(",")}`),this.gameType&&this.rankType==="GAME"&&(t+="&",t+=`game_type=${this.gameType}`),this.limit&&(t+="&",t+=`limit=${this.limit}`),this.page&&(t+="&",t+=`page=${this.page}`),this.groupId&&this.rankType==="TEMPLATE"&&(t+="&",t+=`group_id=${this.groupId}`),t}};var Fo=class{flags=null;status=null;type=null;activeFrom=null;activeTo=null;createdFrom=null;createdTo=null;updatedFrom=null;updatedTo=null;constructor(t){this.flags=t.flags?t.flags:null,this.status=t.status?t.status:null,this.type=t.type?t.type:null,this.activeFrom=t.activeFrom?t.activeFrom:null,this.activeTo=t.activeTo?t.activeTo:null,this.createdFrom=t.createdFrom?t.createdFrom:null,this.createdTo=t.createdTo?t.createdTo:null,this.updatedFrom=t.updatedFrom?t.updatedFrom:null,this.updatedTo=t.updatedTo?t.updatedTo:null}constructFiltersUrl(){let t="";return this.flags&&this.flags.length>0&&(t+="&",t+=`flags=${this.flags.join(",")}`),this.status&&(t+="&",t+=`status=${this.status}`),this.type&&(t+="&",t+=`type=${this.type}`),this.activeFrom&&(t+="&",t+=`active_from=${this.activeFrom}`),this.activeTo&&(t+="&",t+=`active_to=${this.activeTo}`),this.createdFrom&&(t+="&",t+=`created_from=${this.createdFrom}`),this.createdTo&&(t+="&",t+=`created_to=${this.createdTo}`),this.updatedFrom&&(t+="&",t+=`updated_from=${this.updatedFrom}`),this.updatedTo&&(t+="&",t+=`updated_to=${this.updatedTo}`),t}};var So=class{position=null;points=null;predictionsMade=null;profileId=null;profileModel=null;successRatePercent=null};var He=class{templateId=null;privateLeagueId=null;fromDate=null;toDate=null;pagination=new Y};var Ec=class{meta=new He;data=[]};var Bt=class{rankType=null;fromDate=null;toDate=null;pagination=new Y};var Rc=class{meta=new Bt;data=[]};var $e=class{position=null;profileId=null;profileModel=null;points=null;predictionsMade=null};var vo=class{flags="";status="";type="";activeFrom="";activeTo="";createdFrom="";createdTo="";updatedFrom="";updatedTo=""};var Co=class{pagination=new Y;filters=new vo};var Fc=class{id=null;points=null};var Sc=class extends Ee{points;alternative;constructor(){super(),delete this.weight}};var Ao=class extends $e{id=null;rankType=null;model=null;gameType=null};var vc=class{meta=new Bt;data=[]};var Oo=class{groupId;averagePoints;highestPoints};var Nt=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;flags=null;images=new W;status=null;automaticallyChangeStatus=!0;createdAt=null;updatedAt=null;related=null};var xo=class extends Nt{adContent=null};var Lo=class{groupId=null;label=null;flags=[];filters=null};var Do=class{fromDate=null;toDate=null;matchIds=[]};var Cc=class{enabled=!1;id=null;label=null;points=null};var Bo=class{value=null;target=null;playerId=null;playerModel=null;result=null};var No=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new X;prediction=new Bo};var ko=class{gameId=null;results=null;tieBreakers=null};var yt=class{timeTiebreaker=!1};var Pt=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;outcome=null;predictionsCutoff=null;fixtures=[];tiebreaker=new yt;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};var ze=class{id=null;title=null;alternativeTitle=null;description=null;type=null;images=new W;participationCount=null;questionsCount=null;status=null;language=null;authRequirement=null;flags=null;customFields=null;labels=null;branding=null;related=[];time=null;points=null;scored=!1;maxAttempts=null;averageScore=null;perfectScore=null;adContent=null;context=null;createdAt=null;updatedAt=null};var kt=class extends I{flags=null;status=null;entityIds=null;entityType=null;sort=null;groupByStatus=null;language=null;title=null;constructor(t){super(t),this.flags=t&&t.flags?t.flags:null,this.status=t&&t.status?t.status:null,this.entityIds=t&&t.entityIds?t.entityIds:null,this.entityType=t&&t.entityType?t.entityType:null,this.sort=t&&t.sort?t.sort:null,this.groupByStatus=t&&t.groupByStatus!==void 0?t.groupByStatus:null,this.language=t&&t.language?t.language:null,this.title=t&&t.title?t.title:null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.flags&&this.flags.length>0&&(t+=`&flags=${this.flags.join(",")}`),this.status&&(t+=`&status=${this.status}`),this.entityIds&&this.entityIds.length>0&&(t+=`&entity_ids=${this.entityIds}`),this.sort&&(t+=`&sort=${this.sort}`),this.groupByStatus!==null&&(t+=`&group_by_status=${this.groupByStatus}`),this.language!==null&&(t+=`&language=${this.language}`),this.title!==null&&(t+=`&title=${this.title}`),t}};var Go=class extends kt{classicQuizIds=null;constructor(t){super(t),this.classicQuizIds=t&&t.classicQuizIds?t.classicQuizIds:null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.classicQuizIds&&this.classicQuizIds.length>0&&(t+=`&classic_quiz_ids=${this.classicQuizIds.join(",")}`),t}};var Uo=class extends ze{rules=null;questions=[]};var Vo=class{questionId=null;question=null;images=null;embedCode=null;explanation=null;options=[]};var Ho=class{optionId=null;option=null;images=null;correct=null};var Ac=class{questionId=0;optionId=0};var $o=class{classicQuizId=null;userId=null;questions=[];correctOptions=null;personalBest=null;points=null;attempts=null};var zo=class{questionId=null;optionId=null;correct=null;correctOptionId=null};var Ei=class extends I{classicQuizIds=null;constructor(t){super(t),this.classicQuizIds=t?.classicQuizIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.classicQuizIds&&this.classicQuizIds.length>0&&(t+=`&classic_quiz_ids=${this.classicQuizIds.join(",")}`),t}};var Ri=class{classicQuizId=null;classicQuizModel=null;correct=null;classicQuizQuestions=null;personalBest=null;points=null;answers=[];attempts=0};var Qo=class{meta=new y;data=[]};var Oc=class{meta=new y;data=[]};var qo=class{questionId=null;questionModel=null;wrong=null;correct=null;skipped=null;total=null};var Qe=class{classicQuizIds=null};var qe=class{limit=null;page=null;constructor(t){this.limit=t?.limit||null,this.page=t?.page||null}constructMainFiltersUrl(){let t="";return this.limit&&(t+=`&limit=${this.limit}`),this.page&&(t+=`&page=${this.page}`),t}};var Wo=class extends qe{classicQuizIds=null;constructor(t){super(t),this.classicQuizIds=t?.classicQuizIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.classicQuizIds&&this.classicQuizIds.length>0&&(t+=`&classic_quiz_ids=${this.classicQuizIds.join(",")}`),t}};var We=class{pagination=new Y;filters=new Qe};var Ko=class{position=null;profileId=null;profileModel=null;points=null};var jo=class{position=null;classicQuizId=null;classicQuizModel=null;points=null};var xc=class{meta=new k;data=[]};var Lc=class{meta=new We;data=[]};var Ke=class{id="";title="";alternativeTitle="";description="";images=new W;flags=[];status="";language="";authRequirement=null;winningCondition="";lives=0;time=0;points=[];customFields=null;branding=null;labels=null;adContent="";context=null;type="";related=[];totalParticipationsCount=0;totalUsersCount=0;finishedParticipationsCount=0;averageStartedParticipationsCount=0;averageFinishedParticipationsCount=0;createdAt="";updatedAt=""};var Yo=class extends kt{eitherOrIds=null;constructor(t){super(t),this.eitherOrIds=t&&t.eitherOrIds?t.eitherOrIds:null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.eitherOrIds&&this.eitherOrIds.length>0&&(t+=`&either_or_ids=${this.eitherOrIds.join(",")}`),t}};var Xo=class extends Ke{rules=""};var Jo=class{correctSteps=0;score=0};var Dc=class{meta=new y;data=[]};var Zo=class{eitherOrId="";personalBest=0;betterThan=0};var ts=class{instanceId="";eitherOrId="";gameStartedAt="";currentStep=0;currentStreak=0;remainingSteps=0;currentLives=0;currentPoints=0;personalBest=0;participationCount=0;finishedParticipationsCount=0;steps=[]};var es=class{pair="";answer=""};var is=class extends es{expired=!1;time=0};var as=class{main;mobile};var Fi=class{id="";label="";images=new as;value=null};var rs=class{pairId="";userSelection="";correct=null;played=null;timestamp="";optionOne=new Fi;optionTwo=new Fi};var os=class{rangeStartInclusive=0;rangeEndInclusive=0;totalUsers=0};var ss=class{standings=[];breakdown=[]};var ns=class{userId="";userModel=null;personalBest=""};var Gt=class{content=null;tags=[];campaign=null};var Ut=class{id=null;model=null;source=null;type=null};var ls=class{questions=null;correctAnswers=null};var je=class{id=null;title=null;alternativeTitle=null;description=null;images=new W;participationCount=null;status=null;language=null;authRequirement=null;flags=null;customFields=null;labels=null;branding=null;related=[];time=null;preferencesEnabled=!1;maxAttempts=null;adContent=null;context=null;createdAt=null;updatedAt=null};var Bc=class{meta=new y;data=[]};var ps=class{personaId=null;title=null;description=null;images=null};var cs=class{questionId=null;question=null;images=null;explanation=null;options=[]};var us=class{personaId=null;points=null};var ds=class{optionId=null;option=null;images=null;personaPoints=[];preferenceMapping=[]};var ms=class extends je{rules=null;questions=[];personaResults=[]};var hs=class extends kt{personalityQuizIds=null;constructor(t){super(t),this.personalityQuizIds=t&&t.personalityQuizIds?t.personalityQuizIds:null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.personalityQuizIds&&this.personalityQuizIds.length>0&&(t+=`&personality_quiz_ids=${this.personalityQuizIds.join(",")}`),t}};var Nc=class{questionId=0;optionId=0};var fs=class{personalityQuizId=null;userId=null;questions=[];personas=[];attempts=null};var gs=class{questionId=null;optionId=null};var ys=class{personaId=null;percent=null};var bs=class extends I{personalityQuizIds=null;constructor(t){super(t),this.personalityQuizIds=t?.personalityQuizIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.personalityQuizIds&&this.personalityQuizIds.length>0&&(t+=`&personality_quiz_ids=${this.personalityQuizIds.join(",")}`),t}};var Ms=class{meta=new y;data=[]};var Is=class{id=null;name=null;url=null;assets=[];links=[];branding=null;eventUrls=[];stakesDisclaimer=null;domainName=null};var ws=class{backgroundColor=null;textColor=null};var kc=class{appType=null;selectionTemplateUrl=null;eventTemplateUrl=null;homepageUrl=null};var _s=class{logo=null;type=null;transparentBackgroundUrl=null;backgroundColor=null};var Ps=class{url=null;appType=null};var pu=(i=>(i.PRE_EVENT="PRE_EVENT",i.LIVE="LIVE",i.ALL="ALL",i))(pu||{}),cu=(e=>(e.ORDINARY_TIME="ORDINARY_TIME",e.FULL_TIME="FULL_TIME",e))(cu||{}),uu=(i=>(i.DECIMAL="DECIMAL",i.MONEYLINE="MONEYLINE",i.FRACTIONAL="FRACTIONAL",i))(uu||{});var du=(B=>(B.FT_1X2="FT_1X2",B.DOUBLE_CHANCE="DOUBLE_CHANCE",B.HT_FT="HT_FT",B.BOTH_TEAMS_SCORE="BOTH_TEAMS_SCORE",B.CORRECT_SCORE="CORRECT_SCORE",B.PLAYER_SCORE_FIRST_GOAL="PLAYER_SCORE_FIRST_GOAL",B.PLAYER_SCORE="PLAYER_SCORE",B.PLAYER_RED_CARD="PLAYER_RED_CARD",B.PLAYER_YELLOW_CARD="PLAYER_YELLOW_CARD",B.OVER_GOALS_0_5="OVER_GOALS_0_5",B.OVER_GOALS_1_5="OVER_GOALS_1_5",B.OVER_GOALS_2_5="OVER_GOALS_2_5",B.OVER_GOALS_3_5="OVER_GOALS_3_5",B.OVER_GOALS_4_5="OVER_GOALS_4_5",B.OVER_GOALS_5_5="OVER_GOALS_5_5",B))(du||{}),vd={["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"},Ts=class{oddType="PRE_EVENT";scopeType="ORDINARY_TIME";oddFormat="DECIMAL";marketTypes=["FT_1X2"];constructor(t){this.validateFilters(t)}constructFiltersUrl(){let t=this.marketTypes.map(e=>this.mapToSportal365Market(e));return`&odd_type=${this.oddType}&scope_type=${this.scopeType}&odd_format=${this.oddFormat}&market_types=${t.join(",")}`}validateFilters(t){let e=Object.values(pu),i=Object.values(cu),a=Object.values(uu),r=Object.values(du);t?.oddType&&(e.includes(t.oddType)?this.oddType=t.oddType:console.warn(`The filter "oddType" is NOT valid and therefore it will be set to PRE_EVENT. The VALID values are : ${e.join(", ")}`)),t?.scopeType&&(i.includes(t.scopeType)?this.scopeType=t.scopeType:console.warn(`The filter "scopeType" is NOT valid and therefore it will be set to ORDINARY_TIME. The VALID values are : ${i.join(", ")}`)),t?.oddFormat&&(a.includes(t.oddFormat)?this.oddFormat=t.oddFormat:console.warn(`The filter "oddFormat" is NOT valid and therefore it will be set to DECIMAL. The VALID values are : ${a.join(", ")}`)),t?.marketTypes&&Array.isArray(t?.marketTypes)&&t?.marketTypes.length>0&&(t.marketTypes.every(o=>r.includes(o))?this.marketTypes=t.marketTypes:console.warn(`The filter "marketTypes" is NOT valid and therefore it will be set to FT_1X2. The VALID values are : ${r.join(", ")}`))}mapToSportal365Market(t){return t.startsWith("OVER_GOALS_")?"OVER_UNDER":vd[t]}};var Es=class{type=null;scope=null;selections=[]};var Rs=class{id=null;type=null;name=null;entityType=null};var Fs=class{id=null;name=null;code=null;value=null;odds=null;urls=[];movement=null;oddsOld=null;entityType=null;additionalInfo=null;providerInfo=null};var Ss=class{id=null;name=null;code=null;entityType=null};var vs=class{selectionId=null;eventId=null;marketId=null;competitionId=null};var Cs=class{bookmaker=null;type=null;markets=[]};var Gc=class{main=null;all=null};var As=class{value=null;playerId=null;playerModel=null;playerRole};var Ye=class{market=null;matchId=null;matchType=null;matchModel=null;prediction=new As;result=null};var Xe=class{settledAt=null;resettledAt=null;status=null;outcome=null;points=0};var ot=class{value=!1};var Os=class{matchId=null;market="BOTH_TEAMS_SCORE";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new ot,this.prediction.value=e}};var xs=class{value};var Ls=class{matchId=null;market="CORNERS_MATCH";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new xs,this.prediction.value=e}};var Ds=class{value=null};var Vt=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new Ds,this.prediction.value=i}};var Bs=class{value=null};var Ns=class{matchId=null;market="DOUBLE_CHANCE";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new Bs,this.prediction.value=e}};var ks=class{value=null};var Gs=class{matchId=null;market="HT_FT";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new ks,this.prediction.value=e}};var Us=class{value=null};var Vs=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new Us,this.prediction.value=i}};var Je=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new ot,this.prediction.value=i}};var Ze=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new ot,this.prediction.value=i}};var Hs=class{matchId=null;market="PENALTY_MATCH";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new ot,this.prediction.value=e}};var $s=class{value=!1;playerId=null};var st=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i,a){this.matchId=t,this.market=e,this.prediction=new $s,this.prediction.value=i,this.prediction.playerId=a}};var zs=class{matchId=null;market="RED_CARD_MATCH";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new ot,this.prediction.value=e}};var Uc=class{home=null;draw=null;away=null};var Vc=class{score=null;percentage=null};var ti=class{homeGoals=null;awayGoals=null};var Qs=class{playerId=null;playerModel=null};var qs=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 Qs;PLAYER_SCORE=[];PLAYER_SCORE_TWICE=[];PLAYER_SCORE_HATTRICK=[];CORRECT_SCORE=new ti;CORRECT_SCORE_ADVANCED=new ti;CORRECT_SCORE_HT=new ti;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};var L=class{no=0;yes=0};var ei=class{gameInstanceId=null;fixtures=null};var bt=class{goldenGoal=null};var Si=class{id=null;gameInstanceId=null;gameType=null;wager=null;totalFixtures=null;settledFixtures=null;userId=null;fixtures=[];status=null;tiebreaker=new bt;points=null;templateId=null;groupId=null;profileLastUpdatedAt=null;createdAt=null;updatedAt=null};var dl=(r=>(r.ACTIVE="ACTIVE",r.WON="WON",r.LOST="LOST",r.PARTIALLY_WON="PARTIALLY_WON",r.CANCELED="CANCELED",r))(dl||{}),mu=["WON","LOST","PARTIALLY_WON","CANCELED"];var V=class{limit=null;startAfter=null;status=null;type=null;matchIds=null;gameIds=null;constructor(t){this.limit=t?.limit||null,this.startAfter=t?.startAfter||null,this.status=t?.status||null,this.type=t?.type||null,this.matchIds=t?.matchIds||null,this.gameIds=t?.gameIds||null}constructFiltersUrl=()=>{let t="",e=!1;return this.status&&(e=Object.values(dl).some(i=>this.status.includes(i))),this.limit&&(t+="&",t+=`limit=${this.limit}`),this.startAfter&&(t+="&",t+=`start_after=${this.startAfter}`),this.status&&e&&(t+="&",t+=`status=${this.status.join(",")}`),this.type&&(t+="&",t+=`game_types=${this.type}`),this.matchIds&&this.matchIds.length>0&&(t+="&",t+=`match_ids=${this.matchIds.join(",")}`),this.gameIds&&this.gameIds.length>0&&(t+="&",t+=`game_ids=${this.gameIds.join(",")}`),t}};var Ws=class{fullTimeOneXTwo={};halfTimeOneXTwo={};bothTeamsScore=new L;doubleChance={};halfTimeFullTime={};playerScore={};playerYellowCard={};playerRedCard={};redCardMatch=new L;penaltyMatch=new L;playerScoreFirstGoal={};cornersMatch={};correctScore={};correctScoreHalfTime={};correctScoreAdvanced={};playerScoreHattrick={};playerScoreTwice={};overZeroPointFiveGoals=new L;overOnePointFiveGoals=new L;overTwoPointFiveGoals=new L;overThreePointFiveGoals=new L;overFourPointFiveGoals=new L;overFivePointFiveGoals=new L;overSixPointFiveGoals=new L;overSixPointFiveCorners=new L;overSevenPointFiveCorners=new L;overEightPointFiveCorners=new L;overNinePointFiveCorners=new L;overTenPointFiveCorners=new L;overElevenPointFiveCorners=new L;overTwelvePointFiveCorners=new L;overThirteenPointFiveCorners=new L};var Ks=class{matchId=null;matchType=null;predictions=null};var js=class{profileId="";profileModel=null;leagueId="";leagueModel=null;message=""};var Hc=class{id=null;name=null;model=new Nt};var ii=class{id="";name="";description="";type="";banned=[];invites=[];administrators=[];membersCount=0;invitationCode="";templateId="";templateModel=null;pastTemplates=[];usersCanInviteUsers=!1;scoringStartsAt="";pinnedPosts=[]};var Ys=class extends ii{members=[]};var $c=class{name="";description="";invitationCode="";templateId="";usersCanInviteUsers=!1;administrators=[];scoringStartsAt=""};var zc=class{name="";description="";invitationCode="";templateId="";usersCanInviteUsers=!1;administrators=[];pinnedPosts=[];scoringStartsAt=""};var Xs=class{predictionId=null;predictionModel=null;profileId=null;profileModel=null};var Qc=class{meta=new k;data=[]};var qc=class{meta=new y;data=[]};var ai=class extends I{type=null;constructor(t){super(t),this.type=t&&t.type?t.type:null}constructMainFiltersUrl=()=>{let t=super.constructMainFiltersUrl();return this.type&&(t+=`&type=${this.type}`),t}};var Js=class{type="PRIVATE";userRole=null;constructor(t){this.userRole=t?.userRole||null}constructFiltersUrl=()=>{let t=`&type=${this.type}`;return this.userRole&&(t+=`&user_role=${this.userRole}`),t}};var Zs=class{limit=null;page=null;leagueId=null;templateId=null;sortOrder=null;constructor(t){this.limit=t&&t.limit?t.limit:null,this.page=t&&t.page?t.page:null,this.leagueId=t&&t.leagueId?t.leagueId:null,this.templateId=t&&t.templateId?t.templateId:null,this.sortOrder=t&&t.sortOrder?t.sortOrder:null}constructFiltersUrl=()=>{let t="";return this.limit&&(t+=`&limit=${this.limit}`),this.page&&(t+=`&page=${this.page}`),this.leagueId&&(t+=`&private_league_id=${this.leagueId}`),this.templateId&&(t+=`&template_id=${this.templateId}`),this.sortOrder&&(t+=`&sort_order=${this.sortOrder}`),t}};var ri=class extends I{reportsCount=null;constructor(t){super(t),this.reportsCount=t.reportsCount?t.reportsCount:null}constructMainFiltersUrl=()=>{let t=super.constructMainFiltersUrl();return this.reportsCount&&(t+=`&reports_count=${this.reportsCount}`),t}};var oi=class{limit=null;page=null;profileIds=null;constructor(t){this.limit=t&&t.limit?t.limit:null,this.page=t&&t.page?t.page:null,this.profileIds=t&&t.profileIds?t.leagueId:null}constructFiltersUrl=()=>{let t="";return this.limit&&(t+=`&limit=${this.limit}`),this.page&&(t+=`&page=${this.page}`),this.profileIds&&(t+=`&profile_ids=${this.profileIds.join(",")}`),t}};var tn=class{templateId="";templateModel=null;privateLeagueId="";privateLeagueModel=null;position="";points=0;type="private_league"};var en=class extends Be{type="PRIVATE"};var an=class extends Ne{type="PRIVATE"};var rn=class{id="";source="";type="";favourite=!1};var on=class extends rn{model=null};var Wc=class{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};var Kc=class{consentId="";entityId=null;entityType=null;content=null};var sn=class extends I{status=null;sortOrder=null;gameIds=null;constructor(t){super(t),this.status=t?.status||null,this.sortOrder=t?.sortOrder||null,this.gameIds=t?.gameIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.status&&Object.values(ft).includes(this.status)?(t+="&",t+=`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")?(t+="&",t+=`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?(t+="&",t+=`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.`),t}};var nn=class extends I{};var ln=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new X};var pn=class{value=null;result=null};var cn=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new X;prediction=new pn};var Tt=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;scheduleOpenAt=null;predictionsCutoff=null;fixtures=[];tiebreaker=new yt;participantsCount=0;related=[];excludedProfileIds=null;rules=null;labels=null;customFields=null;branding=null;flags=null;images=new W;createdAt=null;updatedAt=null};var si=class extends Tt{adContent=null};var Jt=class{userId=null;points=null;results=[];tiebreaker=null};var un=class{matchId=null;matchModel=null;outcome=null};var nt=class extends I{status=null;type=null;gameIds=null;sortOrder=null;constructor(t){super(t),this.status=t?.status||null,this.type=t?.type||null,this.gameIds=t?.gameIds||null,this.sortOrder=t?.sortOrder||null}constructFiltersUrl=()=>{let t=super.constructMainFiltersUrl();return this.status&&Object.values(ft).includes(this.status)&&(t+="&",t+=`status=${this.status}`),this.type&&(t+="&",t+=`type=${this.type}`),this.gameIds&&this.gameIds.length>0&&(t+="&",t+=`game_ids=${this.gameIds.join(",")}`),this.sortOrder&&(t+="&",t+=`sort_order=${this.sortOrder}`),t}};var Ht=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;outcome=null;predictionsCutoff=null;fixtures=[];tiebreaker=new yt;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 bt;branding=null};var dn=class{contestId="";contestType="GAME";contestModel=null;description="";userList=[]};var mn=class{position="";profileId="";profileModel=null;note="";tags=[]};var ni=class{gameInstanceId=null;fixtures=[];tiebreaker=null;constructor(t){this.gameInstanceId=t.gameInstanceId,t.fixtures.forEach(e=>this.fixtures.push(new Vt(e.matchId,e.market,e.prediction.value))),this.tiebreaker=t.tiebreaker?t.tiebreaker:null}};var li=class extends I{flags=null;status=null;entityIds=null;entityType=null;pollIds=null;sortOrder=null;minVotes=null;language=null;constructor(t){super(t),this.flags=t?.flags||null,this.status=t?.status||null,this.entityIds=t?.entityIds||null,this.entityType=t?.entityType||null,this.pollIds=t?.pollIds||null,this.sortOrder=t?.sortOrder||null,this.minVotes=t&&t.minVotes!==void 0?t.minVotes:null,this.language=t?.language||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.flags&&this.flags.length>0&&(t+=`&flags=${this.flags.join(",")}`),this.status&&(t+=`&status=${this.status}`),this.entityIds&&this.entityIds.length>0&&(t+=`&entity_ids=${this.entityIds.join(",")}`),this.pollIds&&this.pollIds.length>0&&(t+=`&poll_ids=${this.pollIds.join(",")}`),this.sortOrder&&(t+=`&sort_order=${this.sortOrder}`),this.minVotes&&(t+=`&min_votes=${this.minVotes}`),this.language&&(t+=`&language=${this.language}`),t}};var pi=class{id=null;title=null;alternativeTitle=null;description=null;type=null;images=new W;status=null;language=null;authRequirement=null;totalVotes=null;flags=[];customFields=null;branding=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};var hn=class extends pi{rules=null};var fn=class{id=null;title=null;description=null;images=new W;votes=null;embedCode=null;preferencesMapping=[]};var ci=class{preferenceId=""};var $t=class{id=null;pollId=null;optionId=null;optionIds=[];userId=null;createdAt=null};var gn=class extends $t{pollModel=null;optionModel=null;optionsModels=[];previousVotes=[];attempts=null};var yn=class extends $t{previousVotes=[];attempts=null};var bn=class{meta=new y;data=[]};var Mn=class{meta=new y;data=[]};var In=class extends I{matchIds=null;constructor(t){super(t),this.matchIds=t&&t.matchIds?t.matchIds:null}constructFiltersUrl(){let t=super.constructMainFiltersUrl();return this.matchIds&&this.matchIds.length>0&&(t+="&",t+=`match_ids=${this.matchIds.join(",")}`),t}};var wn=class{meta=new y;data=[]};var _n=class{matchId=null;matchModel=null;playerId=null;playerModel=null;createdAt=null};var Pn=class{total};var Tn=class{meta=new Pn;data=[]};var En=class{teamId=null;teamModel=null;playerId=null;playerModel=null;votes=null;winner=null};var Rn=class{meta=new k;data=[]};var ml=class{remapListContent=t=>{let e=new Rn;return e.meta=this.remapMeta(t.meta),e.data=t.data.map(i=>{let a=new mr;return a.entityId=i.entity_id,a.entityType=i.entity_type,a}),e};remapMeta=t=>{let e=new k;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.totalItems=t.pagination.total_items,e.pagination.numberOfPages=t.pagination.number_of_pages,e}};var Q=class extends v{featureConfigRemapper=null;listContentRemapper=null;localStorage=null;clientId=null;constructor(t){super(t,O(t.environment,"client")),this.clientId=t.clientId,this.localStorage=new ct().createLocalCacheInstance(t.idSchema),this.featureConfigRemapper=new cl,this.listContentRemapper=new ml}getConfig=async t=>{let e=await this.getCachedFeatures();if(!e){let i=`/clients/${this.clientId}/features`,a=this.apiSignInUrl.split("&")[0],r=i+a,o="There was a problem fetching client features from Client API";e=(await this.fetchWithoutAuth(r,o)).data,await this.localStorage.setClientFeatures(e)}switch(t){case"predictor":return this.featureConfigRemapper.remapPredictorConfig(e.predictor);case"topX":return this.featureConfigRemapper.remapTopXConfig(e.top_x);case"matchQuiz":return this.featureConfigRemapper.remapMatchQuizConfig(e.match_quiz);case"loyalty":return this.featureConfigRemapper.remapLoyaltyConfig(e.loyalty);case"discussions":return this.featureConfigRemapper.remapDiscussionsConfig(e.discussions);case"fantasy":return this.featureConfigRemapper.remapFantasyConfig(e.football_fantasy)}};getNewLoyaltyConfig=async t=>{let e=`/clients/${this.clientId}/features`,i=this.apiSignInUrl.split("&")[0],a="There was a problem fetching client features from Client API";if(t){let o=e+i+m(),n=await this.fetchWithoutAuthAdditionalHeaders(o,a,{"x-api-version":"2"});await this.localStorage.setClientFeatures(n.data)}let r=await this.getCachedFeatures();if(!r){let o=e+i;r=(await this.fetchWithoutAuthAdditionalHeaders(o,a,{"x-api-version":"2"})).data,await this.localStorage.setClientFeatures(r)}return this.featureConfigRemapper.remapLoyaltyNewConfig(r.loyalty)};getListContent=async(t,e,i)=>{let a=`/clients/${this.clientId}/lists/${t}/content${this.apiSignInUrl}`;e&&(a+=e.constructFiltersUrl()),f(i)&&(a+=m());let r="There was a problem fetching client list content",o=await this.fetchWithoutAuth(a,r);return this.listContentRemapper.remapListContent(o)};getCachedFeatures=async()=>{let t=await this.getLocalStorageData();if(!(!t||!Object.keys(t).length))return t.predictor.client_id&&t.predictor.client_id!==this.clientId?(await this.localStorage.deleteClientFeatures(),null):t};getLocalStorageData=async()=>{let t=Math.floor(Date.now()/1e3);return await this.localStorage.getExpiration("client","features")>t?await this.localStorage.getClientFeatures():null}};var Et=class{clientHttps=null;errorHandlingMode=null;constructor(t){this.clientHttps=new Q(t),this.errorHandlingMode=t.errorHandlingMode}setAvailableMarketsForMatch=async t=>{let{fullCoverageCompetitions:e,markets:i}=await this.clientHttps.getConfig("predictor");if(Array.isArray(t))return t.map(a=>this.setAvailableMarkets(a,e,i));if(typeof t=="object"&&Object.keys(t).length)return this.setAvailableMarkets(t,e,i)};setAvailableMarkets=(t,e,i)=>{let a=t.context.competition?.id;return a&&this.isMatchInCoverageCompetition(a,e)?(t.availableMarkets=i.all,t):(t.availableMarkets=i.main,t)};setMetaDataBatchRequest=(t,e,i)=>{let a=new k;if(a.pagination.totalItems=t,a.pagination.itemsPerPage=e,a.pagination.numberOfPages=t?Math.ceil(t/e):0,a.pagination.currentPage=i,a.pagination.numberOfPages>0&&i>a.pagination.numberOfPages)throw this.errorHandlingMode==="standard"?new h(400,"invalid_page_number","Invalid page number provided. Use number between 1 and max number of pages."):new b(400,"invalid_page_number","Invalid page number provided. Use number between 1 and max number of pages.");return a};finalizeMatchesDataBatchRequest=(t,e)=>{t=t.sort((a,r)=>new Date(a.kickoffAt).getTime()-new Date(r.kickoffAt).getTime());let i=e.limit||20;if(e.page){let a=e.page>1?i*(e.page-1):0;t=t.slice(a,a+i)}return!e.page&&t.length>i&&(t=t.slice(0,i)),t};isMatchInCoverageCompetition=(t,e)=>{let i=!1;return e.includes(t)&&(i=!0),i}};var hl=class{footballService=null;https=null;idMapping=null;constructor(t,e,i){this.idMapping=i,this.https=e,this.footballService=new Et(t)}getTeamsIdMapping=async(t,e)=>{try{let i=!1;if(t){if(t=new Pi(t),t.countryId){let r=await this.idMapping.getEntityIdsBySchemaId([`${t.countryId}`],"country","native");r.country.length===0&&(i=!0),t.countryId=r.country[0]}if(t.scope){let r=await this.idMapping.getEntityIdsBySchemaId(t.scope,"competition","native");r.competition.length===0&&(i=!0),t.scope=r.competition}if(t.teamIds){let r=await this.idMapping.getEntityIdsBySchemaId(t.teamIds,"team","native");r.team.length===0&&(i=!0),t.teamIds=r.team}}if(i)return[];let a=await this.getTeams(t,e);return a.data=await this.idMapping.remapEntities(a.data,"team"),a}catch(i){throw console.warn("There was a problem browsing all teams",i),i}};getTeamsMapWithNativeIds=async t=>{let e=new Map,i=t.length,a=new Pi({teamIds:t,limit:i}),{data:r}=await this.getTeams(a);r.sort((l,p)=>l.id.localeCompare(p.id));let o=Xp(t),n=await this.idMapping.remapEntities(r,"team");return o.forEach((l,p)=>e.set(l,n[p])),e};getTeams=async(t,e)=>{try{return e=e||!1,await this.https.getTeams(t,e)}catch(i){throw console.warn("There was a problem retrieving all teams",i),i}};getTeamByIdIdMapping=async(t,e)=>{try{t=(await this.idMapping.getEntityIdsBySchemaId([t],"team","native")).team[0];let a=await this.getTeamById(t,e);return await this.idMapping.remapEntities(a,"team")}catch(i){throw console.warn(`There was a problem browsing the following team:${t}`,i),i}};getTeamById=async(t,e)=>{try{return e=e||!1,await this.https.getTeamById(t,e)}catch(i){throw console.warn(`There was a problem retrieving the following team: ${t}`,i),i}};getTopTeamsIdMapping=async t=>{try{let e=await this.getTopTeams(t);return await this.idMapping.remapEntities(e,"team")}catch(e){throw console.warn("There was a problem browsing the top teams",e),e}};getTopTeams=async t=>{try{return t=t||!1,await this.https.getTopTeams(t)}catch(e){throw console.warn("There was a problem retrieving the top teams",e),e}};getNextMatchForTeamIdMapping=async(t,e)=>{try{t=(await this.idMapping.getEntityIdsBySchemaId([t],"team","native")).team[0];let a=await this.getNextMatchForTeam(t,e);return await this.idMapping.remapEntities(a,"match")}catch(i){throw console.warn(`There was a problem browsing the next match for the following team:${t}`,i),i}};getNextMatchForTeam=async(t,e)=>{try{e=e||!1;let i=await this.https.getNextMatchForTeam(t,e);return await this.footballService.setAvailableMarketsForMatch(i)}catch(i){throw console.warn(`There was a problem retrieving the next match for the following team: ${t}`,i),i}};getPrevMatchForTeamIdMapping=async(t,e)=>{try{t=(await this.idMapping.getEntityIdsBySchemaId([t],"team","native")).team[0];let a=await this.getPrevMatchForTeam(t,e);return await this.idMapping.remapEntities(a,"match")}catch(i){throw console.warn(`There was a problem browsing the previous match for the following team:${t}`,i),i}};getPrevMatchForTeam=async(t,e)=>{try{e=e||!1;let i=await this.https.getPrevMatchForTeam(t,e);return await this.footballService.setAvailableMarketsForMatch(i)}catch(i){throw console.warn(`There was a problem retrieving the previous match for the following team: ${t}`,i),i}}};var Zt=class{https=null;footballService=null;idMapping=null;constructor(t,e,i){this.idMapping=i,this.https=e,this.footballService=new Et(t)}getPlayersIdMapping=async(t,e)=>{try{let i=!1;if(t){if(t=new Ti(t),t.countryId){let r=await this.idMapping.getEntityIdsBySchemaId([t.countryId],"country","native");r.country.length===0&&(i=!0),t.countryId=r.country[0]}if(t.playerIds){let r=await this.idMapping.getEntityIdsBySchemaId(t.playerIds,"player","native");r.player.length===0&&(i=!0),t.playerIds=r.player}if(t.scope){let r=await this.idMapping.getEntityIdsBySchemaId(t.scope,"competition","native");r.competition.length===0&&(i=!0),t.scope=r.competition}if(i)return[]}let a=await this.getPlayers(t,e);return a.data=await this.idMapping.remapEntities(a.data,"player"),a}catch(i){throw console.warn("There was a problem browsing the players",i),i}};getPlayersWithNativeIds=async t=>{let e=t.length,i=new Ti({playerIds:t,limit:e}),a=await this.getPlayers(i);return a.data.sort((r,o)=>r.id.localeCompare(o.id)),await this.idMapping.remapEntities(a.data,"player")};getPlayersMapWithNativeIds=async t=>{let e={},i=ce(t);i.sort((r,o)=>r.localeCompare(o));let a=await this.getPlayersWithNativeIds(Array.from(i));return i.forEach((r,o)=>e[r]=a[o]),e};getPlayers=async(t,e)=>{try{return e=e||!1,await this.https.getPlayers(t,e)}catch(i){throw console.warn("There was a problem retrieving the players",i),i}};getPlayerIdMapping=async(t,e)=>{try{let i=await this.idMapping.getEntityIdsBySchemaId([t],"player","native"),a=await this.getPlayerById(i.player[0],e);return await this.idMapping.remapEntities(a,"player")}catch(i){throw console.warn(`There was a problem browsing the following player:${t}`,i),i}};getPlayerById=async(t,e)=>{try{return e=e||!1,await this.https.getPlayerById(t,e)}catch(i){throw console.warn(`There was a problem retrieving the following player: ${t}`,i),i}};getTopPlayersIdMapping=async t=>{try{let e=await this.getTopPlayers(t);return await this.idMapping.remapEntities(e,"player")}catch(e){throw console.warn("There was a problem browsing the top players",e),e}};getTopPlayers=async t=>{try{return t=t||!1,await this.https.getTopPlayers(t)}catch(e){throw console.warn("There was a problem retrieving the top players",e),e}};getNextMatchForPlayerIdMapping=async(t,e)=>{try{t=(await this.idMapping.getEntityIdsBySchemaId([t],"player","native")).player[0];let a=await this.getNextMatchForPlayer(t,e);return await this.idMapping.remapEntities(a,"match")}catch(i){throw console.warn(`There was a problem browsing the next match for player:${t}`,i),i}};getNextMatchForPlayer=async(t,e)=>{try{e=e||!1;let i=await this.https.getNextMatchForPlayer(t,e);return await this.footballService.setAvailableMarketsForMatch(i)}catch(i){throw console.warn(`There was a problem retrieving the next match for player: ${t}`,i),i}};getPrevMatchForPlayerIdMapping=async(t,e)=>{try{t=(await this.idMapping.getEntityIdsBySchemaId([t],"player","native")).player[0];let a=await this.getPrevMatchForPlayer(t,e);return await this.idMapping.remapEntities(a,"match")}catch(i){throw console.warn(`There was a problem browsing the previous match for player:${t}`,i),i}};getPrevMatchForPlayer=async(t,e)=>{try{e=e||!1;let i=await this.https.getPrevMatchForPlayer(t,e);return await this.footballService.setAvailableMarketsForMatch(i)}catch(i){throw console.warn(`There was a problem retrieving the previous match for player: ${t}`,i),i}}};var te=class{https=null;idMapping=null;footballService=null;constructor(t,e,i){this.https=e,this.idMapping=i,this.footballService=new Et(t)}getMatchesIdMapping=async(t,e)=>{try{if(t){if(t=new gt(t),t.countryIds&&t.countryIds.length>0){let a=await this.idMapping.getEntityIdsBySchemaId(t.countryIds,"country","native");t.countryIds=a.country}if(t.competitionIds&&t.competitionIds.length>0){let a=await this.idMapping.getEntityIdsBySchemaId(t.competitionIds,"competition","native");t.competitionIds=a.competition}if(t.matchIds&&t.matchIds.length>0){let a=await this.idMapping.getEntityIdsBySchemaId(t.matchIds,"match","native");t.matchIds=a.match}if(t.teamIds&&t.teamIds.length>0){let a=await this.idMapping.getEntityIdsBySchemaId(t.teamIds,"team","native");t.teamIds=a.team}}let i=await this.getMatches(t,e);return i.data=await this.footballService.setAvailableMarketsForMatch([...i.data]),i.data=await this.idMapping.remapEntities(i.data,"match"),i}catch(i){throw console.warn("There was a problem browsing the matches",i),i}};getMatchesWithNativeIds=async t=>{let e=t.length,i=new gt({matchIds:t,limit:e}),a=await this.getMatches(i);return a.data.sort((r,o)=>r.id.localeCompare(o.id)),await this.idMapping.remapEntities(a.data,"match")};getMatchesMapWithNativeIds=async t=>{let e={},i=ce(t);i.sort((r,o)=>r.localeCompare(o));let a=await this.getMatchesWithNativeIds(Array.from(i));if(i.length!==a.length){let r=new gt({matchIds:i,limit:i.length}),o=await this.getMatches(r),n=i.filter(l=>{if(o.data.every(p=>p.id!==l))return l});i=i.filter(l=>{if(!n.includes(l))return l})}return i.forEach((r,o)=>e[r]=a[o]),e};getMatches=async(t,e)=>{try{return e=e||!1,await this.https.getMatches(t,e)}catch(i){throw console.warn("There was a problem retrieving the matches",i),i}};getMatchIdMapping=async(t,e)=>{try{let i=await this.idMapping.getEntityIdsBySchemaId([t],"match","native"),a=await this.getMatchById(i.match[0],e),r=await this.footballService.setAvailableMarketsForMatch(a);return await this.idMapping.remapEntities(r,"match")}catch(i){throw console.warn(`There was a problem browsing the following match: ${t}`,i),i}};getMatchById=async(t,e)=>{try{return e=e||!1,await this.https.getMatchById(t,e)}catch(i){throw console.warn(`There was a problem retrieving the following match: ${t}`,i),i}}};var fl=class{https=null;idMapping=null;constructor(t,e){this.https=t,this.idMapping=e}searchIdMapping=async(t,e)=>{try{if(t=new mo(t),t.scope){let a=await this.idMapping.getEntityIdsBySchemaId(t.scope,"competition","native");t.scope=a.competition}let i=await this.search(t,e);if(i.teams&&i.teams.length>0){let a=await this.idMapping.remapEntities(i.teams,"team");i.teams=a}if(i.players&&i.players.length>0){let a=await this.idMapping.remapEntities(i.players,"player");i.players=a}if(i.competitions&&i.competitions.length>0){let a=await this.idMapping.remapEntities(i.competitions,"competition");i.competitions=a}return i}catch(i){throw console.warn("There was a problem with browsing the search result",i),i}};search=async(t,e)=>{try{return await this.https.search(t,e)}catch(i){throw console.warn("There was a problem retrieving the search response",i),i}}};var K=class{errorHandlingModel=null;constructor(t){this.errorHandlingModel=t}throwException=(t,e,i)=>{throw this.errorHandlingModel==="standard"?new h(t,e,i):new b(t,e,i)}};var gl=class extends K{limit=50;constructor(t){super(t.errorHandlingMode)}validateTeamFormArguments=(t,e)=>{(!t||typeof t!="string")&&this.throwException(400,"invalid_team_id","Invalid team ID provided. Please provide a valid team ID."),e&&(e.competitionId&&typeof e.competitionId!="string"&&this.throwException(400,"invalid_competition_id","Invalid competition ID provided. Please provide a valid competition ID."),e.limit&&typeof e.limit!="number"&&this.throwException(400,"invalid_limit","Invalid limit type. The proper type is number."),e.limit&&e.limit>this.limit&&this.throwException(400,"invalid_limit","Invalid limit. The maximum limit is: "+this.limit.toString()))}};var vi=class{countriesFacade=null;competitionsFacade=null;teamsFacade=null;playerFacade=null;matchFacade=null;searchFacade=null;validator=null;constructor(t,e,i,a){this.countriesFacade=new ll(e,i,a),this.competitionsFacade=new pl(e,i,a),this.teamsFacade=new hl(t,i,a),this.playerFacade=new Zt(t,i,a),this.matchFacade=new te(t,i,a),this.searchFacade=new fl(i,a),this.validator=new gl(t)}getCountries=async t=>this.countriesFacade.getCountriesWithIdMapping(t);getCompetitions=async(t,e)=>this.competitionsFacade.getCompetitionsIdMapping(t,e);getCompetitionById=async(t,e)=>this.competitionsFacade.getCompetitionByIdIdMapping(t,e);getTopCompetitions=async t=>this.competitionsFacade.getTopCompetitionsIdMapping(t);getCompetitionsMapWithNativeIds=async t=>await this.competitionsFacade.getCompetitionsMapWithNativeIds(t);getTeams=async(t,e)=>this.teamsFacade.getTeamsIdMapping(t,e);getTeamById=async(t,e)=>this.teamsFacade.getTeamByIdIdMapping(t,e);getTopTeams=async t=>this.teamsFacade.getTopTeamsIdMapping(t);getNextMatchForTeam=async(t,e)=>this.teamsFacade.getNextMatchForTeamIdMapping(t,e);getPrevMatchForTeam=async(t,e)=>this.teamsFacade.getPrevMatchForTeamIdMapping(t,e);getTeamsMapWithNativeIds=async t=>await this.teamsFacade.getTeamsMapWithNativeIds(t);getPlayers=async(t,e)=>this.playerFacade.getPlayersIdMapping(t,e);getPlayerById=async(t,e)=>this.playerFacade.getPlayerIdMapping(t,e);getTopPlayers=async t=>this.playerFacade.getTopPlayersIdMapping(t);getNextMatchForPlayer=async(t,e)=>this.playerFacade.getNextMatchForPlayerIdMapping(t,e);getPrevMatchForPlayer=async(t,e)=>this.playerFacade.getPrevMatchForPlayerIdMapping(t,e);getPlayersMapWithNativeIds=async t=>this.playerFacade.getPlayersMapWithNativeIds(t);getMatches=async(t,e)=>this.matchFacade.getMatchesIdMapping(t,e);getMatchesMapWithNativeIds=async t=>this.matchFacade.getMatchesMapWithNativeIds(t);getMatchById=async(t,e)=>this.matchFacade.getMatchIdMapping(t,e);search=async(t,e)=>this.searchFacade.searchIdMapping(t,e);getTeamForm=async(t,e,i)=>{this.validator.validateTeamFormArguments(t,e);let a=e?.direction||"ltr",r={teamIds:[t],competitionIds:e&&e.competitionId?[e.competitionId]:null,status:"finished",limit:e?.limit||5,sortField:"date",sortOrder:"desc"},o=await this.matchFacade.getMatchesIdMapping(r,i),n={teamId:t,matches:[]};if(n.matches=o.data.map(l=>{let p=l.homeTeam.id===t,c=l.scores.ftScore.homeGoals??0,u=l.scores.ftScore.awayGoals??0,d;return p?d=c>u?"W":c<u?"L":"D":d=u>c?"W":u<c?"L":"D",{matchModel:l,isHomeGame:p,result:d}}),a==="ltr"){let l=Array.from(n.matches);n.matches=l.reverse()}return n}};var $=class{countriesFromResponse=t=>{if(t)return t.map(e=>this.countryFromResponse(e))};countryFromResponse=t=>{try{if(t){let e=new Yr;return e.id=t.id,e.alias=t.alias,e.assets=t.assets,e.countryCode=t.country_code,e.name=t.name,e}}catch(e){throw e}return null}};var tt=class{countryRemapper=null;constructor(){this.countryRemapper=new $}fromResponse(t){try{let e=new Kr;return e.id=t.id,e.country=this.countryRemapper.countryFromResponse(t.country),e.gender=t.gender,e.assets=t.assets,e.type=t.type,e.name=t.name,e}catch(e){throw console.warn("There was a problem remapping the competition response",e),e}}};var j=class{countryRemapper=null;constructor(){this.countryRemapper=new $}fromResponse(t){try{let e=new lo;return e.id=t.id,e.country=this.countryRemapper.countryFromResponse(t.country),e.gender=t.gender,e.assets=t.assets,e.code=t.code,e.national=t.national,e.fullName=t.full_name,e.shortName=t.short_name,e.name=t.name,e.isDeleted=t.is_deleted,e.undecided=t.undecided,e}catch(e){throw console.warn("There was a problem remapping teams response",e),e}}};var yl=class{countryRemapper=null;teamBasicRemapper=null;constructor(){this.countryRemapper=new $,this.teamBasicRemapper=new j}fromResponse(t){try{let e=new jr;return e.id=t.id,e.country=this.countryRemapper.countryFromResponse(t.country),e.gender=t.gender,e.assets=t.assets,e.type=t.type,e.name=t.name,e.participants=t.participants.map(i=>this.teamBasicRemapper.fromResponse(i)),e}catch(e){throw console.warn("There was a problem remapping the competition response",e),e}}};var bl=class{countryRemapper=null;constructor(){this.countryRemapper=new $}fromResponse(t){try{let e=new oo;return e.id=t.id,e.startDate=t.start_date,e.endDate=t.end_date,e.shirtNumber=t.shirt_number,e.loan=t.loan,e.position=t.position,e.country=this.countryRemapper.countryFromResponse(t.country),e.name=t.name,e.assets=t.assets,e.birthDate=t.birth_date,e}catch(e){throw console.warn("There was a problem remapping the player from squad",e),e}}};var Ml=class{countryRemapper=null;competitionRemapper=null;playerRemapper=null;constructor(){this.countryRemapper=new $,this.competitionRemapper=new tt,this.playerRemapper=new bl}fromResponse(t){try{let e=new co;return e.id=t.id,e.country=this.countryRemapper.countryFromResponse(t.country),e.gender=t.gender,e.assets=t.assets,e.code=t.code,e.national=t.national,e.fullName=t.full_name,e.shortName=t.short_name,e.name=t.name,e.isDeleted=t.is_deleted,e.undecided=t.undecided,e.competitions=t.competitions?t.competitions.map(i=>this.competitionRemapper.fromResponse(i)):[],e.colors=t.colors?t.colors:e.colors,e.squad=t.squad?t.squad.map(i=>this.playerRemapper.fromResponse(i)):[],e}catch(e){throw console.warn("There was a problem remapping team response",e),e}}};var Ci=class{fromResponse(t){try{let e=new to;return e.ftScore=this.statEntityFromResponse(t.ft_score),e.htScore=this.statEntityFromResponse(t.ht_score),e.aetScore=this.statEntityFromResponse(t.aet_score),e.aggScore=this.statEntityFromResponse(t.agg_score),e.penScore=this.statEntityFromResponse(t.pen_score),e}catch(e){throw console.warn("There was a problem remapping the scores",e),e}}statEntityFromResponse=t=>({homeGoals:t.home_goals,awayGoals:t.away_goals})};var Il=class{teamRemapper=null;competitionRemapper=null;scoresRemapper=null;constructor(){this.teamRemapper=new j,this.competitionRemapper=new tt,this.scoresRemapper=new Ci}fromResponse(t){try{let e=new Xr;return e.id=t.id,e.kickoffAt=t.kickoff_at,e.finishedAt=t.finished_at,e.updatedAt=t.updated_at,e.isDeleted=t.is_deleted,e.undecided=t.undecided,e.homeTeam=this.teamRemapper.fromResponse(t.home_team),e.awayTeam=this.teamRemapper.fromResponse(t.away_team),e.lineupsConfirmed=t.lineups_confirmed,e.startedAt=t.started_at,e.minute=t.minute,e.scores=this.scoresRemapper.fromResponse(t.scores),e.context={competition:t.context.competition?this.competitionRemapper.fromResponse(t.context.competition):null},e.status={type:t.status.type,subType:t.status.sub_type},e}catch(e){throw console.warn("There was a problem remapping the match response",e),e}}};var wl=class{fromResponse(t){try{let e=new Zr;return e.corners=this.statEntityFromResponse(t.corners),e.cornersFirstHalf=this.statEntityFromResponse(t.corners_1h),e.cornersSecondHalf=this.statEntityFromResponse(t.corners_2h),e.cornersExtraTime=this.statEntityFromResponse(t.corners_et),e.crosses=this.statEntityFromResponse(t.crosses),e.crossesFirstHalf=this.statEntityFromResponse(t.crosses_1h),e.crossesSecondHalf=this.statEntityFromResponse(t.crosses_2h),e.crossesExtraTime=this.statEntityFromResponse(t.crosses_et),e.offside=this.statEntityFromResponse(t.offside),e.offsideFirstHalf=this.statEntityFromResponse(t.offside_1h),e.offsideSecondHalf=this.statEntityFromResponse(t.offside_2h),e.offsideExtraTime=this.statEntityFromResponse(t.offside_et),e.shotsOn=this.statEntityFromResponse(t.shots_on),e.shotsOnFirstHalf=this.statEntityFromResponse(t.shots_on_1h),e.shotsOnSecondHalf=this.statEntityFromResponse(t.shots_on_2h),e.shotsOnExtraTime=this.statEntityFromResponse(t.shots_on_et),e.throwIn=this.statEntityFromResponse(t.throw_in),e.throwInFirstHalf=this.statEntityFromResponse(t.throw_in_1h),e.throwInSecondHalf=this.statEntityFromResponse(t.throw_in_2h),e.throwInExtraTime=this.statEntityFromResponse(t.throw_in_et),e.redCards=this.statEntityFromResponse(t.red_cards),e.redCardsFirstHalf=this.statEntityFromResponse(t.red_cards_1h),e.redCardsSecondHalf=this.statEntityFromResponse(t.red_cards_2h),e.redCardsExtraTime=this.statEntityFromResponse(t.red_cards_et),e.shotsOff=this.statEntityFromResponse(t.shots_off),e.shotsOffFirstHalf=this.statEntityFromResponse(t.shots_off_1h),e.shotsOffSecondHalf=this.statEntityFromResponse(t.shots_off_2h),e.shotsOffExtraTime=this.statEntityFromResponse(t.shots_off_et),e.goalKicks=this.statEntityFromResponse(t.goal_kicks),e.goalKicksFirstHalf=this.statEntityFromResponse(t.goal_kicks_1h),e.goalKicksSecondHalf=this.statEntityFromResponse(t.goal_kicks_2h),e.goalKicksExtraTime=this.statEntityFromResponse(t.goal_kicks_et),e.possession=this.statEntityFromResponse(t.possession),e.possessionFirstHalf=this.statEntityFromResponse(t.possession_1h),e.possessionSecondHalf=this.statEntityFromResponse(t.possession_2h),e.possessionExtraTime=this.statEntityFromResponse(t.possession_et),e.treatments=this.statEntityFromResponse(t.treatments),e.treatmentsFirstHalf=this.statEntityFromResponse(t.treatments_1h),e.treatmentsSecondHalf=this.statEntityFromResponse(t.treatments_2h),e.treatmentsExtraTime=this.statEntityFromResponse(t.treatments_et),e.yellowCards=this.statEntityFromResponse(t.yellow_cards),e.yellowCardsFirstHalf=this.statEntityFromResponse(t.yellow_cards_1h),e.yellowCardsSecondHalf=this.statEntityFromResponse(t.yellow_cards_2h),e.yellowCardsExtraTime=this.statEntityFromResponse(t.yellow_cards_et),e.shotsBlocked=this.statEntityFromResponse(t.shots_blocked),e.shotsBlockedFirstHalf=this.statEntityFromResponse(t.shots_blocked_1h),e.shotsBlockedSecondHalf=this.statEntityFromResponse(t.shots_blocked_2h),e.shotsBlockedExtraTime=this.statEntityFromResponse(t.shots_blocked_et),e.substitutions=this.statEntityFromResponse(t.substitutions),e.substitutionsFirstHalf=this.statEntityFromResponse(t.substitutions_1h),e.substitutionsSecondHalf=this.statEntityFromResponse(t.substitutions_2h),e.substitutionsExtraTime=this.statEntityFromResponse(t.substitutions_et),e.counterAttacks=this.statEntityFromResponse(t.counter_attacks),e.counterAttacksFirstHalf=this.statEntityFromResponse(t.counter_attacks_1h),e.counterAttacksSecondHalf=this.statEntityFromResponse(t.counter_attacks_2h),e.counterAttacksExtraTime=this.statEntityFromResponse(t.counter_attacks_et),e.foulsCommitted=this.statEntityFromResponse(t.fouls_committed),e.foulsCommittedFirstHalf=this.statEntityFromResponse(t.fouls_committed_1h),e.foulsCommittedSecondHalf=this.statEntityFromResponse(t.fouls_committed_2h),e.foulsCommittedExtraTime=this.statEntityFromResponse(t.fouls_committed_et),e}catch(e){throw console.warn("There was a problem remapping the stats",e),e}}statEntityFromResponse=t=>({homeTeam:t?t.home_team:null,awayTeam:t?t.away_team:null})};var Ai=class{fromResponse(t){try{let e=new no;return e.id=t.id,e.name=t.name,e.position=t.position,e.shirtNumber=t.shirt_number,e.assets=t.assets,e.type=t.type,e}catch(e){throw console.warn("There was a problem remapping the player from timeline",e),e}}};var _l=class{playerRemapper=null;constructor(){this.playerRemapper=new Ai}fromResponse(t){try{let e=new Ve;return e.homeTeam.players=t.home_team&&t.home_team.players?t.home_team.players.map(i=>this.playerRemapper.fromResponse(i)):[],e.awayTeam.players=t.away_team&&t.away_team.players?t.away_team.players.map(i=>this.playerRemapper.fromResponse(i)):[],e}catch(e){throw console.warn("There was a problem remapping the lineups",e),e}}};var Pl=class{playerRemapper=null;constructor(){this.playerRemapper=new Ai}fromResponse(t){try{let e=new eo;return e.minute=t.minute,e.type=t.type,e.teamId=t.team_id,e.player=this.playerRemapper.fromResponse(t.player),e.relatedPlayer=t.related_player?this.playerRemapper.fromResponse(t.related_player):null,e.updatedAt=t.updated_at,e}catch(e){throw console.warn("There was a problem remapping timeline",e),e}}};var Tl=class{fromResponse(t){try{let e=new io;return e.playerId=t.player_id,e.position=t.position,e.minutesPlayed=t.minutes_played,e.yellowCards=t.yellow_cards,e.redCards=t.red_cards,e.goals=t.goals,e.penaltyGoals=t.penalty_goals,e.penaltyCommitted=t.penalty_committed,e.penaltyWon=t.penalty_won,e.penaltyMissed=t.penalty_missed,e.penaltySaved=t.penalty_saved,e.penaltyReceived=t.penalty_received,e.ownGoals=t.own_goals,e.assists=t.assists,e.cleanSheets=t.clean_sheets,e.shots=t.shots,e.shotsOn=t.shots_on,e.shotsBlocked=t.shots_blocked,e.offsides=t.offsides,e.foulsCommitted=t.fouls_committed,e.foulsWon=t.fouls_won,e.tackles=t.tackles,e.tacklesBlocks=t.tackles_blocks,e.tacklesInterceptions=t.tackles_interceptions,e.concededGoals=t.conceded_goals,e.caughtBall=t.caught_ball,e.saves=t.saves,e.passes=t.passes,e.crosses=t.crosses,e.interceptions=t.interceptions,e.keyPasses=t.key_passes,e.passesAccuracy=t.passes_accuracy,e.duels=t.duels,e.duelsWon=t.duels_won,e.dribblesAttempts=t.dribbles_attempts,e.dribblesSuccess=t.dribbles_success,e.dribblesPast=t.dribbles_past,e.updatedAt=t.updated_at,e}catch(e){throw console.warn("There was a problem remapping the player stats",e),e}}};var El=class{teamMapper=null;competitionsMapper=null;lineupsMapper=null;scoresMapper=null;statsMapper=null;timelineMapper=null;playerStatsMapper=null;constructor(){this.teamMapper=new j,this.competitionsMapper=new tt,this.lineupsMapper=new _l,this.scoresMapper=new Ci,this.statsMapper=new wl,this.timelineMapper=new Pl,this.playerStatsMapper=new Tl}fromResponse(t){try{let e=new Jr;return e.id=t.id,e.kickoffAt=t.kickoff_at,e.finishedAt=t.finished_at,e.updatedAt=t.updated_at,e.isDeleted=t.is_deleted,e.undecided=t.undecided,e.homeTeam=t.home_team?this.teamMapper.fromResponse(t.home_team):null,e.awayTeam=t.away_team?this.teamMapper.fromResponse(t.away_team):null,e.lineupsConfirmed=t.lineups_confirmed,e.startedAt=t.started_at,e.minute=t.minute,e.scores=this.scoresMapper.fromResponse(t.scores),e.stats=this.statsMapper.fromResponse(t.stats),e.playerStats=t.player_stats?t.player_stats.map(i=>this.playerStatsMapper.fromResponse(i)):t.player_stats,e.context={competition:this.competitionsMapper.fromResponse(t.context.competition)},e.timeline=t.timeline?t.timeline.map(i=>this.timelineMapper.fromResponse(i)):[],e.status={type:t.status.type,subType:t.status.sub_type},e.lineups=t.lineups?this.lineupsMapper.fromResponse(t.lineups):new Ve,e}catch(e){throw console.warn("There was a problem remapping the match response",e),e}}};var Rl=class{countryRemapper=null;constructor(){this.countryRemapper=new $}fromResponse(t){try{let e=new so;return e.id=t.id,e.firstName=t.first_name?t.first_name:null,e.lastName=t.last_name?t.last_name:null,e.name=t.name?t.name:null,e.birthDate=t.birth_date,e.country=this.countryRemapper.countryFromResponse(t.country),e.assets=t.assets,e.position=t.position,e}catch(e){throw console.warn("There was a problem remapping top player response",e),e}}};var Oi=class{countryRemapper=null;teamRemapper=null;constructor(){this.countryRemapper=new $,this.teamRemapper=new j}fromResponse(t){try{let e=new ao;return e.id=t.id,e.firstName=t.first_name?t.first_name:null,e.lastName=t.last_name?t.last_name:null,e.name=t.name?t.name:null,e.birthDate=t.birth_date,e.country=this.countryRemapper.countryFromResponse(t.country),e.assets=t.assets,e.teams=t.teams?t.teams.map(i=>this.teamRemapper.fromResponse(i)):[],e.position=t.position,e.isDeleted=t.is_deleted,e}catch(e){throw console.warn("There was a problem remapping players response",e),e}}};var Fl=class{countryRemapper=null;teamRemapper=null;competitionRemapper=null;constructor(){this.countryRemapper=new $,this.teamRemapper=new j,this.competitionRemapper=new tt}fromResponse(t){try{let e=new ro;return e.id=t.id,e.firstName=t.first_name?t.first_name:null,e.lastName=t.last_name?t.last_name:null,e.name=t.name?t.name:null,e.birthDate=t.birth_date,e.country=this.countryRemapper.countryFromResponse(t.country),e.assets=t.assets,e.teams=t.teams?t.teams.map(i=>this.teamRemapper.fromResponse(i)):[],e.position=t.position,e.isDeleted=t.is_deleted,e.competitions=t.competitions?t.competitions.map(i=>this.competitionRemapper.fromResponse(i)):[],e}catch(e){throw console.warn("There was a problem remapping player response",e),e}}};var Sl=class{teamRemapper=null;playerRemapper=null;competitionremapper=null;constructor(){this.teamRemapper=new j,this.playerRemapper=new Oi,this.competitionremapper=new tt}fromResponse(t){try{let e=new uo;return e.teams=t.teams?t.teams.map(i=>this.teamRemapper.fromResponse(i)):[],e.players=t.players?t.players.map(i=>this.playerRemapper.fromResponse(i)):[],e.competitions=t.competitions?t.competitions.map(i=>this.competitionremapper.fromResponse(i)):[],e}catch(e){throw console.warn("There was a problem remapping search response",e),e}}};var vl=class{remapMetaProp=t=>{let e=new k;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.totalItems=t.pagination.total_items,e.pagination.numberOfPages=t.pagination.number_of_pages,e}};var Cl=class{remapPlayersPoints=t=>{let e=new Qr;return e.meta.filters.templateId=t.meta.filters.template_id,e.data=t.data.map(i=>this.remapPlayersPointsData(i)),e};remapPlayersPointsData=t=>{let e=new Wr;return e.playerId=t.player_id,e.points=t.points,e.rank=t.rank,e};remapPlayerDetailedStats=t=>{let e=new Vr;return e.meta.filters.templateId=t.meta.filters.template_id,e.meta.filters.playerId=t.meta.filters.player_id,e.data=t.data.map(i=>this.remapPlayerDetailedData(i)),e};remapPlayerDetailedData=t=>{let e=new qr;return e.matchId=t.match_id,e.points=t.points?this.remapPlayerDetailedPoints(t.points):null,e.stats=t.stats?this.remapPlayerDetailedStatsData(t.stats):null,e};remapPlayerDetailedPoints=t=>{let e=new Ue;return e.total=t.total,e.minutesPlayed=t.minutes_played,e.yellowCards=t.yellow_cards,e.redCards=t.red_cards,e.goals=t.goals,e.penaltyGoals=t.penalty_goals,e.ownGoals=t.own_goals,e.assists=t.assists,e.cleanSheets=t.clean_sheets,e.shots=t.shots,e.shotsOn=t.shots_on,e.offsides=t.offsides,e.foulsCommitted=t.fouls_committed,e.penaltyCommitted=t.penalty_committed,e.penaltyWon=t.penalty_won,e.penaltyMissed=t.penalty_missed,e.tackles=t.tackles,e.concededGoals=t.conceded_goals,e.caughtBall=t.caught_ball,e.saves=t.saves,e};remapPlayerDetailedStatsData=t=>{let e=new Dt;return e.minutesPlayed=t.minutes_played,e.yellowCards=t.yellow_cards,e.redCards=t.red_cards,e.goals=t.goals,e.penaltyGoals=t.penalty_goals,e.penaltyCommitted=t.penalty_committed,e.penaltyWon=t.penalty_won,e.penaltyMissed=t.penalty_missed,e.penaltySaved=t.penalty_saved,e.penaltyReceived=t.penalty_received,e.ownGoals=t.own_goals,e.assists=t.assists,e.cleanSheets=t.clean_sheets,e.shots=t.shots,e.shotsOn=t.shots_on,e.shotsBlocked=t.shots_blocked,e.offsides=t.offsides,e.foulsCommitted=t.fouls_committed,e.foulsWon=t.fouls_won,e.tackles=t.tackles,e.tacklesBlocks=t.tackles_blocks,e.tacklesInterceptions=t.tackles_interceptions,e.concededGoals=t.conceded_goals,e.caughtBall=t.caught_ball,e.saves=t.saves,e.passes=t.passes,e.crosses=t.crosses,e.interceptions=t.interceptions,e.keyPasses=t.key_passes,e.passesAccuracy=t.passes_accuracy,e.duels=t.duels,e.duelsWon=t.duels_won,e.dribblesAttempts=t.dribbles_attempts,e.dribblesSuccess=t.dribbles_success,e.dribblesPast=t.dribbles_past,e}};var dt=class extends v{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(t){super(t,O(t.environment,"football")),this.apiSignInUrl=t.lang!=="en"?this.apiSignInUrl+`&lang=${t.lang}`:this.apiSignInUrl,this.countryRemapper=new $,this.competitionBasicRemapper=new tt,this.competitionFullRemapper=new yl,this.teamBasicRemapper=new j,this.teamFullRemapper=new Ml,this.matchBasicRemapper=new Il,this.matchFullRemapper=new El,this.playerBasicRemapper=new Oi,this.playerFullRemapper=new Fl,this.topPlayerRemapper=new Rl,this.searchRemapper=new Sl,this.footballMetaRemapper=new vl,this.footballService=new Et(t),this.fantasyRemapper=new Cl}getCountries=async t=>{let e="There was a problem with the football countries request",i=`/countries${this.apiSignInUrl}`,a=Date.now();t&&(i+=`&disable_cache=${a}`);let r=await this.fetchWithoutAuth(i,e);return this.countryRemapper.countriesFromResponse(r.data)};getCompetitions=async(t,e)=>{let i=Date.now(),a="There was a problem with football competitions request";if(e=e||!1,t&&t.competitionIds&&t.competitionIds.length>this.limitIds-1){let r=[],o=qt(t.competitionIds,this.limitIds);for(let l of o){t.competitionIds=l;let p=`/competitions${this.apiSignInUrl}${t.constructFilterUrl()}`;e&&(p+=`&disable_cache=${i}`);let c=await this.fetchWithoutAuth(p,a);r.push(c.data.map(u=>this.competitionBasicRemapper.fromResponse(u)))}return Array.prototype.concat.apply([],r)}else{let r=`/competitions${this.apiSignInUrl}`;return t&&(r+=`${t.constructFilterUrl()}`),e&&(r+=`&disable_cache=${i}`),(await this.fetchWithoutAuth(r,a)).data.map(n=>this.competitionBasicRemapper.fromResponse(n))}};getCompetitionById=async(t,e)=>{let i=`/competitions/${t}${this.apiSignInUrl}`,a="There was a problem with football competition by ID request",r=Date.now();e&&(i+=`&disable_cache=${r}`);let o=await this.fetchWithoutAuth(i,a);return this.competitionFullRemapper.fromResponse(o.data)};getTopCompetitions=async t=>{let e="There was a problem with top football competitions request",i=`/competitions/top${this.apiSignInUrl}`,a=Date.now();return t&&(i+=`&disable_cache=${a}`),(await this.fetchWithoutAuth(i,e)).data.map(o=>this.competitionBasicRemapper.fromResponse(o))};getTeams=async(t,e)=>{let i=Date.now(),a="There was a problem with football teams request";if(t&&t.teamIds&&t.teamIds.length>this.limitIds){let r=[],o=qt(t.teamIds,this.limitIds);for(let l of o){t.teamIds=l,t.limit=l.length;let p=`/teams${this.apiSignInUrl}${t.constructFilterUrl()}`;e&&(p+=`&disable_cache=${i}`);let c=await this.fetchWithoutAuth(p,a);r.push(c.data.map(u=>this.teamBasicRemapper.fromResponse(u)))}return Array.prototype.concat.apply([],r)}else{let r=new Xt,o=`/teams${this.apiSignInUrl}`;t&&(o+=`${t.constructFilterUrl()}`),e&&(o+=`&disable_cache=${i}`);let n=await this.fetchWithoutAuth(o,a);return r.meta=this.footballMetaRemapper.remapMetaProp(n.meta),r.data=n.data.map(l=>this.teamBasicRemapper.fromResponse(l)),r}};getTeamById=async(t,e)=>{let i="There was a problem with football team by ID request",a=`/teams/${t}${this.apiSignInUrl}`,r=Date.now();e&&(a+=`&disable_cache=${r}`);let o=await this.fetchWithoutAuth(a,i);return this.teamFullRemapper.fromResponse(o.data)};getTopTeams=async t=>{let e=`/teams/top${this.apiSignInUrl}`,i="There was a problem with top football teams request",a=Date.now();t&&(e+=`$disable_cache=${a}`);let r=await this.fetchWithoutAuth(e,i);return r.data?r.data.map(o=>this.teamBasicRemapper.fromResponse(o)):[]};getNextMatchForTeam=async(t,e)=>{let i=`/teams/${t}/next-match${this.apiSignInUrl}`,a=Date.now(),r="There was a problem with next match for team request";e&&(i+=`&disable_cache=${a}`);let o=await this.fetchWithoutAuth(i,r);return this.matchFullRemapper.fromResponse(o.data)};getPrevMatchForTeam=async(t,e)=>{let i=`/teams/${t}/previous-match${this.apiSignInUrl}`,a=Date.now(),r="There was a problem with previous match for team request";e&&(i+=`&disable_cache=${a}`);let o=await this.fetchWithoutAuth(i,r);return this.matchFullRemapper.fromResponse(o.data)};getPlayers=async(t,e)=>{let i=Date.now(),a="There was a problem with football players request";if(t&&t.playerIds&&t.playerIds.length>this.limitIds-1){let r=[],o=qt(t.playerIds,this.limitIds);for(let p of o){t.playerIds=p,t.limit=p.length;let c=`/players${this.apiSignInUrl}${t.constructFilterUrl()}`;e&&(c+=`&disable_cache=${i}`);let u=await this.fetchWithoutAuth(c,a);r.push(u.data.map(d=>this.playerBasicRemapper.fromResponse(d)))}let n=Array.prototype.concat.apply([],r),l=new Xt;return l.data=n,l}else{let r=new Xt,o=`/players${this.apiSignInUrl}`;t&&(o+=`${t.constructFilterUrl()}`),e&&(o+=`&disable_cache=${i}`);let n=await this.fetchWithoutAuth(o,a);return r.meta=this.footballMetaRemapper.remapMetaProp(n.meta),r.data=n.data.map(l=>this.playerBasicRemapper.fromResponse(l)),r}};getPlayerById=async(t,e)=>{let i=`/players/${t}${this.apiSignInUrl}`,a=Date.now(),r="There was a problem with football player by ID request";e&&(i+=`&disable_cache=${a}`);let o=await this.fetchWithoutAuth(i,r);return this.playerFullRemapper.fromResponse(o.data)};getTopPlayers=async t=>{let e=`/players/top${this.apiSignInUrl}`,i=Date.now(),a="There was a problem with top football players request";return t&&(e+=`&disable_cache=${i}`),(await this.fetchWithoutAuth(e,a)).data.map(o=>this.topPlayerRemapper.fromResponse(o))};getNextMatchForPlayer=async(t,e)=>{let i=`/players/${t}/next-match${this.apiSignInUrl}`,a=Date.now(),r="There was a problem with next match for player request";e&&(i+=`&disable_cache=${a}`);let o=await this.fetchWithoutAuth(i,r);return this.matchFullRemapper.fromResponse(o.data)};getPrevMatchForPlayer=async(t,e)=>{let i=`/players/${t}/previous-match${this.apiSignInUrl}`,a=Date.now(),r="There was a problem with previous match for player request";e&&(i+=`&disable_cache=${a}`);let o=await this.fetchWithoutAuth(i,r);return this.matchFullRemapper.fromResponse(o.data)};getMatchById=async(t,e)=>{let i=`/matches/${t}${this.apiSignInUrl}`,a=Date.now(),r="There was a problem with match by ID request";e&&(i+=`&disable_cache=${a}`);let o=await this.fetchWithoutAuth(i,r);return this.matchFullRemapper.fromResponse(o.data)};getMatches=async(t,e)=>{let i=new Xt,a="There was a problem with football matches request";if(t&&t.matchIds&&t.matchIds.length>this.limitIds){let r=[],o=qt(t.matchIds,this.limitIds);for(let l of o){let p=new gt({...t,matchIds:l,limit:l.length}),c=!0,u=`/matches${this.apiSignInUrl}${p.constructFilterUrl(c)}&limit=${l.length}`;e&&(u+=m());let d=await this.fetchWithoutAuth(u,a);r.push(d.data.map(M=>this.matchBasicRemapper.fromResponse(M)))}let n=Array.prototype.concat.apply([],r);return i.meta=this.footballService.setMetaDataBatchRequest(n.length,t.limit||20,t.page||1),i.data=this.footballService.finalizeMatchesDataBatchRequest(n,t),i}else{let r=`/matches${this.apiSignInUrl}`;t&&(r+=`${t.constructFilterUrl()}`),e&&(r+=m());let o=await this.fetchWithoutAuth(r,a);return i.meta=this.footballMetaRemapper.remapMetaProp(o.meta),i.data=o.data.map(n=>this.matchBasicRemapper.fromResponse(n)),i}};search=async(t,e)=>{let i=`/search${this.apiSignInUrl}${t.constructFilterUrl()}`,a=Date.now(),r="There was a problem with football search request";e&&(i+=`&disable_cache=${a}`);let o=await this.fetchWithoutAuth(i,r);return this.searchRemapper.fromResponse(o.data)};getPlayersPoints=async(t,e,i)=>{let a=`/players/points/${t}${this.apiSignInUrl}`,r=Date.now(),o="There was a problem with players points request";e&&(a+=`&position=${e.toLocaleLowerCase()}`),i&&(a+=`&disable_cache=${r}`);let n=await this.fetchWithoutAuth(a,o);return this.fantasyRemapper.remapPlayersPoints(n)};getPlayerDetailedStatistics=async(t,e,i)=>{let a=`/players/${e}/points/${t}${this.apiSignInUrl}`,r=Date.now(),o="There was a problem with detailed player points request";i&&(a+=`&disable_cache=${r}`);let n=await this.fetchWithoutAuth(a,o);return this.fantasyRemapper.remapPlayerDetailedStats(n)}};var Al=class{idMapping=null;idSchema=null;native="native";footballFacade=null;constructor(t,e,i){this.idMapping=i,this.idSchema=t.idSchema,this.footballFacade=e}remapProfileStats=async t=>{if(!t.predictions)return t;let{successRates:e,predictions:i}=t,a={competition:this.getIdsKeys(e.byFootballCompetition,i.single.breakdown.footballCompetitions),team:this.getIdsKeys(e.byFootballTeam,i.single.breakdown.footballTeams)};if(Object.values(a.competition).length){let r=JSON.parse(JSON.stringify(t.successRates.byFootballCompetition)),o=await this.getEntitiesMap(a.competition,"competition"),n=await this.setSuccessRatesModels(r,o);t.successRates.byFootballCompetition=n,i.single.breakdown.footballCompetitions=this.reconstructBreakdown(i.single.breakdown.footballCompetitions,o)}if(Object.values(a.team).length){let r=JSON.parse(JSON.stringify(t.successRates.byFootballTeam)),o=await this.getEntitiesMap(a.team,"team"),n=await this.setSuccessRatesModels(r,o);t.successRates.byFootballTeam=n,i.single.breakdown.footballTeams=this.reconstructBreakdown(i.single.breakdown.footballTeams,o)}return t};setSuccessRatesModels=async(t,e)=>{let i;return this.reconstructRecords(t,i,e)};getEntitiesMap=async(t,e)=>{switch(e){case"competition":return await this.footballFacade.getCompetitionsMapWithNativeIds(t);case"team":return await this.footballFacade.getTeamsMapWithNativeIds(t)}};reconstructRecords=(t,e,i)=>t&&Object.keys(t).length?(Object.keys(t).forEach(a=>{let r=i.get(a);e={...e,[r.id]:t[a]},e[r.id].model=r}),e):t;reconstructBreakdown=(t,e)=>t.length?t.map(i=>{let a=e.get(i.entityId);return i.entityId=a.id,i.model=a,i}):t;getIdsKeys=(t,e)=>{let i=Object.keys(t);if(e.length){let a=e.map(r=>r.entityId);return Array.from(new Set([...i,...a]))}return i};remapInterestsToIdSchema=async t=>{if(this.idSchema!==this.native)if(t&&t.length>0){let e={},i={},a=t.filter(l=>l.source.toLocaleUpperCase()==="FOOTBALL"),r=t.filter(l=>l.source.toLocaleUpperCase()!=="FOOTBALL");a.forEach(l=>{e.hasOwnProperty(l.type)||(e[l.type]=[],i[l.type]=[]),e[l.type].push(l.id),i[l.type].push(l)});let o=await this.remapIdsObj(e,this.native,this.idSchema),n=[];for(let[l,p]of Object.entries(i))p.forEach((c,u)=>{c.id=o[l][u],n.push(c)});return n.concat(r)}else return t;return t};remapInterestToNative=async t=>{if(this.idSchema!==this.native&&t.source.toLocaleUpperCase()==="FOOTBALL"){let e={},{id:i,type:a}=t;e[a]=[i];let r=await this.remapIdsObj(e,this.idSchema,this.native);return t.id=r[a][0],t}return t};inquiryCustomInterests=(t,e)=>{let i=[];return t&&t.length>0&&(i=t.filter(a=>a.source.toLocaleUpperCase()==="CUSTOM"),e)?i.map(a=>{let r=new on;return r.id=a.id,r.type=a.type,r.source=a.source,r.favourite=a.favourite,r}):i};remapInterests=async t=>{let i=this.inquiryCustomInterests(t,!1);if(i&&i.length>0){let a=t.filter(o=>o.source.toLocaleUpperCase()!=="CUSTOM"),r=await this.remapInterestsToIdSchema(a);return i.forEach(o=>r.push(o)),r}return await this.remapInterestsToIdSchema(t)};showFullInterests=async t=>{let e=[];if(t&&t.length>0){let a=this.inquiryCustomInterests(t,!0);e.push(a);let r=t.filter(c=>c.source.toLocaleUpperCase()!=="CUSTOM"),{competitionsMap:o,teamsMap:n,playersMap:l}=await this.getInterestsEntitiesMap(r),p=r.map(c=>{let u=null;if(c.source.toLocaleUpperCase()==="FOOTBALL"){if(c.type==="competition")return u=o.get(c.id),u&&(c.id=u.id),c.model=u,c;if(c.type==="team")return u=n.get(c.id),u&&(c.id=u.id),c.model=u,c;if(c.type==="player")return l?(c.model=l[c.id],c.id=l[c.id].id):c.model=u,c}else return c.model=u,c});return e.push(p),e.flat()}return e};getInterestsEntitiesMap=async t=>{let e=[],i=[],a=[],r=new Map,o=new Map,n=null;return t.forEach(l=>{l.type==="competition"&&l.source.toLocaleUpperCase()==="FOOTBALL"?e.push(l.id):l.type==="team"&&l.source.toLocaleUpperCase()==="FOOTBALL"?i.push(l.id):l.type==="player"&&l.source.toLocaleUpperCase()==="FOOTBALL"&&a.push(l.id)}),e.length&&(r=await this.footballFacade.getCompetitionsMapWithNativeIds(e)),i.length&&(o=await this.footballFacade.getTeamsMapWithNativeIds(i)),a.length&&(n=await this.footballFacade.getPlayersMapWithNativeIds(a)),{competitionsMap:r,teamsMap:o,playersMap:n}};remapIdsObj=async(t,e,i)=>await this.idMapping.idMappingFacade.getEntitiesByIds(t,e,i)};var Ol=class{idMapping=null;profileOperations=null;constructor(t,e){this.idMapping=new R(t),this.profileOperations=new Al(t,e,this.idMapping)}remapProfileStats=async t=>await this.profileOperations.remapProfileStats(t);remapInterestToNative=async t=>await this.profileOperations.remapInterestToNative(t);remapInterests=async t=>await this.profileOperations.remapInterests(t);showFullInterests=async t=>await this.profileOperations.showFullInterests(t)};var D=class{idsRemapper=null;profileHttps=null;activityHttps=null;footballHttps=null;footballFacade=null;idMapping=null;localCache=null;profileFacade=null;ownProfileBuilder=null;profileBuilder=null;constructor(t){this.profileHttps=new Mi(t),this.activityHttps=new hi(t),this.footballHttps=new dt(t),this.idMapping=new R(t),this.localCache=new ct().createLocalCacheInstance(t.idSchema),this.footballFacade=new vi(t,this.localCache,this.footballHttps,this.idMapping),this.profileFacade=new _t(this.localCache,this.profileHttps,this.activityHttps,t.errorHandlingMode),this.idsRemapper=new Ol(t,this.footballFacade),this.ownProfileBuilder=new nl(t,this.idsRemapper,this.localCache,this.profileHttps,this.activityHttps),this.profileBuilder=new wi(this.idsRemapper,this.localCache,this.profileHttps,this.activityHttps)}getOwn=()=>this.ownProfileBuilder;getById=t=>this.profileBuilder.getById(t);getCountries=async t=>await this.profileFacade.getCountries(t);getByIds=async(t,e,i)=>await this.profileFacade.getByIds(t,e,i);collectLead=async t=>await this.profileFacade.collectLead(t);checkFollowStatus=async t=>await this.profileFacade.checkFollowStatus(t);getOwnStats=async()=>await this.ownProfileBuilder.getStats();getStats=async(t,e)=>await this.profileBuilder.getById(t).getStats(e);getOwnBadges=async()=>await this.ownProfileBuilder.getBadges();getBadges=async t=>await this.profileBuilder.getById(t).getBadges();collectConsents=async t=>await this.profileFacade.collectConsents(t)};var xl=class extends I{};var Xu=(r=>(r.LIKE="like",r.DISLIKE="dislike",r.SHARE="share",r.COMMENT="comment",r.PREDICTION_MADE="prediction_made",r))(Xu||{});var Ju=(a=>(a.CORRECT="CORRECT",a.INCORRECT="INCORRECT",a.PARTIALLY_CORRECT="PARTIALLY_CORRECT",a.NOT_VERIFIED="NOT_VERIFIED",a))(Ju||{});var Ll=(i=>(i.ONE="1",i.X="x",i.TWO="2",i))(Ll||{}),Dl=(i=>(i.ONE_X="1x",i.X_TWO="x2",i.ONE_TWO="12",i))(Dl||{}),Bl=(p=>(p.ONE_ONE="1/1",p.ONE_X="1/x",p.ONE_TWO="1/2",p.X_ONE="x/1",p.X_X="x/x",p.X_TWO="x/2",p.TWO_ONE="2/1",p.TWO_X="2/x",p.TWO_TWO="2/2",p))(Bl||{});var hu=(F=>(F.NONE="none",F.FINISHED="finished",F.CANCELLED="cancelled",F.POSTPONED="postponed",F.NOT_STARTED="not_started",F.FIRST_HALF="1st_half",F.SECOND_HALF="2nd_half",F.FINISHED_AFTER_AWARDED_WIN="finished_after_awarded_win",F.TO_FINISH="to_finish",F.FINISHED_AET="finished_aet",F.HALFTIME="halftime",F.FINISHED_AP="finished_ap",F.INTERRUPTED="interrupted",F.KICK_OFF_DELAYED="kick_off_delayed",F.ABANDONED="abandoned",F.WAITING_FOR_PENALTY="waiting_for_penalty",F.PENALTY="penalty",F.PAUSE="pause",F.EXTRA_TIME_1ST_HALF="extra_time_1st_half",F.EXTRA_TIME_END_OF_1ST_HALF="extra_time_end_of_1st_half",F.EXTRA_TIME_2ND_HALF="extra_time_2nd_half",F.WAITING_FOR_EXTRA_TIME="waiting_for_extra_time",F.NO_INFO_YET="no_info_yet",F.AWAITING_INFO="awaiting_info",F.FINISHED_ASG="finished_asg",F))(hu||{});var Nl=class extends K{constructor(t){super(t)}validatePrediction=t=>{(!t.fixtures||!Array.isArray(t.fixtures)||t.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 e=Object.keys(new gr);for(let i of t.fixtures)(Object.keys(i).length!==e.length||Object.keys(i).some(a=>!e.includes(a)))&&this.throwException(400,"invalid_method_call","Fixtures field is invalid. For more information please visit our documentation");t.tiebreaker&&(!t.tiebreaker.statTotal||!Number.isInteger(t.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")}};var kl=class{https=null;validator=null;profile=null;constructor(t){this.https=new jt(t),this.profile=new D(t),this.validator=new Nl(t.errorHandlingMode)}getGames=async(t,e)=>(t&&(t=new yr(t)),await this.https.getBracketGames(t,e));getGameById=async(t,e)=>await this.https.getBracketGameById(t,e);makePrediction=async(t,e)=>(this.validator.validatePrediction(e),await this.https.makeBracketGamePrediction(t,e));updatePrediction=async(t,e,i)=>(this.validator.validatePrediction(i),await this.https.updateBracketGamePrediction(t,e,i));getGamePredictionsForUser=async(t,e,i,a)=>{i&&(i=new fr(i));let r=await this.https.getBracketGamePredictionsForUser(t,e,i,a),o=null;try{o=await this.profile.getById(e).getInfo()}catch(n){console.error(n)}return r.data.forEach(n=>{n.profileModel=o}),r};getGamePredictionById=async(t,e,i)=>await this.https.getBracketGamePredictionById(t,e,i);getRankings=async(t,e,i)=>{e&&(e=new xl(e));let a=await this.https.getBracketGameRankings(t,e,i),r=a.data.map(n=>n.profileId),o=[];return r.length>0&&(o=await this.profile.getByIds(r),a.data=a.data.map(n=>(n.profileModel=o.find(l=>l.id===n.profileId)||null,n))),a}};var Gl=class{facade=null;constructor(t){this.facade=new kl(t)}getGames=async(t,e)=>await this.facade.getGames(t,e);getGameById=async(t,e)=>await this.facade.getGameById(t,e);makePrediction=async(t,e)=>await this.facade.makePrediction(t,e);updatePrediction=async(t,e,i)=>await this.facade.updatePrediction(t,e,i);getGamePredictionsForUser=async(t,e,i,a)=>await this.facade.getGamePredictionsForUser(t,e,i,a);getGamePredictionById=async(t,e,i)=>await this.facade.getGamePredictionById(t,e,i);getRankings=async(t,e,i)=>await this.facade.getRankings(t,e,i)};var Ul=class{remapResponse=t=>(t.meta=this.remapMeta(t.meta),t.data=this.remapData(t.data),t);remapLeagueLeaderboardResponse=t=>(t.meta=this.remapLeagueLeaderboardMeta(t.meta),t.data=this.remapData(t.data),t);remapTemplateBreakdown=t=>(t.meta=this.remapMeta(t.meta),t.data=t.data.map(e=>this.remapTemplatePoints(e)),t);remapMeta=t=>{let e=new Bt;return e.rankType=t.rank_type,e.fromDate=t.from_date,e.toDate=t.to_date,e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.totalItems=t.pagination.total_items,e.pagination.numberOfPages=t.pagination.number_of_pages,e};remapLeagueLeaderboardMeta=t=>{let e=new He;return e.templateId=t.template_id,e.privateLeagueId=t.private_league_id,e.fromDate=t.from_date,e.toDate=t.to_date,e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.totalItems=t.pagination.total_items,e.pagination.numberOfPages=t.pagination.number_of_pages,e};remapData=t=>{let e=[];return t.forEach(i=>{let a=new $e;a.position=i.position,a.profileId=i.profile_id,a.points=i.points,a.predictionsMade=i.predictions_made,e.push(a)}),e};remapTemplatePoints=t=>{let e=new Oo;return e.groupId=t.group_id,e.averagePoints=t.average_points,e.highestPoints=t.highest_points,e}};var Vl=class{remapRankings=t=>(t.meta=this.remapMeta(t.meta),t.data=this.remapData(t.data),t);remapRankingsPrivateLeague=t=>(t.meta=this.remapMeta(t.meta),t.data=this.remapDataUserRankingPrivateLeague(t.data),t);remapRankingsChallenge=t=>(t.meta=this.remapMeta(t.meta),t.data=this.remapDataUserRankingChallenge(t.data),t);remapMeta=t=>{let e=new k;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.numberOfPages=t.pagination.number_of_pages,e.pagination.totalItems=t.pagination.total_items,e};remapData(t){let e=[];return t.forEach(i=>{let a=new Ao;a.id=i.id,a.rankType=i.rank_type,a.position=i.position,a.points=i.points,a.gameType=i.game_type,delete a.profileId,delete a.profileModel,delete a.predictionsMade,e.push(a)}),e}remapDataUserRankingPrivateLeague(t){let e=[];return t.forEach(i=>{let a=new tn;a.templateId=i.template_id,a.privateLeagueId=i.private_league_id,a.position=i.position,a.points=i.points,e.push(a)}),e}remapDataUserRankingChallenge(t){let e=[];return t.forEach(i=>{let a=new Pr;a.templateId=i.template_id,a.challengeId=i.private_league_id,a.position=i.position,a.points=i.points,e.push(a)}),e}};var Hl=class{entityId=null;entityType=null};var et=class{remapBranding=t=>{let e=new ho;return t.colors&&(e.colors=new fo,e.colors.primaryColor=t.colors.primary_color,e.colors.secondaryColor=t.colors.secondary_color,e.colors.contentColor=t.colors.content_color,e.colors.backgroundColor=t.colors.background_color,e.colors.borderColor=t.colors.border_color,e.colors.additionalColor=t.colors.additional_color),t.urls&&(e.urls=new go,e.urls.primaryUrl=t.urls.primary_url,e.urls.secondaryUrl=t.urls.secondary_url,e.urls.privacyPolicyUrl=t.urls.privacy_policy_url,e.urls.termsAndConditionsUrl=t.urls.terms_and_conditions_url,e.urls.additionalUrl=t.urls.additional_url),t.images&&(e.images=new yo,e.images.mainLogo=t.images.main_logo,e.images.mobileLogo=t.images.mobile_logo,e.images.backgroundImage=t.images.background_image,e.images.mobileBackgroundImage=t.images.mobile_background_image,e.images.additionalImage=t.images.additional_image),e}};var $l=class extends et{remapResponse=t=>{let e=[];return t.forEach(i=>{let a=new Nt;a.id=i.id,a.name=i.name,a.description=i.description,a.type=i.type,a.fromDate=i.from_date,a.toDate=i.to_date,a.markets=i.markets?i.markets:null,a.teamIds=i.team_ids?i.team_ids:null,a.matchIds=i.match_ids?i.match_ids:null,a.groups=i.groups?this.remapGroups(i.groups):null,a.gameIds=i.game_ids?i.game_ids:null,a.gameTypes=i.game_types?i.game_types:null,a.competitionIds=i.competition_ids?i.competition_ids:null,a.excludedProfileIds=i.excluded_profile_ids?i.excluded_profile_ids:null,a.rules=i.rules?i.rules:null,a.labels=i.labels?i.labels:null,a.customFields=i.custom_fields?i.custom_fields:null,a.branding=i.branding?this.remapBranding(i.branding):null,a.flags=i.flags?i.flags:null,a.images=i.images?i.images:null,a.status=i.status?i.status:null,a.automaticallyChangeStatus=i.automatically_change_status,a.createdAt=i.created_at,a.updatedAt=i.updated_at,a.related=i.related?this.remapRelated(i.related):null,e.push(a)}),e};remapResponseId=t=>{let e=new xo;return e.id=t.id,e.name=t.name,e.description=t.description,e.type=t.type,e.fromDate=t.from_date,e.toDate=t.to_date,e.markets=t.markets?t.markets:null,e.teamIds=t.team_ids?t.team_ids:null,e.matchIds=t.match_ids?t.match_ids:null,e.groups=t.groups?this.remapGroups(t.groups):null,e.gameIds=t.game_ids?t.game_ids:null,e.gameTypes=t.game_types?t.game_types:null,e.competitionIds=t.competition_ids?t.competition_ids:null,e.excludedProfileIds=t.excluded_profile_ids?t.excluded_profile_ids:null,e.rules=t.rules?t.rules:null,e.flags=t.flags?t.flags:null,e.images=t.images?t.images:null,e.status=t.status?t.status:null,e.automaticallyChangeStatus=t.automatically_change_status,e.related=t.related?this.remapRelated(t.related):null,e.labels=t.labels,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.adContent=t.ad_content,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapMeta=t=>{let e=new Co;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.totalItems=t.pagination.total_items,e.pagination.numberOfPages=t.pagination.number_of_pages,e.filters.flags=t.filters.flags,e.filters.status=t.filters.status,e.filters.type=t.filters.type,e.filters.activeFrom=t.filters.active_from,e.filters.activeTo=t.filters.active_to,e.filters.createdFrom=t.filters.created_from,e.filters.createdTo=t.filters.created_to,e.filters.updatedFrom=t.filters.updated_from,e.filters.updatedTo=t.filters.updated_to,e};remapRelated=t=>t.map(e=>{let i=new Hl;return i.entityId=e.entity_id,i.entityType=e.entity_type,i});remapGroups=t=>t.map(e=>{let i=new Lo;return i.groupId=e.group_id,i.label=e.label,i.flags=e.flags,i.filters=this.remapGroupFilters(e.filters),i});remapGroupFilters=t=>{let e=new Do;return e.fromDate=t.from_date,e.toDate=t.to_date,e.matchIds=t.match_ids,e}};var zl=class{remapHighestSuccessRate=t=>t.map(e=>{let i=new So;return i.position=e.position,i.points=e.points,i.predictionsMade=e.predictions_made,i.profileId=e.profile_id,i.successRatePercent=e.success_rate_percent,i})};var Rt=class extends v{templateRemapper=null;leaderboardRemapper=null;rankingsRemapper=null;highestSuccessRateRemapper=null;constructor(t){super(t,O(t.environment,"loyalty")),this.templateRemapper=new $l,this.leaderboardRemapper=new Ul,this.rankingsRemapper=new Vl,this.highestSuccessRateRemapper=new zl}getTemplates=async(t,e)=>{let i=t?`/leaderboard/templates/${this.apiSignInUrl}${t.constructFiltersUrl()}`:`/leaderboard/templates/${this.apiSignInUrl}`;i+=f(e)?m():"";let a="There was a problem fetching the list of templates",r=await this.fetchWithoutAuth(i,a),o=JSON.parse(JSON.stringify(r));return o.meta=this.templateRemapper.remapMeta(r.meta),o.data=this.templateRemapper.remapResponse(r.data),o};getTemplateById=async(t,e)=>{let i=f(e)?`/leaderboard/templates/${t}${this.apiSignInUrl}${m()}`:`/leaderboard/templates/${t}${this.apiSignInUrl}`,a=`There was a problem requesting the following template: ${t}`,r=await this.fetchWithoutAuth(i,a);return this.templateRemapper.remapResponseId(r.data)};getLeaderboard=async(t,e,i)=>{let a=f(e)?`/leaderboard/${t}${this.apiSignInUrl}${m()}`:`/leaderboard/${t}${this.apiSignInUrl}`,r=`There was a problem fetching the leaderboard for the following template: ${t}`;i&&(a+=`${i.constructFiltersUrl()}`);let o=await this.fetchWithoutAuth(a,r),n=JSON.parse(JSON.stringify(o));return this.leaderboardRemapper.remapResponse(n)};getLeaderboardForGame=async(t,e,i)=>{let a=f(e)?`/leaderboard/games/${t}${this.apiSignInUrl}${m()}`:`/leaderboard/games/${t}${this.apiSignInUrl}`,r=`There was a problem fetching the leaderboard for the following game: ${t}`;i&&(a+=`${i.constructFiltersUrl()}`);let o=await this.fetchWithoutAuth(a,r),n=JSON.parse(JSON.stringify(o));return this.leaderboardRemapper.remapResponse(n)};getLeaderboardForLeague=async(t,e)=>{let i=`/private-league/${t}${this.apiSignInUrl}`,a=`There was a problem fetching the leaderboard for the following league: ${t}`;e&&(i+=`${e.constructFiltersUrl()}`);let r=await this.fetchWithoutAuth(i,a);return this.leaderboardRemapper.remapLeagueLeaderboardResponse(r)};getUserRankings=async(t,e,i)=>{let a=`/leaderboard/users/${t}/rankings${this.apiSignInUrl}`,r=`There was a problem fetching the rankings for the following user: ${t}`;e&&(a+=`${e.constructFiltersUrl()}`),f(i)&&(a+=`${m()}`);let o=await this.fetchWithoutAuth(a,r);return this.rankingsRemapper.remapRankings(o)};getHighestSuccessRate=async(t,e)=>{let i=`/statistics/top${this.apiSignInUrl}`,a="There was a problem fetching highest success rate";t&&(i+=`${t.constructFiltersUrl()}`),f(e)&&(i+=`${m()}`);let r=await this.fetchWithoutAuth(i,a);return this.highestSuccessRateRemapper.remapHighestSuccessRate(r.data)};getEntitiesFollows=async(t,e)=>{let i=f(e)?`/statistics/follows${this.apiSignInUrl}${m()}`:`/statistics/follows${this.apiSignInUrl}`,a="There was a problem fetching follows for entities";return t.footballCompetitions&&(i+=`&competitions=${t.footballCompetitions.join(",")}`),t.footballTeams&&(i+=`&teams=${t.footballTeams.join(",")}`),t.footballPlayers&&(i+=`&players=${t.footballPlayers.join(",")}`),(await this.fetchWithoutAuth(i,a)).data};getUserRankingsForPrivateLeagueAndChallenges=async(t,e,i)=>{let a=`/private-league/users/${t}/rankings${this.apiSignInUrl}&private_league_type=${e==="PRIVATE_LEAGUE"?"private":"one_vs_one"}`,r=`There was a problem fetching user rankings for ${e}`;i&&(a+=`${i.constructFiltersUrl()}`);let o=await this.fetchWithoutAuth(a,r);return e==="PRIVATE_LEAGUE"?this.rankingsRemapper.remapRankingsPrivateLeague(o):this.rankingsRemapper.remapRankingsChallenge(o)};getTemplateBreakdownPoints=async t=>{let e=`/leaderboard/${t}/breakdown${this.apiSignInUrl}`,i=`There was a problem fetching template breakdown points for: ${t}`,a=await this.fetchWithoutAuth(e,i);return this.leaderboardRemapper.remapTemplateBreakdown(a)}};var Ql=class{remapToPrivateLeagues=t=>(t.meta=this.remapMetaPrivateLeagues(t.meta.pagination),t.data=t.data.map(e=>this.remapToPrivateLeagueById(e)),t);remapMetaPrivateLeagues=t=>{let e=new y;return e.pagination.itemsPerPage=t.items_per_page,e.pagination.nextPageStartsAfter=t.next_page_starts_after,e};remapToPrivateLeagueById=t=>{let e=new Ys;return e.id=t.id,e.name=t.name,e.description=t.description,e.type=t.type,e.members=t.members,e.administrators=t.administrators,e.banned=t.banned,e.invites=t.invites,e.membersCount=t.members_count,e.usersCanInviteUsers=t.users_can_invite_users,e.invitationCode=t.invitation_code,e.templateId=t.template_id,e.pastTemplates=t.past_templates,e.pinnedPosts=t.pinned_posts,e.scoringStartsAt=t.scoring_starts_at,e};remapToMyPrivateLeagues=t=>{let e=new ii;return e.id=t.id,e.name=t.name,e.description=t.description,e.type=t.type,e.administrators=t.administrators,e.banned=t.banned,e.invites=t.invites,e.membersCount=t.members_count,e.usersCanInviteUsers=t.users_can_invite_users,e.invitationCode=t.invitation_code,e.templateId=t.template_id,e.pastTemplates=t.past_templates,e.pinnedPosts=t.pinned_posts,e.scoringStartsAt=t.scoring_starts_at,e};remapToAcceptPrivateLeague=t=>{let e=new js;return e.profileId=t.profile_id,e.leagueId=t.league_id,e.message=t.message,e};remapToAcceptChallenge=t=>{let e=new br;return e.profileId=t.profile_id,e.challengeId=t.league_id,e.message=t.message,e};remapPredictions=t=>(t.meta=this.remapMeta(t.meta),t.data=this.remapPredictionsData(t.data),t);remapMeta=t=>{let e=new k;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.numberOfPages=t.pagination.number_of_pages,e.pagination.totalItems=t.pagination.total_items,e};remapPredictionsData=t=>t.map(e=>{let i=new Xs;return i.predictionId=e.prediction_id,i.profileId=e.profile_id,i})};var xi=class{remapToDiscussions=t=>(t.meta=this.remapToMeta(t.meta),t.data=t.data.map(e=>this.remapToDiscussionById(e)),t);remapToDiscussionById=t=>{let e=new Tr;return e.id=t.id,e.label=t.label,e.status=t.status,e.deleted=t.deleted,e.deletedAt=t.deleted_at,e.deletedBy=t.deleted_by,e.discussionType=t.discussion_type,e.discussionUrl=t.discussion_url,e.moderationType=t.moderation_type,e.postsCount=t.posts_count,e.pinnedPosts=t.pinned_posts,e.lastPostId=t.last_post_id,e.customFields=t.custom_fields,e.context=t.context,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapToPostsForDiscussion=(t,e)=>{let i=new Sr,a=new vr;return i.meta=this.remapToPostMeta(t.meta),i.data=t.data.map(r=>this.remapToPostByIdBasic(r)),a.meta=this.remapToPostMeta(t.meta),a.data=t.data.map(r=>this.remapToPostByIdFull(r)),e==="basic"?i:a};remapToPosts=t=>{let e=new Cr;return e.meta=this.remapToMeta(t.meta),e.data=t.data.map(i=>this.remapToPostByIdBasic(i)),e};remapToPostMeta=t=>{let e=new Lt;return e.pagination.totalItems=t.pagination.total_items,e.pagination.nextPageStartsAfter=t.pagination.next_page_starts_after,e.pagination.lastCommentCreateTimestamp=t.pagination.last_comment_create_timestamp,e};remapToMeta=t=>{let e=new y;return e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.nextPageStartsAfter=t.pagination.next_page_starts_after,e};remapToPostByIdBasic=t=>{let e=new ke;return e.id=t.id,e.userId=t.user_id,e.discussionId=t.discussion_id,e.content=t.content,e.anonymousNickname=t.anonymous_nickname,e.reactionsCount=t.reactions_count,e.replyId=t.reply_id,e.reactions=t.reactions.length?t.reactions.map(i=>this.remapReactionsPost(i)):t.reactions,e.repliesCount=t.replies_count,e.reports=t.reports.length?t.reports.map(i=>this.remapReportPost(i)):t.reports,e.reportsCount=t.reports_count,e.versions=t.versions.length?t.versions.map(i=>this.remapVersionsPost(i)):t.versions,e.privatePost=t.private_post,e.deleted=t.deleted,e.deletedAt=t.deleted_at,e.deletedBy=t.deleted_by,e.moderated=t.moderated,e.moderatedAt=t.moderated_at,e.moderatedBy=t.moderated_by,e.moderatedReason=t.moderated_reason,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapToPostByIdFull=t=>{let e=new Er;return e.id=t.id,e.userId=t.user_id,e.discussionId=t.discussion_id,e.content=t.content,e.anonymousNickname=t.anonymous_nickname,e.reactionsCount=t.reactions_count,e.replyId=t.reply_id,e.reactions=t.reactions.length?t.reactions.map(i=>this.remapReactionsPost(i)):t.reactions,e.repliesCount=t.replies_count,e.reports=t.reports.length?t.reports.map(i=>this.remapReportPost(i)):t.reports,e.reportsCount=t.reports_count,e.versions=t.versions.length?t.versions.map(i=>this.remapVersionsPost(i)):t.versions,e.privatePost=t.private_post,e.deleted=t.deleted,e.deletedAt=t.deleted_at,e.deletedBy=t.deleted_by,e.moderated=t.moderated,e.moderatedAt=t.moderated_at,e.moderatedBy=t.moderated_by,e.moderatedReason=t.moderated_reason,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapToPostCount=t=>t.map(e=>{let i=new Fr;return i.id=e.id,i.postsCount=e.posts_count,i});remapReactionsPost=t=>{let e=new Ar;return e.type=t.type,e.userIds=t.user_ids,e.reactionCount=t.reaction_count,e};remapVersionsPost=t=>{let e=new xr;return e.content=t.content,e.updatedAt=t.updated_at,e};remapReportPost=t=>{let e=new Or;return e.userId=t.user_id,e.reason=t.reason,e.reasonDetails=t.reason_details,e}};var Li=class extends v{remapper=null;discussionsRemapper=null;discussionsBaseURL=null;constructor(t){super(t,O(t.environment,"privateLeagues")),this.discussionsBaseURL=O(t.environment,"discussions"),this.remapper=new Ql,this.discussionsRemapper=new xi}create=async(t,e)=>{let i="/leagues"+this.apiSignInUrl,r=`There was a problem ${e==="PRIVATE_LEAGUE"?"creating private league":"issuing challenge"}`,o="POST",n=await this.fetchWithAuth(i,r,o,t);return this.remapper.remapToPrivateLeagueById(n.data)};update=async(t,e,i)=>{let a=`/leagues/${t}`+this.apiSignInUrl,o=`There was a problem updating ${i==="PRIVATE_LEAGUE"?"private league":"challenge"}`,n="PUT",l=await this.fetchWithAuth(a,o,n,e);return this.remapper.remapToPrivateLeagueById(l.data)};updateLeagueTemplate=async(t,e,i,a)=>{let r=`/leagues/${t}/template`+this.apiSignInUrl,n=`There was a problem updating template for the ${a==="PRIVATE_LEAGUE"?"private league":"challenge"}`,l="POST",p={new_template_id:e,past_template_name:i},c=await this.fetchWithAuth(r,n,l,p);return this.remapper.remapToPrivateLeagueById(c.data)};getById=async(t,e,i)=>{let a=`/leagues/${t}`+this.apiSignInUrl;f(i)&&(a+=m());let o=`There was a problem getting ${e==="PRIVATE_LEAGUE"?"private league":"challenge"}`,n=await this.fetchWithAuth(a,o);return this.remapper.remapToPrivateLeagueById(n.data)};getMyLeagues=async(t,e)=>{let i="/leagues"+this.apiSignInUrl+t.constructFiltersUrl(),r=`There was a problem getting user's ${e==="PRIVATE_LEAGUE"?"private leagues":"challenges"}`;return(await this.fetchWithAuth(i,r)).data.map(n=>this.remapper.remapToMyPrivateLeagues(n))};delete=async(t,e)=>{let i=`/leagues/${t}`+this.apiSignInUrl,r=`There was a problem deleting ${e==="PRIVATE_LEAGUE"?"private league":"challenge"}`,o="DELETE";return await this.fetchWithAuth(i,r,o),!0};invite=async(t,e)=>{let i=`/membership/invite/${t}`+this.apiSignInUrl,a=`There was a problem inviting the following users: ${e.join(",")}`,r="POST",o={profiles:e};return(await this.fetchWithAuth(i,a,r,o)).data};deleteInvitation=async(t,e)=>{let i=`/membership/invite/${t}`+this.apiSignInUrl,a=`There was a problem deleting invitation for the following users: ${e.join(",")}`,r="DELETE",o={profiles:e};return await this.fetchWithAuth(i,a,r,o),!0};accept=async(t,e,i)=>{let a=`/membership/accept/${t}`+this.apiSignInUrl+`&accept=${e?"ACCEPT":"REJECT"}`,o=`There was a problem ${e?"accepting":"rejecting"} invitation for ${i==="PRIVATE_LEAGUE"?"private league":"challenge"}: ${t}`,n="POST",l=await this.fetchWithAuth(a,o,n);return i==="PRIVATE_LEAGUE"?this.remapper.remapToAcceptPrivateLeague(l.data):this.remapper.remapToAcceptChallenge(l.data)};ban=async(t,e)=>{let i=`/membership/ban/${t}`+this.apiSignInUrl,a=`There was a problem banning the following users: ${e.join(",")}`,r="POST",o={profiles:e};return(await this.fetchWithAuth(i,a,r,o)).data};unban=async(t,e)=>{let i=`/membership/unban/${t}`+this.apiSignInUrl,a=`There was a problem unbanning the following users: ${e.join(",")}`,r="POST",o={profiles:e};return(await this.fetchWithAuth(i,a,r,o)).data};join=async t=>{let e="/membership/join"+this.apiSignInUrl+`&invitation_code=${t}`,i="There was a problem joining league",a="POST",r=await this.fetchWithAuth(e,i,a);return this.remapper.remapToAcceptPrivateLeague(r.data)};leave=async(t,e)=>{let i=`/membership/leave/${t}`+this.apiSignInUrl,r=`There was a problem leaving the following ${e==="PRIVATE_LEAGUE"?"league":"challenge"}: ${t}`,o="POST";return(await this.fetchWithAuth(i,r,o)).data};getInvitations=async(t,e)=>{let i="/membership/invitations"+this.apiSignInUrl+e.constructMainFiltersUrl(),r=`There was a problem getting invitations for ${t==="PRIVATE_LEAGUE"?"leagues":"challenges"}`,o=await this.fetchWithAuth(i,r);return this.remapper.remapToPrivateLeagues(o)};getReportedPosts=async(t,e)=>{let i=`/discussions/${t}/posts/reported${this.apiSignInUrl}`,a=`There was a problem fetching posts for the following: ${t}`;e&&(i+=e.constructMainFiltersUrl());let r=await this.fetchWithAuthNewBaseURL(this.discussionsBaseURL,i,a);return this.discussionsRemapper.remapToPostsForDiscussion(r,"full")};getPredictions=async(t,e)=>{let i=`/leagues/${t}/predictions`+this.apiSignInUrl,a=`There was a problem getting predictions for private league: ${t}`;e&&(i+=e.constructFiltersUrl());let r=await this.fetchWithAuth(i,a);return this.remapper.remapPredictions(r)};moderatePost=async(t,e)=>{let i=`/posts/${t}/admin/moderate${this.apiSignInUrl}`,a=`There was a problem moderating the following post: ${t}`,r="POST",o={moderation_reason:e},n=await this.fetchWithAuthNewBaseURL(this.discussionsBaseURL,i,a,r,o);return this.discussionsRemapper.remapToPostByIdBasic(n.data)}};var Di=class{createRequestBodyFromParam=(t,e)=>{let i=e==="PRIVATE"?new en:new Mr;return i.name=t.name,i.description=t.description,i.invitation_code=t.invitationCode,i.template_id=t.templateId,i.users_can_invite_users=t.usersCanInviteUsers,t.administrators?i.administrators=t.administrators:delete i.administrators,t.scoringStartsAt?i.scoring_starts_at=t.scoringStartsAt:delete i.scoring_starts_at,i};createUpdateRequestBodyFromParam=(t,e)=>{let i=e==="PRIVATE"?new an:new Ir;return i.name=t.name,i.description=t.description,i.invitation_code=t.invitationCode,i.template_id=t.templateId,i.users_can_invite_users=t.usersCanInviteUsers,i.administrators=t.administrators,i.pinned_posts=t.pinnedPosts,i.scoring_starts_at=t.scoringStartsAt,i}};var ql=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(t){if(!t||!t.type||!t.subType)return"no_info_yet";let e=t.type.toLowerCase(),i=t.subType.toLowerCase();return e==="finished"?i==="awarded_win"?"finished_after_awarded_win":i==="aet"?"finished_aet":i==="ap"?"finished_ap":i==="asg"?"finished_asg":"finished":e==="notstarted"?i==="postponed"?"postponed":i==="delayed"?"kick_off_delayed":"not_started":e==="inprogress"?i==="1st_half"?"1st_half":i==="2nd_half"?"2nd_half":i==="halftime"?"halftime":i==="penalty"?"penalty":i==="waiting_penalty"?"waiting_for_penalty":i==="pause"?"pause":i==="extra_time_1st_half"?"extra_time_1st_half":i==="extra_time_2nd_half"?"extra_time_2nd_half":i==="extra_time_halftime"?"extra_time_end_of_1st_half":i==="waiting_extra_time"?"waiting_for_extra_time":"awaiting_info":e==="interrupted"?i==="abandoned"?"abandoned":i==="to_finish"?"to_finish":"interrupted":e==="cancelled"?"cancelled":"no_info_yet"}isUpcoming(t){if(!t)return!1;let e=this.getMatchEventStatus(t);return this.ALL_UPCOMING_STATUSES.includes(e)}isLive(t){if(!t)return!1;let e=this.getMatchEventStatus(t);return this.ALL_LIVE_STATUSES.includes(e)}isFinished(t){if(!t)return!1;let e=this.getMatchEventStatus(t);return this.ALL_FINISHED_STATUSES.includes(e)}};var Wl=class{matchStatusHelper;constructor(){this.matchStatusHelper=new ql}getMatchStatusEnum(t){return this.matchStatusHelper.getMatchEventStatus(t)}isMatchUpcoming(t){return this.matchStatusHelper.isUpcoming(t)}isMatchLive(t){return this.matchStatusHelper.isLive(t)}isMatchFinished(t){return this.matchStatusHelper.isFinished(t)}};var it=class{https=null;idMapping=null;localCache=null;footballFacade=null;footballHelpers;constructor(t){this.https=new dt(t),this.idMapping=new R(t),this.localCache=new ct().createLocalCacheInstance(t.idSchema),this.footballFacade=new vi(t,this.localCache,this.https,this.idMapping),this.footballHelpers=new Wl}getCountries=async t=>await this.footballFacade.getCountries(t);getCompetitions=async(t,e)=>await this.footballFacade.getCompetitions(t,e);getCompetitionById=async(t,e)=>await this.footballFacade.getCompetitionById(t,e);getTopCompetitions=async t=>await this.footballFacade.getTopCompetitions(t);getTeams=async(t,e)=>await this.footballFacade.getTeams(t,e);getTeamById=async(t,e)=>await this.footballFacade.getTeamById(t,e);getTopTeams=async t=>await this.footballFacade.getTopTeams(t);getNextMatchForTeam=async(t,e)=>await this.footballFacade.getNextMatchForTeam(t,e);getPrevMatchForTeam=async(t,e)=>await this.footballFacade.getPrevMatchForTeam(t,e);getPlayers=async(t,e)=>await this.footballFacade.getPlayers(t,e);getPlayerById=async(t,e)=>await this.footballFacade.getPlayerById(t,e);getTopPlayers=async t=>await this.footballFacade.getTopPlayers(t);getNextMatchForPlayer=async(t,e)=>await this.footballFacade.getNextMatchForPlayer(t,e);getPrevMatchForPlayer=async(t,e)=>await this.footballFacade.getPrevMatchForPlayer(t,e);getMatches=async(t,e)=>await this.footballFacade.getMatches(t,e);getMatchById=async(t,e)=>await this.footballFacade.getMatchById(t,e);search=async(t,e)=>await this.footballFacade.search(t,e);getTeamForm=async(t,e,i)=>await this.footballFacade.getTeamForm(t,e,i);get helpers(){return this.footballHelpers}};var Kl=class{matchFacade=null;playerFacade=null;predictorService=null;constructor(t,e,i){this.matchFacade=t,this.playerFacade=e,this.predictorService=i}remapFixturesRequest=t=>{let e={};if(e.match_id=t.matchId,e.match_type="FOOTBALL",t instanceof st)e.market=t.market,e.prediction=t.prediction.value,e.player_id=t.prediction.playerId;else if(t instanceof Je||t instanceof Ze)e.market=t.market,e.prediction=t.prediction.value;else if(t instanceof Vt){e.market=t.market;let i=t.prediction.value.split(":");e.goals_home=Number(i[0]),e.goals_away=Number(i[1])}else e.market=t.market,e.prediction=t.prediction.value;return e};remapFixturesResponse=async t=>{let e="OWN_GOAL",i=[],a=[],r=null,o=[];t.length>1&&t.sort((l,p)=>l.match_id.localeCompare(p.match_id));for(let l of t)i.push(l.match_id),l.player_id&&!a.includes(l.player_id)&&a.push(l.player_id);let n=await this.matchFacade.getMatchesMapWithNativeIds(i);a.sort((l,p)=>l.localeCompare(p)),a&&a.length>0&&!a.includes(e)&&(r=await this.playerFacade.getPlayersMapWithNativeIds(a));for(let l of t){let p=new Ye;l.target?p.market=this.predictorService.convertMarketForResponseModel(l.market,l.target):p.market=l.market,p.matchId=n[l.match_id].id,p.matchType=l.match_type,p.matchModel=n?n[l.match_id]:null,delete p.matchModel.availableMarkets,l.prediction!==void 0?p.prediction.value=l.prediction:l.goals_home!==void 0&&l.goals_away!==void 0&&(p.prediction.value=l.goals_home.toString()+":"+l.goals_away.toString()),p.prediction.playerId=l.player_id?l.player_id:null,l.market==="PLAYER_PERFORMANCE"&&(p.prediction.playerRole=l.role),p.prediction.playerId&&p.prediction.playerId!==e&&(p.prediction.playerModel=r[l.player_id],p.prediction.playerId=r[l.player_id].id),p.result=this.remapResult(l.result),o.push(p)}return o};remapResult=t=>{let e=new Xe;return e.settledAt=t.settled_at,e.resettledAt=t.resettled_at,e.status=t.status,e.outcome=t.outcome,e.points=t.points,e}};var jc=class{constructor(){}static createMatchMarketsResultsModel(t,e){return{FT_1X2:this.createOneXTwoResult(t.scores,"full_time"),HT_1X2:this.createOneXTwoResult(t.scores,"half_time"),BOTH_TEAMS_SCORE:t.scores.ftScore.homeGoals>0&&t.scores.ftScore.awayGoals>0,DOUBLE_CHANCE:this.createDoubleChanceResult(t.scores),HT_FT:this.createHalfTimeFullTimeResult(t.scores),RED_CARD_MATCH:this.createMarketResultByCriteria(t,"red_card"),PENALTY_MATCH:this.createMarketResultByCriteria(t,"penalty"),CORNERS_MATCH:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam,PLAYER_YELLOW_CARD:this.createPlayersMarketsResults(t,e,"yellow_card"),PLAYER_RED_CARD:this.createPlayersMarketsResults(t,e,"red_card"),PLAYER_SCORE_FIRST_GOAL:this.createPlayersMarketsResults(t,e,"first_goal"),PLAYER_SCORE:this.createPlayersMarketsResults(t,e,"one_goal"),PLAYER_SCORE_TWICE:this.createPlayersMarketsResults(t,e,"two_goals"),PLAYER_SCORE_HATTRICK:this.createPlayersMarketsResults(t,e,"hattrick"),CORRECT_SCORE:{homeGoals:t.scores.ftScore.homeGoals,awayGoals:t.scores.ftScore.awayGoals},CORRECT_SCORE_ADVANCED:{homeGoals:t.scores.ftScore.homeGoals,awayGoals:t.scores.ftScore.awayGoals},CORRECT_SCORE_HT:{homeGoals:t.scores.htScore.homeGoals,awayGoals:t.scores.htScore.awayGoals},OVER_GOALS_0_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>0,OVER_GOALS_1_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>1,OVER_GOALS_2_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>2,OVER_GOALS_3_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>3,OVER_GOALS_4_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>4,OVER_GOALS_5_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>5,OVER_GOALS_6_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>6,OVER_CORNERS_6_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>6,OVER_CORNERS_7_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>7,OVER_CORNERS_8_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>8,OVER_CORNERS_9_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>9,OVER_CORNERS_10_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>10,OVER_CORNERS_11_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>11,OVER_CORNERS_12_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>12,OVER_CORNERS_13_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>13}}},Ft=jc;at(Ft,"createOneXTwoResult",(t,e)=>e==="full_time"?t.ftScore.homeGoals>t.ftScore.awayGoals?"1":t.ftScore.homeGoals===t.ftScore.awayGoals?"x":"2":t?.htScore?.homeGoals>t?.htScore?.awayGoals?"1":t?.htScore?.homeGoals===t?.htScore?.awayGoals?"x":"2"),at(Ft,"createDoubleChanceResult",t=>t?.ftScore?.homeGoals>t?.ftScore?.awayGoals?["1x","12"]:t?.ftScore?.homeGoals===t?.ftScore?.awayGoals?["1x","x2"]:["x2","12"]),at(Ft,"createHalfTimeFullTimeResult",t=>{if(t?.htScore?.homeGoals>t?.htScore?.awayGoals){if(t?.ftScore?.homeGoals>t?.ftScore?.awayGoals)return"1/1";if(t?.ftScore?.homeGoals===t?.ftScore?.awayGoals)return"1/x";if(t?.ftScore?.homeGoals<t?.ftScore?.awayGoals)return"1/2"}if(t?.htScore?.homeGoals===t?.htScore?.awayGoals){if(t?.ftScore?.homeGoals>t?.ftScore?.awayGoals)return"x/1";if(t?.ftScore?.homeGoals===t?.ftScore?.awayGoals)return"x/x";if(t?.ftScore?.homeGoals<t?.ftScore?.awayGoals)return"x/2"}if(t?.htScore?.homeGoals<t?.htScore?.awayGoals){if(t?.ftScore?.homeGoals>t?.ftScore?.awayGoals)return"2/1";if(t?.ftScore?.homeGoals===t?.ftScore?.awayGoals)return"2/x";if(t?.ftScore?.homeGoals<t?.ftScore?.awayGoals)return"2/2"}}),at(Ft,"createMarketResultByCriteria",(t,e)=>!t.timeline||!t.timeline.length?null:e==="red_card"?t.timeline.filter(i=>Number(i.minute)<=90).some(i=>i.type==="red_card"):t.timeline.filter(i=>Number(i.minute)<=90).some(i=>i.type.startsWith(e))),at(Ft,"createPlayersMarketsResults",(t,e,i)=>{if(!t.timeline||!t.timeline.length)return i==="first_goal"?null:[];if(i==="first_goal"){let n=t.timeline.find(l=>l.type==="goal"||l.type==="penalty_goal"||l.type==="own_goal")||null;if(n){let l=e[n.player.id];return{playerId:n.type==="goal"||n.type==="penalty_goal"?n.player.id:"OWN_GOAL",playerModel:l}}return null}if(i==="yellow_card"||i==="red_card")return jc.transformPlayerMarketResult(t.timeline.filter(n=>Number(n.minute)<=90).filter(n=>n.type===i).map(n=>e[n.player.id]));let a=new Map,r=i==="one_goal"?1:i==="two_goals"?2:3,o=[];return t.timeline.filter(n=>Number(n.minute)<=90).filter(n=>n.type==="goal"||n.type==="penalty_goal").forEach(n=>{let l=e[n.player.id];if(a.has(n.player.id)){let p=a.get(n.player.id);p.push(l),a.set(n.player.id,p)}else a.set(n.player.id,[l])}),a.forEach(n=>{n.length>=r&&o.push(n[0])}),jc.transformPlayerMarketResult(o)}),at(Ft,"transformPlayerMarketResult",t=>t.map(e=>({playerId:e.id,playerModel:e})));var St=class{footballHttps=null;idMapping=null;matchFacade=null;playerFacade=null;profileNamespace=null;constructor(t,e){this.footballHttps=new dt(t),this.idMapping=e,this.matchFacade=new te(t,this.footballHttps,e),this.playerFacade=new Zt(t,this.footballHttps,e),this.profileNamespace=new D(t)}remapMatchIdToNative=async t=>(await this.idMapping.getEntityIdsBySchemaId(t,"match","native")).match;remapPlayerIdToNative=async t=>(await this.idMapping.getEntityIdsBySchemaId(t,"player","native")).player[0];remapPlayerIdMapToNative=async t=>{let e={},i=ce(t),r=(await this.idMapping.getEntityIdsBySchemaId(i,"player","native")).player;return i.forEach((o,n)=>e[o]=r[n]),e};remapPlayerIdToIdSchema=async t=>{let e=["playerScore","playerYellowCard","playerRedCard","playerScoreFirstGoal","playerScoreHattrick","playerScoreTwice"],i=[];for(let[r,o]of Object.entries(t))if(e.includes(r))for(let n of Object.keys(o))n!=="NOBODY"&&n!=="OWN_GOAL"&&i.push(n);if(!i.length)return t;let a=await this.playerFacade.getPlayersMapWithNativeIds(i);for(let[r,o]of Object.entries(t))if(e.includes(r))for(let n of Object.keys(o))n!=="NOBODY"&&n!=="OWN_GOAL"&&(o[a[n].id]=o[n],o[a[n].id].model=a[n],this.idMapping.idSchema!=="native"&&delete o[n]);return t};convertMarketForResponseModel=(t,e)=>{let i=e.toString();return t+"_"+i};getMarketSummary=async(t,e,i)=>{let a=_u.get(e),r={};if(r.matchId=t.matchId,r.matchType=t.matchType,Object.keys(t.predictions).includes(a))r[a]=t.predictions[a];else throw new Error("You have passed invalid market");if(It.includes(e)&&i){let n="";if(i!=="OWN_GOAL"&&i!=="NOBODY"&&(n=(await this.idMapping.idMappingFacade.getEntitiesByIds({player:[i]},this.idMapping.idSchema,"native")).player[0]),n&&r[a][n]){let l=await this.playerFacade.getPlayersMapWithNativeIds([n]);return r[a][n].model=l[n],r[a][n]}else return n?(r[a][n]=new L,r[a][n]):r[a][i]}else if(It.includes(e)&&!i){let n=Object.keys(r[a]).filter(p=>p!=="NOBODY"&&p!=="OWN_GOAL"),l=n.length?await this.playerFacade.getPlayersMapWithNativeIds(n):{};Object.keys(l).length&&Object.keys(r[a]).forEach(p=>{p!=="NOBODY"&&p!=="OWN_GOAL"&&(r[a][l[p].id]=r[a][p],r[a][l[p].id].model=l[p],this.idMapping.idSchema!=="native"&&delete r[a][p])})}return r};remapCompetitionsFromConfig=async t=>{if(t instanceof Ce){let e={competition:t.fullCoverageCompetitions},i={competition:t.successRateScopes.competitions},a={team:t.successRateScopes.teams},r=await this.idMapping.idMappingFacade.getEntitiesByIds(e,"native",this.idMapping.idSchema),o=await this.idMapping.idMappingFacade.getEntitiesByIds(i,"native",this.idMapping.idSchema),n=await this.idMapping.idMappingFacade.getEntitiesByIds(a,"native",this.idMapping.idSchema);return t.fullCoverageCompetitions=r.competition,t.successRateScopes.competitions=o.competition,t.successRateScopes.teams=n.team,t}if(t instanceof ve||t instanceof Se){let e={competition:t.competitionsWhitelist},i=await this.idMapping.idMappingFacade.getEntitiesByIds(e,"native",this.idMapping.idSchema);return t.competitionsWhitelist=i.competition,t}};remapMatchIdsFixtures=async t=>{if(Array.isArray(t.data))if(t.data.length>0){let e=[],i=[];return t.data.forEach(a=>{a instanceof Tt||a instanceof Ht||a instanceof Pt||a instanceof si?(a.fixtures.forEach(r=>e.push(r.matchId)),a instanceof Pt&&a.fixtures.forEach(r=>{r.prediction.playerId&&r.prediction.playerId!=="OWN_GOAL"&&i.push(r.prediction.playerId)})):a instanceof Jt&&a.results.forEach(r=>e.push(r.matchId))}),await this.refactorResponseArrModel(t,e,i)}else return t;else return await this.refactorResponseObjModel(t)};refactorResponseArrModel=async(t,e,i)=>{let a=[],r=await this.matchFacade.getMatchesMapWithNativeIds(e),o={};return i.length>0&&(o=await this.playerFacade.getPlayersMapWithNativeIds(i)),t.data.forEach(n=>{n instanceof Tt||n instanceof Ht||n instanceof Pt?(n.fixtures.forEach(l=>{this.handleMatchModel(r,l),n instanceof Pt&&l.prediction.playerId&&l.prediction.playerId!=="OWN_GOAL"&&(l.prediction.playerModel=o[l.prediction.playerId],l.prediction.playerId=o[l.prediction.playerId].id)}),a.push(n)):n instanceof Jt&&(n.results.forEach(l=>{l.matchModel=r[l.matchId],delete l.matchModel.availableMarkets,l.matchId=l.matchModel.id}),a.push(n))}),t.data=a,t};refactorResponseObjModel=async t=>{let e=[];t.fixtures.forEach(a=>e.push(a.matchId));let i=await this.matchFacade.getMatchesMapWithNativeIds(e);return t.fixtures.forEach(a=>this.handleMatchModel(i,a)),t};getCurrentGameId=t=>{let e=new Date;if(t.data.length>1){let i=[];return t.data.forEach(r=>i.push(r.predictionsCutoff)),t.data.sort((r,o)=>{let[n,l]=[r.predictionsCutoff,o.predictionsCutoff].map(p=>Math.abs(new Date(p)-e));return n-l})[0].id}else return t.data[0].id};initGameTypePredictions=(t,e)=>{let i={type:t,limit:null,startAfter:null};return e&&(i={...i,limit:e.limit,startAfter:e.startAfter}),i=new V(i),i};initGameFilters=(t,e,i)=>{if(e&&i)return e.type=t,e.gameIds=i,e=new nt(e),e;if(e&&!i)return e.type=t,e=new nt(e),e;if(!e&&i){let a={type:t,gameIds:i};return a=new nt(a),a}else{let a={type:t};return a=new nt(a),a}};addPredictionProp=async(t,e)=>(e.data.forEach(i=>{let a=i.fixtures.map(r=>r.matchId);t.data.forEach(r=>{i.id===r.game_instance_id&&(i.fixtures.sort((o,n)=>o.matchId.localeCompare(n.matchId)),r.fixtures.sort((o,n)=>o.match_id.localeCompare(n.match_id)),i.predictionId=r.id,i.outcome=r.status,i.fixtures.forEach((o,n)=>{r.fixtures[n].goals_home!==void 0&&r.fixtures[n].goals_away!==void 0?o.prediction.value=r.fixtures[n].goals_home+":"+r.fixtures[n].goals_away:o.prediction.value=r.fixtures[n].prediction,r.fixtures[n].player_id?o.prediction.playerId=r.fixtures[n].player_id:r.fixtures[n].target&&(o.prediction.target=r.fixtures[n].target),o.prediction.result=this.remapResult(r.fixtures[n].result)}),i.predictionsMadeAt=r.created_at,i.predictionsUpdatedAt=r.profile_last_updated_at,i.points=r.points,i instanceof Ht&&(r.tiebreaker?i.predictionTiebreaker.goldenGoal=r.tiebreaker.golden_goal:i.predictionTiebreaker=r.tiebreaker))}),i.fixtures.sort((r,o)=>a.indexOf(r.matchId)-a.indexOf(o.matchId))}),e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,await this.remapMatchIdsFixtures(e));remapResult=t=>{let e=new Xe;return e.settledAt=t.settled_at,e.resettledAt=t.resettled_at,e.status=t.status,e.outcome=t.outcome,e.points=t.points,e};areIdsExceeded=t=>t.length>10;initPredictionsFilters=(t,e,i)=>{switch(e){case"user":t&&(t=new V(t));break;case"current":if(t)this.deleteUnexpectedProperties(t),t.status=["ACTIVE"],t=new V(t);else{let a={status:["ACTIVE"]};t=new V(a)}break;case"past":if(t)this.deleteUnexpectedProperties(t),t.status=mu,t=new V(t);else{let a={status:mu};t=new V(a)}break;case"matches":if(t)this.deleteUnexpectedProperties(t),t.matchIds=i,t=new V(t);else{let a={matchIds:i};t=new V(a)}break}return t};completeGameMarketResults=async(t,e)=>{switch(e){case"MATCH_QUIZ":let i={},a=t.results[0].matchId,r=t.results.map(p=>It.includes(p.market)&&!p.result.includes("OWN_GOAL")?[...p.result]:[]).flat(),o=await this.matchFacade.getMatchesMapWithNativeIds([a]);return r.length&&(i=await this.playerFacade.getPlayersMapWithNativeIds(r)),t.results=t.results.map(p=>{if(p.matchModel=o[p.matchId]?o[p.matchId]:null,p.playerModels&&Object.keys(i).length&&p.result.forEach(u=>{let d=i[u];p.playerModels.push(d)}),this.idMapping.idSchema!=="native"&&(this.remapMatchIdForResultsMarkets(o,p),p.playerModels&&Object.keys(i).length)){let c=p.result;p.result=c.map(u=>i[u].id)}return p}),t;case"TOP_X":let n=t.results.map(p=>p.matchId),l=await this.matchFacade.getMatchesMapWithNativeIds(n);if(t.results=t.results.map(p=>(p.matchModel=l[p.matchId]?l[p.matchId]:null,this.idMapping.idSchema!=="native"&&this.remapMatchIdForResultsMarkets(l,p),p)),t.tieBreakers.goldenGoals.length){let p=t.tieBreakers.goldenGoals.map(u=>u.playerId),c=await this.playerFacade.getPlayersMapWithNativeIds(p);t.tieBreakers.goldenGoals=t.tieBreakers.goldenGoals.map(u=>(u.matchModel=l[u.matchId],u.playerModel=c[u.playerId],this.idMapping.idSchema!=="native"&&(u.matchId=l[u.matchId].id,u.playerId=c[u.playerId].id),u))}return t}};completeContestWinners=async t=>{if(t.userList&&t.userList.length){let e=t.userList.map(a=>a.profileId),i=await this.profileNamespace.getByIds(e);t.userList.forEach(a=>{let r=i.filter(o=>o.id===a.profileId)[0];delete r.interests,a.profileModel=r})}return t};handleMatchModel=(t,e)=>{t[e.matchId]?(e.matchModel=t[e.matchId],delete e.matchModel.availableMarkets,e.matchId=e.matchModel.id):(e.matchModel=null,this.idMapping.idSchema!=="native"&&this.idMapping.idMappingFacade.getEntityById(e.matchId,"match","native").then(i=>{e.matchId=i[G[this.idMapping.idSchema]]}))};remapMatchIdForResultsMarkets=(t,e)=>{t[e.matchId]?e.matchId=t[e.matchId].id:this.idMapping.idMappingFacade.getEntityById(e.matchId,"match","native").then(i=>{e.matchId=i[G[this.idMapping.idSchema]]})};deleteUnexpectedProperties=t=>(t.status&&(console.warn(iu.UNEXPECTED_STATUS_PROP),delete t.status),t.type&&(console.warn(iu.UNEXPECTED_TYPE_PROP),delete t.type),t);getMatchMarketsResults=async t=>{let e=await this.footballHttps.getMatchById(t,!0);if(e.status.type!=="finished"||!e.finishedAt)return new qs;let i=[];e.timeline.filter(r=>Number(r.minute)<=90).filter(r=>r.type==="goal"||r.type==="penalty_goal"||r.type==="yellow_card"||r.type==="red_card").forEach(r=>{i.push(r.player.id)});let a={};return i.length&&(a=await this.playerFacade.getPlayersMapWithNativeIds(i)),Ft.createMatchMarketsResultsModel(e,a)}};var Bi=class{fixturesRemapper=null;footballHttps=null;matchFacade=null;playerFacade=null;predictorService=null;constructor(t,e){this.footballHttps=new dt(t),this.matchFacade=new te(t,this.footballHttps,e),this.playerFacade=new Zt(t,this.footballHttps,e),this.predictorService=new St(t,e),this.fixturesRemapper=new Kl(this.matchFacade,this.playerFacade,this.predictorService)}remapRequestBody=t=>{if(t instanceof Ge)return t;let e={};return e.game_instance_id=t.gameInstanceId,e.fixtures=t.fixtures.map(i=>this.fixturesRemapper.remapFixturesRequest(i)),t instanceof ni&&t.tiebreaker&&(e.tiebreaker={},e.tiebreaker.golden_goal=t.tiebreaker.goldenGoal?t.tiebreaker.goldenGoal:null),e};remapResponseArrayBody=async t=>{if(t.length){let e="OWN_GOAL",i=[],a=[],r={},o=[];t.forEach(l=>{l.fixtures.forEach(p=>{i.push(p.match_id),p.player_id&&p.player_id!==e&&a.push(p.player_id)})});let n=await this.matchFacade.getMatchesMapWithNativeIds(i);return a.length>0&&(r=await this.playerFacade.getPlayersMapWithNativeIds(a)),t.forEach(l=>{let p=new Si,c=[];p.id=l.id,p.gameInstanceId=l.game_instance_id,p.gameType=l.game_type,p.wager=l.wager,p.totalFixtures=l.total_fixtures,p.settledFixtures=l.settled_fixtures,p.userId=l.user_id,p.templateId=l.template_id,p.groupId=l.group_id,p.profileLastUpdatedAt=l.profile_last_updated_at,l.fixtures.forEach(u=>{let d=new Ye;u.target?d.market=this.predictorService.convertMarketForResponseModel(u.market,u.target):d.market=u.market,d.matchId=n[u.match_id].id,d.matchType=u.match_type,d.matchModel=n[u.match_id],delete d.matchModel.availableMarkets,u.prediction!==void 0?d.prediction.value=u.prediction:u.goals_home!==void 0&&u.goals_away!==void 0&&(d.prediction.value=u.goals_home.toString()+":"+u.goals_away.toString()),d.prediction.playerId=u.player_id?u.player_id:null,d.prediction.playerId&&d.prediction.playerId!==e&&(d.prediction.playerModel=r[d.prediction.playerId],d.prediction.playerId=r[d.prediction.playerId].id),u.market==="PLAYER_PERFORMANCE"&&(d.prediction.playerRole=u.role),d.result=this.fixturesRemapper.remapResult(u.result),c.push(d)}),p.fixtures=c,p.status=l.status,l.tiebreaker?p.tiebreaker.goldenGoal=l.tiebreaker.golden_goal:p.tiebreaker=null,p.points=l.points,p.createdAt=l.created_at,p.updatedAt=l.updated_at,o.push(p)}),o}return t};remapResponseObjBody=async t=>{let e=new Si;return e.id=t.id,e.gameInstanceId=t.game_instance_id,e.gameType=t.game_type,e.wager=t.wager,e.totalFixtures=t.total_fixtures,e.settledFixtures=t.settled_fixtures,e.userId=t.user_id,e.templateId=t.template_id,e.groupId=t.group_id,e.profileLastUpdatedAt=t.profile_last_updated_at,e.fixtures=await this.fixturesRemapper.remapFixturesResponse(t.fixtures),e.status=t.status,t.tiebreaker?e.tiebreaker.goldenGoal=t.tiebreaker.golden_goal:e.tiebreaker=null,e.points=t.points,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPredictionModel=t=>{let e=new Ws;return e.fullTimeOneXTwo=t.FT_1X2,e.halfTimeOneXTwo=t.HT_1X2,e.bothTeamsScore=t.BOTH_TEAMS_SCORE,e.overZeroPointFiveGoals=t.OVER_GOALS_0_5,e.overOnePointFiveGoals=t.OVER_GOALS_1_5,e.overTwoPointFiveGoals=t.OVER_GOALS_2_5,e.overThreePointFiveGoals=t.OVER_GOALS_3_5,e.overFourPointFiveGoals=t.OVER_GOALS_4_5,e.overFivePointFiveGoals=t.OVER_GOALS_5_5,e.overSixPointFiveGoals=t.OVER_GOALS_6_5,e.overSixPointFiveCorners=t.OVER_CORNERS_6_5,e.overSevenPointFiveCorners=t.OVER_CORNERS_7_5,e.overEightPointFiveCorners=t.OVER_CORNERS_8_5,e.overNinePointFiveCorners=t.OVER_CORNERS_9_5,e.overTenPointFiveCorners=t.OVER_CORNERS_10_5,e.overElevenPointFiveCorners=t.OVER_CORNERS_11_5,e.overTwelvePointFiveCorners=t.OVER_CORNERS_12_5,e.overThirteenPointFiveCorners=t.OVER_CORNERS_13_5,e.doubleChance=t.DOUBLE_CHANCE,e.halfTimeFullTime=t.HT_FT,e.playerScore=t.PLAYER_SCORE,e.playerYellowCard=t.PLAYER_YELLOW_CARD,e.playerRedCard=t.PLAYER_RED_CARD,e.redCardMatch=t.RED_CARD_MATCH,e.penaltyMatch=t.PENALTY_MATCH,e.playerScoreFirstGoal=t.PLAYER_SCORE_FIRST_GOAL,e.cornersMatch=t.CORNERS_MATCH,e.correctScore=t.CORRECT_SCORE,e.correctScoreHalfTime=t.CORRECT_SCORE_HT,e.correctScoreAdvanced=t.CORRECT_SCORE_ADVANCED,e.playerScoreHattrick=t.PLAYER_SCORE_HATTRICK,e.playerScoreTwice=t.PLAYER_SCORE_TWICE,e}};var jl=class{remapPredictions=null;constructor(t,e){this.remapPredictions=new Bi(t,e)}remapResponse=t=>{let e=new Ks;return e.matchId=t.match_id,e.matchType=t.match_type,e.predictions=this.remapPredictions.remapPredictionModel(t.predictions),e}};var Yl=class extends et{remapPaginatedGames=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapGamesListResponse(i)),e};remapGamesListResponse=t=>{let e=new Tt;return e.id=t.id,e.title=t.title,e.description=t.description,e.type=t.type,e.status=t.status,e.authRequirement=t.auth_requirement||null,e.scheduleOpenAt=t.schedule_open_at,e.predictionsCutoff=t.predictions_cutoff,e.fixtures=t.fixtures.map(i=>this.remapFixturesResponse(i)),e.tiebreaker=t.tiebreaker?this.remapTimeTiebreaker(t.tiebreaker.time_tiebreaker):null,e.participantsCount=t.participants_count,e.related=t.related?this.remapRelated(t.related):[],e.excludedProfileIds=t.excluded_profile_ids,e.rules=t.rules,e.labels=t.labels,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.flags=t.flags,e.images=t.images,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapGameByIdResponse=t=>{let e=new si;return e.id=t.id,e.title=t.title,e.description=t.description,e.type=t.type,e.status=t.status,e.authRequirement=t.auth_requirement||null,e.scheduleOpenAt=t.schedule_open_at,e.predictionsCutoff=t.predictions_cutoff,e.fixtures=t.fixtures.map(i=>this.remapFixturesResponse(i)),e.tiebreaker=t.tiebreaker?this.remapTimeTiebreaker(t.tiebreaker.time_tiebreaker):null,e.participantsCount=t.participants_count,e.related=t.related?this.remapRelated(t.related):[],e.excludedProfileIds=t.excluded_profile_ids,e.rules=t.rules,e.flags=t.flags,e.adContent=t.ad_content,e.labels=t.labels,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.images=t.images,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapFixturesResponse=t=>{let e=new ln;return e.matchId=t.match_id,e.matchType=t.match_type,e.market=t.market,e.matchStatus.type=t.match_status?t.match_status.type:null,e.matchStatus.subType=t.match_status?t.match_status.sub_type:null,e};remapPaginatedUserTopXEditions=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapUserTopXEditionsResponse(i)),e};remapUserTopXEditionsResponse=t=>{let e=new Ht;return e.id=t.id,e.title=t.title,e.description=t.description,e.type=t.type,e.status=t.status,e.authRequirement=t.auth_requirement||null,e.predictionsCutoff=t.predictions_cutoff,e.scheduleOpenAt=t.schedule_open_at,e.fixtures=t.fixtures.map(i=>this.remapTopXFixturesResponse(i)),e.tiebreaker=t.tiebreaker?this.remapTimeTiebreaker(t.tiebreaker.time_tiebreaker):null,e.participantsCount=t.participants_count,e.related=t.related?this.remapRelated(t.related):[],e.excludedProfileIds=t.excluded_profile_ids,e.rules=t.rules,e.flags=t.flags,e.images=t.images,e.branding=t.branding?this.remapBranding(t.branding):null,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapTopXFixturesResponse=t=>{let e=new cn;return e.matchId=t.match_id,e.matchType=t.match_type,e.market=t.market,e.matchStatus.type=t.match_status?t.match_status.type:null,e.matchStatus.subType=t.match_status?t.match_status.sub_type:null,e};remapPaginatedUserMathQuizEditions=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapUserMatchQuizEditionsResponse(i)),e};remapUserMatchQuizEditionsResponse=t=>{let e=new Pt;return e.id=t.id,e.title=t.title,e.description=t.description,e.type=t.type,e.status=t.status,e.authRequirement=t.auth_requirement||null,e.predictionsCutoff=t.predictions_cutoff,e.scheduleOpenAt=t.schedule_open_at,e.fixtures=t.fixtures.map(i=>this.remapMatchQuizFixturesResponse(i)),e.tiebreaker=t.tiebreaker?this.remapTimeTiebreaker(t.tiebreaker.time_tiebreaker):null,e.participantsCount=t.participants_count,e.related=t.related?this.remapRelated(t.related):[],e.excludedProfileIds=t.excluded_profile_ids,e.rules=t.rules,e.flags=t.flags,e.images=t.images,e.branding=t.branding?this.remapBranding(t.branding):null,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapMatchQuizFixturesResponse=t=>{let e=new No;return e.matchId=t.match_id,e.matchType=t.match_type,e.market=t.market,e.matchStatus.type=t.match_status?t.match_status.type:null,e.matchStatus.subType=t.match_status?t.match_status.sub_type:null,e};remapPaginatedGameResults=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapGameResults(i)),e};remapGameResults=t=>{let e=new Jt;return e.userId=t.user_id,e.points=t.points?t.points:0,e.results=t.results.map(i=>this.remapResults(i)),e.tiebreaker=t.tiebreaker?this.remapTiebreaker(t.tiebreaker):null,e};remapGameMarketsResults=t=>{let e=new ko;return e.gameId=t.game_id,e.results=this.remapMarketsResults(t.results),e.tieBreakers=t.tie_breakers?this.remapTieBreakers(t.tie_breakers):null,e};remapContestWinners=t=>{let e=new dn;return e.contestId=t.contest_id,e.contestType=t.contest_type,e.description=t.description,e.userList=t.user_list?t.user_list.map(i=>this.remapUserListWinners(i)):null,e};remapUserListWinners=t=>{let e=new mn;return e.position=t.position,e.profileId=t.profile_id,e.note=t.note,e.tags=t.tags,e};remapTieBreakers=t=>{let e={goldenGoals:[]};return e.goldenGoals=t.golden_goals.map(i=>({minute:i.minute,matchId:i.match_id,matchModel:null,playerId:i.player_id,playerModel:null,goalType:i.goal_type})),e};remapMarketsResults=t=>{let e=[];return t.forEach(i=>{let a={matchId:i.match_id,market:i.market,result:this.remapMarketResult(i.market,i.result),matchModel:null,playerModels:[],matchStatus:this.remapMarketsResultsMatchStatus(i.match_status)};e.push(this.deleteUnusefulField(a))}),e};remapMarketsResultsMatchStatus=t=>{let e=new X;return t&&(e.type=t.type,e.subType=t.sub_type),e};remapMarketResult=(t,e)=>{if(Iu.includes(t))return e[0];if(It.includes(t))return e;if(e[0]==="true")return!0;if(e[0]==="false")return!1};deleteUnusefulField=t=>((!It.includes(t.market)||this.isPlayerMarketWithNoResult(t.market,t.result))&&delete t.playerModels,t);isPlayerMarketWithNoResult=(t,e)=>It.includes(t)&&e.length===0;remapResults=t=>{let e=new un;return e.matchId=t.match_id,e.outcome=t.outcome,e};remapTiebreaker=t=>{let e=new bt;return e.goldenGoal=t.golden_goal,e};remapTimeTiebreaker=t=>{let e=new yt;return e.timeTiebreaker=t,e};remapRelated=t=>t.map(e=>{let i=new z;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i})};var Xl=class{remapMetaData=t=>{let e=new y;return e.pagination.nextPageStartsAfter=t.pagination.next_page_starts_after,e.pagination.itemsPerPage=t.pagination.items_per_page,e}};var mt=class extends v{predictionRemapper=null;matchSummaryRemapper=null;gamesRemapper=null;metaRemapper=null;idMapping=null;constructor(t){super(t,O(t.environment,"predictor")),this.idMapping=new R(t),this.predictionRemapper=new Bi(t,this.idMapping),this.matchSummaryRemapper=new jl(t,this.idMapping),this.gamesRemapper=new Yl,this.metaRemapper=new Xl}makeFootballPrediction=async t=>{let e=`/predictions${this.apiSignInUrl}`,i="There was a problem making POST request",a="POST",r=await this.fetchWithAuth(e,i,a,this.predictionRemapper.remapRequestBody(t));return await this.predictionRemapper.remapResponseObjBody(r)};getMatchSummary=async(t,e)=>{let i=f(e)?`/predictions/summary/${t}${this.apiSignInUrl}${m()}`:`/predictions/summary/${t}${this.apiSignInUrl}`,a=`There was a problem fetching predictions for match: ${t}`,r=await this.fetchWithoutAuth(i,a);return this.matchSummaryRemapper.remapResponse(r)};deleteFootballPrediction=async t=>{let e=`/predictions/${t}${this.apiSignInUrl}`,i=`There was a problem deleting your prediction: ${t}`,a="DELETE";return await this.fetchWithAuth(e,i,a),!0};getMyPredictions=async t=>{let e=new H,i=`/predictions${this.apiSignInUrl}`,a="There was a problem fetching own predictions";t&&(i+=`${t.constructFiltersUrl()}`);let r=await this.fetchWithAuth(i,a);return e.meta=this.metaRemapper.remapMetaData(r.meta),e.data=await this.predictionRemapper.remapResponseArrayBody(r.data),e};getMyPredictionsNoRemap=async t=>{let e=`/predictions${this.apiSignInUrl}${t.constructFiltersUrl()}`,i="There was a problem fetching own predictions";return await this.fetchWithAuth(e,i)};getUserPredictions=async(t,e,i)=>{let a=new H,r=f(e)?`/predictions/users/${t}${this.apiSignInUrl}${m()}`:`/predictions/users/${t}${this.apiSignInUrl}`,o=`There was a problem fetching predictions for user: ${t}`;i&&(r+=`${i.constructFiltersUrl()}`);let n=await this.fetchWithoutAuth(r,o);return a.meta=this.metaRemapper.remapMetaData(n.meta),a.data=await this.predictionRemapper.remapResponseArrayBody(n.data),a};getUserPredictionsNoRemap=async(t,e)=>{let i=`/predictions/users/${t}${this.apiSignInUrl}${e.constructFiltersUrl()}`,a=`There was a problem fetching predictions for user: ${t}`;return await this.fetchWithoutAuth(i,a)};getGames=async(t,e)=>{let i=f(e)?`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}${m()}`:`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}`,a="There was a problem fetching the games list",r=await this.fetchWithoutAuth(i,a);return this.gamesRemapper.remapPaginatedGames(r)};getGamesNoRemap=async(t,e)=>{let i=f(e)?`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}${m()}`:`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}`,a="There was a problem fetching the games list";return await this.fetchWithoutAuth(i,a)};getGameById=async(t,e)=>{let i=f(e)?`/games/${t}${this.apiSignInUrl}${m()}`:`/games/${t}${this.apiSignInUrl}`,a=`There was a problem fetching the following game: ${t}`,r=await this.fetchWithoutAuth(i,a);return this.gamesRemapper.remapGameByIdResponse(r)};getGamePredictions=async(t,e,i)=>{let a=new H,r=f(e)?`/games/${t}/predictions${this.apiSignInUrl}${m()}`:`/games/${t}/predictions${this.apiSignInUrl}`,o=`There was a problem fetching the predictions for game: ${t}`;i&&(r+=`${i.constructFiltersUrl()}`);let n=await this.fetchWithoutAuth(r,o);return a.meta=this.metaRemapper.remapMetaData(n.meta),a.data=await this.predictionRemapper.remapResponseArrayBody(n.data),a};getUserGameEditions=async(t,e)=>{let i=null,a=f(e)?`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}${m()}`:`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}`,r="There was a problem fetching the games list",o=await this.fetchWithoutAuth(a,r);return o.data.forEach(n=>{n.type==="TOP_X"?i=this.gamesRemapper.remapPaginatedUserTopXEditions(o):n.type==="MATCH_QUIZ"&&(i=this.gamesRemapper.remapPaginatedUserMathQuizEditions(o))}),i};getGameResults=async(t,e,i)=>{let a=f(e)?`/games/${t}/results/${this.apiSignInUrl}${m()}`:`/games/${t}/results/${this.apiSignInUrl}`,r=`There was a problem fetching the results for the following game: ${t}`;i&&(a+=`${i.constructMainFiltersUrl()}`);let o=await this.fetchWithoutAuth(a,r);return this.gamesRemapper.remapPaginatedGameResults(o)};getMarketResultsForGame=async(t,e)=>{let i=`/games/${t}/correct-results/${this.apiSignInUrl}`,a=`There was a problem fetching the markets correct results for the following game: ${t}`;f(e)&&(i+=`${m()}`);let r=await this.fetchWithoutAuth(i,a);return this.gamesRemapper.remapGameMarketsResults(r.data)};getContestWinners=async(t,e)=>{let i=`/winners/${this.apiSignInUrl}&contest_id=${t}`,a=`There was a problem fetching winners for the following game: ${t}`;e&&(i+=m());let r=await this.fetchWithoutAuth(i,a);return this.gamesRemapper.remapContestWinners(r)};getPredictionById=async t=>{let e=`/predictions/${t}${this.apiSignInUrl}`,i=`There was a problem fetching info for the following prediction: ${t}`,a=await this.fetchWithoutAuth(e,i);return(await this.predictionRemapper.remapResponseArrayBody([a.data]))[0]};getPredictionsByIds=async t=>{let e=`/predictions/by-ids${this.apiSignInUrl}&prediction_ids=${t.join(",")}`,i="There was a problem fetching predictions",a=await this.fetchWithoutAuth(e,i);return await this.predictionRemapper.remapResponseArrayBody(a.data)}};var ee=class{errorHandlingMode=null;constructor(t){this.errorHandlingMode=t}validateBodyFields=(t,e)=>{let i=Object.keys(e),a=Object.keys(new ei);switch(t){case"MATCH_QUIZ":i.forEach(l=>{a.includes(l)||this.throwInvalidParamException([l])});break;case"TOP_X":let o=e;o.fixtures.forEach(l=>this.validateMarketTopX(l.market));let n="tiebreaker";i.includes(n)&&o.tiebreaker&&this.validateTiebreaker(o.tiebreaker),i.forEach(l=>{l!=="tiebreaker"&&!a.includes(l)&&this.throwInvalidParamException([l])});break}let r=a.filter(o=>!i.includes(o));return r.length&&this.throwMissingFieldsException("game prediction body",r),e.fixtures.forEach(o=>{this.validateFixtureFields(o)}),e};validateFixture=(t,e,i,a)=>{this.validateMarket(e);let r=Object.values(Ll),o=Object.values(Bl),n=Object.values(Dl);if(e==="FT_1X2"||e==="HT_1X2"){if(r.includes(i))return new Vs(t,e,i)}else if(e==="HT_FT"){if(o.includes(i))return new Gs(t,i)}else if(e==="DOUBLE_CHANCE"){if(n.includes(i))return new Ns(t,i)}else if(e==="CORRECT_SCORE"||e==="CORRECT_SCORE_ADVANCED"||e==="CORRECT_SCORE_HT"){if(typeof i=="string"&&/\d+:\d+/.test(i))return new Vt(t,e,i)}else if(e==="CORNERS_MATCH"){if(typeof i=="number")return new Ls(t,i)}else if(e==="BOTH_TEAMS_SCORE"){if(this.isPredictionBoolean(i))return new Os(t,i)}else if(e==="RED_CARD_MATCH"){if(this.isPredictionBoolean(i))return new zs(t,i)}else if(e==="PENALTY_MATCH"){if(this.isPredictionBoolean(i))return new Hs(t,i)}else if(It.includes(e)){let l="OWN_GOAL";if(this.validatePlayerId(e,a),e===ji&&this.isPredictionBoolean(i)){let p=a&&a===l?l:a;return new st(t,e,i,p)}if(a&&this.isPredictionBoolean(i))return new st(t,e,i,a)}else if(bu.includes(e)){if(this.isPredictionBoolean(i))return new Ze(t,e,i)}else if(Mu.includes(e)&&this.isPredictionBoolean(i))return new Je(t,e,i);this.throwInvalidPredictionException(i,e)};validateFixtureFields=t=>{let e=Object.keys(t);e.forEach(a=>{eu.includes(a)||this.throwInvalidParamException([a])});let i=eu.filter(a=>{if(a!=="matchType"&&!e.includes(a))return a});i.length&&this.throwMissingFieldsException("fixtures",i),this.validatePredictionKey(t.market,t.prediction)};validateTiebreaker=t=>{let e=Object.keys(t);(!e.length||typeof t!="object")&&this.throwInvalidType("tiebreaker","object");let i=Object.keys(new bt)[0];e.forEach(a=>{i!==a&&this.throwInvalidParamException([a])}),e.includes(i)||this.throwMissingFieldsException("tiebreaker",[i]),typeof t.goldenGoal!="number"&&this.throwInvalidType("goldenGoal","number")};validatePredictionKey=(t,e)=>{if(typeof e=="object"){let i=Object.keys(e),a=["value"];if(i.length||this.throwMissingFieldsException("prediction",a),i.length===1&&!i.includes(a[0])&&this.throwInvalidParamException(i),i.length>1){It.includes(t)&&a.push("playerId");let r=i.filter(o=>!a.includes(o));r.length&&this.throwInvalidParamException(r)}}else this.throwInvalidType("prediction","object")};validatePlayerId=(t,e)=>{let i="playerId";t!==ji&&(e||this.throwInvalidParamException([i]),typeof e!="string"&&this.throwInvalidType(i,"string"))};validateMarket=t=>{Object.values(rt).includes(t)||this.throwInvalidMarketException(t)};validateMarketTopX=t=>{t!=="CORRECT_SCORE"&&t!=="CORRECT_SCORE_ADVANCED"&&this.throwInvalidMarketException(t,"TOP_X")};isPredictionBoolean=t=>typeof t=="boolean";throwInvalidPredictionException=(t,e)=>{let i=Pu(t,e);throw this.errorHandlingMode==="default"?new b(400,"INVALID_PREDICTION",i):new h(400,"INVALID_TYPE",i)};throwInvalidMarketException=(t,e)=>{let i=null;throw e&&e==="TOP_X"?i=Tu(t):i=Zp(t),this.errorHandlingMode==="default"?new b(400,"INVALID_MARKET",i):new h(400,"INVALID_TYPE",i)};throwInvalidParamException=t=>{let e=Eu(t);throw this.errorHandlingMode==="default"?new b(400,"INVALID_FIELD",e):new h(400,"INVALID_TYPE",e)};throwMissingFieldsException=(t,e)=>{let i=Ru(t,e);throw this.errorHandlingMode==="default"?new b(400,"INVALID_FIELD",i):new h(400,"INVALID_TYPE",i)};throwInvalidType=(t,e)=>{let i=Fu(t,e);throw this.errorHandlingMode==="default"?new b(400,"INVALID_TYPE",i):new h(400,"INVALID_TYPE",i)}};var ie=class{predictorHttps=null;predictorService=null;idMapping=null;clientHttps=null;predictorValidator=null;errorHandlingMode=null;constructor(t){this.predictorValidator=new ee(t.errorHandlingMode),this.idMapping=new R(t),this.predictorHttps=new mt(t),this.predictorService=new St(t,this.idMapping),this.clientHttps=new Q(t),this.errorHandlingMode=t.errorHandlingMode}getConfig=async()=>{let t=await this.clientHttps.getConfig("matchQuiz");return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(t):t};play=async t=>{t=this.predictorValidator.validateBodyFields("MATCH_QUIZ",t);let e=t.fixtures.map(i=>this.predictorValidator.validateFixture(i.matchId,i.market,i.prediction.value,i.prediction.playerId));if(e&&e.length&&this.idMapping.idSchema!=="native"){let i=[],a=[];e.forEach(n=>{i.push(n.matchId),n instanceof st&&n.prediction.playerId&&n.prediction.playerId!=="OWN_GOAL"&&a.push(n.prediction.playerId)});let r=await this.predictorService.remapMatchIdToNative(i),o={};a&&a.length>0&&(o=await this.predictorService.remapPlayerIdMapToNative(a)),e.forEach((n,l)=>{n.matchId=r[l],n instanceof st&&n.prediction.playerId!=="OWN_GOAL"&&(n.prediction.playerId=o[n.prediction.playerId])})}return t.fixtures=e,await this.predictorHttps.makeFootballPrediction(t)};delete=async t=>await this.predictorHttps.deleteFootballPrediction(t);getGames=async(t,e)=>{e=e||!1;let i=this.predictorService.initGameFilters("MATCH_QUIZ",t),a=await this.predictorHttps.getGames(i,e);return await this.predictorService.remapMatchIdsFixtures(a)};getGamesNoRemap=async(t,e)=>{e=e||!1;let i=this.predictorService.initGameFilters("MATCH_QUIZ",t);return await this.predictorHttps.getGamesNoRemap(i,e)};getGameById=async(t,e)=>{e=e||!1;let i=await this.predictorHttps.getGameById(t,e);return await this.predictorService.remapMatchIdsFixtures(i)};getGamePredictions=async(t,e,i)=>(i=i||!1,e&&(e.type&&delete e.type,e.status&&delete e.status,e=new V(e)),await this.predictorHttps.getGamePredictions(t,i,e));getGameResults=async(t,e,i)=>{i=i||!1,e&&(e=new I(e));let a=await this.predictorHttps.getGameResults(t,i,e);return await this.predictorService.remapMatchIdsFixtures(a)};getCurrentGameResults=async t=>{t=t||!1;let e=new nt(null);e.status="OPEN",e.type="MATCH_QUIZ";let i=await this.predictorHttps.getGames(e,t),a=this.predictorService.getCurrentGameId(i);return(await this.getGameResults(a,null,t)).data[0]};getMyGameEditions=async(t,e)=>{t&&t.limit&&this.validateLimitFilterOnGames(t.limit),e=e||!1;let i=this.predictorService.initGameTypePredictions("MATCH_QUIZ",t),a=[],r=await this.predictorHttps.getMyPredictionsNoRemap(i);if(r.data.length>0){r.data.forEach(p=>{p.game_instance_id&&a.push(p.game_instance_id)});let o=t?.limit?{limit:t.limit}:null,n=this.predictorService.initGameFilters("MATCH_QUIZ",o,a),l=await this.predictorHttps.getUserGameEditions(n,e);return await this.predictorService.addPredictionProp(r,l)}else return new H};getMyGamePrediction=async t=>{let e=new V({gameIds:[t]}),i=await this.predictorHttps.getMyPredictions(e);if(i.data.length>0){let a=i.data.filter(r=>r.gameInstanceId===t);return a.length?a[0]:null}return null};getUserGameEditions=async(t,e,i)=>{e&&e.limit&&this.validateLimitFilterOnGames(e.limit),i=i||!1;let a=this.predictorService.initGameTypePredictions("MATCH_QUIZ",e),r=[],o=await this.predictorHttps.getUserPredictionsNoRemap(t,a);if(o.data.length>0){o.data.forEach(c=>{c.game_instance_id&&r.push(c.game_instance_id)});let n=e?.limit?{limit:e.limit}:null,l=this.predictorService.initGameFilters("MATCH_QUIZ",n,r),p=await this.predictorHttps.getUserGameEditions(l,i);return await this.predictorService.addPredictionProp(o,p)}else return new H};getUserGamePrediction=async(t,e,i)=>{i=i||!1;let a=new V({gameIds:[e]}),r=await this.predictorHttps.getUserPredictions(t,i,a);if(r.data.length>0){let o=r.data.filter(n=>n.gameInstanceId===e);return o.length?o[0]:null}else return null};getMarketsResultsForGame=async(t,e)=>{let i=await this.predictorHttps.getMarketResultsForGame(t,e);return await this.predictorService.completeGameMarketResults(i,"MATCH_QUIZ")};getGameWinners=async(t,e)=>{let i=await this.predictorHttps.getContestWinners(t,e),a=await this.getGameById(t);return i.contestModel=a,this.predictorService.completeContestWinners(i)};validateLimitFilterOnGames=t=>{if(this.errorHandlingMode==="default"&&t>50)throw new b(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.");if(this.errorHandlingMode==="standard"&&t>50)throw new h(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.")}};var Jl=class extends et{remapClassicQuizzes=t=>(t.meta.pagination=this.remapMetaPagination(t.meta.pagination),t.data=t.data.map(e=>this.remapBasicClassicQuiz(e)),t);remapClassicQuizById=t=>{let e=new Uo;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.participationCount=t.participation_count,e.questionsCount=t.questions_count,e.status=t.status,e.language=t.language,e.authRequirement=t.auth_requirement,e.flags=t.flags,e.adContent=t.ad_content,e.rules=t.rules,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.labels=t.labels,e.time=t.time,e.points=t.points,e.related=t.related?this.remapRelated(t.related):[],e.scored=t.scored,e.maxAttempts=t.max_attempts,e.context=t.context?this.remapContext(t.context):t.context,e.averageScore=t.average_score,e.perfectScore=t.perfect_score,e.questions=t.questions.map(i=>this.remapQuestions(i)),e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapClassicQuizParticipation=t=>{let e=new $o;return e.classicQuizId=t.classic_quiz_id,e.userId=t.user_id,e.questions=t.questions?t.questions.map(i=>this.remapParticipationQuestions(i)):null,e.correctOptions=t.correct_options,e.personalBest=t.personal_best,e.points=t.points,e.attempts=t.attempts,e};remapClassicQuizParticipationBody=t=>t.map(e=>({question_id:e.questionId,option_id:e.optionId}));remapUserClassicQuizParticipationsWithPagination=t=>{let e=new Qo;return e.meta.pagination=this.remapMetaPagination(t.meta.pagination),e.data=t.data.map(i=>{let a=new Ri;return a.classicQuizId=i.classic_quiz_id,a.correct=i.correct,a.classicQuizQuestions=i.classic_quiz_questions,a.personalBest=i.personal_best,a.points=i.points,a.attempts=i.attempts,a.answers=i.answers?i.answers.map(r=>this.remapParticipationQuestions(r)):i.answers,a}),e};remapUserClassicQuizParticipations=t=>t.map(e=>{let i=new Ri;return i.classicQuizId=e.classic_quiz_id,i.correct=e.correct,i.classicQuizQuestions=e.classic_quiz_questions,i.personalBest=e.personal_best,i.points=e.points,i.attempts=e.attempts,i.answers=e.answers?e.answers.map(a=>this.remapParticipationQuestions(a)):e.answers,i});remapClassicQuizzesLeaderboard=t=>(t.meta=this.remapClassicQuizLeaderboardMeta(t.meta),t.data=t.data.map(e=>this.remapClassicQuizLeaderboard(e)),t);remapClassicQuizUserRankings=t=>(t.meta.pagination=this.remapMetaPaginationRank(t.meta.pagination),t.data=t.data.map(e=>this.remapClassicQuizUserRanking(e)),t);remapClassicQuizQuestionsReport=t=>t.map(e=>{let i=new qo;return i.questionId=e.question_id,i.correct=e.correct,i.wrong=e.wrong,i.skipped=e.skipped,i.total=e.total,i});remapClassicQuizResultsSummary=t=>t.map(e=>{let i=new ls;return i.questions=e.questions,i.correctAnswers=e.correct_answers,i});remapMetaPagination=t=>{let e=new ut;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapClassicQuizLeaderboardMeta=t=>{let e=new We;return e.pagination=this.remapMetaPaginationRank(t.pagination),e.filters=this.remapLeaderboardMetaFilters(t.filters),e};remapMetaPaginationRank=t=>{let e=new Y;return e.currentPage=t.current_page,e.itemsPerPage=t.items_per_page,e.numberOfPages=t.number_of_pages,e.totalItems=t.total_items,e};remapLeaderboardMetaFilters=t=>{let e=new Qe;return e.classicQuizIds=t?.classic_quiz_ids||null,e};remapClassicQuizUserRanking=t=>{let e=new jo;return e.position=t.position,e.classicQuizId=t.classic_quiz_id,e.points=t.points,e};remapBasicClassicQuiz=t=>{let e=new ze;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.participationCount=t.participation_count,e.questionsCount=t.questions_count,e.status=t.status,e.language=t.language,e.authRequirement=t.auth_requirement,e.flags=t.flags,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.labels=t.labels,e.time=t.time,e.related=t.related?this.remapRelated(t.related):[],e.averageScore=t.average_score,e.perfectScore=t.perfect_score,e.points=t.points,e.scored=t.scored,e.maxAttempts=t.max_attempts,e.context=t.context?this.remapContext(t.context):t.context,e.adContent=t.ad_content,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapQuestions=t=>{let e=new Vo;return e.questionId=t.question_id,e.question=t.question,e.images=t.images,e.embedCode=t.embed_code,e.explanation=t.explanation,e.options=t.options.map(i=>this.remapOptions(i)),e};remapOptions=t=>{let e=new Ho;return e.optionId=t.option_id,e.option=t.option,e.images=t.images,e.correct=t.correct,e};remapParticipationQuestions=t=>{let e=new zo;return e.questionId=t.question_id,e.optionId=t.option_id,e.correct=t.correct,e.correctOptionId=t.correct_option_id,e};remapClassicQuizLeaderboard=t=>{let e=new Ko;return e.position=t.position,e.profileId=t.profile_id,e.points=t.points,e};remapContext=t=>{let e=new Gt;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new Ut;return a.id=i.id,a.type=i.type,a.source=i.source,a}):null,e.campaign=t.campaign,e};remapRelated=t=>t.map(e=>{let i=new z;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i})};var Zl=class extends et{remapEitherOrs=t=>(t.meta.pagination=this.remapMetaPagination(t.meta.pagination),t.data=t.data.map(e=>this.remapBasicEitherOr(e)),t);remapEitherOrById=t=>{let e=new Xo;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.status=t.status,e.language=t.language,e.authRequirement=t.auth_requirement,e.winningCondition=t.winning_condition,e.lives=t.lives,e.flags=t.flags,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.labels=t.labels,e.time=t.time,e.related=t.related?this.remapRelated(t.related):[],e.context=t.context?this.remapContext(t.context):t.context,e.points=t.points?t.points.map(i=>this.remapPoints(i)):t.points,e.rules=t.rules,e.adContent=t.ad_content,e.totalParticipationsCount=t.total_participations_count,e.totalUsersCount=t.total_users_count,e.finishedParticipationsCount=t.finished_participations_count,e.averageStartedParticipationsCount=t.average_started_participations_count,e.averageFinishedParticipationsCount=t.average_finished_participations_count,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapEitherOrOwnStats=t=>{let e=new Zo;return e.eitherOrId=t.either_or_id,e.personalBest=t.personal_best,e.betterThan=t.better_than,e};remapEitherOrResults=t=>{let e=new ss;return e.standings=t.standings?t.standings.map(i=>this.remapResultsStandings(i)):t.standings,e.breakdown=t.breakdown?t.breakdown.map(i=>this.remapResultsBreakdown(i)):t.breakdown,e};remapEitherOrParticipation=t=>{let e=new ts;return e.instanceId=t.instance_id,e.eitherOrId=t.either_or_id,e.gameStartedAt=t.game_started_at,e.currentStep=t.current_step,e.currentStreak=t.current_streak,e.remainingSteps=t.remaining_steps,e.currentLives=t.current_lives,e.currentPoints=t.current_points,e.personalBest=t.personal_best,e.participationCount=t.participation_count,e.finishedParticipationsCount=t.finished_participations_count,e.steps=t.steps?t.steps.map(i=>this.remapParticipationSteps(i)):t.steps,e};remapBasicEitherOr=t=>{let e=new Ke;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.status=t.status,e.language=t.language,e.winningCondition=t.winning_condition,e.authRequirement=t.auth_requirement,e.lives=t.lives,e.flags=t.flags,e.related=t.related?this.remapRelated(t.related):[],e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.labels=t.labels,e.adContent=t.ad_content,e.context=t.context?this.remapContext(t.context):t.context,e.time=t.time,e.points=t.points?t.points.map(i=>this.remapPoints(i)):t.points,e.totalParticipationsCount=t.total_participations_count,e.totalUsersCount=t.total_users_count,e.finishedParticipationsCount=t.finished_participations_count,e.averageStartedParticipationsCount=t.average_started_participations_count,e.averageFinishedParticipationsCount=t.average_finished_participations_count,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapMetaPagination=t=>{let e=new ut;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapPoints=t=>{let e=new Jo;return e.correctSteps=t.correct_steps,e.score=t.score,e};remapResultsStandings=t=>{let e=new ns;return e.userId=t.user_id,e.personalBest=t.personal_best,e};remapResultsBreakdown=t=>{let e=new os;return e.rangeStartInclusive=t.range_start_inclusive,e.rangeEndInclusive=t.range_end_inclusive,e.totalUsers=t.total_users,e};remapParticipationSteps=t=>{let e=new rs;return e.pairId=t.pair_id,e.userSelection=t.user_selection,e.correct=t.correct,e.played=t.played,e.timestamp=t.timestamp,e.optionOne=t.option_one,e.optionTwo=t.option_two,e};remapContext=t=>{let e=new Gt;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new Ut;return a.id=i.id,a.type=i.type,a.source=i.source,a}):null,e.campaign=t.campaign,e};remapRelated=t=>t.map(e=>{let i=new z;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i})};var tp=class extends et{remapPersonalityQuizzes=t=>(t.meta.pagination=this.remapMetaPagination(t.meta.pagination),t.data=t.data.map(e=>this.remapBasicPersonalityQuiz(e)),t);remapPersonalityQuizById=t=>{let e=new ms;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.images=t.images,e.participationCount=t.participation_count,e.status=t.status,e.language=t.language,e.authRequirement=t.auth_requirement,e.flags=t.flags,e.adContent=t.ad_content,e.preferencesEnabled=t.preferences_enabled||!1,e.rules=t.rules||null,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.labels=t.labels,e.time=t.time,e.related=t.related?this.remapRelated(t.related):[],e.maxAttempts=t.max_attempts,e.context=t.context?this.remapContext(t.context):t.context,e.questions=t.questions?t.questions.map(i=>this.remapQuestions(i)):[],e.personaResults=t.persona_results?t.persona_results.map(i=>this.remapPersonaResults(i)):[],e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPersonalityQuizParticipation=t=>{let e=new fs;return e.personalityQuizId=t.personality_quiz_id,e.userId=t.user_id,e.questions=t.questions?this.remapParticipationQuestions(t.questions):[],e.personas=t.personas?this.remapParticipationPersonas(t.personas):[],e.attempts=t.attempts,e};remapUserPersonalityQuizParticipations=t=>{let e=new Ms;return e.meta.pagination=this.remapMetaPagination(t.meta.pagination),e.data=t.data.map(i=>this.remapPersonalityQuizParticipation(i)),e};remapParticipationQuestions=t=>t.map(e=>{let i=new gs;return i.questionId=e.question_id,i.optionId=e.option_id,i});remapParticipationPersonas=t=>t.map(e=>{let i=new ys;return i.personaId=e.persona_id,i.percent=e.percent,i});remapPersonalityQuizParticipationBody=t=>t.map(e=>({question_id:e.questionId,option_id:e.optionId}));remapMetaPagination=t=>{let e=new ut;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapBasicPersonalityQuiz=t=>{let e=new je;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.images=t.images,e.participationCount=t.participation_count,e.status=t.status,e.language=t.language,e.authRequirement=t.auth_requirement,e.flags=t.flags,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.labels=t.labels,e.time=t.time,e.related=t.related?this.remapRelated(t.related):[],e.maxAttempts=t.max_attempts,e.preferencesEnabled=t.preferences_enabled||!1,e.context=t.context?this.remapContext(t.context):t.context,e.adContent=t.ad_content,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPersonaResults=t=>{let e=new ps;return e.personaId=t.persona_id,e.title=t.title,e.description=t.description,e.images=t.images,e};remapQuestions=t=>{let e=new cs;return e.questionId=t.question_id,e.question=t.question,e.images=t.images,e.explanation=t.explanation,e.options=t.options.map(i=>this.remapOptions(i)),e};remapOptions=t=>{let e=new ds;return e.optionId=t.option_id,e.option=t.option,e.images=t.images,e.preferenceMapping=t.preference_mapping?this.remapPreferencesMapping(t.preference_mapping):[],e.personaPoints=t.persona_points?this.remapPersonaPoints(t.persona_points):[],e};remapPreferencesMapping=t=>t.map(e=>{let i=new ci;return i.preferenceId=e.preference_id,i});remapPersonaPoints=t=>t.map(e=>{let i=new us;return i.personaId=e.persona_id,i.points=e.points,i});remapContext=t=>{let e=new Gt;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new Ut;return a.id=i.id,a.type=i.type,a.source=i.source,a}):null,e.campaign=t.campaign,e};remapRelated=t=>t.map(e=>{let i=new z;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i})};var Ni=class extends v{classicQuizRemapper=null;eitherOrRemapper=null;personalityQuizRemapper=null;constructor(t){super(t,O(t.environment,"miniGames")),this.classicQuizRemapper=new Jl,this.eitherOrRemapper=new Zl,this.personalityQuizRemapper=new tp}getClassicQuizzes=async(t,e)=>{let i=`/classic-quizzes${this.apiSignInUrl}`;t&&(i+=t.constructMainFiltersUrl()),i+=f(e)?m():"";let a="There was a problem with fetching classic quizzes",r=await this.fetchWithoutAuth(i,a);return this.classicQuizRemapper.remapClassicQuizzes(r)};getClassicQuizById=async(t,e,i)=>{let a=`/classic-quizzes/${t}${this.apiSignInUrl}`;e&&(a+=`&include_correct_options=${e}`),f(i)&&(a+=m());let r="There was a problem with fetching classic quiz by ID",o=await this.fetchWithoutAuth(a,r);return this.classicQuizRemapper.remapClassicQuizById(o.data)};participateInClassicQuiz=async(t,e,i)=>{let a=`/classic-quizzes/${t}/participate${this.apiSignInUrl}`,r=`There was a problem with participating in the following classic quiz: ${t}`,o="POST",n={questions:this.classicQuizRemapper.remapClassicQuizParticipationBody(e),include_correct_options:!!i},l=await this.fetchWithAuth(a,r,o,n);return this.classicQuizRemapper.remapClassicQuizParticipation(l.data)};getMyClassicQuizParticipations=async(t,e)=>{let i=`/classic-quizzes/participations${this.apiSignInUrl}`;t&&(i+=`${t.constructMainFiltersUrl()}`);let a="There was a problem with fetching user's own Classic Quiz participations",r=await this.fetchWithAuth(i,a);return e?this.classicQuizRemapper.remapUserClassicQuizParticipationsWithPagination(r):this.classicQuizRemapper.remapUserClassicQuizParticipations(r.data)};getLeaderboardForClassicQuizzes=async(t,e)=>{let i=`/classic-quizzes/rank${this.apiSignInUrl}`;t&&(i+=`${t.constructMainFiltersUrl()}`),i+=f(e)?m():"";let a="There was a problem with fetching classic quizzes leaderboard",r=await this.fetchWithoutAuth(i,a);return this.classicQuizRemapper.remapClassicQuizzesLeaderboard(r)};getClassicQuizzesUserRanking=async(t,e,i)=>{let a=`/classic-quizzes/users/${t}/rank${this.apiSignInUrl}`;e&&(a+=`${e.constructMainFiltersUrl()}`),a+=f(i)?m():"";let r="There was a problem with fetching user's rankings for classic quizzes",o=await this.fetchWithoutAuth(a,r);return this.classicQuizRemapper.remapClassicQuizUserRankings(o)};getClassicQuizQuestionsReport=async t=>{let e=`/classic-quizzes/${t}/questions-report${this.apiSignInUrl}`,i=`There was a problem with fetching questions report for quiz: ${t}`,a=await this.fetchWithoutAuth(e,i);return this.classicQuizRemapper.remapClassicQuizQuestionsReport(a.data)};getClassicQuizResultsSummary=async(t,e)=>{let i=`/classic-quizzes/${t}/results-summary${this.apiSignInUrl}`;f(e)&&(i+=m());let a="There was a problem with fetching classic quiz results summary",r=await this.fetchWithoutAuth(i,a);return this.classicQuizRemapper.remapClassicQuizResultsSummary(r.data)};getEitherOrs=async(t,e)=>{let i=`/either-or${this.apiSignInUrl}`;t&&(i+=t.constructMainFiltersUrl()),i+=f(e)?m():"";let a="There was a problem with fetching list of Either/Ors",r=await this.fetchWithoutAuth(i,a);return this.eitherOrRemapper.remapEitherOrs(r)};getEitherOrById=async(t,e)=>{let i=`/either-or/${t}${this.apiSignInUrl}`;f(e)&&(i+=m());let a="There was a problem with fetching Either/Or by ID",r=await this.fetchWithoutAuth(i,a);return this.eitherOrRemapper.remapEitherOrById(r.data)};getMyEitherOrStats=async t=>{let e=`/either-or/${t}/own-stats${this.apiSignInUrl}`,i="There was a problem with fetching Either/Or own statistics",a=await this.fetchWithAuth(e,i);return this.eitherOrRemapper.remapEitherOrOwnStats(a.data)};getEitherOrResults=async(t,e)=>{let i=`/either-or/${t}/results${this.apiSignInUrl}${f(e)?m():""}`,a="There was a problem with fetching Either/Or results",r=await this.fetchWithoutAuth(i,a);return this.eitherOrRemapper.remapEitherOrResults(r.data)};participateInEitherOr=async(t,e)=>{let i=`/either-or/${t}/participate${this.apiSignInUrl}`,a="There was a problem with participating in Either/Or",r="POST",o=await this.fetchWithAuth(i,a,r,e);return this.eitherOrRemapper.remapEitherOrParticipation(o.data)};getPersonalityQuizzes=async(t,e)=>{let i=`/personality-quizzes${this.apiSignInUrl}`;t&&(i+=t.constructMainFiltersUrl()),i+=f(e)?m():"";let a="There was a problem with fetching personality quizzes",r=await this.fetchWithoutAuth(i,a);return this.personalityQuizRemapper.remapPersonalityQuizzes(r)};getPersonalityQuizById=async(t,e)=>{let i=`/personality-quizzes/${t}${this.apiSignInUrl}`;f(e)&&(i+=m());let a="There was a problem with fetching personality quiz by ID",r=await this.fetchWithoutAuth(i,a);return this.personalityQuizRemapper.remapPersonalityQuizById(r.data)};participateInPersonalityQuiz=async(t,e)=>{let i=`/personality-quizzes/${t}/participate${this.apiSignInUrl}`,a=`There was a problem with participating in the following personality quiz: ${t}`,r="POST",o={questions:this.personalityQuizRemapper.remapPersonalityQuizParticipationBody(e)},n=await this.fetchWithAuth(i,a,r,o);return this.personalityQuizRemapper.remapPersonalityQuizParticipation(n.data)};getPersonalityQuizUserParticipation=async(t,e,i)=>{let a=`/personality-quizzes/${t}/participations/${e}${this.apiSignInUrl}`;f(i)&&(a+=m());let r="There was a problem with fetching user personality quiz participation",o=await this.fetchWithoutAuth(a,r);return this.personalityQuizRemapper.remapPersonalityQuizParticipation(o.data)};getMyPersonalityQuizParticipations=async t=>{let e=`/personality-quizzes/participations${this.apiSignInUrl}`;t&&(e+=`${t.constructMainFiltersUrl()}`);let i="There was a problem with fetching user's own Personality Quiz participations",a=await this.fetchWithAuth(e,i);return this.personalityQuizRemapper.remapUserPersonalityQuizParticipations(a)}};var ae=class extends K{entityTypes=["competition","team","player"];constructor(t){super(t.errorHandlingMode)}validateFilters=t=>{!t.entityIds&&!t.entityType||(t.entityIds&&!t.entityType&&this.throwException(400,"invalid_filters","You need to use both 'entityIds' and 'entityType' filters together"),!t.entityIds&&t.entityType&&this.throwException(400,"invalid_filters","You need to use both 'entityIds' and 'entityType' filters together"),this.entityTypes.includes(t.entityType)||this.throwException(400,"invalid_filters","Invalid 'entityType' filter. Please use one of the following valid options: competition, team, or player"))}};var ep=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(t){this.idSchema=t.idSchema,this.idMapping=new R(t),this.validator=new ae(t),this.profile=new D(t),this.football=new it(t),this.https=new Ni(t)}finalizeMiniGamesFilters=async t=>{if(this.idSchema!=="native"&&t.entityIds&&t.entityIds.length>0){this.validator.validateFilters(t);let e=await this.idMapping.getEntityIdsBySchemaId(Array.from(t.entityIds),t.entityType,"native");t.entityIds=e[t.entityType]}};setProfileModelsForEitherOrStandings=async t=>{let e=t.standings.map(a=>a.userId);if(!e.length)return t;let i=await this.profile.getByIds(e);return t.standings.forEach(a=>a.userModel=i.find(r=>r.id===a.userId)||null),t};setProfileModelsForClassicQuizLeaderboards=async t=>{let e=t.map(a=>a.profileId);if(!e.length)return t;let i=await this.profile.getByIds(e);return t.forEach(a=>a.profileModel=i.find(r=>r.id===a.profileId)||null),t};defaultEitherOrParticipation=async(t,e)=>{if(!e){let r=await this.https.getEitherOrById(t,!0);this.eitherOrTime=r.time;let o=await this.https.participateInEitherOr(t,null);return this.participationStartTimestamp=Date.now(),o}let i=0;if(this.participationStartTimestamp)i=(Date.now()-this.participationStartTimestamp)/1e3;else{if(!this.eitherOrTime){let r=await this.https.getEitherOrById(t,!0);this.eitherOrTime=r.time}i=this.eitherOrTime+1}let a=this.createNewParticipation(i,e);try{let r=await this.https.participateInEitherOr(t,a);return!r.currentLives||!r.remainingSteps?this.resetDefaultParticipationTimers():this.participationStartTimestamp=Date.now(),r}catch(r){throw this.resetDefaultParticipationTimers(),r}};handleEitherOrParticipationWithCallback=async(t,e,i)=>e?await this.eitherOrParticipationWithCallback(t,e,i):await this.initialEitherOrParticipationWithCallback(t,i);initialEitherOrParticipationWithCallback=async(t,e)=>{let i=await this.https.getEitherOrById(t,!0);this.eitherOrTime=i.time;let a=await this.https.participateInEitherOr(t,null);return this.participationStartTimestamp=Date.now(),this.countdownTimer=this.eitherOrTime,this.setCurrentPairId(a),await this.handleEitherOrParticipationCallbackInterface(t,e),a};eitherOrParticipationWithCallback=async(t,e,i)=>{this.intervalId&&clearInterval(this.intervalId);let a=0;if(this.participationStartTimestamp)a=(Date.now()-this.participationStartTimestamp)/1e3;else{if(!this.eitherOrTime){let o=await this.https.getEitherOrById(t,!0);this.eitherOrTime=o.time}a=this.eitherOrTime+1}let r=this.createNewParticipation(a,e);try{let o=await this.https.participateInEitherOr(t,r);return!o.currentLives||!o.remainingSteps?(this.resetCallbackParticipationTimers(),i.onElapsedResponse(o),clearInterval(this.intervalId)):(this.participationStartTimestamp=Date.now(),this.countdownTimer=this.eitherOrTime,this.setCurrentPairId(o),await this.handleEitherOrParticipationCallbackInterface(t,i)),o}catch(o){throw this.resetCallbackParticipationTimers(),clearInterval(this.intervalId),o}};setCurrentPairId=t=>{this.currentPairId=t.steps.find(e=>!e.played).pairId||""};handleEitherOrParticipationCallbackInterface=async(t,e)=>{this.intervalId=setInterval(async()=>{if(this.countdownTimer>0)this.countdownTimer--,e.onTimerTick(this.countdownTimer);else{clearInterval(this.intervalId);let i=(Date.now()-this.participationStartTimestamp)/1e3,a={pair:this.currentPairId,answer:this.currentPairId.split("_")[0]},r=this.createNewParticipation(i,a),o=await this.eitherOrParticipationWithCallback(t,r,e);e.onElapsedResponse(o)}},1e3)};createNewParticipation=(t,e)=>{let i=new is;return i.expired=t>this.eitherOrTime,i.time=Number(t.toFixed(3)),i.pair=e.pair,i.answer=e.answer,i};resetCallbackParticipationTimers=()=>{this.resetDefaultParticipationTimers(),this.countdownTimer=0,this.currentPairId=""};resetDefaultParticipationTimers=()=>{this.eitherOrTime=0,this.participationStartTimestamp=0};setContextTagsModels=async t=>{let e={competitions:[],teams:[],players:[]};if(t.forEach(i=>{i.context&&i.context.tags&&i.context.tags.length>0&&(e.competitions=[...e.competitions,...this.extractEntityIdsFromTags(i.context.tags,"competition")],e.competitions=Array.from(new Set(e.competitions)),e.teams=[...e.teams,...this.extractEntityIdsFromTags(i.context.tags,"team")],e.teams=Array.from(new Set(e.teams)),e.players=[...e.players,...this.extractEntityIdsFromTags(i.context.tags,"player")],e.players=Array.from(new Set(e.players)))}),e.competitions.length){let i=await this.football.footballFacade.getCompetitionsMapWithNativeIds(e.competitions);this.setModelsForContextTags(t,i,"competition")}if(e.teams.length){let i=await this.football.footballFacade.getTeamsMapWithNativeIds(e.teams);this.setModelsForContextTags(t,i,"team")}if(e.players.length){let i=await this.football.footballFacade.getPlayersMapWithNativeIds(e.players);this.setModelsForContextTags(t,i,"player")}};extractEntityIdsFromTags=(t,e)=>t.filter(i=>i.type===e).map(i=>i.id);setModelsForContextTags=(t,e,i)=>{t.forEach(a=>{a.context&&a.context.tags&&a.context.tags.length>0&&a.context.tags.forEach(r=>{r.type===i&&(r.model=i==="player"?e[r.id]:e.get(r.id),r.id=r.model.id)})})};setQuestionModelsInQuestionsReport=async(t,e)=>t.map(i=>(i.questionModel=e.questions.find(a=>a.questionId.toString()===i.questionId),i))};var ip=class{https=null;service=null;activityService=null;idSchema=null;constructor(t){this.https=new Ni(t),this.service=new ep(t),this.activityService=new wt(t),this.idSchema=t.idSchema}getClassicQuizzes=async(t,e,i)=>{t&&(t=new Go(t),await this.service.finalizeMiniGamesFilters(t));let a=await this.https.getClassicQuizzes(t,i);if(e)await this.service.setContextTagsModels(a.data);else for(let r of a.data)await this.remapTags(r,"native",this.idSchema);return a};getClassicQuizById=async(t,e,i)=>{let a=await this.https.getClassicQuizById(t,e,i);return await this.service.setContextTagsModels([a]),a};participateInClassicQuiz=async(t,e,i)=>await this.https.participateInClassicQuiz(t,e,i);getMyClassicQuizParticipations=async t=>{t&&(t=new Ei(t));let i=await this.https.getMyClassicQuizParticipations(t,!1),a=i.map(o=>o.classicQuizId),r=await this.getClassicQuizzes({classicQuizIds:a});return i.forEach(o=>{o.classicQuizModel=r.data.find(n=>n.id===o.classicQuizId)||null}),i};getMyClassicQuizParticipationsWithPagination=async t=>{t&&(t=new Ei(t));let i=await this.https.getMyClassicQuizParticipations(t,!0),a=i.data.map(o=>o.classicQuizId),r=await this.getClassicQuizzes({classicQuizIds:a});return i.data.forEach(o=>{o.classicQuizModel=r.data.find(n=>n.id===o.classicQuizId)||null}),i};getLeaderboardForClassicQuizzes=async(t,e)=>{t&&(t=new Wo(t));let i=await this.https.getLeaderboardForClassicQuizzes(t,e);return i.data=await this.service.setProfileModelsForClassicQuizLeaderboards(i.data),i};getClassicQuizzesUserRanking=async(t,e,i)=>{e&&(e=new qe(e));let a=await this.https.getClassicQuizzesUserRanking(t,e,i),r=a.data.map(n=>n.classicQuizId),o=await this.getClassicQuizzes({classicQuizIds:r});return a.data=a.data.map(n=>{let l=o.data.find(p=>p.id===n.classicQuizId)||null;return{...n,classicQuizModel:l}}),a};getClassicQuizQuestionsReport=async(t,e)=>{e=e||!1;let i=await this.https.getClassicQuizQuestionsReport(t),a=await this.getClassicQuizById(t,e,!0);return this.service.setQuestionModelsInQuestionsReport(i,a)};getClassicQuizResultsSummary=async(t,e)=>await this.https.getClassicQuizResultsSummary(t,e);getEitherOrs=async(t,e,i)=>{t&&(t=new Yo(t),await this.service.finalizeMiniGamesFilters(t));let a=await this.https.getEitherOrs(t,i);if(e)await this.service.setContextTagsModels(a.data);else for(let r of a.data)await this.remapTags(r,"native",this.idSchema);return a};getEitherOrById=async(t,e)=>{let i=await this.https.getEitherOrById(t,e);return await this.service.setContextTagsModels([i]),i};getMyEitherOrStats=async t=>await this.https.getMyEitherOrStats(t);getEitherOrResults=async(t,e)=>{let i=await this.https.getEitherOrResults(t,e);return await this.service.setProfileModelsForEitherOrStandings(i)};participateInEitherOr=async(t,e,i)=>i?await this.service.handleEitherOrParticipationWithCallback(t,e,i):await this.service.defaultEitherOrParticipation(t,e);calculateEitherOrResultPercentile=async(t,e)=>{if(e==null||isNaN(e)||e<0)return null;if(e===0)return e;let i=await this.getEitherOrResults(t,!0),a=i.breakdown.reduce((o,n)=>o+n.totalUsers,0),r=0;for(let o of i.breakdown)if(r+=o.totalUsers,e>=o.rangeStartInclusive&&e<=o.rangeEndInclusive)return parseFloat((r/a*100).toFixed(1));return null};getPersonalityQuizzes=async(t,e,i)=>{t&&(t=new hs(t),await this.service.finalizeMiniGamesFilters(t));let a=await this.https.getPersonalityQuizzes(t,i);if(e)await this.service.setContextTagsModels(a.data);else for(let r of a.data)await this.remapTags(r,"native",this.idSchema);return a};getPersonalityQuizById=async(t,e)=>{let i=await this.https.getPersonalityQuizById(t,e);return await this.service.setContextTagsModels([i]),i};participateInPersonalityQuiz=async(t,e)=>await this.https.participateInPersonalityQuiz(t,e);getPersonalityQuizUserParticipation=async(t,e,i)=>await this.https.getPersonalityQuizUserParticipation(t,e,i);getMyPersonalityQuizParticipations=async t=>(t&&(t=new bs(t)),await this.https.getMyPersonalityQuizParticipations(t));remapTags=async(t,e,i)=>{if(this.idSchema!="native"&&t.context&&t.context.tags&&t.context.tags.length){let a=JSON.parse(JSON.stringify(t.context.tags)),r=await this.activityService.remapTagsIds(a,e,i);t.context.tags=r}}};var re=class{facade=null;constructor(t){this.facade=new ip(t)}getClassicQuizzes=async(t,e,i)=>await this.facade.getClassicQuizzes(t,e,i);getClassicQuizById=async(t,e,i)=>await this.facade.getClassicQuizById(t,e,i);participateInClassicQuiz=async(t,e,i)=>await this.facade.participateInClassicQuiz(t,e,i);getMyClassicQuizParticipations=async t=>await this.facade.getMyClassicQuizParticipations(t);getMyClassicQuizParticipationsWithPagination=async t=>await this.facade.getMyClassicQuizParticipationsWithPagination(t);getLeaderboardForClassicQuizzes=async(t,e)=>await this.facade.getLeaderboardForClassicQuizzes(t,e);getClassicQuizzesUserRanking=async(t,e,i)=>await this.facade.getClassicQuizzesUserRanking(t,e,i);getClassicQuizQuestionsReport=async(t,e)=>await this.facade.getClassicQuizQuestionsReport(t,e);getClassicQuizResultsSummary=async(t,e)=>await this.facade.getClassicQuizResultsSummary(t,e);getEitherOrs=async(t,e,i)=>await this.facade.getEitherOrs(t,e,i);getEitherOrById=async(t,e)=>await this.facade.getEitherOrById(t,e);getMyEitherOrStats=async t=>await this.facade.getMyEitherOrStats(t);getEitherOrResults=async(t,e)=>await this.facade.getEitherOrResults(t,e);participateInEitherOr=async(t,e,i)=>await this.facade.participateInEitherOr(t,e,i);calculateEitherOrResultPercentile=async(t,e)=>await this.facade.calculateEitherOrResultPercentile(t,e);getPersonalityQuizzes=async(t,e,i)=>await this.facade.getPersonalityQuizzes(t,e,i);getPersonalityQuizById=async(t,e)=>await this.facade.getPersonalityQuizById(t,e);participateInPersonalityQuiz=async(t,e)=>await this.facade.participateInPersonalityQuiz(t,e);getPersonalityQuizUserParticipation=async(t,e,i)=>await this.facade.getPersonalityQuizUserParticipation(t,e,i);getMyPersonalityQuizParticipations=async t=>await this.facade.getMyPersonalityQuizParticipations(t)};var oe=class{idMapping=null;predictorHttps=null;predictorService=null;predictorValidator=null;clientHttps=null;errorHandlingMode=null;constructor(t){this.idMapping=new R(t),this.errorHandlingMode=t.errorHandlingMode,this.predictorValidator=new ee(t.errorHandlingMode),this.predictorHttps=new mt(t),this.predictorService=new St(t,this.idMapping),this.clientHttps=new Q(t)}getConfig=async()=>{let t=await this.clientHttps.getConfig("topX");return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(t):t};getGames=async(t,e)=>{e=e||!1;let i=this.predictorService.initGameFilters("TOP_X",t),a=await this.predictorHttps.getGames(i,e);return await this.predictorService.remapMatchIdsFixtures(a)};getGamesNoRemap=async(t,e)=>{e=e||!1;let i=this.predictorService.initGameFilters("TOP_X",t);return await this.predictorHttps.getGamesNoRemap(i,e)};getGameById=async(t,e)=>{e=e||!1;let i=await this.predictorHttps.getGameById(t,e);return await this.predictorService.remapMatchIdsFixtures(i)};getGamePredictions=async(t,e,i)=>(i=i||!1,e&&(e.type&&delete e.type,e.status&&delete e.status,e=new V(e)),await this.predictorHttps.getGamePredictions(t,i,e));getGameResults=async(t,e,i)=>{i=i||!1,e&&(e=new nt(e));let a=await this.predictorHttps.getGameResults(t,i,e);return await this.predictorService.remapMatchIdsFixtures(a)};getCurrentGameResults=async t=>{t=t||!1;let e=new nt(null);e.status="OPEN",e.type="TOP_X";let i=await this.predictorHttps.getGames(e,t),a=this.predictorService.getCurrentGameId(i);return(await this.getGameResults(a,null,t)).data[0]};play=async t=>{let e=new ni(t);if(e=this.predictorValidator.validateBodyFields("TOP_X",e),e.fixtures=e.fixtures.map(a=>this.predictorValidator.validateFixture(a.matchId,a.market,a.prediction.value)),this.idMapping.idSchema!=="native"){let a=[];e.fixtures.forEach(o=>a.push(o.matchId));let r=await this.predictorService.remapMatchIdToNative(a);e.fixtures.forEach(o=>o.matchId=r.shift())}let i=await this.predictorHttps.makeFootballPrediction(e);return i.fixtures.forEach(a=>{a.matchId=a.matchModel.id}),i};delete=async t=>await this.predictorHttps.deleteFootballPrediction(t);getMyGameEditions=async(t,e)=>{t&&t.limit&&this.validateLimitFilterOnGames(t.limit),e=e||!1;let i=this.predictorService.initGameTypePredictions("TOP_X",t),a=[],r=await this.predictorHttps.getMyPredictionsNoRemap(i);if(r.data.length>0){r.data.forEach(p=>{p.game_instance_id&&a.push(p.game_instance_id)});let o=t?.limit?{limit:t.limit}:null,n=this.predictorService.initGameFilters("TOP_X",o,a),l=await this.predictorHttps.getUserGameEditions(n,e);return await this.predictorService.addPredictionProp(r,l)}else return new H};getMyGamePrediction=async t=>{let e=new V({gameIds:[t]}),i=await this.predictorHttps.getMyPredictions(e);if(i.data.length>0){let a=i.data.filter(r=>r.gameInstanceId===t);return a.length?a[0]:null}return null};getUserGameEditions=async(t,e,i)=>{e&&e.limit&&this.validateLimitFilterOnGames(e.limit),i=i||!1;let a=this.predictorService.initGameTypePredictions("TOP_X",e),r=[],o=await this.predictorHttps.getUserPredictionsNoRemap(t,a);if(o.data.length>0){o.data.forEach(c=>{c.game_instance_id&&r.push(c.game_instance_id)});let n=e?.limit?{limit:e.limit}:null,l=this.predictorService.initGameFilters("TOP_X",n,r),p=await this.predictorHttps.getUserGameEditions(l,i);return await this.predictorService.addPredictionProp(o,p)}else return new H};getUserGamePrediction=async(t,e,i)=>{i=i||!1;let a=new V({gameIds:[e]}),r=await this.predictorHttps.getUserPredictions(t,i,a);if(r.data.length>0){let o=r.data.filter(n=>n.gameInstanceId===e);return o.length?o[0]:null}else return null};getMarketsResultsForGame=async(t,e)=>{let i=await this.predictorHttps.getMarketResultsForGame(t,e);return await this.predictorService.completeGameMarketResults(i,"TOP_X")};getGameWinners=async(t,e)=>{let i=await this.predictorHttps.getContestWinners(t,e),a=await this.getGameById(t);return i.contestModel=a,this.predictorService.completeContestWinners(i)};validateLimitFilterOnGames=t=>{if(this.errorHandlingMode==="default"&&t>50)throw new b(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.");if(this.errorHandlingMode==="standard"&&t>50)throw new h(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.")}};var ap=class{idMappingService=null;profileNamespace=null;footballNamespace=null;topXFacade=null;matchQuizFacade=null;miniGamesNamespace=null;errorHandlingMode=null;constructor(t){this.idMappingService=new R(t),this.profileNamespace=new D(t),this.footballNamespace=new it(t),this.topXFacade=new oe(t),this.matchQuizFacade=new ie(t),this.miniGamesNamespace=new re(t),this.errorHandlingMode=t.errorHandlingMode}remapTemplatesIds=async t=>{if(t.length>0){let e=[],i=[],a=[],r=[],o=[],n=[];t.forEach(c=>{c.teamIds&&c.teamIds.length>0&&(e=[...e,...c.teamIds]),c.matchIds&&c.matchIds.length>0&&(a=[...a,...c.matchIds]),c.competitionIds&&c.competitionIds.length>0&&(o=[...o,...c.competitionIds])});let l={team:e,match:a,competition:o},p=await this.idMappingService.idMappingFacade.getEntitiesByIds(l,"native",this.idMappingService.idSchema);return i=[...p.team],r=[...p.match],n=[...p.competition],t.forEach(c=>{c.teamIds&&c.teamIds.length>0&&(c.teamIds=c.teamIds.map(u=>u=p.team.shift())),c.matchIds&&c.matchIds.length>0&&(c.matchIds=c.matchIds.map(u=>u=p.match.shift())),c.competitionIds&&c.competitionIds.length>0&&(c.competitionIds=c.competitionIds.map(u=>u=p.competition.shift()))}),t}return t};remapTemplateGroupMatchIds=async t=>{if(t&&t.length>0){for(let e of t)if(!(!e.filters.matchIds||!e.filters.matchIds.every(a=>a))&&e.filters.matchIds.length>0){let a={match:Array.from(e.filters.matchIds)},r=await this.idMappingService.idMappingFacade.getEntitiesByIds(a,"native",this.idMappingService.idSchema);e.filters.matchIds=Array.from(r.match)}}};addProfileModelToLeaderboard=async t=>{if(t.length>0){let e=[],i=t.map(r=>r.profileId);if(!i.length)return t;let a=await this.profileNamespace.getByIds(i);return t.forEach(r=>{a.forEach(o=>{o.id===r.profileId&&(delete o.interests,r.profileModel=o)}),r.profileModel||(r.profileModel=null),e.push(r)}),e}return t};buildOldClientBadges=t=>{let e=new wo;return e.general=this.extractEnabledBadgesId(t.general),e.predictor=this.extractEnabledBadgesId(t.predictor),e.topX=this.extractEnabledBadgesId(t.topX),e.matchQuiz=this.extractEnabledBadgesId(t.matchQuiz),e};buildNewClientBadges=t=>{let e=new _o;return e.predictor=this.extractEnabledBadgesId(t.predictor),e.topX=this.extractEnabledBadgesId(t.topX),e.matchQuiz=this.extractEnabledBadgesId(t.matchQuiz),e.games=this.extractEnabledBadgesId(t.games),e.football=this.extractEnabledBadgesId(t.football),e.classicQuizzes=this.extractEnabledBadgesId(t.classicQuizzes),e.eitherOr=this.extractEnabledBadgesId(t.eitherOr),e.discussions=this.extractEnabledBadgesId(t.discussions),e.potm=this.extractEnabledBadgesId(t.voting.potm),e.poll=this.extractEnabledBadgesId(t.voting.poll),e};initFilters=(t,e)=>{switch(e){case"loyalty":t&&(t=new Eo(t));break;case"rankings":t&&(t=new Ro(t));break;case"league_leaderboard":t&&(t=new To(t))}return t};addProfileModelToHighestSuccessRate=async t=>{let e=t.map(a=>a.profileId);if(!e.length)return t;let i=await this.profileNamespace.getByIds(e);return t.map(a=>(i.forEach(r=>{r.id===a.profileId&&(delete r.interests,a.profileModel=r)}),a))};extractRankingsIdsMap=t=>{let e=[],i=[],a=[];return t.forEach(r=>{r.rankType==="GAME"&&r.gameType==="TOP_X"?e.push(r.id):r.rankType==="GAME"&&r.gameType==="MATCH_QUIZ"?i.push(r.id):r.rankType==="TEMPLATE"&&a.push(r.id)}),[e,i,a]};setModelsForUserRankings=(t,e,i,a)=>(a.data.forEach(r=>{r.gameType==="MATCH_QUIZ"&&e?r.model=e.filter(o=>o.id===r.id)[0]:r.gameType==="TOP_X"&&t?r.model=t.filter(o=>o.id===r.id)[0]:r.rankType==="TEMPLATE"&&i&&(r.model=i.filter(o=>o.id===r.id)[0])}),a);completeContestWinners=async t=>{if(t.userList&&t.userList.length){let e=t.userList.map(a=>a.profileId),i=await this.profileNamespace.getByIds(e);t.userList.forEach(a=>{let r=i.filter(o=>o.id===a.profileId)[0];delete r.interests,a.profileModel=r})}return t};validateEntitiesFollowsFilters=t=>{if(!t||(!t.footballCompetitions||!t.footballCompetitions.length)&&(!t.footballTeams||!t.footballTeams.length)&&(!t.footballPlayers||!t.footballPlayers.length))throw this.errorHandlingMode==="default"?new b(400,"invalid_filters","At least one of footballCompetitions, footballTeams or footballPlayers properties should be provided for filters."):new h(400,"invalid_filters","At least one of footballCompetitions, footballTeams or footballPlayers properties should be provided for filters.");if(t.footballCompetitions&&t.footballCompetitions.length>24||t.footballTeams&&t.footballTeams.length>24||t.footballPlayers&&t.footballPlayers.length>24)throw this.errorHandlingMode==="default"?new b(400,"EXCEEDED_LENGTH","Maximum length per entity should be 24 or less."):new h(400,"EXCEEDED_LENGTH","Maximum length per entity should be 24 or less.")};remapEntitiesFollowsFilters=async t=>{let e=JSON.parse(JSON.stringify(t)),i={},a={};e.footballCompetitions&&e.footballCompetitions.length&&(a.competition=e.footballCompetitions),e.footballTeams&&e.footballTeams.length&&(a.team=e.footballTeams),e.footballPlayers&&e.footballPlayers.length&&(a.player=e.footballPlayers);let r=await this.idMappingService.idMappingFacade.getEntitiesByIds(a,this.idMappingService.idSchema,"native");return Object.keys(r).forEach(o=>{o==="competition"?i.footballCompetitions=r[o]:o==="team"?i.footballTeams=r[o]:o==="player"&&(i.footballPlayers=r[o])}),i};addModelsToEntitiesFollows=async t=>{let e=[],i="fb:c:",a=new Map,r=[],o="fb:t:",n=new Map,l=[],p="fb:p:",c=null;return t.breakdown.forEach(u=>{u.id.includes(i)?e.push(u.id):u.id.includes(o)?r.push(u.id):u.id.includes(p)&&l.push(u.id)}),e.length&&(a=await this.footballNamespace.footballFacade.competitionsFacade.getCompetitionsMapWithNativeIds(e)),r.length&&(n=await this.footballNamespace.footballFacade.teamsFacade.getTeamsMapWithNativeIds(r)),l.length&&(c=await this.footballNamespace.footballFacade.playerFacade.getPlayersMapWithNativeIds(l)),t.breakdown.forEach(u=>{u.id.includes(i)?(u.model=a.get(u.id),u.id=u.model.id):u.id.includes(o)?(u.model=n.get(u.id),u.id=u.model.id):u.id.includes(p)&&(u.model=c[u.id],u.id=u.model.id)}),t};getMatchIdsFromGamesInTemplates=async(t,e)=>{if(t&&t.length>0){let o=qt(t,100),n=[];if(e&&e.length===1){if(e.includes("TOP_X"))try{n=(await Promise.all(o.map(c=>this.topXFacade.getGamesNoRemap({gameIds:c,limit:c.length},!0)))).reduce((c,u)=>[...c,...u.data],[])}catch(p){throw console.error("There was a problem fetching match IDs from Top X games",p),p}if(e.includes("MATCH_QUIZ"))try{n=(await Promise.all(o.map(c=>this.matchQuizFacade.getGamesNoRemap({gameIds:c,limit:c.length},!0)))).reduce((c,u)=>[...c,...u.data],[])}catch(p){throw console.error("There was a problem fetching match IDs from Match Quiz games",p),p}}try{n=(await Promise.all(o.map(c=>{let u=this.topXFacade.getGamesNoRemap({gameIds:c,limit:c.length},!0),d=this.matchQuizFacade.getGamesNoRemap({gameIds:c,limit:c.length},!0);return Promise.all([u,d])}))).reduce((c,[u,d])=>[...c,...u.data,...d.data],[])}catch(p){throw console.error("There was a problem fetching match IDs from both Top X and Match Quiz games",p),p}let l=new Set;return n.forEach(p=>{p.fixtures.map(u=>u.match_id).forEach(u=>l.add(u))}),Array.from(l)}let i=[],a=100;try{for(let o of e){let n=!0,l="",p=0;for(;n;){let c,u={limit:a,startAfter:l};o==="TOP_X"?(c=await this.topXFacade.getGamesNoRemap(u,!0),i=[...i,...c.data],l=c.meta.pagination.next_page_starts_after||null):o==="MATCH_QUIZ"&&(c=await this.matchQuizFacade.getGamesNoRemap(u,!0),i=[...i,...c.data],l=c.meta.pagination.next_page_starts_after||null),n=!!l,p++,p>=5&&(n=!1)}}let r=new Set;return i.forEach(o=>{o.fixtures.map(l=>l.match_id).forEach(l=>r.add(l))}),Array.from(r)}catch(r){throw console.error("There was a problem fetching match IDs from games",r),r}};initMatchFiltersForTemplates=async(t,e)=>{let i=[],a=[],r=[],o=t.fromDate?this.reformatDate(t.fromDate):null,n=t.toDate?this.reformatDate(t.toDate,!0):null,l=500;if(t.competitionIds&&t.competitionIds.length>0&&(i=Array.from(t.competitionIds)),t.teamIds&&t.teamIds.length>0&&(a=Array.from(t.teamIds)),t.matchIds&&t.matchIds.length>0&&(r=Array.from(t.matchIds)),this.isGameTemplate(t)&&(r=await this.getMatchIdsFromGamesInTemplates(t.gameIds,t.gameTypes)),e){let c=t.groups.find(d=>d.groupId===e);if(!c)throw this.errorHandlingMode==="default"?new b(400,"invalid_template_group_id","There is no group in this template with the provided groupId"):new h(400,"invalid_template_group_id","There is no group in this template with the provided groupId");if(!c.filters)throw this.errorHandlingMode==="default"?new b(400,"invalid_template_group_filters","The provided template group has no filters"):new h(400,"invalid_template_group_filters","The provided template group has no filters");o=c.filters.fromDate?this.reformatDate(c.filters.fromDate):null,n=c.filters.toDate?this.reformatDate(c.filters.toDate,!0):null;let u=c.filters.matchIds.every(d=>d);c.filters.matchIds.length>0&&u&&(r=Array.from(c.filters.matchIds))}return new gt({competitionIds:i,teamIds:a,matchIds:r,fromDate:o,toDate:n,limit:l})};isGameTemplate=t=>!!(t.gameIds&&t.gameIds.length>0||t.gameTypes&&t.gameTypes.length>0&&(t.gameTypes.includes("TOP_X")||t.gameTypes.includes("MATCH_QUIZ")));reformatDate=(t,e)=>{let i=new Date(t);e&&i.setUTCHours(23,59,59);let a=i.toISOString();return a=a.slice(0,-5)+"Z",a};extractEnabledBadgesId=t=>{let e=[];return t.forEach(i=>{i.enabled&&e.push(i.id)}),e};addEntityModelToFootballBadges=async t=>{let e=[],i=[],a=[],r=[];if(t.football&&t.football.length>0&&(e=t.football.filter(n=>n.requirements.entityType.toLocaleLowerCase()==="competition").map(n=>n.requirements.entityId),i=t.football.filter(n=>n.requirements.entityType.toLocaleLowerCase()==="team").map(n=>n.requirements.entityId),a=t.football.filter(n=>n.requirements.entityType.toLocaleLowerCase()==="player").map(n=>n.requirements.entityId),r=t.football.filter(n=>n.requirements.entityType.toLocaleLowerCase()==="match").map(n=>n.requirements.entityId)),t.voting&&t.voting.poll&&t.voting.poll.length>0){let[n,l,p,c]=this.extractEntityIdsFromBadges(t.voting.poll);e=e.concat(n),e=Array.from(new Set(e)),i=i.concat(l),i=Array.from(new Set(i)),a=a.concat(p),a=Array.from(new Set(a)),r=r.concat(c),r=Array.from(new Set(r))}if(t.voting&&t.voting.potm&&t.voting.potm.length>0){let[n,l,p,c]=this.extractEntityIdsFromBadges(t.voting.potm);e=e.concat(n),e=Array.from(new Set(e)),i=i.concat(l),i=Array.from(new Set(i)),a=a.concat(p),a=Array.from(new Set(a)),r=r.concat(c),r=Array.from(new Set(r))}let o=await this.fetchFootballEntities(e,i,a,r);t.football&&t.football.length>0&&t.football.forEach(n=>{this.setEntityModelsFromMap(n.requirements,"competition",o.competitions),this.setEntityModelsFromMap(n.requirements,"team",o.teams),this.setEntityModelsFromObject(n.requirements,"player",o.players),this.setEntityModelsFromObject(n.requirements,"match",o.matches)}),t.voting&&t.voting.poll&&t.voting.poll.length>0&&t.voting.poll.forEach(n=>{this.setEntityModelsFromMap(n.requirements,"competition",o.competitions),this.setEntityModelsFromMap(n.requirements,"team",o.teams),this.setEntityModelsFromObject(n.requirements,"player",o.players),this.setEntityModelsFromObject(n.requirements,"match",o.matches)}),t.voting&&t.voting.potm&&t.voting.potm.length>0&&t.voting.potm.forEach(n=>{this.setEntityModelsFromMap(n.requirements,"competition",o.competitions),this.setEntityModelsFromMap(n.requirements,"team",o.teams),this.setEntityModelsFromObject(n.requirements,"player",o.players),this.setEntityModelsFromObject(n.requirements,"match",o.matches)})};setEntityModelsFromMap=(t,e,i)=>{t.entityType===e&&(t.entityModel=i&&i.get(t.entityId)||null,t.entityModel&&(t.entityId=t.entityModel.id))};setEntityModelsFromObject=(t,e,i)=>{t.entityType===e&&(t.entityModel=i[t.entityId]?i[t.entityId]:null,t.entityModel&&(t.entityId=t.entityModel.id))};fetchFootballEntities=async(t,e,i,a)=>{let r={competitions:null,teams:null,players:null,matches:null};if(t.length){let o=await this.footballNamespace.footballFacade.getCompetitionsMapWithNativeIds(t);r.competitions=o}if(e.length){let o=await this.footballNamespace.footballFacade.getTeamsMapWithNativeIds(e);r.teams=o}if(i.length){let o=await this.footballNamespace.footballFacade.getPlayersMapWithNativeIds(i);r.players=o}if(a.length){let o=await this.footballNamespace.footballFacade.getMatchesMapWithNativeIds(a);r.matches=o}return r};extractEntityIdsFromBadges=t=>{let e=t.filter(o=>o.requirements.entityType&&o.requirements.entityType.toLocaleLowerCase()==="competition").map(o=>o.requirements.entityId),i=t.filter(o=>o.requirements.entityType&&o.requirements.entityType.toLocaleLowerCase()==="team").map(o=>o.requirements.entityId),a=t.filter(o=>o.requirements.entityType&&o.requirements.entityType.toLocaleLowerCase()==="player").map(o=>o.requirements.entityId),r=t.filter(o=>o.requirements.entityType&&o.requirements.entityType.toLocaleLowerCase()==="match").map(o=>o.requirements.entityId);return[e,i,a,r]};addGameModelToGamesBadges=async t=>{if(!t.games||t.games.length===0)return;let e=this.getGameIdsFromGamesBadge(t.games,"top_x"),i=this.getGameIdsFromGamesBadge(t.games,"match_quiz"),a=this.getGameIdsFromGamesBadge(t.games,"classic_quiz"),r=this.getGameIdsFromGamesBadge(t.games,"either_or"),o=await this.fetchGamesEntities(e,i,a,r);t.games.forEach(n=>{n.requirements.specificGames&&n.requirements.specificGames.forEach(l=>{l.gameModel=o.find(p=>p.id===l.gameId)||null})})};getGameIdsFromGamesBadge=(t,e)=>{let i=t.filter(a=>a.requirements.specificGames?a.requirements.specificGames.some(r=>r.gameType.toLocaleLowerCase()===e):!1).map(a=>a.requirements.specificGames.map(r=>r.gameId));return Array.prototype.concat.apply([],i)};fetchGamesEntities=async(t,e,i,a)=>{let r=[];if(t.length){let o=await this.topXFacade.getGames({gameIds:t});r=[...r,...o.data]}if(e.length){let o=await this.matchQuizFacade.getGames({gameIds:e});r=[...r,...o.data]}if(i.length){let o=await this.miniGamesNamespace.getClassicQuizzes({classicQuizIds:i});r=[...r,...o.data]}if(a.length){let o=await this.miniGamesNamespace.getEitherOrs({eitherOrIds:a});r=[...r,...o.data]}return r}};var rp=class{validate=(t,e)=>{t.market&&this.validateMarket(t.market,e),t.fromDate&&this.validateDate(t.fromDate,"fromDate",e),t.toDate&&this.validateDate(t.toDate,"toDate",e),t.usersCount&&this.validateNumberFilters(t.usersCount,"usersCount",e),t.minimumPredictions&&this.validateNumberFilters(t.minimumPredictions,"minimumPredictions",e)};validateMarket=(t,e)=>{if(!Object.keys(rt).includes(t)){let a=Zp(t);throw e==="default"?new b(400,"INVALID_MARKET",a):new h(400,"INVALID_MARKET",a)}};validateDate=(t,e,i)=>{let a=/^\d{4}-\d{2}-\d{2}$/;if(typeof t!="string")throw i==="default"?new b(400,"invalid_filters","You have provided invalid type. The valid type is "+`string for ${e} filter`):new h(400,"invalid_filters","You have provided invalid type. The valid type is "+`string for ${e} filter`);if(!a.test(t))throw i==="default"?new b(400,"invalid_filters","You have provided invalid value. The valid value is "+`YYYY-MM-DD for ${e}`):new h(400,"invalid_filters","You have provided invalid value. The valid value is "+`YYYY-MM-DD for ${e}`)};validateNumberFilters=(t,e,i)=>{let a=e==="usersCount"?1:0,r=e==="usersCount"?1e3:1e6;if(typeof t!="number")throw i==="default"?new b(400,"invalid_filters","You have provided invalid type. The valid type is "+`number for ${e} filter`):new h(400,"invalid_filters","You have provided invalid type. The valid type is "+`number for ${e} filter`);if(t<a||t>r)throw i==="default"?new b(400,"invalid_filters","You have provided invalid value. The valid value is "+`between ${a} and ${r}`):new h(400,"invalid_filters","You have provided invalid value. The valid value is "+`between ${a} and ${r}`)}};var op=class{limit=null;page=null;groupId=null;constructor(t){this.limit=t?.limit||null,this.page=t?.page||null,t?.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 t="";return this.limit&&(t+="&",t+=`limit=${this.limit}`),this.page&&(t+="&",t+=`page=${this.page}`),t}};var sp=class{config=null;clientHttps=null;loyaltyHttps=null;loyaltyService=null;profileFacade=null;loyaltyValidator=null;topXFacade=null;matchQuizFacade=null;predictorHttps=null;errorHandlingMode=null;football=null;constructor(t,e,i,a,r){this.config=t,this.clientHttps=e,this.loyaltyHttps=i,this.profileFacade=new _t(r,a),this.loyaltyService=new ap(this.config),this.loyaltyValidator=new rp,this.topXFacade=new oe(t),this.matchQuizFacade=new ie(t),this.predictorHttps=new mt(t),this.errorHandlingMode=t.errorHandlingMode,this.football=new it(t)}getConfig=async()=>await this.clientHttps.getConfig("loyalty");getConfigV2=async t=>{let e=await this.clientHttps.getNewLoyaltyConfig(t);return await this.loyaltyService.addEntityModelToFootballBadges(e.rewards.badges),await this.loyaltyService.addGameModelToGamesBadges(e.rewards.badges),e};getClientBadges=async()=>{let t=await this.getConfig();return this.loyaltyService.buildOldClientBadges(t.rewards.badges)};getClientBadgesV2=async t=>{let e=await this.clientHttps.getNewLoyaltyConfig(t);return this.loyaltyService.buildNewClientBadges(e.rewards.badges)};getTemplates=async(t,e)=>{if(t&&(t=new Fo(t)),this.config.idSchema==="native")return await this.loyaltyHttps.getTemplates(t,e);let i=await this.loyaltyHttps.getTemplates(t,e);i.data=await this.loyaltyService.remapTemplatesIds([...i.data]);for(let a of i.data)await this.loyaltyService.remapTemplateGroupMatchIds(a.groups);return i};getTemplateById=async(t,e)=>{let i=await this.loyaltyHttps.getTemplateById(t,e);if(this.config.idSchema==="native")return i;let a=await this.loyaltyService.remapTemplatesIds([i]);return await this.loyaltyService.remapTemplateGroupMatchIds(a[0].groups),a[0]};getLeaderboard=async(t,e,i)=>{e=this.loyaltyService.initFilters(e,"loyalty");let a=await this.loyaltyHttps.getLeaderboard(t,i,e);return a.data=await this.loyaltyService.addProfileModelToLeaderboard(a.data),a};getLeaderboardForGame=async(t,e,i)=>{e&&(e=new op(e));let a=await this.loyaltyHttps.getLeaderboardForGame(t,i,e);return a.data=await this.loyaltyService.addProfileModelToLeaderboard(a.data),a};getLeaderboardForLeague=async(t,e)=>{e=this.loyaltyService.initFilters(e,"league_leaderboard");let i=await this.loyaltyHttps.getLeaderboardForLeague(t,e);return i.data=await this.loyaltyService.addProfileModelToLeaderboard(i.data),i};getOwnRankings=async(t,e)=>{let{id:i}=await this.profileFacade.getOwn();return this.getUserRankings(i,t,e)};getUserRankings=async(t,e,i)=>{e=this.loyaltyService.initFilters(e,"rankings");let a=await this.loyaltyHttps.getUserRankings(t,e,i);return await this.getModelsForUserRankings(a)};getHighestSuccessRate=async(t,e)=>{t&&(t=new Po(t),this.loyaltyValidator.validate(t,this.errorHandlingMode));let i=await this.loyaltyHttps.getHighestSuccessRate(t,e);return this.loyaltyService.addProfileModelToHighestSuccessRate(i)};getTemplateWinners=async(t,e)=>{let i=await this.predictorHttps.getContestWinners(t,e),a=await this.getTemplateById(t);return i.contestModel=a,this.loyaltyService.completeContestWinners(i)};getEntitiesFollows=async(t,e)=>{this.loyaltyService.validateEntitiesFollowsFilters(t),this.config.idSchema!=="native"&&(t=await this.loyaltyService.remapEntitiesFollowsFilters(t));let i=await this.loyaltyHttps.getEntitiesFollows(t,e);return await this.loyaltyService.addModelsToEntitiesFollows(i)};getModelsForUserRankings=async t=>{let e=null,i=null,a=null,[r,o,n]=this.loyaltyService.extractRankingsIdsMap(t.data);if(n.length&&(e=(await this.getTemplates()).data.filter(p=>n.includes(p.id))),r.length){let l={gameIds:r};i=(await this.topXFacade.getGames(l)).data}if(o.length){let l={gameIds:o};a=(await this.matchQuizFacade.getGames(l)).data}return this.loyaltyService.setModelsForUserRankings(i,a,e,t)};getTemplateMatches=async(t,e,i)=>{let a=await this.getTemplateById(t,i);if((!a.competitionIds||a.competitionIds.length===0)&&(!a.teamIds||a.teamIds.length===0)&&(!a.matchIds||a.matchIds.length===0)&&(!a.gameIds||a.gameIds.length===0)&&(!a.gameTypes||a.gameTypes.length===0)&&(!a.groups||a.groups.length===0))return[];let r=await this.loyaltyService.initMatchFiltersForTemplates(a,e);return(await this.football.getMatches(r,i)).data}};var se=class{clientHttps=null;profileHttps=null;loyaltyHttps=null;loyaltyFacade=null;localCache=null;constructor(t){this.clientHttps=new Q(t),this.profileHttps=new Mi(t),this.loyaltyHttps=new Rt(t),this.localCache=new ct().createLocalCacheInstance(t.idSchema),this.loyaltyFacade=new sp(t,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 t=>await this.loyaltyFacade.getConfigV2(t);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 t=>await this.loyaltyFacade.getClientBadgesV2(t);getTemplates=async(t,e)=>await this.loyaltyFacade.getTemplates(t,e);getTemplateById=async(t,e)=>await this.loyaltyFacade.getTemplateById(t,e);getLeaderboard=async(t,e,i)=>await this.loyaltyFacade.getLeaderboard(t,e,i);getLeaderboardForGame=async(t,e,i)=>await this.loyaltyFacade.getLeaderboardForGame(t,e,i);getLeaderboardForLeague=async(t,e)=>await this.loyaltyFacade.getLeaderboardForLeague(t,e);getOwnRankings=async(t,e)=>await this.loyaltyFacade.getOwnRankings(t,e);getUserRankings=async(t,e,i)=>await this.loyaltyFacade.getUserRankings(t,e,i);getHighestSuccessRate=async(t,e)=>await this.loyaltyFacade.getHighestSuccessRate(t,e);getTemplateWinners=async(t,e)=>await this.loyaltyFacade.getTemplateWinners(t,e);getEntitiesFollows=async(t,e)=>await this.loyaltyFacade.getEntitiesFollows(t,e);getTemplateMatches=async(t,e,i)=>await this.loyaltyFacade.getTemplateMatches(t,e,i)};var np=class{predictorHttps=null;clientHttps=null;idMapping=null;predictorService=null;predictorValidator=null;errorHandlingMode=null;constructor(t,e,i,a){this.predictorHttps=e,this.idMapping=a,this.clientHttps=i,this.errorHandlingMode=t.errorHandlingMode,this.predictorValidator=new ee(t.errorHandlingMode),this.predictorService=new St(t,a)}makeFootballPrediction=async(t,e,i,a)=>{let r=this.predictorValidator.validateFixture(t,e,i,a),o=new ei;if(this.idMapping.idSchema!=="native"){let n=r.matchId,l="",p=await this.predictorService.remapMatchIdToNative([n]);if(r.matchId=p[0],this.errorHandlingMode==="default"&&!r.matchId)throw new b(400,"INVALID_FIELD","Match id is invalid!").errorMessage();if(this.errorHandlingMode==="standard"&&!r.matchId)throw new h(400,"INVALID_FIELD","Match id is invalid!");if(r instanceof st&&r.prediction.playerId!=="OWN_GOAL"){if(r.prediction.playerId&&(l=r.prediction.playerId,r.prediction.playerId=await this.predictorService.remapPlayerIdToNative([l])),this.errorHandlingMode==="default"&&r.market!==ji&&!r.prediction.playerId)throw new b(400,"INVALID_FIELD","Player id is invalid!").errorMessage();if(this.errorHandlingMode==="standard"&&r.market!==ji&&!r.prediction.playerId)throw new h(400,"INVALID_FIELD","Player id is invalid!")}o.fixtures=[r];let c=await this.predictorHttps.makeFootballPrediction(o);return c.fixtures.forEach(u=>{u.prediction.playerId&&u.prediction.playerId!=="OWN_GOAL"&&(u.prediction.playerId=l),u.matchId=n}),c}else return o.fixtures=[r],await this.predictorHttps.makeFootballPrediction(o)};getMatchSummary=async(t,e)=>{let i=await this.getMatchSummaryBase(t,e),a=JSON.parse(JSON.stringify(i.predictions)),r=await this.predictorService.remapPlayerIdToIdSchema(a);return i.predictions=r,i};getMarketSummary=async(t,e,i,a)=>{try{let r=await this.getMatchSummaryBase(t,a);return await this.predictorService.getMarketSummary(r,e,i)}catch(r){throw r}};getMatchSummaryBase=async(t,e)=>{if(this.idMapping.idSchema!=="native"){let a=(await this.predictorService.remapMatchIdToNative([t]))[0],r=await this.predictorHttps.getMatchSummary(a,e);return r.matchId=t,r}else return await this.predictorHttps.getMatchSummary(t,e)};getConfig=async()=>{let t=await this.clientHttps.getConfig("predictor");return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(t):t};deleteFootballPrediction=async t=>await this.predictorHttps.deleteFootballPrediction(t);getMyPredictions=async t=>{let e=this.predictorService.initPredictionsFilters(t,"user");return await this.predictorHttps.getMyPredictions(e)};getMyPredictionsForMatches=async(t,e)=>{if(this.errorHandlingMode==="default"&&this.predictorService.areIdsExceeded(t))throw new b(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.").errorMessage();if(this.errorHandlingMode==="standard"&&this.predictorService.areIdsExceeded(t))throw new h(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.");this.idMapping.idSchema!=="native"&&(t=await this.predictorService.remapMatchIdToNative([...t]));let i=this.predictorService.initPredictionsFilters(e,"matches",t);return await this.predictorHttps.getMyPredictions(i)};getMyCurrentPredictions=async t=>{let e=this.predictorService.initPredictionsFilters(t,"current");return await this.predictorHttps.getMyPredictions(e)};getMyPastPredictions=async t=>{let e=this.predictorService.initPredictionsFilters(t,"past");return await this.predictorHttps.getMyPredictions(e)};getUserPredictions=async(t,e,i)=>{let a=this.predictorService.initPredictionsFilters(e,"user");return await this.predictorHttps.getUserPredictions(t,i,a)};getUserCurrentPredictions=async(t,e,i)=>{let a=this.predictorService.initPredictionsFilters(e,"current");return await this.predictorHttps.getUserPredictions(t,i,a)};getUserPastPredictions=async(t,e,i)=>{let a=this.predictorService.initPredictionsFilters(e,"past");return await this.predictorHttps.getUserPredictions(t,i,a)};getUserPredictionsForMatches=async(t,e,i,a)=>{if(this.errorHandlingMode==="default"&&this.predictorService.areIdsExceeded(e))throw new b(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.").errorMessage();if(this.errorHandlingMode==="standard"&&this.predictorService.areIdsExceeded(e))throw new h(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.");this.idMapping.idSchema!=="native"&&(e=await this.predictorService.remapMatchIdToNative([...e]));let r=this.predictorService.initPredictionsFilters(i,"matches",e);return await this.predictorHttps.getUserPredictions(t,a,r)};getPredictionById=async t=>await this.predictorHttps.getPredictionById(t);getPredictionsByIds=async t=>await this.predictorHttps.getPredictionsByIds(t);getMatchMarketsResults=async t=>(this.idMapping.idSchema!=="native"&&(t=(await this.predictorService.remapMatchIdToNative([t]))[0]),await this.predictorService.getMatchMarketsResults(t))};var lp=class extends K{constructor(t){super(t.errorHandlingMode)}validateMatchSummary=t=>{t||this.throwException(400,"invalid_match_summary","Match summary is required."),t.predictions||this.throwException(400,"invalid_match_summary_predictions","Predictions in match summary are required."),(!t.predictions.correctScore||!t.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")}};var pp=class{validator=null;constructor(t){this.validator=new lp(t)}calculateOneXTwoFromScores=t=>{this.validator.validateMatchSummary(t);let{correctScore:e,correctScoreAdvanced:i}=t.predictions,a={...e,...i},r=0,o=0,n=0,l=0;return Object.entries(a).forEach(([p,c])=>{if(c===0)return;let u=c;r+=u;let[d,M]=p.split(":").map(Number);d>M?o+=u:d===M?n+=u:l+=u}),{home:r?Math.round(o/r*100):0,draw:r?Math.round(n/r*100):0,away:r?Math.round(l/r*100):0}};getTopCorrectScores=t=>{this.validator.validateMatchSummary(t);let{correctScore:e,correctScoreAdvanced:i}=t.predictions,a={...e,...i},r=0;return Object.values(a).forEach(o=>{r+=o}),Object.entries(a).filter(([o,n])=>n>0).map(([o,n])=>({score:o,percentage:Math.round(n/r*100)})).sort((o,n)=>n.percentage-o.percentage).slice(0,3)}};var ki=class{predictorHttps=null;clientHttps=null;predictorFacade=null;idMapping=null;helpers=null;constructor(t){this.idMapping=new R(t),this.predictorHttps=new mt(t),this.clientHttps=new Q(t),this.predictorFacade=new np(t,this.predictorHttps,this.clientHttps,this.idMapping),this.helpers=new pp(t)}makeFootballPrediction=async(t,e,i,a)=>await this.predictorFacade.makeFootballPrediction(t,e,i,a);getMatchSummary=async(t,e)=>await this.predictorFacade.getMatchSummary(t,e);getMarketSummary=async(t,e,i,a)=>await this.predictorFacade.getMarketSummary(t,e,i,a);getConfig=async()=>await this.predictorFacade.getConfig();deleteFootballPrediction=async t=>await this.predictorFacade.deleteFootballPrediction(t);getMyPredictions=async t=>await this.predictorFacade.getMyPredictions(t);getMyCurrentPredictions=async t=>await this.predictorFacade.getMyCurrentPredictions(t);getMyPastPredictions=async t=>await this.predictorFacade.getMyPastPredictions(t);getMyPredictionsForMatches=async(t,e)=>await this.predictorFacade.getMyPredictionsForMatches(t,e);getUserPredictions=async(t,e,i)=>await this.predictorFacade.getUserPredictions(t,e,i);getUserCurrentPredictions=async(t,e,i)=>await this.predictorFacade.getUserCurrentPredictions(t,e,i);getUserPastPredictions=async(t,e,i)=>await this.predictorFacade.getUserPastPredictions(t,e,i);getUserPredictionsForMatches=async(t,e,i,a)=>await this.predictorFacade.getUserPredictionsForMatches(t,e,i,a);getPredictionById=async t=>await this.predictorFacade.getPredictionById(t);getPredictionsByIds=async t=>await this.predictorFacade.getPredictionsByIds(t);getMatchMarketsResults=async t=>await this.predictorFacade.getMatchMarketsResults(t)};var Gi=class{loyalty=null;profile=null;predictor=null;constructor(t){this.loyalty=new se(t),this.profile=new D(t),this.predictor=new ki(t)}setTemplateModels=async t=>{let e=await this.loyalty.getTemplates();t.templateModel=e.data.find(i=>i.id===t.templateId),t.pastTemplates&&t.pastTemplates.length>0&&t.pastTemplates.forEach(i=>{i.model=e.data.find(a=>a.id===i.id)})};setTemplateModelsInLeagues=async t=>{if(!t.length)return;let e=await this.loyalty.getTemplates();t.forEach(i=>{i.templateModel=e.data.find(a=>a.id===i.templateId),i.pastTemplates&&i.pastTemplates.length>0&&i.pastTemplates.forEach(a=>{a.model=e.data.find(r=>r.id===a.id)})})};setTemplateModelsFromLeagueModels=(t,e)=>{if(e==="PRIVATE_LEAGUE"){t.forEach(i=>{i.templateModel=i.templateId===i.privateLeagueModel.templateId?i.privateLeagueModel.templateModel:i.privateLeagueModel.pastTemplates.find(a=>a.id===i.templateId).model});return}t.forEach(i=>{i.templateModel=i.templateId===i.challengeModel.templateId?i.challengeModel.templateModel:i.challengeModel.pastTemplates.find(a=>a.id===i.templateId).model})};setProfileModel=async t=>{let e=await this.profile.getById(t.profileId).getInfo();t.profileModel=e};setModelsForPredictions=async t=>{if(t.data.length){let e=t.data.map(o=>o.profileId),i=t.data.map(o=>o.predictionId),a=await this.getProfileModels(e),r=await this.getPredictionModels(i);t.data.forEach(o=>{o.profileModel=a.find(n=>n.id===o.profileId),o.predictionModel=r.find(n=>n.id===o.predictionId)})}return t};getProfileModels=async t=>await this.profile.getByIds(t);getPredictionModels=async t=>await this.predictor.getPredictionsByIds(t)};var ne=class{idSchema=null;profile=null;validator=null;idMapping=null;constructor(t){this.idSchema=t.idSchema,this.profile=new D(t),this.validator=new ae(t),this.idMapping=new R(t)}finalizePostFullModel=async t=>{let e=t.map(a=>a.userId),i=await this.profile.getByIds(e);return t.map(a=>(a.userModel=this.extractModelById(i,a.userId),a))};finalizeTopDiscussionsFilters=async t=>{if(this.idSchema!=="native"&&t.entityIds&&t.entityIds.length>0){this.validator.validateFilters(t);let e=await this.idMapping.getEntityIdsBySchemaId(Array.from(t.entityIds),t.entityType,"native");t.entityIds=e[t.entityType]}};extractModelById=(t,e)=>{if(t.length){let i=t.find(a=>a.id===e);return i?(delete i.interests,i):null}return null}};var cp=class{factory=null;https=null;loyaltyHttps=null;profile=null;service=null;discussionsService=null;constructor(t){this.factory=new Di,this.https=new Li(t),this.service=new Gi(t),this.loyaltyHttps=new Rt(t),this.profile=new D(t),this.discussionsService=new ne(t)}issue=async(t,e)=>{let i=this.factory.createRequestBodyFromParam(t,"ONE_VS_ONE"),a=await this.https.create(i,"CHALLENGE");await this.service.setTemplateModels(a);let r=await this.https.invite(a.id,[e]);return a.invites=[],a.invites.push(r[0]),a};update=async(t,e)=>{let i=this.factory.createUpdateRequestBodyFromParam(e,"ONE_VS_ONE"),a=await this.https.update(t,i,"CHALLENGE");return await this.service.setTemplateModels(a),a};updateTemplate=async(t,e,i)=>{let a=await this.https.updateLeagueTemplate(t,e,i,"CHALLENGE");return await this.service.setTemplateModels(a),a};delete=async t=>await this.https.delete(t,"CHALLENGE");getById=async(t,e)=>{let i=await this.https.getById(t,"CHALLENGE",e);return await this.service.setTemplateModels(i),i};getMyChallenges=async t=>{t=new _r(t);let e=await this.https.getMyLeagues(t,"CHALLENGE");return await this.service.setTemplateModelsInLeagues(e),e};accept=async t=>{let i=await this.https.accept(t,!0,"CHALLENGE");return await this.finalizeAcceptModel(i,!0)};reject=async t=>{let i=await this.https.accept(t,!1,"CHALLENGE");return await this.finalizeAcceptModel(i,!1)};leave=async t=>await this.https.leave(t,"CHALLENGE");finalizeAcceptModel=async(t,e)=>{if(e){let i=await this.getById(t.challengeId);t.challengeModel=i}return await this.service.setProfileModel(t),t};getMyChallengesStandings=async t=>{t&&(t=new wr(t));let e=await this.profile.getOwn().getInfo(),i=await this.loyaltyHttps.getUserRankingsForPrivateLeagueAndChallenges(e.id,"CHALLENGE",t);for(let a of i.data){let r=await this.getById(a.challengeId);a.challengeModel=r}return this.service.setTemplateModelsFromLeagueModels(i.data,"CHALLENGE"),i};getInvitations=async t=>{t=new ai(t),t.type="ONE_VS_ONE";let e=await this.https.getInvitations("CHALLENGE",t);return await this.service.setTemplateModelsInLeagues(e.data),e};getReportedPosts=async(t,e)=>{e&&(e=new ri(e));let i=await this.https.getReportedPosts(t,e);return i.data=await this.discussionsService.finalizePostFullModel(i.data),i};getPredictions=async(t,e)=>{if(e){if(e.limit&&e.limit>20)throw new h(400,"invalid_limit","Invalid limit. The maximum limit is: "+20 .toString());e=new oi(e)}let i=await this.https.getPredictions(t,e);return await this.service.setModelsForPredictions(i)};moderatePost=async(t,e)=>await this.https.moderatePost(t,e)};var up=class{facade=null;constructor(t){this.facade=new cp(t)}issue=async(t,e)=>await this.facade.issue(t,e);update=async(t,e)=>await this.facade.update(t,e);updateTemplate=async(t,e,i)=>await this.facade.updateTemplate(t,e,i);delete=async t=>await this.facade.delete(t);getById=async(t,e)=>await this.facade.getById(t,e);getMyChallenges=async t=>await this.facade.getMyChallenges(t);accept=async t=>await this.facade.accept(t);reject=async t=>await this.facade.reject(t);leave=async t=>await this.facade.leave(t);getMyChallengesStandings=async t=>await this.facade.getMyChallengesStandings(t);getInvitations=async t=>await this.facade.getInvitations(t);getReportedPosts=async(t,e)=>await this.facade.getReportedPosts(t,e);getPredictions=async(t,e)=>await this.facade.getPredictions(t,e);moderatePost=async(t,e)=>await this.facade.moderatePost(t,e)};var dp=class extends v{remapper=null;constructor(t){super(t,O(t.environment,"discussions")),this.remapper=new xi}getAll=async(t,e)=>{let i="/discussions"+this.apiSignInUrl;t&&(i+=`${t.constructMainFiltersUrl()}`),f(e)&&(i+=m());let a="There was a problem getting discussions",r=await this.fetchWithoutAuth(i,a);return this.remapper.remapToDiscussions(r)};getById=async t=>{let e=`/discussions/${t}`+this.apiSignInUrl,i="There was a problem getting discussion",a=await this.fetchWithoutAuth(e,i);return this.remapper.remapToDiscussionById(a.data)};createPost=async(t,e)=>{let i=`/discussions/${t}/posts`+this.apiSignInUrl,a="There was a problem creating post in discussion",r="POST",o=await this.fetchWithAuth(i,a,r,e);return this.remapper.remapToPostByIdBasic(o.data)};getPostById=async t=>{let e=`/posts/${t}`+this.apiSignInUrl,i="There was a problem getting post by ID in discussion",a=await this.fetchWithoutAuth(e,i);return this.remapper.remapToPostByIdFull(a.data)};updatePost=async(t,e)=>{let i=`/posts/${t}`+this.apiSignInUrl,a="There was a problem editing post in discussion",r="PUT",o={content:e},n=await this.fetchWithAuth(i,a,r,o);return this.remapper.remapToPostByIdBasic(n.data)};reactToPost=async(t,e)=>{let i=`/posts/${t}/reaction`+this.apiSignInUrl,a="There was a problem reacting to post in discussion",r="PUT",o={reaction:e.toLocaleLowerCase()},n=await this.fetchWithAuth(i,a,r,o);return this.remapper.remapToPostByIdFull(n.data)};deletePost=async t=>{let e=`/posts/${t}`+this.apiSignInUrl,i="There was a problem deleting post in discussion",a="DELETE";return await this.fetchWithAuth(e,i,a),!0};getPosts=async(t,e)=>{let i=`/discussions/${t}/posts`+this.apiSignInUrl;e&&(i+=`${e.constructMainFiltersUrl()}`);let a="There was a problem getting posts in discussion",r=await this.fetchWithoutAuth(i,a);return this.remapper.remapToPostsForDiscussion(r,"full")};getPostReplies=async(t,e)=>{let i=`/posts/${t}/replies`+this.apiSignInUrl;e&&(i+=`${e.constructMainFiltersUrl()}`);let a="There was a problem getting post's replies in discussion",r=await this.fetchWithoutAuth(i,a);return this.remapper.remapToPostsForDiscussion(r,"full")};reportPost=async(t,e,i)=>{let a=`/posts/${t}/report`+this.apiSignInUrl,r="There was a problem reporting post in discussion",o="POST",n={reason:e.toLocaleUpperCase(),reason_details:i||null},l=await this.fetchWithAuth(a,r,o,n);return this.remapper.remapToPostByIdBasic(l.data)};getOwnPosts=async t=>{let e="/posts"+this.apiSignInUrl;t&&(e+=`${t.constructMainFiltersUrl()}`);let i="There was a problem getting own posts",a=await this.fetchWithAuth(e,i);return this.remapper.remapToPosts(a)};getUserPosts=async(t,e,i)=>{let a=`/posts/users/${t}`+this.apiSignInUrl;e&&(a+=`${e.constructMainFiltersUrl()}`),f(i)&&(a+=m());let r="There was a problem getting user's posts",o=await this.fetchWithoutAuth(a,r);return this.remapper.remapToPosts(o)};getPostsCount=async(t,e)=>{let i="/discussions/posts/count"+this.apiSignInUrl+`&discussion_ids=${t.join(",")}`;f(e)&&(i+=m());let a="There was a problem getting posts count for discussions",r=await this.fetchWithoutAuth(i,a);return this.remapper.remapToPostCount(r.data)};getTopDiscussions=async(t,e)=>{let i="/discussions/top"+this.apiSignInUrl;t&&(i+=`${t.constructMainFiltersUrl()}`),f(e)&&(i+=m());let a="There was a problem getting top discussions",r=await this.fetchWithoutAuth(i,a);return this.remapper.remapToDiscussions(r)};getPostsCountExtended=async t=>{let e="/discussions/posts/count"+this.apiSignInUrl,i={discussion_ids:Array.from(t)},a="POST",r="There was a problem getting posts count extended for discussions",o=await this.fetchWithoutAuth(e,r,a,i);return this.remapper.remapToPostCount(o.data)}};var mp=class{createRequestBodyFromParam=t=>{let e=new Rr;return e.content=t.content,e.reply_id=t.replyId,e.discussion_label=t.discussionLabel,e.discussion_url=t.discussionUrl,e.anonymous_nickname=t.userNickname,e.context=t.context,e}};var hp=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(t){this.idSchema=t.idSchema,this.errorHandlingMode=t.errorHandlingMode,this.https=new dp(t),this.clientHttps=new Q(t),this.activityService=new wt(t),this.service=new ne(t),this.factory=new mp}getAll=async(t,e)=>{t&&(t=new Lr(t));let i=await this.https.getAll(t,e);for(let a of i.data)await this.remapTags(a,"native",this.idSchema);return i};getById=async t=>{let e=await this.https.getById(t);return await this.remapTags(e,"native",this.idSchema),e};createPost=async(t,e)=>{let i=JSON.parse(JSON.stringify(e));await this.remapTags(i,this.idSchema,"native");let a=this.factory.createRequestBodyFromParam(i);return await this.https.createPost(t,a)};getPostById=async t=>{let e=await this.https.getPostById(t);return(await this.service.finalizePostFullModel([e]))[0]};updatePost=async(t,e)=>await this.https.updatePost(t,e);deletePost=async t=>await this.https.deletePost(t);getPosts=async(t,e)=>{e&&(e=new Yt(e));let i=await this.https.getPosts(t,e);return i.data=await this.service.finalizePostFullModel(i.data),i};getPostReplies=async(t,e)=>{e&&(e=new Yt(e));let i=await this.https.getPostReplies(t,e);return i.data=await this.service.finalizePostFullModel(i.data),i};reactToPost=async(t,e)=>{let i=await this.https.reactToPost(t,e);return(await this.service.finalizePostFullModel([i]))[0]};reportPost=async(t,e,i)=>await this.https.reportPost(t,e,i);getOwnPosts=async t=>(t&&(t=new Yt(t)),await this.https.getOwnPosts(t));getUserPosts=async(t,e,i)=>(e&&(e=new Yt(e)),await this.https.getUserPosts(t,e,i));getConfig=async()=>await this.clientHttps.getConfig("discussions");getPostsCount=async(t,e)=>{if(!t||!Array.isArray(t)||!t.length)throw this.errorHandlingMode==="standard"?new h(400,"invalid_discussion_ids","Invalid discussion ids argument. Please provide at least one discussion id in an array"):new b(400,"invalid_discussion_ids","Invalid discussion ids argument. Please provide at least one discussion id in an array");if(t.length>this.LIMIT_POSTS_COUNT)throw this.errorHandlingMode==="standard"?new h(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 b(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(t,e)};getTopDiscussions=async(t,e)=>{t&&(t=new Dr(t),await this.service.finalizeTopDiscussionsFilters(t));let i=await this.https.getTopDiscussions(t,e);for(let a of i.data)await this.remapTags(a,"native",this.idSchema);return i};getPostsCountExtended=async t=>{if(!t||!Array.isArray(t)||!t.length)throw this.errorHandlingMode==="standard"?new h(400,"invalid_discussion_ids","Invalid discussion ids argument. Please provide at least one discussion id in an array"):new b(400,"invalid_discussion_ids","Invalid discussion ids argument. Please provide at least one discussion id in an array");if(t.length>this.LIMIT_POSTS_COUNT_EXTENDED)throw this.errorHandlingMode==="standard"?new h(400,"invalid_discussion_ids","Maximum number of discussion ids exceeded. The maximum number of discussion ids is: "+this.LIMIT_POSTS_COUNT_EXTENDED):new b(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(t)};remapTags=async(t,e,i)=>{if(this.idSchema!="native"&&t.context&&t.context.tags&&t.context.tags.length){let a=JSON.parse(JSON.stringify(t.context.tags)),r=await this.activityService.remapTagsIds(a,e,i);t.context.tags=r}}};var fp=class{facade=null;constructor(t){this.facade=new hp(t)}getAll=async(t,e)=>await this.facade.getAll(t,e);getById=async t=>await this.facade.getById(t);createPost=async(t,e)=>await this.facade.createPost(t,e);getPostById=async t=>await this.facade.getPostById(t);updatePost=async(t,e)=>await this.facade.updatePost(t,e);deletePost=async t=>await this.facade.deletePost(t);getPosts=async(t,e)=>await this.facade.getPosts(t,e);getPostReplies=async(t,e)=>await this.facade.getPostReplies(t,e);react=async(t,e)=>await this.facade.reactToPost(t,e);reportPost=async(t,e,i)=>await this.facade.reportPost(t,e,i);getOwnPosts=async t=>await this.facade.getOwnPosts(t);getUserPosts=async(t,e,i)=>await this.facade.getUserPosts(t,e,i);getConfig=async()=>await this.facade.getConfig();getPostsCount=async(t,e)=>await this.facade.getPostsCount(t,e);getTopDiscussions=async(t,e)=>await this.facade.getTopDiscussions(t,e);getPostsCountExtended=async t=>await this.facade.getPostsCountExtended(t)};var gp=class extends K{constructor(t){super(t)}validatePrediction=t=>{(!t.fixtures||!Array.isArray(t.fixtures)||t.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 e=["id","predictionType","prediction"];for(let i of t.fixtures)(Object.keys(i).length!==e.length||Object.keys(i).some(a=>!e.includes(a)))&&this.throwException(400,"invalid_method_call","Fixtures field is invalid. For more information please visit our documentation"),this.validatePredictionType(i.predictionType,i.prediction);t.tiebreaker&&(!t.tiebreaker.statTotal||!Number.isInteger(t.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=(t,e)=>{switch(t){case"BOOLEAN":typeof e!="boolean"&&this.throwException(400,"invalid_method_call",`Prediction must be a boolean for prediction type ${t}`);break;case"NUMBER":(typeof e!="number"||!Number.isFinite(e))&&this.throwException(400,"invalid_method_call",`Prediction must be a number for prediction type ${t}`);break;case"ENUM":case"FREE_INPUT":(typeof e!="string"||e.trim()==="")&&this.throwException(400,"invalid_method_call",`Prediction must be a non-empty string for prediction type ${t}`);break;default:this.throwException(400,"invalid_method_call",`Unknown prediction type: ${t}`)}}};var yp=class{https=null;validator=null;profile=null;constructor(t){this.https=new jt(t),this.profile=new D(t),this.validator=new gp(t.errorHandlingMode)}getGames=async(t,e)=>(t&&(t=new Br(t)),await this.https.getEventGames(t,e));getGameById=async(t,e)=>await this.https.getEventGameById(t,e);makePrediction=async(t,e)=>(this.validator.validatePrediction(e),await this.https.makeEventGamePrediction(t,e));updatePrediction=async(t,e,i)=>(this.validator.validatePrediction(i),await this.https.updateEventGamePrediction(t,e,i));getGamePredictionsForUser=async(t,e,i,a)=>{i&&(i=new Nr(i));let r=await this.https.getEventGamePredictionsForUser(t,e,i,a),o=null;try{o=await this.profile.getById(e).getInfo()}catch(n){console.error(n)}return r.data.forEach(n=>{n.profileModel=o}),r};getRankings=async(t,e,i)=>{e&&(e=new kr(e));let a=await this.https.getEventGameRankings(t,e,i),r=a.data.map(n=>n.profileId),o=[];return r.length>0&&(o=await this.profile.getByIds(r),a.data=a.data.map(n=>(n.profileModel=o.find(l=>l.id===n.profileId)||null,n))),a}};var bp=class{facade=null;constructor(t){this.facade=new yp(t)}getGames=async(t,e)=>await this.facade.getGames(t,e);getGameById=async(t,e)=>await this.facade.getGameById(t,e);makePrediction=async(t,e)=>await this.facade.makePrediction(t,e);updatePrediction=async(t,e,i)=>await this.facade.updatePrediction(t,e,i);getGamePredictionsForUser=async(t,e,i,a)=>await this.facade.getGamePredictionsForUser(t,e,i,a);getRankings=async(t,e,i)=>await this.facade.getRankings(t,e,i)};var Cd=Object.keys(new Dt),Ad=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"),Ui=class{static createFantasyPrediction(t,e,i,a){let r=new Ge;return r.template_id=t||null,r.group_id=e||null,r.fixtures=i?.map(o=>({player_id:o,match_type:"FOOTBALL",market:"PLAYER_PERFORMANCE",role:a?.get(o)?.toLocaleUpperCase()||null}))||[],r}static createFantasyPlayerStats(t){return Cd.map(e=>{let i=new Hr,a=t.data.reduce((r,o)=>r+o.stats[e],0);return i.key=e,i.label=Ad.get(e),i.value=a,i})}};var Mp=class{idMapping=null;idSchema=null;errorHandlingModel=null;football=null;constructor(t){this.idSchema=t.idSchema,this.errorHandlingModel=t.errorHandlingMode,this.football=new it(t),this.idMapping=new R(t)}remapCompetitions=async t=>{let e={competition:t};return(await this.idMapping.idMappingFacade.getEntitiesByIds(e,"native",this.idSchema)).competition};remapPlayers=async(t,e,i,a)=>{let r={player:Array.from(t)},o=await this.idMapping.idMappingFacade.getEntitiesByIdsMap(r,e,i);if(a){let n=new Map;for(let[l,p]of Array.from(a.entries())){let c=o.get(l);c&&n.set(c,p)}a.clear();for(let[l,p]of Array.from(n.entries()))a.set(l,p)}return Array.from(o.values())};addPlayerModels=async t=>{let e=t.map(a=>a.playerId),i=await this.football.footballFacade.getPlayersMapWithNativeIds(e);return t.forEach(a=>{a.playerModel=Object.keys(i).length&&i[a.playerId]||null,a.playerId=a.playerModel?.id||a.playerId}),t};remapPlayerIdToNative=async t=>{let e=await this.idMapping.getEntityIdBySchemaId("player",t);if(e)return e.id;this.throwException(404,"id_mapping_not_found","No ID mappings are available for the provided ID. ID argument: "+t)};addMatchModels=async t=>{let e=t.map(a=>a.matchId),i=await this.football.footballFacade.getMatchesMapWithNativeIds(e);return t.forEach(a=>{a.matchModel=Object.keys(i).length&&i[a.matchId]||null,a.matchId=a.matchModel?.id||a.matchId}),t};throwException=(t,e,i)=>{throw this.errorHandlingModel==="standard"?new h(t,e,i):new b(t,e,i)}};var Ip=class{idSchema=null;clientHttps=null;footballHttps=null;predictorHttps=null;loyaltyHttps=null;service=null;constructor(t){this.idSchema=t.idSchema,this.clientHttps=new Q(t),this.footballHttps=new dt(t),this.service=new Mp(t),this.predictorHttps=new mt(t),this.loyaltyHttps=new Rt(t)}getConfig=async()=>{let t=await this.clientHttps.getConfig("fantasy");return this.idSchema!=="native"&&(t.competitionsWhitelist=await this.service.remapCompetitions([...t.competitionsWhitelist])),t};getPlayersPoints=async(t,e,i)=>{let a=await this.footballHttps.getPlayersPoints(t,e,i);return a.data=await this.service.addPlayerModels(a.data),a};getPlayerDetailedStatistics=async(t,e,i)=>{let a="";this.idSchema!=="native"&&(a=await this.service.remapPlayerIdToNative(e));let r=await this.footballHttps.getPlayerDetailedStatistics(t,a||e,i);return r.meta.filters.playerId=e,r.data=await this.service.addMatchModels(r.data),r};play=async(t,e,i,a)=>{if((!i||!Array.isArray(i))&&this.service.throwException(400,"invalid_method_call","Invalid parameter provided. Please check the following parameter: "+"playerIds"),a){let o="playersRoles";a instanceof Map||this.service.throwException(400,"invalid_method_call","Invalid parameter provided. Please check the following parameter: "+o);let n=Array.from(a.keys());n.length||this.service.throwException(400,"invalid_method_call","Invalid parameter provided. Please check the following parameter: "+o),n.every(u=>!i.includes(u))&&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: "+i.join(","));let p=Array.from(a.values()),c=["CAPTAIN","VICE_CAPTAIN"];p.every(u=>c.includes(u.toLocaleUpperCase()))||this.service.throwException(400,"invalid_method_call","The values in the map are not valid. The valid ones are: "+c.join(",")+". Case insensitive.")}let r=null;if(this.idSchema!=="native"){let o=await this.service.remapPlayers(i,this.idSchema,"native",a);r=Ui.createFantasyPrediction(t,e,o,a)}else r=Ui.createFantasyPrediction(t,e,i,a);return await this.predictorHttps.makeFootballPrediction(r)};getMyPrediction=async(t,e)=>{let i=`${t}_${e}`,a=new V(null);a.gameIds=[i];let r=await this.predictorHttps.getMyPredictions(a);return r.data.length===0?null:r.data[0]};getPlayerStatistics=async(t,e,i)=>{let a=await this.getPlayerDetailedStatistics(t,e,i);return Ui.createFantasyPlayerStats(a)};getGameWeekStatistics=async t=>await this.loyaltyHttps.getTemplateBreakdownPoints(t)};var wp=class{facade=null;constructor(t){this.facade=new Ip(t)}getConfig=async()=>await this.facade.getConfig();getPlayersPoints=async(t,e,i)=>await this.facade.getPlayersPoints(t,e,i);getPlayerDetailedStatistics=async(t,e,i)=>await this.facade.getPlayerDetailedStatistics(t,e,i);play=async(t,e,i,a)=>await this.facade.play(t,e,i,a);getMyPrediction=async(t,e)=>await this.facade.getMyPrediction(t,e);getPlayerStatistics=async(t,e,i)=>await this.facade.getPlayerStatistics(t,e,i);getGameWeekStatistics=async t=>await this.facade.getGameWeekStatistics(t)};var _p=class{configuration;constructor(t){this.configuration=t}getSDKConfiguration(){return this.configuration}};var Pp=class{remapToResponseModel=(t,e,i)=>{let a=new Mo;return a.meta.input=e,a.meta.output=i,t.size===0||(a.data=Array.from(t).map(([r,o])=>({input:r,output:o}))),a}};var Tp=class{errorHandlingModel=null;constructor(t){this.errorHandlingModel=t.errorHandlingMode}validate=(t,e,i)=>{(!t||!Array.isArray(t)||t.length===0)&&this.throwException(400,"invalid_ids","Invalid or empty IDs provided. Please provide at least one ID."),(!e||e!=="native"&&e!=="enetpulse"&&e!=="sportal365"&&e!=="sportradar"&&e!=="api_football")&&this.throwException(400,"invalid_input_provider","Invalid provider. The valid providers are: 'native', 'enetpulse', 'sportal365', 'sportradar' and 'api_football'."),(!i||i!=="native"&&i!=="enetpulse"&&i!=="sportal365"&&i!=="sportradar"&&i!=="api_football")&&this.throwException(400,"invalid_output_provider","Invalid provider. The valid providers are: 'native', 'enetpulse', 'sportal365', 'sportradar' and 'api_football'."),e===i&&this.throwException(400,"invalid_output_provider","Invalid output provider. The output can not be the same as the input provider.")};throwException=(t,e,i)=>{throw this.errorHandlingModel==="standard"?new h(t,e,i):new b(t,e,i)}};var Ep=class{validator=null;idMappingFacade=null;factory=new Pp;constructor(t){this.validator=new Tp(t),this.idMappingFacade=new yi(t)}getMappedFootballCountryIds=async(t,e,i)=>{this.validator.validate(t,e,i);let a={country:Array.from(t)},r=await this.idMappingFacade.getEntitiesByIdsMap(a,e,i);return this.factory.remapToResponseModel(r,e,i)};getMappedFootballCompetitionIds=async(t,e,i)=>{this.validator.validate(t,e,i);let a={competition:Array.from(t)},r=await this.idMappingFacade.getEntitiesByIdsMap(a,e,i);return this.factory.remapToResponseModel(r,e,i)};getMappedFootballTeamIds=async(t,e,i)=>{this.validator.validate(t,e,i);let a={team:Array.from(t)},r=await this.idMappingFacade.getEntitiesByIdsMap(a,e,i);return this.factory.remapToResponseModel(r,e,i)};getMappedFootballPlayerIds=async(t,e,i)=>{this.validator.validate(t,e,i);let a={player:Array.from(t)},r=await this.idMappingFacade.getEntitiesByIdsMap(a,e,i);return this.factory.remapToResponseModel(r,e,i)};getFootballMappedMatchIds=async(t,e,i)=>{this.validator.validate(t,e,i);let a={match:Array.from(t)},r=await this.idMappingFacade.getEntitiesByIdsMap(a,e,i);return this.factory.remapToResponseModel(r,e,i)}};var Rp=class{facade=null;constructor(t){this.facade=new Ep(t)}getMappedFootballCountryIds=async(t,e,i)=>await this.facade.getMappedFootballCountryIds(t,e,i);getMappedFootballCompetitionIds=async(t,e,i)=>await this.facade.getMappedFootballCompetitionIds(t,e,i);getMappedFootballTeamIds=async(t,e,i)=>await this.facade.getMappedFootballTeamIds(t,e,i);getMappedFootballPlayerIds=async(t,e,i)=>await this.facade.getMappedFootballPlayerIds(t,e,i);getMappedFootballMatchIds=async(t,e,i)=>await this.facade.getFootballMappedMatchIds(t,e,i)};var Fp=class{findLastGame=t=>{if(!Array.isArray(t)||t.length===0)return null;let e=t.filter(r=>r.status==="SETTLED").sort((r,o)=>new Date(o.predictionsCutoff).getTime()-new Date(r.predictionsCutoff).getTime());if(e.length>0)return e[0];let i=new Date,a=t.filter(r=>new Date(r.predictionsCutoff)<i).sort((r,o)=>new Date(o.predictionsCutoff).getTime()-new Date(r.predictionsCutoff).getTime());return a.length>0?a[0]:null};findNextGame=t=>{if(!Array.isArray(t)||t.length===0)return null;let e=this.findCurrentGame(t);if(!e)return null;let i=[...t].sort((r,o)=>new Date(r.predictionsCutoff).getTime()-new Date(o.predictionsCutoff).getTime()),a=new Date(e.predictionsCutoff).getTime();return i.find(r=>new Date(r.predictionsCutoff).getTime()>a)||null};findCurrentGame=t=>{if(!Array.isArray(t)||t.length===0)return null;let e=t.find(o=>o.status==="LIVE");if(e)return e;let i=t.find(o=>o.status==="OPEN");if(i)return i;let a=new Date;return t.filter(o=>new Date(o.predictionsCutoff)>a).sort((o,n)=>new Date(o.predictionsCutoff).getTime()-new Date(n.predictionsCutoff).getTime())[0]||null}};var Vi=class{matchQuizFacade=null;helpers=new Fp;constructor(t){this.matchQuizFacade=new ie(t)}getConfig=async()=>await this.matchQuizFacade.getConfig();play=async t=>await this.matchQuizFacade.play(t);delete=async t=>await this.matchQuizFacade.delete(t);getGames=async(t,e)=>await this.matchQuizFacade.getGames(t,e);getGameById=async(t,e)=>await this.matchQuizFacade.getGameById(t,e);getGamePredictions=async(t,e,i)=>await this.matchQuizFacade.getGamePredictions(t,e,i);getGameResults=async(t,e,i)=>await this.matchQuizFacade.getGameResults(t,e,i);getCurrentGameResults=async t=>await this.matchQuizFacade.getCurrentGameResults(t);getMyGameEditions=async(t,e)=>await this.matchQuizFacade.getMyGameEditions(t,e);getMyGamePrediction=async t=>await this.matchQuizFacade.getMyGamePrediction(t);getUserGameEditions=async(t,e,i)=>await this.matchQuizFacade.getUserGameEditions(t,e,i);getUserGamePrediction=async(t,e,i)=>await this.matchQuizFacade.getUserGamePrediction(t,e,i);getMarketsResultsForGame=async(t,e)=>await this.matchQuizFacade.getMarketsResultsForGame(t,e);getGameWinners=async(t,e)=>await this.matchQuizFacade.getGameWinners(t,e)};var Sp=class{findLastGame=t=>{if(!Array.isArray(t)||t.length===0)return null;let e=t.filter(r=>r.status==="SETTLED").sort((r,o)=>new Date(o.predictionsCutoff).getTime()-new Date(r.predictionsCutoff).getTime());if(e.length>0)return e[0];let i=new Date,a=t.filter(r=>new Date(r.predictionsCutoff)<i).sort((r,o)=>new Date(o.predictionsCutoff).getTime()-new Date(r.predictionsCutoff).getTime());return a.length>0?a[0]:null};findNextGame=t=>{if(!Array.isArray(t)||t.length===0)return null;let e=this.findCurrentGame(t);if(!e)return null;let i=[...t].sort((r,o)=>new Date(r.predictionsCutoff).getTime()-new Date(o.predictionsCutoff).getTime()),a=new Date(e.predictionsCutoff).getTime();return i.find(r=>new Date(r.predictionsCutoff).getTime()>a)||null};findCurrentGame=t=>{if(!Array.isArray(t)||t.length===0)return null;let e=t.find(o=>o.status==="LIVE");if(e)return e;let i=t.find(o=>o.status==="OPEN");if(i)return i;let a=new Date;return t.filter(o=>new Date(o.predictionsCutoff)>a).sort((o,n)=>new Date(o.predictionsCutoff).getTime()-new Date(n.predictionsCutoff).getTime())[0]||null}};var Hi=class{topXFacade=null;helpers=new Sp;constructor(t){this.topXFacade=new oe(t)}getConfig=async()=>await this.topXFacade.getConfig();getGames=async(t,e)=>await this.topXFacade.getGames(t,e);getGameById=async(t,e)=>await this.topXFacade.getGameById(t,e);getGamePredictions=async(t,e,i)=>await this.topXFacade.getGamePredictions(t,e,i);getGameResults=async(t,e,i)=>await this.topXFacade.getGameResults(t,e,i);getCurrentGameResults=async t=>await this.topXFacade.getCurrentGameResults(t);play=async t=>await this.topXFacade.play(t);delete=async t=>await this.topXFacade.delete(t);getMyGameEditions=async(t,e)=>await this.topXFacade.getMyGameEditions(t,e);getMyGamePrediction=async t=>await this.topXFacade.getMyGamePrediction(t);getUserGameEditions=async(t,e,i)=>await this.topXFacade.getUserGameEditions(t,e,i);getUserGamePrediction=async(t,e,i)=>await this.topXFacade.getUserGamePrediction(t,e,i);getMarketsResultsForGame=async(t,e)=>await this.topXFacade.getMarketsResultsForGame(t,e);getGameWinners=async(t,e)=>await this.topXFacade.getGameWinners(t,e)};var vp=class{remapUserVotes=t=>{let e=new wn;return e.meta=this.remapMeta(t.meta.pagination),e.data=t.data.map(i=>this.remapUserVoteModel(i)),e};remapResults=t=>{let e=new Tn;return e.meta=t.meta,e.data=t.data.map(i=>this.remapResultsModel(i)),e};remapMeta=t=>{let e=new y;return e.pagination.itemsPerPage=t.items_per_page,e.pagination.nextPageStartsAfter=t.next_page_starts_after,e};remapUserVoteModel=t=>{let e=new _n;return e.matchId=t.match_id,e.playerId=t.player_id,e.createdAt=t.created_at,e};remapResultsModel=t=>{let e=new En;return e.teamId=t.team_id,e.playerId=t.player_id,e.votes=t.votes,e.winner=t.winner,e}};var Cp=class{id=null;pollId=null;optionIds=[];optionsModels=[];userId=null;createdAt=null};var Ap=class extends et{remapPolls=t=>{let e=new bn;return e.meta.pagination=this.remapMetaPagination(t.meta.pagination),e.data=t.data.map(i=>this.remapPoll(i)),e};remapPollById=t=>{let e=new hn;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.status=t.status,e.language=t.language,e.authRequirement=t.auth_requirement,e.flags=t.flags,e.totalVotes=t.total_votes,e.customFields=t.custom_fields,e.related=t.related?this.remapRelated(t.related):[],e.branding=t.branding?this.remapBranding(t.branding):null,e.embedCode=t.embed_code,e.labels=t.labels,e.rules=t.rules,e.adContent=t.ad_content,e.options=t.options?this.remapOptions(t.options):[],e.context=t.context?this.remapContext(t.context):t.context,e.preferencesEnabled=t.preferences_enabled,e.multipleChoice=t.multiple_choice,e.maxMultipleChoiceOptions=t.max_multiple_choice_options,e.participationCount=t.participation_count,e.maxAttempts=t.max_attempts,e.externalActivity=t.external_activity,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapUserVote=t=>{let e=new yn;return e.id=t.id,e.pollId=t.poll_id,e.optionId=t.option_id,e.optionIds=t.option_ids,e.userId=t.user_id,e.attempts=t.attempts||null,e.previousVotes=t.previous_votes?t.previous_votes.map(i=>this.remapPreviousVotes(i)):[],e.createdAt=t.created_at,e};remapPreviousVotes=t=>{let e=new Cp;return e.id=t.id,e.pollId=t.poll_id,e.optionIds=t.option_ids,e.userId=t.user_id,e.createdAt=t.created_at,e};remapPollsVotes=t=>{let e=new Mn;return e.meta.pagination=this.remapMetaPagination(t.meta.pagination),e.data=t.data.map(i=>this.remapAllPollsVotes(i)),e};remapAllPollsVotes=t=>{let e=new $t;return e.id=t.id,e.pollId=t.poll_id,e.optionId=t.option_id,e.optionIds=t.option_ids,e.userId=t.user_id,e.createdAt=t.created_at,e};remapSinglePollVote=t=>{let e=new gn;return e.id=t.id,e.pollId=t.poll_id,e.optionId=t.option_id,e.optionIds=t.option_ids,e.userId=t.user_id,e.attempts=t.attempts||null,e.createdAt=t.created_at,e.previousVotes=t.previous_votes?t.previous_votes.map(i=>this.remapPreviousVotes(i)):[],e};remapMetaPagination=t=>{let e=new ut;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapPoll=t=>{let e=new pi;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.status=t.status,e.language=t.language,e.authRequirement=t.auth_requirement,e.flags=t.flags,e.totalVotes=t.total_votes,e.customFields=t.custom_fields,e.related=t.related?this.remapRelated(t.related):[],e.branding=t.branding?this.remapBranding(t.branding):null,e.embedCode=t.embed_code,e.labels=t.labels,e.adContent=t.ad_content,e.options=t.options?this.remapOptions(t.options):[],e.context=t.context?this.remapContext(t.context):t.context,e.preferencesEnabled=t.preferences_enabled,e.multipleChoice=t.multiple_choice,e.maxMultipleChoiceOptions=t.max_multiple_choice_options,e.participationCount=t.participation_count,e.maxAttempts=t.max_attempts,e.externalActivity=t.external_activity,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapContext=t=>{let e=new Ct;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new hr;return a.id=i.id,a.type=i.type,a.source=i.source,a}):null,e.campaign=t.campaign,e};remapRelated=t=>t.map(e=>{let i=new z;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i});remapOptions=t=>t.map(e=>{let i=new fn;return i.id=e.id,i.title=e.title,i.description=e.description,i.images=e.images,i.votes=e.votes,i.embedCode=e.embed_code,i.preferencesMapping=e.preferences_mapping?this.remapPreferencesMapping(e.preferences_mapping):[],i});remapPreferencesMapping=t=>t.map(e=>{let i=new ci;return i.preferenceId=e.preference_id,i})};var Op=class extends v{pollRemapper=null;playerOfTheMatchRemapper=null;constructor(t){super(t,O(t.environment,"voting")),this.pollRemapper=new Ap,this.playerOfTheMatchRemapper=new vp}getPolls=async(t,e)=>{let i=`/polls${this.apiSignInUrl}`;t&&(i+=t.constructMainFiltersUrl()),f(e)&&(i+=m());let a="There was a problem fetching polls",r=await this.fetchWithoutAuth(i,a);return this.pollRemapper.remapPolls(r)};getPollById=async(t,e)=>{let i=`/polls/${t}${this.apiSignInUrl}`;f(e)&&(i+=m());let a="There was a problem fetching the following poll: "+t,r=await this.fetchWithoutAuth(i,a);return this.pollRemapper.remapPollById(r.data)};voteForPoll=async(t,e)=>{let i=`/polls/${t}/votes${this.apiSignInUrl}`,a="PUT",r={option_ids:e},o="There was a problem voting for the following poll: "+t,n=await this.fetchWithAuth(i,o,a,r);return this.pollRemapper.remapUserVote(n.data)};deleteVoteForPoll=async t=>{let e=`/polls/${t}/votes${this.apiSignInUrl}`,i="DELETE",a="There was a problem deleting vote for the following poll: "+t;return await this.fetchWithAuth(e,a,i),!0};getMyPollVote=async t=>{let e=`/polls/${t}/votes${this.apiSignInUrl}`,i="There was a problem fetching user's own vote for the following poll: "+t,a=await this.fetchWithAuth(e,i);return this.pollRemapper.remapSinglePollVote(a.data)};getMyPollsVotes=async t=>{let e=`/polls/votes${this.apiSignInUrl}`;t&&(e+=t.constructMainFiltersUrl());let i="There was a problem fetching user's votes for polls",a=await this.fetchWithAuth(e,i);return this.pollRemapper.remapPollsVotes(a)};voteForPlayerOfTheMatch=async(t,e)=>{let i=`/football/potm/${t}${this.apiSignInUrl}`,a="PUT",r={player_id:e},o="There was a problem voting for 'Player of the match'";return{playerId:(await this.fetchWithAuth(i,o,a,r)).data.player_id}};deleteVoteForPlayerOfTheMatch=async t=>{let e=`/football/potm/${t}${this.apiSignInUrl}`,i="DELETE",a="There was a problem with deleting vote for 'Player of the match'";await this.fetchWithAuth(e,a,i)};getOwnVotesForPlayerOfTheMatch=async t=>{let e=`/football/potm${this.apiSignInUrl}`;t&&(e+=t.constructFiltersUrl());let i="There was a problem fetching user's own votes for 'Player of the match'",a=await this.fetchWithAuth(e,i);return this.playerOfTheMatchRemapper.remapUserVotes(a)};getResultsForPlayerOfTheMatch=async(t,e)=>{let i=`/football/potm/${t}${this.apiSignInUrl}${f(e)?m():""}`,a="There was a problem fetching results for 'Player of the match'",r=await this.fetchWithoutAuth(i,a);return this.playerOfTheMatchRemapper.remapResults(r)}};var xp=class{idMappingService=null;idSchema=null;errorHandlingMode=null;validator=null;activityService=null;football=null;constructor(t){this.idSchema=t.idSchema,this.errorHandlingMode=t.errorHandlingMode,this.idMappingService=new R(t),this.validator=new ae(t),this.activityService=new wt(t),this.football=new it(t)}finalizePollsFilters=async t=>{if(this.idSchema!=="native"&&t.entityIds&&t.entityIds.length>0){this.validator.validateFilters(t);let e=await this.idMappingService.getEntityIdsBySchemaId(Array.from(t.entityIds),t.entityType,"native");t.entityIds=e[t.entityType]}};remapTags=async(t,e,i)=>{if(this.idSchema!="native"&&t.context&&t.context.tags&&t.context.tags.length){let a=JSON.parse(JSON.stringify(t.context.tags)),r=await this.activityService.remapTagsIds(a,e,i);t.context.tags=r}};remapMatchAndPlayerIds=async(t,e,i,a)=>{let r={match:[t],player:[e]},o=await this.idMappingService.idMappingFacade.getEntitiesByIds(r,i,a);if(o.match.length>0&&o.player.length>0){let n=o.match[0],l=o.player[0];return[n,l]}throw this.errorHandlingMode==="default"?new b(404,"entity_ids_not_found","Some of the sport entity IDs were not found for the provided id schema"):new h(404,"entity_ids_not_found","Some of the sport entity IDs were not found for the provided id schema")};remapMatchIds=async(t,e,i)=>{let a=Array.from(t),r={match:t},o=await this.idMappingService.idMappingFacade.getEntitiesByIds(r,e,i);if(o.match.length>0&&o.match.length===a.length)return o.match;throw this.errorHandlingMode==="default"?new b(404,"match_ids_not_found","Some of the match IDs were not found for the provided id schema"):new h(404,"match_ids_not_found","Some of the match IDs were not found for the provided id schema")};setModelsForUserVotes=async t=>{let e=t.data.map(a=>a.matchId),i=t.data.map(a=>a.playerId);if(e.length>0&&i.length>0){let a=await this.football.footballFacade.getMatchesMapWithNativeIds(e),r=await this.football.footballFacade.getPlayersMapWithNativeIds(i);t.data.forEach(o=>{o.matchModel=a[o.matchId]||null,o.playerModel=r[o.playerId]||null,o.matchId=o.matchModel?o.matchModel.id:o.matchId,o.playerId=o.playerModel?o.playerModel.id:o.playerId}),t.meta.pagination.nextPageStartsAfter&&(t.meta.pagination.nextPageStartsAfter=t.data[t.data.length-1].matchId)}return t};setModelsForPotmResults=async t=>{let e=t.map(a=>a.teamId),i=t.map(a=>a.playerId);if(e.length>0&&i.length>0){let a=await this.football.footballFacade.getTeamsMapWithNativeIds(e),r=await this.football.footballFacade.getPlayersMapWithNativeIds(i);t.forEach(o=>{o.teamModel=a.get(o.teamId)||null,o.playerModel=r[o.playerId]||null,o.teamId=o.teamModel?o.teamModel.id:o.teamId,o.playerId=o.playerModel?o.playerModel.id:o.playerId})}}};var Lp=class{https=null;service=null;idSchema=null;constructor(t){this.idSchema=t.idSchema,this.https=new Op(t),this.service=new xp(t)}getPolls=async(t,e)=>{t&&(t=new li(t),await this.service.finalizePollsFilters(t));let i=await this.https.getPolls(t,e);for(let a of i.data)await this.service.remapTags(a,"native",this.idSchema);return i};getPollById=async(t,e)=>{let i=await this.https.getPollById(t,e);return await this.service.remapTags(i,"native",this.idSchema),i};voteForPoll=async(t,e)=>(typeof e=="string"&&(console.warn("Passing a single optionId as a string will be deprecated. Please pass it as an array."),e=[e]),await this.https.voteForPoll(t,e));deleteVoteForPoll=async t=>await this.https.deleteVoteForPoll(t);getMyPollVote=async(t,e)=>{let i=await this.https.getMyPollVote(t);if(e){let a=await this.getPolls(new li({pollIds:[t]}),!0);i.pollModel=a.data.find(r=>r.id===t)||null,i.optionModel=a.data.find(r=>r.id===t)?.options.find(r=>r.id===i.optionId)||null,i.optionsModels=i.optionIds?a.data.find(r=>r.id===t)?.options.filter(r=>i.optionIds.includes(r.id))||[]:[],i.previousVotes.forEach(r=>{r.optionsModels=a.data.find(o=>o.id===r.pollId)?.options.filter(o=>r.optionIds.includes(o.id))||[]})}return i};getMyPollsVotes=async t=>{t&&(t=new I(t));let e=await this.https.getMyPollsVotes(t),i=e.data.map(r=>r.id),a=await this.getPolls(new li({pollIds:i}),!0);return e.data=e.data.map(r=>(r.pollModel=a.data.find(o=>o.id===r.pollId)||null,r.optionModel=r.pollModel?.options.find(o=>o.id===r.optionId)||null,r.optionsModels=r.optionIds?r.pollModel?.options.filter(o=>r.optionIds.includes(o.id))||[]:[],r)),e};voteForPlayerOfTheMatch=async(t,e)=>{if(this.idSchema!=="native"){let[i,a]=await this.service.remapMatchAndPlayerIds(t,e,this.idSchema,"native");return await this.https.voteForPlayerOfTheMatch(i,a),{playerId:e}}return await this.https.voteForPlayerOfTheMatch(t,e)};deleteVoteForPlayerOfTheMatch=async t=>{if(this.idSchema!=="native"){let e=await this.service.remapMatchIds([t],this.idSchema,"native");return await this.https.deleteVoteForPlayerOfTheMatch(e[0]),!0}return await this.https.deleteVoteForPlayerOfTheMatch(t),!0};getOwnVotesForPlayerOfTheMatch=async t=>{if(t&&(t=new In(t)),t&&t.matchIds&&t.matchIds.length>0&&this.idSchema!=="native"){let i=await this.service.remapMatchIds(t.matchIds,this.idSchema,"native");t.matchIds=i}let e=await this.https.getOwnVotesForPlayerOfTheMatch(t);return await this.service.setModelsForUserVotes(e)};getResultsForPlayerOfTheMatch=async(t,e)=>{if(this.idSchema!=="native"){let a=await this.service.remapMatchIds([t],this.idSchema,"native"),r=await this.https.getResultsForPlayerOfTheMatch(a[0],e);return await this.service.setModelsForPotmResults(r.data),r}let i=await this.https.getResultsForPlayerOfTheMatch(t,e);return await this.service.setModelsForPotmResults(i.data),i}};var $i=class{facade=null;constructor(t){this.facade=new Lp(t)}getPolls=async(t,e)=>await this.facade.getPolls(t,e);getPollById=async(t,e)=>await this.facade.getPollById(t,e);voteForPoll=async(t,e)=>await this.facade.voteForPoll(t,e);deleteVoteForPoll=async t=>await this.facade.deleteVoteForPoll(t);getMyPollVote=async(t,e)=>await this.facade.getMyPollVote(t,e);getMyPollsVotes=async t=>await this.facade.getMyPollsVotes(t);voteForPlayerOfTheMatch=async(t,e)=>await this.facade.voteForPlayerOfTheMatch(t,e);deleteVoteForPlayerOfTheMatch=async t=>await this.facade.deleteVoteForPlayerOfTheMatch(t);getOwnVotesForPlayerOfTheMatch=async t=>await this.facade.getOwnVotesForPlayerOfTheMatch(t);getResultsForPlayerOfTheMatch=async(t,e)=>await this.facade.getResultsForPlayerOfTheMatch(t,e)};var Dp=class{clientHttps=null;topX=null;matchQuiz=null;loyalty=null;miniGames=null;voting=null;constructor(t){this.clientHttps=new Q(t),this.topX=new Hi(t),this.matchQuiz=new Vi(t),this.loyalty=new se(t),this.miniGames=new re(t),this.voting=new $i(t)}getListContent=async(t,e,i)=>{e&&(e=new Io(e));let a=await this.clientHttps.getListContent(t,e,i);return await this.setModels(a.data,i),a};setModels=async(t,e)=>{let i=[],a=new Map;t.forEach(r=>{if(a.has(r.entityType)){let o=a.get(r.entityType);a.set(r.entityType,[...o,r.entityId])}else a.set(r.entityType,[r.entityId])});try{for(let[r,o]of Array.from(a.entries()))switch(r){case"TOP_X":let n=await this.topX.getGames({limit:o.length,gameIds:o},e);i=[...i,...n.data];break;case"MATCH_QUIZ":let l=await this.matchQuiz.getGames({limit:o.length,gameIds:o},e);i=[...i,...l.data];break;case"LEADERBOARD_TEMPLATES":let p=await this.loyalty.getTemplates(void 0,e);i=[...i,...p.data.filter(_=>o.includes(_.id))];break;case"CLASSIC_QUIZ":let c=await this.miniGames.getClassicQuizzes({limit:o.length,classicQuizIds:o},!1,e);i=[...i,...c.data];break;case"EITHER_OR":let u=await this.miniGames.getEitherOrs({limit:o.length,eitherOrIds:o},!1,e);i=[...i,...u.data];break;case"POLL":let d=await this.voting.getPolls({limit:o.length,pollIds:o},e);i=[...i,...d.data];break;case"PERSONALITY_QUIZ":let M=await this.miniGames.getPersonalityQuizzes({limit:o.length,personalityQuizIds:o},e);i=[...i,...M.data];break;default:}}catch(r){throw console.error("An error occurred while trying to set models for list content entities",r),r}t.forEach(r=>{let o=i.find(n=>n.id===r.entityId)||null;r.entityModel=o})}};var Bp=class{facade=null;constructor(t){this.facade=new Dp(t)}getListContent=async(t,e,i)=>await this.facade.getListContent(t,e,i)};var Np=class{fromResponse(t,e){let i=new Map;return t.matches.forEach(a=>{let r=a.odds.map(o=>{let n=new Cs;return n.bookmaker=o.bookmaker?this.remapBookmaker(o.bookmaker):null,n.type=o.type,n.markets=o.markets?this.remapMarkets(o.markets,e):[],n});i.set(a.id,r)}),i}remapBookmaker(t){let e=new Is;return e.id=t.id,e.name=t.name,e.assets=t.assets?this.remapAssets(t.assets):[],e.links=t.links||[],e.branding=t.branding?this.remapBranding(t.branding):null,e.eventUrls=t.event_urls?this.remapEventUrls(t.event_urls):[],e.stakesDisclaimer=t.stakes_disclaimer,e.domainName=t.domain_name,e}remapMarkets(t,e){return t.map(i=>{let a=new Es;return a.type=i.type?this.remapMarketType(i.type):null,a.scope=i.scope?this.remapMarketScope(i.scope):null,a.selections=i.selections?this.remapMarketSelections(i.selections,a.type.code,e):[],a})}remapEventUrls(t){return t.map(e=>{let i=new Ps;return i.url=e.url,i.appType=e.app_type,i})}remapBranding(t){let e=new ws;return e.backgroundColor=t.background_color,e.textColor=t.text_color,e}remapAssets(t){return t.map(e=>{let i=new _s;return i.logo=e.logo,i.type=e.type,i.transparentBackgroundUrl=e.transparent_background_url,i.backgroundColor=e.background_color,i})}remapMarketType=t=>{let e=new Ss;return e.id=t.id,e.name=t.name,e.code=t.code,e.entityType=t.entity_type,e};remapMarketScope=t=>{let e=new Rs;return e.id=t.id,e.name=t.name,e.type=t.type,e.entityType=t.entity_type,e};remapMarketSelections=(t,e,i)=>{let a=Array.from(t);return i.length>0&&e==="OVER_UNDER"&&(a=a.filter(r=>r.code==="over"?i.some(o=>{switch(o){case"OVER_GOALS_0_5":return r.value==="0.5";case"OVER_GOALS_1_5":return r.value==="1.5";case"OVER_GOALS_2_5":return r.value==="2.5";case"OVER_GOALS_3_5":return r.value==="3.5";case"OVER_GOALS_4_5":return r.value==="4.5";case"OVER_GOALS_5_5":return r.value==="5.5";default:return!1}}):!1)),a.map(r=>{let o=new Fs;return o.id=r.id,o.name=r.name,o.code=r.code,o.value=r.value,o.odds=r.odds,o.urls=r.urls?this.remapEventUrls(r.urls):[],o.movement=r.movement,o.oddsOld=r.odds_old,o.entityType=r.entity_type,o.additionalInfo=r.additional_info,o.providerInfo=r.provider_info?this.remapProviderInfo(r.provider_info):null,o})};remapProviderInfo=t=>{let e=new vs;return e.selectionId=t.selection_id,e.eventId=t.event_id,e.marketId=t.market_id,e.competitionId=t.competition_id,e}};var kp=class{footballBaseUrl="https://football.api.sportal365.com/";retryRequest=!1;oddClient=null;remapper=null;constructor(t){this.oddClient=t.oddClient,this.remapper=new Np}getMatchOdds=async(t,e)=>{let i=`v2/matches/livescore?odd_client=${this.oddClient.name}&match_ids=${t.join(",")}${e.constructFiltersUrl()}`,a=`Error while fetching match odds for matchIds: ${t.join(",")}`,r=await this.fetchWithAuth(i,a),o=e.marketTypes&&e.marketTypes.length>0?e.marketTypes.filter(n=>n.includes("OVER")):[];return this.remapper.fromResponse(r,o)};getAuthHeaders=()=>{let t=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");return{"Content-Type":"application/json",Authorization:`Basic ${t}`}};fetchWithAuth=async(t,e)=>{let i=await fetch(this.footballBaseUrl+t,{headers:this.getAuthHeaders()}),a=await i.json();if(!i.ok)throw(i.status===401||i.status===403)&&!this.retryRequest&&(this.retryRequest=!0,await this.fetchWithAuth(t,e)),this.retryRequest=!1,console.warn(e,a),a;return this.retryRequest=!1,a}};var Gp=class{https;idSchema;oddClient;idMapping=null;validator;constructor(t){this.idSchema=t.idSchema,this.oddClient=t.oddClient,this.https=new kp(t),this.validator=new K(t.errorHandlingMode),this.idMapping=new R(t)}getByMatchIds=async(t,e)=>{this.validateOddClient(),(!t||!Array.isArray(t)||t.length===0)&&this.validator.throwException(400,"invalid_match_ids","Match IDs are invalid!");let i=Array.from(t);this.idSchema!=="sportal365"&&(i=(await this.idMapping.idMappingFacade.getEntitiesByIds({match:Array.from(t)},this.idSchema,"sportal365")).match);let a=new Ts(e),r=await this.https.getMatchOdds(i,a);if(this.idSchema!=="sportal365"){let o=await this.idMapping.idMappingFacade.getEntitiesByIdsMap({match:Array.from(r.keys())},"sportal365",this.idSchema),n=new Map;return Array.from(r.entries()).forEach(([l,p])=>{n.set(o.get(l),p)}),n}return r};validateOddClient=()=>{this.oddClient||this.validator.throwException(412,"odd_client_configuration_not_found","Odds namespace requires oddClient configuration to be set")}};var Up=class{facade;constructor(t){this.facade=new Gp(t)}getByMatchIds=async(t,e)=>await this.facade.getByMatchIds(t,e)};var Vp=class{factory=null;privateLeagueHttps=null;loyaltyHttps=null;profile=null;service=null;discussionsService=null;constructor(t){this.factory=new Di,this.privateLeagueHttps=new Li(t),this.loyaltyHttps=new Rt(t),this.profile=new D(t),this.service=new Gi(t),this.discussionsService=new ne(t)}create=async t=>{let e=this.factory.createRequestBodyFromParam(t,"PRIVATE"),i=await this.privateLeagueHttps.create(e,"PRIVATE_LEAGUE");return await this.service.setTemplateModels(i),i};getById=async(t,e)=>{let i=await this.privateLeagueHttps.getById(t,"PRIVATE_LEAGUE",e);return await this.service.setTemplateModels(i),i};getMyLeagues=async t=>{t=new Js(t);let e=await this.privateLeagueHttps.getMyLeagues(t,"PRIVATE_LEAGUE");return await this.service.setTemplateModelsInLeagues(e),e};update=async(t,e)=>{let i=this.factory.createUpdateRequestBodyFromParam(e,"PRIVATE"),a=await this.privateLeagueHttps.update(t,i,"PRIVATE_LEAGUE");return await this.service.setTemplateModels(a),a};updateTemplate=async(t,e,i)=>{let a=await this.privateLeagueHttps.updateLeagueTemplate(t,e,i,"PRIVATE_LEAGUE");return await this.service.setTemplateModels(a),a};delete=async t=>await this.privateLeagueHttps.delete(t,"PRIVATE_LEAGUE");invite=async(t,e)=>await this.privateLeagueHttps.invite(t,e);deleteInvitation=async(t,e)=>await this.privateLeagueHttps.deleteInvitation(t,e);accept=async t=>{let i=await this.privateLeagueHttps.accept(t,!0,"PRIVATE_LEAGUE");return await this.finalizeAcceptModel(i,!0)};reject=async t=>{let i=await this.privateLeagueHttps.accept(t,!1,"PRIVATE_LEAGUE");return await this.finalizeAcceptModel(i,!1)};banUsers=async(t,e)=>await this.privateLeagueHttps.ban(t,e);unbanUsers=async(t,e)=>await this.privateLeagueHttps.unban(t,e);join=async t=>{let e=await this.privateLeagueHttps.join(t);return await this.finalizeAcceptModel(e,!0)};leave=async t=>await this.privateLeagueHttps.leave(t,"PRIVATE_LEAGUE");finalizeAcceptModel=async(t,e)=>{if(e){let i=await this.getById(t.leagueId);t.leagueModel=i}return await this.service.setProfileModel(t),t};getMyLeaguesStandings=async t=>{t&&(t=new Zs(t));let e=await this.profile.getOwn().getInfo(),i=await this.loyaltyHttps.getUserRankingsForPrivateLeagueAndChallenges(e.id,"PRIVATE_LEAGUE",t);for(let a of i.data){let r=await this.getById(a.privateLeagueId);a.privateLeagueModel=r}return this.service.setTemplateModelsFromLeagueModels(i.data,"PRIVATE_LEAGUE"),i};getInvitations=async t=>{t=new ai(t),t.type="PRIVATE";let e=await this.privateLeagueHttps.getInvitations("PRIVATE_LEAGUE",t);return await this.service.setTemplateModelsInLeagues(e.data),e};getReportedPosts=async(t,e)=>{e&&(e=new ri(e));let i=await this.privateLeagueHttps.getReportedPosts(t,e);return i.data=await this.discussionsService.finalizePostFullModel(i.data),i};getPredictions=async(t,e)=>{if(e){if(e.limit&&e.limit>20)throw new h(400,"invalid_limit","Invalid limit. The maximum limit is: "+20 .toString());e=new oi(e)}let i=await this.privateLeagueHttps.getPredictions(t,e);return await this.service.setModelsForPredictions(i)};moderatePost=async(t,e)=>await this.privateLeagueHttps.moderatePost(t,e)};var Hp=class{privateLeaguesFacade=null;constructor(t){this.privateLeaguesFacade=new Vp(t)}create=async t=>await this.privateLeaguesFacade.create(t);update=async(t,e)=>await this.privateLeaguesFacade.update(t,e);updateTemplate=async(t,e,i)=>await this.privateLeaguesFacade.updateTemplate(t,e,i);delete=async t=>await this.privateLeaguesFacade.delete(t);getById=async(t,e)=>await this.privateLeaguesFacade.getById(t,e);getMyLeagues=async t=>await this.privateLeaguesFacade.getMyLeagues(t);invite=async(t,e)=>await this.privateLeaguesFacade.invite(t,e);deleteInvitation=async(t,e)=>await this.privateLeaguesFacade.deleteInvitation(t,e);accept=async t=>await this.privateLeaguesFacade.accept(t);reject=async t=>await this.privateLeaguesFacade.reject(t);banUsers=async(t,e)=>await this.privateLeaguesFacade.banUsers(t,e);unbanUsers=async(t,e)=>await this.privateLeaguesFacade.unbanUsers(t,e);join=async t=>await this.privateLeaguesFacade.join(t);leave=async t=>await this.privateLeaguesFacade.leave(t);getMyLeaguesStandings=async t=>await this.privateLeaguesFacade.getMyLeaguesStandings(t);getInvitations=async t=>await this.privateLeaguesFacade.getInvitations(t);getReportedPosts=async(t,e)=>await this.privateLeaguesFacade.getReportedPosts(t,e);getPredictions=async(t,e)=>await this.privateLeaguesFacade.getPredictions(t,e);moderatePost=async(t,e)=>await this.privateLeaguesFacade.moderatePost(t,e)};var $p=class{KEY_PREFIX="fu-progress-";get=(t,e)=>{let i=localStorage.getItem(`${this.KEY_PREFIX}${t}-${e}`);return i&&JSON.parse(i)};set=(t,e,i)=>(localStorage.setItem(`${this.KEY_PREFIX}${t}-${e}`,JSON.stringify(i)),JSON.stringify(i));delete=(t,e)=>{localStorage.removeItem(`${this.KEY_PREFIX}${t}-${e}`)}};var zp=class extends K{validatePrediction=t=>{(!t||!Array.isArray(t)||t.length===0||t.some(e=>!e))&&this.throwException(400,"invalid_method_call","The prediction argument is invalid. For more information please visit our documentation")}};var Qp=class{https=null;profile=null;validator=null;constructor(t){this.https=new jt(t),this.profile=new D(t),this.validator=new zp(t.errorHandlingMode)}getGames=async(t,e)=>(t&&(t=new sn(t)),await this.https.getStandingsGames(t,e));getGameById=async(t,e)=>await this.https.getStandingGameById(t,e);makePrediction=async(t,e)=>(this.validator.validatePrediction(e),await this.https.makeStandingGamePrediction(t,e));updatePrediction=async(t,e,i)=>(this.validator.validatePrediction(i),await this.https.updateStandingGamePrediction(t,e,i));getGamePredictionForUser=async(t,e,i)=>{let a=await this.https.getStandingGamePredictionsForUser(t,e,i),r=null;try{r=await this.profile.getById(e).getInfo()}catch(o){console.error(o)}return a.data.forEach(o=>{o.profileModel=r}),a};getRankings=async(t,e,i)=>{e&&(e=new nn(e));let a=await this.https.getStandingGameRankings(t,e,i),r=a.data.map(n=>n.profileId),o=[];return r.length>0&&(o=await this.profile.getByIds(r),a.data=a.data.map(n=>(n.profileModel=o.find(l=>l.id===n.profileId)||null,n))),a}};var qp=class{facade=null;constructor(t){this.facade=new Qp(t)}getGames=async(t,e)=>await this.facade.getGames(t,e);getGameById=async(t,e)=>await this.facade.getGameById(t,e);makePrediction=async(t,e)=>await this.facade.makePrediction(t,e);updatePrediction=async(t,e,i)=>await this.facade.updatePrediction(t,e,i);getGamePredictionForUser=async(t,e,i)=>await this.facade.getGamePredictionForUser(t,e,i);getRankings=async(t,e,i)=>await this.facade.getRankings(t,e,i)};function td(){let s=Zu(),t="-RC",e=null,i=s.version.split("."),a=Number(i[0]),r=Number(i[1]),o=i[2];if(o.includes(t)){let n=o.split(t);o=Number(n[0]),e=Number(n[1])}else o=Number(o);return{version:s.version,major:a,minor:r,patch:o,releaseCandidate:e}}var Yc=null,fu=null;function xd(s){if(Ld(s)){let t=Dd(s);if(t.isValid)return Yc={profile:new D(s),football:new it(s),predictor:new ki(s),loyalty:new se(s),topX:new Hi(s),matchQuiz:new Vi(s),activity:new Yn(s),miniGames:new re(s),discussions:new fp(s),privateLeagues:new Hp(s),challenges:new up(s),progress:new $p,voting:new $i(s),fantasy:new wp(s),helpers:new _p(s),idMapping:new Rp(s),bracketGame:new Gl(s),lists:new Bp(s),standingGame:new qp(s),eventGame:new bp(s),odds:new Up(s),getVersion:td},fu={...s},Yc;Bd(t)}return Yc}var Ld=s=>!Yc||JSON.stringify(s)!==JSON.stringify(fu)||s.authProvider?.getIdToken()!==fu.authProvider?.getIdToken(),Dd=s=>{let e=new $n().validate(s);return(e.idSchema.validation==="missing"||e.idSchema.validation==="invalid")&&(console.warn(e.idSchema.message.text),s.idSchema="native"),(e.environment.validation==="missing"||e.environment.validation==="invalid")&&(console.warn(e.environment.message.text),s.environment="prod"),(e.lang.validation==="missing"||e.lang.validation==="invalid")&&(console.warn(e.lang.message.text),s.lang="en"),(e.errorHandlingMode.validation==="missing"||e.errorHandlingMode.validation==="invalid")&&(console.warn(e.errorHandlingMode.message.text),s.errorHandlingMode="default"),e.authProvider.validation==="invalid"&&console.warn(e.authProvider.message.text),(e.oddClient.message.type==="warning"||e.oddClient.credentials.message.type==="warning")&&console.warn(e.oddClient.message.text||e.oddClient.credentials.message.text),e},Bd=s=>{let t="isValid";Object.keys(s).forEach(e=>{let i=s[e];if(e!==t&&e!=="authProvider"){if(i.message.type==="error")throw new Error(i.message.text)}else if(e!==t&&e==="authProvider"){if(i?.message.type==="error")throw new Error(i.message.text);Object.keys(new pe).forEach(a=>{if(i[a].message.type==="error")throw new Error(i[a].message.text)})}if(e!==t&&e==="oddClient"){if(i?.message.type==="error")throw new Error(i.message.text);let a=i;if(a.credentials.message.type==="error")throw new Error(a.credentials.message.text)}})};export{br as AcceptChallengeModel,js as AcceptPrivateLeagueModel,Yi as AchievementsStats,Ee as ActionValueModel,au as ActionsEnum,Re as ActionsModel,ye as ActivityFilters,nc as ActivityMeta,ge as ActivityResponseBody,Mc as AssetsModel,Te as AutomaticModerationModel,lr as BadgesModel,Wa as BadgesModelV2,pr as BadgesValue,q as BadgesValueV2,_s as BookmakerAssetModel,ws as BookmakerBrandingModel,kc as BookmakerLinkModel,Is as BookmakerModel,Ps as BookmakerUrlModel,Os as BothTeamsFixtureModel,yr as BracketGameFilters,be as BracketGameFixtureScoreModel,gr as BracketGameFixtures,pa as BracketGameFixturesModel,Me as BracketGameMetaModel,ca as BracketGameMetaParticipantsModel,ua as BracketGameModel,fa as BracketGamePredictionFixturesModel,ga as BracketGamePredictionModel,cc as BracketGamePredictionRequestBody,ju as BracketGamePredictionStatusEnum,fr as BracketGamePredictionsFilters,da as BracketGamePredictionsModel,ya as BracketGameRankingsModel,Ie as BracketGameTiebreaker,ha as BracketGameTiebreakerModel,ma as BracketGamesModel,lu as BracketWinnerEnum,fo as BrandingColorsModel,yo as BrandingImagesModel,ho as BrandingModel,go as BrandingUrlsModel,Na as BreakdownModel,Uc as CalculatedOneXTwoFromScoresModel,lc as CampaignModel,Mr as ChallengeCreateModel,wr as ChallengeFilters,Pr as ChallengeRankingsModel,Ir as ChallengeUpdateModel,ze as ClassicQuizBasicModel,Go as ClassicQuizFilters,Qe as ClassicQuizFiltersMeta,Uo as ClassicQuizFullModel,Wo as ClassicQuizLeaderboardFilters,We as ClassicQuizLeaderboardMeta,Ho as ClassicQuizOptionModel,Ac as ClassicQuizParticipationBodyModel,$o as ClassicQuizParticipationModel,zo as ClassicQuizParticipationQuestionModel,Ei as ClassicQuizParticipationsFilters,Vo as ClassicQuizQuestionModel,qo as ClassicQuizQuestionsReportModel,qe as ClassicQuizRankFilters,Ko as ClassicQuizRankModel,Ri as ClassicQuizUserParticipationModel,Qo as ClassicQuizUserParticipationsModel,jo as ClassicQuizUserRank,xc as ClassicQuizUserRankModel,Lc as ClassicQuizzesLeaderboardModel,Oc as ClassicQuizzesModel,ue as ClassicQuizzesStats,wo as ClientBadges,_o as ClientBadgesV2,Kr as CompetitionBasicModel,_i as CompetitionFilters,jr as CompetitionFullModel,Z as CompletedModel,Da as ConsentModel,Kc as ConsentRequestBody,pc as ContentModel,dn as ContestWinners,Ct as ContextModel,Ls as CornersFixtureModel,Vt as CorrectScoreFixtureModel,fi as CreateActivityRequestBody,uc as CreatePostParamBody,Ca as DetailedProfileModel,Ua as DictionaryModel,Tr as DiscussionModel,de as DiscussionStats,rr as DiscussionsBadgeRequirements,or as DiscussionsBadgesValue,Va as DiscussionsConfigModel,Lr as DiscussionsFilters,Dl as DoubleChanceEnum,Ns as DoubleChanceFixtureModel,Ke as EitherOrBasicModel,Yo as EitherOrFilters,Xo as EitherOrFullModel,ts as EitherOrParticipationModel,is as EitherOrParticipationRequestFullModel,es as EitherOrParticipationRequestModel,rs as EitherOrParticipationStepsModel,Fi as EitherOrParticipationStepsOptionModel,Jo as EitherOrPointsModel,os as EitherOrResultsBreakdownModel,ss as EitherOrResultsModel,ns as EitherOrResultsStandingsModel,me as EitherOrStats,Zo as EitherOrStatsModel,Dc as EitherOrsModel,Pc as EntitiesFollows,Tc as EntitiesFollowsFilters,Qi as EnvironmentEnum,C as ErrorCodes,Yp as ErrorHandlingModeEnum,x as ErrorMessages,A as ErrorStatuses,Br as EventGameFilters,hc as EventGameFixtureEnumModel,fc as EventGameFixtureNumberModel,dc as EventGameFixtures,At as EventGameFixturesModel,Sa as EventGameModel,oc as EventGameOutcomeTypeEnum,Ot as EventGamePredictionFixturesModel,Ra as EventGamePredictionModel,mc as EventGamePredictionRequestBody,Yu as EventGamePredictionStatusEnum,Nr as EventGamePredictionsFilters,va as EventGamePredictionsModel,kr as EventGameRankingsFilters,Fa as EventGameRankingsModel,_e as EventGameTiebreaker,Ea as EventGameTiebreakerModel,Ta as EventGamesModel,Ba as ExternalActivityModel,xd as FansUnitedSDK,Ic as FansUnitedSDKModel,Kt as FansUnitedSdkFetchException,Le as FantasyCoefficientsModel,ur as FantasyConfigModel,dr as FantasyMultipliersModel,Ur as FantasyPlayerDetailedStatsMetaModel,Vr as FantasyPlayerDetailedStatsModel,Hr as FantasyPlayerStatsModel,zr as FantasyPlayersMetaModel,De as FantasyPlayersModel,Qr as FantasyPlayersPointsModel,Ge as FantasyPredictionRequestBody,vo as FiltersMetaModel,ln as FixturesGamesModel,No as FixturesMatchQuizModel,As as FixturesPredictionModel,Ye as FixturesResponseModel,cn as FixturesTopXModel,Ii as FollowFilters,bi as FollowModel,xa as FollowStatusModel,Oa as FollowersModel,Aa as FollowingModel,tr as FootballBadgeRequirements,er as FootballBadgesValue,Yr as FootballCountryModel,hu as FootballMatchStatusEnum,Xt as FootballPaginationModel,on as FullInterestModel,ka as FullnessProfile,Ya as GameBadgeRequirements,Xa as GameBadgesValue,si as GameByIdModel,ko as GameMarketsResults,Jt as GameModel,mi as GamePredictionsStats,un as GameResultsModel,ft as GameStatusEnum,Ja as GamesBadgeRequirements,Za as GamesBadgesValue,nt as GamesFilters,Tt as GamesListModel,Pt as GamesMatchQuizListModel,Ht as GamesTopXListModel,cr as GeneralBadgesValue,xe as GeneralRequirementModel,Bl as HalfTimeFullTimeEnum,Gs as HalfTimeFullTimeFixtureModel,Po as HighestSuccessRateFilters,So as HighestSuccessRateModel,N as IdSchemaEnum,W as ImagesModel,rn as InterestModel,ai as InvitationFilters,On as LangEnum,La as LeadModel,Wc as LeadRequestBody,Ec as LeaderboardLeagueResponse,$e as LeaderboardModel,Rc as LeaderboardResponseModel,To as LeagueLeaderboardFilters,He as LeagueLeaderboardMetaModel,Ve as LineupsModel,Io as ListContentFilters,mr as ListContentModel,Rn as ListContentResponseModel,Ha as LoyaltyConfigModel,nr as LoyaltyConfigModelV2,Eo as LoyaltyFilters,Bt as LoyaltyMeta,bo as MappingModel,Mo as MappingResponseModel,rt as MarketEnum,Gc as MarketsConfigModel,Xr as MatchBasicModel,ti as MatchCorrectScoreMarketResultModel,gt as MatchFilters,Jr as MatchFullModel,qs as MatchMarketsResultsModel,Ts as MatchOddsFilters,du as MatchOddsMarketEnum,Es as MatchOddsMarketModel,Rs as MatchOddsMarketScopeModel,Fs as MatchOddsMarketSelectionModel,Ss as MatchOddsMarketTypeModel,Cs as MatchOddsModel,Qs as MatchPlayerMarketResultModel,Se as MatchQuizConfigModel,X as MatchStatus,Ks as MatchSummaryModel,k as MetaFootballModel,as as MiniGameImages,ir as MiniGamesBadgeRequirements,ar as MiniGamesBadgesValue,Gt as MiniGamesContext,Ut as MiniGamesContextTag,kt as MiniGamesFilters,_r as MyChallengesFilters,Js as MyLeaguesFilters,L as NoYesModel,uu as OddFormatEnum,pu as OddTypeEnum,Ll as OneXTwoEnum,Vs as OneXTwoFixtureModel,Ju as OutcomeEnum,Je as OverCornersFixtureModel,Ze as OverGoalsFixtureModel,na as OwnActivityFilters,ea as PaginationActivities,Y as PaginationFootballProperties,Hc as PastTemplateModel,Hs as PenaltyMatchFixtureModel,je as PersonalityQuizBasicModel,hs as PersonalityQuizFilters,ms as PersonalityQuizFullModel,ds as PersonalityQuizOptionModel,Nc as PersonalityQuizParticipationBodyModel,fs as PersonalityQuizParticipationModel,gs as PersonalityQuizParticipationQuestionModel,bs as PersonalityQuizParticipationsFilters,ys as PersonalityQuizPersonaPercentsModel,us as PersonalityQuizPersonaPointsModel,ps as PersonalityQuizPersonaResultsModel,cs as PersonalityQuizQuestionModel,Ms as PersonalityQuizUserParticipationsModel,Bc as PersonalityQuizzesModel,gc as PlayerAssetsModel,ao as PlayerBasicModel,Ue as PlayerDetailedPointsModel,Gr as PlayerDetailedStatsFilters,qr as PlayerDetailedStatsModel,Ti as PlayerFilters,st as PlayerFixtureModel,ro as PlayerFullModel,yc as PlayerMarketResultModel,Wr as PlayerPointsModel,no as PlayerShortModel,oo as PlayerSquadModel,Dt as PlayerStatsMatchModel,io as PlayerStatsModel,$r as PlayersPointsFilters,Fc as Points,$a as PointsModel,Sc as PointsValueModel,_c as PollBadgesValue,pi as PollBasicModel,hn as PollFullModel,fn as PollOptionModel,$t as PollVoteBasicModel,gn as PollVoteFullModel,li as PollsFilters,bn as PollsModel,Mn as PollsUserVotesModel,ke as PostByIdBasicModel,Er as PostByIdFullModel,Rr as PostCreateModel,Fr as PostsCountDiscussionModel,Sr as PostsDiscussionBasicModel,Yt as PostsFilters,vr as PostsFullModel,Lt as PostsMetaModel,Cr as PostsModel,Ae as PotmBadgesValue,Pn as PotmResultsMetaModel,En as PotmResultsModel,Tn as PotmResultsResponseModel,In as PotmUserVotesFilters,_n as PotmUserVotesModel,wn as PotmUserVotesResponseModel,Bo as PredictionMatchQuizModel,ei as PredictionRequestModel,Si as PredictionResponseModel,pn as PredictionTopXModel,V as PredictionsFilters,Ws as PredictionsModel,fe as PredictionsStats,Ka as PredictorBadgeRequirements,ja as PredictorBadgesValue,Ce as PredictorConfigModel,ci as PreferenceMappingModel,wc as PreferenceModel,Be as PrivateLeagueBasicCreateModel,Ne as PrivateLeagueBasicUpdateRequestBody,en as PrivateLeagueCreateModel,Zs as PrivateLeagueFilters,Ys as PrivateLeagueFullModel,ii as PrivateLeagueModel,$c as PrivateLeagueParamCreateBody,zc as PrivateLeagueParamUpdateBody,ri as PrivateLeaguePostsFilters,Xs as PrivateLeaguePredictionModel,oi as PrivateLeaguePredictionsFilters,Qc as PrivateLeaguePredictionsModel,tn as PrivateLeagueRankingsModel,an as PrivateLeagueUpdateModel,qc as PrivateLeaguesModel,Ga as ProfileCountryModel,Pe as ProfileModel,Ji as ProfileStatsModel,Ro as RankingsFilters,Ao as RankingsModel,Ar as ReactionModel,zs as RedCardFixtureModel,z as RelatedEntityRelationship,Or as ReportModel,xt as RequirementModel,Xe as ResultModel,ls as ResultsSummaryModel,Fe as RewardsModel,Oe as RewardsModelV2,ul as SDKConfiguraitonModel,ul as SDKConfigurationModel,cu as ScopeTypeEnum,to as ScoresModel,mo as SearchFilters,uo as SearchModel,vs as SelectionProviderInfoModel,yn as SinglePollVoteModel,Zi as SinglePredictionsBreakdown,he as SinglePredictionsStats,h as StandardFansUnitedException,we as StandingGameMetaModel,Ia as StandingGameMetaParticipantsModel,ba as StandingGameModel,wa as StandingGamePredictionModel,_a as StandingGamePredictionsModel,nn as StandingGameRankingsFilters,Pa as StandingGameRankingsModel,sn as StandingGamesFilters,Ma as StandingGamesModel,Zr as StatsModel,dl as StatusEnum,ta as SuccessRatePercent,za as SuccessRateScopeModel,Xi as SuccessRates,Wt as SummarizedBreakdown,hr as TagsModel,lo as TeamBasicModel,po as TeamColors,Pi as TeamFilters,bc as TeamFormModel,co as TeamFullModel,vc as TemplateBreakdownModel,Oo as TemplateBreakdownPointsModel,xo as TemplateByIdModel,Fo as TemplateFilters,Do as TemplateGroupFilter,Lo as TemplateGroups,Co as TemplateMeta,Nt as TemplateModel,bt as TiebreakerModel,Cc as TiersModel,yt as TimeTiebreaker,eo as TimelineModel,Vc as TopCorrectScoresModel,Dr as TopDiscussionsFilters,so as TopPlayerModel,ve as TopXConfigModel,ni as TopXPredictionRequestModel,Xu as UserActionsEnum,la as UserActivityFilters,Qa as UserDataConfigModel,mn as UserListWinners,$s as ValueAndPlayerId,ot as ValueBoolean,xs as ValueCorners,Ds as ValueCorrectScore,Bs as ValueDoubleChance,ks as ValueHalfTimeFullTime,Us as ValueOneXTwo,xr as VersionsModel,sr as VotingBadgeRequirements,qa as VotingBadgesValue};
4
4
  //# sourceMappingURL=index.js.map