fansunited-sdk-esm 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -36,12 +36,12 @@ This is what the SDK config requires:
36
36
  import {FansUnitedSDK} from "fansunited-sdk-esm";
37
37
 
38
38
  let fansUnitedSdk = FansUnitedSDK({
39
- "api_key": "your-api-key-here",
39
+ "apiKey": "your-api-key-here",
40
40
  "environment": "dev|prod|sandbox|etc", // default: prod
41
- "id_schema": "native|enetpulse|sportradar|sportal365", // default: native
42
- "client_id": "asdssfHShdsah4sajal3425j65",
41
+ "clientId": "your-client-id-here",
43
42
  "lang": "BG|EN|RO", // default: EN
44
- "auth_provider": new myTokenProvider()
43
+ "idSchema": "native|enetpulse|sportradar|sportal365", // default: native
44
+ "authProvider": new myTokenProvider()
45
45
  });
46
46
  ```
47
47
 
package/index.js CHANGED
@@ -1,3 +1,3 @@
1
- var Ai=Object.create;var Wt=Object.defineProperty;var Oi=Object.getOwnPropertyDescriptor;var xi=Object.getOwnPropertyNames;var Li=Object.getPrototypeOf,Ni=Object.prototype.hasOwnProperty;var $i=o=>Wt(o,"__esModule",{value:!0});var m=(o,e)=>()=>(e||o((e={exports:{}}).exports,e),e.exports);var Di=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of xi(e))!Ni.call(o,i)&&(t||i!=="default")&&Wt(o,i,{get:()=>e[i],enumerable:!(r=Oi(e,i))||r.enumerable});return o},z=(o,e)=>Di($i(Wt(o!=null?Ai(Li(o)):{},"default",!e&&o&&o.__esModule?{get:()=>o.default,enumerable:!0}:{value:o,enumerable:!0})),o);var Xt=m((Lo,gr)=>{"use strict";gr.exports=function(e,t){return function(){for(var i=new Array(arguments.length),a=0;a<i.length;a++)i[a]=arguments[a];return e.apply(t,i)}}});var w=m((No,Mr)=>{"use strict";var Ui=Xt(),A=Object.prototype.toString;function Jt(o){return A.call(o)==="[object Array]"}function zt(o){return typeof o=="undefined"}function Vi(o){return o!==null&&!zt(o)&&o.constructor!==null&&!zt(o.constructor)&&typeof o.constructor.isBuffer=="function"&&o.constructor.isBuffer(o)}function qi(o){return A.call(o)==="[object ArrayBuffer]"}function Hi(o){return typeof FormData!="undefined"&&o instanceof FormData}function ki(o){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(o):e=o&&o.buffer&&o.buffer instanceof ArrayBuffer,e}function ji(o){return typeof o=="string"}function Gi(o){return typeof o=="number"}function wr(o){return o!==null&&typeof o=="object"}function ne(o){if(A.call(o)!=="[object Object]")return!1;var e=Object.getPrototypeOf(o);return e===null||e===Object.prototype}function Ki(o){return A.call(o)==="[object Date]"}function Yi(o){return A.call(o)==="[object File]"}function Wi(o){return A.call(o)==="[object Blob]"}function br(o){return A.call(o)==="[object Function]"}function Xi(o){return wr(o)&&br(o.pipe)}function Ji(o){return typeof URLSearchParams!="undefined"&&o instanceof URLSearchParams}function zi(o){return o.trim?o.trim():o.replace(/^\s+|\s+$/g,"")}function Qi(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function Qt(o,e){if(!(o===null||typeof o=="undefined"))if(typeof o!="object"&&(o=[o]),Jt(o))for(var t=0,r=o.length;t<r;t++)e.call(null,o[t],t,o);else for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&e.call(null,o[i],i,o)}function Zt(){var o={};function e(i,a){ne(o[a])&&ne(i)?o[a]=Zt(o[a],i):ne(i)?o[a]=Zt({},i):Jt(i)?o[a]=i.slice():o[a]=i}for(var t=0,r=arguments.length;t<r;t++)Qt(arguments[t],e);return o}function Zi(o,e,t){return Qt(e,function(i,a){t&&typeof i=="function"?o[a]=Ui(i,t):o[a]=i}),o}function eo(o){return o.charCodeAt(0)===65279&&(o=o.slice(1)),o}Mr.exports={isArray:Jt,isArrayBuffer:qi,isBuffer:Vi,isFormData:Hi,isArrayBufferView:ki,isString:ji,isNumber:Gi,isObject:wr,isPlainObject:ne,isUndefined:zt,isDate:Ki,isFile:Yi,isBlob:Wi,isFunction:br,isStream:Xi,isURLSearchParams:Ji,isStandardBrowserEnv:Qi,forEach:Qt,merge:Zt,extend:Zi,trim:zi,stripBOM:eo}});var er=m(($o,Rr)=>{"use strict";var x=w();function Ir(o){return encodeURIComponent(o).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}Rr.exports=function(e,t,r){if(!t)return e;var i;if(r)i=r(t);else if(x.isURLSearchParams(t))i=t.toString();else{var a=[];x.forEach(t,function(p,d){p===null||typeof p=="undefined"||(x.isArray(p)?d=d+"[]":p=[p],x.forEach(p,function(c){x.isDate(c)?c=c.toISOString():x.isObject(c)&&(c=JSON.stringify(c)),a.push(Ir(d)+"="+Ir(c))}))}),i=a.join("&")}if(i){var s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var Fr=m((Do,Pr)=>{"use strict";var to=w();function le(){this.handlers=[]}le.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1};le.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};le.prototype.forEach=function(e){to.forEach(this.handlers,function(r){r!==null&&e(r)})};Pr.exports=le});var vr=m((Uo,Sr)=>{"use strict";var ro=w();Sr.exports=function(e,t){ro.forEach(e,function(i,a){a!==t&&a.toUpperCase()===t.toUpperCase()&&(e[t]=i,delete e[a])})}});var tr=m((Vo,Tr)=>{"use strict";Tr.exports=function(e,t,r,i,a){return e.config=t,r&&(e.code=r),e.request=i,e.response=a,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e}});var rr=m((qo,Cr)=>{"use strict";var io=tr();Cr.exports=function(e,t,r,i,a){var s=new Error(e);return io(s,t,r,i,a)}});var _r=m((Ho,Er)=>{"use strict";var oo=rr();Er.exports=function(e,t,r){var i=r.config.validateStatus;!r.status||!i||i(r.status)?e(r):t(oo("Request failed with status code "+r.status,r.config,null,r.request,r))}});var Ar=m((ko,Br)=>{"use strict";var pe=w();Br.exports=pe.isStandardBrowserEnv()?function(){return{write:function(t,r,i,a,s,l){var p=[];p.push(t+"="+encodeURIComponent(r)),pe.isNumber(i)&&p.push("expires="+new Date(i).toGMTString()),pe.isString(a)&&p.push("path="+a),pe.isString(s)&&p.push("domain="+s),l===!0&&p.push("secure"),document.cookie=p.join("; ")},read:function(t){var r=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return r?decodeURIComponent(r[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var xr=m((jo,Or)=>{"use strict";Or.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var Nr=m((Go,Lr)=>{"use strict";Lr.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}});var Dr=m((Ko,$r)=>{"use strict";var ao=xr(),so=Nr();$r.exports=function(e,t){return e&&!ao(t)?so(e,t):t}});var Vr=m((Yo,Ur)=>{"use strict";var ir=w(),no=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];Ur.exports=function(e){var t={},r,i,a;return e&&ir.forEach(e.split(`
2
- `),function(l){if(a=l.indexOf(":"),r=ir.trim(l.substr(0,a)).toLowerCase(),i=ir.trim(l.substr(a+1)),r){if(t[r]&&no.indexOf(r)>=0)return;r==="set-cookie"?t[r]=(t[r]?t[r]:[]).concat([i]):t[r]=t[r]?t[r]+", "+i:i}}),t}});var kr=m((Wo,Hr)=>{"use strict";var qr=w();Hr.exports=qr.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a"),r;function i(a){var s=a;return e&&(t.setAttribute("href",s),s=t.href),t.setAttribute("href",s),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return r=i(window.location.href),function(s){var l=qr.isString(s)?i(s):s;return l.protocol===r.protocol&&l.host===r.host}}():function(){return function(){return!0}}()});var Q=m((Xo,jr)=>{"use strict";function or(o){this.message=o}or.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};or.prototype.__CANCEL__=!0;jr.exports=or});var sr=m((Jo,Gr)=>{"use strict";var ce=w(),lo=_r(),po=Ar(),co=er(),mo=Dr(),uo=Vr(),ho=kr(),ar=rr(),fo=Z(),yo=Q();Gr.exports=function(e){return new Promise(function(r,i){var a=e.data,s=e.headers,l=e.responseType,p;function d(){e.cancelToken&&e.cancelToken.unsubscribe(p),e.signal&&e.signal.removeEventListener("abort",p)}ce.isFormData(a)&&delete s["Content-Type"];var n=new XMLHttpRequest;if(e.auth){var c=e.auth.username||"",g=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";s.Authorization="Basic "+btoa(c+":"+g)}var J=mo(e.baseURL,e.url);n.open(e.method.toUpperCase(),co(J,e.params,e.paramsSerializer),!0),n.timeout=e.timeout;function fr(){if(!!n){var P="getAllResponseHeaders"in n?uo(n.getAllResponseHeaders()):null,u=!l||l==="text"||l==="json"?n.responseText:n.response,B={data:u,status:n.status,statusText:n.statusText,headers:P,config:e,request:n};lo(function(Yt){r(Yt),d()},function(Yt){i(Yt),d()},B),n=null}}if("onloadend"in n?n.onloadend=fr:n.onreadystatechange=function(){!n||n.readyState!==4||n.status===0&&!(n.responseURL&&n.responseURL.indexOf("file:")===0)||setTimeout(fr)},n.onabort=function(){!n||(i(ar("Request aborted",e,"ECONNABORTED",n)),n=null)},n.onerror=function(){i(ar("Network Error",e,null,n)),n=null},n.ontimeout=function(){var u=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",B=e.transitional||fo.transitional;e.timeoutErrorMessage&&(u=e.timeoutErrorMessage),i(ar(u,e,B.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",n)),n=null},ce.isStandardBrowserEnv()){var yr=(e.withCredentials||ho(J))&&e.xsrfCookieName?po.read(e.xsrfCookieName):void 0;yr&&(s[e.xsrfHeaderName]=yr)}"setRequestHeader"in n&&ce.forEach(s,function(u,B){typeof a=="undefined"&&B.toLowerCase()==="content-type"?delete s[B]:n.setRequestHeader(B,u)}),ce.isUndefined(e.withCredentials)||(n.withCredentials=!!e.withCredentials),l&&l!=="json"&&(n.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&n.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&n.upload&&n.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(p=function(P){!n||(i(!P||P&&P.type?new yo("canceled"):P),n.abort(),n=null)},e.cancelToken&&e.cancelToken.subscribe(p),e.signal&&(e.signal.aborted?p():e.signal.addEventListener("abort",p))),a||(a=null),n.send(a)})}});var Z=m((zo,Wr)=>{"use strict";var f=w(),Kr=vr(),go=tr(),wo={"Content-Type":"application/x-www-form-urlencoded"};function Yr(o,e){!f.isUndefined(o)&&f.isUndefined(o["Content-Type"])&&(o["Content-Type"]=e)}function bo(){var o;return typeof XMLHttpRequest!="undefined"?o=sr():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(o=sr()),o}function Mo(o,e,t){if(f.isString(o))try{return(e||JSON.parse)(o),f.trim(o)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(o)}var me={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:bo(),transformRequest:[function(e,t){return Kr(t,"Accept"),Kr(t,"Content-Type"),f.isFormData(e)||f.isArrayBuffer(e)||f.isBuffer(e)||f.isStream(e)||f.isFile(e)||f.isBlob(e)?e:f.isArrayBufferView(e)?e.buffer:f.isURLSearchParams(e)?(Yr(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):f.isObject(e)||t&&t["Content-Type"]==="application/json"?(Yr(t,"application/json"),Mo(e)):e}],transformResponse:[function(e){var t=this.transitional||me.transitional,r=t&&t.silentJSONParsing,i=t&&t.forcedJSONParsing,a=!r&&this.responseType==="json";if(a||i&&f.isString(e)&&e.length)try{return JSON.parse(e)}catch(s){if(a)throw s.name==="SyntaxError"?go(s,this,"E_JSON_PARSE"):s}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};f.forEach(["delete","get","head"],function(e){me.headers[e]={}});f.forEach(["post","put","patch"],function(e){me.headers[e]=f.merge(wo)});Wr.exports=me});var Jr=m((Qo,Xr)=>{"use strict";var Io=w(),Ro=Z();Xr.exports=function(e,t,r){var i=this||Ro;return Io.forEach(r,function(s){e=s.call(i,e,t)}),e}});var nr=m((Zo,zr)=>{"use strict";zr.exports=function(e){return!!(e&&e.__CANCEL__)}});var ei=m((ea,Zr)=>{"use strict";var Qr=w(),lr=Jr(),Po=nr(),Fo=Z(),So=Q();function pr(o){if(o.cancelToken&&o.cancelToken.throwIfRequested(),o.signal&&o.signal.aborted)throw new So("canceled")}Zr.exports=function(e){pr(e),e.headers=e.headers||{},e.data=lr.call(e,e.data,e.headers,e.transformRequest),e.headers=Qr.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Qr.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var t=e.adapter||Fo.adapter;return t(e).then(function(i){return pr(e),i.data=lr.call(e,i.data,i.headers,e.transformResponse),i},function(i){return Po(i)||(pr(e),i&&i.response&&(i.response.data=lr.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var cr=m((ta,ti)=>{"use strict";var M=w();ti.exports=function(e,t){t=t||{};var r={};function i(n,c){return M.isPlainObject(n)&&M.isPlainObject(c)?M.merge(n,c):M.isPlainObject(c)?M.merge({},c):M.isArray(c)?c.slice():c}function a(n){if(M.isUndefined(t[n])){if(!M.isUndefined(e[n]))return i(void 0,e[n])}else return i(e[n],t[n])}function s(n){if(!M.isUndefined(t[n]))return i(void 0,t[n])}function l(n){if(M.isUndefined(t[n])){if(!M.isUndefined(e[n]))return i(void 0,e[n])}else return i(void 0,t[n])}function p(n){if(n in t)return i(e[n],t[n]);if(n in e)return i(void 0,e[n])}var d={url:s,method:s,data:s,baseURL:l,transformRequest:l,transformResponse:l,paramsSerializer:l,timeout:l,timeoutMessage:l,withCredentials:l,adapter:l,responseType:l,xsrfCookieName:l,xsrfHeaderName:l,onUploadProgress:l,onDownloadProgress:l,decompress:l,maxContentLength:l,maxBodyLength:l,transport:l,httpAgent:l,httpsAgent:l,cancelToken:l,socketPath:l,responseEncoding:l,validateStatus:p};return M.forEach(Object.keys(e).concat(Object.keys(t)),function(c){var g=d[c]||a,J=g(c);M.isUndefined(J)&&g!==p||(r[c]=J)}),r}});var mr=m((ra,ri)=>{ri.exports={version:"0.24.0"}});var ai=m((ia,oi)=>{"use strict";var vo=mr().version,ur={};["object","boolean","number","function","string","symbol"].forEach(function(o,e){ur[o]=function(r){return typeof r===o||"a"+(e<1?"n ":" ")+o}});var ii={};ur.transitional=function(e,t,r){function i(a,s){return"[Axios v"+vo+"] Transitional option '"+a+"'"+s+(r?". "+r:"")}return function(a,s,l){if(e===!1)throw new Error(i(s," has been removed"+(t?" in "+t:"")));return t&&!ii[s]&&(ii[s]=!0,console.warn(i(s," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(a,s,l):!0}};function To(o,e,t){if(typeof o!="object")throw new TypeError("options must be an object");for(var r=Object.keys(o),i=r.length;i-- >0;){var a=r[i],s=e[a];if(s){var l=o[a],p=l===void 0||s(l,a,o);if(p!==!0)throw new TypeError("option "+a+" must be "+p);continue}if(t!==!0)throw Error("Unknown option "+a)}}oi.exports={assertOptions:To,validators:ur}});var mi=m((oa,ci)=>{"use strict";var si=w(),Co=er(),ni=Fr(),li=ei(),ue=cr(),pi=ai(),L=pi.validators;function ee(o){this.defaults=o,this.interceptors={request:new ni,response:new ni}}ee.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=ue(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;t!==void 0&&pi.assertOptions(t,{silentJSONParsing:L.transitional(L.boolean),forcedJSONParsing:L.transitional(L.boolean),clarifyTimeoutError:L.transitional(L.boolean)},!1);var r=[],i=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(e)===!1||(i=i&&g.synchronous,r.unshift(g.fulfilled,g.rejected))});var a=[];this.interceptors.response.forEach(function(g){a.push(g.fulfilled,g.rejected)});var s;if(!i){var l=[li,void 0];for(Array.prototype.unshift.apply(l,r),l=l.concat(a),s=Promise.resolve(e);l.length;)s=s.then(l.shift(),l.shift());return s}for(var p=e;r.length;){var d=r.shift(),n=r.shift();try{p=d(p)}catch(c){n(c);break}}try{s=li(p)}catch(c){return Promise.reject(c)}for(;a.length;)s=s.then(a.shift(),a.shift());return s};ee.prototype.getUri=function(e){return e=ue(this.defaults,e),Co(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};si.forEach(["delete","get","head","options"],function(e){ee.prototype[e]=function(t,r){return this.request(ue(r||{},{method:e,url:t,data:(r||{}).data}))}});si.forEach(["post","put","patch"],function(e){ee.prototype[e]=function(t,r,i){return this.request(ue(i||{},{method:e,url:t,data:r}))}});ci.exports=ee});var di=m((aa,ui)=>{"use strict";var Eo=Q();function N(o){if(typeof o!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var t=this;this.promise.then(function(r){if(!!t._listeners){var i,a=t._listeners.length;for(i=0;i<a;i++)t._listeners[i](r);t._listeners=null}}),this.promise.then=function(r){var i,a=new Promise(function(s){t.subscribe(s),i=s}).then(r);return a.cancel=function(){t.unsubscribe(i)},a},o(function(i){t.reason||(t.reason=new Eo(i),e(t.reason))})}N.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};N.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};N.prototype.unsubscribe=function(e){if(!!this._listeners){var t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}};N.source=function(){var e,t=new N(function(i){e=i});return{token:t,cancel:e}};ui.exports=N});var fi=m((sa,hi)=>{"use strict";hi.exports=function(e){return function(r){return e.apply(null,r)}}});var gi=m((na,yi)=>{"use strict";yi.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var Mi=m((la,dr)=>{"use strict";var wi=w(),_o=Xt(),de=mi(),Bo=cr(),Ao=Z();function bi(o){var e=new de(o),t=_o(de.prototype.request,e);return wi.extend(t,de.prototype,e),wi.extend(t,e),t.create=function(i){return bi(Bo(o,i))},t}var F=bi(Ao);F.Axios=de;F.Cancel=Q();F.CancelToken=di();F.isCancel=nr();F.VERSION=mr().version;F.all=function(e){return Promise.all(e)};F.spread=fi();F.isAxiosError=gi();dr.exports=F;dr.exports.default=F});var $=m((pa,Ii)=>{Ii.exports=Mi()});var Ri=z($());var hr=o=>{let e=[],t=0;return o.forEach(r=>{e[t]?e[t].length<249?e[t].push(r):(t=t+1,e[t]=[r]):e[t]=[r]}),e},he=o=>{let e=[],t=200;for(;o.length>t-1;){let r=o.splice(0,t-1);e.push(r)}return e.push(o),e},S=(o,e)=>{let t="";return o==="prod"||o==="sandbox"?t={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"}[e]:t={profile:"http://localhost:8010",football:"http://locahost:8080",idMapping:"http://localhost:8030",predictor:"http://localhost:8040",client:"http://localhost:8080"}[e],t};var fe=class{id=null;name=null;avatar=null;gender=null;country=null;birthDate=null;interests=[]};var ye=class{profilesFromResponse=e=>e?e.map(t=>this.fullProfileFromResponse(t)):null;fullProfileFromResponse=e=>{let t=new fe;return t.avatar=e.avatar,t.birthDate=e.birth_date,t.country=e.country,t.gender=e.gender,t.id=e.id,t.interests=e.interests,t.name=e.name,t};profileToRequest=e=>({country_id:e.country?e.country.id:null,gender:e.gender,birth_date:e.birthDate,interests:e.interests,name:e.name})};var ge=class{avatar=null;followingId=null;name=null;profileId=null};var we=class{followingFromResponse=e=>e.map(t=>this.remapResponse(t));remapResponse=e=>{let t=new ge;return t.avatar=e.avatar,t.followingId=e.following_id,t.name=e.name,t.profileId=e.profile_id,t}};var be=class{avatar=null;followerId=null;name=null;profileId=null};var Me=class{followersFromResponse=e=>e.map(t=>this.remapResponse(t));remapResponse=e=>{let t=new be;return t.avatar=e.avatar,t.followerId=e.follower_id,t.name=e.name,t.profileId=e.profile_id,t}};var te=class{profile_ids=[]};var O=class{limit=0;startAfter=null;constructor(e){this.limit=e.limit?e.limit:20,this.startAfter=e.startAfter?e.startAfter:null}constructFilterUrl=()=>{let e="";return this.limit&&(e=e+"&",e=e+`limit=${this.limit}`),this.startAfter&&(e=e+"&",e=e+`start_after=${this.startAfter}`),e}};var Oo="/countries",R="/profile",Pi="/profiles",Ie=class{instance=null;apiSignInUrl="";profileRemapper=null;followingRemapper=null;followersRemapper=null;constructor(e){let t=S(e.environment,"profile");this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}&lang=${e.lang}`,this.instance=Ri.default.create({baseURL:t,headers:{Authorization:`Bearer ${e.authProvider.getIdToken()}`,"Content-Type":"application/json"}}),this.profileRemapper=new ye,this.followingRemapper=new we,this.followersRemapper=new Me}getCountries=async()=>{try{return(await this.instance.get(`${Oo}${this.apiSignInUrl}`)).data.data}catch(e){throw console.warn("There was a problem fetching the countries:",e),e}};getProfile=async e=>{let t=`${R}${this.apiSignInUrl}`;e&&(t=`${Pi}/${e}${this.apiSignInUrl}`);try{let r=await this.instance.get(t);return this.profileRemapper.fullProfileFromResponse(r.data.data)}catch(r){throw console.warn(`There was a problem fetching the following profile: ${e}`,r),r}};getProfiles=async e=>{try{let t=await this.instance.get(`${Pi}${this.apiSignInUrl}&profile_ids=${e.join(",")}`);return this.profileRemapper.profilesFromResponse(t.data.data)}catch(t){throw console.warn(`There was a problem fetching the following profiles: ${e.join(",")}`,t),t}};getFollowers=async(e,t)=>{let r=`${R}/followers${this.apiSignInUrl}`;e&&!t?(e=new O(e),r=`${R}/followers${this.apiSignInUrl}${e.constructFilterUrl()}`):e&&t?(e=new O(e),r=`${R}/${t}/followers${this.apiSignInUrl}${e.constructFilterUrl()}`):!e&&t&&(r=`${R}/${t}/followers${this.apiSignInUrl}`);try{let i=await this.instance.get(r);return this.followersRemapper.followersFromResponse(i.data.data)}catch(i){throw console.warn("There was a problem fetching the followers for profile",i),i}};getFollowing=async(e,t)=>{let r=`${R}/following${this.apiSignInUrl}`;e&&!t?(e=new O(e),r=`${R}/following${this.apiSignInUrl}${e.constructFilterUrl()}`):e&&t?(e=new O(e),r=`${R}/${t}/following${this.apiSignInUrl}${e.constructFilterUrl()}`):!e&&t&&(r=`${R}/${t}/following${this.apiSignInUrl}`);try{let i=await this.instance.get(r);return this.followingRemapper.followingFromResponse(i.data.data)}catch(i){throw console.warn(`There was a problem fetching the followers of the following profile: ${t}`,i),i}};follow=async e=>{let t=new te;t.profile_ids=e;try{let r=await this.instance.post(`${R}/follow${this.apiSignInUrl}`,JSON.stringify(t));return this.followingRemapper.followingFromResponse(r.data.data)}catch(r){throw console.warn(`There was a problem with POST request for profiles: ${e.join(",")} `,r),r}};unfollow=async e=>{let t=new te;t.profile_ids=e;try{return await this.instance.delete(`${R}/follow${this.apiSignInUrl}`,{data:JSON.stringify(t)}),!0}catch(r){return console.warn(`There was a problem with DELETE request for profiles: ${e.join(",")} `,r),!1}};updateProfile=async e=>{try{let t=this.profileRemapper.profileToRequest(e),r=await this.instance.patch(`${R}${this.apiSignInUrl}`,t);return this.profileRemapper.fullProfileFromResponse(r.data.data)}catch(t){throw console.warn("There was a problem updating the own profile:",t),t}}};var v={native:"id",sportradar:"sportradar_id",sportal365:"sportal365_id",enetpulse:"enetpulse_id"};var Fi="FansUnited",Si={football:{ids:[],countries:[],competitions:[]},profile:{others:[],own:{},countries:[],expireAt:0}},T=class{idSchema="";exparationTimeout=600;constructor(e){this.idSchema=e.idSchema,(this.getData()===void 0||this.getData()===null)&&this.setData(Si)}clearData=()=>{this.setData(Si)};getEntityById=(e="",t="")=>this.getData().football.ids.find(r=>{let i=v[this.idSchema];return r&&`${r[i]}`===t&&r.resource===e});getEntity=(e,t,r)=>Array.isArray(e)?this.getData().football.ids.filter(i=>{let a=v[r];return i&&e.includes(`${i[a]}`)&&i.resource===t}):this.getData().football.ids.find(i=>{let a=v[r];return i&&`${i[a]}`===e&&i.resource===t});getEntityByNativeId=(e="",t="")=>this.getData().football.ids.find(r=>r&&`${r.id}`===t&&r.resource===e);checkForExistingIdObjs=(e,t)=>{let r=v[t],i={};return Object.keys(e).forEach(a=>{let s=e[a],p=this.getEntity(s,a,t).map(n=>n[r]),d=e[a].filter(n=>!p.includes(n));i[a]=s.map(n=>d.includes(n)?{id:n,exists:!1}:{id:n,exists:!0})}),i};getIdsByType=(e,t,r)=>{let i=v[r],a=v[t],s={};return Object.keys(e).forEach(l=>{let p=e[l],d=[];this.getData().football.ids.forEach(n=>{p.forEach((c,g)=>{c===n[a]&&l===n.resource&&(d[g]=n[i])})}),s[l]=d}),s};addIdMapping=e=>{let t=this.getData();t.football.ids.push(e),this.setData(t)};addIdMappings=e=>{let t=this.getData(),r=t.football.ids;r=[...r,...e],t.football.ids=r,this.setData(t)};setOwnProfile=e=>{let t=this.getData();t.profile.own=e,t.profile.expireAt=Math.floor(Date.now()/1e3)+this.exparationTimeout,this.setData(t)};addProfiles=e=>{let t=this.getData(),r=e.map(a=>`${a.id}`),i=t.profile.others.filter(a=>!r.includes(`${a.id}`));i.push(...e),t.profile.others=i,this.setData(t)};addProfile=e=>{let t=this.getData(),r=t.profile.others.filter(i=>`${i.id}`!=`${e.id}`);r.push(e),t.profile.others=r,this.setData(t)};getOwnProfile=()=>this.getData().profile.own;getProfileCountries=()=>this.getData().profile.countries;setProfileCountries=e=>{let t=this.getData();t.profile.countries=e,this.setData(t)};getProfilesByIds=e=>this.getData().profile.others.filter(i=>e.includes(`${i.id}`));getProfileById=e=>this.getData().profile.others.find(i=>`${i.id}`==`${e}`);getFootballCountries=()=>this.getData().football.countries;setFootballCountries=e=>{let t=this.getData();t.football.countries=e,this.setData(t)};getCompetitions=e=>{let t=this.getData();return e?e.competitionSearchFilter(t.football.competitions):t.football.competitions};setCompetitions=e=>{let t=this.getData();t.football.competitions.push(...e),this.setData(t)};getExparationProfile=()=>this.getData().profile.expireAt;getData=()=>JSON.parse(localStorage.getItem(Fi));setData=e=>{localStorage.setItem(Fi,JSON.stringify(e))}};var vi=z($());var re={player:"players",team:"teams",homeTeam:"teams",awayTeam:"teams",country:"countries",competition:"competitions",match:"matches"},Re=class{instance=null;apiSignInUrl="";constructor(e){let t=S(e.environment,"idMapping");this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}`,this.instance=vi.default.create({baseURL:t})}getEntityById=(e,t)=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${config.idSchema}&${re[e]}=${t}`)}catch(r){throw console.warn(`There was a problem with id mapping request for the following id:${t}`,r),r}};getEntityByIdAndSchema=(e,t,r)=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${r}&${re[e]}=${t}`)}catch(i){throw console.warn(`There was a problem with id mapping request for the following id:${t}`,i),i}};getEntityIdsByIdsAndSchema=(e,t,r)=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${r}&${re[e]}=${t.join(",")}`)}catch(i){throw console.warn(`There was a problem with id mapping request for the following ids:${t.join(",")}`,i),i}};getEntitiesByIds=(e,t,r)=>{t.sort((s,l)=>s.localeCompare(l));let a=hr(t).map(s=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${r}&${re[e]}=${s.join(",")}`)}catch(l){throw console.warn(`There was a problem with id mapping request for the following ids:${s.join(",")}`,l),l}});return Promise.all(a).then(s=>{let l=[];return s.forEach(p=>{l.push(...p.data.data)}),l})};getEntitiesByIdObjs=(e,t)=>{let r=[];return Object.keys(e).forEach(i=>{let s=hr(e[i]).map(l=>{l.sort((p,d)=>p.localeCompare(d));try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${t||"native"}&${re[i]}=${l.join(",")}`)}catch(p){throw console.warn(`There was a problem with id mapping request for the following ids:${l.join(",")}`,p),p}});r=[...r,...s]}),Promise.all(r).then(i=>{let a=[];return i.forEach(s=>{a.push(...s.data.data)}),a})}};var Pe=class{isBrowser=!1;localStorage=null;https=null;constructor(e){this.isBrowser=typeof window!="undefined",this.localStorage=new T(e),this.https=new Re(e)}getEntitiesByIds=async(e,t,r)=>{if(this.isBrowser)try{let i=this.localStorage.checkForExistingIdObjs(e,t),a=this.splitForRequestAndExisting(i),s=await this.https.getEntitiesByIdObjs(a.request,t);return this.localStorage.addIdMappings(s),this.localStorage.getIdsByType(e,t,r)}catch(i){return console.warn("There was a problem retrieving the entity ids ",i),Promise.resolve([])}else try{let i=await this.https.getEntitiesByIdObjs(e,t);return Object.keys(e).forEach(a=>{e[a]=i.filter(s=>s.resource===a).map(s=>s[v[r]])}),e}catch(i){return console.warn("There was a problem retrieving the entity ids ",i),Promise.resolve([])}};getEntityById=async(e,t,r)=>{if(this.isBrowser){let i=this.localStorage.getEntity(e,t,r);if(i)return i;{let a=await this.requestEntity(e,t,r);return this.localStorage.addIdMappings(a),a}}else return await this.requestEntity(e,t,r)};splitForRequestAndExisting=e=>{let t={},r={};return Object.keys(e).forEach(i=>{t[i]=e[i].filter(a=>!a.exists).map(a=>a.id),r[i]=e[i].filter(a=>a.exists).map(a=>a.id)}),{existing:r,request:t}};requestEntity=async(e,t,r)=>{try{return e=Array.isArray(e)?e:[e],await this.https.getEntitiesByIds(t,e,r)}catch(i){return console.warn(`There was a problem retrieving the requested entity: ${i}`),null}}};var Fe=o=>{switch(o){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 o}};var Se=class{extractedObjIds={};traverse=(e,t)=>(t=Fe(t),Array.isArray(e)?this.traverseArrExtract(e,t):e&&typeof e=="object"&&this.traverseObjExtract(e,t),this.extractedObjIds);traverseArrExtract=(e,t)=>{e&&e.length>0&&e.forEach(r=>{this.traverseObjExtract(r,t)})};traverseObjExtract=(e,t)=>{e&&Object.keys(e).length>0&&Object.keys(e).forEach(r=>{let i=e[r];r==="id"||r==="teamId"?(this.extractedObjIds.hasOwnProperty(t)||(this.extractedObjIds[t]=[]),this.extractedObjIds[t].push(i)):e[r]&&this.traverse(e[r],r)})}};var ve=class{replaceObjIdsIndex=null;remappedIdsObj={};traverse=(e,t,r)=>(t=Fe(t),this.replaceObjIdsIndex===null&&(this.initReplaceObjIdsIndex(r),this.remappedIdsObj=r),Array.isArray(e)?this.traverseArrReplace(e,t):e&&typeof e=="object"&&this.traverseObjReplace(e,t),e);initReplaceObjIdsIndex=e=>{this.replaceObjIdsIndex={},Object.keys(e).forEach(t=>{this.replaceObjIdsIndex[t]=0})};traverseArrReplace=(e,t)=>{e&&e.length>0&&e.forEach(r=>{this.traverseObjReplace(r,t)})};traverseObjReplace=(e,t)=>{e&&Object.keys(e).length>0&&Object.keys(e).forEach(r=>{r==="id"||r==="teamId"?(e[r]=this.remappedIdsObj[t][this.replaceObjIdsIndex[t]],this.replaceObjIdsIndex[t]=this.replaceObjIdsIndex[t]+1):e[r]&&this.traverse(e[r],r,this.remappedIdsObj)})}};var C=class{idSchema="";idMappingFacade=null;constructor(e){this.idSchema=e.idSchema,this.idMappingFacade=new Pe(e)}getEntityIdBySchemaId=(e,t)=>this.idMappingFacade.getEntityById(e,t,this.idSchema);remapEntities=async(e,t)=>{let r=JSON.parse(JSON.stringify(e));try{let a=new Se().traverse(r,t);return this.idMappingFacade.getEntitiesByIds(a,"native",this.idSchema).then(s=>new ve().traverse(r,t,s))}catch(i){return console.warn(`There was a problem remapping entity: ${t} with inner entity `,i),[]}};getEntityIdsBySchemaId=async(e,t,r)=>{let i={};return i[t]=e,await this.idMappingFacade.getEntitiesByIds(i,this.idSchema,r)}};var I=class{completed=!1;percentage;constructor(e){this.percentage=e}};var Te=class{teamFollowed=new I(10);teamFavourite=new I(15);playerFollowed=new I(10);playerFavourite=new I(10);competitionFollowed=new I(10);competitionFavourite=new I(5);addedBirthdate=new I(10);addedGender=new I(10);addedCountry=new I(10);addedAvatar=new I(10)};var Ce=class{totalPercentage;breakdown=new Te};var E=class{isBrowser=!1;localStorage={};https=null;constructor(e,t){this.isBrowser=typeof window!="undefined",this.localStorage=e,this.https=t}getOwn=async()=>{if(this.isBrowser){let e=Math.floor(Date.now()/1e3),t=this.localStorage.getExparationProfile(),r=null;if(t>e&&(r=this.localStorage.getOwnProfile()),r)return r;try{let i=await this.https.getProfile();return this.localStorage.setOwnProfile(i),i}catch(i){throw console.warn("There was a problem retrieving your profile: ",i),i}}else try{return await this.https.getProfile()}catch(e){throw console.warn("There was a problem retrieving your profile: ",e),e}};getByIds=async e=>{if(this.isBrowser){let t=this.localStorage.getProfilesByIds(e);if(t&&t.length===e.length)return t.filter(r=>delete r.interests),t;try{let r=await this.https.getProfiles(e);return this.localStorage.addProfiles(r),r.filter(i=>delete i.interests),r}catch(r){throw console.warn(`There was a problem retrieving the selected profiles: ${e.join(",")} `,r),r}}else try{let t=await this.https.getProfiles(e);return t.filter(r=>delete r.interests),t}catch(t){throw console.warn(`There was a problem retrieving the selected profiles: ${e.join(",")} `,t),t}};getById=async e=>{if(this.isBrowser){let t=this.localStorage.getProfileById(e);if(t)return t;try{let r=await this.https.getProfile(e);return this.localStorage.addProfile(r),r}catch(r){throw console.warn(`There was a problem retrieving the selected profile: ${e} `,r),r}}else try{return await this.https.getProfile(e)}catch(t){throw console.warn(`There was a problem retrieving the selected profile: ${e} `,t),t}};getCountries=async()=>{if(this.isBrowser){let e=this.localStorage.getProfileCountries();if(e&&e.length>0)return e;try{let t=await this.https.getCountries();return this.localStorage.setProfileCountries(t),t}catch(t){throw console.warn("There was a problem retrieving profile countries: ",t),t}}else try{return await this.https.getCountries()}catch(e){throw console.warn("There was a problem retrieving profile countries: ",e),e}};getFollowers=async(e,t)=>{try{return await this.https.getFollowers(e,t)}catch(r){throw console.warn("There was a problem retrieving your followers: ",r),r}};getFollowing=async(e,t)=>{try{return await this.https.getFollowing(e,t)}catch(r){throw console.warn("There was a problem retrieving your following profiles: ",r),r}};follow=async e=>{try{return await this.https.follow(e)}catch(t){throw console.warn(`There was a problem following profiles: ${e.join(",")} `,t),t}};unfollow=async e=>{try{return await this.https.unfollow(e)}catch(t){throw console.warn(`There was a problem unfollowing profiles: ${e.join(",")} `,t),t}};showFullnessProfile=e=>{let t=new Ce,r=0;return e.avatar&&(t.breakdown.addedAvatar.completed=!0,r+=t.breakdown.addedAvatar.percentage),e.birthDate&&(t.breakdown.addedBirthdate.completed=!0,r+=t.breakdown.addedBirthdate.percentage),e.country&&(t.breakdown.addedCountry.completed=!0,r+=t.breakdown.addedCountry.percentage),e.gender&&(t.breakdown.addedGender.completed=!0,r+=t.breakdown.addedGender.percentage),e.interests&&e.interests.length>0&&(e.interests.find(n=>n.type==="team"&&n.favourite)&&(t.breakdown.teamFavourite.completed=!0,r+=t.breakdown.teamFavourite.percentage),e.interests.find(n=>n.type==="team")&&(t.breakdown.teamFollowed.completed=!0,r+=t.breakdown.teamFollowed.percentage),e.interests.find(n=>n.type==="player"&&n.favourite)&&(t.breakdown.playerFavourite.completed=!0,r+=t.breakdown.playerFavourite.percentage),e.interests.find(n=>n.type==="player")&&(t.breakdown.playerFollowed.completed=!0,r+=t.breakdown.playerFollowed.percentage),e.interests.find(n=>n.type==="competition"&&n.favourite)&&(t.breakdown.competitionFavourite.completed=!0,r+=t.breakdown.competitionFavourite.percentage),e.interests.find(n=>n.type==="competition")&&(t.breakdown.competitionFollowed.completed=!0,r+=t.breakdown.competitionFollowed.percentage)),t.totalPercentage=r,t}};var Ee=class{id=null;name=null;assets=null};var _e=class{isBrowser=!1;localStorage={};https=null;idMapping=null;constructor(e,t,r){this.isBrowser=typeof window!="undefined",this.localStorage=e,this.idMapping=r,this.https=t}getCountriesWithIdMapping=async()=>{try{let e=await this.getCountries();return this.idMapping.remapEntities(e,"country")}catch(e){throw console.warn("There was a problem browsing countries as football entities",e),e}};getCountries=async()=>{if(this.isBrowser){let e=this.localStorage.getFootballCountries();if(e&&e.length>0)return e;try{let t=await this.https.getCountries();return this.localStorage.setFootballCountries(t),t}catch(t){throw console.warn("There was a problem retrieving countries as football entities",t),t}}else return this.https.getCountries()}};var Be=class{countryId=null;name=null;gender=null;type=null;sortField=null;sortOrder=null;competitionIds=null;constructor(e){this.countryId=e.countryId?`${e.countryId}`:null,this.name=e.name?e.name:null,this.gender=e.gender?e.gender:null,this.type=e.type?e.type:null,this.sortField=e.sortField?`${e.sortField}`:null,this.sortOrder=e.sortOrder?`${e.sortOrder}`:null,this.competitionIds=e.competitionIds?e.competitionIds:null}constructFilterUrl=()=>{let e="";return this.countryId&&(e=e+"&",e=e+`country_id=${this.countryId}`),this.gender&&(e=e+"&",e=e+`gender=${this.gender}`),this.type&&(e=e+"&",e=e+`type=${this.type}`),this.sortField&&(e=e+"&",e=e+`sort_field=${this.sortField}`),this.sortOrder&&(e=e+"&",e=e+`sort_order=${this.sortOrder}`),this.name&&(e=e+"&",e=e+`name=${this.name}`),this.competitionIds&&(e=e+"&",e=e+`competition_ids=${this.competitionIds.join(",")}`),e};competitionSearchFilter=e=>{try{let t=this.filter(e);return this.sortField||this.sortOrder?this.sort(t):t}catch(t){return console.warn("There was a problem filtering the local competitions",t),[]}};filter=e=>{let t=this.entitiesToSearchWith();return e.filter(r=>{let i=!0;return t.forEach(a=>{a!=="sortOrder"&&a!=="sortField"&&(a==="countryId"?i&&=r.country.id===this[a]:a==="name"?i&&=r.name.toLocaleLowerCase().includes(this[a].toLocaleLowerCase()):a==="competitionIds"?i&&=this[a].some(s=>r.id===s):i&&=r[a].toLocaleLowerCase()===this[a].toLocaleLowerCase())}),i})};entitiesToSearchWith=()=>{let e=[];return this.countryId&&e.push("countryId"),this.name&&e.push("name"),this.gender&&e.push("gender"),this.type&&e.push("type"),this.sortField&&e.push("sortField"),this.sortOrder&&e.push("sortOrder"),this.competitionIds&&e.push("competitionIds"),e};sort=e=>{let t=[];return this.sortField==="name"?t=e.sort((r,i)=>this.sortOrder&&this.sortOrder==="desc"?i.name.localeCompare(r.name):r.name.localeCompare(i.name)):this.sortField==="countryId"?t=e.sort((r,i)=>this.sortOrder&&this.sortOrder==="desc"?i.country.id.localeCompare(r.country.id):r.country.id.localeCompare(i.country.id)):this.sortField==="scope"?e.forEach(r=>t[this.competitionIds.indexOf(r.id)]=r):!this.sortField&&this.sortOrder==="desc"&&(t=e.sort((r,i)=>i.id.localeCompare(r.id))),t}};var Ae=class{isBrowser=!1;localStorage={};https=null;idMapping=null;constructor(e,t,r){this.isBrowser=typeof window!="undefined",this.localStorage=e,this.idMapping=r,this.https=t}getCompetitionsIdMapping=async e=>{try{let t=!1;if(e){if(e=new Be(e),e.countryId){let i=await this.idMapping.getEntityIdsBySchemaId([`${e.countryId}`],"country","native");i.country.length===0&&(t=!0),e.countryId=i.country[0]}if(e.competitionIds){let i=await this.idMapping.getEntityIdsBySchemaId(e.competitionIds,"competition","native");i.competition.length===0&&(t=!0),e.competitionIds=i.competition}if(t)return[]}let r=await this.getCompetitions(e);return await this.idMapping.remapEntities(r,"competition")}catch(t){throw console.warn("There was a problem browsing all of the competitions",t),t}};getCompetitions=async e=>{if(this.isBrowser){let t=this.localStorage.getCompetitions(e);if(t&&t.length>0)return t;try{let r=await this.https.getCompetitions(e);return this.localStorage.setCompetitions(r),this.localStorage.getCompetitions(e)}catch(r){throw console.warn("There was a problem retrieving all competitions",r),r}}else return this.https.getCompetitions(e)};getCompetitionByIdIdMapping=async e=>{try{let r=(await this.idMapping.getEntityIdsBySchemaId([e],"competition","native")).competition[0],i=await this.getCompetitionById(r);return await this.idMapping.remapEntities(i,"competition")}catch(t){throw console.warn(`There was a problem browsing the following competition:${e}`,t),t}};getCompetitionById=async e=>{try{return await this.https.getCompetitionById(e)}catch(t){throw console.warn(`There was a problem retrieving the competition with the following id: ${e}`,t),t}};getTopCompetitionsIdMapping=async()=>{try{let e=await this.getTopCompetitions();return await this.idMapping.remapEntities(e,"competition")}catch(e){throw console.warn("There was a problem browsing the top competitions",e),e}};getTopCompetitions=async()=>{try{return await this.https.getTopCompetitions()}catch(e){throw console.warn("There was a problem retrieving the top competitions",e),e}}};var Oe=class{name=null;countryId=null;national=!1;gender=null;limit=null;page=null;scope=null;sortField=null;sortOrder=null;teamIds=null;constructor(e){this.name=e.name?e.name:null,this.countryId=e.countryId?`${e.countryId}`:null,this.national=e.national?e.national:!1,this.gender=e.gender?e.gender:null,this.limit=e.limit?e.limit:null,this.page=e.page?e.page:null,this.scope=e.scope?e.scope:null,this.sortField=e.sortField?`${e.sortField}`:null,this.sortOrder=e.sortOrder?`${e.sortOrder}`:null,this.teamIds=e.teamIds?e.teamIds:null}constructFilterUrl=()=>{let e="";return this.name&&(e=e+"&",e=e+`name=${this.name}`),this.countryId&&(e=e+"&",e=e+`country_id=${this.countryId}`),this.national&&(e=e+"&",e=e+`national=${this.national}`),this.gender&&(e=e+"&",e=e+`gender=${this.gender}`),this.limit&&(e=e+"&",e=e+`limit=${this.limit}`),this.scope&&(e=e+"&",e=e+`scope=${this.scope.join(",")}`),this.page&&(e=e+"&",e=e+`page=${this.page}`),this.sortField&&(e=e+"&",e=e+`sort_field=${this.sortField}`),this.sortOrder&&(e=e+"&",e=e+`sort_order=${this.sortOrder}`),this.teamIds&&(e=e+"&",e=e+`team_ids=${this.teamIds.join(",")}`),e}};var xe=class{https=null;idMapping=null;constructor(e,t){this.idMapping=t,this.https=e}getTeamsIdMapping=async e=>{try{let t=!1;if(e){if(e=new Oe(e),e.countryId){let i=await this.idMapping.getEntityIdsBySchemaId([`${e.countryId}`],"country","native");i.country.length===0&&(t=!0),e.countryId=i.country[0]}if(e.scope){let i=await this.idMapping.getEntityIdsBySchemaId(e.scope,"competition","native");i.competition.length===0&&(t=!0),e.scope=i.competition}if(e.teamIds){let i=await this.idMapping.getEntityIdsBySchemaId(e.teamIds,"team","native");i.team.length===0&&(t=!0),e.teamIds=i.team}}if(t)return[];let r=await this.getTeams(e);return await this.idMapping.remapEntities(r,"team")}catch(t){throw console.warn("There was a problem browsing all teams",t),t}};getTeams=async e=>{try{return await this.https.getTeams(e)}catch(t){throw console.warn("There was a problem retrieving all teams",t),t}};getTeamByIdIdMapping=async e=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"team","native")).team[0];let r=await this.getTeamById(e);return await this.idMapping.remapEntities(r,"team")}catch(t){throw console.warn(`There was a problem browsing the following team:${e}`,t),t}};getTeamById=async e=>{try{return await this.https.getTeamById(e)}catch(t){throw console.warn(`There was a problem retrieving the following team: ${e}`,t),t}};getTopTeamsIdMapping=async()=>{try{let e=await this.getTopTeams();return await this.idMapping.remapEntities(e,"team")}catch(e){throw console.warn("There was a problem browsing the top teams",e),e}};getTopTeams=async()=>{try{return await this.https.getTopTeams()}catch(e){throw console.warn("There was a problem retrieving the top teams",e),e}};getNextMatchForTeamIdMapping=async e=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"team","native")).team[0];let r=await this.getNextMatchForTeam(e);return await this.idMapping.remapEntities(r,"match")}catch(t){throw console.warn(`There was a problem browsing the next match for the following team:${e}`,t),t}};getNextMatchForTeam=async e=>{try{return await this.https.getNextMatchForTeam(e)}catch(t){throw console.warn(`There was a problem retrieving the next match for the following team: ${e}`,t),t}};getPrevMatchForTeamIdMapping=async e=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"team","native")).team[0];let r=await this.getPrevMatchForTeam(e);return await this.idMapping.remapEntities(r,"match")}catch(t){throw console.warn(`There was a problem browsing the previous match for the following team:${e}`,t),t}};getPrevMatchForTeam=async e=>{try{return await this.https.getPrevMatchForTeam(e)}catch(t){throw console.warn(`There was a problem retrieving the previous match for the following team: ${e}`,t),t}}};var Le=class{countryId=null;scope=null;name=null;playerIds=null;limit=null;page=null;sortField=null;sortOrder=null;constructor(e){this.countryId=e.countryId?e.countryId:null,this.scope=e.scope?e.scope:null,this.name=e.name?e.name:null,this.playerIds=e.playerIds?e.playerIds:null,this.limit=e.limit?e.limit:null,this.page=e.page?e.page:null,this.sortField=e.sortField?e.sortField:null,this.sortOrder=e.sortOrder?e.sortOrder:null}constructFilterUrl=()=>{let e="";return this.countryId&&(e=e+"&",e=e+`country_id=${this.countryId}`),this.scope&&(e=e+"&",e=e+`scope=${this.scope.join(",")}`),this.name&&(e=e+"&",e=e+`name=${this.name}`),this.playerIds&&(e=e+"&",e=e+`player_ids=${this.playerIds.join(",")}`),this.limit&&(e=e+"&",e=e+`limit=${this.limit}`),this.page&&(e=e+"&",e=e+`page=${this.page}`),this.sortField&&(e=e+"&",e=e+`sort_field=${this.sortField}`),this.sortOrder&&(e=e+"&",e=e+`sort_order=${this.sortOrder}`),e}};var Ne=class{https=null;idMapping=null;constructor(e,t){this.idMapping=t,this.https=e}getPlayersIdMapping=async e=>{try{let t=!1;if(e){if(e=new Le(e),e.countryId){let i=await this.idMapping.getEntityIdsBySchemaId([e.countryId],"country","native");i.country.length===0&&(t=!0),e.countryId=i.country[0]}if(e.playerIds){let i=await this.idMapping.getEntityIdsBySchemaId(e.playerIds,"player","native");i.player.length===0&&(t=!0),e.playerIds=i.player}if(e.scope){let i=await this.idMapping.getEntityIdsBySchemaId(e.scope,"competition","native");i.competition.length===0&&(t=!0),e.scope=i.competition}if(t)return[]}let r=await this.getPlayers(e);return await this.idMapping.remapEntities(r,"player")}catch(t){throw console.warn("There was a problem browsing the players",t),t}};getPlayers=async e=>{try{return await this.https.getPlayers(e)}catch(t){throw console.warn("There was a problem retrieving the players",t),t}};getPlayerIdMapping=async e=>{try{let t=await this.idMapping.getEntityIdsBySchemaId([e],"player","native"),r=await this.getPlayerById(t.player[0]);return await this.idMapping.remapEntities(r,"player")}catch(t){throw console.warn(`There was a problem browsing the following player:${e}`,t),t}};getPlayerById=async e=>{try{return await this.https.getPlayerById(e)}catch(t){throw console.warn(`There was a problem retrieving the following player: ${e}`,t),t}};getTopPlayersIdMapping=async()=>{try{let e=await this.getTopPlayers();return await this.idMapping.remapEntities(e,"player")}catch(e){throw console.warn("There was a problem browsing the top players",e),e}};getTopPlayers=async()=>{try{return await this.https.getTopPlayers()}catch(e){throw console.warn("There was a problem retrieving the top players",e),e}};getNextMatchForPlayerIdMapping=async e=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"player","native")).player[0];let r=await this.getNextMatchForPlayer(e);return await this.idMapping.remapEntities(r,"match")}catch(t){throw console.warn(`There was a problem browsing the next match for player:${e}`,t),t}};getNextMatchForPlayer=async e=>{try{return await this.https.getNextMatchForPlayer(e)}catch(t){throw console.warn(`There was a problem retrieving the next match for player: ${e}`,t),t}};getPrevMatchForPlayerIdMapping=async e=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"player","native")).player[0];let r=await this.getPrevMatchForPlayer(e);return await this.idMapping.remapEntities(r,"match")}catch(t){throw console.warn(`There was a problem browsing the previous match for player:${e}`,t),t}};getPrevMatchForPlayer=async e=>{try{return await this.https.getPrevMatchForPlayer(e)}catch(t){throw console.warn(`There was a problem retrieving the previous match for player: ${e}`,t),t}}};var $e=class{countryIds=null;competitionIds=null;matchIds=null;status=null;teamIds=null;fromDate=null;toDate=null;limit=null;page=null;sortField=null;sortOrder=null;constructor(e){this.countryIds=e.countryIds?e.countryIds:null,this.competitionIds=e.competitionIds?e.competitionIds:null,this.matchIds=e.matchIds?e.matchIds:null,this.status=e.status?e.status:null,this.teamIds=e.teamIds?e.teamIds:null,this.fromDate=e.fromDate?e.fromDate:null,this.toDate=e.toDate?e.toDate:null,this.limit=e.limit?e.limit:null,this.page=e.page?e.page:null,this.sortField=e.sortField?e.sortField:null,this.sortOrder=e.sortOrder?e.sortOrder:null}constructFilterUrl=()=>{let e="";return this.countryIds&&(e=e+"&",e=e+`countries=${this.countryIds.join(",")}`),this.competitionIds&&(e=e+"&",e=e+`competitions=${this.competitionIds.join(",")}`),this.matchIds&&(e=e+"&",e=e+`matches=${this.matchIds.join(",")}`),this.status&&(e=e+"&",e=e+`status=${this.status}`),this.teamIds&&(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&&(e=e+"&",e=e+`limit=${this.limit}`),this.page&&(e=e+"&",e=e+`page=${this.page}`),this.sortField&&(e=e+"&",e=e+`sort_field=${this.sortField}`),this.sortOrder&&(e=e+"&",e=e+`sort_order=${this.sortOrder}`),e}};var De=class{https=null;idMapping=null;constructor(e,t){this.https=e,this.idMapping=t}getMatchesIdMapping=async e=>{try{if(e){if(e=new $e(e),e.countryIds){let r=await this.idMapping.getEntityIdsBySchemaId(e.countryIds,"country","native");e.countryIds=r.country}if(e.competitionIds){let r=await this.idMapping.getEntityIdsBySchemaId(e.competitionIds,"competition","native");e.competitionIds=r.competition}if(e.matchIds){let r=await this.idMapping.getEntityIdsBySchemaId(e.matchIds,"match","native");e.matchIds=r.match}if(e.teamIds){let r=await this.idMapping.getEntityIdsBySchemaId(e.teamIds,"team","native");e.teamIds=r.team}}let t=await this.getMatches(e);return await this.idMapping.remapEntities(t,"match")}catch(t){throw console.warn("There was a problem browsing the matches",t),t}};getMatches=async e=>{try{return await this.https.getMatches(e)}catch(t){throw console.warn("There was a problem retrieving the matches",t),t}};getMatchIdMapping=async e=>{try{let t=await this.idMapping.getEntityIdsBySchemaId([e],"match","native"),r=await this.getMatchById(t.match[0]);return await this.idMapping.remapEntities(r,"match")}catch(t){throw console.warn(`There was a problem browsing the following match: ${e}`,t),t}};getMatchById=async e=>{try{return await this.https.getMatchById(e)}catch(t){throw console.warn(`There was a problem retrieving the following match: ${e}`,t),t}}};var Ue=class{entities=null;query=null;scope=null;constructor(e){this.entities=e.entities?e.entities:null,this.query=e.query?e.query:null,this.scope=e.scope?e.scope:null}constructFilterUrl=()=>{let e="";return this.entities&&(e=e+"&",e=e+`entities=${this.entities.join(",")}`),this.query&&(e=e+"&",e=e+`q=${this.query}`),this.scope&&(e=e+"&",e=e+`scope=${this.scope.join(",")}`),e}};var Ve=class{https=null;idMapping=null;constructor(e,t){this.https=e,this.idMapping=t}searchIdMapping=async e=>{try{if(e=new Ue(e),e.scope){let r=await this.idMapping.getEntityIdsBySchemaId(e.scope,"competition","native");e.scope=r.competition}let t=await this.search(e);if(t.teams&&t.teams.length>0){let r=await this.idMapping.remapEntities(t.teams,"team");t.teams=r}if(t.players&&t.players.length>0){let r=await this.idMapping.remapEntities(t.players,"player");t.players=r}if(t.competitions&&t.competitions.length>0){let r=await this.idMapping.remapEntities(t.competitions,"competition");t.competitions=r}return t}catch(t){throw console.warn("There was a problem with browsing the search result",t),t}};search=async e=>{try{return await this.https.search(e)}catch(t){throw console.warn("There was a problem retrieving the search response",t),t}}};var _=class{isBrowser=!1;localStorage={};https=null;idMapping=null;countriesFacade=null;competitionsFacade=null;teamsFacade=null;playerFacade=null;matchFacade=null;searchFacade=null;constructor(e,t,r){this.isBrowser=typeof window!="undefined",this.localStorage=e,this.idMapping=r,this.https=t,this.countriesFacade=new _e(e,t,r),this.competitionsFacade=new Ae(e,t,r),this.teamsFacade=new xe(t,r),this.playerFacade=new Ne(t,r),this.matchFacade=new De(t,r),this.searchFacade=new Ve(t,r)}getCountries=async()=>this.countriesFacade.getCountriesWithIdMapping();getCompetitions=async e=>this.competitionsFacade.getCompetitionsIdMapping(e);getCompetitionById=async e=>this.competitionsFacade.getCompetitionByIdIdMapping(e);getTopCompetitions=async()=>this.competitionsFacade.getTopCompetitionsIdMapping();getTeams=async e=>this.teamsFacade.getTeamsIdMapping(e);getTeamById=async e=>this.teamsFacade.getTeamByIdIdMapping(e);getTopTeams=async()=>this.teamsFacade.getTopTeamsIdMapping();getNextMatchForTeam=async e=>this.teamsFacade.getNextMatchForTeamIdMapping(e);getPrevMatchForTeam=async e=>this.teamsFacade.getPrevMatchForTeamIdMapping(e);getPlayers=async e=>this.playerFacade.getPlayersIdMapping(e);getPlayerById=async e=>this.playerFacade.getPlayerIdMapping(e);getTopPlayers=async()=>this.playerFacade.getTopPlayersIdMapping();getNextMatchForPlayer=async e=>this.playerFacade.getNextMatchForPlayerIdMapping(e);getPrevMatchForPlayer=async e=>this.playerFacade.getPrevMatchForPlayerIdMapping(e);getMatches=async e=>this.matchFacade.getMatchesIdMapping(e);getMatchById=async e=>this.matchFacade.getMatchIdMapping(e);search=async e=>this.searchFacade.searchIdMapping(e)};var D=class{idMapping=null;footballFacade=null;constructor(e,t){this.idMapping=e,this.footballFacade=t}remapInterestsToIdSchema=async e=>{let t=this.idMapping.idSchema;if(t!=="native")if(e.length>0){let r={},i={};e.forEach(l=>{r.hasOwnProperty(l.type)||(r[l.type]=[],i[l.type]=[]),r[l.type].push(l.id),i[l.type].push(l)});let a=await this.idMapping.idMappingFacade.getEntitiesByIds(r,"native",t),s=[];for(let[l,p]of Object.entries(i))p.forEach((d,n)=>{d.id=a[l][n],s.push(d)});return s}else return e;else return e};remapInterestToNative=async e=>{let t=this.idMapping.idSchema;if(t!=="native"){let r={},{id:i,type:a}=e;r[a]=[i];let s=await this.idMapping.idMappingFacade.getEntitiesByIds(r,t,"native");return e.id=s[a][0],e}return e};inquiryCustomInterests=async e=>{let t=e.filter(r=>r.source==="custom");if(t&&t.length>0){let r=e.filter(a=>a.source!=="custom"),i=await this.remapInterestsToIdSchema(r);return t.forEach(a=>i.push(a)),i}return await this.remapInterestsToIdSchema(e)};showFullInterests=async e=>{let t=[];for(let r of e)if(r.source!=="custom"&&r.source==="football"){let i={};if(r.type==="team"){i.teamIds=[r.id];let a=await this.footballFacade.getTeams(i);r.model=a[0]}if(r.type==="player"){i.playerIds=[r.id];let a=await this.footballFacade.getPlayers(i);r.model=a[0]}if(r.type==="competition"){i.competitionIds=[r.id];let a=await this.footballFacade.getCompetitions(i);r.model=a[0]}r.model===void 0&&(r.model=null),t.push(r)}else t.push(r);return t}};var qe=class{profileHttps=null;footballHttps=null;localStorage=null;idMapping=null;profileFacade=null;footballFacade=null;interestsService=null;ownProfile=null;modified=!1;expireAt=0;promises=[];isFetching=!1;constructor(e,t,r,i){this.localStorage=e,this.profileHttps=t,this.footballHttps=i,this.idMapping=r,this.footballFacade=new _(e,i,r),this.interestsService=new D(r,this.footballFacade),this.profileFacade=new E(e,t)}getOwnProfile=async()=>{for(;this.isFetching;)console.log("Another thread is fetching profile..."),await this.delay(100);if(this.modified&&this.ownProfile)return console.log("Timestamp is less than 10 minutes OR profile is modifying "),this.ownProfile;let e=Math.floor(Date.now()/1e3);if(!this.ownProfile||this.expireAt<e){this.isFetching=!0,this.expireAt=Math.floor(Date.now()/1e3)+600;let t=await this.profileFacade.getOwn();return this.setOwnProfile(t),this.modified=!1,this.isFetching=!1,this.ownProfile}return this.ownProfile};delay=e=>new Promise(t=>{setTimeout(t,e)});setOwnProfile=e=>{this.ownProfile=e};getInfo=async()=>{let e=await this.getOwnProfile();return delete e.interests,e};showInterests=async()=>{let e=await this.getOwnProfile(),t=[];return t=e.interests,await this.interestsService.inquiryCustomInterests(t)};showFullInterests=async()=>{let e=await this.showInterests();return await this.interestsService.showFullInterests(e)};getFollowers=async e=>await this.profileFacade.getFollowers(e);getFollowing=async e=>await this.profileFacade.getFollowing(e);follow=async e=>await this.profileFacade.follow(e);unfollow=async e=>await this.profileFacade.unfollow(e);addInterestPromise=async e=>{this.modified=!0,await this.getOwnProfile();let t=null;e.source!=="custom"?t=await this.interestsService.remapInterestToNative(e):t=e;let r=this.ownProfile.interests.filter(i=>i.id!==t.id||i.type!==t.type||i.source!==t.source);return this.ownProfile.interests=[...r],this.ownProfile.interests.push(t),this};addInterest=e=>(this.promises.push(this.addInterestPromise(e)),this);removeInterestPromise=async e=>{this.modified=!0,await this.getOwnProfile();let t=null;return e.source!=="custom"?t=await this.interestsService.remapInterestToNative(e):t=e,this.ownProfile.interests=this.ownProfile.interests.filter(r=>r.id!==t.id||r.type!==t.type||r.source!==t.source),this};removeInterest=e=>(this.promises.push(this.removeInterestPromise(e)),this);setBirthdatePromise=async e=>(this.modified=!0,await this.getOwnProfile(),e?this.ownProfile.birthDate=e:this.ownProfile.birthDate=null,this);setBirthdate=e=>(this.promises.push(this.setBirthdatePromise(e)),this);setGenderPromise=async e=>(this.modified=!0,await this.getOwnProfile(),e==="male"||e==="female"?this.ownProfile.gender=e:this.ownProfile.gender="unspecified",this);setGender=e=>(this.promises.push(this.setGenderPromise(e)),this);setCountryPromise=async e=>(this.modified=!0,await this.getOwnProfile(),e&&!this.ownProfile.country?(this.ownProfile.country=new Ee,this.ownProfile.country.id=e):e&&this.ownProfile.country?this.ownProfile.country.id=e:this.ownProfile.country=null,this);setCountry=e=>(this.promises.push(this.setCountryPromise(e)),this);showFullnessProfile=async()=>{let e=await this.getOwnProfile();return this.profileFacade.showFullnessProfile(e)};update=async()=>{if(this.promises.length===0)return this.ownProfile;await Promise.all(this.promises);let e=await this.getOwnProfile(),t=await this.profileHttps.updateProfile(e);return this.modified=!1,this.expireAt=0,this.localStorage.setOwnProfile(t),delete t.interests,t}};var He=class{profileHttps=null;footballFacade=null;localStorage=null;idMapping=null;profileFacade=null;interestsService=null;profileId="";constructor(e,t,r,i){this.localStorage=e,this.profileHttps=t,this.footballFacade=i,this.idMapping=r,this.interestsService=new D(r,i),this.profileFacade=new E(e,t)}setId=e=>(this.profileId=e,this);getProfile=async()=>await this.profileFacade.getById(this.profileId);getInfo=async()=>{let e=await this.getProfile();return delete e.interests,e};showInterests=async()=>{let e=await this.getProfile(),t=[];return t=e.interests,await this.interestsService.inquiryCustomInterests(t)};showFullInterests=async()=>{let e=await this.showInterests();return await this.interestsService.showFullInterests(e)};getFollowers=async e=>await this.profileFacade.getFollowers(e,this.profileId);getFollowing=async e=>await this.profileFacade.getFollowing(e,this.profileId);showFullnessProfile=async()=>{let e=await this.getProfile();return this.profileFacade.showFullnessProfile(e)}};var Ti=z($());var ke=class{id="";alias="";countryCode="";assets=null;name=""};var h=class{countriesFromResponse=e=>{if(e)return e.map(t=>this.countryFromResponse(t))};countryFromResponse=e=>{try{if(e){let t=new ke;return t.id=e.id,t.alias=e.alias,t.assets=e.assets,t.countryCode=e.country_code,t.name=e.name,t}}catch(t){throw t}return null}};var je=class{id="";country=null;gender="";assets=null;type="";name=""};var b=class{countryRemapper=null;constructor(){this.countryRemapper=new h}fromResponse(e){try{let t=new je;return t.id=e.id,t.country=this.countryRemapper.countryFromResponse(e.country),t.gender=e.gender,t.assets=e.assets,t.type=e.type,t.name=e.name,t}catch(t){throw console.warn("There was a problem remapping the competition response",t),t}}};var Ge=class{id="";country=null;gender="";assets=null;type="";name="";participants=[]};var Ke=class{id="";country=null;gender="";assets=null;name="";code="";national=!1;fullName="";shortName=""};var y=class{countryRemapper=null;constructor(){this.countryRemapper=new h}fromResponse(e){try{let t=new Ke;return t.id=e.id,t.country=this.countryRemapper.countryFromResponse(e.country),t.gender=e.gender,t.assets=e.assets,t.code=e.code,t.national=e.national,t.fullName=e.full_name,t.shortName=e.short_name,t.name=e.name,t}catch(t){throw console.warn("There was a problem remapping teams response",t),t}}};var Ye=class{countryRemapper=null;teamBasicRemapper=null;constructor(){this.countryRemapper=new h,this.teamBasicRemapper=new y}fromResponse(e){try{let t=new Ge;return t.id=e.id,t.country=this.countryRemapper.countryFromResponse(e.country),t.gender=e.gender,t.assets=e.assets,t.type=e.type,t.name=e.name,t.participants=e.participants.map(r=>this.teamBasicRemapper.fromResponse(r)),t}catch(t){throw console.warn("There was a problem remapping the competition response",t),t}}};var We=class{id="";country=null;gender="";assets=null;name="";competitions=[];code="";national=!1;fullName="";shortName="";squad=[]};var Xe=class{id="";startDate="";endDate="";shirtNumber;loan=!1;position="";country=null;name="";assets=null;birthDate=""};var Je=class{countryRemapper=null;constructor(){this.countryRemapper=new h}fromResponse(e){try{let t=new Xe;return t.id=e.id,t.startDate=e.start_date,t.endDate=e.end_date,t.shirtNumber=e.shirt_number,t.loan=e.loan,t.position=e.position,t.country=this.countryRemapper.countryFromResponse(e.country),t.name=e.name,t.assets=e.assets,t.birthDate=e.birth_date,t}catch(t){throw console.warn("There was a problem remapping the player from squad",t),t}}};var ze=class{countryRemapper=null;competitionRemapper=null;playerRemapper=null;constructor(){this.countryRemapper=new h,this.competitionRemapper=new b,this.playerRemapper=new Je}fromResponse(e){try{let t=new We;return t.id=e.id,t.country=this.countryRemapper.countryFromResponse(e.country),t.gender=e.gender,t.assets=e.assets,t.code=e.code,t.national=e.national,t.fullName=e.full_name,t.shortName=e.short_name,t.name=e.name,t.competitions=e.competitions?e.competitions.map(r=>this.competitionRemapper.fromResponse(r)):[],t.squad=e.squad?e.squad.map(r=>this.playerRemapper.fromResponse(r)):[],t}catch(t){throw console.warn("There was a problem remapping team response",t),t}}};var Qe=class{id="";kickoffAt="";finishedAt="";updatedAt="";homeTeam=null;awayTeam=null;lineupsConfirmed=!1;startedAt="";minute="";scores=null;context={competition:null};status={type:null,subType:null}};var Ze=class{ftScore=null;htScore=null;aetScore=null;aggScore=null;penScore=null};var U=class{fromResponse(e){try{let t=new Ze;return t.ftScore=this.statEntityFromResponse(e.ft_score),t.htScore=this.statEntityFromResponse(e.ht_score),t.aetScore=this.statEntityFromResponse(e.aet_score),t.aggScore=this.statEntityFromResponse(e.agg_score),t.penScore=this.statEntityFromResponse(e.pen_score),t}catch(t){throw console.warn("There was a problem remapping the scores",t),t}}statEntityFromResponse=e=>({homeGoals:e.home_goals,awayGoals:e.away_goals})};var et=class{teamRemapper=null;competitionRemapper=null;scoresRemapper=null;constructor(){this.teamRemapper=new y,this.competitionRemapper=new b,this.scoresRemapper=new U}fromResponse(e){try{let t=new Qe;return t.id=e.id,t.kickoffAt=e.kickoff_at,t.finishedAt=e.finished_at,t.updatedAt=e.updated_at,t.homeTeam=this.teamRemapper.fromResponse(e.home_team),t.awayTeam=this.teamRemapper.fromResponse(e.away_team),t.lineupsConfirmed=e.lineups_confirmed,t.startedAt=e.started_at,t.minute=e.minute,t.scores=this.scoresRemapper.fromResponse(e.scores),t.context={competition:this.competitionRemapper.fromResponse(e.context.competition)},t.status={type:e.status.type,subType:e.status.sub_type},t}catch(t){throw console.warn("There was a problem remapping the match response",t),t}}};var tt=class{id="";kickoffAt="";finishedAt="";updatedAt="";homeTeam=null;awayTeam=null;lineupsConfirmed=!1;startedAt="";minute="";scores=null;stats=null;context={competition:null};timeline=[];status={type:null,subType:null};lineups=null};var rt=class{corners=null;crosses=null;offside=null;shotsOn=null;throwIn=null;redCards=null;shotsOff=null;goalKicks=null;possession=null;treatments=null;yellowCards=null;shotsBlocked=null;substitutions=null;counterAttacks=null;foulsCommitted=null};var it=class{fromResponse(e){try{let t=new rt;return t.corners=this.statEntityFromResponse(e.corners),t.crosses=this.statEntityFromResponse(e.crosses),t.offside=this.statEntityFromResponse(e.offside),t.shotsOn=this.statEntityFromResponse(e.shots_on),t.throwIn=this.statEntityFromResponse(e.throw_in),t.redCards=this.statEntityFromResponse(e.red_cards),t.shotsOff=this.statEntityFromResponse(e.shots_off),t.goalKicks=this.statEntityFromResponse(e.goal_kicks),t.possession=this.statEntityFromResponse(e.possession),t.treatments=this.statEntityFromResponse(e.treatments),t.yellowCards=this.statEntityFromResponse(e.yellow_cards),t.shotsBlocked=this.statEntityFromResponse(e.shots_blocked),t.substitutions=this.statEntityFromResponse(e.substitutions),t.counterAttacks=this.statEntityFromResponse(e.counter_attacks),t.foulsCommitted=this.statEntityFromResponse(e.fouls_committed),t}catch(t){throw console.warn("There was a problem remapping the stats",t),t}}statEntityFromResponse=e=>({homeTeam:e?e.home_team:null,awayTeam:e?e.away_team:null})};var V=class{homeTeam={players:[]};awayTeam={players:[]}};var ot=class{id="";name="";position="";shirtNumber;assets=null;type=""};var q=class{fromResponse(e){try{let t=new ot;return t.id=e.id,t.name=e.name,t.position=e.position,t.shirtNumber=e.shirt_number,t.assets=e.assets,t.type=e.type,t}catch(t){throw console.warn("There was a problem remapping the player from timeline",t),t}}};var at=class{playerRemapper=null;constructor(){this.playerRemapper=new q}fromResponse(e){try{let t=new V;return t.homeTeam.players=e.home_team&&e.home_team.players?e.home_team.players.map(r=>this.playerRemapper.fromResponse(r)):[],t.awayTeam.players=e.away_team&&e.away_team.players?e.away_team.players.map(r=>this.playerRemapper.fromResponse(r)):[],t}catch(t){throw console.warn("There was a problem remapping the lineups",t),t}}};var st=class{minute="";type="";teamId="";player=null;relatedPlayer=null;updatedAt=""};var nt=class{playerRemapper=null;constructor(){this.playerRemapper=new q}fromResponse(e){try{let t=new st;return t.minute=e.minute,t.type=e.type,t.teamId=e.team_id,t.player=this.playerRemapper.fromResponse(e.player),t.relatedPlayer=e.related_player?this.playerRemapper.fromResponse(e.related_player):null,t.updatedAt=e.updated_at,t}catch(t){throw console.warn("There was a problem remapping timeline",t),t}}};var lt=class{teamMapper=null;competitionsMapper=null;lineupsMapper=null;scoresMapper=null;statsMapper=null;timelineMapper=null;constructor(){this.teamMapper=new y,this.competitionsMapper=new b,this.lineupsMapper=new at,this.scoresMapper=new U,this.statsMapper=new it,this.timelineMapper=new nt}fromResponse(e){try{let t=new tt;return t.id=e.id,t.kickoffAt=e.kickoff_at,t.finishedAt=e.finished_at,t.updatedAt=e.updated_at,t.homeTeam=e.home_team?this.teamMapper.fromResponse(e.home_team):null,t.awayTeam=e.away_team?this.teamMapper.fromResponse(e.away_team):null,t.lineupsConfirmed=e.lineups_confirmed,t.startedAt=e.started_at,t.minute=e.minute,t.scores=this.scoresMapper.fromResponse(e.scores),t.stats=this.statsMapper.fromResponse(e.stats),t.context={competition:this.competitionsMapper.fromResponse(e.context.competition)},t.timeline=e.timeline?e.timeline.map(r=>this.timelineMapper.fromResponse(r)):[],t.status={type:e.status.type,subType:e.status.sub_type},t.lineups=e.lineups?this.lineupsMapper.fromResponse(e.lineups):new V,t}catch(t){throw console.warn("There was a problem remapping the match response",t),t}}};var pt=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null};var ct=class{countryRemapper=null;constructor(){this.countryRemapper=new h}fromResponse(e){try{let t=new pt;return t.id=e.id,t.firstName=e.first_name?e.first_name:null,t.lastName=e.last_name?e.last_name:null,t.name=e.name?e.name:null,t.birthDate=e.birth_date,t.country=this.countryRemapper.countryFromResponse(e.country),t.assets=e.assets,t.position=e.position,t}catch(t){throw console.warn("There was a problem remapping top player response",t),t}}};var mt=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;teams=[]};var H=class{countryRemapper=null;teamRemapper=null;constructor(){this.countryRemapper=new h,this.teamRemapper=new y}fromResponse(e){try{let t=new mt;return t.id=e.id,t.firstName=e.first_name?e.first_name:null,t.lastName=e.last_name?e.last_name:null,t.name=e.name?e.name:null,t.birthDate=e.birth_date,t.country=this.countryRemapper.countryFromResponse(e.country),t.assets=e.assets,t.teams=e.teams?e.teams.map(r=>this.teamRemapper.fromResponse(r)):[],t.position=e.position,t}catch(t){throw console.warn("There was a problem remapping players response",t),t}}};var ut=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;competitions=[];teams=[]};var dt=class{countryRemapper=null;teamRemapper=null;competitionRemapper=null;constructor(){this.countryRemapper=new h,this.teamRemapper=new y,this.competitionRemapper=new b}fromResponse(e){try{let t=new ut;return t.id=e.id,t.firstName=e.first_name?e.first_name:null,t.lastName=e.last_name?e.last_name:null,t.name=e.name?e.name:null,t.birthDate=e.birth_date,t.country=this.countryRemapper.countryFromResponse(e.country),t.assets=e.assets,t.teams=e.teams?e.teams.map(r=>this.teamRemapper.fromResponse(r)):[],t.position=e.position,t.competitions=e.competitions?e.competitions.map(r=>this.competitionRemapper.fromResponse(r)):[],t}catch(t){throw console.warn("There was a problem remapping player response",t),t}}};var ht=class{teams=null;players=null;competitions=null};var ft=class{teamRemapper=null;playerRemapper=null;competitionremapper=null;constructor(){this.teamRemapper=new y,this.playerRemapper=new H,this.competitionremapper=new b}fromResponse(e){try{let t=new ht;return t.teams=e.teams?e.teams.map(r=>this.teamRemapper.fromResponse(r)):[],t.players=e.players?e.players.map(r=>this.playerRemapper.fromResponse(r)):[],t.competitions=e.competitions?e.competitions.map(r=>this.competitionremapper.fromResponse(r)):[],t}catch(t){throw console.warn("There was a problem remapping search response",t),t}}};var k=class{instance=null;apiSignInUrl="";idSchema="";limitIds=200;countryRemapper=null;competitionBasicRemapper=null;competitionFullRemapper=null;teamBasicRemapper=null;teamFullRemapper=null;matchBasicRemapper=null;matchFullRemapper=null;playerBasicRemapper=null;playerFullRemapper=null;topPlayerRemapper=null;searchRemapper=null;constructor(e){let t=S(e.environment,"football");this.apiSignInUrl=`?key=${e.apiKey}&lang=${e.lang}&client_id=${e.clientId}`,this.idSchema=e.idSchema,this.instance=Ti.default.create({baseURL:t}),this.countryRemapper=new h,this.competitionBasicRemapper=new b,this.competitionFullRemapper=new Ye,this.teamBasicRemapper=new y,this.teamFullRemapper=new ze,this.matchBasicRemapper=new et,this.matchFullRemapper=new lt,this.playerBasicRemapper=new H,this.playerFullRemapper=new dt,this.topPlayerRemapper=new ct,this.searchRemapper=new ft}getCountries=async()=>{try{let e=await this.instance.get(`/countries${this.apiSignInUrl}`);return this.countryRemapper.countriesFromResponse(e.data.data)}catch(e){throw console.warn("There was a problem with the football countries request",e),e}};getCompetitions=async e=>{try{let t={};if(e&&e.competitionIds&&e.competitionIds.length>this.limitIds-1){let r=[],i=he(e.competitionIds);for(let s of i)e.competitionIds=s,t=await this.instance.get(`/competitions${this.apiSignInUrl}${e.constructFilterUrl()}`),r.push(t.data.data.map(l=>this.competitionBasicRemapper.fromResponse(l)));return Array.prototype.concat.apply([],r)}else return t=e?await this.instance.get(`/competitions${this.apiSignInUrl}${e.constructFilterUrl()}`):await this.instance.get(`/competitions${this.apiSignInUrl}`),t.data.data.map(r=>this.competitionBasicRemapper.fromResponse(r))}catch(t){throw console.warn("There was a problem with getCompetitions request",t),t}};getCompetitionById=async e=>{try{let t=await this.instance.get(`/competitions/${e}${this.apiSignInUrl}`);return this.competitionFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getCompetitionById request",t),t}};getTopCompetitions=async()=>{try{return(await this.instance.get(`/competitions/top${this.apiSignInUrl}`)).data.data.map(t=>this.competitionBasicRemapper.fromResponse(t))}catch(e){throw console.warn("There was a problem with getTopCompetitions request",e),e}};getTeams=async e=>{try{let t={};if(e.teamIds&&e.teamIds.length>this.limitIds-1){let r=[],i=he(e.teamIds);for(let s of i)e.teamIds=s,t=await this.instance.get(`/teams${this.apiSignInUrl}${e.constructFilterUrl()}`),r.push(t.data.data.map(l=>this.teamBasicRemapper.fromResponse(l)));return Array.prototype.concat.apply([],r)}else return t=e?await this.instance.get(`/teams${this.apiSignInUrl}${e.constructFilterUrl()}`):await this.instance.get(`/teams${this.apiSignInUrl}`),t.data.data.map(r=>this.teamBasicRemapper.fromResponse(r))}catch(t){throw console.warn("There was a problem with getTeams request",t),t}};getTeamById=async e=>{try{let t=await this.instance.get(`/teams/${e}${this.apiSignInUrl}`);return this.teamFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getTeamById request",t),t}};getTopTeams=async()=>{try{let e=await this.instance.get(`/teams/top${this.apiSignInUrl}`);return e.data.data?e.data.data.map(t=>this.teamBasicRemapper.fromResponse(t)):[]}catch(e){throw console.warn("There was a problem with getTopTeams request",e),e}};getNextMatchForTeam=async e=>{try{let t=await this.instance.get(`/teams/${e}/next-match${this.apiSignInUrl}`);return this.matchFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getNextMatchForTeam request",t),t}};getPrevMatchForTeam=async e=>{try{let t=await this.instance.get(`/teams/${e}/previous-match${this.apiSignInUrl}`);return this.matchFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getPrevMatchForTeam request",t),t}};getPlayers=async e=>{try{let t={};if(e.playerIds&&e.playerIds.length>this.limitIds-1){let r=[],i=he(e.playerIds);for(let s of i)e.playerIds=s,t=await this.instance.get(`/players${this.apiSignInUrl}${e.constructFilterUrl()}`),r.push(t.data.data.map(l=>this.teamBasicRemapper.fromResponse(l)));return Array.prototype.concat.apply([],r)}else return(e?await this.instance.get(`/players${this.apiSignInUrl}${e.constructFilterUrl()}`):await this.instance.get(`/players${this.apiSignInUrl}`)).data.data.map(i=>this.playerBasicRemapper.fromResponse(i))}catch(t){throw console.warn("There was a problem with getPlayers request",t),t}};getPlayerById=async e=>{try{let t=await this.instance.get(`/players/${e}${this.apiSignInUrl}`);return this.playerFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getPlayerById request",t),t}};getTopPlayers=async()=>{try{return(await this.instance.get(`/players/top${this.apiSignInUrl}`)).data.data.map(t=>this.topPlayerRemapper.fromResponse(t))}catch(e){throw console.warn("There was a problem with getTopPlayers request",e),e}};getNextMatchForPlayer=async e=>{try{let t=await this.instance.get(`/players/${e}/next-match${this.apiSignInUrl}`);return this.matchFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getNextMatchForPlayer request",t),t}};getPrevMatchForPlayer=async e=>{try{let t=await this.instance.get(`/players/${e}/previous-match${this.apiSignInUrl}`);return this.matchFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getPrevMatchForPlayer request",t),t}};getMatchById=async e=>{try{let t=await this.instance.get(`/matches/${e}${this.apiSignInUrl}`);return this.matchFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getMatchById request",t),t}};getMatches=async e=>{try{return(e?await this.instance.get(`/matches${this.apiSignInUrl}${e.constructFilterUrl()}`):await this.instance.get(`/matches${this.apiSignInUrl}`)).data.data.map(r=>this.matchBasicRemapper.fromResponse(r))}catch(t){throw console.warn("There was a problem with getMatches request",t),t}};search=async e=>{try{let t=await this.instance.get(`/search${this.apiSignInUrl}${e.constructFilterUrl()}`);return this.searchRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with search request",t),t}}};var yt=class{profileHttps=null;footballHttps=null;footballFacade=null;idMapping=null;localStorage=null;profileFacade=null;ownProfileBuilder=null;profileBuilder=null;constructor(e){this.profileHttps=new Ie(e),this.footballHttps=new k(e),this.idMapping=new C(e),this.localStorage=new T(e),this.footballFacade=new _(this.localStorage,this.footballHttps,this.idMapping),this.profileFacade=new E(this.localStorage,this.profileHttps),this.ownProfileBuilder=new qe(this.localStorage,this.profileHttps,this.idMapping,this.footballHttps),this.profileBuilder=new He(this.localStorage,this.profileHttps,this.idMapping,this.footballFacade)}getOwn=()=>this.ownProfileBuilder;getById=e=>this.profileBuilder.setId(e);getCountries=async()=>await this.profileFacade.getCountries();getByIds=async e=>await this.profileFacade.getByIds(e)};var gt=class{validate=e=>{let t=this.validateField(e.lang),r=this.generateMessage(t);return{validation:t,message:r}};validateField=e=>{let t=["bg","ro","en"],r=null;return e!=null&&e.length>0?t.includes(e)?r="valid":r="invalid":r="missing",r};generateMessage=e=>{let t=null,r="warning";return e==="missing"&&(t="If no lang is passed the default one will be set which is: EN"),e==="invalid"&&(t="This lang value is not supported, the default one will be set which is: EN"),e==="valid"&&(t=null,r=null),{text:t,type:r}}};var wt=class{validate(e){let t=this.validateField(e.environment),r=this.generateMessage(t);return{validation:t,message:r}}validateField=e=>{let t=["dev","sandbox","prod"],r=null;return e!=null&&e.length>0?t.includes(e)?r="valid":r="invalid":r="missing",r};generateMessage=e=>{let t=null,r="warning";return e==="missing"&&(t="If no environment is passed the default one will be set which is: prod"),e==="invalid"&&(t="This environment value is not supported, the default one will be set which is: prod"),e==="valid"&&(t=null,r=null),{text:t,type:r}}};var bt=class{validate(e){let t=this.validateField(e.apiKey),r=this.generateMessage(t);return{validation:t,message:r}}validateField=e=>{let t=null;return e!=null&&e.length>0?t="valid":t="missing",t};generateMessage=e=>{let t=null,r="error";return e==="missing"&&(t="The field apiKey must be provided to use this SDK"),e==="valid"&&(t=null,r=null),{text:t,type:r}}};var Mt=class{validate(e){let t=this.validateField(e.idSchema),r=this.generateMessage(t);return{validation:t,message:r}}validateField=e=>{let t=["native","sportal365","enetpulse","sportradar"],r=null;return e!=null&&e.length>0?t.includes(e)?r="valid":r="invalid":r="missing",r};generateMessage=e=>{let t=null,r="warning";return e==="missing"&&(t="If no idSchema is passed the default one will be set which is: native"),e==="invalid"&&(t="This idSchema value is not supported, the default one will be set which is: native"),e==="valid"&&(t=null,r=null),{text:t,type:r}}};var ae=class{getIdToken=null;logout=null};var G=class{text=null;type=null};var It=class{validation=null;message=new G;getIdToken={validation:null,message:new G};logout={validation:null,message:new G}};var Rt=class{validate(e){let t=this.validateAuthProvider(e.authProvider);return t.validation!=="missing"&&(t=this.validateAuthProviderConfigFields(e.authProvider,t),t=this.generateAuthProviderConfigMessages(t),t=this.checkAuthProviderConfigMessagesForErrors(t)),t}validateAuthProvider=e=>{let t=Object.keys(new ae),r=new It;if(e){let a=Object.keys(e).filter(s=>!t.includes(s));a.length>0?(r.validation="invalid",r.message.type="warning",r.message.text=`${"You have passed a property which is not supported for the authentication provider:"} ${a.join(",")}`):r.validation="valid"}else r.validation="missing",r.message.type="error",r.message.text="The field authProvider must be provided to use this SDK";return r};validateAuthProviderConfigFields=(e,t)=>(Object.keys(new ae).forEach(i=>{e[i]?t[i].validation="valid":t[i].validation="missing"}),t);generateAuthProviderConfigMessages=e=>(Object.keys(e).filter(t=>t!=="validation"&&t!=="message").forEach(t=>{let r=e[t];r.validation==="missing"&&(r.message.text=`${"The following property is missing from the authProvider object:"} ${t}`,r.message.type="error")}),e);checkAuthProviderConfigMessagesForErrors=e=>(Object.keys(e).filter(t=>t!=="validation"&&t!=="message").forEach(t=>{e[t].validation==="missing"&&e.validation==="valid"&&(e.validation="invalid",e.message.type="error",e.message.text="The field authProvider has missing properties")}),e)};var se=class{validation;message};var Pt=class{apiKey=null;environment=null;idSchema=null;clientId=null;lang=null;authProvider={getIdToken:new se,logout:new se};isValid=!1};var Ft=class{validate(e){let t=this.validateField(e.clientId),r=this.generateMessage(t);return{validation:t,message:r}}validateField=e=>{let t=null;return e!=null&&e.length>0?t="valid":t="missing",t};generateMessage=e=>{let t=null,r="warning";return e==="missing"&&(t="The field clientId must be provided to use this SDK"),e==="valid"&&(t=null,r=null),{text:t,type:r}}};var St=class{validate=e=>{let t=this.checkFieldsForValues(e);return t.isValid=this.containsErrorMessage(t),t};checkFieldsForValues=e=>{let t=new Pt,r={apiKey:new bt,environment:new wt,idSchema:new Mt,clientId:new Ft,lang:new gt,authProvider:new Rt};for(let[i,a]of Object.entries(t))i!=="isValid"&&(a=r[i].validate(e));return Object.keys(r).forEach(i=>{t[i]=r[i].validate(e)}),t};containsErrorMessage=e=>{let t=!0;for(let[r,i]of Object.entries(e))if(r!=="authProvider"){if(r!=="isValid"&&i.message.type==="error")return t=!1,t;if(r!=="isValid"&&i.message.type==="warning")return t=!0,t}return t}};var vt=class{https=null;idMapping=null;localStorage=null;footballFacade=null;constructor(e){this.https=new k(e),this.idMapping=new C(e),this.localStorage=new T(e),this.footballFacade=new _(this.localStorage,this.https,this.idMapping)}getCountries=async()=>await this.footballFacade.getCountries();getCompetitions=async e=>await this.footballFacade.getCompetitions(e);getCompetitionById=async e=>await this.footballFacade.getCompetitionById(e);getTopCompetitions=async()=>await this.footballFacade.getTopCompetitions();getTeams=async e=>await this.footballFacade.getTeams(e);getTeamById=async e=>await this.footballFacade.getTeamById(e);getTopTeams=async()=>await this.footballFacade.getTopTeams();getNextMatchForTeam=async e=>await this.footballFacade.getNextMatchForTeam(e);getPrevMatchForTeam=async e=>await this.footballFacade.getPrevMatchForTeam(e);getPlayers=async e=>await this.footballFacade.getPlayers(e);getPlayerById=async e=>await this.footballFacade.getPlayerById(e);getTopPlayers=async()=>await this.footballFacade.getTopPlayers();getNextMatchForPlayer=async e=>await this.footballFacade.getNextMatchForPlayer(e);getPrevMatchForPlayer=async e=>await this.footballFacade.getPrevMatchForPlayer(e);getMatches=async e=>await this.footballFacade.getMatches(e);getMatchById=async e=>await this.footballFacade.getMatchById(e);search=async e=>await this.footballFacade.search(e)};var Ei=z($());var Tt=(u=>(u.FT_1X2="FT_1X2",u.HT_1X2="HT_1X2",u.BOTH_TEAMS_SCORE="BOTH_TEAMS_SCORE",u.OVER_GOALS="OVER_GOALS",u.OVER_CORNERS="OVER_CORNERS",u.DOUBLE_CHANCE="DOUBLE_CHANCE",u.HT_FT="HT_FT",u.PLAYER_SCORE="PLAYER_SCORE",u.PLAYER_YELLOW_CARD="PLAYER_YELLOW_CARD",u.PLAYER_RED_CARD="PLAYER_RED_CARD",u.RED_CARD_MATCH="RED_CARD_MATCH",u.PENALTY_MATCH="PENALTY_MATCH",u.PLAYER_SCORE_FIRST_GOAL="PLAYER_SCORE_FIRST_GOAL",u.CORNERS_MATCH="CORNERS_MATCH",u.CORRECT_SCORE="CORRECT_SCORE",u.PLAYER_SCORE_HATTRICK="PLAYER_SCORE_HATTRICK",u.PLAYER_SCORE_TWICE="PLAYER_SCORE_TWICE",u))(Tt||{});var Ct=class{matchId=null;matchType=null;result=null;market=null;prediction;target;playerId;goalsHome;goalsAway};var Et=class{settledAt=null;resettledAt=null;status=null;outcome=null};var _t=class{remapFixturesRequest=e=>{let t={},r=["PLAYER_RED_CARD","PLAYER_SCORE","PLAYER_SCORE_FIRST_GOAL","PLAYER_SCORE_HATTRICK","PLAYER_SCORE_TWICE","PLAYER_YELLOW_CARD"],i=["HT_1X2","HT_FT","FT_1X2","DOUBLE_CHANCE","CORNERS_MATCH"],a="API request body is expecting a property",s="API request body is not expecting a property";if(t.match_id=e.matchId,t.match_type=e.matchType,t.market=e.market,e.prediction!==void 0&&e.market!=="CORRECT_SCORE")t.prediction=e.prediction;else{if(typeof e.prediction=="boolean"&&i.includes(e.market))throw new Error(`${a} prediction to be type string`);if(typeof e.prediction=="string"&&!i.includes(e.market))throw new Error(`${a} prediction to be type boolean`);if(e.prediction&&e.market==="CORRECT_SCORE")throw new Error(`${s} prediction for market: ${"CORRECT_SCORE"}`);if(e.prediction===void 0&&e.market!=="CORRECT_SCORE")throw new Error(`${a} prediction`)}if(e.target&&(e.market==="OVER_CORNERS"||e.market==="OVER_GOALS"))t.target=e.target;else{if(e.target&&e.market!=="OVER_CORNERS"&&e.market!=="OVER_GOALS")throw new Error(`${s} target`);if(!e.target&&(e.market==="OVER_CORNERS"||e.market==="OVER_GOALS"))throw new Error(`${a} target for the following markets: ${"OVER_GOALS"} and ${"OVER_CORNERS"}`)}if(e.playerId&&r.includes(e.market))t.player_id=e.playerId;else{if(e.playerId&&!r.includes(e.market))throw new Error(`${s} playerId for market: ${e.market}`);if(!e.playerId&&r.includes(e.market))throw new Error(`${a} playerId for market: ${e.market}`)}if(e.goalsHome&&e.goalsAway&&e.market==="CORRECT_SCORE")t.goals_home=e.goalsHome,t.goals_away=e.goalsAway;else{if((e.goalsHome||e.goalsAway)&&e.market!=="CORRECT_SCORE")throw new Error("API request body is not expecting the following properties: goalsHome and goalsAway");if((!e.goalsHome||!e.goalsAway)&&e.market==="CORRECT_SCORE")throw new Error("API request body is expecting the following properties: goalsHome and goalsAway")}return t};remapFixturesResponse=e=>{let t=new Ct;return t.matchId=e.match_id,t.matchType=e.match_type,t.result=this.remapResult(e.result),t.market=e.market,e.prediction!==void 0&&(t.prediction=e.prediction),e.target&&(t.target=e.target),e.player_id&&(t.playerId=e.player_id),e.goals_home&&(t.goalsHome=e.goals_home),e.goals_away&&(t.goalsAway=e.goals_away),t};remapResult=e=>{let t=new Et;return t.settledAt=e.settled_at,t.resettledAt=e.resettled_at,t.status=e.status,t.outcome=e.outcome,t}};var K=class{id=null;gameInstanceId=null;wager=null;totalFixtures=null;settledFixtures=null;userId=null;fixtures=null;status=null;tiebreaker=null;points=null;createdAt=null;updatedAt=null};var Y=class{fullTimeOneXTwo={};halfTimeOneXTwo={};bothTeamsScore={};overGoals={};overCorners={};doubleChance={};halfTimeFullTime={};playerScore={};playerYellowCard={};playerRedCard={};redCardMatch={};penaltyMatch={};playerScoreFirstGoal={};cornersMatch={};correctScore={};playerScoreHattrick={};playerScoreTwice={}};var W=class{fixturesRemapper=null;constructor(){this.fixturesRemapper=new _t}remapRequestBody=e=>{let t={};return t.game_instance_id=e.gameInstanceId,t.fixtures=e.fixtures.map(r=>this.fixturesRemapper.remapFixturesRequest(r)),t};remapResponseBody=e=>{let t=new K;return t.id=e.id,t.gameInstanceId=e.game_instance_id,t.wager=e.wager,t.totalFixtures=e.total_fixtures,t.settledFixtures=e.settled_fixtures,t.userId=e.user_id,t.fixtures=e.fixtures.map(r=>this.fixturesRemapper.remapFixturesResponse(r)),t.status=e.status,t.tiebreaker=e.tiebreaker,t.points=e.points,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapPredictionModel=e=>{let t=new Y;return t.fullTimeOneXTwo=e.FT_1X2,t.halfTimeOneXTwo=e.HT_1X2,t.bothTeamsScore=e.BOTH_TEAMS_SCORE,t.overGoals=e.OVER_GOALS,t.overCorners=e.OVER_CORNERS,t.doubleChance=e.DOUBLE_CHANCE,t.halfTimeFullTime=e.HT_FT,t.playerScore=e.PLAYER_SCORE,t.playerYellowCard=e.PLAYER_YELLOW_CARD,t.playerRedCard=e.PLAYER_RED_CARD,t.redCardMatch=e.RED_CARD_MATCH,t.penaltyMatch=e.PENALTY_MATCH,t.playerScoreFirstGoal=e.PLAYER_SCORE_FIRST_GOAL,t.cornersMatch=e.CORNERS_MATCH,t.correctScore=e.CORRECT_SCORE,t.playerScoreHattrick=e.PLAYER_SCORE_HATTRICK,t.playerScoreTwice=e.PLAYER_SCORE_TWICE,t}};var Bt=class{matchId=null;matchType=null;predictions=null};var At=class{remapPredictions=null;constructor(){this.remapPredictions=new W}remapResponse=e=>{let t=new Bt;return t.matchId=e.match_id,t.matchType=e.match_type,t.predictions=this.remapPredictions.remapPredictionModel(e.predictions),t}};var Ot=class{instance=null;apiSignInUrl=null;clientApiSignInUrl=null;predictionRemapper=null;matchSummaryRemapper=null;constructor(e){let t=S(e.environment,"predictor");this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}`,this.predictionRemapper=new W,this.matchSummaryRemapper=new At,this.instance=Ei.default.create({baseURL:t,headers:{Authorization:`Bearer ${e.authProvider.getIdToken()}`,"Content-Type":"application/json"}})}makePrediction=async e=>{try{let t=this.predictionRemapper.remapRequestBody(e),r=await this.instance.post(`/predictions${this.apiSignInUrl}`,JSON.stringify(t));return this.predictionRemapper.remapResponseBody(r.data)}catch(t){return console.warn("There was a problem making POST request: ",t),t.message}};getMatchSummary=async e=>{try{let t=await this.instance.get(`/predictions/summary/${e}${this.apiSignInUrl}`);return this.matchSummaryRemapper.remapResponse(t.data)}catch(t){return console.warn(`There was a problem fetching predictions for match: ${e} `,t),t.message}};deletePrediction=async()=>{};getMyPredictions=async()=>{}};var xt=class{fullCoverageCompetitions=null;markets=null};var Lt=class{remapConfig=e=>{let t=new xt;return t.fullCoverageCompetitions=e.full_coverage_competitions,t.markets=e.markets,t}};var Nt=class{gameInstanceId=null;fixtures=null};var $t=class{idMapping=null;constructor(e){this.idMapping=e}remapMatchIdToNative=async e=>(await this.idMapping.getEntityIdsBySchemaId(e,"match","native")).match[0];remapPlayerIdToNative=async e=>(await this.idMapping.getEntityIdsBySchemaId(e,"player","native")).player[0];remapPlayerIdToIdSchema=async e=>{let t=["playerScore","playerYellowCard","playerRedCard","playerScoreFirstGoal","playerScoreHattrick","playerScoreTwice"];for(let[r,i]of Object.entries(e))if(t.includes(r))for(let a of Object.keys(i)){let s={player:[a]},p=(await this.idMapping.idMappingFacade.getEntitiesByIds(s,"native",this.idMapping.idSchema)).player[0];i[p]=i[a],delete i[a]}return e};convertMarket=e=>{let t=Object.keys(new Y),r=Object.values(Tt);for(let i=0;i<r.length;i++)e===r[i]&&(e=t[i]);return e}};var Dt=class{predictorHttps=null;clientHttps=null;idMapping=null;predictorConfigRemapper=null;predictorService=null;constructor(e,t,r){this.predictorHttps=e,this.idMapping=r,this.clientHttps=t,this.predictorConfigRemapper=new Lt,this.predictorService=new $t(r)}makePrediction=async e=>{let t=new Nt;if(this.idMapping.idSchema!=="native"){let r=e.matchId,i=e.playerId;e.matchId=await this.predictorService.remapMatchIdToNative([r]),i&&(e.playerId=await this.predictorService.remapPlayerIdToNative([i])),t.fixtures=[e];let a=await this.predictorHttps.makePrediction(t);return a instanceof K&&a.fixtures.map(s=>{s.playerId&&(s.playerId=i),s.matchId=r}),a}else return t.fixtures=[e],await this.predictorHttps.makePrediction(t)};getMatchSummary=async e=>{if(this.idMapping.idSchema!=="native"){let t=await this.predictorService.remapMatchIdToNative([e]),r=await this.predictorHttps.getMatchSummary(t);r.matchId=e;let i=r.predictions,a=await this.predictorService.remapPlayerIdToIdSchema(i);return r.predictions=a,r}else return await this.predictorHttps.getMatchSummary(e)};getMarketSummary=async(e,t)=>{try{let r=await this.getMatchSummary(e),i=this.predictorService.convertMarket(t),a={};if(a.matchId=r.matchId,a.matchType=r.matchType,Object.keys(r.predictions).includes(i)&&(a[i]=r.predictions[i]),!a.hasOwnProperty(i))throw new Error("You have passed invalid market");return a}catch(r){return r.message}};getConfig=async()=>{let e=await this.clientHttps.getConfig(),t=await this.predictorConfigRemapper.remapConfig(e.predictor);if(this.idMapping.idSchema!=="native"){let r={competition:t.fullCoverageCompetitions},i=await this.idMapping.idMappingFacade.getEntitiesByIds(r,"native",this.idMapping.idSchema);return t.fullCoverageCompetitions=i.competition,t}return t};deletePrediction=()=>{};getMyPredictions=()=>{};getUserPastPredictions=()=>{};getUserCurrentPredictions=()=>{}};var _i=z($());var X=class{instance=null;apiSignInUrl="";constructor(e){let t=S(e.environment,"client");this.apiSignInUrl=`/clients/${e.clientId}/features?key=${e.apiKey}`,this.instance=_i.default.create({baseURL:t,headers:{"Content-Type":"application/json"}})}getConfig=async()=>{try{return(await this.instance.get(`${this.apiSignInUrl}`)).data.data}catch(e){return console.warn("There was a problem fetching configuration from Client API",e),e.message}}};var Ut=class{predictorHttps=null;clientHttps=null;predictorFacade=null;idMapping=null;constructor(e){this.predictorHttps=new Ot(e),this.clientHttps=new X(e),this.idMapping=new C(e),this.predictorFacade=new Dt(this.predictorHttps,this.clientHttps,this.idMapping)}makePrediction=async e=>await this.predictorFacade.makePrediction(e);getMatchSummary=async e=>await this.predictorFacade.getMatchSummary(e);getMarketSummary=async(e,t)=>await this.predictorFacade.getMarketSummary(e,t);getConfig=async()=>await this.predictorFacade.getConfig();deletePrediction=()=>{};getMyPredictions=()=>{};getUserPastPredictions=()=>{};getUserCurrentPredictions=()=>{}};var Vt=class{general=[];predictor=[];topX=[]};var qt=class{enabled=!1;rewards=null};var Ht=class{general=null;topX=null;predictor=null};var kt=class{points=null;tiers=null;badges=null};var jt=class{remapLoyaltyResponse=e=>{let t=new qt;return t.enabled=e.enabled,t.rewards=this.remapRewards(e.rewards),t};remapRewards=e=>{let t=new kt;return t.points=this.remapPoints(e.points),t.tiers=e.tiers,t.badges=this.remapBadges(e.badges),t};remapPoints=e=>{let t=new Ht;return t.general=e.general,t.topX=e.top_x,t.predictor=e.predictor,t};remapBadges=e=>{let t=new Vt;return t.general=e.general,t.predictor=e.predictor,t.topX=e.top_x,t}};var Gt=class{https=null;loyaltyRemapper=null;constructor(e){this.https=e,this.loyaltyRemapper=new jt}getConfig=async()=>{let e=await this.https.getConfig();return this.loyaltyRemapper.remapLoyaltyResponse(e.loyalty)}};var Kt=class{https=null;loyaltyFacade=null;constructor(e){this.https=new X(e),this.loyaltyFacade=new Gt(this.https)}getConfig=async()=>await this.loyaltyFacade.getConfig()};function Wc(o){let t=new St().validate(o);return o.idSchema||(o.idSchema="native"),{profile:new yt(o),football:new vt(o),predictor:new Ut(o),loyalty:new Kt(o)}}export{Wc as FansUnitedSDK};
1
+ var Ai=Object.create;var Wt=Object.defineProperty;var xi=Object.getOwnPropertyDescriptor;var Oi=Object.getOwnPropertyNames;var Li=Object.getPrototypeOf,Ni=Object.prototype.hasOwnProperty;var $i=o=>Wt(o,"__esModule",{value:!0});var m=(o,e)=>()=>(e||o((e={exports:{}}).exports,e),e.exports);var Di=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Oi(e))!Ni.call(o,i)&&(t||i!=="default")&&Wt(o,i,{get:()=>e[i],enumerable:!(r=xi(e,i))||r.enumerable});return o},Q=(o,e)=>Di($i(Wt(o!=null?Ai(Li(o)):{},"default",!e&&o&&o.__esModule?{get:()=>o.default,enumerable:!0}:{value:o,enumerable:!0})),o);var Xt=m(($o,wr)=>{"use strict";wr.exports=function(e,t){return function(){for(var i=new Array(arguments.length),a=0;a<i.length;a++)i[a]=arguments[a];return e.apply(t,i)}}});var w=m((Do,Ir)=>{"use strict";var Ui=Xt(),A=Object.prototype.toString;function Jt(o){return A.call(o)==="[object Array]"}function zt(o){return typeof o=="undefined"}function Vi(o){return o!==null&&!zt(o)&&o.constructor!==null&&!zt(o.constructor)&&typeof o.constructor.isBuffer=="function"&&o.constructor.isBuffer(o)}function qi(o){return A.call(o)==="[object ArrayBuffer]"}function Hi(o){return typeof FormData!="undefined"&&o instanceof FormData}function ki(o){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(o):e=o&&o.buffer&&o.buffer instanceof ArrayBuffer,e}function ji(o){return typeof o=="string"}function Gi(o){return typeof o=="number"}function br(o){return o!==null&&typeof o=="object"}function ne(o){if(A.call(o)!=="[object Object]")return!1;var e=Object.getPrototypeOf(o);return e===null||e===Object.prototype}function Ki(o){return A.call(o)==="[object Date]"}function Yi(o){return A.call(o)==="[object File]"}function Wi(o){return A.call(o)==="[object Blob]"}function Mr(o){return A.call(o)==="[object Function]"}function Xi(o){return br(o)&&Mr(o.pipe)}function Ji(o){return typeof URLSearchParams!="undefined"&&o instanceof URLSearchParams}function zi(o){return o.trim?o.trim():o.replace(/^\s+|\s+$/g,"")}function Qi(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function Qt(o,e){if(!(o===null||typeof o=="undefined"))if(typeof o!="object"&&(o=[o]),Jt(o))for(var t=0,r=o.length;t<r;t++)e.call(null,o[t],t,o);else for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&e.call(null,o[i],i,o)}function Zt(){var o={};function e(i,a){ne(o[a])&&ne(i)?o[a]=Zt(o[a],i):ne(i)?o[a]=Zt({},i):Jt(i)?o[a]=i.slice():o[a]=i}for(var t=0,r=arguments.length;t<r;t++)Qt(arguments[t],e);return o}function Zi(o,e,t){return Qt(e,function(i,a){t&&typeof i=="function"?o[a]=Ui(i,t):o[a]=i}),o}function eo(o){return o.charCodeAt(0)===65279&&(o=o.slice(1)),o}Ir.exports={isArray:Jt,isArrayBuffer:qi,isBuffer:Vi,isFormData:Hi,isArrayBufferView:ki,isString:ji,isNumber:Gi,isObject:br,isPlainObject:ne,isUndefined:zt,isDate:Ki,isFile:Yi,isBlob:Wi,isFunction:Mr,isStream:Xi,isURLSearchParams:Ji,isStandardBrowserEnv:Qi,forEach:Qt,merge:Zt,extend:Zi,trim:zi,stripBOM:eo}});var er=m((Uo,Pr)=>{"use strict";var O=w();function Rr(o){return encodeURIComponent(o).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}Pr.exports=function(e,t,r){if(!t)return e;var i;if(r)i=r(t);else if(O.isURLSearchParams(t))i=t.toString();else{var a=[];O.forEach(t,function(p,d){p===null||typeof p=="undefined"||(O.isArray(p)?d=d+"[]":p=[p],O.forEach(p,function(c){O.isDate(c)?c=c.toISOString():O.isObject(c)&&(c=JSON.stringify(c)),a.push(Rr(d)+"="+Rr(c))}))}),i=a.join("&")}if(i){var s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var Sr=m((Vo,Fr)=>{"use strict";var to=w();function le(){this.handlers=[]}le.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1};le.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};le.prototype.forEach=function(e){to.forEach(this.handlers,function(r){r!==null&&e(r)})};Fr.exports=le});var Tr=m((qo,vr)=>{"use strict";var ro=w();vr.exports=function(e,t){ro.forEach(e,function(i,a){a!==t&&a.toUpperCase()===t.toUpperCase()&&(e[t]=i,delete e[a])})}});var tr=m((Ho,Cr)=>{"use strict";Cr.exports=function(e,t,r,i,a){return e.config=t,r&&(e.code=r),e.request=i,e.response=a,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e}});var rr=m((ko,Er)=>{"use strict";var io=tr();Er.exports=function(e,t,r,i,a){var s=new Error(e);return io(s,t,r,i,a)}});var Br=m((jo,_r)=>{"use strict";var oo=rr();_r.exports=function(e,t,r){var i=r.config.validateStatus;!r.status||!i||i(r.status)?e(r):t(oo("Request failed with status code "+r.status,r.config,null,r.request,r))}});var xr=m((Go,Ar)=>{"use strict";var pe=w();Ar.exports=pe.isStandardBrowserEnv()?function(){return{write:function(t,r,i,a,s,l){var p=[];p.push(t+"="+encodeURIComponent(r)),pe.isNumber(i)&&p.push("expires="+new Date(i).toGMTString()),pe.isString(a)&&p.push("path="+a),pe.isString(s)&&p.push("domain="+s),l===!0&&p.push("secure"),document.cookie=p.join("; ")},read:function(t){var r=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return r?decodeURIComponent(r[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var Lr=m((Ko,Or)=>{"use strict";Or.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var $r=m((Yo,Nr)=>{"use strict";Nr.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}});var Ur=m((Wo,Dr)=>{"use strict";var ao=Lr(),so=$r();Dr.exports=function(e,t){return e&&!ao(t)?so(e,t):t}});var qr=m((Xo,Vr)=>{"use strict";var ir=w(),no=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];Vr.exports=function(e){var t={},r,i,a;return e&&ir.forEach(e.split(`
2
+ `),function(l){if(a=l.indexOf(":"),r=ir.trim(l.substr(0,a)).toLowerCase(),i=ir.trim(l.substr(a+1)),r){if(t[r]&&no.indexOf(r)>=0)return;r==="set-cookie"?t[r]=(t[r]?t[r]:[]).concat([i]):t[r]=t[r]?t[r]+", "+i:i}}),t}});var jr=m((Jo,kr)=>{"use strict";var Hr=w();kr.exports=Hr.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a"),r;function i(a){var s=a;return e&&(t.setAttribute("href",s),s=t.href),t.setAttribute("href",s),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return r=i(window.location.href),function(s){var l=Hr.isString(s)?i(s):s;return l.protocol===r.protocol&&l.host===r.host}}():function(){return function(){return!0}}()});var Z=m((zo,Gr)=>{"use strict";function or(o){this.message=o}or.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};or.prototype.__CANCEL__=!0;Gr.exports=or});var sr=m((Qo,Kr)=>{"use strict";var ce=w(),lo=Br(),po=xr(),co=er(),mo=Ur(),uo=qr(),ho=jr(),ar=rr(),fo=ee(),yo=Z();Kr.exports=function(e){return new Promise(function(r,i){var a=e.data,s=e.headers,l=e.responseType,p;function d(){e.cancelToken&&e.cancelToken.unsubscribe(p),e.signal&&e.signal.removeEventListener("abort",p)}ce.isFormData(a)&&delete s["Content-Type"];var n=new XMLHttpRequest;if(e.auth){var c=e.auth.username||"",g=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";s.Authorization="Basic "+btoa(c+":"+g)}var z=mo(e.baseURL,e.url);n.open(e.method.toUpperCase(),co(z,e.params,e.paramsSerializer),!0),n.timeout=e.timeout;function yr(){if(!!n){var P="getAllResponseHeaders"in n?uo(n.getAllResponseHeaders()):null,u=!l||l==="text"||l==="json"?n.responseText:n.response,B={data:u,status:n.status,statusText:n.statusText,headers:P,config:e,request:n};lo(function(Yt){r(Yt),d()},function(Yt){i(Yt),d()},B),n=null}}if("onloadend"in n?n.onloadend=yr:n.onreadystatechange=function(){!n||n.readyState!==4||n.status===0&&!(n.responseURL&&n.responseURL.indexOf("file:")===0)||setTimeout(yr)},n.onabort=function(){!n||(i(ar("Request aborted",e,"ECONNABORTED",n)),n=null)},n.onerror=function(){i(ar("Network Error",e,null,n)),n=null},n.ontimeout=function(){var u=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",B=e.transitional||fo.transitional;e.timeoutErrorMessage&&(u=e.timeoutErrorMessage),i(ar(u,e,B.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",n)),n=null},ce.isStandardBrowserEnv()){var gr=(e.withCredentials||ho(z))&&e.xsrfCookieName?po.read(e.xsrfCookieName):void 0;gr&&(s[e.xsrfHeaderName]=gr)}"setRequestHeader"in n&&ce.forEach(s,function(u,B){typeof a=="undefined"&&B.toLowerCase()==="content-type"?delete s[B]:n.setRequestHeader(B,u)}),ce.isUndefined(e.withCredentials)||(n.withCredentials=!!e.withCredentials),l&&l!=="json"&&(n.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&n.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&n.upload&&n.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(p=function(P){!n||(i(!P||P&&P.type?new yo("canceled"):P),n.abort(),n=null)},e.cancelToken&&e.cancelToken.subscribe(p),e.signal&&(e.signal.aborted?p():e.signal.addEventListener("abort",p))),a||(a=null),n.send(a)})}});var ee=m((Zo,Xr)=>{"use strict";var f=w(),Yr=Tr(),go=tr(),wo={"Content-Type":"application/x-www-form-urlencoded"};function Wr(o,e){!f.isUndefined(o)&&f.isUndefined(o["Content-Type"])&&(o["Content-Type"]=e)}function bo(){var o;return typeof XMLHttpRequest!="undefined"?o=sr():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(o=sr()),o}function Mo(o,e,t){if(f.isString(o))try{return(e||JSON.parse)(o),f.trim(o)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(o)}var me={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:bo(),transformRequest:[function(e,t){return Yr(t,"Accept"),Yr(t,"Content-Type"),f.isFormData(e)||f.isArrayBuffer(e)||f.isBuffer(e)||f.isStream(e)||f.isFile(e)||f.isBlob(e)?e:f.isArrayBufferView(e)?e.buffer:f.isURLSearchParams(e)?(Wr(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):f.isObject(e)||t&&t["Content-Type"]==="application/json"?(Wr(t,"application/json"),Mo(e)):e}],transformResponse:[function(e){var t=this.transitional||me.transitional,r=t&&t.silentJSONParsing,i=t&&t.forcedJSONParsing,a=!r&&this.responseType==="json";if(a||i&&f.isString(e)&&e.length)try{return JSON.parse(e)}catch(s){if(a)throw s.name==="SyntaxError"?go(s,this,"E_JSON_PARSE"):s}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};f.forEach(["delete","get","head"],function(e){me.headers[e]={}});f.forEach(["post","put","patch"],function(e){me.headers[e]=f.merge(wo)});Xr.exports=me});var zr=m((ea,Jr)=>{"use strict";var Io=w(),Ro=ee();Jr.exports=function(e,t,r){var i=this||Ro;return Io.forEach(r,function(s){e=s.call(i,e,t)}),e}});var nr=m((ta,Qr)=>{"use strict";Qr.exports=function(e){return!!(e&&e.__CANCEL__)}});var ti=m((ra,ei)=>{"use strict";var Zr=w(),lr=zr(),Po=nr(),Fo=ee(),So=Z();function pr(o){if(o.cancelToken&&o.cancelToken.throwIfRequested(),o.signal&&o.signal.aborted)throw new So("canceled")}ei.exports=function(e){pr(e),e.headers=e.headers||{},e.data=lr.call(e,e.data,e.headers,e.transformRequest),e.headers=Zr.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Zr.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var t=e.adapter||Fo.adapter;return t(e).then(function(i){return pr(e),i.data=lr.call(e,i.data,i.headers,e.transformResponse),i},function(i){return Po(i)||(pr(e),i&&i.response&&(i.response.data=lr.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var cr=m((ia,ri)=>{"use strict";var M=w();ri.exports=function(e,t){t=t||{};var r={};function i(n,c){return M.isPlainObject(n)&&M.isPlainObject(c)?M.merge(n,c):M.isPlainObject(c)?M.merge({},c):M.isArray(c)?c.slice():c}function a(n){if(M.isUndefined(t[n])){if(!M.isUndefined(e[n]))return i(void 0,e[n])}else return i(e[n],t[n])}function s(n){if(!M.isUndefined(t[n]))return i(void 0,t[n])}function l(n){if(M.isUndefined(t[n])){if(!M.isUndefined(e[n]))return i(void 0,e[n])}else return i(void 0,t[n])}function p(n){if(n in t)return i(e[n],t[n]);if(n in e)return i(void 0,e[n])}var d={url:s,method:s,data:s,baseURL:l,transformRequest:l,transformResponse:l,paramsSerializer:l,timeout:l,timeoutMessage:l,withCredentials:l,adapter:l,responseType:l,xsrfCookieName:l,xsrfHeaderName:l,onUploadProgress:l,onDownloadProgress:l,decompress:l,maxContentLength:l,maxBodyLength:l,transport:l,httpAgent:l,httpsAgent:l,cancelToken:l,socketPath:l,responseEncoding:l,validateStatus:p};return M.forEach(Object.keys(e).concat(Object.keys(t)),function(c){var g=d[c]||a,z=g(c);M.isUndefined(z)&&g!==p||(r[c]=z)}),r}});var mr=m((oa,ii)=>{ii.exports={version:"0.24.0"}});var si=m((aa,ai)=>{"use strict";var vo=mr().version,ur={};["object","boolean","number","function","string","symbol"].forEach(function(o,e){ur[o]=function(r){return typeof r===o||"a"+(e<1?"n ":" ")+o}});var oi={};ur.transitional=function(e,t,r){function i(a,s){return"[Axios v"+vo+"] Transitional option '"+a+"'"+s+(r?". "+r:"")}return function(a,s,l){if(e===!1)throw new Error(i(s," has been removed"+(t?" in "+t:"")));return t&&!oi[s]&&(oi[s]=!0,console.warn(i(s," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(a,s,l):!0}};function To(o,e,t){if(typeof o!="object")throw new TypeError("options must be an object");for(var r=Object.keys(o),i=r.length;i-- >0;){var a=r[i],s=e[a];if(s){var l=o[a],p=l===void 0||s(l,a,o);if(p!==!0)throw new TypeError("option "+a+" must be "+p);continue}if(t!==!0)throw Error("Unknown option "+a)}}ai.exports={assertOptions:To,validators:ur}});var ui=m((sa,mi)=>{"use strict";var ni=w(),Co=er(),li=Sr(),pi=ti(),ue=cr(),ci=si(),L=ci.validators;function te(o){this.defaults=o,this.interceptors={request:new li,response:new li}}te.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=ue(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;t!==void 0&&ci.assertOptions(t,{silentJSONParsing:L.transitional(L.boolean),forcedJSONParsing:L.transitional(L.boolean),clarifyTimeoutError:L.transitional(L.boolean)},!1);var r=[],i=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(e)===!1||(i=i&&g.synchronous,r.unshift(g.fulfilled,g.rejected))});var a=[];this.interceptors.response.forEach(function(g){a.push(g.fulfilled,g.rejected)});var s;if(!i){var l=[pi,void 0];for(Array.prototype.unshift.apply(l,r),l=l.concat(a),s=Promise.resolve(e);l.length;)s=s.then(l.shift(),l.shift());return s}for(var p=e;r.length;){var d=r.shift(),n=r.shift();try{p=d(p)}catch(c){n(c);break}}try{s=pi(p)}catch(c){return Promise.reject(c)}for(;a.length;)s=s.then(a.shift(),a.shift());return s};te.prototype.getUri=function(e){return e=ue(this.defaults,e),Co(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};ni.forEach(["delete","get","head","options"],function(e){te.prototype[e]=function(t,r){return this.request(ue(r||{},{method:e,url:t,data:(r||{}).data}))}});ni.forEach(["post","put","patch"],function(e){te.prototype[e]=function(t,r,i){return this.request(ue(i||{},{method:e,url:t,data:r}))}});mi.exports=te});var hi=m((na,di)=>{"use strict";var Eo=Z();function N(o){if(typeof o!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var t=this;this.promise.then(function(r){if(!!t._listeners){var i,a=t._listeners.length;for(i=0;i<a;i++)t._listeners[i](r);t._listeners=null}}),this.promise.then=function(r){var i,a=new Promise(function(s){t.subscribe(s),i=s}).then(r);return a.cancel=function(){t.unsubscribe(i)},a},o(function(i){t.reason||(t.reason=new Eo(i),e(t.reason))})}N.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};N.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};N.prototype.unsubscribe=function(e){if(!!this._listeners){var t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}};N.source=function(){var e,t=new N(function(i){e=i});return{token:t,cancel:e}};di.exports=N});var yi=m((la,fi)=>{"use strict";fi.exports=function(e){return function(r){return e.apply(null,r)}}});var wi=m((pa,gi)=>{"use strict";gi.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var Ii=m((ca,dr)=>{"use strict";var bi=w(),_o=Xt(),de=ui(),Bo=cr(),Ao=ee();function Mi(o){var e=new de(o),t=_o(de.prototype.request,e);return bi.extend(t,de.prototype,e),bi.extend(t,e),t.create=function(i){return Mi(Bo(o,i))},t}var F=Mi(Ao);F.Axios=de;F.Cancel=Z();F.CancelToken=hi();F.isCancel=nr();F.VERSION=mr().version;F.all=function(e){return Promise.all(e)};F.spread=yi();F.isAxiosError=wi();dr.exports=F;dr.exports.default=F});var $=m((ma,Ri)=>{Ri.exports=Ii()});var Pi=Q($());var hr=o=>{let e=[],t=0;return o.forEach(r=>{e[t]?e[t].length<249?e[t].push(r):(t=t+1,e[t]=[r]):e[t]=[r]}),e},he=o=>{let e=[],t=200;for(;o.length>t-1;){let r=o.splice(0,t-1);e.push(r)}return e.push(o),e},S=(o,e)=>{let t="";return o==="prod"||o==="sandbox"?t={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"}[e]:t={profile:"http://localhost:8010",football:"http://locahost:8080",idMapping:"http://localhost:8030",predictor:"http://localhost:8040",client:"http://localhost:8080"}[e],t};var fe=class{id=null;name=null;avatar=null;gender=null;country=null;birthDate=null;interests=[]};var ye=class{profilesFromResponse=e=>e?e.map(t=>this.fullProfileFromResponse(t)):null;fullProfileFromResponse=e=>{let t=new fe;return t.avatar=e.avatar,t.birthDate=e.birth_date,t.country=e.country,t.gender=e.gender,t.id=e.id,t.interests=e.interests,t.name=e.name,t};profileToRequest=e=>({country_id:e.country?e.country.id:null,gender:e.gender,birth_date:e.birthDate,interests:e.interests,name:e.name})};var ge=class{avatar=null;followingId=null;name=null;profileId=null};var we=class{followingFromResponse=e=>e.map(t=>this.remapResponse(t));remapResponse=e=>{let t=new ge;return t.avatar=e.avatar,t.followingId=e.following_id,t.name=e.name,t.profileId=e.profile_id,t}};var be=class{avatar=null;followerId=null;name=null;profileId=null};var Me=class{followersFromResponse=e=>e.map(t=>this.remapResponse(t));remapResponse=e=>{let t=new be;return t.avatar=e.avatar,t.followerId=e.follower_id,t.name=e.name,t.profileId=e.profile_id,t}};var re=class{profile_ids=[]};var x=class{limit=0;startAfter=null;constructor(e){this.limit=e.limit?e.limit:20,this.startAfter=e.startAfter?e.startAfter:null}constructFilterUrl=()=>{let e="";return this.limit&&(e=e+"&",e=e+`limit=${this.limit}`),this.startAfter&&(e=e+"&",e=e+`start_after=${this.startAfter}`),e}};var xo="/countries",R="/profile",Fi="/profiles",Ie=class{instance=null;apiSignInUrl="";profileRemapper=null;followingRemapper=null;followersRemapper=null;constructor(e){let t=S(e.environment,"profile");this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}&lang=${e.lang}`,this.instance=Pi.default.create({baseURL:t,headers:{Authorization:`Bearer ${e.authProvider.getIdToken()}`,"Content-Type":"application/json"}}),this.profileRemapper=new ye,this.followingRemapper=new we,this.followersRemapper=new Me}getCountries=async()=>{try{return(await this.instance.get(`${xo}${this.apiSignInUrl}`)).data.data}catch(e){throw console.warn("There was a problem fetching the countries:",e),e}};getProfile=async e=>{let t=`${R}${this.apiSignInUrl}`;e&&(t=`${Fi}/${e}${this.apiSignInUrl}`);try{let r=await this.instance.get(t);return this.profileRemapper.fullProfileFromResponse(r.data.data)}catch(r){throw console.warn(`There was a problem fetching the following profile: ${e}`,r),r}};getProfiles=async e=>{try{let t=await this.instance.get(`${Fi}${this.apiSignInUrl}&profile_ids=${e.join(",")}`);return this.profileRemapper.profilesFromResponse(t.data.data)}catch(t){throw console.warn(`There was a problem fetching the following profiles: ${e.join(",")}`,t),t}};getFollowers=async(e,t)=>{let r=`${R}/followers${this.apiSignInUrl}`;e&&!t?(e=new x(e),r=`${R}/followers${this.apiSignInUrl}${e.constructFilterUrl()}`):e&&t?(e=new x(e),r=`${R}/${t}/followers${this.apiSignInUrl}${e.constructFilterUrl()}`):!e&&t&&(r=`${R}/${t}/followers${this.apiSignInUrl}`);try{let i=await this.instance.get(r);return this.followersRemapper.followersFromResponse(i.data.data)}catch(i){throw console.warn("There was a problem fetching the followers for profile",i),i}};getFollowing=async(e,t)=>{let r=`${R}/following${this.apiSignInUrl}`;e&&!t?(e=new x(e),r=`${R}/following${this.apiSignInUrl}${e.constructFilterUrl()}`):e&&t?(e=new x(e),r=`${R}/${t}/following${this.apiSignInUrl}${e.constructFilterUrl()}`):!e&&t&&(r=`${R}/${t}/following${this.apiSignInUrl}`);try{let i=await this.instance.get(r);return this.followingRemapper.followingFromResponse(i.data.data)}catch(i){throw console.warn(`There was a problem fetching the followers of the following profile: ${t}`,i),i}};follow=async e=>{let t=new re;t.profile_ids=e;try{let r=await this.instance.post(`${R}/follow${this.apiSignInUrl}`,JSON.stringify(t));return this.followingRemapper.followingFromResponse(r.data.data)}catch(r){throw console.warn(`There was a problem with POST request for profiles: ${e.join(",")} `,r),r}};unfollow=async e=>{let t=new re;t.profile_ids=e;try{return await this.instance.delete(`${R}/follow${this.apiSignInUrl}`,{data:JSON.stringify(t)}),!0}catch(r){return console.warn(`There was a problem with DELETE request for profiles: ${e.join(",")} `,r),!1}};updateProfile=async e=>{try{let t=this.profileRemapper.profileToRequest(e),r=await this.instance.patch(`${R}${this.apiSignInUrl}`,t);return this.profileRemapper.fullProfileFromResponse(r.data.data)}catch(t){throw console.warn("There was a problem updating the own profile:",t),t}}};var v={native:"id",sportradar:"sportradar_id",sportal365:"sportal365_id",enetpulse:"enetpulse_id"};var Si="FansUnited",vi={football:{ids:[],countries:[],competitions:[]},profile:{others:[],own:{},countries:[],expireAt:0}},T=class{idSchema="";exparationTimeout=600;constructor(e){this.idSchema=e.idSchema,(this.getData()===void 0||this.getData()===null)&&this.setData(vi)}clearData=()=>{this.setData(vi)};getEntityById=(e="",t="")=>this.getData().football.ids.find(r=>{let i=v[this.idSchema];return r&&`${r[i]}`===t&&r.resource===e});getEntity=(e,t,r)=>Array.isArray(e)?this.getData().football.ids.filter(i=>{let a=v[r];return i&&e.includes(`${i[a]}`)&&i.resource===t}):this.getData().football.ids.find(i=>{let a=v[r];return i&&`${i[a]}`===e&&i.resource===t});getEntityByNativeId=(e="",t="")=>this.getData().football.ids.find(r=>r&&`${r.id}`===t&&r.resource===e);checkForExistingIdObjs=(e,t)=>{let r=v[t],i={};return Object.keys(e).forEach(a=>{let s=e[a],p=this.getEntity(s,a,t).map(n=>n[r]),d=e[a].filter(n=>!p.includes(n));i[a]=s.map(n=>d.includes(n)?{id:n,exists:!1}:{id:n,exists:!0})}),i};getIdsByType=(e,t,r)=>{let i=v[r],a=v[t],s={};return Object.keys(e).forEach(l=>{let p=e[l],d=[];this.getData().football.ids.forEach(n=>{p.forEach((c,g)=>{c===n[a]&&l===n.resource&&(d[g]=n[i])})}),s[l]=d}),s};addIdMapping=e=>{let t=this.getData();t.football.ids.push(e),this.setData(t)};addIdMappings=e=>{let t=this.getData(),r=t.football.ids;r=[...r,...e],t.football.ids=r,this.setData(t)};setOwnProfile=e=>{let t=this.getData();t.profile.own=e,t.profile.expireAt=Math.floor(Date.now()/1e3)+this.exparationTimeout,this.setData(t)};addProfiles=e=>{let t=this.getData(),r=e.map(a=>`${a.id}`),i=t.profile.others.filter(a=>!r.includes(`${a.id}`));i.push(...e),t.profile.others=i,this.setData(t)};addProfile=e=>{let t=this.getData(),r=t.profile.others.filter(i=>`${i.id}`!=`${e.id}`);r.push(e),t.profile.others=r,this.setData(t)};getOwnProfile=()=>this.getData().profile.own;getProfileCountries=()=>this.getData().profile.countries;setProfileCountries=e=>{let t=this.getData();t.profile.countries=e,this.setData(t)};getProfilesByIds=e=>this.getData().profile.others.filter(i=>e.includes(`${i.id}`));getProfileById=e=>this.getData().profile.others.find(i=>`${i.id}`==`${e}`);getFootballCountries=()=>this.getData().football.countries;setFootballCountries=e=>{let t=this.getData();t.football.countries=e,this.setData(t)};getCompetitions=e=>{let t=this.getData();return e?e.competitionSearchFilter(t.football.competitions):t.football.competitions};setCompetitions=e=>{let t=this.getData();t.football.competitions.push(...e),this.setData(t)};getExparationProfile=()=>this.getData().profile.expireAt;getData=()=>JSON.parse(localStorage.getItem(Si));setData=e=>{localStorage.setItem(Si,JSON.stringify(e))}};var Ti=Q($());var ie={player:"players",team:"teams",homeTeam:"teams",awayTeam:"teams",country:"countries",competition:"competitions",match:"matches"},Re=class{instance=null;apiSignInUrl="";constructor(e){let t=S(e.environment,"idMapping");this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}`,this.instance=Ti.default.create({baseURL:t})}getEntityById=(e,t)=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${config.idSchema}&${ie[e]}=${t}`)}catch(r){throw console.warn(`There was a problem with id mapping request for the following id:${t}`,r),r}};getEntityByIdAndSchema=(e,t,r)=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${r}&${ie[e]}=${t}`)}catch(i){throw console.warn(`There was a problem with id mapping request for the following id:${t}`,i),i}};getEntityIdsByIdsAndSchema=(e,t,r)=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${r}&${ie[e]}=${t.join(",")}`)}catch(i){throw console.warn(`There was a problem with id mapping request for the following ids:${t.join(",")}`,i),i}};getEntitiesByIds=(e,t,r)=>{t.sort((s,l)=>s.localeCompare(l));let a=hr(t).map(s=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${r}&${ie[e]}=${s.join(",")}`)}catch(l){throw console.warn(`There was a problem with id mapping request for the following ids:${s.join(",")}`,l),l}});return Promise.all(a).then(s=>{let l=[];return s.forEach(p=>{l.push(...p.data.data)}),l})};getEntitiesByIdObjs=(e,t)=>{let r=[];return Object.keys(e).forEach(i=>{let s=hr(e[i]).map(l=>{l.sort((p,d)=>p.localeCompare(d));try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${t||"native"}&${ie[i]}=${l.join(",")}`)}catch(p){throw console.warn(`There was a problem with id mapping request for the following ids:${l.join(",")}`,p),p}});r=[...r,...s]}),Promise.all(r).then(i=>{let a=[];return i.forEach(s=>{a.push(...s.data.data)}),a})}};var Pe=class{isBrowser=!1;localStorage=null;https=null;constructor(e){this.isBrowser=typeof window!="undefined",this.localStorage=new T(e),this.https=new Re(e)}getEntitiesByIds=async(e,t,r)=>{if(this.isBrowser)try{let i=this.localStorage.checkForExistingIdObjs(e,t),a=this.splitForRequestAndExisting(i),s=await this.https.getEntitiesByIdObjs(a.request,t);return this.localStorage.addIdMappings(s),this.localStorage.getIdsByType(e,t,r)}catch(i){return console.warn("There was a problem retrieving the entity ids ",i),Promise.resolve([])}else try{let i=await this.https.getEntitiesByIdObjs(e,t);return Object.keys(e).forEach(a=>{e[a]=i.filter(s=>s.resource===a).map(s=>s[v[r]])}),e}catch(i){return console.warn("There was a problem retrieving the entity ids ",i),Promise.resolve([])}};getEntityById=async(e,t,r)=>{if(this.isBrowser){let i=this.localStorage.getEntity(e,t,r);if(i)return i;{let a=await this.requestEntity(e,t,r);return this.localStorage.addIdMappings(a),a}}else return await this.requestEntity(e,t,r)};splitForRequestAndExisting=e=>{let t={},r={};return Object.keys(e).forEach(i=>{t[i]=e[i].filter(a=>!a.exists).map(a=>a.id),r[i]=e[i].filter(a=>a.exists).map(a=>a.id)}),{existing:r,request:t}};requestEntity=async(e,t,r)=>{try{return e=Array.isArray(e)?e:[e],await this.https.getEntitiesByIds(t,e,r)}catch(i){return console.warn(`There was a problem retrieving the requested entity: ${i}`),null}}};var Fe=o=>{switch(o){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 o}};var Se=class{extractedObjIds={};traverse=(e,t)=>(t=Fe(t),Array.isArray(e)?this.traverseArrExtract(e,t):e&&typeof e=="object"&&this.traverseObjExtract(e,t),this.extractedObjIds);traverseArrExtract=(e,t)=>{e&&e.length>0&&e.forEach(r=>{this.traverseObjExtract(r,t)})};traverseObjExtract=(e,t)=>{e&&Object.keys(e).length>0&&Object.keys(e).forEach(r=>{let i=e[r];r==="id"||r==="teamId"?(this.extractedObjIds.hasOwnProperty(t)||(this.extractedObjIds[t]=[]),this.extractedObjIds[t].push(i)):e[r]&&this.traverse(e[r],r)})}};var ve=class{replaceObjIdsIndex=null;remappedIdsObj={};traverse=(e,t,r)=>(t=Fe(t),this.replaceObjIdsIndex===null&&(this.initReplaceObjIdsIndex(r),this.remappedIdsObj=r),Array.isArray(e)?this.traverseArrReplace(e,t):e&&typeof e=="object"&&this.traverseObjReplace(e,t),e);initReplaceObjIdsIndex=e=>{this.replaceObjIdsIndex={},Object.keys(e).forEach(t=>{this.replaceObjIdsIndex[t]=0})};traverseArrReplace=(e,t)=>{e&&e.length>0&&e.forEach(r=>{this.traverseObjReplace(r,t)})};traverseObjReplace=(e,t)=>{e&&Object.keys(e).length>0&&Object.keys(e).forEach(r=>{r==="id"||r==="teamId"?(e[r]=this.remappedIdsObj[t][this.replaceObjIdsIndex[t]],this.replaceObjIdsIndex[t]=this.replaceObjIdsIndex[t]+1):e[r]&&this.traverse(e[r],r,this.remappedIdsObj)})}};var C=class{idSchema="";idMappingFacade=null;constructor(e){this.idSchema=e.idSchema,this.idMappingFacade=new Pe(e)}getEntityIdBySchemaId=(e,t)=>this.idMappingFacade.getEntityById(e,t,this.idSchema);remapEntities=async(e,t)=>{let r=JSON.parse(JSON.stringify(e));try{if(this.idSchema!=="native"){let a=new Se().traverse(r,t);return this.idMappingFacade.getEntitiesByIds(a,"native",this.idSchema).then(s=>new ve().traverse(r,t,s))}else return e}catch(i){return console.warn(`There was a problem remapping entity: ${t} with inner entity `,i),[]}};getEntityIdsBySchemaId=async(e,t,r)=>{let i={};return i[t]=e,this.idSchema!=="native"?await this.idMappingFacade.getEntitiesByIds(i,this.idSchema,r):i}};var I=class{completed=!1;percentage;constructor(e){this.percentage=e}};var Te=class{teamFollowed=new I(10);teamFavourite=new I(15);playerFollowed=new I(10);playerFavourite=new I(10);competitionFollowed=new I(10);competitionFavourite=new I(5);addedBirthdate=new I(10);addedGender=new I(10);addedCountry=new I(10);addedAvatar=new I(10)};var Ce=class{totalPercentage;breakdown=new Te};var E=class{isBrowser=!1;localStorage={};https=null;constructor(e,t){this.isBrowser=typeof window!="undefined",this.localStorage=e,this.https=t}getOwn=async()=>{if(this.isBrowser){let e=Math.floor(Date.now()/1e3),t=this.localStorage.getExparationProfile(),r=null;if(t>e&&(r=this.localStorage.getOwnProfile()),r)return r;try{let i=await this.https.getProfile();return this.localStorage.setOwnProfile(i),i}catch(i){throw console.warn("There was a problem retrieving your profile: ",i),i}}else try{return await this.https.getProfile()}catch(e){throw console.warn("There was a problem retrieving your profile: ",e),e}};getByIds=async e=>{if(this.isBrowser){let t=this.localStorage.getProfilesByIds(e);if(t&&t.length===e.length)return t.filter(r=>delete r.interests),t;try{let r=await this.https.getProfiles(e);return this.localStorage.addProfiles(r),r.filter(i=>delete i.interests),r}catch(r){throw console.warn(`There was a problem retrieving the selected profiles: ${e.join(",")} `,r),r}}else try{let t=await this.https.getProfiles(e);return t.filter(r=>delete r.interests),t}catch(t){throw console.warn(`There was a problem retrieving the selected profiles: ${e.join(",")} `,t),t}};getById=async e=>{if(this.isBrowser){let t=this.localStorage.getProfileById(e);if(t)return t;try{let r=await this.https.getProfile(e);return this.localStorage.addProfile(r),r}catch(r){throw console.warn(`There was a problem retrieving the selected profile: ${e} `,r),r}}else try{return await this.https.getProfile(e)}catch(t){throw console.warn(`There was a problem retrieving the selected profile: ${e} `,t),t}};getCountries=async()=>{if(this.isBrowser){let e=this.localStorage.getProfileCountries();if(e&&e.length>0)return e;try{let t=await this.https.getCountries();return this.localStorage.setProfileCountries(t),t}catch(t){throw console.warn("There was a problem retrieving profile countries: ",t),t}}else try{return await this.https.getCountries()}catch(e){throw console.warn("There was a problem retrieving profile countries: ",e),e}};getFollowers=async(e,t)=>{try{return await this.https.getFollowers(e,t)}catch(r){throw console.warn("There was a problem retrieving your followers: ",r),r}};getFollowing=async(e,t)=>{try{return await this.https.getFollowing(e,t)}catch(r){throw console.warn("There was a problem retrieving your following profiles: ",r),r}};follow=async e=>{try{return await this.https.follow(e)}catch(t){throw console.warn(`There was a problem following profiles: ${e.join(",")} `,t),t}};unfollow=async e=>{try{return await this.https.unfollow(e)}catch(t){throw console.warn(`There was a problem unfollowing profiles: ${e.join(",")} `,t),t}};showFullnessProfile=e=>{let t=new Ce,r=0;return e.avatar&&(t.breakdown.addedAvatar.completed=!0,r+=t.breakdown.addedAvatar.percentage),e.birthDate&&(t.breakdown.addedBirthdate.completed=!0,r+=t.breakdown.addedBirthdate.percentage),e.country&&(t.breakdown.addedCountry.completed=!0,r+=t.breakdown.addedCountry.percentage),e.gender&&(t.breakdown.addedGender.completed=!0,r+=t.breakdown.addedGender.percentage),e.interests&&e.interests.length>0&&(e.interests.find(n=>n.type==="team"&&n.favourite)&&(t.breakdown.teamFavourite.completed=!0,r+=t.breakdown.teamFavourite.percentage),e.interests.find(n=>n.type==="team")&&(t.breakdown.teamFollowed.completed=!0,r+=t.breakdown.teamFollowed.percentage),e.interests.find(n=>n.type==="player"&&n.favourite)&&(t.breakdown.playerFavourite.completed=!0,r+=t.breakdown.playerFavourite.percentage),e.interests.find(n=>n.type==="player")&&(t.breakdown.playerFollowed.completed=!0,r+=t.breakdown.playerFollowed.percentage),e.interests.find(n=>n.type==="competition"&&n.favourite)&&(t.breakdown.competitionFavourite.completed=!0,r+=t.breakdown.competitionFavourite.percentage),e.interests.find(n=>n.type==="competition")&&(t.breakdown.competitionFollowed.completed=!0,r+=t.breakdown.competitionFollowed.percentage)),t.totalPercentage=r,t}};var Ee=class{id=null;name=null;assets=null};var _e=class{isBrowser=!1;localStorage={};https=null;idMapping=null;constructor(e,t,r){this.isBrowser=typeof window!="undefined",this.localStorage=e,this.idMapping=r,this.https=t}getCountriesWithIdMapping=async()=>{try{let e=await this.getCountries();return this.idMapping.remapEntities(e,"country")}catch(e){throw console.warn("There was a problem browsing countries as football entities",e),e}};getCountries=async()=>{if(this.isBrowser){let e=this.localStorage.getFootballCountries();if(e&&e.length>0)return e;try{let t=await this.https.getCountries();return this.localStorage.setFootballCountries(t),t}catch(t){throw console.warn("There was a problem retrieving countries as football entities",t),t}}else return this.https.getCountries()}};var Be=class{countryId=null;name=null;gender=null;type=null;sortField=null;sortOrder=null;competitionIds=null;constructor(e){this.countryId=e.countryId?`${e.countryId}`:null,this.name=e.name?e.name:null,this.gender=e.gender?e.gender:null,this.type=e.type?e.type:null,this.sortField=e.sortField?`${e.sortField}`:null,this.sortOrder=e.sortOrder?`${e.sortOrder}`:null,this.competitionIds=e.competitionIds?e.competitionIds:null}constructFilterUrl=()=>{let e="";return this.countryId&&(e=e+"&",e=e+`country_id=${this.countryId}`),this.gender&&(e=e+"&",e=e+`gender=${this.gender}`),this.type&&(e=e+"&",e=e+`type=${this.type}`),this.sortField&&(e=e+"&",e=e+`sort_field=${this.sortField}`),this.sortOrder&&(e=e+"&",e=e+`sort_order=${this.sortOrder}`),this.name&&(e=e+"&",e=e+`name=${this.name}`),this.competitionIds&&(e=e+"&",e=e+`competition_ids=${this.competitionIds.join(",")}`),e};competitionSearchFilter=e=>{try{let t=this.filter(e);return this.sortField||this.sortOrder?this.sort(t):t}catch(t){return console.warn("There was a problem filtering the local competitions",t),[]}};filter=e=>{let t=this.entitiesToSearchWith();return e.filter(r=>{let i=!0;return t.forEach(a=>{a!=="sortOrder"&&a!=="sortField"&&(a==="countryId"?i&&=r.country.id===this[a]:a==="name"?i&&=r.name.toLocaleLowerCase().includes(this[a].toLocaleLowerCase()):a==="competitionIds"?i&&=this[a].some(s=>r.id===s):i&&=r[a].toLocaleLowerCase()===this[a].toLocaleLowerCase())}),i})};entitiesToSearchWith=()=>{let e=[];return this.countryId&&e.push("countryId"),this.name&&e.push("name"),this.gender&&e.push("gender"),this.type&&e.push("type"),this.sortField&&e.push("sortField"),this.sortOrder&&e.push("sortOrder"),this.competitionIds&&e.push("competitionIds"),e};sort=e=>{let t=[];return this.sortField==="name"?t=e.sort((r,i)=>this.sortOrder&&this.sortOrder==="desc"?i.name.localeCompare(r.name):r.name.localeCompare(i.name)):this.sortField==="countryId"?t=e.sort((r,i)=>this.sortOrder&&this.sortOrder==="desc"?i.country.id.localeCompare(r.country.id):r.country.id.localeCompare(i.country.id)):this.sortField==="scope"?e.forEach(r=>t[this.competitionIds.indexOf(r.id)]=r):!this.sortField&&this.sortOrder==="desc"&&(t=e.sort((r,i)=>i.id.localeCompare(r.id))),t}};var Ae=class{isBrowser=!1;localStorage={};https=null;idMapping=null;constructor(e,t,r){this.isBrowser=typeof window!="undefined",this.localStorage=e,this.idMapping=r,this.https=t}getCompetitionsIdMapping=async e=>{try{let t=!1;if(e){if(e=new Be(e),e.countryId){let i=await this.idMapping.getEntityIdsBySchemaId([`${e.countryId}`],"country","native");i.country.length===0&&(t=!0),e.countryId=i.country[0]}if(e.competitionIds){let i=await this.idMapping.getEntityIdsBySchemaId(e.competitionIds,"competition","native");i.competition.length===0&&(t=!0),e.competitionIds=i.competition}if(t)return[]}let r=await this.getCompetitions(e);return await this.idMapping.remapEntities(r,"competition")}catch(t){throw console.warn("There was a problem browsing all of the competitions",t),t}};getCompetitions=async e=>{if(this.isBrowser){let t=this.localStorage.getCompetitions(e);if(t&&t.length>0)return t;try{let r=await this.https.getCompetitions(e);return this.localStorage.setCompetitions(r),this.localStorage.getCompetitions(e)}catch(r){throw console.warn("There was a problem retrieving all competitions",r),r}}else return this.https.getCompetitions(e)};getCompetitionByIdIdMapping=async e=>{try{let r=(await this.idMapping.getEntityIdsBySchemaId([e],"competition","native")).competition[0],i=await this.getCompetitionById(r);return await this.idMapping.remapEntities(i,"competition")}catch(t){throw console.warn(`There was a problem browsing the following competition:${e}`,t),t}};getCompetitionById=async e=>{try{return await this.https.getCompetitionById(e)}catch(t){throw console.warn(`There was a problem retrieving the competition with the following id: ${e}`,t),t}};getTopCompetitionsIdMapping=async()=>{try{let e=await this.getTopCompetitions();return await this.idMapping.remapEntities(e,"competition")}catch(e){throw console.warn("There was a problem browsing the top competitions",e),e}};getTopCompetitions=async()=>{try{return await this.https.getTopCompetitions()}catch(e){throw console.warn("There was a problem retrieving the top competitions",e),e}}};var xe=class{name=null;countryId=null;national=!1;gender=null;limit=null;page=null;scope=null;sortField=null;sortOrder=null;teamIds=null;constructor(e){this.name=e.name?e.name:null,this.countryId=e.countryId?`${e.countryId}`:null,this.national=e.national?e.national:!1,this.gender=e.gender?e.gender:null,this.limit=e.limit?e.limit:null,this.page=e.page?e.page:null,this.scope=e.scope?e.scope:null,this.sortField=e.sortField?`${e.sortField}`:null,this.sortOrder=e.sortOrder?`${e.sortOrder}`:null,this.teamIds=e.teamIds?e.teamIds:null}constructFilterUrl=()=>{let e="";return this.name&&(e=e+"&",e=e+`name=${this.name}`),this.countryId&&(e=e+"&",e=e+`country_id=${this.countryId}`),this.national&&(e=e+"&",e=e+`national=${this.national}`),this.gender&&(e=e+"&",e=e+`gender=${this.gender}`),this.limit&&(e=e+"&",e=e+`limit=${this.limit}`),this.scope&&(e=e+"&",e=e+`scope=${this.scope.join(",")}`),this.page&&(e=e+"&",e=e+`page=${this.page}`),this.sortField&&(e=e+"&",e=e+`sort_field=${this.sortField}`),this.sortOrder&&(e=e+"&",e=e+`sort_order=${this.sortOrder}`),this.teamIds&&(e=e+"&",e=e+`team_ids=${this.teamIds.join(",")}`),e}};var Oe=class{https=null;idMapping=null;constructor(e,t){this.idMapping=t,this.https=e}getTeamsIdMapping=async e=>{try{let t=!1;if(e){if(e=new xe(e),e.countryId){let i=await this.idMapping.getEntityIdsBySchemaId([`${e.countryId}`],"country","native");i.country.length===0&&(t=!0),e.countryId=i.country[0]}if(e.scope){let i=await this.idMapping.getEntityIdsBySchemaId(e.scope,"competition","native");i.competition.length===0&&(t=!0),e.scope=i.competition}if(e.teamIds){let i=await this.idMapping.getEntityIdsBySchemaId(e.teamIds,"team","native");i.team.length===0&&(t=!0),e.teamIds=i.team}}if(t)return[];let r=await this.getTeams(e);return await this.idMapping.remapEntities(r,"team")}catch(t){throw console.warn("There was a problem browsing all teams",t),t}};getTeams=async e=>{try{return await this.https.getTeams(e)}catch(t){throw console.warn("There was a problem retrieving all teams",t),t}};getTeamByIdIdMapping=async e=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"team","native")).team[0];let r=await this.getTeamById(e);return await this.idMapping.remapEntities(r,"team")}catch(t){throw console.warn(`There was a problem browsing the following team:${e}`,t),t}};getTeamById=async e=>{try{return await this.https.getTeamById(e)}catch(t){throw console.warn(`There was a problem retrieving the following team: ${e}`,t),t}};getTopTeamsIdMapping=async()=>{try{let e=await this.getTopTeams();return await this.idMapping.remapEntities(e,"team")}catch(e){throw console.warn("There was a problem browsing the top teams",e),e}};getTopTeams=async()=>{try{return await this.https.getTopTeams()}catch(e){throw console.warn("There was a problem retrieving the top teams",e),e}};getNextMatchForTeamIdMapping=async e=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"team","native")).team[0];let r=await this.getNextMatchForTeam(e);return await this.idMapping.remapEntities(r,"match")}catch(t){throw console.warn(`There was a problem browsing the next match for the following team:${e}`,t),t}};getNextMatchForTeam=async e=>{try{return await this.https.getNextMatchForTeam(e)}catch(t){throw console.warn(`There was a problem retrieving the next match for the following team: ${e}`,t),t}};getPrevMatchForTeamIdMapping=async e=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"team","native")).team[0];let r=await this.getPrevMatchForTeam(e);return await this.idMapping.remapEntities(r,"match")}catch(t){throw console.warn(`There was a problem browsing the previous match for the following team:${e}`,t),t}};getPrevMatchForTeam=async e=>{try{return await this.https.getPrevMatchForTeam(e)}catch(t){throw console.warn(`There was a problem retrieving the previous match for the following team: ${e}`,t),t}}};var Le=class{countryId=null;scope=null;name=null;playerIds=null;limit=null;page=null;sortField=null;sortOrder=null;constructor(e){this.countryId=e.countryId?e.countryId:null,this.scope=e.scope?e.scope:null,this.name=e.name?e.name:null,this.playerIds=e.playerIds?e.playerIds:null,this.limit=e.limit?e.limit:null,this.page=e.page?e.page:null,this.sortField=e.sortField?e.sortField:null,this.sortOrder=e.sortOrder?e.sortOrder:null}constructFilterUrl=()=>{let e="";return this.countryId&&(e=e+"&",e=e+`country_id=${this.countryId}`),this.scope&&(e=e+"&",e=e+`scope=${this.scope.join(",")}`),this.name&&(e=e+"&",e=e+`name=${this.name}`),this.playerIds&&(e=e+"&",e=e+`player_ids=${this.playerIds.join(",")}`),this.limit&&(e=e+"&",e=e+`limit=${this.limit}`),this.page&&(e=e+"&",e=e+`page=${this.page}`),this.sortField&&(e=e+"&",e=e+`sort_field=${this.sortField}`),this.sortOrder&&(e=e+"&",e=e+`sort_order=${this.sortOrder}`),e}};var Ne=class{https=null;idMapping=null;constructor(e,t){this.idMapping=t,this.https=e}getPlayersIdMapping=async e=>{try{let t=!1;if(e){if(e=new Le(e),e.countryId){let i=await this.idMapping.getEntityIdsBySchemaId([e.countryId],"country","native");i.country.length===0&&(t=!0),e.countryId=i.country[0]}if(e.playerIds){let i=await this.idMapping.getEntityIdsBySchemaId(e.playerIds,"player","native");i.player.length===0&&(t=!0),e.playerIds=i.player}if(e.scope){let i=await this.idMapping.getEntityIdsBySchemaId(e.scope,"competition","native");i.competition.length===0&&(t=!0),e.scope=i.competition}if(t)return[]}let r=await this.getPlayers(e);return await this.idMapping.remapEntities(r,"player")}catch(t){throw console.warn("There was a problem browsing the players",t),t}};getPlayers=async e=>{try{return await this.https.getPlayers(e)}catch(t){throw console.warn("There was a problem retrieving the players",t),t}};getPlayerIdMapping=async e=>{try{let t=await this.idMapping.getEntityIdsBySchemaId([e],"player","native"),r=await this.getPlayerById(t.player[0]);return await this.idMapping.remapEntities(r,"player")}catch(t){throw console.warn(`There was a problem browsing the following player:${e}`,t),t}};getPlayerById=async e=>{try{return await this.https.getPlayerById(e)}catch(t){throw console.warn(`There was a problem retrieving the following player: ${e}`,t),t}};getTopPlayersIdMapping=async()=>{try{let e=await this.getTopPlayers();return await this.idMapping.remapEntities(e,"player")}catch(e){throw console.warn("There was a problem browsing the top players",e),e}};getTopPlayers=async()=>{try{return await this.https.getTopPlayers()}catch(e){throw console.warn("There was a problem retrieving the top players",e),e}};getNextMatchForPlayerIdMapping=async e=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"player","native")).player[0];let r=await this.getNextMatchForPlayer(e);return await this.idMapping.remapEntities(r,"match")}catch(t){throw console.warn(`There was a problem browsing the next match for player:${e}`,t),t}};getNextMatchForPlayer=async e=>{try{return await this.https.getNextMatchForPlayer(e)}catch(t){throw console.warn(`There was a problem retrieving the next match for player: ${e}`,t),t}};getPrevMatchForPlayerIdMapping=async e=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"player","native")).player[0];let r=await this.getPrevMatchForPlayer(e);return await this.idMapping.remapEntities(r,"match")}catch(t){throw console.warn(`There was a problem browsing the previous match for player:${e}`,t),t}};getPrevMatchForPlayer=async e=>{try{return await this.https.getPrevMatchForPlayer(e)}catch(t){throw console.warn(`There was a problem retrieving the previous match for player: ${e}`,t),t}}};var $e=class{countryIds=null;competitionIds=null;matchIds=null;status=null;teamIds=null;fromDate=null;toDate=null;limit=null;page=null;sortField=null;sortOrder=null;constructor(e){this.countryIds=e.countryIds?e.countryIds:null,this.competitionIds=e.competitionIds?e.competitionIds:null,this.matchIds=e.matchIds?e.matchIds:null,this.status=e.status?e.status:null,this.teamIds=e.teamIds?e.teamIds:null,this.fromDate=e.fromDate?e.fromDate:null,this.toDate=e.toDate?e.toDate:null,this.limit=e.limit?e.limit:null,this.page=e.page?e.page:null,this.sortField=e.sortField?e.sortField:null,this.sortOrder=e.sortOrder?e.sortOrder:null}constructFilterUrl=()=>{let e="";return this.countryIds&&(e=e+"&",e=e+`countries=${this.countryIds.join(",")}`),this.competitionIds&&(e=e+"&",e=e+`competitions=${this.competitionIds.join(",")}`),this.matchIds&&(e=e+"&",e=e+`matches=${this.matchIds.join(",")}`),this.status&&(e=e+"&",e=e+`status=${this.status}`),this.teamIds&&(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&&(e=e+"&",e=e+`limit=${this.limit}`),this.page&&(e=e+"&",e=e+`page=${this.page}`),this.sortField&&(e=e+"&",e=e+`sort_field=${this.sortField}`),this.sortOrder&&(e=e+"&",e=e+`sort_order=${this.sortOrder}`),e}};var De=class{https=null;idMapping=null;constructor(e,t){this.https=e,this.idMapping=t}getMatchesIdMapping=async e=>{try{if(e){if(e=new $e(e),e.countryIds){let r=await this.idMapping.getEntityIdsBySchemaId(e.countryIds,"country","native");e.countryIds=r.country}if(e.competitionIds){let r=await this.idMapping.getEntityIdsBySchemaId(e.competitionIds,"competition","native");e.competitionIds=r.competition}if(e.matchIds){let r=await this.idMapping.getEntityIdsBySchemaId(e.matchIds,"match","native");e.matchIds=r.match}if(e.teamIds){let r=await this.idMapping.getEntityIdsBySchemaId(e.teamIds,"team","native");e.teamIds=r.team}}let t=await this.getMatches(e);return await this.idMapping.remapEntities(t,"match")}catch(t){throw console.warn("There was a problem browsing the matches",t),t}};getMatches=async e=>{try{return await this.https.getMatches(e)}catch(t){throw console.warn("There was a problem retrieving the matches",t),t}};getMatchIdMapping=async e=>{try{let t=await this.idMapping.getEntityIdsBySchemaId([e],"match","native"),r=await this.getMatchById(t.match[0]);return await this.idMapping.remapEntities(r,"match")}catch(t){throw console.warn(`There was a problem browsing the following match: ${e}`,t),t}};getMatchById=async e=>{try{return await this.https.getMatchById(e)}catch(t){throw console.warn(`There was a problem retrieving the following match: ${e}`,t),t}}};var Ue=class{entities=null;query=null;scope=null;constructor(e){this.entities=e.entities?e.entities:null,this.query=e.query?e.query:null,this.scope=e.scope?e.scope:null}constructFilterUrl=()=>{let e="";return this.entities&&(e=e+"&",e=e+`entities=${this.entities.join(",")}`),this.query&&(e=e+"&",e=e+`q=${this.query}`),this.scope&&(e=e+"&",e=e+`scope=${this.scope.join(",")}`),e}};var Ve=class{https=null;idMapping=null;constructor(e,t){this.https=e,this.idMapping=t}searchIdMapping=async e=>{try{if(e=new Ue(e),e.scope){let r=await this.idMapping.getEntityIdsBySchemaId(e.scope,"competition","native");e.scope=r.competition}let t=await this.search(e);if(t.teams&&t.teams.length>0){let r=await this.idMapping.remapEntities(t.teams,"team");t.teams=r}if(t.players&&t.players.length>0){let r=await this.idMapping.remapEntities(t.players,"player");t.players=r}if(t.competitions&&t.competitions.length>0){let r=await this.idMapping.remapEntities(t.competitions,"competition");t.competitions=r}return t}catch(t){throw console.warn("There was a problem with browsing the search result",t),t}};search=async e=>{try{return await this.https.search(e)}catch(t){throw console.warn("There was a problem retrieving the search response",t),t}}};var _=class{isBrowser=!1;localStorage={};https=null;idMapping=null;countriesFacade=null;competitionsFacade=null;teamsFacade=null;playerFacade=null;matchFacade=null;searchFacade=null;constructor(e,t,r){this.isBrowser=typeof window!="undefined",this.localStorage=e,this.idMapping=r,this.https=t,this.countriesFacade=new _e(e,t,r),this.competitionsFacade=new Ae(e,t,r),this.teamsFacade=new Oe(t,r),this.playerFacade=new Ne(t,r),this.matchFacade=new De(t,r),this.searchFacade=new Ve(t,r)}getCountries=async()=>this.countriesFacade.getCountriesWithIdMapping();getCompetitions=async e=>this.competitionsFacade.getCompetitionsIdMapping(e);getCompetitionById=async e=>this.competitionsFacade.getCompetitionByIdIdMapping(e);getTopCompetitions=async()=>this.competitionsFacade.getTopCompetitionsIdMapping();getTeams=async e=>this.teamsFacade.getTeamsIdMapping(e);getTeamById=async e=>this.teamsFacade.getTeamByIdIdMapping(e);getTopTeams=async()=>this.teamsFacade.getTopTeamsIdMapping();getNextMatchForTeam=async e=>this.teamsFacade.getNextMatchForTeamIdMapping(e);getPrevMatchForTeam=async e=>this.teamsFacade.getPrevMatchForTeamIdMapping(e);getPlayers=async e=>this.playerFacade.getPlayersIdMapping(e);getPlayerById=async e=>this.playerFacade.getPlayerIdMapping(e);getTopPlayers=async()=>this.playerFacade.getTopPlayersIdMapping();getNextMatchForPlayer=async e=>this.playerFacade.getNextMatchForPlayerIdMapping(e);getPrevMatchForPlayer=async e=>this.playerFacade.getPrevMatchForPlayerIdMapping(e);getMatches=async e=>this.matchFacade.getMatchesIdMapping(e);getMatchById=async e=>this.matchFacade.getMatchIdMapping(e);search=async e=>this.searchFacade.searchIdMapping(e)};var D=class{idMapping=null;footballFacade=null;constructor(e,t){this.idMapping=e,this.footballFacade=t}remapInterestsToIdSchema=async e=>{let t=this.idMapping.idSchema;if(t!=="native")if(e.length>0){let r={},i={};e.forEach(l=>{r.hasOwnProperty(l.type)||(r[l.type]=[],i[l.type]=[]),r[l.type].push(l.id),i[l.type].push(l)});let a=await this.idMapping.idMappingFacade.getEntitiesByIds(r,"native",t),s=[];for(let[l,p]of Object.entries(i))p.forEach((d,n)=>{d.id=a[l][n],s.push(d)});return s}else return e;else return e};remapInterestToNative=async e=>{let t=this.idMapping.idSchema;if(t!=="native"){let r={},{id:i,type:a}=e;r[a]=[i];let s=await this.idMapping.idMappingFacade.getEntitiesByIds(r,t,"native");return e.id=s[a][0],e}return e};inquiryCustomInterests=async e=>{let t=e.filter(r=>r.source==="custom");if(t&&t.length>0){let r=e.filter(a=>a.source!=="custom"),i=await this.remapInterestsToIdSchema(r);return t.forEach(a=>i.push(a)),i}return await this.remapInterestsToIdSchema(e)};showFullInterests=async e=>{let t=[];for(let r of e)if(r.source!=="custom"&&r.source==="football"){let i={};if(r.type==="team"){i.teamIds=[r.id];let a=await this.footballFacade.getTeams(i);r.model=a[0]}if(r.type==="player"){i.playerIds=[r.id];let a=await this.footballFacade.getPlayers(i);r.model=a[0]}if(r.type==="competition"){i.competitionIds=[r.id];let a=await this.footballFacade.getCompetitions(i);r.model=a[0]}r.model===void 0&&(r.model=null),t.push(r)}else t.push(r);return t}};var qe=class{profileHttps=null;footballHttps=null;localStorage=null;idMapping=null;profileFacade=null;footballFacade=null;interestsService=null;ownProfile=null;modified=!1;expireAt=0;promises=[];isFetching=!1;constructor(e,t,r,i){this.localStorage=e,this.profileHttps=t,this.footballHttps=i,this.idMapping=r,this.footballFacade=new _(e,i,r),this.interestsService=new D(r,this.footballFacade),this.profileFacade=new E(e,t)}getOwnProfile=async()=>{for(;this.isFetching;)console.log("Another thread is fetching profile..."),await this.delay(100);if(this.modified&&this.ownProfile)return console.log("Timestamp is less than 10 minutes OR profile is modifying "),this.ownProfile;let e=Math.floor(Date.now()/1e3);if(!this.ownProfile||this.expireAt<e){this.isFetching=!0,this.expireAt=Math.floor(Date.now()/1e3)+600;let t=await this.profileFacade.getOwn();return this.setOwnProfile(t),this.modified=!1,this.isFetching=!1,this.ownProfile}return this.ownProfile};delay=e=>new Promise(t=>{setTimeout(t,e)});setOwnProfile=e=>{this.ownProfile=e};getInfo=async()=>{let e=await this.getOwnProfile();return delete e.interests,e};showInterests=async()=>{let e=await this.getOwnProfile(),t=[];return t=e.interests,await this.interestsService.inquiryCustomInterests(t)};showFullInterests=async()=>{let e=await this.showInterests();return await this.interestsService.showFullInterests(e)};getFollowers=async e=>await this.profileFacade.getFollowers(e);getFollowing=async e=>await this.profileFacade.getFollowing(e);follow=async e=>await this.profileFacade.follow(e);unfollow=async e=>await this.profileFacade.unfollow(e);addInterestPromise=async e=>{this.modified=!0,await this.getOwnProfile();let t=null;e.source!=="custom"?t=await this.interestsService.remapInterestToNative(e):t=e;let r=this.ownProfile.interests.filter(i=>i.id!==t.id||i.type!==t.type||i.source!==t.source);return this.ownProfile.interests=[...r],this.ownProfile.interests.push(t),this};addInterest=e=>(this.promises.push(this.addInterestPromise(e)),this);removeInterestPromise=async e=>{this.modified=!0,await this.getOwnProfile();let t=null;return e.source!=="custom"?t=await this.interestsService.remapInterestToNative(e):t=e,this.ownProfile.interests=this.ownProfile.interests.filter(r=>r.id!==t.id||r.type!==t.type||r.source!==t.source),this};removeInterest=e=>(this.promises.push(this.removeInterestPromise(e)),this);setBirthdatePromise=async e=>(this.modified=!0,await this.getOwnProfile(),e?this.ownProfile.birthDate=e:this.ownProfile.birthDate=null,this);setBirthdate=e=>(this.promises.push(this.setBirthdatePromise(e)),this);setGenderPromise=async e=>(this.modified=!0,await this.getOwnProfile(),e==="male"||e==="female"?this.ownProfile.gender=e:this.ownProfile.gender="unspecified",this);setGender=e=>(this.promises.push(this.setGenderPromise(e)),this);setCountryPromise=async e=>(this.modified=!0,await this.getOwnProfile(),e&&!this.ownProfile.country?(this.ownProfile.country=new Ee,this.ownProfile.country.id=e):e&&this.ownProfile.country?this.ownProfile.country.id=e:this.ownProfile.country=null,this);setCountry=e=>(this.promises.push(this.setCountryPromise(e)),this);showFullnessProfile=async()=>{let e=await this.getOwnProfile();return this.profileFacade.showFullnessProfile(e)};update=async()=>{if(this.promises.length===0)return this.ownProfile;await Promise.all(this.promises);let e=await this.getOwnProfile(),t=await this.profileHttps.updateProfile(e);return this.modified=!1,this.expireAt=0,this.localStorage.setOwnProfile(t),delete t.interests,t}};var He=class{profileHttps=null;footballFacade=null;localStorage=null;idMapping=null;profileFacade=null;interestsService=null;profileId="";constructor(e,t,r,i){this.localStorage=e,this.profileHttps=t,this.footballFacade=i,this.idMapping=r,this.interestsService=new D(r,i),this.profileFacade=new E(e,t)}setId=e=>(this.profileId=e,this);getProfile=async()=>await this.profileFacade.getById(this.profileId);getInfo=async()=>{let e=await this.getProfile();return delete e.interests,e};showInterests=async()=>{let e=await this.getProfile(),t=[];return t=e.interests,await this.interestsService.inquiryCustomInterests(t)};showFullInterests=async()=>{let e=await this.showInterests();return await this.interestsService.showFullInterests(e)};getFollowers=async e=>await this.profileFacade.getFollowers(e,this.profileId);getFollowing=async e=>await this.profileFacade.getFollowing(e,this.profileId);showFullnessProfile=async()=>{let e=await this.getProfile();return this.profileFacade.showFullnessProfile(e)}};var Ci=Q($());var ke=class{id="";alias="";countryCode="";assets=null;name=""};var h=class{countriesFromResponse=e=>{if(e)return e.map(t=>this.countryFromResponse(t))};countryFromResponse=e=>{try{if(e){let t=new ke;return t.id=e.id,t.alias=e.alias,t.assets=e.assets,t.countryCode=e.country_code,t.name=e.name,t}}catch(t){throw t}return null}};var je=class{id="";country=null;gender="";assets=null;type="";name=""};var b=class{countryRemapper=null;constructor(){this.countryRemapper=new h}fromResponse(e){try{let t=new je;return t.id=e.id,t.country=this.countryRemapper.countryFromResponse(e.country),t.gender=e.gender,t.assets=e.assets,t.type=e.type,t.name=e.name,t}catch(t){throw console.warn("There was a problem remapping the competition response",t),t}}};var Ge=class{id="";country=null;gender="";assets=null;type="";name="";participants=[]};var Ke=class{id="";country=null;gender="";assets=null;name="";code="";national=!1;fullName="";shortName=""};var y=class{countryRemapper=null;constructor(){this.countryRemapper=new h}fromResponse(e){try{let t=new Ke;return t.id=e.id,t.country=this.countryRemapper.countryFromResponse(e.country),t.gender=e.gender,t.assets=e.assets,t.code=e.code,t.national=e.national,t.fullName=e.full_name,t.shortName=e.short_name,t.name=e.name,t}catch(t){throw console.warn("There was a problem remapping teams response",t),t}}};var Ye=class{countryRemapper=null;teamBasicRemapper=null;constructor(){this.countryRemapper=new h,this.teamBasicRemapper=new y}fromResponse(e){try{let t=new Ge;return t.id=e.id,t.country=this.countryRemapper.countryFromResponse(e.country),t.gender=e.gender,t.assets=e.assets,t.type=e.type,t.name=e.name,t.participants=e.participants.map(r=>this.teamBasicRemapper.fromResponse(r)),t}catch(t){throw console.warn("There was a problem remapping the competition response",t),t}}};var We=class{id="";country=null;gender="";assets=null;name="";competitions=[];code="";national=!1;fullName="";shortName="";squad=[]};var Xe=class{id="";startDate="";endDate="";shirtNumber;loan=!1;position="";country=null;name="";assets=null;birthDate=""};var Je=class{countryRemapper=null;constructor(){this.countryRemapper=new h}fromResponse(e){try{let t=new Xe;return t.id=e.id,t.startDate=e.start_date,t.endDate=e.end_date,t.shirtNumber=e.shirt_number,t.loan=e.loan,t.position=e.position,t.country=this.countryRemapper.countryFromResponse(e.country),t.name=e.name,t.assets=e.assets,t.birthDate=e.birth_date,t}catch(t){throw console.warn("There was a problem remapping the player from squad",t),t}}};var ze=class{countryRemapper=null;competitionRemapper=null;playerRemapper=null;constructor(){this.countryRemapper=new h,this.competitionRemapper=new b,this.playerRemapper=new Je}fromResponse(e){try{let t=new We;return t.id=e.id,t.country=this.countryRemapper.countryFromResponse(e.country),t.gender=e.gender,t.assets=e.assets,t.code=e.code,t.national=e.national,t.fullName=e.full_name,t.shortName=e.short_name,t.name=e.name,t.competitions=e.competitions?e.competitions.map(r=>this.competitionRemapper.fromResponse(r)):[],t.squad=e.squad?e.squad.map(r=>this.playerRemapper.fromResponse(r)):[],t}catch(t){throw console.warn("There was a problem remapping team response",t),t}}};var Qe=class{id="";kickoffAt="";finishedAt="";updatedAt="";homeTeam=null;awayTeam=null;lineupsConfirmed=!1;startedAt="";minute="";scores=null;context={competition:null};status={type:null,subType:null}};var Ze=class{ftScore=null;htScore=null;aetScore=null;aggScore=null;penScore=null};var U=class{fromResponse(e){try{let t=new Ze;return t.ftScore=this.statEntityFromResponse(e.ft_score),t.htScore=this.statEntityFromResponse(e.ht_score),t.aetScore=this.statEntityFromResponse(e.aet_score),t.aggScore=this.statEntityFromResponse(e.agg_score),t.penScore=this.statEntityFromResponse(e.pen_score),t}catch(t){throw console.warn("There was a problem remapping the scores",t),t}}statEntityFromResponse=e=>({homeGoals:e.home_goals,awayGoals:e.away_goals})};var et=class{teamRemapper=null;competitionRemapper=null;scoresRemapper=null;constructor(){this.teamRemapper=new y,this.competitionRemapper=new b,this.scoresRemapper=new U}fromResponse(e){try{let t=new Qe;return t.id=e.id,t.kickoffAt=e.kickoff_at,t.finishedAt=e.finished_at,t.updatedAt=e.updated_at,t.homeTeam=this.teamRemapper.fromResponse(e.home_team),t.awayTeam=this.teamRemapper.fromResponse(e.away_team),t.lineupsConfirmed=e.lineups_confirmed,t.startedAt=e.started_at,t.minute=e.minute,t.scores=this.scoresRemapper.fromResponse(e.scores),t.context={competition:e.context.competition?this.competitionRemapper.fromResponse(e.context.competition):null},t.status={type:e.status.type,subType:e.status.sub_type},t}catch(t){throw console.warn("There was a problem remapping the match response",t),t}}};var tt=class{id="";kickoffAt="";finishedAt="";updatedAt="";homeTeam=null;awayTeam=null;lineupsConfirmed=!1;startedAt="";minute="";scores=null;stats=null;context={competition:null};timeline=[];status={type:null,subType:null};lineups=null};var rt=class{corners=null;crosses=null;offside=null;shotsOn=null;throwIn=null;redCards=null;shotsOff=null;goalKicks=null;possession=null;treatments=null;yellowCards=null;shotsBlocked=null;substitutions=null;counterAttacks=null;foulsCommitted=null};var it=class{fromResponse(e){try{let t=new rt;return t.corners=this.statEntityFromResponse(e.corners),t.crosses=this.statEntityFromResponse(e.crosses),t.offside=this.statEntityFromResponse(e.offside),t.shotsOn=this.statEntityFromResponse(e.shots_on),t.throwIn=this.statEntityFromResponse(e.throw_in),t.redCards=this.statEntityFromResponse(e.red_cards),t.shotsOff=this.statEntityFromResponse(e.shots_off),t.goalKicks=this.statEntityFromResponse(e.goal_kicks),t.possession=this.statEntityFromResponse(e.possession),t.treatments=this.statEntityFromResponse(e.treatments),t.yellowCards=this.statEntityFromResponse(e.yellow_cards),t.shotsBlocked=this.statEntityFromResponse(e.shots_blocked),t.substitutions=this.statEntityFromResponse(e.substitutions),t.counterAttacks=this.statEntityFromResponse(e.counter_attacks),t.foulsCommitted=this.statEntityFromResponse(e.fouls_committed),t}catch(t){throw console.warn("There was a problem remapping the stats",t),t}}statEntityFromResponse=e=>({homeTeam:e?e.home_team:null,awayTeam:e?e.away_team:null})};var V=class{homeTeam={players:[]};awayTeam={players:[]}};var ot=class{id="";name="";position="";shirtNumber;assets=null;type=""};var q=class{fromResponse(e){try{let t=new ot;return t.id=e.id,t.name=e.name,t.position=e.position,t.shirtNumber=e.shirt_number,t.assets=e.assets,t.type=e.type,t}catch(t){throw console.warn("There was a problem remapping the player from timeline",t),t}}};var at=class{playerRemapper=null;constructor(){this.playerRemapper=new q}fromResponse(e){try{let t=new V;return t.homeTeam.players=e.home_team&&e.home_team.players?e.home_team.players.map(r=>this.playerRemapper.fromResponse(r)):[],t.awayTeam.players=e.away_team&&e.away_team.players?e.away_team.players.map(r=>this.playerRemapper.fromResponse(r)):[],t}catch(t){throw console.warn("There was a problem remapping the lineups",t),t}}};var st=class{minute="";type="";teamId="";player=null;relatedPlayer=null;updatedAt=""};var nt=class{playerRemapper=null;constructor(){this.playerRemapper=new q}fromResponse(e){try{let t=new st;return t.minute=e.minute,t.type=e.type,t.teamId=e.team_id,t.player=this.playerRemapper.fromResponse(e.player),t.relatedPlayer=e.related_player?this.playerRemapper.fromResponse(e.related_player):null,t.updatedAt=e.updated_at,t}catch(t){throw console.warn("There was a problem remapping timeline",t),t}}};var lt=class{teamMapper=null;competitionsMapper=null;lineupsMapper=null;scoresMapper=null;statsMapper=null;timelineMapper=null;constructor(){this.teamMapper=new y,this.competitionsMapper=new b,this.lineupsMapper=new at,this.scoresMapper=new U,this.statsMapper=new it,this.timelineMapper=new nt}fromResponse(e){try{let t=new tt;return t.id=e.id,t.kickoffAt=e.kickoff_at,t.finishedAt=e.finished_at,t.updatedAt=e.updated_at,t.homeTeam=e.home_team?this.teamMapper.fromResponse(e.home_team):null,t.awayTeam=e.away_team?this.teamMapper.fromResponse(e.away_team):null,t.lineupsConfirmed=e.lineups_confirmed,t.startedAt=e.started_at,t.minute=e.minute,t.scores=this.scoresMapper.fromResponse(e.scores),t.stats=this.statsMapper.fromResponse(e.stats),t.context={competition:this.competitionsMapper.fromResponse(e.context.competition)},t.timeline=e.timeline?e.timeline.map(r=>this.timelineMapper.fromResponse(r)):[],t.status={type:e.status.type,subType:e.status.sub_type},t.lineups=e.lineups?this.lineupsMapper.fromResponse(e.lineups):new V,t}catch(t){throw console.warn("There was a problem remapping the match response",t),t}}};var pt=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null};var ct=class{countryRemapper=null;constructor(){this.countryRemapper=new h}fromResponse(e){try{let t=new pt;return t.id=e.id,t.firstName=e.first_name?e.first_name:null,t.lastName=e.last_name?e.last_name:null,t.name=e.name?e.name:null,t.birthDate=e.birth_date,t.country=this.countryRemapper.countryFromResponse(e.country),t.assets=e.assets,t.position=e.position,t}catch(t){throw console.warn("There was a problem remapping top player response",t),t}}};var mt=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;teams=[]};var H=class{countryRemapper=null;teamRemapper=null;constructor(){this.countryRemapper=new h,this.teamRemapper=new y}fromResponse(e){try{let t=new mt;return t.id=e.id,t.firstName=e.first_name?e.first_name:null,t.lastName=e.last_name?e.last_name:null,t.name=e.name?e.name:null,t.birthDate=e.birth_date,t.country=this.countryRemapper.countryFromResponse(e.country),t.assets=e.assets,t.teams=e.teams?e.teams.map(r=>this.teamRemapper.fromResponse(r)):[],t.position=e.position,t}catch(t){throw console.warn("There was a problem remapping players response",t),t}}};var ut=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;competitions=[];teams=[]};var dt=class{countryRemapper=null;teamRemapper=null;competitionRemapper=null;constructor(){this.countryRemapper=new h,this.teamRemapper=new y,this.competitionRemapper=new b}fromResponse(e){try{let t=new ut;return t.id=e.id,t.firstName=e.first_name?e.first_name:null,t.lastName=e.last_name?e.last_name:null,t.name=e.name?e.name:null,t.birthDate=e.birth_date,t.country=this.countryRemapper.countryFromResponse(e.country),t.assets=e.assets,t.teams=e.teams?e.teams.map(r=>this.teamRemapper.fromResponse(r)):[],t.position=e.position,t.competitions=e.competitions?e.competitions.map(r=>this.competitionRemapper.fromResponse(r)):[],t}catch(t){throw console.warn("There was a problem remapping player response",t),t}}};var ht=class{teams=null;players=null;competitions=null};var ft=class{teamRemapper=null;playerRemapper=null;competitionremapper=null;constructor(){this.teamRemapper=new y,this.playerRemapper=new H,this.competitionremapper=new b}fromResponse(e){try{let t=new ht;return t.teams=e.teams?e.teams.map(r=>this.teamRemapper.fromResponse(r)):[],t.players=e.players?e.players.map(r=>this.playerRemapper.fromResponse(r)):[],t.competitions=e.competitions?e.competitions.map(r=>this.competitionremapper.fromResponse(r)):[],t}catch(t){throw console.warn("There was a problem remapping search response",t),t}}};var k=class{instance=null;apiSignInUrl="";idSchema="";limitIds=200;countryRemapper=null;competitionBasicRemapper=null;competitionFullRemapper=null;teamBasicRemapper=null;teamFullRemapper=null;matchBasicRemapper=null;matchFullRemapper=null;playerBasicRemapper=null;playerFullRemapper=null;topPlayerRemapper=null;searchRemapper=null;constructor(e){let t=S(e.environment,"football");this.apiSignInUrl=`?key=${e.apiKey}&lang=${e.lang}&client_id=${e.clientId}`,this.idSchema=e.idSchema,this.instance=Ci.default.create({baseURL:t}),this.countryRemapper=new h,this.competitionBasicRemapper=new b,this.competitionFullRemapper=new Ye,this.teamBasicRemapper=new y,this.teamFullRemapper=new ze,this.matchBasicRemapper=new et,this.matchFullRemapper=new lt,this.playerBasicRemapper=new H,this.playerFullRemapper=new dt,this.topPlayerRemapper=new ct,this.searchRemapper=new ft}getCountries=async()=>{try{let e=await this.instance.get(`/countries${this.apiSignInUrl}`);return this.countryRemapper.countriesFromResponse(e.data.data)}catch(e){throw console.warn("There was a problem with the football countries request",e),e}};getCompetitions=async e=>{try{let t={};if(e&&e.competitionIds&&e.competitionIds.length>this.limitIds-1){let r=[],i=he(e.competitionIds);for(let s of i)e.competitionIds=s,t=await this.instance.get(`/competitions${this.apiSignInUrl}${e.constructFilterUrl()}`),r.push(t.data.data.map(l=>this.competitionBasicRemapper.fromResponse(l)));return Array.prototype.concat.apply([],r)}else return t=e?await this.instance.get(`/competitions${this.apiSignInUrl}${e.constructFilterUrl()}`):await this.instance.get(`/competitions${this.apiSignInUrl}`),t.data.data.map(r=>this.competitionBasicRemapper.fromResponse(r))}catch(t){throw console.warn("There was a problem with getCompetitions request",t),t}};getCompetitionById=async e=>{try{let t=await this.instance.get(`/competitions/${e}${this.apiSignInUrl}`);return this.competitionFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getCompetitionById request",t),t}};getTopCompetitions=async()=>{try{return(await this.instance.get(`/competitions/top${this.apiSignInUrl}`)).data.data.map(t=>this.competitionBasicRemapper.fromResponse(t))}catch(e){throw console.warn("There was a problem with getTopCompetitions request",e),e}};getTeams=async e=>{try{let t={};if(e&&e.teamIds&&e.teamIds.length>this.limitIds-1){let r=[],i=he(e.teamIds);for(let s of i)e.teamIds=s,t=await this.instance.get(`/teams${this.apiSignInUrl}${e.constructFilterUrl()}`),r.push(t.data.data.map(l=>this.teamBasicRemapper.fromResponse(l)));return Array.prototype.concat.apply([],r)}else return t=e?await this.instance.get(`/teams${this.apiSignInUrl}${e.constructFilterUrl()}`):await this.instance.get(`/teams${this.apiSignInUrl}`),t.data.data.map(r=>this.teamBasicRemapper.fromResponse(r))}catch(t){throw console.warn("There was a problem with getTeams request",t),t}};getTeamById=async e=>{try{let t=await this.instance.get(`/teams/${e}${this.apiSignInUrl}`);return this.teamFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getTeamById request",t),t}};getTopTeams=async()=>{try{let e=await this.instance.get(`/teams/top${this.apiSignInUrl}`);return e.data.data?e.data.data.map(t=>this.teamBasicRemapper.fromResponse(t)):[]}catch(e){throw console.warn("There was a problem with getTopTeams request",e),e}};getNextMatchForTeam=async e=>{try{let t=await this.instance.get(`/teams/${e}/next-match${this.apiSignInUrl}`);return this.matchFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getNextMatchForTeam request",t),t}};getPrevMatchForTeam=async e=>{try{let t=await this.instance.get(`/teams/${e}/previous-match${this.apiSignInUrl}`);return this.matchFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getPrevMatchForTeam request",t),t}};getPlayers=async e=>{try{let t={};if(e&&e.playerIds&&e.playerIds.length>this.limitIds-1){let r=[],i=he(e.playerIds);for(let s of i)e.playerIds=s,t=await this.instance.get(`/players${this.apiSignInUrl}${e.constructFilterUrl()}`),r.push(t.data.data.map(l=>this.teamBasicRemapper.fromResponse(l)));return Array.prototype.concat.apply([],r)}else return(e?await this.instance.get(`/players${this.apiSignInUrl}${e.constructFilterUrl()}`):await this.instance.get(`/players${this.apiSignInUrl}`)).data.data.map(i=>this.playerBasicRemapper.fromResponse(i))}catch(t){throw console.warn("There was a problem with getPlayers request",t),t}};getPlayerById=async e=>{try{let t=await this.instance.get(`/players/${e}${this.apiSignInUrl}`);return this.playerFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getPlayerById request",t),t}};getTopPlayers=async()=>{try{return(await this.instance.get(`/players/top${this.apiSignInUrl}`)).data.data.map(t=>this.topPlayerRemapper.fromResponse(t))}catch(e){throw console.warn("There was a problem with getTopPlayers request",e),e}};getNextMatchForPlayer=async e=>{try{let t=await this.instance.get(`/players/${e}/next-match${this.apiSignInUrl}`);return this.matchFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getNextMatchForPlayer request",t),t}};getPrevMatchForPlayer=async e=>{try{let t=await this.instance.get(`/players/${e}/previous-match${this.apiSignInUrl}`);return this.matchFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getPrevMatchForPlayer request",t),t}};getMatchById=async e=>{try{let t=await this.instance.get(`/matches/${e}${this.apiSignInUrl}`);return this.matchFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getMatchById request",t),t}};getMatches=async e=>{try{return(e?await this.instance.get(`/matches${this.apiSignInUrl}${e.constructFilterUrl()}`):await this.instance.get(`/matches${this.apiSignInUrl}`)).data.data.map(r=>this.matchBasicRemapper.fromResponse(r))}catch(t){throw console.warn("There was a problem with getMatches request",t),t}};search=async e=>{try{let t=await this.instance.get(`/search${this.apiSignInUrl}${e.constructFilterUrl()}`);return this.searchRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with search request",t),t}}};var yt=class{profileHttps=null;footballHttps=null;footballFacade=null;idMapping=null;localStorage=null;profileFacade=null;ownProfileBuilder=null;profileBuilder=null;constructor(e){this.profileHttps=new Ie(e),this.footballHttps=new k(e),this.idMapping=new C(e),this.localStorage=new T(e),this.footballFacade=new _(this.localStorage,this.footballHttps,this.idMapping),this.profileFacade=new E(this.localStorage,this.profileHttps),this.ownProfileBuilder=new qe(this.localStorage,this.profileHttps,this.idMapping,this.footballHttps),this.profileBuilder=new He(this.localStorage,this.profileHttps,this.idMapping,this.footballFacade)}getOwn=()=>this.ownProfileBuilder;getById=e=>this.profileBuilder.setId(e);getCountries=async()=>await this.profileFacade.getCountries();getByIds=async e=>await this.profileFacade.getByIds(e)};var gt=class{validate=e=>{let t=this.validateField(e.lang),r=this.generateMessage(t);return{validation:t,message:r}};validateField=e=>{let t=["bg","ro","en"],r=null;return e!=null&&e.length>0?t.includes(e)?r="valid":r="invalid":r="missing",r};generateMessage=e=>{let t=null,r="warning";return e==="missing"&&(t="If no lang is passed the default one will be set which is: EN"),e==="invalid"&&(t="This lang value is not supported, the default one will be set which is: EN"),e==="valid"&&(t=null,r=null),{text:t,type:r}}};var wt=class{validate(e){let t=this.validateField(e.environment),r=this.generateMessage(t);return{validation:t,message:r}}validateField=e=>{let t=["dev","sandbox","prod"],r=null;return e!=null&&e.length>0?t.includes(e)?r="valid":r="invalid":r="missing",r};generateMessage=e=>{let t=null,r="warning";return e==="missing"&&(t="If no environment is passed the default one will be set which is: prod"),e==="invalid"&&(t="This environment value is not supported, the default one will be set which is: prod"),e==="valid"&&(t=null,r=null),{text:t,type:r}}};var bt=class{validate(e){let t=this.validateField(e.apiKey),r=this.generateMessage(t);return{validation:t,message:r}}validateField=e=>{let t=null;return e!=null&&e.length>0?t="valid":t="missing",t};generateMessage=e=>{let t=null,r="error";return e==="missing"&&(t="The field apiKey with valid value must be provided to use this SDK"),e==="valid"&&(r=null),{text:t,type:r}}};var Mt=class{validate(e){let t=this.validateField(e.idSchema),r=this.generateMessage(t);return{validation:t,message:r}}validateField=e=>{let t=["native","sportal365","enetpulse","sportradar"],r=null;return e!=null&&e.length>0?t.includes(e)?r="valid":r="invalid":r="missing",r};generateMessage=e=>{let t=null,r="warning";return e==="missing"&&(t="If no idSchema is passed the default one will be set which is: native"),e==="invalid"&&(t="This idSchema value is not supported, the default one will be set which is: native"),e==="valid"&&(t=null,r=null),{text:t,type:r}}};var ae=class{getIdToken=null;logout=null};var K=class{text=null;type=null};var It=class{validation=null;message=new K;getIdToken={validation:null,message:new K};logout={validation:null,message:new K}};var Rt=class{validate(e){let t=this.validateAuthProvider(e.authProvider);return t.validation!=="missing"&&(t=this.validateAuthProviderConfigFields(e.authProvider,t),t=this.generateAuthProviderConfigMessages(t),t=this.checkAuthProviderConfigMessagesForErrors(t)),t}validateAuthProvider=e=>{let t=Object.keys(new ae),r=new It;if(e){let a=Object.keys(e).filter(s=>!t.includes(s));a.length>0?(r.validation="invalid",r.message.type="warning",r.message.text=`${"You have passed a property which is not supported for the authentication provider:"} ${a.join(",")}`):r.validation="valid"}else r.validation="missing",r.message.type="error",r.message.text="The field authProvider must be provided to use this SDK";return r};validateAuthProviderConfigFields=(e,t)=>(Object.keys(new ae).forEach(i=>{e[i]?t[i].validation="valid":t[i].validation="missing"}),t);generateAuthProviderConfigMessages=e=>(Object.keys(e).filter(t=>t!=="validation"&&t!=="message").forEach(t=>{let r=e[t];r.validation==="missing"&&(r.message.text=`${"The following property is missing from the authProvider object:"} ${t}`,r.message.type="error")}),e);checkAuthProviderConfigMessagesForErrors=e=>(Object.keys(e).filter(t=>t!=="validation"&&t!=="message").forEach(t=>{e[t].validation==="missing"&&e.validation==="valid"&&(e.validation="invalid",e.message.type="error",e.message.text="The field authProvider has missing properties")}),e)};var se=class{validation;message};var Pt=class{apiKey=null;environment=null;idSchema=null;clientId=null;lang=null;authProvider={getIdToken:new se,logout:new se};isValid=!1};var Ft=class{validate(e){let t=this.validateField(e.clientId),r=this.generateMessage(t);return{validation:t,message:r}}validateField=e=>{let t=null;return e!=null&&e.length>0?t="valid":t="missing",t};generateMessage=e=>{let t=null,r="warning";return e==="missing"&&(t="The field clientId must be provided to use this SDK"),e==="valid"&&(t=null,r=null),{text:t,type:r}}};var St=class{validate=e=>{let t=this.checkFieldsForValues(e);return t.isValid=this.containsErrorMessage(t),t};checkFieldsForValues=e=>{let t=new Pt,r={apiKey:new bt,environment:new wt,idSchema:new Mt,clientId:new Ft,lang:new gt,authProvider:new Rt};for(let[i,a]of Object.entries(t))i!=="isValid"&&(a=r[i].validate(e));return Object.keys(r).forEach(i=>{t[i]=r[i].validate(e)}),t};containsErrorMessage=e=>{let t=!0;for(let[r,i]of Object.entries(e))if(r!=="authProvider"){if(r!=="isValid"&&i.message.type==="error")return t=!1,t;if(r!=="isValid"&&i.message.type==="warning")return t=!0,t}return t}};var vt=class{https=null;idMapping=null;localStorage=null;footballFacade=null;constructor(e){this.https=new k(e),this.idMapping=new C(e),this.localStorage=new T(e),this.footballFacade=new _(this.localStorage,this.https,this.idMapping)}getCountries=async()=>await this.footballFacade.getCountries();getCompetitions=async e=>await this.footballFacade.getCompetitions(e);getCompetitionById=async e=>await this.footballFacade.getCompetitionById(e);getTopCompetitions=async()=>await this.footballFacade.getTopCompetitions();getTeams=async e=>await this.footballFacade.getTeams(e);getTeamById=async e=>await this.footballFacade.getTeamById(e);getTopTeams=async()=>await this.footballFacade.getTopTeams();getNextMatchForTeam=async e=>await this.footballFacade.getNextMatchForTeam(e);getPrevMatchForTeam=async e=>await this.footballFacade.getPrevMatchForTeam(e);getPlayers=async e=>await this.footballFacade.getPlayers(e);getPlayerById=async e=>await this.footballFacade.getPlayerById(e);getTopPlayers=async()=>await this.footballFacade.getTopPlayers();getNextMatchForPlayer=async e=>await this.footballFacade.getNextMatchForPlayer(e);getPrevMatchForPlayer=async e=>await this.footballFacade.getPrevMatchForPlayer(e);getMatches=async e=>await this.footballFacade.getMatches(e);getMatchById=async e=>await this.footballFacade.getMatchById(e);search=async e=>await this.footballFacade.search(e)};var Ei=Q($());var Tt=(u=>(u.FT_1X2="FT_1X2",u.HT_1X2="HT_1X2",u.BOTH_TEAMS_SCORE="BOTH_TEAMS_SCORE",u.OVER_GOALS="OVER_GOALS",u.OVER_CORNERS="OVER_CORNERS",u.DOUBLE_CHANCE="DOUBLE_CHANCE",u.HT_FT="HT_FT",u.PLAYER_SCORE="PLAYER_SCORE",u.PLAYER_YELLOW_CARD="PLAYER_YELLOW_CARD",u.PLAYER_RED_CARD="PLAYER_RED_CARD",u.RED_CARD_MATCH="RED_CARD_MATCH",u.PENALTY_MATCH="PENALTY_MATCH",u.PLAYER_SCORE_FIRST_GOAL="PLAYER_SCORE_FIRST_GOAL",u.CORNERS_MATCH="CORNERS_MATCH",u.CORRECT_SCORE="CORRECT_SCORE",u.PLAYER_SCORE_HATTRICK="PLAYER_SCORE_HATTRICK",u.PLAYER_SCORE_TWICE="PLAYER_SCORE_TWICE",u))(Tt||{});var Ct=class{matchId=null;matchType=null;result=null;market=null;prediction;target;playerId;goalsHome;goalsAway};var Et=class{settledAt=null;resettledAt=null;status=null;outcome=null};var _t=class{remapFixturesRequest=e=>{let t={},r=["PLAYER_RED_CARD","PLAYER_SCORE","PLAYER_SCORE_FIRST_GOAL","PLAYER_SCORE_HATTRICK","PLAYER_SCORE_TWICE","PLAYER_YELLOW_CARD"],i=["HT_1X2","HT_FT","FT_1X2","DOUBLE_CHANCE","CORNERS_MATCH"],a="API request body is expecting a property",s="API request body is not expecting a property";if(t.match_id=e.matchId,t.match_type=e.matchType,t.market=e.market,e.prediction!==void 0&&e.market!=="CORRECT_SCORE")t.prediction=e.prediction;else{if(typeof e.prediction=="boolean"&&i.includes(e.market))throw new Error(`${a} prediction to be type string`);if(typeof e.prediction=="string"&&!i.includes(e.market))throw new Error(`${a} prediction to be type boolean`);if(e.prediction&&e.market==="CORRECT_SCORE")throw new Error(`${s} prediction for market: ${"CORRECT_SCORE"}`);if(e.prediction===void 0&&e.market!=="CORRECT_SCORE")throw new Error(`${a} prediction`)}if(e.target&&(e.market==="OVER_CORNERS"||e.market==="OVER_GOALS"))t.target=e.target;else{if(e.target&&e.market!=="OVER_CORNERS"&&e.market!=="OVER_GOALS")throw new Error(`${s} target`);if(!e.target&&(e.market==="OVER_CORNERS"||e.market==="OVER_GOALS"))throw new Error(`${a} target for the following markets: ${"OVER_GOALS"} and ${"OVER_CORNERS"}`)}if(e.playerId&&r.includes(e.market))t.player_id=e.playerId;else{if(e.playerId&&!r.includes(e.market))throw new Error(`${s} playerId for market: ${e.market}`);if(!e.playerId&&r.includes(e.market))throw new Error(`${a} playerId for market: ${e.market}`)}if(e.goalsHome&&e.goalsAway&&e.market==="CORRECT_SCORE")t.goals_home=e.goalsHome,t.goals_away=e.goalsAway;else{if((e.goalsHome||e.goalsAway)&&e.market!=="CORRECT_SCORE")throw new Error("API request body is not expecting the following properties: goalsHome and goalsAway");if((!e.goalsHome||!e.goalsAway)&&e.market==="CORRECT_SCORE")throw new Error("API request body is expecting the following properties: goalsHome and goalsAway")}return t};remapFixturesResponse=e=>{let t=new Ct;return t.matchId=e.match_id,t.matchType=e.match_type,t.result=this.remapResult(e.result),t.market=e.market,e.prediction!==void 0&&(t.prediction=e.prediction),e.target&&(t.target=e.target),e.player_id&&(t.playerId=e.player_id),e.goals_home&&(t.goalsHome=e.goals_home),e.goals_away&&(t.goalsAway=e.goals_away),t};remapResult=e=>{let t=new Et;return t.settledAt=e.settled_at,t.resettledAt=e.resettled_at,t.status=e.status,t.outcome=e.outcome,t}};var Y=class{id=null;gameInstanceId=null;wager=null;totalFixtures=null;settledFixtures=null;userId=null;fixtures=null;status=null;tiebreaker=null;points=null;createdAt=null;updatedAt=null};var W=class{fullTimeOneXTwo={};halfTimeOneXTwo={};bothTeamsScore={};overGoals={};overCorners={};doubleChance={};halfTimeFullTime={};playerScore={};playerYellowCard={};playerRedCard={};redCardMatch={};penaltyMatch={};playerScoreFirstGoal={};cornersMatch={};correctScore={};playerScoreHattrick={};playerScoreTwice={}};var X=class{fixturesRemapper=null;constructor(){this.fixturesRemapper=new _t}remapRequestBody=e=>{let t={};return t.game_instance_id=e.gameInstanceId,t.fixtures=e.fixtures.map(r=>this.fixturesRemapper.remapFixturesRequest(r)),t};remapResponseBody=e=>{let t=new Y;return t.id=e.id,t.gameInstanceId=e.game_instance_id,t.wager=e.wager,t.totalFixtures=e.total_fixtures,t.settledFixtures=e.settled_fixtures,t.userId=e.user_id,t.fixtures=e.fixtures.map(r=>this.fixturesRemapper.remapFixturesResponse(r)),t.status=e.status,t.tiebreaker=e.tiebreaker,t.points=e.points,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapPredictionModel=e=>{let t=new W;return t.fullTimeOneXTwo=e.FT_1X2,t.halfTimeOneXTwo=e.HT_1X2,t.bothTeamsScore=e.BOTH_TEAMS_SCORE,t.overGoals=e.OVER_GOALS,t.overCorners=e.OVER_CORNERS,t.doubleChance=e.DOUBLE_CHANCE,t.halfTimeFullTime=e.HT_FT,t.playerScore=e.PLAYER_SCORE,t.playerYellowCard=e.PLAYER_YELLOW_CARD,t.playerRedCard=e.PLAYER_RED_CARD,t.redCardMatch=e.RED_CARD_MATCH,t.penaltyMatch=e.PENALTY_MATCH,t.playerScoreFirstGoal=e.PLAYER_SCORE_FIRST_GOAL,t.cornersMatch=e.CORNERS_MATCH,t.correctScore=e.CORRECT_SCORE,t.playerScoreHattrick=e.PLAYER_SCORE_HATTRICK,t.playerScoreTwice=e.PLAYER_SCORE_TWICE,t}};var Bt=class{matchId=null;matchType=null;predictions=null};var At=class{remapPredictions=null;constructor(){this.remapPredictions=new X}remapResponse=e=>{let t=new Bt;return t.matchId=e.match_id,t.matchType=e.match_type,t.predictions=this.remapPredictions.remapPredictionModel(e.predictions),t}};var xt=class{instance=null;apiSignInUrl=null;clientApiSignInUrl=null;predictionRemapper=null;matchSummaryRemapper=null;constructor(e){let t=S(e.environment,"predictor");this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}`,this.predictionRemapper=new X,this.matchSummaryRemapper=new At,this.instance=Ei.default.create({baseURL:t,headers:{Authorization:`Bearer ${e.authProvider.getIdToken()}`,"Content-Type":"application/json"}})}makePrediction=async e=>{try{let t=this.predictionRemapper.remapRequestBody(e),r=await this.instance.post(`/predictions${this.apiSignInUrl}`,JSON.stringify(t));return this.predictionRemapper.remapResponseBody(r.data)}catch(t){return console.warn("There was a problem making POST request: ",t),t.message}};getMatchSummary=async e=>{try{let t=await this.instance.get(`/predictions/summary/${e}${this.apiSignInUrl}`);return this.matchSummaryRemapper.remapResponse(t.data)}catch(t){return console.warn(`There was a problem fetching predictions for match: ${e} `,t),t.message}};deletePrediction=async()=>{};getMyPredictions=async()=>{}};var Ot=class{fullCoverageCompetitions=null;markets=null};var Lt=class{remapConfig=e=>{let t=new Ot;return t.fullCoverageCompetitions=e.full_coverage_competitions,t.markets=e.markets,t}};var Nt=class{gameInstanceId=null;fixtures=null};var $t=class{idMapping=null;constructor(e){this.idMapping=e}remapMatchIdToNative=async e=>(await this.idMapping.getEntityIdsBySchemaId(e,"match","native")).match[0];remapPlayerIdToNative=async e=>(await this.idMapping.getEntityIdsBySchemaId(e,"player","native")).player[0];remapPlayerIdToIdSchema=async e=>{let t=["playerScore","playerYellowCard","playerRedCard","playerScoreFirstGoal","playerScoreHattrick","playerScoreTwice"];for(let[r,i]of Object.entries(e))if(t.includes(r))for(let a of Object.keys(i)){let s={player:[a]},p=(await this.idMapping.idMappingFacade.getEntitiesByIds(s,"native",this.idMapping.idSchema)).player[0];i[p]=i[a],delete i[a]}return e};convertMarket=e=>{let t=Object.keys(new W),r=Object.values(Tt);for(let i=0;i<r.length;i++)e===r[i]&&(e=t[i]);return e}};var Dt=class{predictorHttps=null;clientHttps=null;idMapping=null;predictorConfigRemapper=null;predictorService=null;constructor(e,t,r){this.predictorHttps=e,this.idMapping=r,this.clientHttps=t,this.predictorConfigRemapper=new Lt,this.predictorService=new $t(r)}makePrediction=async e=>{let t=new Nt;if(this.idMapping.idSchema!=="native"){let r=e.matchId,i=e.playerId;e.matchId=await this.predictorService.remapMatchIdToNative([r]),i&&(e.playerId=await this.predictorService.remapPlayerIdToNative([i])),t.fixtures=[e];let a=await this.predictorHttps.makePrediction(t);return a instanceof Y&&a.fixtures.map(s=>{s.playerId&&(s.playerId=i),s.matchId=r}),a}else return t.fixtures=[e],await this.predictorHttps.makePrediction(t)};getMatchSummary=async e=>{if(this.idMapping.idSchema!=="native"){let t=await this.predictorService.remapMatchIdToNative([e]),r=await this.predictorHttps.getMatchSummary(t);r.matchId=e;let i=r.predictions,a=await this.predictorService.remapPlayerIdToIdSchema(i);return r.predictions=a,r}else return await this.predictorHttps.getMatchSummary(e)};getMarketSummary=async(e,t)=>{try{let r=await this.getMatchSummary(e),i=this.predictorService.convertMarket(t),a={};if(a.matchId=r.matchId,a.matchType=r.matchType,Object.keys(r.predictions).includes(i)&&(a[i]=r.predictions[i]),!a.hasOwnProperty(i))throw new Error("You have passed invalid market");return a}catch(r){return r.message}};getConfig=async()=>{let e=await this.clientHttps.getConfig(),t=await this.predictorConfigRemapper.remapConfig(e.predictor);if(this.idMapping.idSchema!=="native"){let r={competition:t.fullCoverageCompetitions},i=await this.idMapping.idMappingFacade.getEntitiesByIds(r,"native",this.idMapping.idSchema);return t.fullCoverageCompetitions=i.competition,t}return t};deletePrediction=()=>{};getMyPredictions=()=>{};getUserPastPredictions=()=>{};getUserCurrentPredictions=()=>{}};var _i=Q($());var J=class{instance=null;apiSignInUrl="";constructor(e){let t=S(e.environment,"client");this.apiSignInUrl=`/clients/${e.clientId}/features?key=${e.apiKey}`,this.instance=_i.default.create({baseURL:t,headers:{"Content-Type":"application/json"}})}getConfig=async()=>{try{return(await this.instance.get(`${this.apiSignInUrl}`)).data.data}catch(e){return console.warn("There was a problem fetching configuration from Client API",e),e.message}}};var Ut=class{predictorHttps=null;clientHttps=null;predictorFacade=null;idMapping=null;constructor(e){this.predictorHttps=new xt(e),this.clientHttps=new J(e),this.idMapping=new C(e),this.predictorFacade=new Dt(this.predictorHttps,this.clientHttps,this.idMapping)}makePrediction=async e=>await this.predictorFacade.makePrediction(e);getMatchSummary=async e=>await this.predictorFacade.getMatchSummary(e);getMarketSummary=async(e,t)=>await this.predictorFacade.getMarketSummary(e,t);getConfig=async()=>await this.predictorFacade.getConfig();deletePrediction=()=>{};getMyPredictions=()=>{};getUserPastPredictions=()=>{};getUserCurrentPredictions=()=>{}};var Vt=class{general=[];predictor=[];topX=[]};var qt=class{enabled=!1;rewards=null};var Ht=class{general=null;topX=null;predictor=null};var kt=class{points=null;tiers=null;badges=null};var jt=class{remapLoyaltyResponse=e=>{let t=new qt;return t.enabled=e.enabled,t.rewards=this.remapRewards(e.rewards),t};remapRewards=e=>{let t=new kt;return t.points=this.remapPoints(e.points),t.tiers=e.tiers,t.badges=this.remapBadges(e.badges),t};remapPoints=e=>{let t=new Ht;return t.general=e.general,t.topX=e.top_x,t.predictor=e.predictor,t};remapBadges=e=>{let t=new Vt;return t.general=e.general,t.predictor=e.predictor,t.topX=e.top_x,t}};var Gt=class{https=null;loyaltyRemapper=null;constructor(e){this.https=e,this.loyaltyRemapper=new jt}getConfig=async()=>{let e=await this.https.getConfig();return this.loyaltyRemapper.remapLoyaltyResponse(e.loyalty)}};var Kt=class{https=null;loyaltyFacade=null;constructor(e){this.https=new J(e),this.loyaltyFacade=new Gt(this.https)}getConfig=async()=>await this.loyaltyFacade.getConfig()};function Qc(o){let t=new St().validate(o);if(t.idSchema.validation==="missing"&&(console.warn(t.idSchema.message.text),o.idSchema="native"),t.environment.validation==="missing"&&(console.warn(t.environment.message.text),o.environment="prod"),t.lang.validation==="missing"&&(console.warn(t.lang.message.text),o.lang="en"),t.isValid)return{profile:new yt(o),football:new vt(o),predictor:new Ut(o),loyalty:new Kt(o)};throw new Error("Configuration is not valid")}export{Qc as FansUnitedSDK};
3
3
  //# sourceMappingURL=index.js.map