fansunited-sdk-esm 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +29 -2
  2. package/index.js.map +3 -3
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -1,3 +1,30 @@
1
- var Uo=Object.create;var Yr=Object.defineProperty;var Do=Object.getOwnPropertyDescriptor;var Vo=Object.getOwnPropertyNames;var $o=Object.getPrototypeOf,Ho=Object.prototype.hasOwnProperty;var ko=o=>Yr(o,"__esModule",{value:!0});var h=(o,e)=>()=>(e||o((e={exports:{}}).exports,e),e.exports);var qo=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Vo(e))!Ho.call(o,i)&&(t||i!=="default")&&Yr(o,i,{get:()=>e[i],enumerable:!(r=Do(e,i))||r.enumerable});return o},Fe=(o,e)=>qo(ko(Yr(o!=null?Uo($o(o)):{},"default",!e&&o&&o.__esModule?{get:()=>o.default,enumerable:!0}:{value:o,enumerable:!0})),o);var Wr=h((Ha,Ri)=>{"use strict";Ri.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 P=h((ka,Si)=>{"use strict";var jo=Wr(),Y=Object.prototype.toString;function zr(o){return Y.call(o)==="[object Array]"}function Qr(o){return typeof o=="undefined"}function Xo(o){return o!==null&&!Qr(o)&&o.constructor!==null&&!Qr(o.constructor)&&typeof o.constructor.isBuffer=="function"&&o.constructor.isBuffer(o)}function Ko(o){return Y.call(o)==="[object ArrayBuffer]"}function Yo(o){return typeof FormData!="undefined"&&o instanceof FormData}function Wo(o){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(o):e=o&&o.buffer&&o.buffer instanceof ArrayBuffer,e}function zo(o){return typeof o=="string"}function Qo(o){return typeof o=="number"}function Fi(o){return o!==null&&typeof o=="object"}function Ve(o){if(Y.call(o)!=="[object Object]")return!1;var e=Object.getPrototypeOf(o);return e===null||e===Object.prototype}function Jo(o){return Y.call(o)==="[object Date]"}function Zo(o){return Y.call(o)==="[object File]"}function ea(o){return Y.call(o)==="[object Blob]"}function vi(o){return Y.call(o)==="[object Function]"}function ta(o){return Fi(o)&&vi(o.pipe)}function ra(o){return typeof URLSearchParams!="undefined"&&o instanceof URLSearchParams}function ia(o){return o.trim?o.trim():o.replace(/^\s+|\s+$/g,"")}function oa(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function Jr(o,e){if(!(o===null||typeof o=="undefined"))if(typeof o!="object"&&(o=[o]),zr(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 Zr(){var o={};function e(i,a){Ve(o[a])&&Ve(i)?o[a]=Zr(o[a],i):Ve(i)?o[a]=Zr({},i):zr(i)?o[a]=i.slice():o[a]=i}for(var t=0,r=arguments.length;t<r;t++)Jr(arguments[t],e);return o}function aa(o,e,t){return Jr(e,function(i,a){t&&typeof i=="function"?o[a]=jo(i,t):o[a]=i}),o}function na(o){return o.charCodeAt(0)===65279&&(o=o.slice(1)),o}Si.exports={isArray:zr,isArrayBuffer:Ko,isBuffer:Xo,isFormData:Yo,isArrayBufferView:Wo,isString:zo,isNumber:Qo,isObject:Fi,isPlainObject:Ve,isUndefined:Qr,isDate:Jo,isFile:Zo,isBlob:ea,isFunction:vi,isStream:ta,isURLSearchParams:ra,isStandardBrowserEnv:oa,forEach:Jr,merge:Zr,extend:aa,trim:ia,stripBOM:na}});var ei=h((qa,Ei)=>{"use strict";var Z=P();function Ti(o){return encodeURIComponent(o).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}Ei.exports=function(e,t,r){if(!t)return e;var i;if(r)i=r(t);else if(Z.isURLSearchParams(t))i=t.toString();else{var a=[];Z.forEach(t,function(p,m){p===null||typeof p=="undefined"||(Z.isArray(p)?m=m+"[]":p=[p],Z.forEach(p,function(c){Z.isDate(c)?c=c.toISOString():Z.isObject(c)&&(c=JSON.stringify(c)),a.push(Ti(m)+"="+Ti(c))}))}),i=a.join("&")}if(i){var n=e.indexOf("#");n!==-1&&(e=e.slice(0,n)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var Ci=h((ja,_i)=>{"use strict";var sa=P();function $e(){this.handlers=[]}$e.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};$e.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};$e.prototype.forEach=function(e){sa.forEach(this.handlers,function(r){r!==null&&e(r)})};_i.exports=$e});var xi=h((Xa,Oi)=>{"use strict";var la=P();Oi.exports=function(e,t){la.forEach(e,function(i,a){a!==t&&a.toUpperCase()===t.toUpperCase()&&(e[t]=i,delete e[a])})}});var ti=h((Ka,Ai)=>{"use strict";Ai.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 ri=h((Ya,Bi)=>{"use strict";var pa=ti();Bi.exports=function(e,t,r,i,a){var n=new Error(e);return pa(n,t,r,i,a)}});var Li=h((Wa,Ni)=>{"use strict";var ca=ri();Ni.exports=function(e,t,r){var i=r.config.validateStatus;!r.status||!i||i(r.status)?e(r):t(ca("Request failed with status code "+r.status,r.config,null,r.request,r))}});var Ui=h((za,Gi)=>{"use strict";var He=P();Gi.exports=He.isStandardBrowserEnv()?function(){return{write:function(t,r,i,a,n,s){var p=[];p.push(t+"="+encodeURIComponent(r)),He.isNumber(i)&&p.push("expires="+new Date(i).toGMTString()),He.isString(a)&&p.push("path="+a),He.isString(n)&&p.push("domain="+n),s===!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 Vi=h((Qa,Di)=>{"use strict";Di.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var Hi=h((Ja,$i)=>{"use strict";$i.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}});var qi=h((Za,ki)=>{"use strict";var ma=Vi(),ua=Hi();ki.exports=function(e,t){return e&&!ma(t)?ua(e,t):t}});var Xi=h((en,ji)=>{"use strict";var ii=P(),da=["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"];ji.exports=function(e){var t={},r,i,a;return e&&ii.forEach(e.split(`
2
- `),function(s){if(a=s.indexOf(":"),r=ii.trim(s.substr(0,a)).toLowerCase(),i=ii.trim(s.substr(a+1)),r){if(t[r]&&da.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 Wi=h((tn,Yi)=>{"use strict";var Ki=P();Yi.exports=Ki.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a"),r;function i(a){var n=a;return e&&(t.setAttribute("href",n),n=t.href),t.setAttribute("href",n),{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(n){var s=Ki.isString(n)?i(n):n;return s.protocol===r.protocol&&s.host===r.host}}():function(){return function(){return!0}}()});var ve=h((rn,zi)=>{"use strict";function oi(o){this.message=o}oi.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};oi.prototype.__CANCEL__=!0;zi.exports=oi});var ni=h((on,Qi)=>{"use strict";var ke=P(),ha=Li(),fa=Ui(),ga=ei(),ya=qi(),Ma=Xi(),wa=Wi(),ai=ri(),ba=Se(),Pa=ve();Qi.exports=function(e){return new Promise(function(r,i){var a=e.data,n=e.headers,s=e.responseType,p;function m(){e.cancelToken&&e.cancelToken.unsubscribe(p),e.signal&&e.signal.removeEventListener("abort",p)}ke.isFormData(a)&&delete n["Content-Type"];var l=new XMLHttpRequest;if(e.auth){var c=e.auth.username||"",f=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";n.Authorization="Basic "+btoa(c+":"+f)}var L=ya(e.baseURL,e.url);l.open(e.method.toUpperCase(),ga(L,e.params,e.paramsSerializer),!0),l.timeout=e.timeout;function Pi(){if(!!l){var C="getAllResponseHeaders"in l?Ma(l.getAllResponseHeaders()):null,J=!s||s==="text"||s==="json"?l.responseText:l.response,K={data:J,status:l.status,statusText:l.statusText,headers:C,config:e,request:l};ha(function(Kr){r(Kr),m()},function(Kr){i(Kr),m()},K),l=null}}if("onloadend"in l?l.onloadend=Pi:l.onreadystatechange=function(){!l||l.readyState!==4||l.status===0&&!(l.responseURL&&l.responseURL.indexOf("file:")===0)||setTimeout(Pi)},l.onabort=function(){!l||(i(ai("Request aborted",e,"ECONNABORTED",l)),l=null)},l.onerror=function(){i(ai("Network Error",e,null,l)),l=null},l.ontimeout=function(){var J=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",K=e.transitional||ba.transitional;e.timeoutErrorMessage&&(J=e.timeoutErrorMessage),i(ai(J,e,K.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",l)),l=null},ke.isStandardBrowserEnv()){var Ii=(e.withCredentials||wa(L))&&e.xsrfCookieName?fa.read(e.xsrfCookieName):void 0;Ii&&(n[e.xsrfHeaderName]=Ii)}"setRequestHeader"in l&&ke.forEach(n,function(J,K){typeof a=="undefined"&&K.toLowerCase()==="content-type"?delete n[K]:l.setRequestHeader(K,J)}),ke.isUndefined(e.withCredentials)||(l.withCredentials=!!e.withCredentials),s&&s!=="json"&&(l.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&l.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&l.upload&&l.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(p=function(C){!l||(i(!C||C&&C.type?new Pa("canceled"):C),l.abort(),l=null)},e.cancelToken&&e.cancelToken.subscribe(p),e.signal&&(e.signal.aborted?p():e.signal.addEventListener("abort",p))),a||(a=null),l.send(a)})}});var Se=h((an,eo)=>{"use strict";var M=P(),Ji=xi(),Ia=ti(),Ra={"Content-Type":"application/x-www-form-urlencoded"};function Zi(o,e){!M.isUndefined(o)&&M.isUndefined(o["Content-Type"])&&(o["Content-Type"]=e)}function Fa(){var o;return typeof XMLHttpRequest!="undefined"?o=ni():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(o=ni()),o}function va(o,e,t){if(M.isString(o))try{return(e||JSON.parse)(o),M.trim(o)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(o)}var qe={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:Fa(),transformRequest:[function(e,t){return Ji(t,"Accept"),Ji(t,"Content-Type"),M.isFormData(e)||M.isArrayBuffer(e)||M.isBuffer(e)||M.isStream(e)||M.isFile(e)||M.isBlob(e)?e:M.isArrayBufferView(e)?e.buffer:M.isURLSearchParams(e)?(Zi(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):M.isObject(e)||t&&t["Content-Type"]==="application/json"?(Zi(t,"application/json"),va(e)):e}],transformResponse:[function(e){var t=this.transitional||qe.transitional,r=t&&t.silentJSONParsing,i=t&&t.forcedJSONParsing,a=!r&&this.responseType==="json";if(a||i&&M.isString(e)&&e.length)try{return JSON.parse(e)}catch(n){if(a)throw n.name==="SyntaxError"?Ia(n,this,"E_JSON_PARSE"):n}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, */*"}}};M.forEach(["delete","get","head"],function(e){qe.headers[e]={}});M.forEach(["post","put","patch"],function(e){qe.headers[e]=M.merge(Ra)});eo.exports=qe});var ro=h((nn,to)=>{"use strict";var Sa=P(),Ta=Se();to.exports=function(e,t,r){var i=this||Ta;return Sa.forEach(r,function(n){e=n.call(i,e,t)}),e}});var si=h((sn,io)=>{"use strict";io.exports=function(e){return!!(e&&e.__CANCEL__)}});var no=h((ln,ao)=>{"use strict";var oo=P(),li=ro(),Ea=si(),_a=Se(),Ca=ve();function pi(o){if(o.cancelToken&&o.cancelToken.throwIfRequested(),o.signal&&o.signal.aborted)throw new Ca("canceled")}ao.exports=function(e){pi(e),e.headers=e.headers||{},e.data=li.call(e,e.data,e.headers,e.transformRequest),e.headers=oo.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),oo.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var t=e.adapter||_a.adapter;return t(e).then(function(i){return pi(e),i.data=li.call(e,i.data,i.headers,e.transformResponse),i},function(i){return Ea(i)||(pi(e),i&&i.response&&(i.response.data=li.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var ci=h((pn,so)=>{"use strict";var R=P();so.exports=function(e,t){t=t||{};var r={};function i(l,c){return R.isPlainObject(l)&&R.isPlainObject(c)?R.merge(l,c):R.isPlainObject(c)?R.merge({},c):R.isArray(c)?c.slice():c}function a(l){if(R.isUndefined(t[l])){if(!R.isUndefined(e[l]))return i(void 0,e[l])}else return i(e[l],t[l])}function n(l){if(!R.isUndefined(t[l]))return i(void 0,t[l])}function s(l){if(R.isUndefined(t[l])){if(!R.isUndefined(e[l]))return i(void 0,e[l])}else return i(void 0,t[l])}function p(l){if(l in t)return i(e[l],t[l]);if(l in e)return i(void 0,e[l])}var m={url:n,method:n,data:n,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:p};return R.forEach(Object.keys(e).concat(Object.keys(t)),function(c){var f=m[c]||a,L=f(c);R.isUndefined(L)&&f!==p||(r[c]=L)}),r}});var mi=h((cn,lo)=>{lo.exports={version:"0.24.0"}});var mo=h((mn,co)=>{"use strict";var Oa=mi().version,ui={};["object","boolean","number","function","string","symbol"].forEach(function(o,e){ui[o]=function(r){return typeof r===o||"a"+(e<1?"n ":" ")+o}});var po={};ui.transitional=function(e,t,r){function i(a,n){return"[Axios v"+Oa+"] Transitional option '"+a+"'"+n+(r?". "+r:"")}return function(a,n,s){if(e===!1)throw new Error(i(n," has been removed"+(t?" in "+t:"")));return t&&!po[n]&&(po[n]=!0,console.warn(i(n," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(a,n,s):!0}};function xa(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],n=e[a];if(n){var s=o[a],p=s===void 0||n(s,a,o);if(p!==!0)throw new TypeError("option "+a+" must be "+p);continue}if(t!==!0)throw Error("Unknown option "+a)}}co.exports={assertOptions:xa,validators:ui}});var Mo=h((un,yo)=>{"use strict";var uo=P(),Aa=ei(),ho=Ci(),fo=no(),je=ci(),go=mo(),ee=go.validators;function Te(o){this.defaults=o,this.interceptors={request:new ho,response:new ho}}Te.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=je(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&&go.assertOptions(t,{silentJSONParsing:ee.transitional(ee.boolean),forcedJSONParsing:ee.transitional(ee.boolean),clarifyTimeoutError:ee.transitional(ee.boolean)},!1);var r=[],i=!0;this.interceptors.request.forEach(function(f){typeof f.runWhen=="function"&&f.runWhen(e)===!1||(i=i&&f.synchronous,r.unshift(f.fulfilled,f.rejected))});var a=[];this.interceptors.response.forEach(function(f){a.push(f.fulfilled,f.rejected)});var n;if(!i){var s=[fo,void 0];for(Array.prototype.unshift.apply(s,r),s=s.concat(a),n=Promise.resolve(e);s.length;)n=n.then(s.shift(),s.shift());return n}for(var p=e;r.length;){var m=r.shift(),l=r.shift();try{p=m(p)}catch(c){l(c);break}}try{n=fo(p)}catch(c){return Promise.reject(c)}for(;a.length;)n=n.then(a.shift(),a.shift());return n};Te.prototype.getUri=function(e){return e=je(this.defaults,e),Aa(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};uo.forEach(["delete","get","head","options"],function(e){Te.prototype[e]=function(t,r){return this.request(je(r||{},{method:e,url:t,data:(r||{}).data}))}});uo.forEach(["post","put","patch"],function(e){Te.prototype[e]=function(t,r,i){return this.request(je(i||{},{method:e,url:t,data:r}))}});yo.exports=Te});var bo=h((dn,wo)=>{"use strict";var Ba=ve();function te(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(n){t.subscribe(n),i=n}).then(r);return a.cancel=function(){t.unsubscribe(i)},a},o(function(i){t.reason||(t.reason=new Ba(i),e(t.reason))})}te.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};te.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};te.prototype.unsubscribe=function(e){if(!!this._listeners){var t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}};te.source=function(){var e,t=new te(function(i){e=i});return{token:t,cancel:e}};wo.exports=te});var Io=h((hn,Po)=>{"use strict";Po.exports=function(e){return function(r){return e.apply(null,r)}}});var Fo=h((fn,Ro)=>{"use strict";Ro.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var To=h((gn,di)=>{"use strict";var vo=P(),Na=Wr(),Xe=Mo(),La=ci(),Ga=Se();function So(o){var e=new Xe(o),t=Na(Xe.prototype.request,e);return vo.extend(t,Xe.prototype,e),vo.extend(t,e),t.create=function(i){return So(La(o,i))},t}var x=So(Ga);x.Axios=Xe;x.Cancel=ve();x.CancelToken=bo();x.isCancel=si();x.VERSION=mi().version;x.all=function(e){return Promise.all(e)};x.spread=Io();x.isAxiosError=Fo();di.exports=x;di.exports.default=x});var re=h((yn,Eo)=>{Eo.exports=To()});var fi=Fe(re());var hi=o=>{let e=250,t=[],r=0;return t[r]=[],o.forEach(i=>{t[r].length<=e?t[r].push(i):(r++,t[r]=[i])}),t},Ke=o=>{let e=[],t=200;for(;o.length>t;){let r=o.splice(0,t);e.push(r)}return e.push(o),e},A=(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},D=o=>o.filter((t,r,i)=>r===i.indexOf(t));var Ye=class{id=null;name=null;avatar=null;gender=null;country=null;birthDate=null;interests=[];followingCount=0;followersCount=0};var We=class{profilesFromResponse=e=>e?e.map(t=>this.fullProfileFromResponse(t)):null;fullProfileFromResponse=e=>{let t=new Ye;return t.id=e.id,t.name=e.name,t.avatar=e.avatar,t.gender=e.gender,t.country=e.country,t.birthDate=e.birth_date,t.interests=e.interests,t.followingCount=e.following_count,t.followersCount=e.followers_count,t}};var ze=class{nextPageStartsAfter=null;itemsPerPage=null};var ie=class{pagination=new ze};var g=class{meta=new ie;data=[]};var Qe=class{avatar=null;followingId=null;name=null;profileId=null};var Je=class{followResponse=e=>e.map(t=>this.remapResponse(t));followingFromResponse=e=>{let t=new g;return t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,t.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,t.data=e.data.map(r=>this.remapResponse(r)),t};remapResponse=e=>{let t=new Qe;return t.avatar=e.avatar,t.followingId=e.following_id,t.name=e.name,t.profileId=e.profile_id,t}};var Ze=class{avatar=null;followerId=null;name=null;profileId=null};var et=class{followersFromResponse=e=>{let t=new g;return t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,t.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,t.data=e.data.map(r=>this.remapResponse(r)),t};remapResponse=e=>{let t=new Ze;return t.avatar=e.avatar,t.followerId=e.follower_id,t.name=e.name,t.profileId=e.profile_id,t}};var Ee=class{profile_ids=[]};var Ua="/countries",T="/profile",_o="/profiles",tt=class{instanceAuth=null;instance=null;apiSignInUrl=null;profileRemapper=null;followingRemapper=null;followersRemapper=null;constructor(e){let t=A(e.environment,"profile");this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}&lang=${e.lang}`,this.instanceAuth=fi.default.create({baseURL:t,headers:{Authorization:`Bearer ${e.authProvider.getIdToken()}`,"Content-Type":"application/json"}}),this.instanceAuth.interceptors.request.use(r=>r,r=>{Promise.reject(r)}),this.instanceAuth.interceptors.response.use(r=>r,r=>{let i=r.config;if((r.response.status===403||r.response.status===401)&&!i._retry){i._retry=!0;let a=e.authProvider.getIdToken();return i.headers.Authorization=`Bearer ${a}`,this.instanceAuth(i)}return Promise.reject(r)}),this.instance=fi.default.create({baseURL:t,headers:{"Content-Type":"application/json"}}),this.profileRemapper=new We,this.followingRemapper=new Je,this.followersRemapper=new et}getCountries=async e=>{try{let t=`${Ua}${this.apiSignInUrl}`,r=Date.now();return e&&(t+=`&disable_cache=${r}`),(await this.instance.get(t)).data.data}catch(t){throw console.warn("There was a problem fetching the countries:",t),t.response}};getProfile=async e=>{let t=`${T}${this.apiSignInUrl}`;if(e){t=`${_o}/${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.response}}else try{let r=await this.instanceAuth.get(t);return this.profileRemapper.fullProfileFromResponse(r.data.data)}catch(r){throw console.warn("There was a problem fetching your profile from API:",r),r.response}};getProfiles=async(e,t)=>{try{let r=`${_o}${this.apiSignInUrl}&profile_ids=${e.join(",")}`,i=Date.now();t&&(r+=`&disable_cache=${i}`);let a=await this.instance.get(r);return this.profileRemapper.profilesFromResponse(a.data.data)}catch(r){throw console.warn(`There was a problem fetching the following profiles: ${e.join(",")}`,r),r.response}};getFollowers=async(e,t)=>{let r=`${T}/followers${this.apiSignInUrl}`;if(e&&!t){r=`${T}/followers${this.apiSignInUrl}${e.constructFilterUrl()}`;try{let i=await this.instanceAuth.get(r);return this.followersRemapper.followersFromResponse(i.data)}catch(i){throw console.warn("There was a problem fetching the followers for own profile",i),i.response}}else if(!e&&!t)try{let i=await this.instanceAuth.get(r);return this.followersRemapper.followersFromResponse(i.data)}catch(i){throw console.warn("There was a problem fetching the followers for own profile",i),i.response}e&&t?r=`${T}/${t}/followers${this.apiSignInUrl}${e.constructFilterUrl()}`:!e&&t&&(r=`${T}/${t}/followers${this.apiSignInUrl}`);try{let i=await this.instance.get(r);return this.followersRemapper.followersFromResponse(i.data)}catch(i){throw console.warn(`There was a problem fetching the followers for profile: ${t}`,i),i.response}};getFollowing=async(e,t)=>{let r=`${T}/following${this.apiSignInUrl}`;if(e&&!t){r=`${T}/following${this.apiSignInUrl}${e.constructFilterUrl()}`;try{let i=await this.instanceAuth.get(r);return this.followingRemapper.followingFromResponse(i.data)}catch(i){throw console.warn("There was a problem fetching the followers of own profile",i),i.response}}else if(!e&&!t)try{let i=await this.instanceAuth.get(r);return this.followingRemapper.followingFromResponse(i.data)}catch(i){throw console.warn("There was a problem fetching the followers of own profile",i),i.response}e&&t?r=`${T}/${t}/following${this.apiSignInUrl}${e.constructFilterUrl()}`:!e&&t&&(r=`${T}/${t}/following${this.apiSignInUrl}`);try{let i=await this.instance.get(r);return this.followingRemapper.followingFromResponse(i.data)}catch(i){throw console.warn(`There was a problem fetching the followers of the following profile: ${t}`,i),i.response}};follow=async e=>{let t=new Ee;t.profile_ids=e;try{let r=await this.instanceAuth.post(`${T}/follow${this.apiSignInUrl}`,JSON.stringify(t));return this.followingRemapper.followResponse(r.data.data)}catch(r){throw console.warn(`There was a problem with POST request for profiles: ${e.join(",")} `,r),r.response}};unfollow=async e=>{let t=new Ee;t.profile_ids=e;try{return await this.instanceAuth.delete(`${T}/follow${this.apiSignInUrl}`,{data:JSON.stringify(t)}),!0}catch(r){throw console.warn(`There was a problem with DELETE request for profiles: ${e.join(",")} `,r),r.response}};updateProfile=async e=>{try{let t=await this.instanceAuth.patch(`${T}${this.apiSignInUrl}`,e);return this.profileRemapper.fullProfileFromResponse(t.data.data)}catch(t){throw console.warn("There was a problem updating the own profile:",t),t.response}}};var G={native:"id",sportradar:"sportradar_id",sportal365:"sportal365_id",enetpulse:"enetpulse_id"};var Co="FansUnited",Oo={football:{ids:[],countries:[],competitions:[]},profile:{own:{},countries:[],expireAt:0}},V=class{idSchema="";expirationTimeout=600;constructor(e){this.idSchema=e.idSchema,(this.getData()===void 0||this.getData()===null)&&this.setData(Oo)}clearData=()=>{this.setData(Oo)};getEntityById=(e="",t="")=>this.getData().football.ids.find(r=>{let i=G[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=G[r];return i&&e.includes(`${i[a]}`)&&i.resource===t}):this.getData().football.ids.find(i=>{let a=G[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=G[t],i={};return Object.keys(e).forEach(a=>{let n=e[a],p=this.getEntity(n,a,t).map(l=>l[r]),m=e[a].filter(l=>!p.includes(l));i[a]=n.map(l=>m.includes(l)?{id:l,exists:!1}:{id:l,exists:!0})}),i};getIdsByType=(e,t,r)=>{let i=G[r],a=G[t],n={};return Object.keys(e).forEach(s=>{let p=e[s],m=[];this.getData().football.ids.forEach(l=>{p.forEach((c,f)=>{c===l[a]&&s===l.resource&&(m[f]=l[i])})}),n[s]=m}),n};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.expirationTimeout,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)};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)};getExpirationProfile=()=>this.getData().profile.expireAt;getData=()=>JSON.parse(localStorage.getItem(Co));setData=e=>{localStorage.setItem(Co,JSON.stringify(e))}};var xo=Fe(re());var _e={player:"players",team:"teams",homeTeam:"teams",awayTeam:"teams",country:"countries",competition:"competitions",match:"matches"},rt=class{instance=null;apiSignInUrl="";constructor(e){let t=A(e.environment,"idMapping");this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}`,this.instance=xo.default.create({baseURL:t})}getEntityById=(e,t)=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${config.idSchema}&${_e[e]}=${t}`)}catch(r){throw console.warn(`There was a problem with id mapping request for the following id:${t}`,r),r.response}};getEntityByIdAndSchema=(e,t,r)=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${r}&${_e[e]}=${t}`)}catch(i){throw console.warn(`There was a problem with id mapping request for the following id:${t}`,i),i.response}};getEntityIdsByIdsAndSchema=(e,t,r)=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${r}&${_e[e]}=${t.join(",")}`)}catch(i){throw console.warn(`There was a problem with id mapping request for the following ids:${t.join(",")}`,i),i.response}};getEntitiesByIds=(e,t,r)=>{t.sort((n,s)=>n.localeCompare(s));let a=hi(t).map(n=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${r}&${_e[e]}=${n.join(",")}`)}catch(s){throw console.warn(`There was a problem with id mapping request for the following ids:${n.join(",")}`,s),s.response}});return Promise.all(a).then(n=>{let s=[];return n.forEach(p=>{s.push(...p.data.data)}),s})};getEntitiesByIdObjs=async(e,t)=>{let r=[],i={},a=[];Object.keys(e).forEach(m=>{r.push.apply(r,e[m])});let n=D(r),s=hi(n);for(let m of s){let l="";if(Object.keys(e).forEach(c=>{i[c]=[];let f=m.filter(L=>e[c].includes(L));f&&f.length>0&&(i[c]=f)}),Object.keys(i).forEach(c=>{i[c].length>0&&(i[c].sort((f,L)=>f.localeCompare(L)),l+="&",l+=`${_e[c]}=${i[c].join(",")}`)}),l&&l.length>0)try{let c=await this.instance.get(`/football${this.apiSignInUrl}&input_provider=${t||"native"}${l}`);a.push(c.data.data)}catch(c){throw console.warn("There was a problem with id mapping request",c),c.response}else a.push([])}return Array.prototype.concat.apply([],a)}};var it=class{isBrowser=!1;localStorage=null;https=null;constructor(e){this.isBrowser=typeof window!="undefined",this.localStorage=new V(e),this.https=new rt(e)}getEntitiesByIds=async(e,t,r)=>{if(this.isBrowser)try{let i=this.localStorage.checkForExistingIdObjs(e,t),a=this.splitForRequestAndExisting(i),n=await this.https.getEntitiesByIdObjs(a.request,t);return this.localStorage.addIdMappings(n),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(n=>n.resource===a).map(n=>n[G[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 ot=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 at=class{extractedObjIds={};traverse=(e,t)=>(t=ot(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 nt=class{replaceObjIdsIndex=null;remappedIdsObj={};traverse=(e,t,r)=>(t=ot(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 E=class{idSchema="";idMappingFacade=null;constructor(e){this.idSchema=e.idSchema,this.idMappingFacade=new it(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 at().traverse(r,t);return this.idMappingFacade.getEntitiesByIds(a,"native",this.idSchema).then(n=>new nt().traverse(r,t,n))}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 F=class{completed=!1;percentage;constructor(e){this.percentage=e}};var st=class{teamFollowed=new F(10);teamFavourite=new F(15);playerFollowed=new F(10);playerFavourite=new F(10);competitionFollowed=new F(10);competitionFavourite=new F(5);addedBirthdate=new F(10);addedGender=new F(10);addedCountry=new F(10);addedAvatar=new F(10)};var lt=class{totalPercentage;breakdown=new st};var Oe=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 $=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.getExpirationProfile(),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,t)=>{try{return t=t||!1,await this.https.getProfiles(e,t)}catch(r){throw console.warn(`There was a problem retrieving the selected profiles: ${e.join(",")} `,r),r}};getById=async e=>{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 e=>{if(e=e||!1,this.isBrowser){let t=this.localStorage.getProfileCountries();if(t&&t.length>0)return t;try{let r=await this.https.getCountries(e);return this.localStorage.setProfileCountries(r),r}catch(r){throw console.warn("There was a problem retrieving profile countries: ",r),r}}else try{return await this.https.getCountries(e)}catch(t){throw console.warn("There was a problem retrieving profile countries: ",t),t}};getFollowers=async(e,t)=>{try{return e&&(e=new Oe(e)),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 e&&(e=new Oe(e)),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 lt,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(l=>l.type==="team"&&l.favourite)&&(t.breakdown.teamFavourite.completed=!0,r+=t.breakdown.teamFavourite.percentage),e.interests.find(l=>l.type==="team")&&(t.breakdown.teamFollowed.completed=!0,r+=t.breakdown.teamFollowed.percentage),e.interests.find(l=>l.type==="player"&&l.favourite)&&(t.breakdown.playerFavourite.completed=!0,r+=t.breakdown.playerFavourite.percentage),e.interests.find(l=>l.type==="player")&&(t.breakdown.playerFollowed.completed=!0,r+=t.breakdown.playerFollowed.percentage),e.interests.find(l=>l.type==="competition"&&l.favourite)&&(t.breakdown.competitionFavourite.completed=!0,r+=t.breakdown.competitionFavourite.percentage),e.interests.find(l=>l.type==="competition")&&(t.breakdown.competitionFollowed.completed=!0,r+=t.breakdown.competitionFollowed.percentage)),t.totalPercentage=r,t}};var pt=class{id=null;name=null;assets=null};var ct=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 e=>{try{let t=await this.getCountries(e);return this.idMapping.remapEntities(t,"country")}catch(t){throw console.warn("There was a problem browsing countries as football entities",t),t}};getCountries=async e=>{if(e=e||!1,this.isBrowser){let t=this.localStorage.getFootballCountries();if(t&&t.length>0)return t;try{let r=await this.https.getCountries(e);return this.localStorage.setFootballCountries(r),r}catch(r){throw console.warn("There was a problem retrieving countries as football entities",r),r}}else return this.https.getCountries(e)}};var mt=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(n=>r.id===n):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 ut=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,t)=>{try{let r=!1;if(e){if(e=new mt(e),e.countryId){let a=await this.idMapping.getEntityIdsBySchemaId([`${e.countryId}`],"country","native");a.country.length===0&&(r=!0),e.countryId=a.country[0]}if(e.competitionIds){let a=await this.idMapping.getEntityIdsBySchemaId(e.competitionIds,"competition","native");a.competition.length===0&&(r=!0),e.competitionIds=a.competition}if(r)return[]}let i=await this.getCompetitions(e,t);return await this.idMapping.remapEntities(i,"competition")}catch(r){throw console.warn("There was a problem browsing all of the competitions",r),r}};getCompetitions=async(e,t)=>{if(t=t||!1,this.isBrowser){let r=this.localStorage.getCompetitions(e);if(r&&r.length>0)return r;try{let i=await this.https.getCompetitions(e,t);return this.localStorage.setCompetitions(i),this.localStorage.getCompetitions(e)}catch(i){throw console.warn("There was a problem retrieving all competitions",i),i}}else return this.https.getCompetitions(e,t)};getCompetitionByIdIdMapping=async(e,t)=>{try{let i=(await this.idMapping.getEntityIdsBySchemaId([e],"competition","native")).competition[0],a=await this.getCompetitionById(i,t);return await this.idMapping.remapEntities(a,"competition")}catch(r){throw console.warn(`There was a problem browsing the following competition:${e}`,r),r}};getCompetitionById=async(e,t)=>{try{return t=t||!1,await this.https.getCompetitionById(e,t)}catch(r){throw console.warn(`There was a problem retrieving the competition with the following id: ${e}`,r),r}};getTopCompetitionsIdMapping=async e=>{try{let t=await this.getTopCompetitions(e);return await this.idMapping.remapEntities(t,"competition")}catch(t){throw console.warn("There was a problem browsing the top competitions",t),t}};getTopCompetitions=async e=>{try{return e=e||!1,await this.https.getTopCompetitions(e)}catch(t){throw console.warn("There was a problem retrieving the top competitions",t),t}}};var dt=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 ht=class{https=null;idMapping=null;constructor(e,t){this.idMapping=t,this.https=e}getTeamsIdMapping=async(e,t)=>{try{let r=!1;if(e){if(e=new dt(e),e.countryId){let a=await this.idMapping.getEntityIdsBySchemaId([`${e.countryId}`],"country","native");a.country.length===0&&(r=!0),e.countryId=a.country[0]}if(e.scope){let a=await this.idMapping.getEntityIdsBySchemaId(e.scope,"competition","native");a.competition.length===0&&(r=!0),e.scope=a.competition}if(e.teamIds){let a=await this.idMapping.getEntityIdsBySchemaId(e.teamIds,"team","native");a.team.length===0&&(r=!0),e.teamIds=a.team}}if(r)return[];let i=await this.getTeams(e,t);return i.data=await this.idMapping.remapEntities(i.data,"team"),i}catch(r){throw console.warn("There was a problem browsing all teams",r),r}};getTeams=async(e,t)=>{try{return t=t||!1,await this.https.getTeams(e,t)}catch(r){throw console.warn("There was a problem retrieving all teams",r),r}};getTeamByIdIdMapping=async(e,t)=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"team","native")).team[0];let i=await this.getTeamById(e,t);return await this.idMapping.remapEntities(i,"team")}catch(r){throw console.warn(`There was a problem browsing the following team:${e}`,r),r}};getTeamById=async(e,t)=>{try{return t=t||!1,await this.https.getTeamById(e,t)}catch(r){throw console.warn(`There was a problem retrieving the following team: ${e}`,r),r}};getTopTeamsIdMapping=async e=>{try{let t=await this.getTopTeams(e);return await this.idMapping.remapEntities(t,"team")}catch(t){throw console.warn("There was a problem browsing the top teams",t),t}};getTopTeams=async e=>{try{return e=e||!1,await this.https.getTopTeams(e)}catch(t){throw console.warn("There was a problem retrieving the top teams",t),t}};getNextMatchForTeamIdMapping=async(e,t)=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"team","native")).team[0];let i=await this.getNextMatchForTeam(e,t);return await this.idMapping.remapEntities(i,"match")}catch(r){throw console.warn(`There was a problem browsing the next match for the following team:${e}`,r),r}};getNextMatchForTeam=async(e,t)=>{try{return t=t||!1,await this.https.getNextMatchForTeam(e,t)}catch(r){throw console.warn(`There was a problem retrieving the next match for the following team: ${e}`,r),r}};getPrevMatchForTeamIdMapping=async(e,t)=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"team","native")).team[0];let i=await this.getPrevMatchForTeam(e,t);return await this.idMapping.remapEntities(i,"match")}catch(r){throw console.warn(`There was a problem browsing the previous match for the following team:${e}`,r),r}};getPrevMatchForTeam=async(e,t)=>{try{return t=t||!1,await this.https.getPrevMatchForTeam(e,t)}catch(r){throw console.warn(`There was a problem retrieving the previous match for the following team: ${e}`,r),r}}};var xe=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 H=class{https=null;idMapping=null;constructor(e,t){this.idMapping=t,this.https=e}getPlayersIdMapping=async(e,t)=>{try{let r=!1;if(e){if(e=new xe(e),e.countryId){let a=await this.idMapping.getEntityIdsBySchemaId([e.countryId],"country","native");a.country.length===0&&(r=!0),e.countryId=a.country[0]}if(e.playerIds){let a=await this.idMapping.getEntityIdsBySchemaId(e.playerIds,"player","native");a.player.length===0&&(r=!0),e.playerIds=a.player}if(e.scope){let a=await this.idMapping.getEntityIdsBySchemaId(e.scope,"competition","native");a.competition.length===0&&(r=!0),e.scope=a.competition}if(r)return[]}let i=await this.getPlayers(e,t);return i.data=await this.idMapping.remapEntities(i.data,"player"),i}catch(r){throw console.warn("There was a problem browsing the players",r),r}};getPlayersWithNativeIds=async e=>{let t=new xe({playerIds:e}),r=await this.getPlayers(t);return r.data.sort((i,a)=>i.id.localeCompare(a.id)),await this.idMapping.remapEntities(r.data,"player")};getPlayersMapWithNativeIds=async e=>{let t={},r=D(e);r.sort((a,n)=>a.localeCompare(n));let i=await this.getPlayersWithNativeIds(r);return r.forEach((a,n)=>t[a]=i[n]),t};getPlayers=async(e,t)=>{try{return t=t||!1,await this.https.getPlayers(e,t)}catch(r){throw console.warn("There was a problem retrieving the players",r),r}};getPlayerIdMapping=async(e,t)=>{try{let r=await this.idMapping.getEntityIdsBySchemaId([e],"player","native"),i=await this.getPlayerById(r.player[0],t);return await this.idMapping.remapEntities(i,"player")}catch(r){throw console.warn(`There was a problem browsing the following player:${e}`,r),r}};getPlayerById=async(e,t)=>{try{return t=t||!1,await this.https.getPlayerById(e,t)}catch(r){throw console.warn(`There was a problem retrieving the following player: ${e}`,r),r}};getTopPlayersIdMapping=async e=>{try{let t=await this.getTopPlayers(e);return await this.idMapping.remapEntities(t,"player")}catch(t){throw console.warn("There was a problem browsing the top players",t),t}};getTopPlayers=async e=>{try{return e=e||!1,await this.https.getTopPlayers(e)}catch(t){throw console.warn("There was a problem retrieving the top players",t),t}};getNextMatchForPlayerIdMapping=async(e,t)=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"player","native")).player[0];let i=await this.getNextMatchForPlayer(e,t);return await this.idMapping.remapEntities(i,"match")}catch(r){throw console.warn(`There was a problem browsing the next match for player:${e}`,r),r}};getNextMatchForPlayer=async(e,t)=>{try{return t=t||!1,await this.https.getNextMatchForPlayer(e,t)}catch(r){throw console.warn(`There was a problem retrieving the next match for player: ${e}`,r),r}};getPrevMatchForPlayerIdMapping=async(e,t)=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"player","native")).player[0];let i=await this.getPrevMatchForPlayer(e,t);return await this.idMapping.remapEntities(i,"match")}catch(r){throw console.warn(`There was a problem browsing the previous match for player:${e}`,r),r}};getPrevMatchForPlayer=async(e,t)=>{try{return t=t||!1,await this.https.getPrevMatchForPlayer(e,t)}catch(r){throw console.warn(`There was a problem retrieving the previous match for player: ${e}`,r),r}}};var Ae=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 k=class{https=null;idMapping=null;constructor(e,t){this.https=e,this.idMapping=t}getMatchesIdMapping=async(e,t)=>{try{if(e){if(e=new Ae(e),e.countryIds){let i=await this.idMapping.getEntityIdsBySchemaId(e.countryIds,"country","native");e.countryIds=i.country}if(e.competitionIds){let i=await this.idMapping.getEntityIdsBySchemaId(e.competitionIds,"competition","native");e.competitionIds=i.competition}if(e.matchIds){let i=await this.idMapping.getEntityIdsBySchemaId(e.matchIds,"match","native");e.matchIds=i.match}if(e.teamIds){let i=await this.idMapping.getEntityIdsBySchemaId(e.teamIds,"team","native");e.teamIds=i.team}}let r=await this.getMatches(e,t);return r.data=await this.idMapping.remapEntities(r.data,"match"),r}catch(r){throw console.warn("There was a problem browsing the matches",r),r}};getMatchesWithNativeIds=async e=>{let t=new Ae({matchIds:e}),r=await this.getMatches(t);return r.data.sort((i,a)=>i.id.localeCompare(a.id)),await this.idMapping.remapEntities(r.data,"match")};getMatchesMapWithNativeIds=async e=>{let t={},r=D(e);r.sort((a,n)=>a.localeCompare(n));let i=await this.getMatchesWithNativeIds(r);return r.forEach((a,n)=>t[a]=i[n]),t};getMatches=async(e,t)=>{try{return t=t||!1,await this.https.getMatches(e,t)}catch(r){throw console.warn("There was a problem retrieving the matches",r),r}};getMatchIdMapping=async(e,t)=>{try{let r=await this.idMapping.getEntityIdsBySchemaId([e],"match","native"),i=await this.getMatchById(r.match[0],t);return await this.idMapping.remapEntities(i,"match")}catch(r){throw console.warn(`There was a problem browsing the following match: ${e}`,r),r}};getMatchById=async(e,t)=>{try{return t=t||!1,await this.https.getMatchById(e,t)}catch(r){throw console.warn(`There was a problem retrieving the following match: ${e}`,r),r}}};var ft=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 gt=class{https=null;idMapping=null;constructor(e,t){this.https=e,this.idMapping=t}searchIdMapping=async(e,t)=>{try{if(e=new ft(e),e.scope){let i=await this.idMapping.getEntityIdsBySchemaId(e.scope,"competition","native");e.scope=i.competition}let r=await this.search(e,t);if(r.teams&&r.teams.length>0){let i=await this.idMapping.remapEntities(r.teams,"team");r.teams=i}if(r.players&&r.players.length>0){let i=await this.idMapping.remapEntities(r.players,"player");r.players=i}if(r.competitions&&r.competitions.length>0){let i=await this.idMapping.remapEntities(r.competitions,"competition");r.competitions=i}return r}catch(r){throw console.warn("There was a problem with browsing the search result",r),r}};search=async(e,t)=>{try{return await this.https.search(e,t)}catch(r){throw console.warn("There was a problem retrieving the search response",r),r}}};var q=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 ct(e,t,r),this.competitionsFacade=new ut(e,t,r),this.teamsFacade=new ht(t,r),this.playerFacade=new H(t,r),this.matchFacade=new k(t,r),this.searchFacade=new gt(t,r)}getCountries=async e=>this.countriesFacade.getCountriesWithIdMapping(e);getCompetitions=async(e,t)=>this.competitionsFacade.getCompetitionsIdMapping(e,t);getCompetitionById=async(e,t)=>this.competitionsFacade.getCompetitionByIdIdMapping(e,t);getTopCompetitions=async e=>this.competitionsFacade.getTopCompetitionsIdMapping(e);getTeams=async(e,t)=>this.teamsFacade.getTeamsIdMapping(e,t);getTeamById=async(e,t)=>this.teamsFacade.getTeamByIdIdMapping(e,t);getTopTeams=async e=>this.teamsFacade.getTopTeamsIdMapping(e);getNextMatchForTeam=async(e,t)=>this.teamsFacade.getNextMatchForTeamIdMapping(e,t);getPrevMatchForTeam=async(e,t)=>this.teamsFacade.getPrevMatchForTeamIdMapping(e,t);getPlayers=async(e,t)=>this.playerFacade.getPlayersIdMapping(e,t);getPlayerById=async(e,t)=>this.playerFacade.getPlayerIdMapping(e,t);getTopPlayers=async e=>this.playerFacade.getTopPlayersIdMapping(e);getNextMatchForPlayer=async(e,t)=>this.playerFacade.getNextMatchForPlayerIdMapping(e,t);getPrevMatchForPlayer=async(e,t)=>this.playerFacade.getPrevMatchForPlayerIdMapping(e,t);getMatches=async(e,t)=>this.matchFacade.getMatchesIdMapping(e,t);getMatchById=async(e,t)=>this.matchFacade.getMatchIdMapping(e,t);search=async(e,t)=>this.searchFacade.searchIdMapping(e,t)};var oe=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(s=>{r.hasOwnProperty(s.type)||(r[s.type]=[],i[s.type]=[]),r[s.type].push(s.id),i[s.type].push(s)});let a=await this.idMapping.idMappingFacade.getEntitiesByIds(r,"native",t),n=[];for(let[s,p]of Object.entries(i))p.forEach((m,l)=>{m.id=a[s][l],n.push(m)});return n}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 n=await this.idMapping.idMappingFacade.getEntitiesByIds(r,t,"native");return e.id=n[a][0],e}return e};inquiryCustomInterests=async e=>{let t=[];if(e&&e.length>0&&(t=e.filter(r=>r.source==="custom")),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=[];if(e&&e.length>0)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.data[0]}if(r.type==="player"){i.playerIds=[r.id];let a=await this.footballFacade.getPlayers(i);r.model=a.data[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};updateInterests=(e,t)=>{if(e.length===t.length){let r=t.filter(a=>e.some(n=>a.id===n.id&&a.type===n.type&&a.source===n.source&&a.favourite===n.favourite)),i=t.filter(a=>!e.some(n=>a.id===n.id&&a.type===n.type&&a.source===n.source&&a.favourite===n.favourite));return[...r,...i]}else return t}};var yt=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 q(e,i,r),this.interestsService=new oe(r,this.footballFacade),this.profileFacade=new $(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;try{let t=await this.profileFacade.getOwn();this.setOwnProfile(t)}catch{this.isFetching=!1}return this.modified=!1,this.isFetching=!1,this.ownProfile}return this.ownProfile};delay=e=>new Promise(t=>{setTimeout(t,e)});setOwnProfile=e=>{this.ownProfile=e};extractUpdatedProps=(e,t)=>{let r={};return Object.keys(e).forEach(i=>{i==="gender"&&e[i]!==t[i]?r[i]=t[i]:i==="birthDate"?(t[i]===null||e[i]===null&&t[i]||e[i]!==t[i])&&(r.birth_date=t[i]):i==="country"?t[i]===null?r.country_id=t[i]:(e[i]===null&&t[i]||e[i].id!==t[i].id)&&(r.country_id=t[i].id):i==="interests"&&t[i]&&t[i].length>0&&(r[i]=this.interestsService.updateInterests(e[i],t[i]))}),r};getInfo=async()=>{let e=await this.getOwnProfile(),t=JSON.parse(JSON.stringify(e));return delete t.interests,t};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 pt,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(),t=JSON.parse(JSON.stringify(e));return this.profileFacade.showFullnessProfile(t)};update=async()=>{if(this.promises.length===0)return this.ownProfile;await Promise.all(this.promises);let e=await this.profileFacade.getOwn(),t=await this.getOwnProfile(),r=this.extractUpdatedProps(e,t),i=await this.profileHttps.updateProfile(r);return this.modified=!1,this.expireAt=0,this.localStorage.setOwnProfile(i),delete i.interests,i}};var Mt=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 oe(r,i),this.profileFacade=new $(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 Ao=Fe(re());var wt=class{id="";alias="";countryCode="";assets=null;name=""};var y=class{countriesFromResponse=e=>{if(e)return e.map(t=>this.countryFromResponse(t))};countryFromResponse=e=>{try{if(e){let t=new wt;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 bt=class{id="";country=null;gender="";assets=null;type="";name=""};var I=class{countryRemapper=null;constructor(){this.countryRemapper=new y}fromResponse(e){try{let t=new bt;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 Pt=class{id="";country=null;gender="";assets=null;type="";name="";participants=[]};var It=class{id="";country=null;gender="";assets=null;name="";code="";national=!1;fullName="";shortName=""};var w=class{countryRemapper=null;constructor(){this.countryRemapper=new y}fromResponse(e){try{let t=new It;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 Rt=class{countryRemapper=null;teamBasicRemapper=null;constructor(){this.countryRemapper=new y,this.teamBasicRemapper=new w}fromResponse(e){try{let t=new Pt;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 Ft=class{id="";country=null;gender="";assets=null;name="";competitions=[];code="";national=!1;fullName="";shortName="";squad=[]};var vt=class{id="";startDate="";endDate="";shirtNumber;loan=!1;position="";country=null;name="";assets=null;birthDate=""};var St=class{countryRemapper=null;constructor(){this.countryRemapper=new y}fromResponse(e){try{let t=new vt;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 Tt=class{countryRemapper=null;competitionRemapper=null;playerRemapper=null;constructor(){this.countryRemapper=new y,this.competitionRemapper=new I,this.playerRemapper=new St}fromResponse(e){try{let t=new Ft;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 Et=class{id="";kickoffAt="";finishedAt="";updatedAt="";homeTeam=null;awayTeam=null;lineupsConfirmed=!1;startedAt="";minute="";scores=null;context={competition:null};status={type:null,subType:null}};var _t=class{ftScore=null;htScore=null;aetScore=null;aggScore=null;penScore=null};var ae=class{fromResponse(e){try{let t=new _t;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 Ct=class{teamRemapper=null;competitionRemapper=null;scoresRemapper=null;constructor(){this.teamRemapper=new w,this.competitionRemapper=new I,this.scoresRemapper=new ae}fromResponse(e){try{let t=new Et;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 Ot=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 xt=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 At=class{fromResponse(e){try{let t=new xt;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 ne=class{homeTeam={players:[]};awayTeam={players:[]}};var Bt=class{id="";name="";position="";shirtNumber;assets=null;type=""};var se=class{fromResponse(e){try{let t=new Bt;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 Nt=class{playerRemapper=null;constructor(){this.playerRemapper=new se}fromResponse(e){try{let t=new ne;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 Lt=class{minute="";type="";teamId="";player=null;relatedPlayer=null;updatedAt=""};var Gt=class{playerRemapper=null;constructor(){this.playerRemapper=new se}fromResponse(e){try{let t=new Lt;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 Ut=class{teamMapper=null;competitionsMapper=null;lineupsMapper=null;scoresMapper=null;statsMapper=null;timelineMapper=null;constructor(){this.teamMapper=new w,this.competitionsMapper=new I,this.lineupsMapper=new Nt,this.scoresMapper=new ae,this.statsMapper=new At,this.timelineMapper=new Gt}fromResponse(e){try{let t=new Ot;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 ne,t}catch(t){throw console.warn("There was a problem remapping the match response",t),t}}};var Dt=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null};var Vt=class{countryRemapper=null;constructor(){this.countryRemapper=new y}fromResponse(e){try{let t=new Dt;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 $t=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;teams=[]};var le=class{countryRemapper=null;teamRemapper=null;constructor(){this.countryRemapper=new y,this.teamRemapper=new w}fromResponse(e){try{let t=new $t;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 Ht=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;competitions=[];teams=[]};var kt=class{countryRemapper=null;teamRemapper=null;competitionRemapper=null;constructor(){this.countryRemapper=new y,this.teamRemapper=new w,this.competitionRemapper=new I}fromResponse(e){try{let t=new Ht;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 qt=class{teams=null;players=null;competitions=null};var jt=class{teamRemapper=null;playerRemapper=null;competitionremapper=null;constructor(){this.teamRemapper=new w,this.playerRemapper=new le,this.competitionremapper=new I}fromResponse(e){try{let t=new qt;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 Xt=class{currentPage=null;itemsPerPage=null;totalItems=null;numberOfPages=null};var pe=class{pagination=new Xt};var ce=class{meta=new pe;data=[]};var Kt=class{remapMetaProp=e=>{let t=new pe;return t.pagination.currentPage=e.pagination.current_page,t.pagination.itemsPerPage=e.pagination.items_per_page,t.pagination.totalItems=e.pagination.total_items,t.pagination.numberOfPages=e.pagination.number_of_pages,t}};var B=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;footballMetaRemapper=null;constructor(e){let t=A(e.environment,"football");this.apiSignInUrl=`?key=${e.apiKey}&lang=${e.lang}&client_id=${e.clientId}`,this.idSchema=e.idSchema,this.instance=Ao.default.create({baseURL:t}),this.countryRemapper=new y,this.competitionBasicRemapper=new I,this.competitionFullRemapper=new Rt,this.teamBasicRemapper=new w,this.teamFullRemapper=new Tt,this.matchBasicRemapper=new Ct,this.matchFullRemapper=new Ut,this.playerBasicRemapper=new le,this.playerFullRemapper=new kt,this.topPlayerRemapper=new Vt,this.searchRemapper=new jt,this.footballMetaRemapper=new Kt}getCountries=async e=>{try{let t=`/countries${this.apiSignInUrl}`,r=Date.now();e&&(t+=`&disable_cache=${r}`);let i=await this.instance.get(t);return this.countryRemapper.countriesFromResponse(i.data.data)}catch(t){throw console.warn("There was a problem with the football countries request",t),t}};getCompetitions=async(e,t)=>{try{let r={},i=Date.now();if(t=t||!1,e&&e.competitionIds&&e.competitionIds.length>this.limitIds-1){let a=[],n=Ke(e.competitionIds);for(let p of n){e.competitionIds=p;let m=`/competitions${this.apiSignInUrl}${e.constructFilterUrl()}`;t&&(m+=`&disable_cache=${i}`),r=await this.instance.get(m),a.push(r.data.data.map(l=>this.competitionBasicRemapper.fromResponse(l)))}return Array.prototype.concat.apply([],a)}else{let a=`/competitions${this.apiSignInUrl}`;return e&&(a+=`${e.constructFilterUrl()}`),t&&(a+=`&disable_cache=${i}`),r=await this.instance.get(a),r.data.data.map(n=>this.competitionBasicRemapper.fromResponse(n))}}catch(r){throw console.warn("There was a problem with getCompetitions request",r),r.response}};getCompetitionById=async(e,t)=>{try{let r=`/competitions/${e}${this.apiSignInUrl}`,i=Date.now();t&&(r+=`&disable_cache=${i}`);let a=await this.instance.get(r);return this.competitionFullRemapper.fromResponse(a.data.data)}catch(r){throw console.warn("There was a problem with getCompetitionById request",r),r.response}};getTopCompetitions=async e=>{try{let t=`/competitions/top${this.apiSignInUrl}`,r=Date.now();return e&&(t+=`&disable_cache=${r}`),(await this.instance.get(t)).data.data.map(a=>this.competitionBasicRemapper.fromResponse(a))}catch(t){throw console.warn("There was a problem with getTopCompetitions request",t),t.response}};getTeams=async(e,t)=>{try{let r={},i=Date.now();if(e&&e.teamIds&&e.teamIds.length>this.limitIds){let a=[],n=Ke(e.teamIds);for(let p of n){e.teamIds=p;let m=`/teams${this.apiSignInUrl}${e.constructFilterUrl()}`;t&&(m+=`disable_cache=${i}`),r=await this.instance.get(m),a.push(r.data.data.map(l=>this.teamBasicRemapper.fromResponse(l)))}return Array.prototype.concat.apply([],a)}else{let a=new ce,n=`/teams${this.apiSignInUrl}`;return e&&(n+=`${e.constructFilterUrl()}`),t&&(n+=`&disable_cache=${i}`),r=await this.instance.get(n),a.meta=this.footballMetaRemapper.remapMetaProp(r.data.meta),a.data=r.data.data.map(s=>this.teamBasicRemapper.fromResponse(s)),a}}catch(r){throw console.warn("There was a problem with getTeams request",r),r.response}};getTeamById=async(e,t)=>{try{let r=`/teams/${e}${this.apiSignInUrl}`,i=Date.now();t&&(r+=`disable_cache=${i}`);let a=await this.instance.get(r);return this.teamFullRemapper.fromResponse(a.data.data)}catch(r){throw console.warn("There was a problem with getTeamById request",r),r.response}};getTopTeams=async e=>{try{let t=`/teams/top${this.apiSignInUrl}`,r=Date.now();e&&(t+=`$disable_cache=${r}`);let i=await this.instance.get(t);return i.data.data?i.data.data.map(a=>this.teamBasicRemapper.fromResponse(a)):[]}catch(t){throw console.warn("There was a problem with getTopTeams request",t),t.response}};getNextMatchForTeam=async(e,t)=>{try{let r=`/teams/${e}/next-match${this.apiSignInUrl}`,i=Date.now();t&&(r+=`&disable_cache=${i}`);let a=await this.instance.get(r);return this.matchFullRemapper.fromResponse(a.data.data)}catch(r){throw console.warn("There was a problem with getNextMatchForTeam request",r),r.response}};getPrevMatchForTeam=async(e,t)=>{try{let r=`/teams/${e}/previous-match${this.apiSignInUrl}`,i=Date.now();t&&(r+=`disable_cache=${i}`);let a=await this.instance.get(r);return this.matchFullRemapper.fromResponse(a.data.data)}catch(r){throw console.warn("There was a problem with getPrevMatchForTeam request",r),r.response}};getPlayers=async(e,t)=>{try{let r={},i=Date.now();if(e&&e.playerIds&&e.playerIds.length>this.limitIds-1){let a=[],n=Ke(e.playerIds);for(let p of n){e.playerIds=p;let m=`/players${this.apiSignInUrl}${e.constructFilterUrl()}`;t&&(m+=`&disable_cache=${i}`),r=await this.instance.get(m),a.push(r.data.data.map(l=>this.teamBasicRemapper.fromResponse(l)))}return Array.prototype.concat.apply([],a)}else{let a=new ce,n=`/players${this.apiSignInUrl}`;return e&&(n+=`${e.constructFilterUrl()}`),t&&(n+=`&disable_cache=${i}`),r=await this.instance.get(n),a.meta=this.footballMetaRemapper.remapMetaProp(r.data.meta),a.data=r.data.data.map(s=>this.playerBasicRemapper.fromResponse(s)),a}}catch(r){throw console.warn("There was a problem with getPlayers request",r),r.response}};getPlayerById=async(e,t)=>{try{let r=`/players/${e}${this.apiSignInUrl}`,i=Date.now();t&&(r+=`&disable_cache=${i}`);let a=await this.instance.get(r);return this.playerFullRemapper.fromResponse(a.data.data)}catch(r){throw console.warn("There was a problem with getPlayerById request",r),r.response}};getTopPlayers=async e=>{try{let t=`/players/top${this.apiSignInUrl}`,r=Date.now();return e&&(t+=`&disable_cache=${r}`),(await this.instance.get(t)).data.data.map(a=>this.topPlayerRemapper.fromResponse(a))}catch(t){throw console.warn("There was a problem with getTopPlayers request",t),t.response}};getNextMatchForPlayer=async(e,t)=>{try{let r=`/players/${e}/next-match${this.apiSignInUrl}`,i=Date.now();t&&(r+=`&disable_cache=${i}`);let a=await this.instance.get(r);return this.matchFullRemapper.fromResponse(a.data.data)}catch(r){throw console.warn("There was a problem with getNextMatchForPlayer request",r),r.response}};getPrevMatchForPlayer=async(e,t)=>{try{let r=`/players/${e}/previous-match${this.apiSignInUrl}`,i=Date.now();t&&(r+=`&disable_cache=${i}`);let a=await this.instance.get(r);return this.matchFullRemapper.fromResponse(a.data.data)}catch(r){throw console.warn("There was a problem with getPrevMatchForPlayer request",r),r.response}};getMatchById=async(e,t)=>{try{let r=`/matches/${e}${this.apiSignInUrl}`,i=Date.now();t&&(r+=`&disable_cache=${i}`);let a=await this.instance.get(r);return this.matchFullRemapper.fromResponse(a.data.data)}catch(r){throw console.warn("There was a problem with getMatchById request",r),r.response}};getMatches=async(e,t)=>{try{let r=new ce,i=`/matches${this.apiSignInUrl}`,a=Date.now();e&&(i+=`${e.constructFilterUrl()}`),t&&(i+=`&disable_cache=${a}`);let n=await this.instance.get(i);return r.meta=this.footballMetaRemapper.remapMetaProp(n.data.meta),r.data=n.data.data.map(s=>this.matchBasicRemapper.fromResponse(s)),r}catch(r){throw console.warn("There was a problem with getMatches request",r),r.response}};search=async(e,t)=>{try{let r=`/search${this.apiSignInUrl}${e.constructFilterUrl()}`,i=Date.now();t&&(r+=`&disable_cache=${i}`);let a=await this.instance.get(r);return this.searchRemapper.fromResponse(a.data.data)}catch(r){throw console.warn("There was a problem with search request",r),r.response}}};var Yt=class{profileHttps=null;footballHttps=null;footballFacade=null;idMapping=null;localStorage=null;profileFacade=null;ownProfileBuilder=null;profileBuilder=null;constructor(e){this.profileHttps=new tt(e),this.footballHttps=new B(e),this.idMapping=new E(e),this.localStorage=new V(e),this.footballFacade=new q(this.localStorage,this.footballHttps,this.idMapping),this.profileFacade=new $(this.localStorage,this.profileHttps),this.ownProfileBuilder=new yt(this.localStorage,this.profileHttps,this.idMapping,this.footballHttps),this.profileBuilder=new Mt(this.localStorage,this.profileHttps,this.idMapping,this.footballFacade)}getOwn=()=>this.ownProfileBuilder;getById=e=>this.profileBuilder.setId(e);getCountries=async e=>await this.profileFacade.getCountries(e);getByIds=async(e,t)=>await this.profileFacade.getByIds(e,t)};var Wt=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 zt=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 Qt=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 Jt=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 Ne=class{getIdToken=null;logout=null};var de=class{text=null;type=null};var Zt=class{validation=null;message=new de;getIdToken={validation:null,message:new de};logout={validation:null,message:new de}};var er=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 Ne),r=new Zt;if(e){let a=Object.keys(e).filter(n=>!t.includes(n));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 Ne).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 Le=class{validation;message};var tr=class{apiKey=null;environment=null;idSchema=null;clientId=null;lang=null;authProvider={getIdToken:new Le,logout:new Le};isValid=!1};var rr=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 ir=class{validate=e=>{let t=this.checkFieldsForValues(e);return t.isValid=this.containsErrorMessage(t),t};checkFieldsForValues=e=>{let t=new tr,r={apiKey:new Qt,environment:new zt,idSchema:new Jt,clientId:new rr,lang:new Wt,authProvider:new er};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 or=class{https=null;idMapping=null;localStorage=null;footballFacade=null;constructor(e){this.https=new B(e),this.idMapping=new E(e),this.localStorage=new V(e),this.footballFacade=new q(this.localStorage,this.https,this.idMapping)}getCountries=async e=>await this.footballFacade.getCountries(e);getCompetitions=async(e,t)=>await this.footballFacade.getCompetitions(e,t);getCompetitionById=async(e,t)=>await this.footballFacade.getCompetitionById(e,t);getTopCompetitions=async e=>await this.footballFacade.getTopCompetitions(e);getTeams=async(e,t)=>await this.footballFacade.getTeams(e,t);getTeamById=async(e,t)=>await this.footballFacade.getTeamById(e,t);getTopTeams=async e=>await this.footballFacade.getTopTeams(e);getNextMatchForTeam=async(e,t)=>await this.footballFacade.getNextMatchForTeam(e,t);getPrevMatchForTeam=async(e,t)=>await this.footballFacade.getPrevMatchForTeam(e,t);getPlayers=async(e,t)=>await this.footballFacade.getPlayers(e,t);getPlayerById=async(e,t)=>await this.footballFacade.getPlayerById(e,t);getTopPlayers=async e=>await this.footballFacade.getTopPlayers(e);getNextMatchForPlayer=async(e,t)=>await this.footballFacade.getNextMatchForPlayer(e,t);getPrevMatchForPlayer=async(e,t)=>await this.footballFacade.getPrevMatchForPlayer(e,t);getMatches=async(e,t)=>await this.footballFacade.getMatches(e,t);getMatchById=async(e,t)=>await this.footballFacade.getMatchById(e,t);search=async(e,t)=>await this.footballFacade.search(e,t)};var bi=Fe(re());var ar=class{value=null;playerId=null;playerModel=null};var he=class{market=null;matchId=null;matchType=null;matchModel=null;prediction=new ar;result=null};var nr=class{value=!1;playerId=null};var O=class{matchId=null;market=null;prediction=null;constructor(e,t,r,i){this.matchId=e,this.market=t,this.prediction=new nr,this.prediction.value=r,this.prediction.playerId=i}};var fe=class{settledAt=null;resettledAt=null;status=null;outcome=null};var v=(d=>(d.FT_1X2="FT_1X2",d.HT_1X2="HT_1X2",d.BOTH_TEAMS_SCORE="BOTH_TEAMS_SCORE",d.DOUBLE_CHANCE="DOUBLE_CHANCE",d.HT_FT="HT_FT",d.PLAYER_SCORE="PLAYER_SCORE",d.PLAYER_YELLOW_CARD="PLAYER_YELLOW_CARD",d.PLAYER_RED_CARD="PLAYER_RED_CARD",d.RED_CARD_MATCH="RED_CARD_MATCH",d.PENALTY_MATCH="PENALTY_MATCH",d.PLAYER_SCORE_FIRST_GOAL="PLAYER_SCORE_FIRST_GOAL",d.CORNERS_MATCH="CORNERS_MATCH",d.CORRECT_SCORE="CORRECT_SCORE",d.PLAYER_SCORE_HATTRICK="PLAYER_SCORE_HATTRICK",d.PLAYER_SCORE_TWICE="PLAYER_SCORE_TWICE",d.OVER_GOALS_0_5="OVER_GOALS_0.5",d.OVER_GOALS_1_5="OVER_GOALS_1.5",d.OVER_GOALS_2_5="OVER_GOALS_2.5",d.OVER_GOALS_3_5="OVER_GOALS_3.5",d.OVER_GOALS_4_5="OVER_GOALS_4.5",d.OVER_GOALS_5_5="OVER_GOALS_5.5",d.OVER_GOALS_6_5="OVER_GOALS_6.5",d.OVER_CORNERS_6_5="OVER_CORNERS_6.5",d.OVER_CORNERS_7_5="OVER_CORNERS_7.5",d.OVER_CORNERS_8_5="OVER_CORNERS_8.5",d.OVER_CORNERS_9_5="OVER_CORNERS_9.5",d.OVER_CORNERS_10_5="OVER_CORNERS_10.5",d.OVER_CORNERS_11_5="OVER_CORNERS_11.5",d.OVER_CORNERS_12_5="OVER_CORNERS_12.5",d.OVER_CORNERS_13_5="OVER_CORNERS_13.5",d))(v||{}),Bo=["OVER_GOALS_0.5","OVER_GOALS_1.5","OVER_GOALS_2.5","OVER_GOALS_3.5","OVER_GOALS_4.5","OVER_GOALS_5.5","OVER_GOALS_6.5"],No=["OVER_CORNERS_6.5","OVER_CORNERS_7.5","OVER_CORNERS_8.5","OVER_CORNERS_9.5","OVER_CORNERS_10.5","OVER_CORNERS_11.5","OVER_CORNERS_12.5","OVER_CORNERS_13.5"],gi=["PLAYER_RED_CARD","PLAYER_SCORE","PLAYER_SCORE_FIRST_GOAL","PLAYER_SCORE_HATTRICK","PLAYER_SCORE_TWICE","PLAYER_YELLOW_CARD"];var sr=class{value=null};var j=class{matchId=null;market="CORRECT_SCORE";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new sr,this.prediction.value=t}};var _=class{value=!1};var ge=class{matchId=null;market=null;prediction=null;constructor(e,t,r){this.matchId=e,this.market=t,this.prediction=new _,this.prediction.value=r}};var ye=class{matchId=null;market=null;prediction=null;constructor(e,t,r){this.matchId=e,this.market=t,this.prediction=new _,this.prediction.value=r}};var lr=class{matchFacade=null;playerFacade=null;predictorService=null;constructor(e,t,r){this.matchFacade=e,this.playerFacade=t,this.predictorService=r}remapFixturesRequest=e=>{let t={};if(t.match_id=e.matchId,t.match_type="FOOTBALL",e instanceof O)t.market=e.market,t.prediction=e.prediction.value,t.player_id=e.prediction.playerId;else if(e instanceof ge||e instanceof ye){let r=e.market.split("_");t.market=r[0]+"_"+r[1],t.prediction=e.prediction.value,t.target=Number(r[2])}else if(e instanceof j){t.market=e.market;let r=e.prediction.value.split(":");t.goals_home=Number(r[0]),t.goals_away=Number(r[1])}else t.market=e.market,t.prediction=e.prediction.value;return t};remapFixturesResponse=async e=>{e.length>1&&e.sort((s,p)=>s.match_id.localeCompare(p.match_id));let t=[],r=[];for(let s of e)t.push(s.match_id),s.player_id&&!r.includes(s.player_id)&&r.push(s.player_id);let i=await this.matchFacade.getMatchesMapWithNativeIds(t),a=[];r.sort((s,p)=>s.localeCompare(p)),r&&r.length>0&&(a=await this.playerFacade.getPlayersMapWithNativeIds(r));let n=[];for(let s of e){let p=new he;s.target?p.market=this.predictorService.convertMarketForResponseModel(s.market,s.target):p.market=s.market,p.matchId=i[s.match_id].id,p.matchType=s.match_type,p.matchModel=i?i[s.match_id]:null,s.goals_home!==void 0&&s.goals_away!==void 0?p.prediction.value=s.goals_home.toString()+":"+s.goals_away.toString():p.prediction.value=s.prediction,p.prediction.playerId=s.player_id?s.player_id:null,p.prediction.playerId&&(p.prediction.playerModel=a[s.player_id],p.prediction.playerId=a[s.player_id].id),p.result=this.remapResult(s.result),n.push(p)}return n};remapResult=e=>{let t=new fe;return t.settledAt=e.settled_at,t.resettledAt=e.resettled_at,t.status=e.status,t.outcome=e.outcome,t}};var Me=class{goldenGoal=null};var Ge=class{id=null;gameInstanceId=null;gameType=null;wager=null;totalFixtures=null;settledFixtures=null;userId=null;fixtures=[];status=null;tiebreaker=new Me;points=null;createdAt=null;updatedAt=null};var u=class{no=0;yes=0};var we=class{fullTimeOneXTwo={};halfTimeOneXTwo={};bothTeamsScore=new u;doubleChance={};halfTimeFullTime={};playerScore={};playerYellowCard={};playerRedCard={};redCardMatch=new u;penaltyMatch=new u;playerScoreFirstGoal={};cornersMatch={};correctScore={};playerScoreHattrick={};playerScoreTwice={};overZeroPointFiveGoals=new u;overOnePointFiveGoals=new u;overTwoPointFiveGoals=new u;overThreePointFiveGoals=new u;overFourPointFiveGoals=new u;overFivePointFiveGoals=new u;overSixPointFiveGoals=new u;overSixPointFiveCorners=new u;overSevenPointFiveCorners=new u;overEightPointFiveCorners=new u;overNinePointFiveCorners=new u;overTenPointFiveCorners=new u;overElevenPointFiveCorners=new u;overTwelvePointFiveCorners=new u;overThirteenPointFiveCorners=new u};var yi=(r=>(r.ONE="1",r.X="x",r.TWO="2",r))(yi||{}),Mi=(r=>(r.ONE_X="1x",r.X_TWO="x2",r.ONE_TWO="12",r))(Mi||{}),wi=(m=>(m.ONE_ONE="1/1",m.ONE_X="1/x",m.ONE_TWO="1/2",m.X_ONE="x/1",m.X_X="x/x",m.X_TWO="x/2",m.TWO_ONE="2/1",m.TWO_X="2/x",m.TWO_TWO="2/2",m))(wi||{});var pr=class{value=null};var cr=class{matchId=null;market="HT_FT";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new pr,this.prediction.value=t}};var mr=class{value=null};var ur=class{matchId=null;market="DOUBLE_CHANCE";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new mr,this.prediction.value=t}};var be=class{value=null};var dr=class{matchId=null;market="FT_1X2";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new be,this.prediction.value=t}};var hr=class{matchId=null;market="HT_1X2";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new be,this.prediction.value=t}};var fr=class{value};var gr=class{matchId=null;market="CORNERS_MATCH";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new fr,this.prediction.value=t}};var yr=class{matchId=null;market="BOTH_TEAMS_SCORE";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new _,this.prediction.value=t}};var Mr=class{matchId=null;market="RED_CARD_MATCH";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new _,this.prediction.value=t}};var wr=class{matchId=null;market="PENALTY_MATCH";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new _,this.prediction.value=t}};var W=class{id=null;title=null;description=null;type=null;status=null;predictionsCutoff=null;fixtures=[];createdAt=null;updatedAt=null};var z=class{userId=null;points=null;results=[];tiebreaker=null};var br=(a=>(a.ACTIVE="ACTIVE",a.WON="WON",a.LOST="LOST",a.PARTIALLY_WON="PARTIALLY_WON",a.CANCELED="CANCELED",a))(br||{}),Ue=["WON","LOST","PARTIALLY_WON","CANCELED"];var b=class{limit=null;startAfter=null;status=null;type=null;constructor(e){this.limit=e.limit?e.limit:null,this.startAfter=e.startAfter?e.startAfter:null,this.status=e.status?e.status:null,this.type=e.type?e.type:null}constructFiltersUrl=()=>{let e="",t=!1;return this.status&&(t=Object.values(br).some(r=>this.status.includes(r))),this.limit&&(e+="&",e+=`limit=${this.limit}`),this.startAfter&&(e+="&",e+=`start_after=${this.startAfter}`),this.status&&t&&(e+="&",e+=`status=${this.status.join(",")}`),this.type&&(e+="&",e+=`game_types=${this.type}`),e}};var De=(n=>(n.OPEN="OPEN",n.LIVE="LIVE",n.PENDING="PENDING",n.CANCELED="CANCELED",n.CLOSED="CLOSED",n.SETTLED="SETTLED",n))(De||{});var S=class{limit=null;startAfter=null;status=null;type=null;gameIds=null;constructor(e){this.limit=e.limit?e.limit:null,this.startAfter=e.startAfter?e.startAfter:null,this.status=e.status?e.status:null,this.type=e.type?e.type:null,this.gameIds=e.gameIds?e.gameIds:null}constructFiltersUrl=()=>{let e="";return this.limit&&(e+="&",e+=`limit=${this.limit}`),this.startAfter&&(e+="&",e+=`start_after=${this.startAfter}`),this.status&&Object.values(De).includes(this.status)&&(e+="&",e+=`status=${this.status}`),this.type&&(e+="&",e+=`type=${this.type}`),this.gameIds&&this.gameIds.length>0&&(e+="&",e+=`game_ids=${this.gameIds.join(",")}`),e}};var Q=class{id=null;title=null;description=null;type=null;status=null;predictionsCutoff=null;fixtures=[];createdAt=null;updatedAt=null};var U=class{id=null;title=null;description=null;type=null;status=null;predictionsCutoff=null;fixtures=[];createdAt=null;updatedAt=null};var N=class{footballHttps=null;idMapping=null;matchFacade=null;playerFacade=null;constructor(e,t){this.footballHttps=new B(e),this.idMapping=t,this.matchFacade=new k(this.footballHttps,t),this.playerFacade=new H(this.footballHttps,t)}remapMatchIdToNative=async e=>{let t=await this.idMapping.getEntityIdsBySchemaId(e,"match","native"),r=[];return t.match.forEach(i=>r.push(i)),r};remapPlayerIdToNative=async e=>(await this.idMapping.getEntityIdsBySchemaId(e,"player","native")).player[0];remapPlayerIdMapToNative=async e=>{let t={},r=D(e),a=(await this.idMapping.getEntityIdsBySchemaId(r,"player","native")).player;return r.forEach((n,s)=>t[n]=a[s]),t};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 n={player:[a]},p=(await this.idMapping.idMappingFacade.getEntitiesByIds(n,"native",this.idMapping.idSchema)).player[0];i[p]=i[a],delete i[a]}return e};convertMarket=e=>{let t=Object.keys(new we),r=Object.values(v);for(let i=0;i<r.length;i++)e===r[i]&&(e=t[i]);return e};convertMarketForResponseModel=(e,t)=>{let r=t.toString();return e+"_"+r};validateFixture=(e,t,r,i)=>{let a=Object.values(yi),n=Object.values(wi),s=Object.values(Mi);if(t==="FT_1X2"){if(a.includes(r))return new dr(e,r)}else if(t==="HT_1X2"){if(a.includes(r))return new hr(e,r)}else if(t==="HT_FT"){if(n.includes(r))return new cr(e,r)}else if(t==="DOUBLE_CHANCE"){if(s.includes(r))return new ur(e,r)}else if(t==="CORRECT_SCORE"){if(typeof r=="string"&&/\d+:\d+/.test(r))return new j(e,r)}else if(t==="CORNERS_MATCH"){if(typeof r=="number")return new gr(e,r)}else if(t==="BOTH_TEAMS_SCORE"){if(typeof r=="boolean")return new yr(e,r)}else if(t==="RED_CARD_MATCH"){if(typeof r=="boolean")return new Mr(e,r)}else if(t==="PENALTY_MATCH"){if(typeof r=="boolean")return new wr(e,r)}else if(gi.includes(t)){if(i&&typeof r=="boolean")return new O(e,t,r,i)}else if(Bo.includes(t)){if(typeof r=="boolean")return new ye(e,t,r)}else if(No.includes(t)&&typeof r=="boolean")return new ge(e,t,r)};getMarketSummary=(e,t,r)=>{let i=this.convertMarket(t),a={};if(a.matchId=e.matchId,a.matchType=e.matchType,Object.keys(e.predictions).includes(i))a[i]=e.predictions[i];else throw new Error("You have passed invalid market");return gi.includes(t)&&r?(a[i][r]||(a[i][r]=new u),a[i][r]):a};remapCompetitionsFromConfig=async e=>{let t={competition:e.fullCoverageCompetitions},r=await this.idMapping.idMappingFacade.getEntitiesByIds(t,"native",this.idMapping.idSchema);return e.fullCoverageCompetitions=r.competition,e};remapMatchIdsFixtures=async e=>{if(Array.isArray(e.data))if(e.data.length>0){let t=[],r=[];return e.data.forEach(i=>{i instanceof Q||i instanceof W||i instanceof U?(i.fixtures.forEach(a=>t.push(a.matchId)),i instanceof U&&i.fixtures.forEach(a=>{a.prediction.playerId&&r.push(a.prediction.playerId)})):i instanceof z&&i.results.forEach(a=>t.push(a.matchId))}),await this.refactorResponseArrModel(e,t,r)}else return e;else return await this.refactorResponseObjModel(e)};refactorResponseArrModel=async(e,t,r)=>{let i=[],a=await this.matchFacade.getMatchesMapWithNativeIds(t),n={};return r.length>0&&(n=await this.playerFacade.getPlayersMapWithNativeIds(r)),e.data.forEach(s=>{s instanceof Q||s instanceof W||s instanceof U?(s.fixtures.forEach(p=>{p.matchModel=a[p.matchId],p.matchId=p.matchModel.id,s instanceof U&&p.prediction.playerId&&(p.prediction.playerModel=n[p.prediction.playerId],p.prediction.playerId=n[p.prediction.playerId].id)}),i.push(s)):s instanceof z&&(s.results.forEach(p=>{p.matchModel=a[p.matchId],p.matchId=p.matchModel.id}),i.push(s))}),e.data=i,e};refactorResponseObjModel=async e=>{let t=[];e.fixtures.forEach(i=>t.push(i.matchId));let r=await this.matchFacade.getMatchesMapWithNativeIds(t);return e.fixtures.forEach(i=>{i.matchModel=r[i.matchId],i.matchId=r[i.matchId].id}),e};getCurrentGameId=e=>{let t=new Date;if(e.data.length>1){let r=[];return e.data.forEach(a=>r.push(a.predictionsCutoff)),e.data.sort((a,n)=>{let[s,p]=[a.predictionsCutoff,n.predictionsCutoff].map(m=>Math.abs(new Date(m)-t));return s-p})[0].id}else return e.data[0].id};initGameTypePredictions=e=>{let t={type:e};return t=new b(t),t};initGameFilters=(e,t,r)=>{if(t&&r)return t.type=e,t.gameIds=r,t=new S(t),t;if(t&&!r)return t.type=e,t=new S(t),t;if(!t&&r){let i={type:e,gameIds:r};return i=new S(i),i}else{let i={type:e};return i=new S(i),i}};addPredictionProp=async(e,t)=>(t.data.forEach((r,i)=>{r.id===e[i].game_instance_id&&r.fixtures.forEach((a,n)=>{e[i].fixtures[n].goals_home!==void 0&&e[i].fixtures[n].goals_away!==void 0?a.prediction.value=e[i].fixtures[n].goals_home+":"+e[i].fixtures[n].goals_away:a.prediction.value=e[i].fixtures[n].prediction,e[i].fixtures[n].player_id?a.prediction.playerId=e[i].fixtures[n].player_id:e[i].fixtures[n].target&&(a.prediction.target=e[i].fixtures[n].target),a.prediction.result=this.remapResult(e[i].fixtures[n].result)})}),await this.remapMatchIdsFixtures(t));remapResult=e=>{let t=new fe;return t.settledAt=e.settled_at,t.resettledAt=e.resettled_at,t.status=e.status,t.outcome=e.outcome,t}};var Pe=class{gameInstanceId=null;fixtures=[];tiebreaker=null;constructor(e){this.gameInstanceId=e.gameInstanceId,e.fixtures.forEach(t=>this.fixtures.push(new j(t.matchId,t.prediction.value))),this.tiebreaker=e.tiebreaker?e.tiebreaker:null}};var Ie=class{fixturesRemapper=null;footballHttps=null;matchFacade=null;playerFacade=null;predictorService=null;constructor(e,t){this.footballHttps=new B(e),this.matchFacade=new k(this.footballHttps,t),this.playerFacade=new H(this.footballHttps,t),this.predictorService=new N(e,t),this.fixturesRemapper=new lr(this.matchFacade,this.playerFacade,this.predictorService)}remapRequestBody=e=>{let t={};return t.game_instance_id=e.gameInstanceId,t.fixtures=e.fixtures.map(r=>this.fixturesRemapper.remapFixturesRequest(r)),e instanceof Pe&&e.tiebreaker&&(t.tiebreaker={},t.tiebreaker.golden_goal=e.tiebreaker.goldenGoal?e.tiebreaker.goldenGoal:null),t};remapResponseArrayBody=async e=>{let t=[],r=[],i={},a=[];e.forEach(s=>{s.fixtures.forEach(p=>{t.push(p.match_id),p.player_id&&r.push(p.player_id)})});let n=await this.matchFacade.getMatchesMapWithNativeIds(t);return r.length>0&&(i=await this.playerFacade.getPlayersMapWithNativeIds(r)),e.forEach(s=>{let p=new Ge,m=[];p.id=s.id,p.gameInstanceId=s.game_instance_id,p.gameType=s.game_type,p.wager=s.wager,p.totalFixtures=s.total_fixtures,p.settledFixtures=s.settled_fixtures,p.userId=s.user_id,s.fixtures.forEach(l=>{let c=new he;l.target?c.market=this.predictorService.convertMarketForResponseModel(l.market,l.target):c.market=l.market,c.matchId=n[l.match_id].id,c.matchType=l.match_type,c.matchModel=n[l.match_id],l.goals_home!==void 0&&l.goals_away!==void 0?c.prediction.value=l.goals_home.toString()+":"+l.goals_away.toString():c.prediction.value=l.prediction,c.prediction.playerId=l.player_id?l.player_id:null,c.prediction.playerId&&(c.prediction.playerModel=i[c.prediction.playerId],c.prediction.playerId=i[c.prediction.playerId].id),c.result=this.fixturesRemapper.remapResult(l.result),m.push(c)}),p.fixtures=m,p.status=s.status,s.tiebreaker?p.tiebreaker.goldenGoal=s.tiebreaker.golden_goal:p.tiebreaker=null,p.points=s.points,p.createdAt=s.created_at,p.updatedAt=s.updated_at,a.push(p)}),a};remapResponseObjBody=async e=>{let t=new Ge;return t.id=e.id,t.gameInstanceId=e.game_instance_id,t.gameType=e.game_type,t.wager=e.wager,t.totalFixtures=e.total_fixtures,t.settledFixtures=e.settled_fixtures,t.userId=e.user_id,t.fixtures=await this.fixturesRemapper.remapFixturesResponse(e.fixtures),t.status=e.status,e.tiebreaker?t.tiebreaker.goldenGoal=e.tiebreaker.golden_goal:t.tiebreaker=null,t.points=e.points,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapPredictionModel=e=>{let t=new we;return t.fullTimeOneXTwo=e.FT_1X2,t.halfTimeOneXTwo=e.HT_1X2,t.bothTeamsScore=e.BOTH_TEAMS_SCORE?e.BOTH_TEAMS_SCORE:new u,t.overZeroPointFiveGoals=e.OVER_GOALS["over:0.5"]?e.OVER_GOALS["over:0.5"]:new u,t.overOnePointFiveGoals=e.OVER_GOALS["over:1.5"]?e.OVER_GOALS["over:1.5"]:new u,t.overTwoPointFiveGoals=e.OVER_GOALS["over:2.5"]?e.OVER_GOALS["over:2.5"]:new u,t.overThreePointFiveGoals=e.OVER_GOALS["over:3.5"]?e.OVER_GOALS["over:3.5"]:new u,t.overFourPointFiveGoals=e.OVER_GOALS["over:4.5"]?e.OVER_GOALS["over:4.5"]:new u,t.overFivePointFiveGoals=e.OVER_GOALS["over:5.5"]?e.OVER_GOALS["over:5.5"]:new u,t.overSixPointFiveGoals=e.OVER_GOALS["over:6.5"]?e.OVER_GOALS["over:6.5"]:new u,t.overSixPointFiveCorners=e.OVER_CORNERS["over:6.5"]?e.OVER_CORNERS["over:6.5"]:new u,t.overSevenPointFiveCorners=e.OVER_CORNERS["over:7.5"]?e.OVER_CORNERS["over:7.5"]:new u,t.overEightPointFiveCorners=e.OVER_CORNERS["over:8.5"]?e.OVER_CORNERS["over:8.5"]:new u,t.overNinePointFiveCorners=e.OVER_CORNERS["over:9.5"]?e.OVER_CORNERS["over:9.5"]:new u,t.overTenPointFiveCorners=e.OVER_CORNERS["over:10.5"]?e.OVER_CORNERS["over:10.5"]:new u,t.overElevenPointFiveCorners=e.OVER_CORNERS["over:11.5"]?e.OVER_CORNERS["over:11.5"]:new u,t.overTwelvePointFiveCorners=e.OVER_CORNERS["over:12.5"]?e.OVER_CORNERS["over:12.5"]:new u,t.overThirteenPointFiveCorners=e.OVER_CORNERS["over:13.5"]?e.OVER_CORNERS["over:13.5"]:new u,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?e.RED_CARD_MATCH:new u,t.penaltyMatch=e.PENALTY_MATCH?e.PENALTY_MATCH:new u,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 Pr=class{matchId=null;matchType=null;predictions=null};var Ir=class{remapPredictions=null;constructor(e,t){this.remapPredictions=new Ie(e,t)}remapResponse=e=>{let t=new Pr;return t.matchId=e.match_id,t.matchType=e.match_type,t.predictions=this.remapPredictions.remapPredictionModel(e.predictions),t}};var Rr=class{matchId=null;matchType=null;market=null;matchModel=null};var Fr=class{value=null;target=null;playerId=null;playerModel=null;result=null};var vr=class{matchId=null;matchType=null;market=null;matchModel=null;prediction=new Fr};var Sr=class{value=null;result=null};var Tr=class{matchId=null;matchType=null;market="CORRECT_SCORE";matchModel=null;prediction=new Sr};var Er=class{matchId=null;matchModel=null;outcome=null};var _r=class{remapPaginatedGames=e=>{let t=new g;return t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,t.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,t.data=e.data.map(r=>this.remapGamesListResponse(r)),t};remapGamesListResponse=e=>{let t=new Q;return t.id=e.id,t.title=e.title,t.description=e.description,t.type=e.type,t.status=e.status,t.predictionsCutoff=e.predictions_cutoff,t.fixtures=e.fixtures.map(r=>this.remapFixturesResponse(r)),t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapFixturesResponse=e=>{let t=new Rr;return t.matchId=e.match_id,t.matchType=e.match_type,t.market=e.market,t};remapPaginatedUserTopXEditions=e=>{let t=new g;return t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,t.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,t.data=e.data.map(r=>this.remapUserTopXEditionsResponse(r)),t};remapUserTopXEditionsResponse=e=>{let t=new W;return t.id=e.id,t.title=e.title,t.description=e.description,t.type=e.type,t.status=e.status,t.predictionsCutoff=e.predictions_cutoff,t.fixtures=e.fixtures.map(r=>this.remapTopXFixturesResponse(r)),t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapTopXFixturesResponse=e=>{let t=new Tr;return t.matchId=e.match_id,t.matchType=e.match_type,t};remapPaginatedUserMathQuizEditions=e=>{let t=new g;return t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,t.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,t.data=e.data.map(r=>this.remapUserMatchQuizEditionsResponse(r)),t};remapUserMatchQuizEditionsResponse=e=>{let t=new U;return t.id=e.id,t.title=e.title,t.description=e.description,t.type=e.type,t.status=e.status,t.predictionsCutoff=e.predictions_cutoff,t.fixtures=e.fixtures.map(r=>this.remapMatchQuizFixturesResponse(r)),t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapMatchQuizFixturesResponse=e=>{let t=new vr;return t.matchId=e.match_id,t.matchType=e.match_type,t.market=e.market,t};remapPaginatedGameResults=e=>{let t=new g;return t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,t.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,t.data=e.data.map(r=>this.remapGameResults(r)),t};remapGameResults=e=>{let t=new z;return t.userId=e.user_id,t.points=e.points?e.points:0,t.results=e.results.map(r=>this.remapResults(r)),t.tiebreaker=e.tiebreaker?this.remapTiebreaker(e.tiebreaker):null,t};remapResults=e=>{let t=new Er;return t.matchId=e.match_id,t.outcome=e.outcome,t};remapTiebreaker=e=>{let t=new Me;return t.goldenGoal=e.golden_goal,t}};var Cr=class{remapMetaData=e=>{let t=new ie;return t.pagination.nextPageStartsAfter=e.pagination.next_page_starts_after,t.pagination.itemsPerPage=e.pagination.items_per_page,t}};var X=class{instanceAuth=null;instance=null;apiSignInUrl=null;clientApiSignInUrl=null;predictionRemapper=null;matchSummaryRemapper=null;gamesRemapper=null;metaRemapper=null;constructor(e,t){let r=A(e.environment,"predictor");this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}`,this.predictionRemapper=new Ie(e,t),this.matchSummaryRemapper=new Ir(e,t),this.gamesRemapper=new _r,this.metaRemapper=new Cr,this.instanceAuth=bi.default.create({baseURL:r,headers:{Authorization:`Bearer ${e.authProvider.getIdToken()}`,"Content-Type":"application/json"}}),this.instance=bi.default.create({baseURL:r,headers:{"Content-Type":"application/json"}})}makeFootballPrediction=async e=>{try{let t=this.predictionRemapper.remapRequestBody(e),r=await this.instanceAuth.post(`/predictions${this.apiSignInUrl}`,JSON.stringify(t));return await this.predictionRemapper.remapResponseObjBody(r.data)}catch(t){throw console.warn("There was a problem making POST request: ",t),t.response}};getMatchSummary=async e=>{try{let t=await this.instance.get(`/predictions/summary/${e}${this.apiSignInUrl}`);return this.matchSummaryRemapper.remapResponse(t.data)}catch(t){throw console.warn(`There was a problem fetching predictions for match: ${e} `,t),t.response}};deleteFootballPrediction=async e=>{try{return await this.instanceAuth.delete(`/predictions/${e}${this.apiSignInUrl}`),!0}catch(t){throw console.warn(`There was a problem deleting your prediction: ${e}`,t),t.response}};getMyPredictions=async e=>{try{let t=new g,r=`/predictions${this.apiSignInUrl}`;e&&(r+=`${e.constructFiltersUrl()}`);let i=await this.instanceAuth.get(r);return t.meta=this.metaRemapper.remapMetaData(i.data.meta),t.data=await this.predictionRemapper.remapResponseArrayBody(i.data.data),t}catch(t){throw console.warn("There was a problem fetching own predictions",t),t.response}};getMyPredictionsNoRemap=async e=>{try{return(await this.instanceAuth.get(`/predictions${this.apiSignInUrl}${e.constructFiltersUrl()}`)).data.data}catch(t){throw console.warn("There was a problem fetching own predictions",t),t.response}};getUserPredictions=async(e,t,r)=>{try{let i=new g,a=`/predictions/users/${e}${this.apiSignInUrl}`,n=Date.now();r&&(a+=`${r.constructFiltersUrl()}`),t&&(a+=`&disable_cache=${n}`);let s=await this.instance.get(a);return i.meta=this.metaRemapper.remapMetaData(s.data.meta),i.data=await this.predictionRemapper.remapResponseArrayBody(s.data.data),i}catch(i){throw console.warn(`There was a problem fetching predictions for user: ${e}`,i),i.response}};getUserPredictionsNoRemap=async(e,t)=>{try{return(await this.instance.get(`/predictions/users/${e}${this.apiSignInUrl}${t.constructFiltersUrl()}`)).data.data}catch(r){throw console.warn(`There was a problem fetching predictions for user: ${e}`,r),r.response}};getGames=async(e,t)=>{try{let r=`/games/${this.apiSignInUrl}${e.constructFiltersUrl()}`,i=Date.now();t&&(r+=`&disable_cache=${i}`);let a=await this.instance.get(r);return this.gamesRemapper.remapPaginatedGames(a.data)}catch(r){throw console.warn("There was a problem fetching the games list",r),r.response}};getGameById=async(e,t)=>{try{let r=`/games/${e}${this.apiSignInUrl}`,i=Date.now();t&&(r+=`&disable_cache=${i}`);let a=await this.instance.get(r);return this.gamesRemapper.remapGamesListResponse(a.data)}catch(r){throw console.warn(`There was a problem fetching the following game: ${e}`,r),r.response}};getUserGameEditions=async(e,t)=>{try{let r=null,i=`/games/${this.apiSignInUrl}${e.constructFiltersUrl()}`,a=Date.now();t&&(i+=`&disable_cache=${a}`);let n=await this.instance.get(i);return n.data.data.forEach(s=>{s.type==="TOP_X"?r=this.gamesRemapper.remapPaginatedUserTopXEditions(n.data):s.type==="MATCH_QUIZ"&&(r=this.gamesRemapper.remapPaginatedUserMathQuizEditions(n.data))}),r}catch(r){throw console.warn("There was a problem fetching the games list",r),r.response}};getGameResults=async(e,t,r)=>{try{let i=`/games/${e}/results/${this.apiSignInUrl}`,a=Date.now();r&&(i+=`${r.constructFiltersUrl()}`),t&&(i+=`&disable_cache=${a}`);let n=await this.instance.get(i);return this.gamesRemapper.remapPaginatedGameResults(n.data)}catch(i){throw console.warn(`There was a problem fetching the results for the following game: ${e}`,i),i.response}}};var Or=class{fullCoverageCompetitions=null;markets=null};var xr=class{remapConfig=e=>{let t=new Or;return t.fullCoverageCompetitions=e.full_coverage_competitions,t.markets=e.markets,t}};var Ar=class{gameInstanceId=null;fixtures=null};var Br=class{predictorHttps=null;clientHttps=null;idMapping=null;predictorConfigRemapper=null;predictorService=null;constructor(e,t,r,i){this.predictorHttps=t,this.idMapping=i,this.clientHttps=r,this.predictorConfigRemapper=new xr,this.predictorService=new N(e,i)}makeFootballPrediction=async(e,t,r,i)=>{let a=this.predictorService.validateFixture(e,t,r,i),n=new Ar;if(a)if(this.idMapping.idSchema!=="native"){let s=a.matchId,p="",m=await this.predictorService.remapMatchIdToNative([s]);if(a.matchId=m[0],!a.matchId)throw new Error("Match id is invalid!");if(a instanceof O&&(p=a.prediction.playerId,a.prediction.playerId=await this.predictorService.remapPlayerIdToNative([p]),!a.prediction.playerId))throw new Error("Player id is invalid!");n.fixtures=[a];let l=await this.predictorHttps.makeFootballPrediction(n);return l.fixtures.map(c=>{c.prediction.playerId&&(c.prediction.playerId=p),c.matchId=s}),l}else return n.fixtures=[a],await this.predictorHttps.makeFootballPrediction(n);else throw new Error("The prediction is invalid. Please check again have you passed appropriate prediction model")};getMatchSummary=async e=>{if(this.idMapping.idSchema!=="native"){let r=(await this.predictorService.remapMatchIdToNative([e]))[0],i=await this.predictorHttps.getMatchSummary(r);i.matchId=e;let a=i.predictions,n=await this.predictorService.remapPlayerIdToIdSchema(a);return i.predictions=n,i}else return await this.predictorHttps.getMatchSummary(e)};getMarketSummary=async(e,t,r)=>{try{let i=await this.getMatchSummary(e);return this.predictorService.getMarketSummary(i,t,r)}catch(i){return i.message}};getConfig=async()=>{let e=await this.clientHttps.getConfig(),t=await this.predictorConfigRemapper.remapConfig(e.predictor);return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(t):t};deleteFootballPrediction=async e=>await this.predictorHttps.deleteFootballPrediction(e);getMyPredictions=async e=>(e&&(e=new b(e)),await this.predictorHttps.getMyPredictions(e));getMyCurrentPredictions=async e=>{if(e)e.status=["ACTIVE"],e=new b(e);else{let t={status:["ACTIVE"]};e=new b(t)}return await this.getMyPredictions(e)};getMyPastPredictions=async e=>{if(e)e.status=Ue,e=new b(e);else{let t={status:Ue};e=new b(t)}return await this.getMyPredictions(e)};getUserPredictions=async(e,t,r)=>(r=r||!1,t&&(t=new b(t)),await this.predictorHttps.getUserPredictions(e,r,t));getUserCurrentPredictions=async(e,t)=>{if(t)t.status=["ACTIVE"],t=new b(t);else{let r={status:["ACTIVE"]};t=new b(r)}return await this.getUserPredictions(e,t)};getUserPastPredictions=async(e,t)=>{if(t)t.status=Ue,t=new b(t);else{let r={status:Ue};t=new b(r)}return await this.getUserPredictions(e,t)}};var Lo=Fe(re());var Re=class{instance=null;apiSignInUrl="";constructor(e){let t=A(e.environment,"client");this.apiSignInUrl=`/clients/${e.clientId}/features?key=${e.apiKey}`,this.instance=Lo.default.create({baseURL:t,headers:{"Content-Type":"application/json"}})}getConfig=async()=>{try{return(await this.instance.get(`${this.apiSignInUrl}`)).data.data}catch(e){throw console.warn("There was a problem fetching configuration from Client API",e),e.response}}};var Nr=class{predictorHttps=null;clientHttps=null;predictorFacade=null;idMapping=null;constructor(e){this.idMapping=new E(e),this.predictorHttps=new X(e,this.idMapping),this.clientHttps=new Re(e),this.predictorFacade=new Br(e,this.predictorHttps,this.clientHttps,this.idMapping)}makeFootballPrediction=async(e,t,r,i)=>await this.predictorFacade.makeFootballPrediction(e,t,r,i);getMatchSummary=async e=>await this.predictorFacade.getMatchSummary(e);getMarketSummary=async(e,t,r)=>await this.predictorFacade.getMarketSummary(e,t,r);getConfig=async()=>await this.predictorFacade.getConfig();deleteFootballPrediction=async e=>await this.predictorFacade.deleteFootballPrediction(e);getMyPredictions=async e=>await this.predictorFacade.getMyPredictions(e);getMyCurrentPredictions=async e=>await this.predictorFacade.getMyCurrentPredictions(e);getMyPastPredictions=async e=>await this.predictorFacade.getMyPastPredictions(e);getUserPredictions=async(e,t,r)=>await this.predictorFacade.getUserPredictions(e,t,r);getUserCurrentPredictions=async(e,t)=>await this.predictorFacade.getUserCurrentPredictions(e,t);getUserPastPredictions=async(e,t)=>await this.predictorFacade.getUserPastPredictions(e,t)};var Lr=class{general=[];predictor=[];topX=[]};var Gr=class{enabled=!1;rewards=null};var Ur=class{general=null;topX=null;predictor=null};var Dr=class{points=null;tiers=null;badges=null};var Vr=class{remapLoyaltyResponse=e=>{let t=new Gr;return t.enabled=e.enabled,t.rewards=this.remapRewards(e.rewards),t};remapRewards=e=>{let t=new Dr;return t.points=this.remapPoints(e.points),t.tiers=e.tiers,t.badges=this.remapBadges(e.badges),t};remapPoints=e=>{let t=new Ur;return t.general=e.general,t.topX=e.top_x,t.predictor=e.predictor,t};remapBadges=e=>{let t=new Lr;return t.general=e.general,t.predictor=e.predictor,t.topX=e.top_x,t}};var $r=class{https=null;loyaltyRemapper=null;constructor(e){this.https=e,this.loyaltyRemapper=new Vr}getConfig=async()=>{let e=await this.https.getConfig();return this.loyaltyRemapper.remapLoyaltyResponse(e.loyalty)}};var Hr=class{https=null;loyaltyFacade=null;constructor(e){this.https=new Re(e),this.loyaltyFacade=new $r(this.https)}getConfig=async()=>await this.loyaltyFacade.getConfig()};var kr=class{idMapping=null;predictorHttps=null;predictorService=null;constructor(e,t){this.idMapping=t,this.predictorHttps=new X(e,t),this.predictorService=new N(e,t)}getGames=async(e,t)=>{t=t||!1;let r=this.predictorService.initGameFilters("TOP_X",e),i=await this.predictorHttps.getGames(r,t);return await this.predictorService.remapMatchIdsFixtures(i)};getGameById=async(e,t)=>{t=t||!1;let r=await this.predictorHttps.getGameById(e,t);return await this.predictorService.remapMatchIdsFixtures(r)};getGameResults=async(e,t,r)=>{r=r||!1,t&&(t=new S(t));let i=await this.predictorHttps.getGameResults(e,r,t);return await this.predictorService.remapMatchIdsFixtures(i)};getCurrentGameResults=async e=>{e=e||!1;let t={status:"OPEN",type:"TOP_X"};t=new S(t);let r=await this.predictorHttps.getGames(t,e),i=this.predictorService.getCurrentGameId(r);return(await this.getGameResults(i,null,e)).data[0]};play=async e=>{let t=new Pe(e);if(this.idMapping.idSchema!=="native"){let i=[];t.fixtures.forEach(n=>i.push(n.matchId));let a=await this.predictorService.remapMatchIdToNative(i);t.fixtures.forEach(n=>n.matchId=a.shift())}let r=await this.predictorHttps.makeFootballPrediction(t);return r.fixtures.forEach(i=>{i.matchId=i.matchModel.id}),r};delete=async e=>await this.predictorHttps.deleteFootballPrediction(e);getMyGameEditions=async(e,t)=>{t=t||!1;let r=this.predictorService.initGameTypePredictions("TOP_X"),i=[],a=await this.predictorHttps.getMyPredictionsNoRemap(r);if(a.length>0){a.forEach(p=>{p.game_instance_id&&i.push(p.game_instance_id)});let n=this.predictorService.initGameFilters("TOP_X",e,i),s=await this.predictorHttps.getUserGameEditions(n,t);return await this.predictorService.addPredictionProp(a,s)}else return new g};getMyGamePrediction=async e=>{let t=this.predictorService.initGameTypePredictions("TOP_X"),r=await this.predictorHttps.getMyPredictions(t);return r.data.length>0?r.data.filter(a=>a.gameInstanceId===e)[0]:null};getUserGameEditions=async(e,t,r)=>{r=r||!1;let i=this.predictorService.initGameTypePredictions("TOP_X"),a=[],n=await this.predictorHttps.getUserPredictionsNoRemap(e,i);if(n.length>0){n.forEach(m=>{m.game_instance_id&&a.push(m.game_instance_id)});let s=this.predictorService.initGameFilters("TOP_X",t,a),p=await this.predictorHttps.getUserGameEditions(s,r);return await this.predictorService.addPredictionProp(n,p)}else return new g};getUserGamePrediction=async(e,t,r)=>{r=r||!1;let i=this.predictorService.initGameTypePredictions("TOP_X"),a=await this.predictorHttps.getUserPredictions(e,r,i);return a.data.length>0?a.data.filter(s=>s.gameInstanceId===t)[0]:null}};var qr=class{topXFacade=null;idMapping=null;constructor(e){this.idMapping=new E(e),this.topXFacade=new kr(e,this.idMapping)}getGames=async(e,t)=>await this.topXFacade.getGames(e,t);getGameById=async(e,t)=>await this.topXFacade.getGameById(e,t);getGameResults=async(e,t,r)=>await this.topXFacade.getGameResults(e,t,r);getCurrentGameResults=async e=>await this.topXFacade.getCurrentGameResults(e);play=async e=>await this.topXFacade.play(e);delete=async e=>await this.topXFacade.delete(e);getMyGameEditions=async(e,t)=>await this.topXFacade.getMyGameEditions(e,t);getMyGamePrediction=async e=>await this.topXFacade.getMyGamePrediction(e);getUserGameEditions=async(e,t,r)=>await this.topXFacade.getUserGameEditions(e,t,r);getUserGamePrediction=async(e,t,r)=>await this.topXFacade.getUserGamePrediction(e,t,r)};var jr=class{predictorHttps=null;predictorService=null;idMapping=null;constructor(e){this.idMapping=new E(e),this.predictorHttps=new X(e,this.idMapping),this.predictorService=new N(e,this.idMapping)}play=async e=>{let t=e.fixtures.map(r=>this.predictorService.validateFixture(r.matchId,r.market,r.prediction.value,r.prediction.playerId));if(t){if(this.idMapping.idSchema!=="native"){let r=[],i=[];t.forEach(s=>{r.push(s.matchId),s instanceof O&&i.push(s.prediction.playerId)});let a=await this.predictorService.remapMatchIdToNative(r),n={};i&&i.length>0&&(n=await this.predictorService.remapPlayerIdMapToNative(i)),t.forEach((s,p)=>{s.matchId=a[p],s instanceof O&&(s.prediction.playerId=n[s.prediction.playerId])})}}else throw new Error("The prediction is invalid. Please check again have you passed appropriate prediction model");return e.fixtures=t,await this.predictorHttps.makeFootballPrediction(e)};delete=async e=>await this.predictorHttps.deleteFootballPrediction(e);getGames=async(e,t)=>{t=t||!1;let r=this.predictorService.initGameFilters("MATCH_QUIZ",e),i=await this.predictorHttps.getGames(r,t);return await this.predictorService.remapMatchIdsFixtures(i)};getGameById=async(e,t)=>{t=t||!1;let r=await this.predictorHttps.getGameById(e,t);return await this.predictorService.remapMatchIdsFixtures(r)};getGameResults=async(e,t,r)=>{r=r||!1,t&&(t=new S(t));let i=await this.predictorHttps.getGameResults(e,r,t);return await this.predictorService.remapMatchIdsFixtures(i)};getCurrentGameResults=async e=>{e=e||!1;let t={status:"OPEN",type:"MATCH_QUIZ"};t=new S(t);let r=await this.predictorHttps.getGames(t,e),i=this.predictorService.getCurrentGameId(r);return(await this.getGameResults(i,null,e)).data[0]};getMyGameEditions=async(e,t)=>{t=t||!1;let r=this.predictorService.initGameTypePredictions("MATCH_QUIZ"),i=[],a=await this.predictorHttps.getMyPredictionsNoRemap(r);if(a.length>0){a.forEach(p=>{p.game_instance_id&&i.push(p.game_instance_id)});let n=this.predictorService.initGameFilters("MATCH_QUIZ",e,i),s=await this.predictorHttps.getUserGameEditions(n,t);return await this.predictorService.addPredictionProp(a,s)}else return new g};getMyGamePrediction=async e=>{let t=this.predictorService.initGameTypePredictions("MATCH_QUIZ"),r=await this.predictorHttps.getMyPredictions(t);return r.data.length>0?r.data.filter(a=>a.gameInstanceId===e)[0]:null};getUserGameEditions=async(e,t,r)=>{r=r||!1;let i=this.predictorService.initGameTypePredictions("MATCH_QUIZ"),a=[],n=await this.predictorHttps.getUserPredictionsNoRemap(e,i);if(n.length>0){n.forEach(m=>{m.game_instance_id&&a.push(m.game_instance_id)});let s=this.predictorService.initGameFilters("MATCH_QUIZ",t,a),p=await this.predictorHttps.getUserGameEditions(s,r);return await this.predictorService.addPredictionProp(n,p)}else return new g};getUserGamePrediction=async(e,t,r)=>{r=r||!1;let i=this.predictorService.initGameTypePredictions("MATCH_QUIZ"),a=await this.predictorHttps.getUserPredictions(e,r,i);return a.data.length>0?a.data.filter(s=>s.gameInstanceId===t)[0]:null}};var Xr=class{matchQuizFacade=null;constructor(e){this.matchQuizFacade=new jr(e)}play=async e=>await this.matchQuizFacade.play(e);delete=async e=>await this.matchQuizFacade.delete(e);getGames=async(e,t)=>await this.matchQuizFacade.getGames(e,t);getGameById=async(e,t)=>await this.matchQuizFacade.getGameById(e,t);getGameResults=async(e,t,r)=>await this.matchQuizFacade.getGameResults(e,t,r);getCurrentGameResults=async e=>await this.matchQuizFacade.getCurrentGameResults(e);getMyGameEditions=async(e,t)=>await this.matchQuizFacade.getMyGameEditions(e,t);getMyGamePrediction=async e=>await this.matchQuizFacade.getMyGamePrediction(e);getUserGameEditions=async(e,t,r)=>await this.matchQuizFacade.getUserGameEditions(e,t,r);getUserGamePrediction=async(e,t,r)=>await this.matchQuizFacade.getUserGamePrediction(e,t,r)};function af(o){let t=new ir().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 or(o),predictor:new Nr(o),loyalty:new Hr(o),topX:new qr(o),matchQuiz:new Xr(o)};throw new Error("Configuration is not valid")}export{af as FansUnitedSDK};
1
+ var Tb=Object.create;var ml=Object.defineProperty;var Eb=Object.getOwnPropertyDescriptor;var Cb=Object.getOwnPropertyNames;var xb=Object.getPrototypeOf,Ab=Object.prototype.hasOwnProperty;var Ob=s=>ml(s,"__esModule",{value:!0});var K=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var Lb=(s,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Cb(e))!Ab.call(s,a)&&(r||a!=="default")&&ml(s,a,{get:()=>e[a],enumerable:!(n=Eb(e,a))||n.enumerable});return s},rr=(s,e)=>Lb(Ob(ml(s!=null?Tb(xb(s)):{},"default",!e&&s&&s.__esModule?{get:()=>s.default,enumerable:!0}:{value:s,enumerable:!0})),s);var dl=K((Av,yc)=>{"use strict";yc.exports=function(e,r){return function(){for(var a=new Array(arguments.length),u=0;u<a.length;u++)a[u]=arguments[u];return e.apply(r,a)}}});var Se=K((Ov,bc)=>{"use strict";var Bb=dl(),ir=Object.prototype.toString;function fl(s){return ir.call(s)==="[object Array]"}function hl(s){return typeof s=="undefined"}function Nb(s){return s!==null&&!hl(s)&&s.constructor!==null&&!hl(s.constructor)&&typeof s.constructor.isBuffer=="function"&&s.constructor.isBuffer(s)}function Db(s){return ir.call(s)==="[object ArrayBuffer]"}function Ub(s){return typeof FormData!="undefined"&&s instanceof FormData}function Gb(s){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(s):e=s&&s.buffer&&s.buffer instanceof ArrayBuffer,e}function $b(s){return typeof s=="string"}function Hb(s){return typeof s=="number"}function wc(s){return s!==null&&typeof s=="object"}function Cn(s){if(ir.call(s)!=="[object Object]")return!1;var e=Object.getPrototypeOf(s);return e===null||e===Object.prototype}function Vb(s){return ir.call(s)==="[object Date]"}function qb(s){return ir.call(s)==="[object File]"}function kb(s){return ir.call(s)==="[object Blob]"}function Mc(s){return ir.call(s)==="[object Function]"}function Wb(s){return wc(s)&&Mc(s.pipe)}function Kb(s){return typeof URLSearchParams!="undefined"&&s instanceof URLSearchParams}function Xb(s){return s.trim?s.trim():s.replace(/^\s+|\s+$/g,"")}function Yb(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function gl(s,e){if(!(s===null||typeof s=="undefined"))if(typeof s!="object"&&(s=[s]),fl(s))for(var r=0,n=s.length;r<n;r++)e.call(null,s[r],r,s);else for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&e.call(null,s[a],a,s)}function yl(){var s={};function e(a,u){Cn(s[u])&&Cn(a)?s[u]=yl(s[u],a):Cn(a)?s[u]=yl({},a):fl(a)?s[u]=a.slice():s[u]=a}for(var r=0,n=arguments.length;r<n;r++)gl(arguments[r],e);return s}function zb(s,e,r){return gl(e,function(a,u){r&&typeof a=="function"?s[u]=Bb(a,r):s[u]=a}),s}function Qb(s){return s.charCodeAt(0)===65279&&(s=s.slice(1)),s}bc.exports={isArray:fl,isArrayBuffer:Db,isBuffer:Nb,isFormData:Ub,isArrayBufferView:Gb,isString:$b,isNumber:Hb,isObject:wc,isPlainObject:Cn,isUndefined:hl,isDate:Vb,isFile:qb,isBlob:kb,isFunction:Mc,isStream:Wb,isURLSearchParams:Kb,isStandardBrowserEnv:Yb,forEach:gl,merge:yl,extend:zb,trim:Xb,stripBOM:Qb}});var wl=K((Lv,_c)=>{"use strict";var Ir=Se();function vc(s){return encodeURIComponent(s).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}_c.exports=function(e,r,n){if(!r)return e;var a;if(n)a=n(r);else if(Ir.isURLSearchParams(r))a=r.toString();else{var u=[];Ir.forEach(r,function(v,T){v===null||typeof v=="undefined"||(Ir.isArray(v)?T=T+"[]":v=[v],Ir.forEach(v,function(F){Ir.isDate(F)?F=F.toISOString():Ir.isObject(F)&&(F=JSON.stringify(F)),u.push(vc(T)+"="+vc(F))}))}),a=u.join("&")}if(a){var f=e.indexOf("#");f!==-1&&(e=e.slice(0,f)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}});var Pc=K((Bv,Ic)=>{"use strict";var Jb=Se();function xn(){this.handlers=[]}xn.prototype.use=function(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};xn.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};xn.prototype.forEach=function(e){Jb.forEach(this.handlers,function(n){n!==null&&e(n)})};Ic.exports=xn});var Fc=K((Nv,Rc)=>{"use strict";var Zb=Se();Rc.exports=function(e,r){Zb.forEach(e,function(a,u){u!==r&&u.toUpperCase()===r.toUpperCase()&&(e[r]=a,delete e[u])})}});var Ml=K((Dv,Sc)=>{"use strict";Sc.exports=function(e,r,n,a,u){return e.config=r,n&&(e.code=n),e.request=a,e.response=u,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 bl=K((Uv,Tc)=>{"use strict";var jb=Ml();Tc.exports=function(e,r,n,a,u){var f=new Error(e);return jb(f,r,n,a,u)}});var Cc=K((Gv,Ec)=>{"use strict";var ev=bl();Ec.exports=function(e,r,n){var a=n.config.validateStatus;!n.status||!a||a(n.status)?e(n):r(ev("Request failed with status code "+n.status,n.config,null,n.request,n))}});var Ac=K(($v,xc)=>{"use strict";var An=Se();xc.exports=An.isStandardBrowserEnv()?function(){return{write:function(r,n,a,u,f,g){var v=[];v.push(r+"="+encodeURIComponent(n)),An.isNumber(a)&&v.push("expires="+new Date(a).toGMTString()),An.isString(u)&&v.push("path="+u),An.isString(f)&&v.push("domain="+f),g===!0&&v.push("secure"),document.cookie=v.join("; ")},read:function(r){var n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var Lc=K((Hv,Oc)=>{"use strict";Oc.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var Nc=K((Vv,Bc)=>{"use strict";Bc.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var Uc=K((qv,Dc)=>{"use strict";var tv=Lc(),rv=Nc();Dc.exports=function(e,r){return e&&!tv(r)?rv(e,r):r}});var $c=K((kv,Gc)=>{"use strict";var vl=Se(),iv=["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"];Gc.exports=function(e){var r={},n,a,u;return e&&vl.forEach(e.split(`
2
+ `),function(g){if(u=g.indexOf(":"),n=vl.trim(g.substr(0,u)).toLowerCase(),a=vl.trim(g.substr(u+1)),n){if(r[n]&&iv.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([a]):r[n]=r[n]?r[n]+", "+a:a}}),r}});var qc=K((Wv,Vc)=>{"use strict";var Hc=Se();Vc.exports=Hc.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function a(u){var f=u;return e&&(r.setAttribute("href",f),f=r.href),r.setAttribute("href",f),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=a(window.location.href),function(f){var g=Hc.isString(f)?a(f):f;return g.protocol===n.protocol&&g.host===n.host}}():function(){return function(){return!0}}()});var bi=K((Kv,kc)=>{"use strict";function _l(s){this.message=s}_l.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};_l.prototype.__CANCEL__=!0;kc.exports=_l});var Pl=K((Xv,Wc)=>{"use strict";var On=Se(),nv=Cc(),ov=Ac(),av=wl(),sv=Uc(),lv=$c(),pv=qc(),Il=bl(),uv=vi(),cv=bi();Wc.exports=function(e){return new Promise(function(n,a){var u=e.data,f=e.headers,g=e.responseType,v;function T(){e.cancelToken&&e.cancelToken.unsubscribe(v),e.signal&&e.signal.removeEventListener("abort",v)}On.isFormData(u)&&delete f["Content-Type"];var M=new XMLHttpRequest;if(e.auth){var F=e.auth.username||"",Y=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";f.Authorization="Basic "+btoa(F+":"+Y)}var be=sv(e.baseURL,e.url);M.open(e.method.toUpperCase(),av(be,e.params,e.paramsSerializer),!0),M.timeout=e.timeout;function he(){if(!!M){var ve="getAllResponseHeaders"in M?lv(M.getAllResponseHeaders()):null,pe=!g||g==="text"||g==="json"?M.responseText:M.response,_e={data:pe,status:M.status,statusText:M.statusText,headers:ve,config:e,request:M};nv(function(at){n(at),T()},function(at){a(at),T()},_e),M=null}}if("onloadend"in M?M.onloadend=he:M.onreadystatechange=function(){!M||M.readyState!==4||M.status===0&&!(M.responseURL&&M.responseURL.indexOf("file:")===0)||setTimeout(he)},M.onabort=function(){!M||(a(Il("Request aborted",e,"ECONNABORTED",M)),M=null)},M.onerror=function(){a(Il("Network Error",e,null,M)),M=null},M.ontimeout=function(){var pe=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",_e=e.transitional||uv.transitional;e.timeoutErrorMessage&&(pe=e.timeoutErrorMessage),a(Il(pe,e,_e.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",M)),M=null},On.isStandardBrowserEnv()){var ot=(e.withCredentials||pv(be))&&e.xsrfCookieName?ov.read(e.xsrfCookieName):void 0;ot&&(f[e.xsrfHeaderName]=ot)}"setRequestHeader"in M&&On.forEach(f,function(pe,_e){typeof u=="undefined"&&_e.toLowerCase()==="content-type"?delete f[_e]:M.setRequestHeader(_e,pe)}),On.isUndefined(e.withCredentials)||(M.withCredentials=!!e.withCredentials),g&&g!=="json"&&(M.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&M.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&M.upload&&M.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(v=function(ve){!M||(a(!ve||ve&&ve.type?new cv("canceled"):ve),M.abort(),M=null)},e.cancelToken&&e.cancelToken.subscribe(v),e.signal&&(e.signal.aborted?v():e.signal.addEventListener("abort",v))),u||(u=null),M.send(u)})}});var vi=K((Yv,Yc)=>{"use strict";var ce=Se(),Kc=Fc(),mv=Ml(),dv={"Content-Type":"application/x-www-form-urlencoded"};function Xc(s,e){!ce.isUndefined(s)&&ce.isUndefined(s["Content-Type"])&&(s["Content-Type"]=e)}function fv(){var s;return typeof XMLHttpRequest!="undefined"?s=Pl():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(s=Pl()),s}function hv(s,e,r){if(ce.isString(s))try{return(e||JSON.parse)(s),ce.trim(s)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(s)}var Ln={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:fv(),transformRequest:[function(e,r){return Kc(r,"Accept"),Kc(r,"Content-Type"),ce.isFormData(e)||ce.isArrayBuffer(e)||ce.isBuffer(e)||ce.isStream(e)||ce.isFile(e)||ce.isBlob(e)?e:ce.isArrayBufferView(e)?e.buffer:ce.isURLSearchParams(e)?(Xc(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):ce.isObject(e)||r&&r["Content-Type"]==="application/json"?(Xc(r,"application/json"),hv(e)):e}],transformResponse:[function(e){var r=this.transitional||Ln.transitional,n=r&&r.silentJSONParsing,a=r&&r.forcedJSONParsing,u=!n&&this.responseType==="json";if(u||a&&ce.isString(e)&&e.length)try{return JSON.parse(e)}catch(f){if(u)throw f.name==="SyntaxError"?mv(f,this,"E_JSON_PARSE"):f}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, */*"}}};ce.forEach(["delete","get","head"],function(e){Ln.headers[e]={}});ce.forEach(["post","put","patch"],function(e){Ln.headers[e]=ce.merge(dv)});Yc.exports=Ln});var Qc=K((zv,zc)=>{"use strict";var gv=Se(),yv=vi();zc.exports=function(e,r,n){var a=this||yv;return gv.forEach(n,function(f){e=f.call(a,e,r)}),e}});var Rl=K((Qv,Jc)=>{"use strict";Jc.exports=function(e){return!!(e&&e.__CANCEL__)}});var em=K((Jv,jc)=>{"use strict";var Zc=Se(),Fl=Qc(),wv=Rl(),Mv=vi(),bv=bi();function Sl(s){if(s.cancelToken&&s.cancelToken.throwIfRequested(),s.signal&&s.signal.aborted)throw new bv("canceled")}jc.exports=function(e){Sl(e),e.headers=e.headers||{},e.data=Fl.call(e,e.data,e.headers,e.transformRequest),e.headers=Zc.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Zc.forEach(["delete","get","head","post","put","patch","common"],function(a){delete e.headers[a]});var r=e.adapter||Mv.adapter;return r(e).then(function(a){return Sl(e),a.data=Fl.call(e,a.data,a.headers,e.transformResponse),a},function(a){return wv(a)||(Sl(e),a&&a.response&&(a.response.data=Fl.call(e,a.response.data,a.response.headers,e.transformResponse))),Promise.reject(a)})}});var Tl=K((Zv,tm)=>{"use strict";var Ne=Se();tm.exports=function(e,r){r=r||{};var n={};function a(M,F){return Ne.isPlainObject(M)&&Ne.isPlainObject(F)?Ne.merge(M,F):Ne.isPlainObject(F)?Ne.merge({},F):Ne.isArray(F)?F.slice():F}function u(M){if(Ne.isUndefined(r[M])){if(!Ne.isUndefined(e[M]))return a(void 0,e[M])}else return a(e[M],r[M])}function f(M){if(!Ne.isUndefined(r[M]))return a(void 0,r[M])}function g(M){if(Ne.isUndefined(r[M])){if(!Ne.isUndefined(e[M]))return a(void 0,e[M])}else return a(void 0,r[M])}function v(M){if(M in r)return a(e[M],r[M]);if(M in e)return a(void 0,e[M])}var T={url:f,method:f,data:f,baseURL:g,transformRequest:g,transformResponse:g,paramsSerializer:g,timeout:g,timeoutMessage:g,withCredentials:g,adapter:g,responseType:g,xsrfCookieName:g,xsrfHeaderName:g,onUploadProgress:g,onDownloadProgress:g,decompress:g,maxContentLength:g,maxBodyLength:g,transport:g,httpAgent:g,httpsAgent:g,cancelToken:g,socketPath:g,responseEncoding:g,validateStatus:v};return Ne.forEach(Object.keys(e).concat(Object.keys(r)),function(F){var Y=T[F]||u,be=Y(F);Ne.isUndefined(be)&&Y!==v||(n[F]=be)}),n}});var El=K((jv,rm)=>{rm.exports={version:"0.24.0"}});var om=K((e_,nm)=>{"use strict";var vv=El().version,Cl={};["object","boolean","number","function","string","symbol"].forEach(function(s,e){Cl[s]=function(n){return typeof n===s||"a"+(e<1?"n ":" ")+s}});var im={};Cl.transitional=function(e,r,n){function a(u,f){return"[Axios v"+vv+"] Transitional option '"+u+"'"+f+(n?". "+n:"")}return function(u,f,g){if(e===!1)throw new Error(a(f," has been removed"+(r?" in "+r:"")));return r&&!im[f]&&(im[f]=!0,console.warn(a(f," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(u,f,g):!0}};function _v(s,e,r){if(typeof s!="object")throw new TypeError("options must be an object");for(var n=Object.keys(s),a=n.length;a-- >0;){var u=n[a],f=e[u];if(f){var g=s[u],v=g===void 0||f(g,u,s);if(v!==!0)throw new TypeError("option "+u+" must be "+v);continue}if(r!==!0)throw Error("Unknown option "+u)}}nm.exports={assertOptions:_v,validators:Cl}});var cm=K((t_,um)=>{"use strict";var am=Se(),Iv=wl(),sm=Pc(),lm=em(),Bn=Tl(),pm=om(),Pr=pm.validators;function _i(s){this.defaults=s,this.interceptors={request:new sm,response:new sm}}_i.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=Bn(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;r!==void 0&&pm.assertOptions(r,{silentJSONParsing:Pr.transitional(Pr.boolean),forcedJSONParsing:Pr.transitional(Pr.boolean),clarifyTimeoutError:Pr.transitional(Pr.boolean)},!1);var n=[],a=!0;this.interceptors.request.forEach(function(Y){typeof Y.runWhen=="function"&&Y.runWhen(e)===!1||(a=a&&Y.synchronous,n.unshift(Y.fulfilled,Y.rejected))});var u=[];this.interceptors.response.forEach(function(Y){u.push(Y.fulfilled,Y.rejected)});var f;if(!a){var g=[lm,void 0];for(Array.prototype.unshift.apply(g,n),g=g.concat(u),f=Promise.resolve(e);g.length;)f=f.then(g.shift(),g.shift());return f}for(var v=e;n.length;){var T=n.shift(),M=n.shift();try{v=T(v)}catch(F){M(F);break}}try{f=lm(v)}catch(F){return Promise.reject(F)}for(;u.length;)f=f.then(u.shift(),u.shift());return f};_i.prototype.getUri=function(e){return e=Bn(this.defaults,e),Iv(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};am.forEach(["delete","get","head","options"],function(e){_i.prototype[e]=function(r,n){return this.request(Bn(n||{},{method:e,url:r,data:(n||{}).data}))}});am.forEach(["post","put","patch"],function(e){_i.prototype[e]=function(r,n,a){return this.request(Bn(a||{},{method:e,url:r,data:n}))}});um.exports=_i});var dm=K((r_,mm)=>{"use strict";var Pv=bi();function Rr(s){if(typeof s!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(a){e=a});var r=this;this.promise.then(function(n){if(!!r._listeners){var a,u=r._listeners.length;for(a=0;a<u;a++)r._listeners[a](n);r._listeners=null}}),this.promise.then=function(n){var a,u=new Promise(function(f){r.subscribe(f),a=f}).then(n);return u.cancel=function(){r.unsubscribe(a)},u},s(function(a){r.reason||(r.reason=new Pv(a),e(r.reason))})}Rr.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};Rr.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};Rr.prototype.unsubscribe=function(e){if(!!this._listeners){var r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}};Rr.source=function(){var e,r=new Rr(function(a){e=a});return{token:r,cancel:e}};mm.exports=Rr});var hm=K((i_,fm)=>{"use strict";fm.exports=function(e){return function(n){return e.apply(null,n)}}});var ym=K((n_,gm)=>{"use strict";gm.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var bm=K((o_,xl)=>{"use strict";var wm=Se(),Rv=dl(),Nn=cm(),Fv=Tl(),Sv=vi();function Mm(s){var e=new Nn(s),r=Rv(Nn.prototype.request,e);return wm.extend(r,Nn.prototype,e),wm.extend(r,e),r.create=function(a){return Mm(Fv(s,a))},r}var ct=Mm(Sv);ct.Axios=Nn;ct.Cancel=bi();ct.CancelToken=dm();ct.isCancel=Rl();ct.VERSION=El().version;ct.all=function(e){return Promise.all(e)};ct.spread=hm();ct.isAxiosError=ym();xl.exports=ct;xl.exports.default=ct});var nr=K((a_,vm)=>{vm.exports=bm()});var _m=K((Fr,Ii)=>{(function(){var s,e="4.17.21",r=200,n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",u="Invalid `variable` option passed into `_.template`",f="__lodash_hash_undefined__",g=500,v="__lodash_placeholder__",T=1,M=2,F=4,Y=1,be=2,he=1,ot=2,ve=4,pe=8,_e=16,$e=32,at=64,ft=128,Jr=256,ka=512,Om=30,Lm="...",Bm=800,Nm=16,Gl=1,Dm=2,q=3,Kt=1/0,St=9007199254740991,Um=17976931348623157e292,Ni=0/0,st=4294967295,Gm=st-1,$m=st>>>1,Hm=[["ary",ft],["bind",he],["bindKey",ot],["curry",pe],["curryRight",_e],["flip",ka],["partial",$e],["partialRight",at],["rearg",Jr]],lr="[object Arguments]",Di="[object Array]",Vm="[object AsyncFunction]",Zr="[object Boolean]",jr="[object Date]",qm="[object DOMException]",Ui="[object Error]",Gi="[object Function]",$l="[object GeneratorFunction]",Ze="[object Map]",ei="[object Number]",km="[object Null]",ht="[object Object]",Hl="[object Promise]",Wm="[object Proxy]",ti="[object RegExp]",je="[object Set]",ri="[object String]",$i="[object Symbol]",Km="[object Undefined]",ii="[object WeakMap]",Xm="[object WeakSet]",ni="[object ArrayBuffer]",pr="[object DataView]",Wa="[object Float32Array]",Ka="[object Float64Array]",Xa="[object Int8Array]",Ya="[object Int16Array]",za="[object Int32Array]",Qa="[object Uint8Array]",Ja="[object Uint8ClampedArray]",Za="[object Uint16Array]",ja="[object Uint32Array]",Ym=/\b__p \+= '';/g,zm=/\b(__p \+=) '' \+/g,Qm=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Vl=/&(?:amp|lt|gt|quot|#39);/g,ql=/[&<>"']/g,Jm=RegExp(Vl.source),Zm=RegExp(ql.source),jm=/<%-([\s\S]+?)%>/g,ed=/<%([\s\S]+?)%>/g,kl=/<%=([\s\S]+?)%>/g,td=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,rd=/^\w*$/,id=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,es=/[\\^$.*+?()[\]{}|]/g,nd=RegExp(es.source),ts=/^\s+/,od=/\s/,ad=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,sd=/\{\n\/\* \[wrapped with (.+)\] \*/,ld=/,? & /,pd=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ud=/[()=,{}\[\]\/\s]/,cd=/\\(\\)?/g,md=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Wl=/\w*$/,dd=/^[-+]0x[0-9a-f]+$/i,fd=/^0b[01]+$/i,hd=/^\[object .+?Constructor\]$/,gd=/^0o[0-7]+$/i,yd=/^(?:0|[1-9]\d*)$/,wd=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Hi=/($^)/,Md=/['\n\r\u2028\u2029\\]/g,Vi="\\ud800-\\udfff",bd="\\u0300-\\u036f",vd="\\ufe20-\\ufe2f",_d="\\u20d0-\\u20ff",Kl=bd+vd+_d,Xl="\\u2700-\\u27bf",Yl="a-z\\xdf-\\xf6\\xf8-\\xff",Id="\\xac\\xb1\\xd7\\xf7",Pd="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Rd="\\u2000-\\u206f",Fd=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",zl="A-Z\\xc0-\\xd6\\xd8-\\xde",Ql="\\ufe0e\\ufe0f",Jl=Id+Pd+Rd+Fd,rs="['\u2019]",Sd="["+Vi+"]",Zl="["+Jl+"]",qi="["+Kl+"]",jl="\\d+",Td="["+Xl+"]",ep="["+Yl+"]",tp="[^"+Vi+Jl+jl+Xl+Yl+zl+"]",is="\\ud83c[\\udffb-\\udfff]",Ed="(?:"+qi+"|"+is+")",rp="[^"+Vi+"]",ns="(?:\\ud83c[\\udde6-\\uddff]){2}",os="[\\ud800-\\udbff][\\udc00-\\udfff]",ur="["+zl+"]",ip="\\u200d",np="(?:"+ep+"|"+tp+")",Cd="(?:"+ur+"|"+tp+")",op="(?:"+rs+"(?:d|ll|m|re|s|t|ve))?",ap="(?:"+rs+"(?:D|LL|M|RE|S|T|VE))?",sp=Ed+"?",lp="["+Ql+"]?",xd="(?:"+ip+"(?:"+[rp,ns,os].join("|")+")"+lp+sp+")*",Ad="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Od="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",pp=lp+sp+xd,Ld="(?:"+[Td,ns,os].join("|")+")"+pp,Bd="(?:"+[rp+qi+"?",qi,ns,os,Sd].join("|")+")",Nd=RegExp(rs,"g"),Dd=RegExp(qi,"g"),as=RegExp(is+"(?="+is+")|"+Bd+pp,"g"),Ud=RegExp([ur+"?"+ep+"+"+op+"(?="+[Zl,ur,"$"].join("|")+")",Cd+"+"+ap+"(?="+[Zl,ur+np,"$"].join("|")+")",ur+"?"+np+"+"+op,ur+"+"+ap,Od,Ad,jl,Ld].join("|"),"g"),Gd=RegExp("["+ip+Vi+Kl+Ql+"]"),$d=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Hd=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Vd=-1,J={};J[Wa]=J[Ka]=J[Xa]=J[Ya]=J[za]=J[Qa]=J[Ja]=J[Za]=J[ja]=!0,J[lr]=J[Di]=J[ni]=J[Zr]=J[pr]=J[jr]=J[Ui]=J[Gi]=J[Ze]=J[ei]=J[ht]=J[ti]=J[je]=J[ri]=J[ii]=!1;var Q={};Q[lr]=Q[Di]=Q[ni]=Q[pr]=Q[Zr]=Q[jr]=Q[Wa]=Q[Ka]=Q[Xa]=Q[Ya]=Q[za]=Q[Ze]=Q[ei]=Q[ht]=Q[ti]=Q[je]=Q[ri]=Q[$i]=Q[Qa]=Q[Ja]=Q[Za]=Q[ja]=!0,Q[Ui]=Q[Gi]=Q[ii]=!1;var qd={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},kd={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Wd={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Kd={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Xd=parseFloat,Yd=parseInt,up=typeof global=="object"&&global&&global.Object===Object&&global,zd=typeof self=="object"&&self&&self.Object===Object&&self,se=up||zd||Function("return this")(),ss=typeof Fr=="object"&&Fr&&!Fr.nodeType&&Fr,Xt=ss&&typeof Ii=="object"&&Ii&&!Ii.nodeType&&Ii,cp=Xt&&Xt.exports===ss,ls=cp&&up.process,He=function(){try{var y=Xt&&Xt.require&&Xt.require("util").types;return y||ls&&ls.binding&&ls.binding("util")}catch{}}(),mp=He&&He.isArrayBuffer,dp=He&&He.isDate,fp=He&&He.isMap,hp=He&&He.isRegExp,gp=He&&He.isSet,yp=He&&He.isTypedArray;function Ce(y,_,b){switch(b.length){case 0:return y.call(_);case 1:return y.call(_,b[0]);case 2:return y.call(_,b[0],b[1]);case 3:return y.call(_,b[0],b[1],b[2])}return y.apply(_,b)}function Qd(y,_,b,E){for(var L=-1,k=y==null?0:y.length;++L<k;){var oe=y[L];_(E,oe,b(oe),y)}return E}function Ve(y,_){for(var b=-1,E=y==null?0:y.length;++b<E&&_(y[b],b,y)!==!1;);return y}function Jd(y,_){for(var b=y==null?0:y.length;b--&&_(y[b],b,y)!==!1;);return y}function wp(y,_){for(var b=-1,E=y==null?0:y.length;++b<E;)if(!_(y[b],b,y))return!1;return!0}function Tt(y,_){for(var b=-1,E=y==null?0:y.length,L=0,k=[];++b<E;){var oe=y[b];_(oe,b,y)&&(k[L++]=oe)}return k}function ki(y,_){var b=y==null?0:y.length;return!!b&&cr(y,_,0)>-1}function ps(y,_,b){for(var E=-1,L=y==null?0:y.length;++E<L;)if(b(_,y[E]))return!0;return!1}function Z(y,_){for(var b=-1,E=y==null?0:y.length,L=Array(E);++b<E;)L[b]=_(y[b],b,y);return L}function Et(y,_){for(var b=-1,E=_.length,L=y.length;++b<E;)y[L+b]=_[b];return y}function us(y,_,b,E){var L=-1,k=y==null?0:y.length;for(E&&k&&(b=y[++L]);++L<k;)b=_(b,y[L],L,y);return b}function Zd(y,_,b,E){var L=y==null?0:y.length;for(E&&L&&(b=y[--L]);L--;)b=_(b,y[L],L,y);return b}function cs(y,_){for(var b=-1,E=y==null?0:y.length;++b<E;)if(_(y[b],b,y))return!0;return!1}var jd=ms("length");function ef(y){return y.split("")}function tf(y){return y.match(pd)||[]}function Mp(y,_,b){var E;return b(y,function(L,k,oe){if(_(L,k,oe))return E=k,!1}),E}function Wi(y,_,b,E){for(var L=y.length,k=b+(E?1:-1);E?k--:++k<L;)if(_(y[k],k,y))return k;return-1}function cr(y,_,b){return _===_?ff(y,_,b):Wi(y,bp,b)}function rf(y,_,b,E){for(var L=b-1,k=y.length;++L<k;)if(E(y[L],_))return L;return-1}function bp(y){return y!==y}function vp(y,_){var b=y==null?0:y.length;return b?fs(y,_)/b:Ni}function ms(y){return function(_){return _==null?s:_[y]}}function ds(y){return function(_){return y==null?s:y[_]}}function _p(y,_,b,E,L){return L(y,function(k,oe,z){b=E?(E=!1,k):_(b,k,oe,z)}),b}function nf(y,_){var b=y.length;for(y.sort(_);b--;)y[b]=y[b].value;return y}function fs(y,_){for(var b,E=-1,L=y.length;++E<L;){var k=_(y[E]);k!==s&&(b=b===s?k:b+k)}return b}function hs(y,_){for(var b=-1,E=Array(y);++b<y;)E[b]=_(b);return E}function of(y,_){return Z(_,function(b){return[b,y[b]]})}function Ip(y){return y&&y.slice(0,Sp(y)+1).replace(ts,"")}function xe(y){return function(_){return y(_)}}function gs(y,_){return Z(_,function(b){return y[b]})}function oi(y,_){return y.has(_)}function Pp(y,_){for(var b=-1,E=y.length;++b<E&&cr(_,y[b],0)>-1;);return b}function Rp(y,_){for(var b=y.length;b--&&cr(_,y[b],0)>-1;);return b}function af(y,_){for(var b=y.length,E=0;b--;)y[b]===_&&++E;return E}var sf=ds(qd),lf=ds(kd);function pf(y){return"\\"+Kd[y]}function uf(y,_){return y==null?s:y[_]}function mr(y){return Gd.test(y)}function cf(y){return $d.test(y)}function mf(y){for(var _,b=[];!(_=y.next()).done;)b.push(_.value);return b}function ys(y){var _=-1,b=Array(y.size);return y.forEach(function(E,L){b[++_]=[L,E]}),b}function Fp(y,_){return function(b){return y(_(b))}}function Ct(y,_){for(var b=-1,E=y.length,L=0,k=[];++b<E;){var oe=y[b];(oe===_||oe===v)&&(y[b]=v,k[L++]=b)}return k}function Ki(y){var _=-1,b=Array(y.size);return y.forEach(function(E){b[++_]=E}),b}function df(y){var _=-1,b=Array(y.size);return y.forEach(function(E){b[++_]=[E,E]}),b}function ff(y,_,b){for(var E=b-1,L=y.length;++E<L;)if(y[E]===_)return E;return-1}function hf(y,_,b){for(var E=b+1;E--;)if(y[E]===_)return E;return E}function dr(y){return mr(y)?yf(y):jd(y)}function et(y){return mr(y)?wf(y):ef(y)}function Sp(y){for(var _=y.length;_--&&od.test(y.charAt(_)););return _}var gf=ds(Wd);function yf(y){for(var _=as.lastIndex=0;as.test(y);)++_;return _}function wf(y){return y.match(as)||[]}function Mf(y){return y.match(Ud)||[]}var bf=function y(_){_=_==null?se:xt.defaults(se.Object(),_,xt.pick(se,Hd));var b=_.Array,E=_.Date,L=_.Error,k=_.Function,oe=_.Math,z=_.Object,ws=_.RegExp,vf=_.String,qe=_.TypeError,Xi=b.prototype,_f=k.prototype,fr=z.prototype,Yi=_["__core-js_shared__"],zi=_f.toString,X=fr.hasOwnProperty,If=0,Tp=function(){var t=/[^.]+$/.exec(Yi&&Yi.keys&&Yi.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Qi=fr.toString,Pf=zi.call(z),Rf=se._,Ff=ws("^"+zi.call(X).replace(es,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ji=cp?_.Buffer:s,At=_.Symbol,Zi=_.Uint8Array,Ep=Ji?Ji.allocUnsafe:s,ji=Fp(z.getPrototypeOf,z),Cp=z.create,xp=fr.propertyIsEnumerable,en=Xi.splice,Ap=At?At.isConcatSpreadable:s,ai=At?At.iterator:s,Yt=At?At.toStringTag:s,tn=function(){try{var t=jt(z,"defineProperty");return t({},"",{}),t}catch{}}(),Sf=_.clearTimeout!==se.clearTimeout&&_.clearTimeout,Tf=E&&E.now!==se.Date.now&&E.now,Ef=_.setTimeout!==se.setTimeout&&_.setTimeout,rn=oe.ceil,nn=oe.floor,Ms=z.getOwnPropertySymbols,Cf=Ji?Ji.isBuffer:s,Op=_.isFinite,xf=Xi.join,Af=Fp(z.keys,z),ae=oe.max,me=oe.min,Of=E.now,Lf=_.parseInt,Lp=oe.random,Bf=Xi.reverse,bs=jt(_,"DataView"),si=jt(_,"Map"),vs=jt(_,"Promise"),hr=jt(_,"Set"),li=jt(_,"WeakMap"),pi=jt(z,"create"),on=li&&new li,gr={},Nf=er(bs),Df=er(si),Uf=er(vs),Gf=er(hr),$f=er(li),an=At?At.prototype:s,ui=an?an.valueOf:s,Bp=an?an.toString:s;function c(t){if(ee(t)&&!B(t)&&!(t instanceof H)){if(t instanceof ke)return t;if(X.call(t,"__wrapped__"))return Nu(t)}return new ke(t)}var yr=function(){function t(){}return function(i){if(!j(i))return{};if(Cp)return Cp(i);t.prototype=i;var o=new t;return t.prototype=s,o}}();function sn(){}function ke(t,i){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!i,this.__index__=0,this.__values__=s}c.templateSettings={escape:jm,evaluate:ed,interpolate:kl,variable:"",imports:{_:c}},c.prototype=sn.prototype,c.prototype.constructor=c,ke.prototype=yr(sn.prototype),ke.prototype.constructor=ke;function H(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=st,this.__views__=[]}function Hf(){var t=new H(this.__wrapped__);return t.__actions__=Ie(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Ie(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Ie(this.__views__),t}function Vf(){if(this.__filtered__){var t=new H(this);t.__dir__=-1,t.__filtered__=!0}else t=this.clone(),t.__dir__*=-1;return t}function qf(){var t=this.__wrapped__.value(),i=this.__dir__,o=B(t),l=i<0,p=o?t.length:0,m=tg(0,p,this.__views__),d=m.start,h=m.end,w=h-d,I=l?h:d-1,P=this.__iteratees__,R=P.length,S=0,C=me(w,this.__takeCount__);if(!o||!l&&p==w&&C==w)return ou(t,this.__actions__);var A=[];e:for(;w--&&S<C;){I+=i;for(var U=-1,O=t[I];++U<R;){var $=P[U],V=$.iteratee,Le=$.type,we=V(O);if(Le==Dm)O=we;else if(!we){if(Le==Gl)continue e;break e}}A[S++]=O}return A}H.prototype=yr(sn.prototype),H.prototype.constructor=H;function zt(t){var i=-1,o=t==null?0:t.length;for(this.clear();++i<o;){var l=t[i];this.set(l[0],l[1])}}function kf(){this.__data__=pi?pi(null):{},this.size=0}function Wf(t){var i=this.has(t)&&delete this.__data__[t];return this.size-=i?1:0,i}function Kf(t){var i=this.__data__;if(pi){var o=i[t];return o===f?s:o}return X.call(i,t)?i[t]:s}function Xf(t){var i=this.__data__;return pi?i[t]!==s:X.call(i,t)}function Yf(t,i){var o=this.__data__;return this.size+=this.has(t)?0:1,o[t]=pi&&i===s?f:i,this}zt.prototype.clear=kf,zt.prototype.delete=Wf,zt.prototype.get=Kf,zt.prototype.has=Xf,zt.prototype.set=Yf;function gt(t){var i=-1,o=t==null?0:t.length;for(this.clear();++i<o;){var l=t[i];this.set(l[0],l[1])}}function zf(){this.__data__=[],this.size=0}function Qf(t){var i=this.__data__,o=ln(i,t);if(o<0)return!1;var l=i.length-1;return o==l?i.pop():en.call(i,o,1),--this.size,!0}function Jf(t){var i=this.__data__,o=ln(i,t);return o<0?s:i[o][1]}function Zf(t){return ln(this.__data__,t)>-1}function jf(t,i){var o=this.__data__,l=ln(o,t);return l<0?(++this.size,o.push([t,i])):o[l][1]=i,this}gt.prototype.clear=zf,gt.prototype.delete=Qf,gt.prototype.get=Jf,gt.prototype.has=Zf,gt.prototype.set=jf;function yt(t){var i=-1,o=t==null?0:t.length;for(this.clear();++i<o;){var l=t[i];this.set(l[0],l[1])}}function eh(){this.size=0,this.__data__={hash:new zt,map:new(si||gt),string:new zt}}function th(t){var i=bn(this,t).delete(t);return this.size-=i?1:0,i}function rh(t){return bn(this,t).get(t)}function ih(t){return bn(this,t).has(t)}function nh(t,i){var o=bn(this,t),l=o.size;return o.set(t,i),this.size+=o.size==l?0:1,this}yt.prototype.clear=eh,yt.prototype.delete=th,yt.prototype.get=rh,yt.prototype.has=ih,yt.prototype.set=nh;function Qt(t){var i=-1,o=t==null?0:t.length;for(this.__data__=new yt;++i<o;)this.add(t[i])}function oh(t){return this.__data__.set(t,f),this}function ah(t){return this.__data__.has(t)}Qt.prototype.add=Qt.prototype.push=oh,Qt.prototype.has=ah;function tt(t){var i=this.__data__=new gt(t);this.size=i.size}function sh(){this.__data__=new gt,this.size=0}function lh(t){var i=this.__data__,o=i.delete(t);return this.size=i.size,o}function ph(t){return this.__data__.get(t)}function uh(t){return this.__data__.has(t)}function ch(t,i){var o=this.__data__;if(o instanceof gt){var l=o.__data__;if(!si||l.length<r-1)return l.push([t,i]),this.size=++o.size,this;o=this.__data__=new yt(l)}return o.set(t,i),this.size=o.size,this}tt.prototype.clear=sh,tt.prototype.delete=lh,tt.prototype.get=ph,tt.prototype.has=uh,tt.prototype.set=ch;function Np(t,i){var o=B(t),l=!o&&tr(t),p=!o&&!l&&Dt(t),m=!o&&!l&&!p&&vr(t),d=o||l||p||m,h=d?hs(t.length,vf):[],w=h.length;for(var I in t)(i||X.call(t,I))&&!(d&&(I=="length"||p&&(I=="offset"||I=="parent")||m&&(I=="buffer"||I=="byteLength"||I=="byteOffset")||vt(I,w)))&&h.push(I);return h}function Dp(t){var i=t.length;return i?t[As(0,i-1)]:s}function mh(t,i){return vn(Ie(t),Jt(i,0,t.length))}function dh(t){return vn(Ie(t))}function _s(t,i,o){(o!==s&&!rt(t[i],o)||o===s&&!(i in t))&&wt(t,i,o)}function ci(t,i,o){var l=t[i];(!(X.call(t,i)&&rt(l,o))||o===s&&!(i in t))&&wt(t,i,o)}function ln(t,i){for(var o=t.length;o--;)if(rt(t[o][0],i))return o;return-1}function fh(t,i,o,l){return Ot(t,function(p,m,d){i(l,p,o(p),d)}),l}function Up(t,i){return t&&pt(i,le(i),t)}function hh(t,i){return t&&pt(i,Re(i),t)}function wt(t,i,o){i=="__proto__"&&tn?tn(t,i,{configurable:!0,enumerable:!0,value:o,writable:!0}):t[i]=o}function Is(t,i){for(var o=-1,l=i.length,p=b(l),m=t==null;++o<l;)p[o]=m?s:il(t,i[o]);return p}function Jt(t,i,o){return t===t&&(o!==s&&(t=t<=o?t:o),i!==s&&(t=t>=i?t:i)),t}function We(t,i,o,l,p,m){var d,h=i&T,w=i&M,I=i&F;if(o&&(d=p?o(t,l,p,m):o(t)),d!==s)return d;if(!j(t))return t;var P=B(t);if(P){if(d=ig(t),!h)return Ie(t,d)}else{var R=de(t),S=R==Gi||R==$l;if(Dt(t))return lu(t,h);if(R==ht||R==lr||S&&!p){if(d=w||S?{}:Su(t),!h)return w?Kh(t,hh(d,t)):Wh(t,Up(d,t))}else{if(!Q[R])return p?t:{};d=ng(t,R,h)}}m||(m=new tt);var C=m.get(t);if(C)return C;m.set(t,d),rc(t)?t.forEach(function(O){d.add(We(O,i,o,O,t,m))}):ec(t)&&t.forEach(function(O,$){d.set($,We(O,i,o,$,t,m))});var A=I?w?qs:Vs:w?Re:le,U=P?s:A(t);return Ve(U||t,function(O,$){U&&($=O,O=t[$]),ci(d,$,We(O,i,o,$,t,m))}),d}function gh(t){var i=le(t);return function(o){return Gp(o,t,i)}}function Gp(t,i,o){var l=o.length;if(t==null)return!l;for(t=z(t);l--;){var p=o[l],m=i[p],d=t[p];if(d===s&&!(p in t)||!m(d))return!1}return!0}function $p(t,i,o){if(typeof t!="function")throw new qe(a);return wi(function(){t.apply(s,o)},i)}function mi(t,i,o,l){var p=-1,m=ki,d=!0,h=t.length,w=[],I=i.length;if(!h)return w;o&&(i=Z(i,xe(o))),l?(m=ps,d=!1):i.length>=r&&(m=oi,d=!1,i=new Qt(i));e:for(;++p<h;){var P=t[p],R=o==null?P:o(P);if(P=l||P!==0?P:0,d&&R===R){for(var S=I;S--;)if(i[S]===R)continue e;w.push(P)}else m(i,R,l)||w.push(P)}return w}var Ot=du(lt),Hp=du(Rs,!0);function yh(t,i){var o=!0;return Ot(t,function(l,p,m){return o=!!i(l,p,m),o}),o}function pn(t,i,o){for(var l=-1,p=t.length;++l<p;){var m=t[l],d=i(m);if(d!=null&&(h===s?d===d&&!Oe(d):o(d,h)))var h=d,w=m}return w}function wh(t,i,o,l){var p=t.length;for(o=D(o),o<0&&(o=-o>p?0:p+o),l=l===s||l>p?p:D(l),l<0&&(l+=p),l=o>l?0:nc(l);o<l;)t[o++]=i;return t}function Vp(t,i){var o=[];return Ot(t,function(l,p,m){i(l,p,m)&&o.push(l)}),o}function ue(t,i,o,l,p){var m=-1,d=t.length;for(o||(o=ag),p||(p=[]);++m<d;){var h=t[m];i>0&&o(h)?i>1?ue(h,i-1,o,l,p):Et(p,h):l||(p[p.length]=h)}return p}var Ps=fu(),qp=fu(!0);function lt(t,i){return t&&Ps(t,i,le)}function Rs(t,i){return t&&qp(t,i,le)}function un(t,i){return Tt(i,function(o){return _t(t[o])})}function Zt(t,i){i=Bt(i,t);for(var o=0,l=i.length;t!=null&&o<l;)t=t[ut(i[o++])];return o&&o==l?t:s}function kp(t,i,o){var l=i(t);return B(t)?l:Et(l,o(t))}function ge(t){return t==null?t===s?Km:km:Yt&&Yt in z(t)?eg(t):dg(t)}function Fs(t,i){return t>i}function Mh(t,i){return t!=null&&X.call(t,i)}function bh(t,i){return t!=null&&i in z(t)}function vh(t,i,o){return t>=me(i,o)&&t<ae(i,o)}function Ss(t,i,o){for(var l=o?ps:ki,p=t[0].length,m=t.length,d=m,h=b(m),w=1/0,I=[];d--;){var P=t[d];d&&i&&(P=Z(P,xe(i))),w=me(P.length,w),h[d]=!o&&(i||p>=120&&P.length>=120)?new Qt(d&&P):s}P=t[0];var R=-1,S=h[0];e:for(;++R<p&&I.length<w;){var C=P[R],A=i?i(C):C;if(C=o||C!==0?C:0,!(S?oi(S,A):l(I,A,o))){for(d=m;--d;){var U=h[d];if(!(U?oi(U,A):l(t[d],A,o)))continue e}S&&S.push(A),I.push(C)}}return I}function _h(t,i,o,l){return lt(t,function(p,m,d){i(l,o(p),m,d)}),l}function di(t,i,o){i=Bt(i,t),t=xu(t,i);var l=t==null?t:t[ut(Xe(i))];return l==null?s:Ce(l,t,o)}function Wp(t){return ee(t)&&ge(t)==lr}function Ih(t){return ee(t)&&ge(t)==ni}function Ph(t){return ee(t)&&ge(t)==jr}function fi(t,i,o,l,p){return t===i?!0:t==null||i==null||!ee(t)&&!ee(i)?t!==t&&i!==i:Rh(t,i,o,l,fi,p)}function Rh(t,i,o,l,p,m){var d=B(t),h=B(i),w=d?Di:de(t),I=h?Di:de(i);w=w==lr?ht:w,I=I==lr?ht:I;var P=w==ht,R=I==ht,S=w==I;if(S&&Dt(t)){if(!Dt(i))return!1;d=!0,P=!1}if(S&&!P)return m||(m=new tt),d||vr(t)?Pu(t,i,o,l,p,m):Zh(t,i,w,o,l,p,m);if(!(o&Y)){var C=P&&X.call(t,"__wrapped__"),A=R&&X.call(i,"__wrapped__");if(C||A){var U=C?t.value():t,O=A?i.value():i;return m||(m=new tt),p(U,O,o,l,m)}}return S?(m||(m=new tt),jh(t,i,o,l,p,m)):!1}function Fh(t){return ee(t)&&de(t)==Ze}function Ts(t,i,o,l){var p=o.length,m=p,d=!l;if(t==null)return!m;for(t=z(t);p--;){var h=o[p];if(d&&h[2]?h[1]!==t[h[0]]:!(h[0]in t))return!1}for(;++p<m;){h=o[p];var w=h[0],I=t[w],P=h[1];if(d&&h[2]){if(I===s&&!(w in t))return!1}else{var R=new tt;if(l)var S=l(I,P,w,t,i,R);if(!(S===s?fi(P,I,Y|be,l,R):S))return!1}}return!0}function Kp(t){if(!j(t)||lg(t))return!1;var i=_t(t)?Ff:hd;return i.test(er(t))}function Sh(t){return ee(t)&&ge(t)==ti}function Th(t){return ee(t)&&de(t)==je}function Eh(t){return ee(t)&&Sn(t.length)&&!!J[ge(t)]}function Xp(t){return typeof t=="function"?t:t==null?Fe:typeof t=="object"?B(t)?Qp(t[0],t[1]):zp(t):hc(t)}function Es(t){if(!yi(t))return Af(t);var i=[];for(var o in z(t))X.call(t,o)&&o!="constructor"&&i.push(o);return i}function Ch(t){if(!j(t))return mg(t);var i=yi(t),o=[];for(var l in t)l=="constructor"&&(i||!X.call(t,l))||o.push(l);return o}function Cs(t,i){return t<i}function Yp(t,i){var o=-1,l=Pe(t)?b(t.length):[];return Ot(t,function(p,m,d){l[++o]=i(p,m,d)}),l}function zp(t){var i=Ws(t);return i.length==1&&i[0][2]?Eu(i[0][0],i[0][1]):function(o){return o===t||Ts(o,t,i)}}function Qp(t,i){return Xs(t)&&Tu(i)?Eu(ut(t),i):function(o){var l=il(o,t);return l===s&&l===i?nl(o,t):fi(i,l,Y|be)}}function cn(t,i,o,l,p){t!==i&&Ps(i,function(m,d){if(p||(p=new tt),j(m))xh(t,i,d,o,cn,l,p);else{var h=l?l(zs(t,d),m,d+"",t,i,p):s;h===s&&(h=m),_s(t,d,h)}},Re)}function xh(t,i,o,l,p,m,d){var h=zs(t,o),w=zs(i,o),I=d.get(w);if(I){_s(t,o,I);return}var P=m?m(h,w,o+"",t,i,d):s,R=P===s;if(R){var S=B(w),C=!S&&Dt(w),A=!S&&!C&&vr(w);P=w,S||C||A?B(h)?P=h:te(h)?P=Ie(h):C?(R=!1,P=lu(w,!0)):A?(R=!1,P=pu(w,!0)):P=[]:Mi(w)||tr(w)?(P=h,tr(h)?P=oc(h):(!j(h)||_t(h))&&(P=Su(w))):R=!1}R&&(d.set(w,P),p(P,w,l,m,d),d.delete(w)),_s(t,o,P)}function Jp(t,i){var o=t.length;if(!!o)return i+=i<0?o:0,vt(i,o)?t[i]:s}function Zp(t,i,o){i.length?i=Z(i,function(m){return B(m)?function(d){return Zt(d,m.length===1?m[0]:m)}:m}):i=[Fe];var l=-1;i=Z(i,xe(x()));var p=Yp(t,function(m,d,h){var w=Z(i,function(I){return I(m)});return{criteria:w,index:++l,value:m}});return nf(p,function(m,d){return kh(m,d,o)})}function Ah(t,i){return jp(t,i,function(o,l){return nl(t,l)})}function jp(t,i,o){for(var l=-1,p=i.length,m={};++l<p;){var d=i[l],h=Zt(t,d);o(h,d)&&hi(m,Bt(d,t),h)}return m}function Oh(t){return function(i){return Zt(i,t)}}function xs(t,i,o,l){var p=l?rf:cr,m=-1,d=i.length,h=t;for(t===i&&(i=Ie(i)),o&&(h=Z(t,xe(o)));++m<d;)for(var w=0,I=i[m],P=o?o(I):I;(w=p(h,P,w,l))>-1;)h!==t&&en.call(h,w,1),en.call(t,w,1);return t}function eu(t,i){for(var o=t?i.length:0,l=o-1;o--;){var p=i[o];if(o==l||p!==m){var m=p;vt(p)?en.call(t,p,1):Bs(t,p)}}return t}function As(t,i){return t+nn(Lp()*(i-t+1))}function Lh(t,i,o,l){for(var p=-1,m=ae(rn((i-t)/(o||1)),0),d=b(m);m--;)d[l?m:++p]=t,t+=o;return d}function Os(t,i){var o="";if(!t||i<1||i>St)return o;do i%2&&(o+=t),i=nn(i/2),i&&(t+=t);while(i);return o}function G(t,i){return Qs(Cu(t,i,Fe),t+"")}function Bh(t){return Dp(_r(t))}function Nh(t,i){var o=_r(t);return vn(o,Jt(i,0,o.length))}function hi(t,i,o,l){if(!j(t))return t;i=Bt(i,t);for(var p=-1,m=i.length,d=m-1,h=t;h!=null&&++p<m;){var w=ut(i[p]),I=o;if(w==="__proto__"||w==="constructor"||w==="prototype")return t;if(p!=d){var P=h[w];I=l?l(P,w,h):s,I===s&&(I=j(P)?P:vt(i[p+1])?[]:{})}ci(h,w,I),h=h[w]}return t}var tu=on?function(t,i){return on.set(t,i),t}:Fe,Dh=tn?function(t,i){return tn(t,"toString",{configurable:!0,enumerable:!1,value:al(i),writable:!0})}:Fe;function Uh(t){return vn(_r(t))}function Ke(t,i,o){var l=-1,p=t.length;i<0&&(i=-i>p?0:p+i),o=o>p?p:o,o<0&&(o+=p),p=i>o?0:o-i>>>0,i>>>=0;for(var m=b(p);++l<p;)m[l]=t[l+i];return m}function Gh(t,i){var o;return Ot(t,function(l,p,m){return o=i(l,p,m),!o}),!!o}function mn(t,i,o){var l=0,p=t==null?l:t.length;if(typeof i=="number"&&i===i&&p<=$m){for(;l<p;){var m=l+p>>>1,d=t[m];d!==null&&!Oe(d)&&(o?d<=i:d<i)?l=m+1:p=m}return p}return Ls(t,i,Fe,o)}function Ls(t,i,o,l){var p=0,m=t==null?0:t.length;if(m===0)return 0;i=o(i);for(var d=i!==i,h=i===null,w=Oe(i),I=i===s;p<m;){var P=nn((p+m)/2),R=o(t[P]),S=R!==s,C=R===null,A=R===R,U=Oe(R);if(d)var O=l||A;else I?O=A&&(l||S):h?O=A&&S&&(l||!C):w?O=A&&S&&!C&&(l||!U):C||U?O=!1:O=l?R<=i:R<i;O?p=P+1:m=P}return me(m,Gm)}function ru(t,i){for(var o=-1,l=t.length,p=0,m=[];++o<l;){var d=t[o],h=i?i(d):d;if(!o||!rt(h,w)){var w=h;m[p++]=d===0?0:d}}return m}function iu(t){return typeof t=="number"?t:Oe(t)?Ni:+t}function Ae(t){if(typeof t=="string")return t;if(B(t))return Z(t,Ae)+"";if(Oe(t))return Bp?Bp.call(t):"";var i=t+"";return i=="0"&&1/t==-Kt?"-0":i}function Lt(t,i,o){var l=-1,p=ki,m=t.length,d=!0,h=[],w=h;if(o)d=!1,p=ps;else if(m>=r){var I=i?null:Qh(t);if(I)return Ki(I);d=!1,p=oi,w=new Qt}else w=i?[]:h;e:for(;++l<m;){var P=t[l],R=i?i(P):P;if(P=o||P!==0?P:0,d&&R===R){for(var S=w.length;S--;)if(w[S]===R)continue e;i&&w.push(R),h.push(P)}else p(w,R,o)||(w!==h&&w.push(R),h.push(P))}return h}function Bs(t,i){return i=Bt(i,t),t=xu(t,i),t==null||delete t[ut(Xe(i))]}function nu(t,i,o,l){return hi(t,i,o(Zt(t,i)),l)}function dn(t,i,o,l){for(var p=t.length,m=l?p:-1;(l?m--:++m<p)&&i(t[m],m,t););return o?Ke(t,l?0:m,l?m+1:p):Ke(t,l?m+1:0,l?p:m)}function ou(t,i){var o=t;return o instanceof H&&(o=o.value()),us(i,function(l,p){return p.func.apply(p.thisArg,Et([l],p.args))},o)}function Ns(t,i,o){var l=t.length;if(l<2)return l?Lt(t[0]):[];for(var p=-1,m=b(l);++p<l;)for(var d=t[p],h=-1;++h<l;)h!=p&&(m[p]=mi(m[p]||d,t[h],i,o));return Lt(ue(m,1),i,o)}function au(t,i,o){for(var l=-1,p=t.length,m=i.length,d={};++l<p;){var h=l<m?i[l]:s;o(d,t[l],h)}return d}function Ds(t){return te(t)?t:[]}function Us(t){return typeof t=="function"?t:Fe}function Bt(t,i){return B(t)?t:Xs(t,i)?[t]:Bu(W(t))}var $h=G;function Nt(t,i,o){var l=t.length;return o=o===s?l:o,!i&&o>=l?t:Ke(t,i,o)}var su=Sf||function(t){return se.clearTimeout(t)};function lu(t,i){if(i)return t.slice();var o=t.length,l=Ep?Ep(o):new t.constructor(o);return t.copy(l),l}function Gs(t){var i=new t.constructor(t.byteLength);return new Zi(i).set(new Zi(t)),i}function Hh(t,i){var o=i?Gs(t.buffer):t.buffer;return new t.constructor(o,t.byteOffset,t.byteLength)}function Vh(t){var i=new t.constructor(t.source,Wl.exec(t));return i.lastIndex=t.lastIndex,i}function qh(t){return ui?z(ui.call(t)):{}}function pu(t,i){var o=i?Gs(t.buffer):t.buffer;return new t.constructor(o,t.byteOffset,t.length)}function uu(t,i){if(t!==i){var o=t!==s,l=t===null,p=t===t,m=Oe(t),d=i!==s,h=i===null,w=i===i,I=Oe(i);if(!h&&!I&&!m&&t>i||m&&d&&w&&!h&&!I||l&&d&&w||!o&&w||!p)return 1;if(!l&&!m&&!I&&t<i||I&&o&&p&&!l&&!m||h&&o&&p||!d&&p||!w)return-1}return 0}function kh(t,i,o){for(var l=-1,p=t.criteria,m=i.criteria,d=p.length,h=o.length;++l<d;){var w=uu(p[l],m[l]);if(w){if(l>=h)return w;var I=o[l];return w*(I=="desc"?-1:1)}}return t.index-i.index}function cu(t,i,o,l){for(var p=-1,m=t.length,d=o.length,h=-1,w=i.length,I=ae(m-d,0),P=b(w+I),R=!l;++h<w;)P[h]=i[h];for(;++p<d;)(R||p<m)&&(P[o[p]]=t[p]);for(;I--;)P[h++]=t[p++];return P}function mu(t,i,o,l){for(var p=-1,m=t.length,d=-1,h=o.length,w=-1,I=i.length,P=ae(m-h,0),R=b(P+I),S=!l;++p<P;)R[p]=t[p];for(var C=p;++w<I;)R[C+w]=i[w];for(;++d<h;)(S||p<m)&&(R[C+o[d]]=t[p++]);return R}function Ie(t,i){var o=-1,l=t.length;for(i||(i=b(l));++o<l;)i[o]=t[o];return i}function pt(t,i,o,l){var p=!o;o||(o={});for(var m=-1,d=i.length;++m<d;){var h=i[m],w=l?l(o[h],t[h],h,o,t):s;w===s&&(w=t[h]),p?wt(o,h,w):ci(o,h,w)}return o}function Wh(t,i){return pt(t,Ks(t),i)}function Kh(t,i){return pt(t,Ru(t),i)}function fn(t,i){return function(o,l){var p=B(o)?Qd:fh,m=i?i():{};return p(o,t,x(l,2),m)}}function wr(t){return G(function(i,o){var l=-1,p=o.length,m=p>1?o[p-1]:s,d=p>2?o[2]:s;for(m=t.length>3&&typeof m=="function"?(p--,m):s,d&&ye(o[0],o[1],d)&&(m=p<3?s:m,p=1),i=z(i);++l<p;){var h=o[l];h&&t(i,h,l,m)}return i})}function du(t,i){return function(o,l){if(o==null)return o;if(!Pe(o))return t(o,l);for(var p=o.length,m=i?p:-1,d=z(o);(i?m--:++m<p)&&l(d[m],m,d)!==!1;);return o}}function fu(t){return function(i,o,l){for(var p=-1,m=z(i),d=l(i),h=d.length;h--;){var w=d[t?h:++p];if(o(m[w],w,m)===!1)break}return i}}function Xh(t,i,o){var l=i&he,p=gi(t);function m(){var d=this&&this!==se&&this instanceof m?p:t;return d.apply(l?o:this,arguments)}return m}function hu(t){return function(i){i=W(i);var o=mr(i)?et(i):s,l=o?o[0]:i.charAt(0),p=o?Nt(o,1).join(""):i.slice(1);return l[t]()+p}}function Mr(t){return function(i){return us(dc(mc(i).replace(Nd,"")),t,"")}}function gi(t){return function(){var i=arguments;switch(i.length){case 0:return new t;case 1:return new t(i[0]);case 2:return new t(i[0],i[1]);case 3:return new t(i[0],i[1],i[2]);case 4:return new t(i[0],i[1],i[2],i[3]);case 5:return new t(i[0],i[1],i[2],i[3],i[4]);case 6:return new t(i[0],i[1],i[2],i[3],i[4],i[5]);case 7:return new t(i[0],i[1],i[2],i[3],i[4],i[5],i[6])}var o=yr(t.prototype),l=t.apply(o,i);return j(l)?l:o}}function Yh(t,i,o){var l=gi(t);function p(){for(var m=arguments.length,d=b(m),h=m,w=br(p);h--;)d[h]=arguments[h];var I=m<3&&d[0]!==w&&d[m-1]!==w?[]:Ct(d,w);if(m-=I.length,m<o)return bu(t,i,hn,p.placeholder,s,d,I,s,s,o-m);var P=this&&this!==se&&this instanceof p?l:t;return Ce(P,this,d)}return p}function gu(t){return function(i,o,l){var p=z(i);if(!Pe(i)){var m=x(o,3);i=le(i),o=function(h){return m(p[h],h,p)}}var d=t(i,o,l);return d>-1?p[m?i[d]:d]:s}}function yu(t){return bt(function(i){var o=i.length,l=o,p=ke.prototype.thru;for(t&&i.reverse();l--;){var m=i[l];if(typeof m!="function")throw new qe(a);if(p&&!d&&Mn(m)=="wrapper")var d=new ke([],!0)}for(l=d?l:o;++l<o;){m=i[l];var h=Mn(m),w=h=="wrapper"?ks(m):s;w&&Ys(w[0])&&w[1]==(ft|pe|$e|Jr)&&!w[4].length&&w[9]==1?d=d[Mn(w[0])].apply(d,w[3]):d=m.length==1&&Ys(m)?d[h]():d.thru(m)}return function(){var I=arguments,P=I[0];if(d&&I.length==1&&B(P))return d.plant(P).value();for(var R=0,S=o?i[R].apply(this,I):P;++R<o;)S=i[R].call(this,S);return S}})}function hn(t,i,o,l,p,m,d,h,w,I){var P=i&ft,R=i&he,S=i&ot,C=i&(pe|_e),A=i&ka,U=S?s:gi(t);function O(){for(var $=arguments.length,V=b($),Le=$;Le--;)V[Le]=arguments[Le];if(C)var we=br(O),Be=af(V,we);if(l&&(V=cu(V,l,p,C)),m&&(V=mu(V,m,d,C)),$-=Be,C&&$<I){var re=Ct(V,we);return bu(t,i,hn,O.placeholder,o,V,re,h,w,I-$)}var it=R?o:this,Pt=S?it[t]:t;return $=V.length,h?V=fg(V,h):A&&$>1&&V.reverse(),P&&w<$&&(V.length=w),this&&this!==se&&this instanceof O&&(Pt=U||gi(Pt)),Pt.apply(it,V)}return O}function wu(t,i){return function(o,l){return _h(o,t,i(l),{})}}function gn(t,i){return function(o,l){var p;if(o===s&&l===s)return i;if(o!==s&&(p=o),l!==s){if(p===s)return l;typeof o=="string"||typeof l=="string"?(o=Ae(o),l=Ae(l)):(o=iu(o),l=iu(l)),p=t(o,l)}return p}}function $s(t){return bt(function(i){return i=Z(i,xe(x())),G(function(o){var l=this;return t(i,function(p){return Ce(p,l,o)})})})}function yn(t,i){i=i===s?" ":Ae(i);var o=i.length;if(o<2)return o?Os(i,t):i;var l=Os(i,rn(t/dr(i)));return mr(i)?Nt(et(l),0,t).join(""):l.slice(0,t)}function zh(t,i,o,l){var p=i&he,m=gi(t);function d(){for(var h=-1,w=arguments.length,I=-1,P=l.length,R=b(P+w),S=this&&this!==se&&this instanceof d?m:t;++I<P;)R[I]=l[I];for(;w--;)R[I++]=arguments[++h];return Ce(S,p?o:this,R)}return d}function Mu(t){return function(i,o,l){return l&&typeof l!="number"&&ye(i,o,l)&&(o=l=s),i=It(i),o===s?(o=i,i=0):o=It(o),l=l===s?i<o?1:-1:It(l),Lh(i,o,l,t)}}function wn(t){return function(i,o){return typeof i=="string"&&typeof o=="string"||(i=Ye(i),o=Ye(o)),t(i,o)}}function bu(t,i,o,l,p,m,d,h,w,I){var P=i&pe,R=P?d:s,S=P?s:d,C=P?m:s,A=P?s:m;i|=P?$e:at,i&=~(P?at:$e),i&ve||(i&=~(he|ot));var U=[t,i,p,C,R,A,S,h,w,I],O=o.apply(s,U);return Ys(t)&&Au(O,U),O.placeholder=l,Ou(O,t,i)}function Hs(t){var i=oe[t];return function(o,l){if(o=Ye(o),l=l==null?0:me(D(l),292),l&&Op(o)){var p=(W(o)+"e").split("e"),m=i(p[0]+"e"+(+p[1]+l));return p=(W(m)+"e").split("e"),+(p[0]+"e"+(+p[1]-l))}return i(o)}}var Qh=hr&&1/Ki(new hr([,-0]))[1]==Kt?function(t){return new hr(t)}:pl;function vu(t){return function(i){var o=de(i);return o==Ze?ys(i):o==je?df(i):of(i,t(i))}}function Mt(t,i,o,l,p,m,d,h){var w=i&ot;if(!w&&typeof t!="function")throw new qe(a);var I=l?l.length:0;if(I||(i&=~($e|at),l=p=s),d=d===s?d:ae(D(d),0),h=h===s?h:D(h),I-=p?p.length:0,i&at){var P=l,R=p;l=p=s}var S=w?s:ks(t),C=[t,i,o,l,p,P,R,m,d,h];if(S&&cg(C,S),t=C[0],i=C[1],o=C[2],l=C[3],p=C[4],h=C[9]=C[9]===s?w?0:t.length:ae(C[9]-I,0),!h&&i&(pe|_e)&&(i&=~(pe|_e)),!i||i==he)var A=Xh(t,i,o);else i==pe||i==_e?A=Yh(t,i,h):(i==$e||i==(he|$e))&&!p.length?A=zh(t,i,o,l):A=hn.apply(s,C);var U=S?tu:Au;return Ou(U(A,C),t,i)}function _u(t,i,o,l){return t===s||rt(t,fr[o])&&!X.call(l,o)?i:t}function Iu(t,i,o,l,p,m){return j(t)&&j(i)&&(m.set(i,t),cn(t,i,s,Iu,m),m.delete(i)),t}function Jh(t){return Mi(t)?s:t}function Pu(t,i,o,l,p,m){var d=o&Y,h=t.length,w=i.length;if(h!=w&&!(d&&w>h))return!1;var I=m.get(t),P=m.get(i);if(I&&P)return I==i&&P==t;var R=-1,S=!0,C=o&be?new Qt:s;for(m.set(t,i),m.set(i,t);++R<h;){var A=t[R],U=i[R];if(l)var O=d?l(U,A,R,i,t,m):l(A,U,R,t,i,m);if(O!==s){if(O)continue;S=!1;break}if(C){if(!cs(i,function($,V){if(!oi(C,V)&&(A===$||p(A,$,o,l,m)))return C.push(V)})){S=!1;break}}else if(!(A===U||p(A,U,o,l,m))){S=!1;break}}return m.delete(t),m.delete(i),S}function Zh(t,i,o,l,p,m,d){switch(o){case pr:if(t.byteLength!=i.byteLength||t.byteOffset!=i.byteOffset)return!1;t=t.buffer,i=i.buffer;case ni:return!(t.byteLength!=i.byteLength||!m(new Zi(t),new Zi(i)));case Zr:case jr:case ei:return rt(+t,+i);case Ui:return t.name==i.name&&t.message==i.message;case ti:case ri:return t==i+"";case Ze:var h=ys;case je:var w=l&Y;if(h||(h=Ki),t.size!=i.size&&!w)return!1;var I=d.get(t);if(I)return I==i;l|=be,d.set(t,i);var P=Pu(h(t),h(i),l,p,m,d);return d.delete(t),P;case $i:if(ui)return ui.call(t)==ui.call(i)}return!1}function jh(t,i,o,l,p,m){var d=o&Y,h=Vs(t),w=h.length,I=Vs(i),P=I.length;if(w!=P&&!d)return!1;for(var R=w;R--;){var S=h[R];if(!(d?S in i:X.call(i,S)))return!1}var C=m.get(t),A=m.get(i);if(C&&A)return C==i&&A==t;var U=!0;m.set(t,i),m.set(i,t);for(var O=d;++R<w;){S=h[R];var $=t[S],V=i[S];if(l)var Le=d?l(V,$,S,i,t,m):l($,V,S,t,i,m);if(!(Le===s?$===V||p($,V,o,l,m):Le)){U=!1;break}O||(O=S=="constructor")}if(U&&!O){var we=t.constructor,Be=i.constructor;we!=Be&&"constructor"in t&&"constructor"in i&&!(typeof we=="function"&&we instanceof we&&typeof Be=="function"&&Be instanceof Be)&&(U=!1)}return m.delete(t),m.delete(i),U}function bt(t){return Qs(Cu(t,s,Gu),t+"")}function Vs(t){return kp(t,le,Ks)}function qs(t){return kp(t,Re,Ru)}var ks=on?function(t){return on.get(t)}:pl;function Mn(t){for(var i=t.name+"",o=gr[i],l=X.call(gr,i)?o.length:0;l--;){var p=o[l],m=p.func;if(m==null||m==t)return p.name}return i}function br(t){var i=X.call(c,"placeholder")?c:t;return i.placeholder}function x(){var t=c.iteratee||sl;return t=t===sl?Xp:t,arguments.length?t(arguments[0],arguments[1]):t}function bn(t,i){var o=t.__data__;return sg(i)?o[typeof i=="string"?"string":"hash"]:o.map}function Ws(t){for(var i=le(t),o=i.length;o--;){var l=i[o],p=t[l];i[o]=[l,p,Tu(p)]}return i}function jt(t,i){var o=uf(t,i);return Kp(o)?o:s}function eg(t){var i=X.call(t,Yt),o=t[Yt];try{t[Yt]=s;var l=!0}catch{}var p=Qi.call(t);return l&&(i?t[Yt]=o:delete t[Yt]),p}var Ks=Ms?function(t){return t==null?[]:(t=z(t),Tt(Ms(t),function(i){return xp.call(t,i)}))}:ul,Ru=Ms?function(t){for(var i=[];t;)Et(i,Ks(t)),t=ji(t);return i}:ul,de=ge;(bs&&de(new bs(new ArrayBuffer(1)))!=pr||si&&de(new si)!=Ze||vs&&de(vs.resolve())!=Hl||hr&&de(new hr)!=je||li&&de(new li)!=ii)&&(de=function(t){var i=ge(t),o=i==ht?t.constructor:s,l=o?er(o):"";if(l)switch(l){case Nf:return pr;case Df:return Ze;case Uf:return Hl;case Gf:return je;case $f:return ii}return i});function tg(t,i,o){for(var l=-1,p=o.length;++l<p;){var m=o[l],d=m.size;switch(m.type){case"drop":t+=d;break;case"dropRight":i-=d;break;case"take":i=me(i,t+d);break;case"takeRight":t=ae(t,i-d);break}}return{start:t,end:i}}function rg(t){var i=t.match(sd);return i?i[1].split(ld):[]}function Fu(t,i,o){i=Bt(i,t);for(var l=-1,p=i.length,m=!1;++l<p;){var d=ut(i[l]);if(!(m=t!=null&&o(t,d)))break;t=t[d]}return m||++l!=p?m:(p=t==null?0:t.length,!!p&&Sn(p)&&vt(d,p)&&(B(t)||tr(t)))}function ig(t){var i=t.length,o=new t.constructor(i);return i&&typeof t[0]=="string"&&X.call(t,"index")&&(o.index=t.index,o.input=t.input),o}function Su(t){return typeof t.constructor=="function"&&!yi(t)?yr(ji(t)):{}}function ng(t,i,o){var l=t.constructor;switch(i){case ni:return Gs(t);case Zr:case jr:return new l(+t);case pr:return Hh(t,o);case Wa:case Ka:case Xa:case Ya:case za:case Qa:case Ja:case Za:case ja:return pu(t,o);case Ze:return new l;case ei:case ri:return new l(t);case ti:return Vh(t);case je:return new l;case $i:return qh(t)}}function og(t,i){var o=i.length;if(!o)return t;var l=o-1;return i[l]=(o>1?"& ":"")+i[l],i=i.join(o>2?", ":" "),t.replace(ad,`{
3
+ /* [wrapped with `+i+`] */
4
+ `)}function ag(t){return B(t)||tr(t)||!!(Ap&&t&&t[Ap])}function vt(t,i){var o=typeof t;return i=i??St,!!i&&(o=="number"||o!="symbol"&&yd.test(t))&&t>-1&&t%1==0&&t<i}function ye(t,i,o){if(!j(o))return!1;var l=typeof i;return(l=="number"?Pe(o)&&vt(i,o.length):l=="string"&&i in o)?rt(o[i],t):!1}function Xs(t,i){if(B(t))return!1;var o=typeof t;return o=="number"||o=="symbol"||o=="boolean"||t==null||Oe(t)?!0:rd.test(t)||!td.test(t)||i!=null&&t in z(i)}function sg(t){var i=typeof t;return i=="string"||i=="number"||i=="symbol"||i=="boolean"?t!=="__proto__":t===null}function Ys(t){var i=Mn(t),o=c[i];if(typeof o!="function"||!(i in H.prototype))return!1;if(t===o)return!0;var l=ks(o);return!!l&&t===l[0]}function lg(t){return!!Tp&&Tp in t}var pg=Yi?_t:cl;function yi(t){var i=t&&t.constructor,o=typeof i=="function"&&i.prototype||fr;return t===o}function Tu(t){return t===t&&!j(t)}function Eu(t,i){return function(o){return o==null?!1:o[t]===i&&(i!==s||t in z(o))}}function ug(t){var i=Rn(t,function(l){return o.size===g&&o.clear(),l}),o=i.cache;return i}function cg(t,i){var o=t[1],l=i[1],p=o|l,m=p<(he|ot|ft),d=l==ft&&o==pe||l==ft&&o==Jr&&t[7].length<=i[8]||l==(ft|Jr)&&i[7].length<=i[8]&&o==pe;if(!(m||d))return t;l&he&&(t[2]=i[2],p|=o&he?0:ve);var h=i[3];if(h){var w=t[3];t[3]=w?cu(w,h,i[4]):h,t[4]=w?Ct(t[3],v):i[4]}return h=i[5],h&&(w=t[5],t[5]=w?mu(w,h,i[6]):h,t[6]=w?Ct(t[5],v):i[6]),h=i[7],h&&(t[7]=h),l&ft&&(t[8]=t[8]==null?i[8]:me(t[8],i[8])),t[9]==null&&(t[9]=i[9]),t[0]=i[0],t[1]=p,t}function mg(t){var i=[];if(t!=null)for(var o in z(t))i.push(o);return i}function dg(t){return Qi.call(t)}function Cu(t,i,o){return i=ae(i===s?t.length-1:i,0),function(){for(var l=arguments,p=-1,m=ae(l.length-i,0),d=b(m);++p<m;)d[p]=l[i+p];p=-1;for(var h=b(i+1);++p<i;)h[p]=l[p];return h[i]=o(d),Ce(t,this,h)}}function xu(t,i){return i.length<2?t:Zt(t,Ke(i,0,-1))}function fg(t,i){for(var o=t.length,l=me(i.length,o),p=Ie(t);l--;){var m=i[l];t[l]=vt(m,o)?p[m]:s}return t}function zs(t,i){if(!(i==="constructor"&&typeof t[i]=="function")&&i!="__proto__")return t[i]}var Au=Lu(tu),wi=Ef||function(t,i){return se.setTimeout(t,i)},Qs=Lu(Dh);function Ou(t,i,o){var l=i+"";return Qs(t,og(l,hg(rg(l),o)))}function Lu(t){var i=0,o=0;return function(){var l=Of(),p=Nm-(l-o);if(o=l,p>0){if(++i>=Bm)return arguments[0]}else i=0;return t.apply(s,arguments)}}function vn(t,i){var o=-1,l=t.length,p=l-1;for(i=i===s?l:i;++o<i;){var m=As(o,p),d=t[m];t[m]=t[o],t[o]=d}return t.length=i,t}var Bu=ug(function(t){var i=[];return t.charCodeAt(0)===46&&i.push(""),t.replace(id,function(o,l,p,m){i.push(p?m.replace(cd,"$1"):l||o)}),i});function ut(t){if(typeof t=="string"||Oe(t))return t;var i=t+"";return i=="0"&&1/t==-Kt?"-0":i}function er(t){if(t!=null){try{return zi.call(t)}catch{}try{return t+""}catch{}}return""}function hg(t,i){return Ve(Hm,function(o){var l="_."+o[0];i&o[1]&&!ki(t,l)&&t.push(l)}),t.sort()}function Nu(t){if(t instanceof H)return t.clone();var i=new ke(t.__wrapped__,t.__chain__);return i.__actions__=Ie(t.__actions__),i.__index__=t.__index__,i.__values__=t.__values__,i}function gg(t,i,o){(o?ye(t,i,o):i===s)?i=1:i=ae(D(i),0);var l=t==null?0:t.length;if(!l||i<1)return[];for(var p=0,m=0,d=b(rn(l/i));p<l;)d[m++]=Ke(t,p,p+=i);return d}function yg(t){for(var i=-1,o=t==null?0:t.length,l=0,p=[];++i<o;){var m=t[i];m&&(p[l++]=m)}return p}function wg(){var t=arguments.length;if(!t)return[];for(var i=b(t-1),o=arguments[0],l=t;l--;)i[l-1]=arguments[l];return Et(B(o)?Ie(o):[o],ue(i,1))}var Mg=G(function(t,i){return te(t)?mi(t,ue(i,1,te,!0)):[]}),bg=G(function(t,i){var o=Xe(i);return te(o)&&(o=s),te(t)?mi(t,ue(i,1,te,!0),x(o,2)):[]}),vg=G(function(t,i){var o=Xe(i);return te(o)&&(o=s),te(t)?mi(t,ue(i,1,te,!0),s,o):[]});function _g(t,i,o){var l=t==null?0:t.length;return l?(i=o||i===s?1:D(i),Ke(t,i<0?0:i,l)):[]}function Ig(t,i,o){var l=t==null?0:t.length;return l?(i=o||i===s?1:D(i),i=l-i,Ke(t,0,i<0?0:i)):[]}function Pg(t,i){return t&&t.length?dn(t,x(i,3),!0,!0):[]}function Rg(t,i){return t&&t.length?dn(t,x(i,3),!0):[]}function Fg(t,i,o,l){var p=t==null?0:t.length;return p?(o&&typeof o!="number"&&ye(t,i,o)&&(o=0,l=p),wh(t,i,o,l)):[]}function Du(t,i,o){var l=t==null?0:t.length;if(!l)return-1;var p=o==null?0:D(o);return p<0&&(p=ae(l+p,0)),Wi(t,x(i,3),p)}function Uu(t,i,o){var l=t==null?0:t.length;if(!l)return-1;var p=l-1;return o!==s&&(p=D(o),p=o<0?ae(l+p,0):me(p,l-1)),Wi(t,x(i,3),p,!0)}function Gu(t){var i=t==null?0:t.length;return i?ue(t,1):[]}function Sg(t){var i=t==null?0:t.length;return i?ue(t,Kt):[]}function Tg(t,i){var o=t==null?0:t.length;return o?(i=i===s?1:D(i),ue(t,i)):[]}function Eg(t){for(var i=-1,o=t==null?0:t.length,l={};++i<o;){var p=t[i];l[p[0]]=p[1]}return l}function $u(t){return t&&t.length?t[0]:s}function Cg(t,i,o){var l=t==null?0:t.length;if(!l)return-1;var p=o==null?0:D(o);return p<0&&(p=ae(l+p,0)),cr(t,i,p)}function xg(t){var i=t==null?0:t.length;return i?Ke(t,0,-1):[]}var Ag=G(function(t){var i=Z(t,Ds);return i.length&&i[0]===t[0]?Ss(i):[]}),Og=G(function(t){var i=Xe(t),o=Z(t,Ds);return i===Xe(o)?i=s:o.pop(),o.length&&o[0]===t[0]?Ss(o,x(i,2)):[]}),Lg=G(function(t){var i=Xe(t),o=Z(t,Ds);return i=typeof i=="function"?i:s,i&&o.pop(),o.length&&o[0]===t[0]?Ss(o,s,i):[]});function Bg(t,i){return t==null?"":xf.call(t,i)}function Xe(t){var i=t==null?0:t.length;return i?t[i-1]:s}function Ng(t,i,o){var l=t==null?0:t.length;if(!l)return-1;var p=l;return o!==s&&(p=D(o),p=p<0?ae(l+p,0):me(p,l-1)),i===i?hf(t,i,p):Wi(t,bp,p,!0)}function Dg(t,i){return t&&t.length?Jp(t,D(i)):s}var Ug=G(Hu);function Hu(t,i){return t&&t.length&&i&&i.length?xs(t,i):t}function Gg(t,i,o){return t&&t.length&&i&&i.length?xs(t,i,x(o,2)):t}function $g(t,i,o){return t&&t.length&&i&&i.length?xs(t,i,s,o):t}var Hg=bt(function(t,i){var o=t==null?0:t.length,l=Is(t,i);return eu(t,Z(i,function(p){return vt(p,o)?+p:p}).sort(uu)),l});function Vg(t,i){var o=[];if(!(t&&t.length))return o;var l=-1,p=[],m=t.length;for(i=x(i,3);++l<m;){var d=t[l];i(d,l,t)&&(o.push(d),p.push(l))}return eu(t,p),o}function Js(t){return t==null?t:Bf.call(t)}function qg(t,i,o){var l=t==null?0:t.length;return l?(o&&typeof o!="number"&&ye(t,i,o)?(i=0,o=l):(i=i==null?0:D(i),o=o===s?l:D(o)),Ke(t,i,o)):[]}function kg(t,i){return mn(t,i)}function Wg(t,i,o){return Ls(t,i,x(o,2))}function Kg(t,i){var o=t==null?0:t.length;if(o){var l=mn(t,i);if(l<o&&rt(t[l],i))return l}return-1}function Xg(t,i){return mn(t,i,!0)}function Yg(t,i,o){return Ls(t,i,x(o,2),!0)}function zg(t,i){var o=t==null?0:t.length;if(o){var l=mn(t,i,!0)-1;if(rt(t[l],i))return l}return-1}function Qg(t){return t&&t.length?ru(t):[]}function Jg(t,i){return t&&t.length?ru(t,x(i,2)):[]}function Zg(t){var i=t==null?0:t.length;return i?Ke(t,1,i):[]}function jg(t,i,o){return t&&t.length?(i=o||i===s?1:D(i),Ke(t,0,i<0?0:i)):[]}function ey(t,i,o){var l=t==null?0:t.length;return l?(i=o||i===s?1:D(i),i=l-i,Ke(t,i<0?0:i,l)):[]}function ty(t,i){return t&&t.length?dn(t,x(i,3),!1,!0):[]}function ry(t,i){return t&&t.length?dn(t,x(i,3)):[]}var iy=G(function(t){return Lt(ue(t,1,te,!0))}),ny=G(function(t){var i=Xe(t);return te(i)&&(i=s),Lt(ue(t,1,te,!0),x(i,2))}),oy=G(function(t){var i=Xe(t);return i=typeof i=="function"?i:s,Lt(ue(t,1,te,!0),s,i)});function ay(t){return t&&t.length?Lt(t):[]}function sy(t,i){return t&&t.length?Lt(t,x(i,2)):[]}function ly(t,i){return i=typeof i=="function"?i:s,t&&t.length?Lt(t,s,i):[]}function Zs(t){if(!(t&&t.length))return[];var i=0;return t=Tt(t,function(o){if(te(o))return i=ae(o.length,i),!0}),hs(i,function(o){return Z(t,ms(o))})}function Vu(t,i){if(!(t&&t.length))return[];var o=Zs(t);return i==null?o:Z(o,function(l){return Ce(i,s,l)})}var py=G(function(t,i){return te(t)?mi(t,i):[]}),uy=G(function(t){return Ns(Tt(t,te))}),cy=G(function(t){var i=Xe(t);return te(i)&&(i=s),Ns(Tt(t,te),x(i,2))}),my=G(function(t){var i=Xe(t);return i=typeof i=="function"?i:s,Ns(Tt(t,te),s,i)}),dy=G(Zs);function fy(t,i){return au(t||[],i||[],ci)}function hy(t,i){return au(t||[],i||[],hi)}var gy=G(function(t){var i=t.length,o=i>1?t[i-1]:s;return o=typeof o=="function"?(t.pop(),o):s,Vu(t,o)});function qu(t){var i=c(t);return i.__chain__=!0,i}function yy(t,i){return i(t),t}function _n(t,i){return i(t)}var wy=bt(function(t){var i=t.length,o=i?t[0]:0,l=this.__wrapped__,p=function(m){return Is(m,t)};return i>1||this.__actions__.length||!(l instanceof H)||!vt(o)?this.thru(p):(l=l.slice(o,+o+(i?1:0)),l.__actions__.push({func:_n,args:[p],thisArg:s}),new ke(l,this.__chain__).thru(function(m){return i&&!m.length&&m.push(s),m}))});function My(){return qu(this)}function by(){return new ke(this.value(),this.__chain__)}function vy(){this.__values__===s&&(this.__values__=ic(this.value()));var t=this.__index__>=this.__values__.length,i=t?s:this.__values__[this.__index__++];return{done:t,value:i}}function _y(){return this}function Iy(t){for(var i,o=this;o instanceof sn;){var l=Nu(o);l.__index__=0,l.__values__=s,i?p.__wrapped__=l:i=l;var p=l;o=o.__wrapped__}return p.__wrapped__=t,i}function Py(){var t=this.__wrapped__;if(t instanceof H){var i=t;return this.__actions__.length&&(i=new H(this)),i=i.reverse(),i.__actions__.push({func:_n,args:[Js],thisArg:s}),new ke(i,this.__chain__)}return this.thru(Js)}function Ry(){return ou(this.__wrapped__,this.__actions__)}var Fy=fn(function(t,i,o){X.call(t,o)?++t[o]:wt(t,o,1)});function Sy(t,i,o){var l=B(t)?wp:yh;return o&&ye(t,i,o)&&(i=s),l(t,x(i,3))}function Ty(t,i){var o=B(t)?Tt:Vp;return o(t,x(i,3))}var Ey=gu(Du),Cy=gu(Uu);function xy(t,i){return ue(In(t,i),1)}function Ay(t,i){return ue(In(t,i),Kt)}function Oy(t,i,o){return o=o===s?1:D(o),ue(In(t,i),o)}function ku(t,i){var o=B(t)?Ve:Ot;return o(t,x(i,3))}function Wu(t,i){var o=B(t)?Jd:Hp;return o(t,x(i,3))}var Ly=fn(function(t,i,o){X.call(t,o)?t[o].push(i):wt(t,o,[i])});function By(t,i,o,l){t=Pe(t)?t:_r(t),o=o&&!l?D(o):0;var p=t.length;return o<0&&(o=ae(p+o,0)),Tn(t)?o<=p&&t.indexOf(i,o)>-1:!!p&&cr(t,i,o)>-1}var Ny=G(function(t,i,o){var l=-1,p=typeof i=="function",m=Pe(t)?b(t.length):[];return Ot(t,function(d){m[++l]=p?Ce(i,d,o):di(d,i,o)}),m}),Dy=fn(function(t,i,o){wt(t,o,i)});function In(t,i){var o=B(t)?Z:Yp;return o(t,x(i,3))}function Uy(t,i,o,l){return t==null?[]:(B(i)||(i=i==null?[]:[i]),o=l?s:o,B(o)||(o=o==null?[]:[o]),Zp(t,i,o))}var Gy=fn(function(t,i,o){t[o?0:1].push(i)},function(){return[[],[]]});function $y(t,i,o){var l=B(t)?us:_p,p=arguments.length<3;return l(t,x(i,4),o,p,Ot)}function Hy(t,i,o){var l=B(t)?Zd:_p,p=arguments.length<3;return l(t,x(i,4),o,p,Hp)}function Vy(t,i){var o=B(t)?Tt:Vp;return o(t,Fn(x(i,3)))}function qy(t){var i=B(t)?Dp:Bh;return i(t)}function ky(t,i,o){(o?ye(t,i,o):i===s)?i=1:i=D(i);var l=B(t)?mh:Nh;return l(t,i)}function Wy(t){var i=B(t)?dh:Uh;return i(t)}function Ky(t){if(t==null)return 0;if(Pe(t))return Tn(t)?dr(t):t.length;var i=de(t);return i==Ze||i==je?t.size:Es(t).length}function Xy(t,i,o){var l=B(t)?cs:Gh;return o&&ye(t,i,o)&&(i=s),l(t,x(i,3))}var Yy=G(function(t,i){if(t==null)return[];var o=i.length;return o>1&&ye(t,i[0],i[1])?i=[]:o>2&&ye(i[0],i[1],i[2])&&(i=[i[0]]),Zp(t,ue(i,1),[])}),Pn=Tf||function(){return se.Date.now()};function zy(t,i){if(typeof i!="function")throw new qe(a);return t=D(t),function(){if(--t<1)return i.apply(this,arguments)}}function Ku(t,i,o){return i=o?s:i,i=t&&i==null?t.length:i,Mt(t,ft,s,s,s,s,i)}function Xu(t,i){var o;if(typeof i!="function")throw new qe(a);return t=D(t),function(){return--t>0&&(o=i.apply(this,arguments)),t<=1&&(i=s),o}}var js=G(function(t,i,o){var l=he;if(o.length){var p=Ct(o,br(js));l|=$e}return Mt(t,l,i,o,p)}),Yu=G(function(t,i,o){var l=he|ot;if(o.length){var p=Ct(o,br(Yu));l|=$e}return Mt(i,l,t,o,p)});function zu(t,i,o){i=o?s:i;var l=Mt(t,pe,s,s,s,s,s,i);return l.placeholder=zu.placeholder,l}function Qu(t,i,o){i=o?s:i;var l=Mt(t,_e,s,s,s,s,s,i);return l.placeholder=Qu.placeholder,l}function Ju(t,i,o){var l,p,m,d,h,w,I=0,P=!1,R=!1,S=!0;if(typeof t!="function")throw new qe(a);i=Ye(i)||0,j(o)&&(P=!!o.leading,R="maxWait"in o,m=R?ae(Ye(o.maxWait)||0,i):m,S="trailing"in o?!!o.trailing:S);function C(re){var it=l,Pt=p;return l=p=s,I=re,d=t.apply(Pt,it),d}function A(re){return I=re,h=wi($,i),P?C(re):d}function U(re){var it=re-w,Pt=re-I,gc=i-it;return R?me(gc,m-Pt):gc}function O(re){var it=re-w,Pt=re-I;return w===s||it>=i||it<0||R&&Pt>=m}function $(){var re=Pn();if(O(re))return V(re);h=wi($,U(re))}function V(re){return h=s,S&&l?C(re):(l=p=s,d)}function Le(){h!==s&&su(h),I=0,l=w=p=h=s}function we(){return h===s?d:V(Pn())}function Be(){var re=Pn(),it=O(re);if(l=arguments,p=this,w=re,it){if(h===s)return A(w);if(R)return su(h),h=wi($,i),C(w)}return h===s&&(h=wi($,i)),d}return Be.cancel=Le,Be.flush=we,Be}var Qy=G(function(t,i){return $p(t,1,i)}),Jy=G(function(t,i,o){return $p(t,Ye(i)||0,o)});function Zy(t){return Mt(t,ka)}function Rn(t,i){if(typeof t!="function"||i!=null&&typeof i!="function")throw new qe(a);var o=function(){var l=arguments,p=i?i.apply(this,l):l[0],m=o.cache;if(m.has(p))return m.get(p);var d=t.apply(this,l);return o.cache=m.set(p,d)||m,d};return o.cache=new(Rn.Cache||yt),o}Rn.Cache=yt;function Fn(t){if(typeof t!="function")throw new qe(a);return function(){var i=arguments;switch(i.length){case 0:return!t.call(this);case 1:return!t.call(this,i[0]);case 2:return!t.call(this,i[0],i[1]);case 3:return!t.call(this,i[0],i[1],i[2])}return!t.apply(this,i)}}function jy(t){return Xu(2,t)}var ew=$h(function(t,i){i=i.length==1&&B(i[0])?Z(i[0],xe(x())):Z(ue(i,1),xe(x()));var o=i.length;return G(function(l){for(var p=-1,m=me(l.length,o);++p<m;)l[p]=i[p].call(this,l[p]);return Ce(t,this,l)})}),el=G(function(t,i){var o=Ct(i,br(el));return Mt(t,$e,s,i,o)}),Zu=G(function(t,i){var o=Ct(i,br(Zu));return Mt(t,at,s,i,o)}),tw=bt(function(t,i){return Mt(t,Jr,s,s,s,i)});function rw(t,i){if(typeof t!="function")throw new qe(a);return i=i===s?i:D(i),G(t,i)}function iw(t,i){if(typeof t!="function")throw new qe(a);return i=i==null?0:ae(D(i),0),G(function(o){var l=o[i],p=Nt(o,0,i);return l&&Et(p,l),Ce(t,this,p)})}function nw(t,i,o){var l=!0,p=!0;if(typeof t!="function")throw new qe(a);return j(o)&&(l="leading"in o?!!o.leading:l,p="trailing"in o?!!o.trailing:p),Ju(t,i,{leading:l,maxWait:i,trailing:p})}function ow(t){return Ku(t,1)}function aw(t,i){return el(Us(i),t)}function sw(){if(!arguments.length)return[];var t=arguments[0];return B(t)?t:[t]}function lw(t){return We(t,F)}function pw(t,i){return i=typeof i=="function"?i:s,We(t,F,i)}function uw(t){return We(t,T|F)}function cw(t,i){return i=typeof i=="function"?i:s,We(t,T|F,i)}function mw(t,i){return i==null||Gp(t,i,le(i))}function rt(t,i){return t===i||t!==t&&i!==i}var dw=wn(Fs),fw=wn(function(t,i){return t>=i}),tr=Wp(function(){return arguments}())?Wp:function(t){return ee(t)&&X.call(t,"callee")&&!xp.call(t,"callee")},B=b.isArray,hw=mp?xe(mp):Ih;function Pe(t){return t!=null&&Sn(t.length)&&!_t(t)}function te(t){return ee(t)&&Pe(t)}function gw(t){return t===!0||t===!1||ee(t)&&ge(t)==Zr}var Dt=Cf||cl,yw=dp?xe(dp):Ph;function ww(t){return ee(t)&&t.nodeType===1&&!Mi(t)}function Mw(t){if(t==null)return!0;if(Pe(t)&&(B(t)||typeof t=="string"||typeof t.splice=="function"||Dt(t)||vr(t)||tr(t)))return!t.length;var i=de(t);if(i==Ze||i==je)return!t.size;if(yi(t))return!Es(t).length;for(var o in t)if(X.call(t,o))return!1;return!0}function bw(t,i){return fi(t,i)}function vw(t,i,o){o=typeof o=="function"?o:s;var l=o?o(t,i):s;return l===s?fi(t,i,s,o):!!l}function tl(t){if(!ee(t))return!1;var i=ge(t);return i==Ui||i==qm||typeof t.message=="string"&&typeof t.name=="string"&&!Mi(t)}function _w(t){return typeof t=="number"&&Op(t)}function _t(t){if(!j(t))return!1;var i=ge(t);return i==Gi||i==$l||i==Vm||i==Wm}function ju(t){return typeof t=="number"&&t==D(t)}function Sn(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=St}function j(t){var i=typeof t;return t!=null&&(i=="object"||i=="function")}function ee(t){return t!=null&&typeof t=="object"}var ec=fp?xe(fp):Fh;function Iw(t,i){return t===i||Ts(t,i,Ws(i))}function Pw(t,i,o){return o=typeof o=="function"?o:s,Ts(t,i,Ws(i),o)}function Rw(t){return tc(t)&&t!=+t}function Fw(t){if(pg(t))throw new L(n);return Kp(t)}function Sw(t){return t===null}function Tw(t){return t==null}function tc(t){return typeof t=="number"||ee(t)&&ge(t)==ei}function Mi(t){if(!ee(t)||ge(t)!=ht)return!1;var i=ji(t);if(i===null)return!0;var o=X.call(i,"constructor")&&i.constructor;return typeof o=="function"&&o instanceof o&&zi.call(o)==Pf}var rl=hp?xe(hp):Sh;function Ew(t){return ju(t)&&t>=-St&&t<=St}var rc=gp?xe(gp):Th;function Tn(t){return typeof t=="string"||!B(t)&&ee(t)&&ge(t)==ri}function Oe(t){return typeof t=="symbol"||ee(t)&&ge(t)==$i}var vr=yp?xe(yp):Eh;function Cw(t){return t===s}function xw(t){return ee(t)&&de(t)==ii}function Aw(t){return ee(t)&&ge(t)==Xm}var Ow=wn(Cs),Lw=wn(function(t,i){return t<=i});function ic(t){if(!t)return[];if(Pe(t))return Tn(t)?et(t):Ie(t);if(ai&&t[ai])return mf(t[ai]());var i=de(t),o=i==Ze?ys:i==je?Ki:_r;return o(t)}function It(t){if(!t)return t===0?t:0;if(t=Ye(t),t===Kt||t===-Kt){var i=t<0?-1:1;return i*Um}return t===t?t:0}function D(t){var i=It(t),o=i%1;return i===i?o?i-o:i:0}function nc(t){return t?Jt(D(t),0,st):0}function Ye(t){if(typeof t=="number")return t;if(Oe(t))return Ni;if(j(t)){var i=typeof t.valueOf=="function"?t.valueOf():t;t=j(i)?i+"":i}if(typeof t!="string")return t===0?t:+t;t=Ip(t);var o=fd.test(t);return o||gd.test(t)?Yd(t.slice(2),o?2:8):dd.test(t)?Ni:+t}function oc(t){return pt(t,Re(t))}function Bw(t){return t?Jt(D(t),-St,St):t===0?t:0}function W(t){return t==null?"":Ae(t)}var Nw=wr(function(t,i){if(yi(i)||Pe(i)){pt(i,le(i),t);return}for(var o in i)X.call(i,o)&&ci(t,o,i[o])}),ac=wr(function(t,i){pt(i,Re(i),t)}),En=wr(function(t,i,o,l){pt(i,Re(i),t,l)}),Dw=wr(function(t,i,o,l){pt(i,le(i),t,l)}),Uw=bt(Is);function Gw(t,i){var o=yr(t);return i==null?o:Up(o,i)}var $w=G(function(t,i){t=z(t);var o=-1,l=i.length,p=l>2?i[2]:s;for(p&&ye(i[0],i[1],p)&&(l=1);++o<l;)for(var m=i[o],d=Re(m),h=-1,w=d.length;++h<w;){var I=d[h],P=t[I];(P===s||rt(P,fr[I])&&!X.call(t,I))&&(t[I]=m[I])}return t}),Hw=G(function(t){return t.push(s,Iu),Ce(sc,s,t)});function Vw(t,i){return Mp(t,x(i,3),lt)}function qw(t,i){return Mp(t,x(i,3),Rs)}function kw(t,i){return t==null?t:Ps(t,x(i,3),Re)}function Ww(t,i){return t==null?t:qp(t,x(i,3),Re)}function Kw(t,i){return t&&lt(t,x(i,3))}function Xw(t,i){return t&&Rs(t,x(i,3))}function Yw(t){return t==null?[]:un(t,le(t))}function zw(t){return t==null?[]:un(t,Re(t))}function il(t,i,o){var l=t==null?s:Zt(t,i);return l===s?o:l}function Qw(t,i){return t!=null&&Fu(t,i,Mh)}function nl(t,i){return t!=null&&Fu(t,i,bh)}var Jw=wu(function(t,i,o){i!=null&&typeof i.toString!="function"&&(i=Qi.call(i)),t[i]=o},al(Fe)),Zw=wu(function(t,i,o){i!=null&&typeof i.toString!="function"&&(i=Qi.call(i)),X.call(t,i)?t[i].push(o):t[i]=[o]},x),jw=G(di);function le(t){return Pe(t)?Np(t):Es(t)}function Re(t){return Pe(t)?Np(t,!0):Ch(t)}function eM(t,i){var o={};return i=x(i,3),lt(t,function(l,p,m){wt(o,i(l,p,m),l)}),o}function tM(t,i){var o={};return i=x(i,3),lt(t,function(l,p,m){wt(o,p,i(l,p,m))}),o}var rM=wr(function(t,i,o){cn(t,i,o)}),sc=wr(function(t,i,o,l){cn(t,i,o,l)}),iM=bt(function(t,i){var o={};if(t==null)return o;var l=!1;i=Z(i,function(m){return m=Bt(m,t),l||(l=m.length>1),m}),pt(t,qs(t),o),l&&(o=We(o,T|M|F,Jh));for(var p=i.length;p--;)Bs(o,i[p]);return o});function nM(t,i){return lc(t,Fn(x(i)))}var oM=bt(function(t,i){return t==null?{}:Ah(t,i)});function lc(t,i){if(t==null)return{};var o=Z(qs(t),function(l){return[l]});return i=x(i),jp(t,o,function(l,p){return i(l,p[0])})}function aM(t,i,o){i=Bt(i,t);var l=-1,p=i.length;for(p||(p=1,t=s);++l<p;){var m=t==null?s:t[ut(i[l])];m===s&&(l=p,m=o),t=_t(m)?m.call(t):m}return t}function sM(t,i,o){return t==null?t:hi(t,i,o)}function lM(t,i,o,l){return l=typeof l=="function"?l:s,t==null?t:hi(t,i,o,l)}var pc=vu(le),uc=vu(Re);function pM(t,i,o){var l=B(t),p=l||Dt(t)||vr(t);if(i=x(i,4),o==null){var m=t&&t.constructor;p?o=l?new m:[]:j(t)?o=_t(m)?yr(ji(t)):{}:o={}}return(p?Ve:lt)(t,function(d,h,w){return i(o,d,h,w)}),o}function uM(t,i){return t==null?!0:Bs(t,i)}function cM(t,i,o){return t==null?t:nu(t,i,Us(o))}function mM(t,i,o,l){return l=typeof l=="function"?l:s,t==null?t:nu(t,i,Us(o),l)}function _r(t){return t==null?[]:gs(t,le(t))}function dM(t){return t==null?[]:gs(t,Re(t))}function fM(t,i,o){return o===s&&(o=i,i=s),o!==s&&(o=Ye(o),o=o===o?o:0),i!==s&&(i=Ye(i),i=i===i?i:0),Jt(Ye(t),i,o)}function hM(t,i,o){return i=It(i),o===s?(o=i,i=0):o=It(o),t=Ye(t),vh(t,i,o)}function gM(t,i,o){if(o&&typeof o!="boolean"&&ye(t,i,o)&&(i=o=s),o===s&&(typeof i=="boolean"?(o=i,i=s):typeof t=="boolean"&&(o=t,t=s)),t===s&&i===s?(t=0,i=1):(t=It(t),i===s?(i=t,t=0):i=It(i)),t>i){var l=t;t=i,i=l}if(o||t%1||i%1){var p=Lp();return me(t+p*(i-t+Xd("1e-"+((p+"").length-1))),i)}return As(t,i)}var yM=Mr(function(t,i,o){return i=i.toLowerCase(),t+(o?cc(i):i)});function cc(t){return ol(W(t).toLowerCase())}function mc(t){return t=W(t),t&&t.replace(wd,sf).replace(Dd,"")}function wM(t,i,o){t=W(t),i=Ae(i);var l=t.length;o=o===s?l:Jt(D(o),0,l);var p=o;return o-=i.length,o>=0&&t.slice(o,p)==i}function MM(t){return t=W(t),t&&Zm.test(t)?t.replace(ql,lf):t}function bM(t){return t=W(t),t&&nd.test(t)?t.replace(es,"\\$&"):t}var vM=Mr(function(t,i,o){return t+(o?"-":"")+i.toLowerCase()}),_M=Mr(function(t,i,o){return t+(o?" ":"")+i.toLowerCase()}),IM=hu("toLowerCase");function PM(t,i,o){t=W(t),i=D(i);var l=i?dr(t):0;if(!i||l>=i)return t;var p=(i-l)/2;return yn(nn(p),o)+t+yn(rn(p),o)}function RM(t,i,o){t=W(t),i=D(i);var l=i?dr(t):0;return i&&l<i?t+yn(i-l,o):t}function FM(t,i,o){t=W(t),i=D(i);var l=i?dr(t):0;return i&&l<i?yn(i-l,o)+t:t}function SM(t,i,o){return o||i==null?i=0:i&&(i=+i),Lf(W(t).replace(ts,""),i||0)}function TM(t,i,o){return(o?ye(t,i,o):i===s)?i=1:i=D(i),Os(W(t),i)}function EM(){var t=arguments,i=W(t[0]);return t.length<3?i:i.replace(t[1],t[2])}var CM=Mr(function(t,i,o){return t+(o?"_":"")+i.toLowerCase()});function xM(t,i,o){return o&&typeof o!="number"&&ye(t,i,o)&&(i=o=s),o=o===s?st:o>>>0,o?(t=W(t),t&&(typeof i=="string"||i!=null&&!rl(i))&&(i=Ae(i),!i&&mr(t))?Nt(et(t),0,o):t.split(i,o)):[]}var AM=Mr(function(t,i,o){return t+(o?" ":"")+ol(i)});function OM(t,i,o){return t=W(t),o=o==null?0:Jt(D(o),0,t.length),i=Ae(i),t.slice(o,o+i.length)==i}function LM(t,i,o){var l=c.templateSettings;o&&ye(t,i,o)&&(i=s),t=W(t),i=En({},i,l,_u);var p=En({},i.imports,l.imports,_u),m=le(p),d=gs(p,m),h,w,I=0,P=i.interpolate||Hi,R="__p += '",S=ws((i.escape||Hi).source+"|"+P.source+"|"+(P===kl?md:Hi).source+"|"+(i.evaluate||Hi).source+"|$","g"),C="//# sourceURL="+(X.call(i,"sourceURL")?(i.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Vd+"]")+`
5
+ `;t.replace(S,function(O,$,V,Le,we,Be){return V||(V=Le),R+=t.slice(I,Be).replace(Md,pf),$&&(h=!0,R+=`' +
6
+ __e(`+$+`) +
7
+ '`),we&&(w=!0,R+=`';
8
+ `+we+`;
9
+ __p += '`),V&&(R+=`' +
10
+ ((__t = (`+V+`)) == null ? '' : __t) +
11
+ '`),I=Be+O.length,O}),R+=`';
12
+ `;var A=X.call(i,"variable")&&i.variable;if(!A)R=`with (obj) {
13
+ `+R+`
14
+ }
15
+ `;else if(ud.test(A))throw new L(u);R=(w?R.replace(Ym,""):R).replace(zm,"$1").replace(Qm,"$1;"),R="function("+(A||"obj")+`) {
16
+ `+(A?"":`obj || (obj = {});
17
+ `)+"var __t, __p = ''"+(h?", __e = _.escape":"")+(w?`, __j = Array.prototype.join;
18
+ function print() { __p += __j.call(arguments, '') }
19
+ `:`;
20
+ `)+R+`return __p
21
+ }`;var U=fc(function(){return k(m,C+"return "+R).apply(s,d)});if(U.source=R,tl(U))throw U;return U}function BM(t){return W(t).toLowerCase()}function NM(t){return W(t).toUpperCase()}function DM(t,i,o){if(t=W(t),t&&(o||i===s))return Ip(t);if(!t||!(i=Ae(i)))return t;var l=et(t),p=et(i),m=Pp(l,p),d=Rp(l,p)+1;return Nt(l,m,d).join("")}function UM(t,i,o){if(t=W(t),t&&(o||i===s))return t.slice(0,Sp(t)+1);if(!t||!(i=Ae(i)))return t;var l=et(t),p=Rp(l,et(i))+1;return Nt(l,0,p).join("")}function GM(t,i,o){if(t=W(t),t&&(o||i===s))return t.replace(ts,"");if(!t||!(i=Ae(i)))return t;var l=et(t),p=Pp(l,et(i));return Nt(l,p).join("")}function $M(t,i){var o=Om,l=Lm;if(j(i)){var p="separator"in i?i.separator:p;o="length"in i?D(i.length):o,l="omission"in i?Ae(i.omission):l}t=W(t);var m=t.length;if(mr(t)){var d=et(t);m=d.length}if(o>=m)return t;var h=o-dr(l);if(h<1)return l;var w=d?Nt(d,0,h).join(""):t.slice(0,h);if(p===s)return w+l;if(d&&(h+=w.length-h),rl(p)){if(t.slice(h).search(p)){var I,P=w;for(p.global||(p=ws(p.source,W(Wl.exec(p))+"g")),p.lastIndex=0;I=p.exec(P);)var R=I.index;w=w.slice(0,R===s?h:R)}}else if(t.indexOf(Ae(p),h)!=h){var S=w.lastIndexOf(p);S>-1&&(w=w.slice(0,S))}return w+l}function HM(t){return t=W(t),t&&Jm.test(t)?t.replace(Vl,gf):t}var VM=Mr(function(t,i,o){return t+(o?" ":"")+i.toUpperCase()}),ol=hu("toUpperCase");function dc(t,i,o){return t=W(t),i=o?s:i,i===s?cf(t)?Mf(t):tf(t):t.match(i)||[]}var fc=G(function(t,i){try{return Ce(t,s,i)}catch(o){return tl(o)?o:new L(o)}}),qM=bt(function(t,i){return Ve(i,function(o){o=ut(o),wt(t,o,js(t[o],t))}),t});function kM(t){var i=t==null?0:t.length,o=x();return t=i?Z(t,function(l){if(typeof l[1]!="function")throw new qe(a);return[o(l[0]),l[1]]}):[],G(function(l){for(var p=-1;++p<i;){var m=t[p];if(Ce(m[0],this,l))return Ce(m[1],this,l)}})}function WM(t){return gh(We(t,T))}function al(t){return function(){return t}}function KM(t,i){return t==null||t!==t?i:t}var XM=yu(),YM=yu(!0);function Fe(t){return t}function sl(t){return Xp(typeof t=="function"?t:We(t,T))}function zM(t){return zp(We(t,T))}function QM(t,i){return Qp(t,We(i,T))}var JM=G(function(t,i){return function(o){return di(o,t,i)}}),ZM=G(function(t,i){return function(o){return di(t,o,i)}});function ll(t,i,o){var l=le(i),p=un(i,l);o==null&&!(j(i)&&(p.length||!l.length))&&(o=i,i=t,t=this,p=un(i,le(i)));var m=!(j(o)&&"chain"in o)||!!o.chain,d=_t(t);return Ve(p,function(h){var w=i[h];t[h]=w,d&&(t.prototype[h]=function(){var I=this.__chain__;if(m||I){var P=t(this.__wrapped__),R=P.__actions__=Ie(this.__actions__);return R.push({func:w,args:arguments,thisArg:t}),P.__chain__=I,P}return w.apply(t,Et([this.value()],arguments))})}),t}function jM(){return se._===this&&(se._=Rf),this}function pl(){}function eb(t){return t=D(t),G(function(i){return Jp(i,t)})}var tb=$s(Z),rb=$s(wp),ib=$s(cs);function hc(t){return Xs(t)?ms(ut(t)):Oh(t)}function nb(t){return function(i){return t==null?s:Zt(t,i)}}var ob=Mu(),ab=Mu(!0);function ul(){return[]}function cl(){return!1}function sb(){return{}}function lb(){return""}function pb(){return!0}function ub(t,i){if(t=D(t),t<1||t>St)return[];var o=st,l=me(t,st);i=x(i),t-=st;for(var p=hs(l,i);++o<t;)i(o);return p}function cb(t){return B(t)?Z(t,ut):Oe(t)?[t]:Ie(Bu(W(t)))}function mb(t){var i=++If;return W(t)+i}var db=gn(function(t,i){return t+i},0),fb=Hs("ceil"),hb=gn(function(t,i){return t/i},1),gb=Hs("floor");function yb(t){return t&&t.length?pn(t,Fe,Fs):s}function wb(t,i){return t&&t.length?pn(t,x(i,2),Fs):s}function Mb(t){return vp(t,Fe)}function bb(t,i){return vp(t,x(i,2))}function vb(t){return t&&t.length?pn(t,Fe,Cs):s}function _b(t,i){return t&&t.length?pn(t,x(i,2),Cs):s}var Ib=gn(function(t,i){return t*i},1),Pb=Hs("round"),Rb=gn(function(t,i){return t-i},0);function Fb(t){return t&&t.length?fs(t,Fe):0}function Sb(t,i){return t&&t.length?fs(t,x(i,2)):0}return c.after=zy,c.ary=Ku,c.assign=Nw,c.assignIn=ac,c.assignInWith=En,c.assignWith=Dw,c.at=Uw,c.before=Xu,c.bind=js,c.bindAll=qM,c.bindKey=Yu,c.castArray=sw,c.chain=qu,c.chunk=gg,c.compact=yg,c.concat=wg,c.cond=kM,c.conforms=WM,c.constant=al,c.countBy=Fy,c.create=Gw,c.curry=zu,c.curryRight=Qu,c.debounce=Ju,c.defaults=$w,c.defaultsDeep=Hw,c.defer=Qy,c.delay=Jy,c.difference=Mg,c.differenceBy=bg,c.differenceWith=vg,c.drop=_g,c.dropRight=Ig,c.dropRightWhile=Pg,c.dropWhile=Rg,c.fill=Fg,c.filter=Ty,c.flatMap=xy,c.flatMapDeep=Ay,c.flatMapDepth=Oy,c.flatten=Gu,c.flattenDeep=Sg,c.flattenDepth=Tg,c.flip=Zy,c.flow=XM,c.flowRight=YM,c.fromPairs=Eg,c.functions=Yw,c.functionsIn=zw,c.groupBy=Ly,c.initial=xg,c.intersection=Ag,c.intersectionBy=Og,c.intersectionWith=Lg,c.invert=Jw,c.invertBy=Zw,c.invokeMap=Ny,c.iteratee=sl,c.keyBy=Dy,c.keys=le,c.keysIn=Re,c.map=In,c.mapKeys=eM,c.mapValues=tM,c.matches=zM,c.matchesProperty=QM,c.memoize=Rn,c.merge=rM,c.mergeWith=sc,c.method=JM,c.methodOf=ZM,c.mixin=ll,c.negate=Fn,c.nthArg=eb,c.omit=iM,c.omitBy=nM,c.once=jy,c.orderBy=Uy,c.over=tb,c.overArgs=ew,c.overEvery=rb,c.overSome=ib,c.partial=el,c.partialRight=Zu,c.partition=Gy,c.pick=oM,c.pickBy=lc,c.property=hc,c.propertyOf=nb,c.pull=Ug,c.pullAll=Hu,c.pullAllBy=Gg,c.pullAllWith=$g,c.pullAt=Hg,c.range=ob,c.rangeRight=ab,c.rearg=tw,c.reject=Vy,c.remove=Vg,c.rest=rw,c.reverse=Js,c.sampleSize=ky,c.set=sM,c.setWith=lM,c.shuffle=Wy,c.slice=qg,c.sortBy=Yy,c.sortedUniq=Qg,c.sortedUniqBy=Jg,c.split=xM,c.spread=iw,c.tail=Zg,c.take=jg,c.takeRight=ey,c.takeRightWhile=ty,c.takeWhile=ry,c.tap=yy,c.throttle=nw,c.thru=_n,c.toArray=ic,c.toPairs=pc,c.toPairsIn=uc,c.toPath=cb,c.toPlainObject=oc,c.transform=pM,c.unary=ow,c.union=iy,c.unionBy=ny,c.unionWith=oy,c.uniq=ay,c.uniqBy=sy,c.uniqWith=ly,c.unset=uM,c.unzip=Zs,c.unzipWith=Vu,c.update=cM,c.updateWith=mM,c.values=_r,c.valuesIn=dM,c.without=py,c.words=dc,c.wrap=aw,c.xor=uy,c.xorBy=cy,c.xorWith=my,c.zip=dy,c.zipObject=fy,c.zipObjectDeep=hy,c.zipWith=gy,c.entries=pc,c.entriesIn=uc,c.extend=ac,c.extendWith=En,ll(c,c),c.add=db,c.attempt=fc,c.camelCase=yM,c.capitalize=cc,c.ceil=fb,c.clamp=fM,c.clone=lw,c.cloneDeep=uw,c.cloneDeepWith=cw,c.cloneWith=pw,c.conformsTo=mw,c.deburr=mc,c.defaultTo=KM,c.divide=hb,c.endsWith=wM,c.eq=rt,c.escape=MM,c.escapeRegExp=bM,c.every=Sy,c.find=Ey,c.findIndex=Du,c.findKey=Vw,c.findLast=Cy,c.findLastIndex=Uu,c.findLastKey=qw,c.floor=gb,c.forEach=ku,c.forEachRight=Wu,c.forIn=kw,c.forInRight=Ww,c.forOwn=Kw,c.forOwnRight=Xw,c.get=il,c.gt=dw,c.gte=fw,c.has=Qw,c.hasIn=nl,c.head=$u,c.identity=Fe,c.includes=By,c.indexOf=Cg,c.inRange=hM,c.invoke=jw,c.isArguments=tr,c.isArray=B,c.isArrayBuffer=hw,c.isArrayLike=Pe,c.isArrayLikeObject=te,c.isBoolean=gw,c.isBuffer=Dt,c.isDate=yw,c.isElement=ww,c.isEmpty=Mw,c.isEqual=bw,c.isEqualWith=vw,c.isError=tl,c.isFinite=_w,c.isFunction=_t,c.isInteger=ju,c.isLength=Sn,c.isMap=ec,c.isMatch=Iw,c.isMatchWith=Pw,c.isNaN=Rw,c.isNative=Fw,c.isNil=Tw,c.isNull=Sw,c.isNumber=tc,c.isObject=j,c.isObjectLike=ee,c.isPlainObject=Mi,c.isRegExp=rl,c.isSafeInteger=Ew,c.isSet=rc,c.isString=Tn,c.isSymbol=Oe,c.isTypedArray=vr,c.isUndefined=Cw,c.isWeakMap=xw,c.isWeakSet=Aw,c.join=Bg,c.kebabCase=vM,c.last=Xe,c.lastIndexOf=Ng,c.lowerCase=_M,c.lowerFirst=IM,c.lt=Ow,c.lte=Lw,c.max=yb,c.maxBy=wb,c.mean=Mb,c.meanBy=bb,c.min=vb,c.minBy=_b,c.stubArray=ul,c.stubFalse=cl,c.stubObject=sb,c.stubString=lb,c.stubTrue=pb,c.multiply=Ib,c.nth=Dg,c.noConflict=jM,c.noop=pl,c.now=Pn,c.pad=PM,c.padEnd=RM,c.padStart=FM,c.parseInt=SM,c.random=gM,c.reduce=$y,c.reduceRight=Hy,c.repeat=TM,c.replace=EM,c.result=aM,c.round=Pb,c.runInContext=y,c.sample=qy,c.size=Ky,c.snakeCase=CM,c.some=Xy,c.sortedIndex=kg,c.sortedIndexBy=Wg,c.sortedIndexOf=Kg,c.sortedLastIndex=Xg,c.sortedLastIndexBy=Yg,c.sortedLastIndexOf=zg,c.startCase=AM,c.startsWith=OM,c.subtract=Rb,c.sum=Fb,c.sumBy=Sb,c.template=LM,c.times=ub,c.toFinite=It,c.toInteger=D,c.toLength=nc,c.toLower=BM,c.toNumber=Ye,c.toSafeInteger=Bw,c.toString=W,c.toUpper=NM,c.trim=DM,c.trimEnd=UM,c.trimStart=GM,c.truncate=$M,c.unescape=HM,c.uniqueId=mb,c.upperCase=VM,c.upperFirst=ol,c.each=ku,c.eachRight=Wu,c.first=$u,ll(c,function(){var t={};return lt(c,function(i,o){X.call(c.prototype,o)||(t[o]=i)}),t}(),{chain:!1}),c.VERSION=e,Ve(["bind","bindKey","curry","curryRight","partial","partialRight"],function(t){c[t].placeholder=c}),Ve(["drop","take"],function(t,i){H.prototype[t]=function(o){o=o===s?1:ae(D(o),0);var l=this.__filtered__&&!i?new H(this):this.clone();return l.__filtered__?l.__takeCount__=me(o,l.__takeCount__):l.__views__.push({size:me(o,st),type:t+(l.__dir__<0?"Right":"")}),l},H.prototype[t+"Right"]=function(o){return this.reverse()[t](o).reverse()}}),Ve(["filter","map","takeWhile"],function(t,i){var o=i+1,l=o==Gl||o==q;H.prototype[t]=function(p){var m=this.clone();return m.__iteratees__.push({iteratee:x(p,3),type:o}),m.__filtered__=m.__filtered__||l,m}}),Ve(["head","last"],function(t,i){var o="take"+(i?"Right":"");H.prototype[t]=function(){return this[o](1).value()[0]}}),Ve(["initial","tail"],function(t,i){var o="drop"+(i?"":"Right");H.prototype[t]=function(){return this.__filtered__?new H(this):this[o](1)}}),H.prototype.compact=function(){return this.filter(Fe)},H.prototype.find=function(t){return this.filter(t).head()},H.prototype.findLast=function(t){return this.reverse().find(t)},H.prototype.invokeMap=G(function(t,i){return typeof t=="function"?new H(this):this.map(function(o){return di(o,t,i)})}),H.prototype.reject=function(t){return this.filter(Fn(x(t)))},H.prototype.slice=function(t,i){t=D(t);var o=this;return o.__filtered__&&(t>0||i<0)?new H(o):(t<0?o=o.takeRight(-t):t&&(o=o.drop(t)),i!==s&&(i=D(i),o=i<0?o.dropRight(-i):o.take(i-t)),o)},H.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},H.prototype.toArray=function(){return this.take(st)},lt(H.prototype,function(t,i){var o=/^(?:filter|find|map|reject)|While$/.test(i),l=/^(?:head|last)$/.test(i),p=c[l?"take"+(i=="last"?"Right":""):i],m=l||/^find/.test(i);!p||(c.prototype[i]=function(){var d=this.__wrapped__,h=l?[1]:arguments,w=d instanceof H,I=h[0],P=w||B(d),R=function($){var V=p.apply(c,Et([$],h));return l&&S?V[0]:V};P&&o&&typeof I=="function"&&I.length!=1&&(w=P=!1);var S=this.__chain__,C=!!this.__actions__.length,A=m&&!S,U=w&&!C;if(!m&&P){d=U?d:new H(this);var O=t.apply(d,h);return O.__actions__.push({func:_n,args:[R],thisArg:s}),new ke(O,S)}return A&&U?t.apply(this,h):(O=this.thru(R),A?l?O.value()[0]:O.value():O)})}),Ve(["pop","push","shift","sort","splice","unshift"],function(t){var i=Xi[t],o=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",l=/^(?:pop|shift)$/.test(t);c.prototype[t]=function(){var p=arguments;if(l&&!this.__chain__){var m=this.value();return i.apply(B(m)?m:[],p)}return this[o](function(d){return i.apply(B(d)?d:[],p)})}}),lt(H.prototype,function(t,i){var o=c[i];if(o){var l=o.name+"";X.call(gr,l)||(gr[l]=[]),gr[l].push({name:i,func:o})}}),gr[hn(s,ot).name]=[{name:"wrapper",func:s}],H.prototype.clone=Hf,H.prototype.reverse=Vf,H.prototype.value=qf,c.prototype.at=wy,c.prototype.chain=My,c.prototype.commit=by,c.prototype.next=vy,c.prototype.plant=Iy,c.prototype.reverse=Py,c.prototype.toJSON=c.prototype.valueOf=c.prototype.value=Ry,c.prototype.first=c.prototype.head,ai&&(c.prototype[ai]=_y),c},xt=bf();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(se._=xt,define(function(){return xt})):Xt?((Xt.exports=xt)._=xt,ss._=xt):se._=xt}).call(Fr)});var Ol=rr(nr());var Im=rr(_m()),Al=s=>{let e=250,r=[],n=0;return r[n]=[],s.forEach(a=>{r[n].length<=e?r[n].push(a):(n++,r[n]=[a])}),r},Dn=s=>{let e=[],r=200;for(;s.length>r;){let n=s.splice(0,r);e.push(n)}return e.push(s),e},ze=(s,e)=>{let r="";return s==="prod"||s==="sandbox"?r={profile:"https://profile.fansunitedapi.com/v1",football:"https://football.fansunitedapi.com/v1",idMapping:"https://id-mapping.fansunitedapi.com/v1",predictor:"https://prediction.fansunitedapi.com/v1",client:"https://client.fansunitedapi.com/v1",loyalty:"https://loyalty.fansunitedapi.com/v1"}[e]:r={profile:"http://localhost:8010",football:"http://locahost:8080",idMapping:"http://localhost:8030",predictor:"http://localhost:8040",client:"http://localhost:8080"}[e],r},Ut=s=>s.filter((r,n,a)=>n===a.indexOf(r)),Un=s=>Array.isArray(s)?s.map(e=>Un(e)):s!=null&&s.constructor===Object?Object.keys(s).reduce((e,r)=>({...e,[(0,Im.camelCase)(r)]:Un(s[r])}),{}):s;var Gn=class{id=null;name=null;avatar=null;gender=null;country=null;birthDate=null;interests=[];followingCount=0;followersCount=0};var $n=class{profilesFromResponse=e=>e?e.map(r=>this.fullProfileFromResponse(r)):null;fullProfileFromResponse=e=>{let r=new Gn;return r.id=e.id,r.name=e.name,r.avatar=e.avatar,r.gender=e.gender,r.country=e.country,r.birthDate=e.birth_date,r.interests=e.interests,r.followingCount=e.following_count,r.followersCount=e.followers_count,r}};var Hn=class{nextPageStartsAfter=null;itemsPerPage=null};var Sr=class{pagination=new Hn};var ie=class{meta=new Sr;data=[]};var Vn=class{avatar=null;followingId=null;name=null;profileId=null};var qn=class{followResponse=e=>e.map(r=>this.remapResponse(r));followingFromResponse=e=>{let r=new ie;return r.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,r.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,r.data=e.data.map(n=>this.remapResponse(n)),r};remapResponse=e=>{let r=new Vn;return r.avatar=e.avatar,r.followingId=e.following_id,r.name=e.name,r.profileId=e.profile_id,r}};var kn=class{avatar=null;followerId=null;name=null;profileId=null};var Wn=class{followersFromResponse=e=>{let r=new ie;return r.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,r.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,r.data=e.data.map(n=>this.remapResponse(n)),r};remapResponse=e=>{let r=new kn;return r.avatar=e.avatar,r.followerId=e.follower_id,r.name=e.name,r.profileId=e.profile_id,r}};var Pi=class{profile_ids=[]};var Tv="/countries",Qe="/profile",Pm="/profiles",Kn=class{instanceAuth=null;instance=null;apiSignInUrl=null;profileRemapper=null;followingRemapper=null;followersRemapper=null;constructor(e){let r=ze(e.environment,"profile");this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}&lang=${e.lang}`,this.instanceAuth=Ol.default.create({baseURL:r,headers:{Authorization:`Bearer ${e.authProvider.getIdToken()}`,"Content-Type":"application/json"}}),this.instanceAuth.interceptors.request.use(n=>n,n=>{Promise.reject(n)}),this.instanceAuth.interceptors.response.use(n=>n,n=>{let a=n.config;if((n.response.status===403||n.response.status===401)&&!a._retry){a._retry=!0;let u=e.authProvider.getIdToken();return a.headers.Authorization=`Bearer ${u}`,this.instanceAuth(a)}return Promise.reject(n)}),this.instance=Ol.default.create({baseURL:r,headers:{"Content-Type":"application/json"}}),this.profileRemapper=new $n,this.followingRemapper=new qn,this.followersRemapper=new Wn}getCountries=async e=>{try{let r=`${Tv}${this.apiSignInUrl}`,n=Date.now();return e&&(r+=`&disable_cache=${n}`),(await this.instance.get(r)).data.data}catch(r){throw console.warn("There was a problem fetching the countries:",r),r.response}};getProfile=async e=>{let r=`${Qe}${this.apiSignInUrl}`;if(e){r=`${Pm}/${e}${this.apiSignInUrl}`;try{let n=await this.instance.get(r);return this.profileRemapper.fullProfileFromResponse(n.data.data)}catch(n){throw console.warn(`There was a problem fetching the following profile: ${e}`,n),n.response}}else try{let n=await this.instanceAuth.get(r);return this.profileRemapper.fullProfileFromResponse(n.data.data)}catch(n){throw console.warn("There was a problem fetching your profile from API:",n),n.response}};getProfiles=async(e,r)=>{try{let n=`${Pm}${this.apiSignInUrl}&profile_ids=${e.join(",")}`,a=Date.now();r&&(n+=`&disable_cache=${a}`);let u=await this.instance.get(n);return this.profileRemapper.profilesFromResponse(u.data.data)}catch(n){throw console.warn(`There was a problem fetching the following profiles: ${e.join(",")}`,n),n.response}};getFollowers=async(e,r)=>{let n=`${Qe}/followers${this.apiSignInUrl}`;if(e&&!r){n=`${Qe}/followers${this.apiSignInUrl}${e.constructFilterUrl()}`;try{let a=await this.instanceAuth.get(n);return this.followersRemapper.followersFromResponse(a.data)}catch(a){throw console.warn("There was a problem fetching the followers for own profile",a),a.response}}else if(!e&&!r)try{let a=await this.instanceAuth.get(n);return this.followersRemapper.followersFromResponse(a.data)}catch(a){throw console.warn("There was a problem fetching the followers for own profile",a),a.response}e&&r?n=`${Qe}/${r}/followers${this.apiSignInUrl}${e.constructFilterUrl()}`:!e&&r&&(n=`${Qe}/${r}/followers${this.apiSignInUrl}`);try{let a=await this.instance.get(n);return this.followersRemapper.followersFromResponse(a.data)}catch(a){throw console.warn(`There was a problem fetching the followers for profile: ${r}`,a),a.response}};getFollowing=async(e,r)=>{let n=`${Qe}/following${this.apiSignInUrl}`;if(e&&!r){n=`${Qe}/following${this.apiSignInUrl}${e.constructFilterUrl()}`;try{let a=await this.instanceAuth.get(n);return this.followingRemapper.followingFromResponse(a.data)}catch(a){throw console.warn("There was a problem fetching the followers of own profile",a),a.response}}else if(!e&&!r)try{let a=await this.instanceAuth.get(n);return this.followingRemapper.followingFromResponse(a.data)}catch(a){throw console.warn("There was a problem fetching the followers of own profile",a),a.response}e&&r?n=`${Qe}/${r}/following${this.apiSignInUrl}${e.constructFilterUrl()}`:!e&&r&&(n=`${Qe}/${r}/following${this.apiSignInUrl}`);try{let a=await this.instance.get(n);return this.followingRemapper.followingFromResponse(a.data)}catch(a){throw console.warn(`There was a problem fetching the followers of the following profile: ${r}`,a),a.response}};follow=async e=>{let r=new Pi;r.profile_ids=e;try{let n=await this.instanceAuth.post(`${Qe}/follow${this.apiSignInUrl}`,JSON.stringify(r));return this.followingRemapper.followResponse(n.data.data)}catch(n){throw console.warn(`There was a problem with POST request for profiles: ${e.join(",")} `,n),n.response}};unfollow=async e=>{let r=new Pi;r.profile_ids=e;try{return await this.instanceAuth.delete(`${Qe}/follow${this.apiSignInUrl}`,{data:JSON.stringify(r)}),!0}catch(n){throw console.warn(`There was a problem with DELETE request for profiles: ${e.join(",")} `,n),n.response}};updateProfile=async e=>{try{let r=await this.instanceAuth.patch(`${Qe}${this.apiSignInUrl}`,e);return this.profileRemapper.fullProfileFromResponse(r.data.data)}catch(r){throw console.warn("There was a problem updating the own profile:",r),r.response}}};var Rt={native:"id",sportradar:"sportradar_id",sportal365:"sportal365_id",enetpulse:"enetpulse_id"};var Rm="FansUnited",Fm={football:{ids:[],countries:[],competitions:[]},profile:{own:{},countries:[],expireAt:0}},Gt=class{idSchema="";expirationTimeout=600;constructor(e){this.idSchema=e.idSchema,(this.getData()===void 0||this.getData()===null)&&this.setData(Fm)}clearData=()=>{this.setData(Fm)};getEntityById=(e="",r="")=>this.getData().football.ids.find(n=>{let a=Rt[this.idSchema];return n&&`${n[a]}`===r&&n.resource===e});getEntity=(e,r,n)=>Array.isArray(e)?this.getData().football.ids.filter(a=>{let u=Rt[n];return a&&e.includes(`${a[u]}`)&&a.resource===r}):this.getData().football.ids.find(a=>{let u=Rt[n];return a&&`${a[u]}`===e&&a.resource===r});getEntityByNativeId=(e="",r="")=>this.getData().football.ids.find(n=>n&&`${n.id}`===r&&n.resource===e);checkForExistingIdObjs=(e,r)=>{let n=Rt[r],a={};return Object.keys(e).forEach(u=>{let f=e[u],v=this.getEntity(f,u,r).map(M=>M[n]),T=e[u].filter(M=>!v.includes(M));a[u]=f.map(M=>T.includes(M)?{id:M,exists:!1}:{id:M,exists:!0})}),a};getIdsByType=(e,r,n)=>{let a=Rt[n],u=Rt[r],f={};return Object.keys(e).forEach(g=>{let v=e[g],T=[];this.getData().football.ids.forEach(M=>{v.forEach((F,Y)=>{F===M[u]&&g===M.resource&&(T[Y]=M[a])})}),f[g]=T}),f};addIdMapping=e=>{let r=this.getData();r.football.ids.push(e),this.setData(r)};addIdMappings=e=>{let r=this.getData(),n=r.football.ids;n=[...n,...e],r.football.ids=n,this.setData(r)};setOwnProfile=e=>{let r=this.getData();r.profile.own=e,r.profile.expireAt=Math.floor(Date.now()/1e3)+this.expirationTimeout,this.setData(r)};getOwnProfile=()=>this.getData().profile.own;getProfileCountries=()=>this.getData().profile.countries;setProfileCountries=e=>{let r=this.getData();r.profile.countries=e,this.setData(r)};getFootballCountries=()=>this.getData().football.countries;setFootballCountries=e=>{let r=this.getData();r.football.countries=e,this.setData(r)};getCompetitions=e=>{let r=this.getData();return e?e.competitionSearchFilter(r.football.competitions):r.football.competitions};setCompetitions=e=>{let r=this.getData();r.football.competitions.push(...e),this.setData(r)};getExpirationProfile=()=>this.getData().profile.expireAt;getData=()=>JSON.parse(localStorage.getItem(Rm));setData=e=>{localStorage.setItem(Rm,JSON.stringify(e))}};var Sm=rr(nr());var Ri={player:"players",team:"teams",homeTeam:"teams",awayTeam:"teams",country:"countries",competition:"competitions",match:"matches"},Xn=class{instance=null;apiSignInUrl="";constructor(e){let r=ze(e.environment,"idMapping");this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}`,this.instance=Sm.default.create({baseURL:r})}getEntityById=(e,r)=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${config.idSchema}&${Ri[e]}=${r}`)}catch(n){throw console.warn(`There was a problem with id mapping request for the following id:${r}`,n),n.response}};getEntityByIdAndSchema=(e,r,n)=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${n}&${Ri[e]}=${r}`)}catch(a){throw console.warn(`There was a problem with id mapping request for the following id:${r}`,a),a.response}};getEntityIdsByIdsAndSchema=(e,r,n)=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${n}&${Ri[e]}=${r.join(",")}`)}catch(a){throw console.warn(`There was a problem with id mapping request for the following ids:${r.join(",")}`,a),a.response}};getEntitiesByIds=(e,r,n)=>{r.sort((f,g)=>f.localeCompare(g));let u=Al(r).map(f=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${n}&${Ri[e]}=${f.join(",")}`)}catch(g){throw console.warn(`There was a problem with id mapping request for the following ids:${f.join(",")}`,g),g.response}});return Promise.all(u).then(f=>{let g=[];return f.forEach(v=>{g.push(...v.data.data)}),g})};getEntitiesByIdObjs=async(e,r)=>{let n=[],a={},u=[];Object.keys(e).forEach(T=>{n.push.apply(n,e[T])});let f=Ut(n),g=Al(f);for(let T of g){let M="";if(Object.keys(e).forEach(F=>{a[F]=[];let Y=T.filter(be=>e[F].includes(be));Y&&Y.length>0&&(a[F]=Y)}),Object.keys(a).forEach(F=>{a[F].length>0&&(a[F].sort((Y,be)=>Y.localeCompare(be)),M+="&",M+=`${Ri[F]}=${a[F].join(",")}`)}),M&&M.length>0)try{let F=await this.instance.get(`/football${this.apiSignInUrl}&input_provider=${r||"native"}${M}`);u.push(F.data.data)}catch(F){throw console.warn("There was a problem with id mapping request",F),F.response}else u.push([])}return Array.prototype.concat.apply([],u)}};var Yn=class{isBrowser=!1;localStorage=null;https=null;constructor(e){this.isBrowser=typeof window!="undefined",this.localStorage=new Gt(e),this.https=new Xn(e)}getEntitiesByIds=async(e,r,n)=>{if(this.isBrowser)try{let a=this.localStorage.checkForExistingIdObjs(e,r),u=this.splitForRequestAndExisting(a),f=await this.https.getEntitiesByIdObjs(u.request,r);return this.localStorage.addIdMappings(f),this.localStorage.getIdsByType(e,r,n)}catch(a){return console.warn("There was a problem retrieving the entity ids ",a),Promise.resolve([])}else try{let a=await this.https.getEntitiesByIdObjs(e,r);return Object.keys(e).forEach(u=>{e[u]=a.filter(f=>f.resource===u).map(f=>f[Rt[n]])}),e}catch(a){return console.warn("There was a problem retrieving the entity ids ",a),Promise.resolve([])}};getEntityById=async(e,r,n)=>{if(this.isBrowser){let a=this.localStorage.getEntity(e,r,n);if(a)return a;{let u=await this.requestEntity(e,r,n);return this.localStorage.addIdMappings(u),u}}else return await this.requestEntity(e,r,n)};splitForRequestAndExisting=e=>{let r={},n={};return Object.keys(e).forEach(a=>{r[a]=e[a].filter(u=>!u.exists).map(u=>u.id),n[a]=e[a].filter(u=>u.exists).map(u=>u.id)}),{existing:n,request:r}};requestEntity=async(e,r,n)=>{try{return e=Array.isArray(e)?e:[e],await this.https.getEntitiesByIds(r,e,n)}catch(a){return console.warn(`There was a problem retrieving the requested entity: ${a}`),null}}};var zn=s=>{switch(s){case"competitions":return"competition";case"players":case"relatedPlayer":case"squad":return"player";case"teams":case"participants":case"homeTeam":case"awayTeam":case"timeline":case"teamId":return"team";default:return s}};var Qn=class{extractedObjIds={};traverse=(e,r)=>(r=zn(r),Array.isArray(e)?this.traverseArrExtract(e,r):e&&typeof e=="object"&&this.traverseObjExtract(e,r),this.extractedObjIds);traverseArrExtract=(e,r)=>{e&&e.length>0&&e.forEach(n=>{this.traverseObjExtract(n,r)})};traverseObjExtract=(e,r)=>{e&&Object.keys(e).length>0&&Object.keys(e).forEach(n=>{let a=e[n];n==="id"||n==="teamId"?(this.extractedObjIds.hasOwnProperty(r)||(this.extractedObjIds[r]=[]),this.extractedObjIds[r].push(a)):e[n]&&this.traverse(e[n],n)})}};var Jn=class{replaceObjIdsIndex=null;remappedIdsObj={};traverse=(e,r,n)=>(r=zn(r),this.replaceObjIdsIndex===null&&(this.initReplaceObjIdsIndex(n),this.remappedIdsObj=n),Array.isArray(e)?this.traverseArrReplace(e,r):e&&typeof e=="object"&&this.traverseObjReplace(e,r),e);initReplaceObjIdsIndex=e=>{this.replaceObjIdsIndex={},Object.keys(e).forEach(r=>{this.replaceObjIdsIndex[r]=0})};traverseArrReplace=(e,r)=>{e&&e.length>0&&e.forEach(n=>{this.traverseObjReplace(n,r)})};traverseObjReplace=(e,r)=>{e&&Object.keys(e).length>0&&Object.keys(e).forEach(n=>{n==="id"||n==="teamId"?(e[n]=this.remappedIdsObj[r][this.replaceObjIdsIndex[r]],this.replaceObjIdsIndex[r]=this.replaceObjIdsIndex[r]+1):e[n]&&this.traverse(e[n],n,this.remappedIdsObj)})}};var Te=class{idSchema="";idMappingFacade=null;constructor(e){this.idSchema=e.idSchema,this.idMappingFacade=new Yn(e)}getEntityIdBySchemaId=(e,r)=>this.idMappingFacade.getEntityById(e,r,this.idSchema);remapEntities=async(e,r)=>{let n=JSON.parse(JSON.stringify(e));try{if(this.idSchema!=="native"){let u=new Qn().traverse(n,r);return this.idMappingFacade.getEntitiesByIds(u,"native",this.idSchema).then(f=>new Jn().traverse(n,r,f))}else return e}catch(a){return console.warn(`There was a problem remapping entity: ${r} with inner entity `,a),[]}};getEntityIdsBySchemaId=async(e,r,n)=>{let a={};return a[r]=e,this.idSchema!=="native"?await this.idMappingFacade.getEntitiesByIds(a,this.idSchema,n):a}};var De=class{completed=!1;percentage;constructor(e){this.percentage=e}};var Zn=class{teamFollowed=new De(10);teamFavourite=new De(15);playerFollowed=new De(10);playerFavourite=new De(10);competitionFollowed=new De(10);competitionFavourite=new De(5);addedBirthdate=new De(10);addedGender=new De(10);addedCountry=new De(10);addedAvatar=new De(10)};var jn=class{totalPercentage;breakdown=new Zn};var Fi=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 $t=class{isBrowser=!1;localStorage={};https=null;constructor(e,r){this.isBrowser=typeof window!="undefined",this.localStorage=e,this.https=r}getOwn=async()=>{if(this.isBrowser){let e=Math.floor(Date.now()/1e3),r=this.localStorage.getExpirationProfile(),n=null;if(r>e&&(n=this.localStorage.getOwnProfile()),n)return n;try{let a=await this.https.getProfile();return this.localStorage.setOwnProfile(a),a}catch(a){throw console.warn("There was a problem retrieving your profile: ",a),a}}else try{return await this.https.getProfile()}catch(e){throw console.warn("There was a problem retrieving your profile: ",e),e}};getByIds=async(e,r)=>{try{return r=r||!1,await this.https.getProfiles(e,r)}catch(n){throw console.warn(`There was a problem retrieving the selected profiles: ${e.join(",")} `,n),n}};getById=async e=>{try{return await this.https.getProfile(e)}catch(r){throw console.warn(`There was a problem retrieving the selected profile: ${e} `,r),r}};getCountries=async e=>{if(e=e||!1,this.isBrowser){let r=this.localStorage.getProfileCountries();if(r&&r.length>0)return r;try{let n=await this.https.getCountries(e);return this.localStorage.setProfileCountries(n),n}catch(n){throw console.warn("There was a problem retrieving profile countries: ",n),n}}else try{return await this.https.getCountries(e)}catch(r){throw console.warn("There was a problem retrieving profile countries: ",r),r}};getFollowers=async(e,r)=>{try{return e&&(e=new Fi(e)),await this.https.getFollowers(e,r)}catch(n){throw console.warn("There was a problem retrieving your followers: ",n),n}};getFollowing=async(e,r)=>{try{return e&&(e=new Fi(e)),await this.https.getFollowing(e,r)}catch(n){throw console.warn("There was a problem retrieving your following profiles: ",n),n}};follow=async e=>{try{return await this.https.follow(e)}catch(r){throw console.warn(`There was a problem following profiles: ${e.join(",")} `,r),r}};unfollow=async e=>{try{return await this.https.unfollow(e)}catch(r){throw console.warn(`There was a problem unfollowing profiles: ${e.join(",")} `,r),r}};showFullnessProfile=e=>{let r=new jn,n=0;return e.avatar&&(r.breakdown.addedAvatar.completed=!0,n+=r.breakdown.addedAvatar.percentage),e.birthDate&&(r.breakdown.addedBirthdate.completed=!0,n+=r.breakdown.addedBirthdate.percentage),e.country&&(r.breakdown.addedCountry.completed=!0,n+=r.breakdown.addedCountry.percentage),e.gender&&(r.breakdown.addedGender.completed=!0,n+=r.breakdown.addedGender.percentage),e.interests&&e.interests.length>0&&(e.interests.find(M=>M.type==="team"&&M.favourite)&&(r.breakdown.teamFavourite.completed=!0,n+=r.breakdown.teamFavourite.percentage),e.interests.find(M=>M.type==="team")&&(r.breakdown.teamFollowed.completed=!0,n+=r.breakdown.teamFollowed.percentage),e.interests.find(M=>M.type==="player"&&M.favourite)&&(r.breakdown.playerFavourite.completed=!0,n+=r.breakdown.playerFavourite.percentage),e.interests.find(M=>M.type==="player")&&(r.breakdown.playerFollowed.completed=!0,n+=r.breakdown.playerFollowed.percentage),e.interests.find(M=>M.type==="competition"&&M.favourite)&&(r.breakdown.competitionFavourite.completed=!0,n+=r.breakdown.competitionFavourite.percentage),e.interests.find(M=>M.type==="competition")&&(r.breakdown.competitionFollowed.completed=!0,n+=r.breakdown.competitionFollowed.percentage)),r.totalPercentage=n,r}};var eo=class{id=null;name=null;assets=null};var to=class{isBrowser=!1;localStorage={};https=null;idMapping=null;constructor(e,r,n){this.isBrowser=typeof window!="undefined",this.localStorage=e,this.idMapping=n,this.https=r}getCountriesWithIdMapping=async e=>{try{let r=await this.getCountries(e);return this.idMapping.remapEntities(r,"country")}catch(r){throw console.warn("There was a problem browsing countries as football entities",r),r}};getCountries=async e=>{if(e=e||!1,this.isBrowser){let r=this.localStorage.getFootballCountries();if(r&&r.length>0)return r;try{let n=await this.https.getCountries(e);return this.localStorage.setFootballCountries(n),n}catch(n){throw console.warn("There was a problem retrieving countries as football entities",n),n}}else return this.https.getCountries(e)}};var ro=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 r=this.filter(e);return this.sortField||this.sortOrder?this.sort(r):r}catch(r){return console.warn("There was a problem filtering the local competitions",r),[]}};filter=e=>{let r=this.entitiesToSearchWith();return e.filter(n=>{let a=!0;return r.forEach(u=>{u!=="sortOrder"&&u!=="sortField"&&(u==="countryId"?a&&=n.country.id===this[u]:u==="name"?a&&=n.name.toLocaleLowerCase().includes(this[u].toLocaleLowerCase()):u==="competitionIds"?a&&=this[u].some(f=>n.id===f):a&&=n[u].toLocaleLowerCase()===this[u].toLocaleLowerCase())}),a})};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 r=[];return this.sortField==="name"?r=e.sort((n,a)=>this.sortOrder&&this.sortOrder==="desc"?a.name.localeCompare(n.name):n.name.localeCompare(a.name)):this.sortField==="countryId"?r=e.sort((n,a)=>this.sortOrder&&this.sortOrder==="desc"?a.country.id.localeCompare(n.country.id):n.country.id.localeCompare(a.country.id)):this.sortField==="scope"?e.forEach(n=>r[this.competitionIds.indexOf(n.id)]=n):!this.sortField&&this.sortOrder==="desc"&&(r=e.sort((n,a)=>a.id.localeCompare(n.id))),r}};var io=class{isBrowser=!1;localStorage={};https=null;idMapping=null;constructor(e,r,n){this.isBrowser=typeof window!="undefined",this.localStorage=e,this.idMapping=n,this.https=r}getCompetitionsIdMapping=async(e,r)=>{try{let n=!1;if(e){if(e=new ro(e),e.countryId){let u=await this.idMapping.getEntityIdsBySchemaId([`${e.countryId}`],"country","native");u.country.length===0&&(n=!0),e.countryId=u.country[0]}if(e.competitionIds){let u=await this.idMapping.getEntityIdsBySchemaId(e.competitionIds,"competition","native");u.competition.length===0&&(n=!0),e.competitionIds=u.competition}if(n)return[]}let a=await this.getCompetitions(e,r);return await this.idMapping.remapEntities(a,"competition")}catch(n){throw console.warn("There was a problem browsing all of the competitions",n),n}};getCompetitions=async(e,r)=>{if(r=r||!1,this.isBrowser){let n=this.localStorage.getCompetitions(e);if(n&&n.length>0)return n;try{let a=await this.https.getCompetitions(e,r);return this.localStorage.setCompetitions(a),this.localStorage.getCompetitions(e)}catch(a){throw console.warn("There was a problem retrieving all competitions",a),a}}else return this.https.getCompetitions(e,r)};getCompetitionByIdIdMapping=async(e,r)=>{try{let a=(await this.idMapping.getEntityIdsBySchemaId([e],"competition","native")).competition[0],u=await this.getCompetitionById(a,r);return await this.idMapping.remapEntities(u,"competition")}catch(n){throw console.warn(`There was a problem browsing the following competition:${e}`,n),n}};getCompetitionById=async(e,r)=>{try{return r=r||!1,await this.https.getCompetitionById(e,r)}catch(n){throw console.warn(`There was a problem retrieving the competition with the following id: ${e}`,n),n}};getTopCompetitionsIdMapping=async e=>{try{let r=await this.getTopCompetitions(e);return await this.idMapping.remapEntities(r,"competition")}catch(r){throw console.warn("There was a problem browsing the top competitions",r),r}};getTopCompetitions=async e=>{try{return e=e||!1,await this.https.getTopCompetitions(e)}catch(r){throw console.warn("There was a problem retrieving the top competitions",r),r}}};var no=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 oo=class{https=null;idMapping=null;constructor(e,r){this.idMapping=r,this.https=e}getTeamsIdMapping=async(e,r)=>{try{let n=!1;if(e){if(e=new no(e),e.countryId){let u=await this.idMapping.getEntityIdsBySchemaId([`${e.countryId}`],"country","native");u.country.length===0&&(n=!0),e.countryId=u.country[0]}if(e.scope){let u=await this.idMapping.getEntityIdsBySchemaId(e.scope,"competition","native");u.competition.length===0&&(n=!0),e.scope=u.competition}if(e.teamIds){let u=await this.idMapping.getEntityIdsBySchemaId(e.teamIds,"team","native");u.team.length===0&&(n=!0),e.teamIds=u.team}}if(n)return[];let a=await this.getTeams(e,r);return a.data=await this.idMapping.remapEntities(a.data,"team"),a}catch(n){throw console.warn("There was a problem browsing all teams",n),n}};getTeams=async(e,r)=>{try{return r=r||!1,await this.https.getTeams(e,r)}catch(n){throw console.warn("There was a problem retrieving all teams",n),n}};getTeamByIdIdMapping=async(e,r)=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"team","native")).team[0];let a=await this.getTeamById(e,r);return await this.idMapping.remapEntities(a,"team")}catch(n){throw console.warn(`There was a problem browsing the following team:${e}`,n),n}};getTeamById=async(e,r)=>{try{return r=r||!1,await this.https.getTeamById(e,r)}catch(n){throw console.warn(`There was a problem retrieving the following team: ${e}`,n),n}};getTopTeamsIdMapping=async e=>{try{let r=await this.getTopTeams(e);return await this.idMapping.remapEntities(r,"team")}catch(r){throw console.warn("There was a problem browsing the top teams",r),r}};getTopTeams=async e=>{try{return e=e||!1,await this.https.getTopTeams(e)}catch(r){throw console.warn("There was a problem retrieving the top teams",r),r}};getNextMatchForTeamIdMapping=async(e,r)=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"team","native")).team[0];let a=await this.getNextMatchForTeam(e,r);return await this.idMapping.remapEntities(a,"match")}catch(n){throw console.warn(`There was a problem browsing the next match for the following team:${e}`,n),n}};getNextMatchForTeam=async(e,r)=>{try{return r=r||!1,await this.https.getNextMatchForTeam(e,r)}catch(n){throw console.warn(`There was a problem retrieving the next match for the following team: ${e}`,n),n}};getPrevMatchForTeamIdMapping=async(e,r)=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"team","native")).team[0];let a=await this.getPrevMatchForTeam(e,r);return await this.idMapping.remapEntities(a,"match")}catch(n){throw console.warn(`There was a problem browsing the previous match for the following team:${e}`,n),n}};getPrevMatchForTeam=async(e,r)=>{try{return r=r||!1,await this.https.getPrevMatchForTeam(e,r)}catch(n){throw console.warn(`There was a problem retrieving the previous match for the following team: ${e}`,n),n}}};var Si=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 Ht=class{https=null;idMapping=null;constructor(e,r){this.idMapping=r,this.https=e}getPlayersIdMapping=async(e,r)=>{try{let n=!1;if(e){if(e=new Si(e),e.countryId){let u=await this.idMapping.getEntityIdsBySchemaId([e.countryId],"country","native");u.country.length===0&&(n=!0),e.countryId=u.country[0]}if(e.playerIds){let u=await this.idMapping.getEntityIdsBySchemaId(e.playerIds,"player","native");u.player.length===0&&(n=!0),e.playerIds=u.player}if(e.scope){let u=await this.idMapping.getEntityIdsBySchemaId(e.scope,"competition","native");u.competition.length===0&&(n=!0),e.scope=u.competition}if(n)return[]}let a=await this.getPlayers(e,r);return a.data=await this.idMapping.remapEntities(a.data,"player"),a}catch(n){throw console.warn("There was a problem browsing the players",n),n}};getPlayersWithNativeIds=async e=>{let r=new Si({playerIds:e}),n=await this.getPlayers(r);return n.data.sort((a,u)=>a.id.localeCompare(u.id)),await this.idMapping.remapEntities(n.data,"player")};getPlayersMapWithNativeIds=async e=>{let r={},n=Ut(e);n.sort((u,f)=>u.localeCompare(f));let a=await this.getPlayersWithNativeIds(n);return n.forEach((u,f)=>r[u]=a[f]),r};getPlayers=async(e,r)=>{try{return r=r||!1,await this.https.getPlayers(e,r)}catch(n){throw console.warn("There was a problem retrieving the players",n),n}};getPlayerIdMapping=async(e,r)=>{try{let n=await this.idMapping.getEntityIdsBySchemaId([e],"player","native"),a=await this.getPlayerById(n.player[0],r);return await this.idMapping.remapEntities(a,"player")}catch(n){throw console.warn(`There was a problem browsing the following player:${e}`,n),n}};getPlayerById=async(e,r)=>{try{return r=r||!1,await this.https.getPlayerById(e,r)}catch(n){throw console.warn(`There was a problem retrieving the following player: ${e}`,n),n}};getTopPlayersIdMapping=async e=>{try{let r=await this.getTopPlayers(e);return await this.idMapping.remapEntities(r,"player")}catch(r){throw console.warn("There was a problem browsing the top players",r),r}};getTopPlayers=async e=>{try{return e=e||!1,await this.https.getTopPlayers(e)}catch(r){throw console.warn("There was a problem retrieving the top players",r),r}};getNextMatchForPlayerIdMapping=async(e,r)=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"player","native")).player[0];let a=await this.getNextMatchForPlayer(e,r);return await this.idMapping.remapEntities(a,"match")}catch(n){throw console.warn(`There was a problem browsing the next match for player:${e}`,n),n}};getNextMatchForPlayer=async(e,r)=>{try{return r=r||!1,await this.https.getNextMatchForPlayer(e,r)}catch(n){throw console.warn(`There was a problem retrieving the next match for player: ${e}`,n),n}};getPrevMatchForPlayerIdMapping=async(e,r)=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"player","native")).player[0];let a=await this.getPrevMatchForPlayer(e,r);return await this.idMapping.remapEntities(a,"match")}catch(n){throw console.warn(`There was a problem browsing the previous match for player:${e}`,n),n}};getPrevMatchForPlayer=async(e,r)=>{try{return r=r||!1,await this.https.getPrevMatchForPlayer(e,r)}catch(n){throw console.warn(`There was a problem retrieving the previous match for player: ${e}`,n),n}}};var Ti=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 Vt=class{https=null;idMapping=null;constructor(e,r){this.https=e,this.idMapping=r}getMatchesIdMapping=async(e,r)=>{try{if(e){if(e=new Ti(e),e.countryIds){let a=await this.idMapping.getEntityIdsBySchemaId(e.countryIds,"country","native");e.countryIds=a.country}if(e.competitionIds){let a=await this.idMapping.getEntityIdsBySchemaId(e.competitionIds,"competition","native");e.competitionIds=a.competition}if(e.matchIds){let a=await this.idMapping.getEntityIdsBySchemaId(e.matchIds,"match","native");e.matchIds=a.match}if(e.teamIds){let a=await this.idMapping.getEntityIdsBySchemaId(e.teamIds,"team","native");e.teamIds=a.team}}let n=await this.getMatches(e,r);return n.data=await this.idMapping.remapEntities(n.data,"match"),n}catch(n){throw console.warn("There was a problem browsing the matches",n),n}};getMatchesWithNativeIds=async e=>{let r=e.length,n=new Ti({matchIds:e,limit:r}),a=await this.getMatches(n);return a.data.sort((u,f)=>u.id.localeCompare(f.id)),await this.idMapping.remapEntities(a.data,"match")};getMatchesMapWithNativeIds=async e=>{let r={},n=Ut(e);n.sort((u,f)=>u.localeCompare(f));let a=await this.getMatchesWithNativeIds(n);return n.forEach((u,f)=>r[u]=a[f]),r};getMatches=async(e,r)=>{try{return r=r||!1,await this.https.getMatches(e,r)}catch(n){throw console.warn("There was a problem retrieving the matches",n),n}};getMatchIdMapping=async(e,r)=>{try{let n=await this.idMapping.getEntityIdsBySchemaId([e],"match","native"),a=await this.getMatchById(n.match[0],r);return await this.idMapping.remapEntities(a,"match")}catch(n){throw console.warn(`There was a problem browsing the following match: ${e}`,n),n}};getMatchById=async(e,r)=>{try{return r=r||!1,await this.https.getMatchById(e,r)}catch(n){throw console.warn(`There was a problem retrieving the following match: ${e}`,n),n}}};var ao=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 so=class{https=null;idMapping=null;constructor(e,r){this.https=e,this.idMapping=r}searchIdMapping=async(e,r)=>{try{if(e=new ao(e),e.scope){let a=await this.idMapping.getEntityIdsBySchemaId(e.scope,"competition","native");e.scope=a.competition}let n=await this.search(e,r);if(n.teams&&n.teams.length>0){let a=await this.idMapping.remapEntities(n.teams,"team");n.teams=a}if(n.players&&n.players.length>0){let a=await this.idMapping.remapEntities(n.players,"player");n.players=a}if(n.competitions&&n.competitions.length>0){let a=await this.idMapping.remapEntities(n.competitions,"competition");n.competitions=a}return n}catch(n){throw console.warn("There was a problem with browsing the search result",n),n}};search=async(e,r)=>{try{return await this.https.search(e,r)}catch(n){throw console.warn("There was a problem retrieving the search response",n),n}}};var qt=class{isBrowser=!1;localStorage={};https=null;idMapping=null;countriesFacade=null;competitionsFacade=null;teamsFacade=null;playerFacade=null;matchFacade=null;searchFacade=null;constructor(e,r,n){this.isBrowser=typeof window!="undefined",this.localStorage=e,this.idMapping=n,this.https=r,this.countriesFacade=new to(e,r,n),this.competitionsFacade=new io(e,r,n),this.teamsFacade=new oo(r,n),this.playerFacade=new Ht(r,n),this.matchFacade=new Vt(r,n),this.searchFacade=new so(r,n)}getCountries=async e=>this.countriesFacade.getCountriesWithIdMapping(e);getCompetitions=async(e,r)=>this.competitionsFacade.getCompetitionsIdMapping(e,r);getCompetitionById=async(e,r)=>this.competitionsFacade.getCompetitionByIdIdMapping(e,r);getTopCompetitions=async e=>this.competitionsFacade.getTopCompetitionsIdMapping(e);getTeams=async(e,r)=>this.teamsFacade.getTeamsIdMapping(e,r);getTeamById=async(e,r)=>this.teamsFacade.getTeamByIdIdMapping(e,r);getTopTeams=async e=>this.teamsFacade.getTopTeamsIdMapping(e);getNextMatchForTeam=async(e,r)=>this.teamsFacade.getNextMatchForTeamIdMapping(e,r);getPrevMatchForTeam=async(e,r)=>this.teamsFacade.getPrevMatchForTeamIdMapping(e,r);getPlayers=async(e,r)=>this.playerFacade.getPlayersIdMapping(e,r);getPlayerById=async(e,r)=>this.playerFacade.getPlayerIdMapping(e,r);getTopPlayers=async e=>this.playerFacade.getTopPlayersIdMapping(e);getNextMatchForPlayer=async(e,r)=>this.playerFacade.getNextMatchForPlayerIdMapping(e,r);getPrevMatchForPlayer=async(e,r)=>this.playerFacade.getPrevMatchForPlayerIdMapping(e,r);getMatches=async(e,r)=>this.matchFacade.getMatchesIdMapping(e,r);getMatchById=async(e,r)=>this.matchFacade.getMatchIdMapping(e,r);search=async(e,r)=>this.searchFacade.searchIdMapping(e,r)};var Er=class{idMapping=null;footballFacade=null;constructor(e,r){this.idMapping=e,this.footballFacade=r}remapInterestsToIdSchema=async e=>{let r=this.idMapping.idSchema;if(r!=="native")if(e.length>0){let n={},a={};e.forEach(g=>{n.hasOwnProperty(g.type)||(n[g.type]=[],a[g.type]=[]),n[g.type].push(g.id),a[g.type].push(g)});let u=await this.idMapping.idMappingFacade.getEntitiesByIds(n,"native",r),f=[];for(let[g,v]of Object.entries(a))v.forEach((T,M)=>{T.id=u[g][M],f.push(T)});return f}else return e;else return e};remapInterestToNative=async e=>{let r=this.idMapping.idSchema;if(r!=="native"){let n={},{id:a,type:u}=e;n[u]=[a];let f=await this.idMapping.idMappingFacade.getEntitiesByIds(n,r,"native");return e.id=f[u][0],e}return e};inquiryCustomInterests=async e=>{let r=[];if(e&&e.length>0&&(r=e.filter(n=>n.source==="custom")),r&&r.length>0){let n=e.filter(u=>u.source!=="custom"),a=await this.remapInterestsToIdSchema(n);return r.forEach(u=>a.push(u)),a}return await this.remapInterestsToIdSchema(e)};showFullInterests=async e=>{let r=[];if(e&&e.length>0)for(let n of e)if(n.source!=="custom"&&n.source==="football"){let a={};if(n.type==="team"){a.teamIds=[n.id];let u=await this.footballFacade.getTeams(a);n.model=u.data[0]}if(n.type==="player"){a.playerIds=[n.id];let u=await this.footballFacade.getPlayers(a);n.model=u.data[0]}if(n.type==="competition"){a.competitionIds=[n.id];let u=await this.footballFacade.getCompetitions(a);n.model=u[0]}n.model===void 0&&(n.model=null),r.push(n)}else r.push(n);return r};updateInterests=(e,r)=>{if(e.length===r.length){let n=r.filter(u=>e.some(f=>u.id===f.id&&u.type===f.type&&u.source===f.source&&u.favourite===f.favourite)),a=r.filter(u=>!e.some(f=>u.id===f.id&&u.type===f.type&&u.source===f.source&&u.favourite===f.favourite));return[...n,...a]}else return r}};var lo=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,r,n,a){this.localStorage=e,this.profileHttps=r,this.footballHttps=a,this.idMapping=n,this.footballFacade=new qt(e,a,n),this.interestsService=new Er(n,this.footballFacade),this.profileFacade=new $t(e,r)}getOwnProfile=async()=>{for(;this.isFetching;)console.log("Another thread is fetching profile..."),await this.delay(100);if(this.modified&&this.ownProfile)return console.log("Timestamp is less than 10 minutes OR profile is modifying "),this.ownProfile;let e=Math.floor(Date.now()/1e3);if(!this.ownProfile||this.expireAt<e){this.isFetching=!0,this.expireAt=Math.floor(Date.now()/1e3)+600;try{let r=await this.profileFacade.getOwn();this.setOwnProfile(r)}catch{this.isFetching=!1}return this.modified=!1,this.isFetching=!1,this.ownProfile}return this.ownProfile};delay=e=>new Promise(r=>{setTimeout(r,e)});setOwnProfile=e=>{this.ownProfile=e};extractUpdatedProps=(e,r)=>{let n={};return Object.keys(e).forEach(a=>{a==="gender"&&e[a]!==r[a]?n[a]=r[a]:a==="birthDate"?(r[a]===null||e[a]===null&&r[a]||e[a]!==r[a])&&(n.birth_date=r[a]):a==="country"?r[a]===null?n.country_id=r[a]:(e[a]===null&&r[a]||e[a].id!==r[a].id)&&(n.country_id=r[a].id):a==="interests"&&r[a]&&r[a].length>0&&(n[a]=this.interestsService.updateInterests(e[a],r[a]))}),n};getInfo=async()=>{let e=await this.getOwnProfile(),r=JSON.parse(JSON.stringify(e));return delete r.interests,r};showInterests=async()=>{let e=await this.getOwnProfile(),r=[];return r=e.interests,await this.interestsService.inquiryCustomInterests(r)};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 r=null;e.source!=="custom"?r=await this.interestsService.remapInterestToNative(e):r=e;let n=this.ownProfile.interests.filter(a=>a.id!==r.id||a.type!==r.type||a.source!==r.source);return this.ownProfile.interests=[...n],this.ownProfile.interests.push(r),this};addInterest=e=>(this.promises.push(this.addInterestPromise(e)),this);removeInterestPromise=async e=>{this.modified=!0,await this.getOwnProfile();let r=null;return e.source!=="custom"?r=await this.interestsService.remapInterestToNative(e):r=e,this.ownProfile.interests=this.ownProfile.interests.filter(n=>n.id!==r.id||n.type!==r.type||n.source!==r.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 eo,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(),r=JSON.parse(JSON.stringify(e));return this.profileFacade.showFullnessProfile(r)};update=async()=>{if(this.promises.length===0)return this.ownProfile;await Promise.all(this.promises);let e=await this.profileFacade.getOwn(),r=await this.getOwnProfile(),n=this.extractUpdatedProps(e,r),a=await this.profileHttps.updateProfile(n);return this.modified=!1,this.expireAt=0,this.localStorage.setOwnProfile(a),delete a.interests,a}};var po=class{profileHttps=null;footballFacade=null;localStorage=null;idMapping=null;profileFacade=null;interestsService=null;profileId="";constructor(e,r,n,a){this.localStorage=e,this.profileHttps=r,this.footballFacade=a,this.idMapping=n,this.interestsService=new Er(n,a),this.profileFacade=new $t(e,r)}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(),r=[];return r=e.interests,await this.interestsService.inquiryCustomInterests(r)};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 Tm=rr(nr());var uo=class{id="";alias="";countryCode="";assets=null;name=""};var ne=class{countriesFromResponse=e=>{if(e)return e.map(r=>this.countryFromResponse(r))};countryFromResponse=e=>{try{if(e){let r=new uo;return r.id=e.id,r.alias=e.alias,r.assets=e.assets,r.countryCode=e.country_code,r.name=e.name,r}}catch(r){throw r}return null}};var co=class{id="";country=null;gender="";assets=null;type="";name=""};var Ee=class{countryRemapper=null;constructor(){this.countryRemapper=new ne}fromResponse(e){try{let r=new co;return r.id=e.id,r.country=this.countryRemapper.countryFromResponse(e.country),r.gender=e.gender,r.assets=e.assets,r.type=e.type,r.name=e.name,r}catch(r){throw console.warn("There was a problem remapping the competition response",r),r}}};var mo=class{id="";country=null;gender="";assets=null;type="";name="";participants=[]};var fo=class{id="";country=null;gender="";assets=null;name="";code="";national=!1;fullName="";shortName=""};var fe=class{countryRemapper=null;constructor(){this.countryRemapper=new ne}fromResponse(e){try{let r=new fo;return r.id=e.id,r.country=this.countryRemapper.countryFromResponse(e.country),r.gender=e.gender,r.assets=e.assets,r.code=e.code,r.national=e.national,r.fullName=e.full_name,r.shortName=e.short_name,r.name=e.name,r}catch(r){throw console.warn("There was a problem remapping teams response",r),r}}};var ho=class{countryRemapper=null;teamBasicRemapper=null;constructor(){this.countryRemapper=new ne,this.teamBasicRemapper=new fe}fromResponse(e){try{let r=new mo;return r.id=e.id,r.country=this.countryRemapper.countryFromResponse(e.country),r.gender=e.gender,r.assets=e.assets,r.type=e.type,r.name=e.name,r.participants=e.participants.map(n=>this.teamBasicRemapper.fromResponse(n)),r}catch(r){throw console.warn("There was a problem remapping the competition response",r),r}}};var go=class{id="";country=null;gender="";assets=null;name="";competitions=[];code="";national=!1;fullName="";shortName="";squad=[]};var yo=class{id="";startDate="";endDate="";shirtNumber;loan=!1;position="";country=null;name="";assets=null;birthDate=""};var wo=class{countryRemapper=null;constructor(){this.countryRemapper=new ne}fromResponse(e){try{let r=new yo;return r.id=e.id,r.startDate=e.start_date,r.endDate=e.end_date,r.shirtNumber=e.shirt_number,r.loan=e.loan,r.position=e.position,r.country=this.countryRemapper.countryFromResponse(e.country),r.name=e.name,r.assets=e.assets,r.birthDate=e.birth_date,r}catch(r){throw console.warn("There was a problem remapping the player from squad",r),r}}};var Mo=class{countryRemapper=null;competitionRemapper=null;playerRemapper=null;constructor(){this.countryRemapper=new ne,this.competitionRemapper=new Ee,this.playerRemapper=new wo}fromResponse(e){try{let r=new go;return r.id=e.id,r.country=this.countryRemapper.countryFromResponse(e.country),r.gender=e.gender,r.assets=e.assets,r.code=e.code,r.national=e.national,r.fullName=e.full_name,r.shortName=e.short_name,r.name=e.name,r.competitions=e.competitions?e.competitions.map(n=>this.competitionRemapper.fromResponse(n)):[],r.squad=e.squad?e.squad.map(n=>this.playerRemapper.fromResponse(n)):[],r}catch(r){throw console.warn("There was a problem remapping team response",r),r}}};var bo=class{id="";kickoffAt="";finishedAt="";updatedAt="";homeTeam=null;awayTeam=null;lineupsConfirmed=!1;startedAt="";minute="";scores=null;context={competition:null};status={type:null,subType:null}};var vo=class{ftScore=null;htScore=null;aetScore=null;aggScore=null;penScore=null};var Cr=class{fromResponse(e){try{let r=new vo;return r.ftScore=this.statEntityFromResponse(e.ft_score),r.htScore=this.statEntityFromResponse(e.ht_score),r.aetScore=this.statEntityFromResponse(e.aet_score),r.aggScore=this.statEntityFromResponse(e.agg_score),r.penScore=this.statEntityFromResponse(e.pen_score),r}catch(r){throw console.warn("There was a problem remapping the scores",r),r}}statEntityFromResponse=e=>({homeGoals:e.home_goals,awayGoals:e.away_goals})};var _o=class{teamRemapper=null;competitionRemapper=null;scoresRemapper=null;constructor(){this.teamRemapper=new fe,this.competitionRemapper=new Ee,this.scoresRemapper=new Cr}fromResponse(e){try{let r=new bo;return r.id=e.id,r.kickoffAt=e.kickoff_at,r.finishedAt=e.finished_at,r.updatedAt=e.updated_at,r.homeTeam=this.teamRemapper.fromResponse(e.home_team),r.awayTeam=this.teamRemapper.fromResponse(e.away_team),r.lineupsConfirmed=e.lineups_confirmed,r.startedAt=e.started_at,r.minute=e.minute,r.scores=this.scoresRemapper.fromResponse(e.scores),r.context={competition:e.context.competition?this.competitionRemapper.fromResponse(e.context.competition):null},r.status={type:e.status.type,subType:e.status.sub_type},r}catch(r){throw console.warn("There was a problem remapping the match response",r),r}}};var Io=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 Po=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 Ro=class{fromResponse(e){try{let r=new Po;return r.corners=this.statEntityFromResponse(e.corners),r.crosses=this.statEntityFromResponse(e.crosses),r.offside=this.statEntityFromResponse(e.offside),r.shotsOn=this.statEntityFromResponse(e.shots_on),r.throwIn=this.statEntityFromResponse(e.throw_in),r.redCards=this.statEntityFromResponse(e.red_cards),r.shotsOff=this.statEntityFromResponse(e.shots_off),r.goalKicks=this.statEntityFromResponse(e.goal_kicks),r.possession=this.statEntityFromResponse(e.possession),r.treatments=this.statEntityFromResponse(e.treatments),r.yellowCards=this.statEntityFromResponse(e.yellow_cards),r.shotsBlocked=this.statEntityFromResponse(e.shots_blocked),r.substitutions=this.statEntityFromResponse(e.substitutions),r.counterAttacks=this.statEntityFromResponse(e.counter_attacks),r.foulsCommitted=this.statEntityFromResponse(e.fouls_committed),r}catch(r){throw console.warn("There was a problem remapping the stats",r),r}}statEntityFromResponse=e=>({homeTeam:e?e.home_team:null,awayTeam:e?e.away_team:null})};var xr=class{homeTeam={players:[]};awayTeam={players:[]}};var Fo=class{id="";name="";position="";shirtNumber;assets=null;type=""};var Ar=class{fromResponse(e){try{let r=new Fo;return r.id=e.id,r.name=e.name,r.position=e.position,r.shirtNumber=e.shirt_number,r.assets=e.assets,r.type=e.type,r}catch(r){throw console.warn("There was a problem remapping the player from timeline",r),r}}};var So=class{playerRemapper=null;constructor(){this.playerRemapper=new Ar}fromResponse(e){try{let r=new xr;return r.homeTeam.players=e.home_team&&e.home_team.players?e.home_team.players.map(n=>this.playerRemapper.fromResponse(n)):[],r.awayTeam.players=e.away_team&&e.away_team.players?e.away_team.players.map(n=>this.playerRemapper.fromResponse(n)):[],r}catch(r){throw console.warn("There was a problem remapping the lineups",r),r}}};var To=class{minute="";type="";teamId="";player=null;relatedPlayer=null;updatedAt=""};var Eo=class{playerRemapper=null;constructor(){this.playerRemapper=new Ar}fromResponse(e){try{let r=new To;return r.minute=e.minute,r.type=e.type,r.teamId=e.team_id,r.player=this.playerRemapper.fromResponse(e.player),r.relatedPlayer=e.related_player?this.playerRemapper.fromResponse(e.related_player):null,r.updatedAt=e.updated_at,r}catch(r){throw console.warn("There was a problem remapping timeline",r),r}}};var Co=class{teamMapper=null;competitionsMapper=null;lineupsMapper=null;scoresMapper=null;statsMapper=null;timelineMapper=null;constructor(){this.teamMapper=new fe,this.competitionsMapper=new Ee,this.lineupsMapper=new So,this.scoresMapper=new Cr,this.statsMapper=new Ro,this.timelineMapper=new Eo}fromResponse(e){try{let r=new Io;return r.id=e.id,r.kickoffAt=e.kickoff_at,r.finishedAt=e.finished_at,r.updatedAt=e.updated_at,r.homeTeam=e.home_team?this.teamMapper.fromResponse(e.home_team):null,r.awayTeam=e.away_team?this.teamMapper.fromResponse(e.away_team):null,r.lineupsConfirmed=e.lineups_confirmed,r.startedAt=e.started_at,r.minute=e.minute,r.scores=this.scoresMapper.fromResponse(e.scores),r.stats=this.statsMapper.fromResponse(e.stats),r.context={competition:this.competitionsMapper.fromResponse(e.context.competition)},r.timeline=e.timeline?e.timeline.map(n=>this.timelineMapper.fromResponse(n)):[],r.status={type:e.status.type,subType:e.status.sub_type},r.lineups=e.lineups?this.lineupsMapper.fromResponse(e.lineups):new xr,r}catch(r){throw console.warn("There was a problem remapping the match response",r),r}}};var xo=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null};var Ao=class{countryRemapper=null;constructor(){this.countryRemapper=new ne}fromResponse(e){try{let r=new xo;return r.id=e.id,r.firstName=e.first_name?e.first_name:null,r.lastName=e.last_name?e.last_name:null,r.name=e.name?e.name:null,r.birthDate=e.birth_date,r.country=this.countryRemapper.countryFromResponse(e.country),r.assets=e.assets,r.position=e.position,r}catch(r){throw console.warn("There was a problem remapping top player response",r),r}}};var Oo=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;teams=[]};var Or=class{countryRemapper=null;teamRemapper=null;constructor(){this.countryRemapper=new ne,this.teamRemapper=new fe}fromResponse(e){try{let r=new Oo;return r.id=e.id,r.firstName=e.first_name?e.first_name:null,r.lastName=e.last_name?e.last_name:null,r.name=e.name?e.name:null,r.birthDate=e.birth_date,r.country=this.countryRemapper.countryFromResponse(e.country),r.assets=e.assets,r.teams=e.teams?e.teams.map(n=>this.teamRemapper.fromResponse(n)):[],r.position=e.position,r}catch(r){throw console.warn("There was a problem remapping players response",r),r}}};var Lo=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;competitions=[];teams=[]};var Bo=class{countryRemapper=null;teamRemapper=null;competitionRemapper=null;constructor(){this.countryRemapper=new ne,this.teamRemapper=new fe,this.competitionRemapper=new Ee}fromResponse(e){try{let r=new Lo;return r.id=e.id,r.firstName=e.first_name?e.first_name:null,r.lastName=e.last_name?e.last_name:null,r.name=e.name?e.name:null,r.birthDate=e.birth_date,r.country=this.countryRemapper.countryFromResponse(e.country),r.assets=e.assets,r.teams=e.teams?e.teams.map(n=>this.teamRemapper.fromResponse(n)):[],r.position=e.position,r.competitions=e.competitions?e.competitions.map(n=>this.competitionRemapper.fromResponse(n)):[],r}catch(r){throw console.warn("There was a problem remapping player response",r),r}}};var No=class{teams=null;players=null;competitions=null};var Do=class{teamRemapper=null;playerRemapper=null;competitionremapper=null;constructor(){this.teamRemapper=new fe,this.playerRemapper=new Or,this.competitionremapper=new Ee}fromResponse(e){try{let r=new No;return r.teams=e.teams?e.teams.map(n=>this.teamRemapper.fromResponse(n)):[],r.players=e.players?e.players.map(n=>this.playerRemapper.fromResponse(n)):[],r.competitions=e.competitions?e.competitions.map(n=>this.competitionremapper.fromResponse(n)):[],r}catch(r){throw console.warn("There was a problem remapping search response",r),r}}};var Lr=class{currentPage=null;itemsPerPage=null;totalItems=null;numberOfPages=null};var Br=class{pagination=new Lr};var Nr=class{meta=new Br;data=[]};var Uo=class{remapMetaProp=e=>{let r=new Br;return r.pagination.currentPage=e.pagination.current_page,r.pagination.itemsPerPage=e.pagination.items_per_page,r.pagination.totalItems=e.pagination.total_items,r.pagination.numberOfPages=e.pagination.number_of_pages,r}};var mt=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;footballMetaRemapper=null;constructor(e){let r=ze(e.environment,"football");this.apiSignInUrl=`?key=${e.apiKey}&lang=${e.lang}&client_id=${e.clientId}`,this.idSchema=e.idSchema,this.instance=Tm.default.create({baseURL:r}),this.countryRemapper=new ne,this.competitionBasicRemapper=new Ee,this.competitionFullRemapper=new ho,this.teamBasicRemapper=new fe,this.teamFullRemapper=new Mo,this.matchBasicRemapper=new _o,this.matchFullRemapper=new Co,this.playerBasicRemapper=new Or,this.playerFullRemapper=new Bo,this.topPlayerRemapper=new Ao,this.searchRemapper=new Do,this.footballMetaRemapper=new Uo}getCountries=async e=>{try{let r=`/countries${this.apiSignInUrl}`,n=Date.now();e&&(r+=`&disable_cache=${n}`);let a=await this.instance.get(r);return this.countryRemapper.countriesFromResponse(a.data.data)}catch(r){throw console.warn("There was a problem with the football countries request",r),r}};getCompetitions=async(e,r)=>{try{let n={},a=Date.now();if(r=r||!1,e&&e.competitionIds&&e.competitionIds.length>this.limitIds-1){let u=[],f=Dn(e.competitionIds);for(let v of f){e.competitionIds=v;let T=`/competitions${this.apiSignInUrl}${e.constructFilterUrl()}`;r&&(T+=`&disable_cache=${a}`),n=await this.instance.get(T),u.push(n.data.data.map(M=>this.competitionBasicRemapper.fromResponse(M)))}return Array.prototype.concat.apply([],u)}else{let u=`/competitions${this.apiSignInUrl}`;return e&&(u+=`${e.constructFilterUrl()}`),r&&(u+=`&disable_cache=${a}`),n=await this.instance.get(u),n.data.data.map(f=>this.competitionBasicRemapper.fromResponse(f))}}catch(n){throw console.warn("There was a problem with getCompetitions request",n),n.response}};getCompetitionById=async(e,r)=>{try{let n=`/competitions/${e}${this.apiSignInUrl}`,a=Date.now();r&&(n+=`&disable_cache=${a}`);let u=await this.instance.get(n);return this.competitionFullRemapper.fromResponse(u.data.data)}catch(n){throw console.warn("There was a problem with getCompetitionById request",n),n.response}};getTopCompetitions=async e=>{try{let r=`/competitions/top${this.apiSignInUrl}`,n=Date.now();return e&&(r+=`&disable_cache=${n}`),(await this.instance.get(r)).data.data.map(u=>this.competitionBasicRemapper.fromResponse(u))}catch(r){throw console.warn("There was a problem with getTopCompetitions request",r),r.response}};getTeams=async(e,r)=>{try{let n={},a=Date.now();if(e&&e.teamIds&&e.teamIds.length>this.limitIds){let u=[],f=Dn(e.teamIds);for(let v of f){e.teamIds=v;let T=`/teams${this.apiSignInUrl}${e.constructFilterUrl()}`;r&&(T+=`disable_cache=${a}`),n=await this.instance.get(T),u.push(n.data.data.map(M=>this.teamBasicRemapper.fromResponse(M)))}return Array.prototype.concat.apply([],u)}else{let u=new Nr,f=`/teams${this.apiSignInUrl}`;return e&&(f+=`${e.constructFilterUrl()}`),r&&(f+=`&disable_cache=${a}`),n=await this.instance.get(f),u.meta=this.footballMetaRemapper.remapMetaProp(n.data.meta),u.data=n.data.data.map(g=>this.teamBasicRemapper.fromResponse(g)),u}}catch(n){throw console.warn("There was a problem with getTeams request",n),n.response}};getTeamById=async(e,r)=>{try{let n=`/teams/${e}${this.apiSignInUrl}`,a=Date.now();r&&(n+=`disable_cache=${a}`);let u=await this.instance.get(n);return this.teamFullRemapper.fromResponse(u.data.data)}catch(n){throw console.warn("There was a problem with getTeamById request",n),n.response}};getTopTeams=async e=>{try{let r=`/teams/top${this.apiSignInUrl}`,n=Date.now();e&&(r+=`$disable_cache=${n}`);let a=await this.instance.get(r);return a.data.data?a.data.data.map(u=>this.teamBasicRemapper.fromResponse(u)):[]}catch(r){throw console.warn("There was a problem with getTopTeams request",r),r.response}};getNextMatchForTeam=async(e,r)=>{try{let n=`/teams/${e}/next-match${this.apiSignInUrl}`,a=Date.now();r&&(n+=`&disable_cache=${a}`);let u=await this.instance.get(n);return this.matchFullRemapper.fromResponse(u.data.data)}catch(n){throw console.warn("There was a problem with getNextMatchForTeam request",n),n.response}};getPrevMatchForTeam=async(e,r)=>{try{let n=`/teams/${e}/previous-match${this.apiSignInUrl}`,a=Date.now();r&&(n+=`disable_cache=${a}`);let u=await this.instance.get(n);return this.matchFullRemapper.fromResponse(u.data.data)}catch(n){throw console.warn("There was a problem with getPrevMatchForTeam request",n),n.response}};getPlayers=async(e,r)=>{try{let n={},a=Date.now();if(e&&e.playerIds&&e.playerIds.length>this.limitIds-1){let u=[],f=Dn(e.playerIds);for(let v of f){e.playerIds=v;let T=`/players${this.apiSignInUrl}${e.constructFilterUrl()}`;r&&(T+=`&disable_cache=${a}`),n=await this.instance.get(T),u.push(n.data.data.map(M=>this.teamBasicRemapper.fromResponse(M)))}return Array.prototype.concat.apply([],u)}else{let u=new Nr,f=`/players${this.apiSignInUrl}`;return e&&(f+=`${e.constructFilterUrl()}`),r&&(f+=`&disable_cache=${a}`),n=await this.instance.get(f),u.meta=this.footballMetaRemapper.remapMetaProp(n.data.meta),u.data=n.data.data.map(g=>this.playerBasicRemapper.fromResponse(g)),u}}catch(n){throw console.warn("There was a problem with getPlayers request",n),n.response}};getPlayerById=async(e,r)=>{try{let n=`/players/${e}${this.apiSignInUrl}`,a=Date.now();r&&(n+=`&disable_cache=${a}`);let u=await this.instance.get(n);return this.playerFullRemapper.fromResponse(u.data.data)}catch(n){throw console.warn("There was a problem with getPlayerById request",n),n.response}};getTopPlayers=async e=>{try{let r=`/players/top${this.apiSignInUrl}`,n=Date.now();return e&&(r+=`&disable_cache=${n}`),(await this.instance.get(r)).data.data.map(u=>this.topPlayerRemapper.fromResponse(u))}catch(r){throw console.warn("There was a problem with getTopPlayers request",r),r.response}};getNextMatchForPlayer=async(e,r)=>{try{let n=`/players/${e}/next-match${this.apiSignInUrl}`,a=Date.now();r&&(n+=`&disable_cache=${a}`);let u=await this.instance.get(n);return this.matchFullRemapper.fromResponse(u.data.data)}catch(n){throw console.warn("There was a problem with getNextMatchForPlayer request",n),n.response}};getPrevMatchForPlayer=async(e,r)=>{try{let n=`/players/${e}/previous-match${this.apiSignInUrl}`,a=Date.now();r&&(n+=`&disable_cache=${a}`);let u=await this.instance.get(n);return this.matchFullRemapper.fromResponse(u.data.data)}catch(n){throw console.warn("There was a problem with getPrevMatchForPlayer request",n),n.response}};getMatchById=async(e,r)=>{try{let n=`/matches/${e}${this.apiSignInUrl}`,a=Date.now();r&&(n+=`&disable_cache=${a}`);let u=await this.instance.get(n);return this.matchFullRemapper.fromResponse(u.data.data)}catch(n){throw console.warn("There was a problem with getMatchById request",n),n.response}};getMatches=async(e,r)=>{try{let n=new Nr,a=`/matches${this.apiSignInUrl}`,u=Date.now();e&&(a+=`${e.constructFilterUrl()}`),r&&(a+=`&disable_cache=${u}`);let f=await this.instance.get(a);return n.meta=this.footballMetaRemapper.remapMetaProp(f.data.meta),n.data=f.data.data.map(g=>this.matchBasicRemapper.fromResponse(g)),n}catch(n){throw console.warn("There was a problem with getMatches request",n),n.response}};search=async(e,r)=>{try{let n=`/search${this.apiSignInUrl}${e.constructFilterUrl()}`,a=Date.now();r&&(n+=`&disable_cache=${a}`);let u=await this.instance.get(n);return this.searchRemapper.fromResponse(u.data.data)}catch(n){throw console.warn("There was a problem with search request",n),n.response}}};var Dr=class{profileHttps=null;footballHttps=null;footballFacade=null;idMapping=null;localStorage=null;profileFacade=null;ownProfileBuilder=null;profileBuilder=null;constructor(e){this.profileHttps=new Kn(e),this.footballHttps=new mt(e),this.idMapping=new Te(e),this.localStorage=new Gt(e),this.footballFacade=new qt(this.localStorage,this.footballHttps,this.idMapping),this.profileFacade=new $t(this.localStorage,this.profileHttps),this.ownProfileBuilder=new lo(this.localStorage,this.profileHttps,this.idMapping,this.footballHttps),this.profileBuilder=new po(this.localStorage,this.profileHttps,this.idMapping,this.footballFacade)}getOwn=()=>this.ownProfileBuilder;getById=e=>this.profileBuilder.setId(e);getCountries=async e=>await this.profileFacade.getCountries(e);getByIds=async(e,r)=>await this.profileFacade.getByIds(e,r)};var Go=class{validate=e=>{let r=this.validateField(e.lang),n=this.generateMessage(r);return{validation:r,message:n}};validateField=e=>{let r=["bg","ro","en"],n=null;return e!=null&&e.length>0?r.includes(e)?n="valid":n="invalid":n="missing",n};generateMessage=e=>{let r=null,n="warning";return e==="missing"&&(r="If no lang is passed the default one will be set which is: EN"),e==="invalid"&&(r="This lang value is not supported, the default one will be set which is: EN"),e==="valid"&&(r=null,n=null),{text:r,type:n}}};var $o=class{validate(e){let r=this.validateField(e.environment),n=this.generateMessage(r);return{validation:r,message:n}}validateField=e=>{let r=["dev","sandbox","prod"],n=null;return e!=null&&e.length>0?r.includes(e)?n="valid":n="invalid":n="missing",n};generateMessage=e=>{let r=null,n="warning";return e==="missing"&&(r="If no environment is passed the default one will be set which is: prod"),e==="invalid"&&(r="This environment value is not supported, the default one will be set which is: prod"),e==="valid"&&(r=null,n=null),{text:r,type:n}}};var Ho=class{validate(e){let r=this.validateField(e.apiKey),n=this.generateMessage(r);return{validation:r,message:n}}validateField=e=>{let r=null;return e!=null&&e.length>0?r="valid":r="missing",r};generateMessage=e=>{let r=null,n="error";return e==="missing"&&(r="The field apiKey with valid value must be provided to use this SDK"),e==="valid"&&(n=null),{text:r,type:n}}};var Vo=class{validate(e){let r=this.validateField(e.idSchema),n=this.generateMessage(r);return{validation:r,message:n}}validateField=e=>{let r=["native","sportal365","enetpulse","sportradar"],n=null;return e!=null&&e.length>0?r.includes(e)?n="valid":n="invalid":n="missing",n};generateMessage=e=>{let r=null,n="warning";return e==="missing"&&(r="If no idSchema is passed the default one will be set which is: native"),e==="invalid"&&(r="This idSchema value is not supported, the default one will be set which is: native"),e==="valid"&&(r=null,n=null),{text:r,type:n}}};var Ci=class{getIdToken=null;logout=null};var $r=class{text=null;type=null};var qo=class{validation=null;message=new $r;getIdToken={validation:null,message:new $r};logout={validation:null,message:new $r}};var ko=class{validate(e){let r=this.validateAuthProvider(e.authProvider);return r.validation!=="missing"&&(r=this.validateAuthProviderConfigFields(e.authProvider,r),r=this.generateAuthProviderConfigMessages(r),r=this.checkAuthProviderConfigMessagesForErrors(r)),r}validateAuthProvider=e=>{let r=Object.keys(new Ci),n=new qo;if(e){let u=Object.keys(e).filter(f=>!r.includes(f));u.length>0?(n.validation="invalid",n.message.type="warning",n.message.text=`${"You have passed a property which is not supported for the authentication provider:"} ${u.join(",")}`):n.validation="valid"}else n.validation="missing",n.message.type="error",n.message.text="The field authProvider must be provided to use this SDK";return n};validateAuthProviderConfigFields=(e,r)=>(Object.keys(new Ci).forEach(a=>{e[a]?r[a].validation="valid":r[a].validation="missing"}),r);generateAuthProviderConfigMessages=e=>(Object.keys(e).filter(r=>r!=="validation"&&r!=="message").forEach(r=>{let n=e[r];n.validation==="missing"&&(n.message.text=`${"The following property is missing from the authProvider object:"} ${r}`,n.message.type="error")}),e);checkAuthProviderConfigMessagesForErrors=e=>(Object.keys(e).filter(r=>r!=="validation"&&r!=="message").forEach(r=>{e[r].validation==="missing"&&e.validation==="valid"&&(e.validation="invalid",e.message.type="error",e.message.text="The field authProvider has missing properties")}),e)};var xi=class{validation;message};var Wo=class{apiKey=null;environment=null;idSchema=null;clientId=null;lang=null;authProvider={getIdToken:new xi,logout:new xi};isValid=!1};var Ko=class{validate(e){let r=this.validateField(e.clientId),n=this.generateMessage(r);return{validation:r,message:n}}validateField=e=>{let r=null;return e!=null&&e.length>0?r="valid":r="missing",r};generateMessage=e=>{let r=null,n="warning";return e==="missing"&&(r="The field clientId must be provided to use this SDK"),e==="valid"&&(r=null,n=null),{text:r,type:n}}};var Xo=class{validate=e=>{let r=this.checkFieldsForValues(e);return r.isValid=this.containsErrorMessage(r),r};checkFieldsForValues=e=>{let r=new Wo,n={apiKey:new Ho,environment:new $o,idSchema:new Vo,clientId:new Ko,lang:new Go,authProvider:new ko};for(let[a,u]of Object.entries(r))a!=="isValid"&&(u=n[a].validate(e));return Object.keys(n).forEach(a=>{r[a]=n[a].validate(e)}),r};containsErrorMessage=e=>{let r=!0;for(let[n,a]of Object.entries(e))if(n!=="authProvider"){if(n!=="isValid"&&a.message.type==="error")return r=!1,r;if(n!=="isValid"&&a.message.type==="warning")return r=!0,r}return r}};var Yo=class{https=null;idMapping=null;localStorage=null;footballFacade=null;constructor(e){this.https=new mt(e),this.idMapping=new Te(e),this.localStorage=new Gt(e),this.footballFacade=new qt(this.localStorage,this.https,this.idMapping)}getCountries=async e=>await this.footballFacade.getCountries(e);getCompetitions=async(e,r)=>await this.footballFacade.getCompetitions(e,r);getCompetitionById=async(e,r)=>await this.footballFacade.getCompetitionById(e,r);getTopCompetitions=async e=>await this.footballFacade.getTopCompetitions(e);getTeams=async(e,r)=>await this.footballFacade.getTeams(e,r);getTeamById=async(e,r)=>await this.footballFacade.getTeamById(e,r);getTopTeams=async e=>await this.footballFacade.getTopTeams(e);getNextMatchForTeam=async(e,r)=>await this.footballFacade.getNextMatchForTeam(e,r);getPrevMatchForTeam=async(e,r)=>await this.footballFacade.getPrevMatchForTeam(e,r);getPlayers=async(e,r)=>await this.footballFacade.getPlayers(e,r);getPlayerById=async(e,r)=>await this.footballFacade.getPlayerById(e,r);getTopPlayers=async e=>await this.footballFacade.getTopPlayers(e);getNextMatchForPlayer=async(e,r)=>await this.footballFacade.getNextMatchForPlayer(e,r);getPrevMatchForPlayer=async(e,r)=>await this.footballFacade.getPrevMatchForPlayer(e,r);getMatches=async(e,r)=>await this.footballFacade.getMatches(e,r);getMatchById=async(e,r)=>await this.footballFacade.getMatchById(e,r);search=async(e,r)=>await this.footballFacade.search(e,r)};var Ul=rr(nr());var zo=class{value=null;playerId=null;playerModel=null};var Hr=class{market=null;matchId=null;matchType=null;matchModel=null;prediction=new zo;result=null};var Qo=class{value=!1;playerId=null};var nt=class{matchId=null;market=null;prediction=null;constructor(e,r,n,a){this.matchId=e,this.market=r,this.prediction=new Qo,this.prediction.value=n,this.prediction.playerId=a}};var Vr=class{settledAt=null;resettledAt=null;status=null;outcome=null};var Ue=(q=>(q.FT_1X2="FT_1X2",q.HT_1X2="HT_1X2",q.BOTH_TEAMS_SCORE="BOTH_TEAMS_SCORE",q.DOUBLE_CHANCE="DOUBLE_CHANCE",q.HT_FT="HT_FT",q.PLAYER_SCORE="PLAYER_SCORE",q.PLAYER_YELLOW_CARD="PLAYER_YELLOW_CARD",q.PLAYER_RED_CARD="PLAYER_RED_CARD",q.RED_CARD_MATCH="RED_CARD_MATCH",q.PENALTY_MATCH="PENALTY_MATCH",q.PLAYER_SCORE_FIRST_GOAL="PLAYER_SCORE_FIRST_GOAL",q.CORNERS_MATCH="CORNERS_MATCH",q.CORRECT_SCORE="CORRECT_SCORE",q.PLAYER_SCORE_HATTRICK="PLAYER_SCORE_HATTRICK",q.PLAYER_SCORE_TWICE="PLAYER_SCORE_TWICE",q.OVER_GOALS_0_5="OVER_GOALS_0.5",q.OVER_GOALS_1_5="OVER_GOALS_1.5",q.OVER_GOALS_2_5="OVER_GOALS_2.5",q.OVER_GOALS_3_5="OVER_GOALS_3.5",q.OVER_GOALS_4_5="OVER_GOALS_4.5",q.OVER_GOALS_5_5="OVER_GOALS_5.5",q.OVER_GOALS_6_5="OVER_GOALS_6.5",q.OVER_CORNERS_6_5="OVER_CORNERS_6.5",q.OVER_CORNERS_7_5="OVER_CORNERS_7.5",q.OVER_CORNERS_8_5="OVER_CORNERS_8.5",q.OVER_CORNERS_9_5="OVER_CORNERS_9.5",q.OVER_CORNERS_10_5="OVER_CORNERS_10.5",q.OVER_CORNERS_11_5="OVER_CORNERS_11.5",q.OVER_CORNERS_12_5="OVER_CORNERS_12.5",q.OVER_CORNERS_13_5="OVER_CORNERS_13.5",q))(Ue||{}),Em=["OVER_GOALS_0.5","OVER_GOALS_1.5","OVER_GOALS_2.5","OVER_GOALS_3.5","OVER_GOALS_4.5","OVER_GOALS_5.5","OVER_GOALS_6.5"],Cm=["OVER_CORNERS_6.5","OVER_CORNERS_7.5","OVER_CORNERS_8.5","OVER_CORNERS_9.5","OVER_CORNERS_10.5","OVER_CORNERS_11.5","OVER_CORNERS_12.5","OVER_CORNERS_13.5"],Ll=["PLAYER_RED_CARD","PLAYER_SCORE","PLAYER_SCORE_FIRST_GOAL","PLAYER_SCORE_HATTRICK","PLAYER_SCORE_TWICE","PLAYER_YELLOW_CARD"];var Jo=class{value=null};var kt=class{matchId=null;market="CORRECT_SCORE";prediction=null;constructor(e,r){this.matchId=e,this.prediction=new Jo,this.prediction.value=r}};var Je=class{value=!1};var qr=class{matchId=null;market=null;prediction=null;constructor(e,r,n){this.matchId=e,this.market=r,this.prediction=new Je,this.prediction.value=n}};var kr=class{matchId=null;market=null;prediction=null;constructor(e,r,n){this.matchId=e,this.market=r,this.prediction=new Je,this.prediction.value=n}};var Zo=class{matchFacade=null;playerFacade=null;predictorService=null;constructor(e,r,n){this.matchFacade=e,this.playerFacade=r,this.predictorService=n}remapFixturesRequest=e=>{let r={};if(r.match_id=e.matchId,r.match_type="FOOTBALL",e instanceof nt)r.market=e.market,r.prediction=e.prediction.value,r.player_id=e.prediction.playerId;else if(e instanceof qr||e instanceof kr){let n=e.market.split("_");r.market=n[0]+"_"+n[1],r.prediction=e.prediction.value,r.target=Number(n[2])}else if(e instanceof kt){r.market=e.market;let n=e.prediction.value.split(":");r.goals_home=Number(n[0]),r.goals_away=Number(n[1])}else r.market=e.market,r.prediction=e.prediction.value;return r};remapFixturesResponse=async e=>{e.length>1&&e.sort((g,v)=>g.match_id.localeCompare(v.match_id));let r=[],n=[];for(let g of e)r.push(g.match_id),g.player_id&&!n.includes(g.player_id)&&n.push(g.player_id);let a=await this.matchFacade.getMatchesMapWithNativeIds(r),u=[];n.sort((g,v)=>g.localeCompare(v)),n&&n.length>0&&(u=await this.playerFacade.getPlayersMapWithNativeIds(n));let f=[];for(let g of e){let v=new Hr;g.target?v.market=this.predictorService.convertMarketForResponseModel(g.market,g.target):v.market=g.market,v.matchId=a[g.match_id].id,v.matchType=g.match_type,v.matchModel=a?a[g.match_id]:null,g.goals_home!==void 0&&g.goals_away!==void 0?v.prediction.value=g.goals_home.toString()+":"+g.goals_away.toString():v.prediction.value=g.prediction,v.prediction.playerId=g.player_id?g.player_id:null,v.prediction.playerId&&(v.prediction.playerModel=u[g.player_id],v.prediction.playerId=u[g.player_id].id),v.result=this.remapResult(g.result),f.push(v)}return f};remapResult=e=>{let r=new Vr;return r.settledAt=e.settled_at,r.resettledAt=e.resettled_at,r.status=e.status,r.outcome=e.outcome,r}};var Wr=class{goldenGoal=null};var Ai=class{id=null;gameInstanceId=null;gameType=null;wager=null;totalFixtures=null;settledFixtures=null;userId=null;fixtures=[];status=null;tiebreaker=new Wr;points=null;createdAt=null;updatedAt=null};var N=class{no=0;yes=0};var Kr=class{fullTimeOneXTwo={};halfTimeOneXTwo={};bothTeamsScore=new N;doubleChance={};halfTimeFullTime={};playerScore={};playerYellowCard={};playerRedCard={};redCardMatch=new N;penaltyMatch=new N;playerScoreFirstGoal={};cornersMatch={};correctScore={};playerScoreHattrick={};playerScoreTwice={};overZeroPointFiveGoals=new N;overOnePointFiveGoals=new N;overTwoPointFiveGoals=new N;overThreePointFiveGoals=new N;overFourPointFiveGoals=new N;overFivePointFiveGoals=new N;overSixPointFiveGoals=new N;overSixPointFiveCorners=new N;overSevenPointFiveCorners=new N;overEightPointFiveCorners=new N;overNinePointFiveCorners=new N;overTenPointFiveCorners=new N;overElevenPointFiveCorners=new N;overTwelvePointFiveCorners=new N;overThirteenPointFiveCorners=new N};var Bl=(n=>(n.ONE="1",n.X="x",n.TWO="2",n))(Bl||{}),Nl=(n=>(n.ONE_X="1x",n.X_TWO="x2",n.ONE_TWO="12",n))(Nl||{}),Dl=(T=>(T.ONE_ONE="1/1",T.ONE_X="1/x",T.ONE_TWO="1/2",T.X_ONE="x/1",T.X_X="x/x",T.X_TWO="x/2",T.TWO_ONE="2/1",T.TWO_X="2/x",T.TWO_TWO="2/2",T))(Dl||{});var jo=class{value=null};var ea=class{matchId=null;market="HT_FT";prediction=null;constructor(e,r){this.matchId=e,this.prediction=new jo,this.prediction.value=r}};var ta=class{value=null};var ra=class{matchId=null;market="DOUBLE_CHANCE";prediction=null;constructor(e,r){this.matchId=e,this.prediction=new ta,this.prediction.value=r}};var Xr=class{value=null};var ia=class{matchId=null;market="FT_1X2";prediction=null;constructor(e,r){this.matchId=e,this.prediction=new Xr,this.prediction.value=r}};var na=class{matchId=null;market="HT_1X2";prediction=null;constructor(e,r){this.matchId=e,this.prediction=new Xr,this.prediction.value=r}};var oa=class{value};var aa=class{matchId=null;market="CORNERS_MATCH";prediction=null;constructor(e,r){this.matchId=e,this.prediction=new oa,this.prediction.value=r}};var sa=class{matchId=null;market="BOTH_TEAMS_SCORE";prediction=null;constructor(e,r){this.matchId=e,this.prediction=new Je,this.prediction.value=r}};var la=class{matchId=null;market="RED_CARD_MATCH";prediction=null;constructor(e,r){this.matchId=e,this.prediction=new Je,this.prediction.value=r}};var pa=class{matchId=null;market="PENALTY_MATCH";prediction=null;constructor(e,r){this.matchId=e,this.prediction=new Je,this.prediction.value=r}};var or=class{id=null;title=null;description=null;type=null;status=null;predictionsCutoff=null;fixtures=[];createdAt=null;updatedAt=null};var ar=class{userId=null;points=null;results=[];tiebreaker=null};var ua=(u=>(u.ACTIVE="ACTIVE",u.WON="WON",u.LOST="LOST",u.PARTIALLY_WON="PARTIALLY_WON",u.CANCELED="CANCELED",u))(ua||{}),Oi=["WON","LOST","PARTIALLY_WON","CANCELED"];var Me=class{limit=null;startAfter=null;status=null;type=null;constructor(e){this.limit=e.limit?e.limit:null,this.startAfter=e.startAfter?e.startAfter:null,this.status=e.status?e.status:null,this.type=e.type?e.type:null}constructFiltersUrl=()=>{let e="",r=!1;return this.status&&(r=Object.values(ua).some(n=>this.status.includes(n))),this.limit&&(e+="&",e+=`limit=${this.limit}`),this.startAfter&&(e+="&",e+=`start_after=${this.startAfter}`),this.status&&r&&(e+="&",e+=`status=${this.status.join(",")}`),this.type&&(e+="&",e+=`game_types=${this.type}`),e}};var Li=(f=>(f.OPEN="OPEN",f.LIVE="LIVE",f.PENDING="PENDING",f.CANCELED="CANCELED",f.CLOSED="CLOSED",f.SETTLED="SETTLED",f))(Li||{});var Ge=class{limit=null;startAfter=null;status=null;type=null;gameIds=null;constructor(e){this.limit=e.limit?e.limit:null,this.startAfter=e.startAfter?e.startAfter:null,this.status=e.status?e.status:null,this.type=e.type?e.type:null,this.gameIds=e.gameIds?e.gameIds:null}constructFiltersUrl=()=>{let e="";return this.limit&&(e+="&",e+=`limit=${this.limit}`),this.startAfter&&(e+="&",e+=`start_after=${this.startAfter}`),this.status&&Object.values(Li).includes(this.status)&&(e+="&",e+=`status=${this.status}`),this.type&&(e+="&",e+=`type=${this.type}`),this.gameIds&&this.gameIds.length>0&&(e+="&",e+=`game_ids=${this.gameIds.join(",")}`),e}};var sr=class{id=null;title=null;description=null;type=null;status=null;predictionsCutoff=null;fixtures=[];createdAt=null;updatedAt=null};var Ft=class{id=null;title=null;description=null;type=null;status=null;predictionsCutoff=null;fixtures=[];createdAt=null;updatedAt=null};var dt=class{footballHttps=null;idMapping=null;matchFacade=null;playerFacade=null;constructor(e,r){this.footballHttps=new mt(e),this.idMapping=r,this.matchFacade=new Vt(this.footballHttps,r),this.playerFacade=new Ht(this.footballHttps,r)}remapMatchIdToNative=async e=>{let r=await this.idMapping.getEntityIdsBySchemaId(e,"match","native"),n=[];return r.match.forEach(a=>n.push(a)),n};remapPlayerIdToNative=async e=>(await this.idMapping.getEntityIdsBySchemaId(e,"player","native")).player[0];remapPlayerIdMapToNative=async e=>{let r={},n=Ut(e),u=(await this.idMapping.getEntityIdsBySchemaId(n,"player","native")).player;return n.forEach((f,g)=>r[f]=u[g]),r};remapPlayerIdToIdSchema=async e=>{let r=["playerScore","playerYellowCard","playerRedCard","playerScoreFirstGoal","playerScoreHattrick","playerScoreTwice"];for(let[n,a]of Object.entries(e))if(r.includes(n))for(let u of Object.keys(a)){let f={player:[u]},v=(await this.idMapping.idMappingFacade.getEntitiesByIds(f,"native",this.idMapping.idSchema)).player[0];a[v]=a[u],delete a[u]}return e};convertMarket=e=>{let r=Object.keys(new Kr),n=Object.values(Ue);for(let a=0;a<n.length;a++)e===n[a]&&(e=r[a]);return e};convertMarketForResponseModel=(e,r)=>{let n=r.toString();return e+"_"+n};validateFixture=(e,r,n,a)=>{let u=Object.values(Bl),f=Object.values(Dl),g=Object.values(Nl);if(r==="FT_1X2"){if(u.includes(n))return new ia(e,n)}else if(r==="HT_1X2"){if(u.includes(n))return new na(e,n)}else if(r==="HT_FT"){if(f.includes(n))return new ea(e,n)}else if(r==="DOUBLE_CHANCE"){if(g.includes(n))return new ra(e,n)}else if(r==="CORRECT_SCORE"){if(typeof n=="string"&&/\d+:\d+/.test(n))return new kt(e,n)}else if(r==="CORNERS_MATCH"){if(typeof n=="number")return new aa(e,n)}else if(r==="BOTH_TEAMS_SCORE"){if(typeof n=="boolean")return new sa(e,n)}else if(r==="RED_CARD_MATCH"){if(typeof n=="boolean")return new la(e,n)}else if(r==="PENALTY_MATCH"){if(typeof n=="boolean")return new pa(e,n)}else if(Ll.includes(r)){if(a&&typeof n=="boolean")return new nt(e,r,n,a)}else if(Em.includes(r)){if(typeof n=="boolean")return new kr(e,r,n)}else if(Cm.includes(r)&&typeof n=="boolean")return new qr(e,r,n)};getMarketSummary=(e,r,n)=>{let a=this.convertMarket(r),u={};if(u.matchId=e.matchId,u.matchType=e.matchType,Object.keys(e.predictions).includes(a))u[a]=e.predictions[a];else throw new Error("You have passed invalid market");return Ll.includes(r)&&n?(u[a][n]||(u[a][n]=new N),u[a][n]):u};remapCompetitionsFromConfig=async e=>{let r={competition:e.fullCoverageCompetitions},n=await this.idMapping.idMappingFacade.getEntitiesByIds(r,"native",this.idMapping.idSchema);return e.fullCoverageCompetitions=n.competition,e};remapMatchIdsFixtures=async e=>{if(Array.isArray(e.data))if(e.data.length>0){let r=[],n=[];return e.data.forEach(a=>{a instanceof sr||a instanceof or||a instanceof Ft?(a.fixtures.forEach(u=>r.push(u.matchId)),a instanceof Ft&&a.fixtures.forEach(u=>{u.prediction.playerId&&n.push(u.prediction.playerId)})):a instanceof ar&&a.results.forEach(u=>r.push(u.matchId))}),await this.refactorResponseArrModel(e,r,n)}else return e;else return await this.refactorResponseObjModel(e)};refactorResponseArrModel=async(e,r,n)=>{let a=[],u=await this.matchFacade.getMatchesMapWithNativeIds(r),f={};return n.length>0&&(f=await this.playerFacade.getPlayersMapWithNativeIds(n)),e.data.forEach(g=>{g instanceof sr||g instanceof or||g instanceof Ft?(g.fixtures.forEach(v=>{v.matchModel=u[v.matchId],v.matchId=v.matchModel.id,g instanceof Ft&&v.prediction.playerId&&(v.prediction.playerModel=f[v.prediction.playerId],v.prediction.playerId=f[v.prediction.playerId].id)}),a.push(g)):g instanceof ar&&(g.results.forEach(v=>{v.matchModel=u[v.matchId],v.matchId=v.matchModel.id}),a.push(g))}),e.data=a,e};refactorResponseObjModel=async e=>{let r=[];e.fixtures.forEach(a=>r.push(a.matchId));let n=await this.matchFacade.getMatchesMapWithNativeIds(r);return e.fixtures.forEach(a=>{a.matchModel=n[a.matchId],a.matchId=n[a.matchId].id}),e};getCurrentGameId=e=>{let r=new Date;if(e.data.length>1){let n=[];return e.data.forEach(u=>n.push(u.predictionsCutoff)),e.data.sort((u,f)=>{let[g,v]=[u.predictionsCutoff,f.predictionsCutoff].map(T=>Math.abs(new Date(T)-r));return g-v})[0].id}else return e.data[0].id};initGameTypePredictions=e=>{let r={type:e};return r=new Me(r),r};initGameFilters=(e,r,n)=>{if(r&&n)return r.type=e,r.gameIds=n,r=new Ge(r),r;if(r&&!n)return r.type=e,r=new Ge(r),r;if(!r&&n){let a={type:e,gameIds:n};return a=new Ge(a),a}else{let a={type:e};return a=new Ge(a),a}};addPredictionProp=async(e,r)=>(r.data.forEach((n,a)=>{n.id===e[a].game_instance_id&&n.fixtures.forEach((u,f)=>{e[a].fixtures[f].goals_home!==void 0&&e[a].fixtures[f].goals_away!==void 0?u.prediction.value=e[a].fixtures[f].goals_home+":"+e[a].fixtures[f].goals_away:u.prediction.value=e[a].fixtures[f].prediction,e[a].fixtures[f].player_id?u.prediction.playerId=e[a].fixtures[f].player_id:e[a].fixtures[f].target&&(u.prediction.target=e[a].fixtures[f].target),u.prediction.result=this.remapResult(e[a].fixtures[f].result)})}),await this.remapMatchIdsFixtures(r));remapResult=e=>{let r=new Vr;return r.settledAt=e.settled_at,r.resettledAt=e.resettled_at,r.status=e.status,r.outcome=e.outcome,r}};var Yr=class{gameInstanceId=null;fixtures=[];tiebreaker=null;constructor(e){this.gameInstanceId=e.gameInstanceId,e.fixtures.forEach(r=>this.fixtures.push(new kt(r.matchId,r.prediction.value))),this.tiebreaker=e.tiebreaker?e.tiebreaker:null}};var zr=class{fixturesRemapper=null;footballHttps=null;matchFacade=null;playerFacade=null;predictorService=null;constructor(e,r){this.footballHttps=new mt(e),this.matchFacade=new Vt(this.footballHttps,r),this.playerFacade=new Ht(this.footballHttps,r),this.predictorService=new dt(e,r),this.fixturesRemapper=new Zo(this.matchFacade,this.playerFacade,this.predictorService)}remapRequestBody=e=>{let r={};return r.game_instance_id=e.gameInstanceId,r.fixtures=e.fixtures.map(n=>this.fixturesRemapper.remapFixturesRequest(n)),e instanceof Yr&&e.tiebreaker&&(r.tiebreaker={},r.tiebreaker.golden_goal=e.tiebreaker.goldenGoal?e.tiebreaker.goldenGoal:null),r};remapResponseArrayBody=async e=>{let r=[],n=[],a={},u=[];e.forEach(g=>{g.fixtures.forEach(v=>{r.push(v.match_id),v.player_id&&n.push(v.player_id)})});let f=await this.matchFacade.getMatchesMapWithNativeIds(r);return n.length>0&&(a=await this.playerFacade.getPlayersMapWithNativeIds(n)),e.forEach(g=>{let v=new Ai,T=[];v.id=g.id,v.gameInstanceId=g.game_instance_id,v.gameType=g.game_type,v.wager=g.wager,v.totalFixtures=g.total_fixtures,v.settledFixtures=g.settled_fixtures,v.userId=g.user_id,g.fixtures.forEach(M=>{let F=new Hr;M.target?F.market=this.predictorService.convertMarketForResponseModel(M.market,M.target):F.market=M.market,F.matchId=f[M.match_id].id,F.matchType=M.match_type,F.matchModel=f[M.match_id],M.goals_home!==void 0&&M.goals_away!==void 0?F.prediction.value=M.goals_home.toString()+":"+M.goals_away.toString():F.prediction.value=M.prediction,F.prediction.playerId=M.player_id?M.player_id:null,F.prediction.playerId&&(F.prediction.playerModel=a[F.prediction.playerId],F.prediction.playerId=a[F.prediction.playerId].id),F.result=this.fixturesRemapper.remapResult(M.result),T.push(F)}),v.fixtures=T,v.status=g.status,g.tiebreaker?v.tiebreaker.goldenGoal=g.tiebreaker.golden_goal:v.tiebreaker=null,v.points=g.points,v.createdAt=g.created_at,v.updatedAt=g.updated_at,u.push(v)}),u};remapResponseObjBody=async e=>{let r=new Ai;return r.id=e.id,r.gameInstanceId=e.game_instance_id,r.gameType=e.game_type,r.wager=e.wager,r.totalFixtures=e.total_fixtures,r.settledFixtures=e.settled_fixtures,r.userId=e.user_id,r.fixtures=await this.fixturesRemapper.remapFixturesResponse(e.fixtures),r.status=e.status,e.tiebreaker?r.tiebreaker.goldenGoal=e.tiebreaker.golden_goal:r.tiebreaker=null,r.points=e.points,r.createdAt=e.created_at,r.updatedAt=e.updated_at,r};remapPredictionModel=e=>{let r=new Kr;return r.fullTimeOneXTwo=e.FT_1X2,r.halfTimeOneXTwo=e.HT_1X2,r.bothTeamsScore=e.BOTH_TEAMS_SCORE?e.BOTH_TEAMS_SCORE:new N,r.overZeroPointFiveGoals=e.OVER_GOALS["over:0.5"]?e.OVER_GOALS["over:0.5"]:new N,r.overOnePointFiveGoals=e.OVER_GOALS["over:1.5"]?e.OVER_GOALS["over:1.5"]:new N,r.overTwoPointFiveGoals=e.OVER_GOALS["over:2.5"]?e.OVER_GOALS["over:2.5"]:new N,r.overThreePointFiveGoals=e.OVER_GOALS["over:3.5"]?e.OVER_GOALS["over:3.5"]:new N,r.overFourPointFiveGoals=e.OVER_GOALS["over:4.5"]?e.OVER_GOALS["over:4.5"]:new N,r.overFivePointFiveGoals=e.OVER_GOALS["over:5.5"]?e.OVER_GOALS["over:5.5"]:new N,r.overSixPointFiveGoals=e.OVER_GOALS["over:6.5"]?e.OVER_GOALS["over:6.5"]:new N,r.overSixPointFiveCorners=e.OVER_CORNERS["over:6.5"]?e.OVER_CORNERS["over:6.5"]:new N,r.overSevenPointFiveCorners=e.OVER_CORNERS["over:7.5"]?e.OVER_CORNERS["over:7.5"]:new N,r.overEightPointFiveCorners=e.OVER_CORNERS["over:8.5"]?e.OVER_CORNERS["over:8.5"]:new N,r.overNinePointFiveCorners=e.OVER_CORNERS["over:9.5"]?e.OVER_CORNERS["over:9.5"]:new N,r.overTenPointFiveCorners=e.OVER_CORNERS["over:10.5"]?e.OVER_CORNERS["over:10.5"]:new N,r.overElevenPointFiveCorners=e.OVER_CORNERS["over:11.5"]?e.OVER_CORNERS["over:11.5"]:new N,r.overTwelvePointFiveCorners=e.OVER_CORNERS["over:12.5"]?e.OVER_CORNERS["over:12.5"]:new N,r.overThirteenPointFiveCorners=e.OVER_CORNERS["over:13.5"]?e.OVER_CORNERS["over:13.5"]:new N,r.doubleChance=e.DOUBLE_CHANCE,r.halfTimeFullTime=e.HT_FT,r.playerScore=e.PLAYER_SCORE,r.playerYellowCard=e.PLAYER_YELLOW_CARD,r.playerRedCard=e.PLAYER_RED_CARD,r.redCardMatch=e.RED_CARD_MATCH?e.RED_CARD_MATCH:new N,r.penaltyMatch=e.PENALTY_MATCH?e.PENALTY_MATCH:new N,r.playerScoreFirstGoal=e.PLAYER_SCORE_FIRST_GOAL,r.cornersMatch=e.CORNERS_MATCH,r.correctScore=e.CORRECT_SCORE,r.playerScoreHattrick=e.PLAYER_SCORE_HATTRICK,r.playerScoreTwice=e.PLAYER_SCORE_TWICE,r}};var ca=class{matchId=null;matchType=null;predictions=null};var ma=class{remapPredictions=null;constructor(e,r){this.remapPredictions=new zr(e,r)}remapResponse=e=>{let r=new ca;return r.matchId=e.match_id,r.matchType=e.match_type,r.predictions=this.remapPredictions.remapPredictionModel(e.predictions),r}};var da=class{matchId=null;matchType=null;market=null;matchModel=null};var fa=class{value=null;target=null;playerId=null;playerModel=null;result=null};var ha=class{matchId=null;matchType=null;market=null;matchModel=null;prediction=new fa};var ga=class{value=null;result=null};var ya=class{matchId=null;matchType=null;market="CORRECT_SCORE";matchModel=null;prediction=new ga};var wa=class{matchId=null;matchModel=null;outcome=null};var Ma=class{remapPaginatedGames=e=>{let r=new ie;return r.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,r.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,r.data=e.data.map(n=>this.remapGamesListResponse(n)),r};remapGamesListResponse=e=>{let r=new sr;return r.id=e.id,r.title=e.title,r.description=e.description,r.type=e.type,r.status=e.status,r.predictionsCutoff=e.predictions_cutoff,r.fixtures=e.fixtures.map(n=>this.remapFixturesResponse(n)),r.createdAt=e.created_at,r.updatedAt=e.updated_at,r};remapFixturesResponse=e=>{let r=new da;return r.matchId=e.match_id,r.matchType=e.match_type,r.market=e.market,r};remapPaginatedUserTopXEditions=e=>{let r=new ie;return r.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,r.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,r.data=e.data.map(n=>this.remapUserTopXEditionsResponse(n)),r};remapUserTopXEditionsResponse=e=>{let r=new or;return r.id=e.id,r.title=e.title,r.description=e.description,r.type=e.type,r.status=e.status,r.predictionsCutoff=e.predictions_cutoff,r.fixtures=e.fixtures.map(n=>this.remapTopXFixturesResponse(n)),r.createdAt=e.created_at,r.updatedAt=e.updated_at,r};remapTopXFixturesResponse=e=>{let r=new ya;return r.matchId=e.match_id,r.matchType=e.match_type,r};remapPaginatedUserMathQuizEditions=e=>{let r=new ie;return r.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,r.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,r.data=e.data.map(n=>this.remapUserMatchQuizEditionsResponse(n)),r};remapUserMatchQuizEditionsResponse=e=>{let r=new Ft;return r.id=e.id,r.title=e.title,r.description=e.description,r.type=e.type,r.status=e.status,r.predictionsCutoff=e.predictions_cutoff,r.fixtures=e.fixtures.map(n=>this.remapMatchQuizFixturesResponse(n)),r.createdAt=e.created_at,r.updatedAt=e.updated_at,r};remapMatchQuizFixturesResponse=e=>{let r=new ha;return r.matchId=e.match_id,r.matchType=e.match_type,r.market=e.market,r};remapPaginatedGameResults=e=>{let r=new ie;return r.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,r.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,r.data=e.data.map(n=>this.remapGameResults(n)),r};remapGameResults=e=>{let r=new ar;return r.userId=e.user_id,r.points=e.points?e.points:0,r.results=e.results.map(n=>this.remapResults(n)),r.tiebreaker=e.tiebreaker?this.remapTiebreaker(e.tiebreaker):null,r};remapResults=e=>{let r=new wa;return r.matchId=e.match_id,r.outcome=e.outcome,r};remapTiebreaker=e=>{let r=new Wr;return r.goldenGoal=e.golden_goal,r}};var ba=class{remapMetaData=e=>{let r=new Sr;return r.pagination.nextPageStartsAfter=e.pagination.next_page_starts_after,r.pagination.itemsPerPage=e.pagination.items_per_page,r}};var Wt=class{instanceAuth=null;instance=null;apiSignInUrl=null;clientApiSignInUrl=null;predictionRemapper=null;matchSummaryRemapper=null;gamesRemapper=null;metaRemapper=null;constructor(e,r){let n=ze(e.environment,"predictor");this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}`,this.predictionRemapper=new zr(e,r),this.matchSummaryRemapper=new ma(e,r),this.gamesRemapper=new Ma,this.metaRemapper=new ba,this.instanceAuth=Ul.default.create({baseURL:n,headers:{Authorization:`Bearer ${e.authProvider.getIdToken()}`,"Content-Type":"application/json"}}),this.instance=Ul.default.create({baseURL:n,headers:{"Content-Type":"application/json"}})}makeFootballPrediction=async e=>{try{let r=this.predictionRemapper.remapRequestBody(e),n=await this.instanceAuth.post(`/predictions${this.apiSignInUrl}`,JSON.stringify(r));return await this.predictionRemapper.remapResponseObjBody(n.data)}catch(r){throw console.warn("There was a problem making POST request: ",r),r.response}};getMatchSummary=async e=>{try{let r=await this.instance.get(`/predictions/summary/${e}${this.apiSignInUrl}`);return this.matchSummaryRemapper.remapResponse(r.data)}catch(r){throw console.warn(`There was a problem fetching predictions for match: ${e} `,r),r.response}};deleteFootballPrediction=async e=>{try{return await this.instanceAuth.delete(`/predictions/${e}${this.apiSignInUrl}`),!0}catch(r){throw console.warn(`There was a problem deleting your prediction: ${e}`,r),r.response}};getMyPredictions=async e=>{try{let r=new ie,n=`/predictions${this.apiSignInUrl}`;e&&(n+=`${e.constructFiltersUrl()}`);let a=await this.instanceAuth.get(n);return r.meta=this.metaRemapper.remapMetaData(a.data.meta),r.data=await this.predictionRemapper.remapResponseArrayBody(a.data.data),r}catch(r){throw console.warn("There was a problem fetching own predictions",r),r.response}};getMyPredictionsNoRemap=async e=>{try{return(await this.instanceAuth.get(`/predictions${this.apiSignInUrl}${e.constructFiltersUrl()}`)).data.data}catch(r){throw console.warn("There was a problem fetching own predictions",r),r.response}};getUserPredictions=async(e,r,n)=>{try{let a=new ie,u=`/predictions/users/${e}${this.apiSignInUrl}`,f=Date.now();n&&(u+=`${n.constructFiltersUrl()}`),r&&(u+=`&disable_cache=${f}`);let g=await this.instance.get(u);return a.meta=this.metaRemapper.remapMetaData(g.data.meta),a.data=await this.predictionRemapper.remapResponseArrayBody(g.data.data),a}catch(a){throw console.warn(`There was a problem fetching predictions for user: ${e}`,a),a.response}};getUserPredictionsNoRemap=async(e,r)=>{try{return(await this.instance.get(`/predictions/users/${e}${this.apiSignInUrl}${r.constructFiltersUrl()}`)).data.data}catch(n){throw console.warn(`There was a problem fetching predictions for user: ${e}`,n),n.response}};getGames=async(e,r)=>{try{let n=`/games/${this.apiSignInUrl}${e.constructFiltersUrl()}`,a=Date.now();r&&(n+=`&disable_cache=${a}`);let u=await this.instance.get(n);return this.gamesRemapper.remapPaginatedGames(u.data)}catch(n){throw console.warn("There was a problem fetching the games list",n),n.response}};getGameById=async(e,r)=>{try{let n=`/games/${e}${this.apiSignInUrl}`,a=Date.now();r&&(n+=`&disable_cache=${a}`);let u=await this.instance.get(n);return this.gamesRemapper.remapGamesListResponse(u.data)}catch(n){throw console.warn(`There was a problem fetching the following game: ${e}`,n),n.response}};getUserGameEditions=async(e,r)=>{try{let n=null,a=`/games/${this.apiSignInUrl}${e.constructFiltersUrl()}`,u=Date.now();r&&(a+=`&disable_cache=${u}`);let f=await this.instance.get(a);return f.data.data.forEach(g=>{g.type==="TOP_X"?n=this.gamesRemapper.remapPaginatedUserTopXEditions(f.data):g.type==="MATCH_QUIZ"&&(n=this.gamesRemapper.remapPaginatedUserMathQuizEditions(f.data))}),n}catch(n){throw console.warn("There was a problem fetching the games list",n),n.response}};getGameResults=async(e,r,n)=>{try{let a=`/games/${e}/results/${this.apiSignInUrl}`,u=Date.now();n&&(a+=`${n.constructFiltersUrl()}`),r&&(a+=`&disable_cache=${u}`);let f=await this.instance.get(a);return this.gamesRemapper.remapPaginatedGameResults(f.data)}catch(a){throw console.warn(`There was a problem fetching the results for the following game: ${e}`,a),a.response}}};var va=class{fullCoverageCompetitions=null;markets=null};var _a=class{remapConfig=e=>{let r=new va;return r.fullCoverageCompetitions=e.full_coverage_competitions,r.markets=e.markets,r}};var Ia=class{gameInstanceId=null;fixtures=null};var Pa=class{predictorHttps=null;clientHttps=null;idMapping=null;predictorConfigRemapper=null;predictorService=null;constructor(e,r,n,a){this.predictorHttps=r,this.idMapping=a,this.clientHttps=n,this.predictorConfigRemapper=new _a,this.predictorService=new dt(e,a)}makeFootballPrediction=async(e,r,n,a)=>{let u=this.predictorService.validateFixture(e,r,n,a),f=new Ia;if(u)if(this.idMapping.idSchema!=="native"){let g=u.matchId,v="",T=await this.predictorService.remapMatchIdToNative([g]);if(u.matchId=T[0],!u.matchId)throw new Error("Match id is invalid!");if(u instanceof nt&&(v=u.prediction.playerId,u.prediction.playerId=await this.predictorService.remapPlayerIdToNative([v]),!u.prediction.playerId))throw new Error("Player id is invalid!");f.fixtures=[u];let M=await this.predictorHttps.makeFootballPrediction(f);return M.fixtures.map(F=>{F.prediction.playerId&&(F.prediction.playerId=v),F.matchId=g}),M}else return f.fixtures=[u],await this.predictorHttps.makeFootballPrediction(f);else throw new Error("The prediction is invalid. Please check again have you passed appropriate prediction model")};getMatchSummary=async e=>{if(this.idMapping.idSchema!=="native"){let n=(await this.predictorService.remapMatchIdToNative([e]))[0],a=await this.predictorHttps.getMatchSummary(n);a.matchId=e;let u=a.predictions,f=await this.predictorService.remapPlayerIdToIdSchema(u);return a.predictions=f,a}else return await this.predictorHttps.getMatchSummary(e)};getMarketSummary=async(e,r,n)=>{try{let a=await this.getMatchSummary(e);return this.predictorService.getMarketSummary(a,r,n)}catch(a){return a.message}};getConfig=async()=>{let e=await this.clientHttps.getConfig(),r=await this.predictorConfigRemapper.remapConfig(e.predictor);return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(r):r};deleteFootballPrediction=async e=>await this.predictorHttps.deleteFootballPrediction(e);getMyPredictions=async e=>(e&&(e=new Me(e)),await this.predictorHttps.getMyPredictions(e));getMyCurrentPredictions=async e=>{if(e)e.status=["ACTIVE"],e=new Me(e);else{let r={status:["ACTIVE"]};e=new Me(r)}return await this.getMyPredictions(e)};getMyPastPredictions=async e=>{if(e)e.status=Oi,e=new Me(e);else{let r={status:Oi};e=new Me(r)}return await this.getMyPredictions(e)};getUserPredictions=async(e,r,n)=>(n=n||!1,r&&(r=new Me(r)),await this.predictorHttps.getUserPredictions(e,n,r));getUserCurrentPredictions=async(e,r)=>{if(r)r.status=["ACTIVE"],r=new Me(r);else{let n={status:["ACTIVE"]};r=new Me(n)}return await this.getUserPredictions(e,r)};getUserPastPredictions=async(e,r)=>{if(r)r.status=Oi,r=new Me(r);else{let n={status:Oi};r=new Me(n)}return await this.getUserPredictions(e,r)}};var xm=rr(nr());var Qr=class{instance=null;apiSignInUrl="";constructor(e){let r=ze(e.environment,"client");this.apiSignInUrl=`/clients/${e.clientId}/features?key=${e.apiKey}`,this.instance=xm.default.create({baseURL:r,headers:{"Content-Type":"application/json"}})}getConfig=async()=>{try{return(await this.instance.get(`${this.apiSignInUrl}`)).data.data}catch(e){throw console.warn("There was a problem fetching configuration from Client API",e),e.response}}};var Ra=class{predictorHttps=null;clientHttps=null;predictorFacade=null;idMapping=null;constructor(e){this.idMapping=new Te(e),this.predictorHttps=new Wt(e,this.idMapping),this.clientHttps=new Qr(e),this.predictorFacade=new Pa(e,this.predictorHttps,this.clientHttps,this.idMapping)}makeFootballPrediction=async(e,r,n,a)=>await this.predictorFacade.makeFootballPrediction(e,r,n,a);getMatchSummary=async e=>await this.predictorFacade.getMatchSummary(e);getMarketSummary=async(e,r,n)=>await this.predictorFacade.getMarketSummary(e,r,n);getConfig=async()=>await this.predictorFacade.getConfig();deleteFootballPrediction=async e=>await this.predictorFacade.deleteFootballPrediction(e);getMyPredictions=async e=>await this.predictorFacade.getMyPredictions(e);getMyCurrentPredictions=async e=>await this.predictorFacade.getMyCurrentPredictions(e);getMyPastPredictions=async e=>await this.predictorFacade.getMyPastPredictions(e);getUserPredictions=async(e,r,n)=>await this.predictorFacade.getUserPredictions(e,r,n);getUserCurrentPredictions=async(e,r)=>await this.predictorFacade.getUserCurrentPredictions(e,r);getUserPastPredictions=async(e,r)=>await this.predictorFacade.getUserPastPredictions(e,r)};var Am=rr(nr());var Fa=class{rankType=null;fromDate=null;toDate=null;pagination=new Lr};var Sa=class{position=null;profileId=null;profileModel=null;points=null};var Ta=class{remapMeta=e=>{let r=new Fa;return r.rankType=e.rank_type,r.fromDate=e.from_date,r.toDate=e.to_date,r.pagination.currentPage=e.pagination.current_page,r.pagination.itemsPerPage=e.pagination.items_per_page,r.pagination.totalItems=e.pagination.total_items,r.pagination.numberOfPages=e.pagination.number_of_pages,r};remapResponseData=e=>{let r=[];return e.forEach(n=>{let a=new Sa;a.position=n.position,a.profileId=n.profile_id,a.points=n.points,r.push(a)}),r}};var Ea=class{id=null;name=null;type=null;fromDate=null;toDate=null;markets=[];teamIds=[];matchIds=[];gameIds=[];gameTypes=[];competitionIds=[]};var Ca=class{remapResponse=e=>{let r=[];return e.forEach(n=>{let a=new Ea;a.id=n.id,a.name=n.name,a.type=n.type,a.fromDate=n.from_date,a.toDate=n.to_date,a.markets=n.markets?n.markets:null,a.teamIds=n.team_ids?n.team_ids:null,a.matchIds=n.match_ids?n.match_ids:null,a.gameIds=n.game_ids?n.game_ids:null,a.gameTypes=n.game_types?n.game_types:null,a.competitionIds=n.competition_ids?n.competition_ids:null,r.push(a)}),r};remapMeta=e=>{let r={};return r.totalItems=e.pagination.total_items,r}};var xa=class{instance=null;apiSignInUrl=null;clientApiSignInUrl=null;templateRemapper=null;leaderboardRemapper=null;constructor(e){let r=ze(e.environment,"loyalty");this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}`,this.templateRemapper=new Ca,this.leaderboardRemapper=new Ta,this.instance=Am.default.create({baseURL:r,headers:{"Content-Type":"application/json"}})}getTemplates=async e=>{try{let r=`/leaderboard/templates/${this.apiSignInUrl}`,n=Date.now();e&&(r+=`&disable_cache=${n}`);let a=await this.instance.get(r),u=JSON.parse(JSON.stringify(a.data));return u.meta=this.templateRemapper.remapMeta(a.data.meta),u.data=this.templateRemapper.remapResponse(a.data.data),u}catch(r){throw console.warn("There was a problem fetching the list of templates",r),r.response}};getLeaderboard=async(e,r,n)=>{try{let a=`/leaderboard/${e}/${this.apiSignInUrl}`,u=Date.now();r&&(a+=`&disable_cache=${u}`),n&&(a+=`${n.constructFiltersUrl()}`);let f=await this.instance.get(a),g=JSON.parse(JSON.stringify(f.data));return g.meta=this.leaderboardRemapper.remapMeta(f.data.meta),g.data=this.leaderboardRemapper.remapResponseData(f.data.data),g}catch(a){throw console.warn(`There was a problem fetching the leaderboard for the following template: ${e}`,a),a.response}};getLeaderboardForGame=async(e,r,n)=>{try{let a=`/leaderboard/games/${e}/${this.apiSignInUrl}`,u=Date.now();r&&(a+=`&disable_cache=${u}`),n&&(a+=`${n.constructFiltersUrl()}`);let f=await this.instance.get(a),g=JSON.parse(JSON.stringify(f.data));return Un(g)}catch(a){throw console.warn(`There was a problem fetching the leaderboard for the following game: ${e}`,a),a.response}}};var Bi=class{limit=null;page=null;constructor(e){this.limit=e.limit?e.limit:null,this.page=e.page?e.page:null}constructFiltersUrl=()=>{let e="";return this.limit&&(e+="&",e+=`limit=${this.limit}`),this.page&&(e+="&",e+=`page=${this.page}`),e}};var Aa=class{general=[];predictor=[];topX=[]};var Oa=class{enabled=!1;rewards=null};var La=class{general=null;topX=null;predictor=null};var Ba=class{points=null;tiers=null;badges=null};var Na=class{remapLoyaltyResponse=e=>{let r=new Oa;return r.enabled=e.enabled,r.rewards=this.remapRewards(e.rewards),r};remapRewards=e=>{let r=new Ba;return r.points=this.remapPoints(e.points),r.tiers=e.tiers,r.badges=this.remapBadges(e.badges),r};remapPoints=e=>{let r=new La;return r.general=e.general,r.topX=e.top_x,r.predictor=e.predictor,r};remapBadges=e=>{let r=new Aa;return r.general=e.general,r.predictor=e.predictor,r.topX=e.top_x,r}};var Da=class{idMappingService=null;profileNamespace=null;constructor(e){this.idMappingService=new Te(e),this.profileNamespace=new Dr(e)}remapTemplatesIds=async e=>{if(e.length>0){let r=[],n=[],a=[],u=[],f=[],g=[];e.forEach(M=>{M.teamIds&&M.teamIds.length>0?r=[...r,...M.teamIds]:M.matchIds&&M.matchIds.length>0?a=[...a,...M.matchIds]:M.competitionIds&&M.competitionIds.length>0&&(f=[...f,...M.competitionIds])});let v={team:r,match:a,competition:f},T=await this.idMappingService.idMappingFacade.getEntitiesByIds(v,"native",this.idMappingService.idSchema);return n=[...T.team],u=[...T.match],g=[...T.competition],e.forEach(M=>{M.teamIds&&M.teamIds.length>0?M.teamIds=M.teamIds.map(F=>F=T.team.shift()):M.matchIds&&M.matchIds.length>0?M.matchIds=M.matchIds.map(F=>F=T.match.shift()):M.competitionIds&&M.competitionIds.length>0&&(M.competitionIds=M.competitionIds.map(F=>F=T.competition.shift()))}),e}return e};addProfileModel=async e=>{if(e.length>0){let r=[],n=[];e.forEach(u=>{r.push(u.profileId)});let a=await this.profileNamespace.getByIds(r);return e.forEach(u=>{a.forEach(f=>{f.id===u.profileId&&(delete f.interests,u.profileModel=f)}),u.profileModel||(u.profileModel=null),n.push(u)}),n}return e}};var Ua=class{config=null;clientHttps=null;loyaltyHttps=null;loyaltyRemapper=null;loyaltyService=null;constructor(e,r,n){this.config=e,this.clientHttps=r,this.loyaltyHttps=n,this.loyaltyRemapper=new Na,this.loyaltyService=new Da(this.config)}getConfig=async()=>{let e=await this.clientHttps.getConfig();return this.loyaltyRemapper.remapLoyaltyResponse(e.loyalty)};getTemplates=async e=>{if(e=e||!1,this.config.idSchema==="native")return await this.loyaltyHttps.getTemplates(e);let r=await this.loyaltyHttps.getTemplates(e);return r.data=await this.loyaltyService.remapTemplatesIds([...r.data]),r};getLeaderboard=async(e,r,n)=>{n=n||!1,r&&(r=new Bi(r));let a=await this.loyaltyHttps.getLeaderboard(e,n,r);return a.data=await this.loyaltyService.addProfileModel(a.data),a};getLeaderboardForGame=async(e,r,n)=>{n=n||!1,r&&(r=new Bi(r));let a=await this.loyaltyHttps.getLeaderboardForGame(e,n,r);return a.data=await this.loyaltyService.addProfileModel(a.data),a}};var Ga=class{clientHttps=null;loyaltyHttps=null;loyaltyFacade=null;constructor(e){this.clientHttps=new Qr(e),this.loyaltyHttps=new xa(e),this.loyaltyFacade=new Ua(e,this.clientHttps,this.loyaltyHttps)}getConfig=()=>this.loyaltyFacade.getConfig();getTemplates=e=>this.loyaltyFacade.getTemplates(e);getLeaderboard=(e,r,n)=>this.loyaltyFacade.getLeaderboard(e,r,n);getLeaderboardForGame=(e,r,n)=>this.loyaltyFacade.getLeaderboardForGame(e,r,n)};var $a=class{idMapping=null;predictorHttps=null;predictorService=null;constructor(e,r){this.idMapping=r,this.predictorHttps=new Wt(e,r),this.predictorService=new dt(e,r)}getGames=async(e,r)=>{r=r||!1;let n=this.predictorService.initGameFilters("TOP_X",e),a=await this.predictorHttps.getGames(n,r);return await this.predictorService.remapMatchIdsFixtures(a)};getGameById=async(e,r)=>{r=r||!1;let n=await this.predictorHttps.getGameById(e,r);return await this.predictorService.remapMatchIdsFixtures(n)};getGameResults=async(e,r,n)=>{n=n||!1,r&&(r=new Ge(r));let a=await this.predictorHttps.getGameResults(e,n,r);return await this.predictorService.remapMatchIdsFixtures(a)};getCurrentGameResults=async e=>{e=e||!1;let r={status:"OPEN",type:"TOP_X"};r=new Ge(r);let n=await this.predictorHttps.getGames(r,e),a=this.predictorService.getCurrentGameId(n);return(await this.getGameResults(a,null,e)).data[0]};play=async e=>{let r=new Yr(e);if(this.idMapping.idSchema!=="native"){let a=[];r.fixtures.forEach(f=>a.push(f.matchId));let u=await this.predictorService.remapMatchIdToNative(a);r.fixtures.forEach(f=>f.matchId=u.shift())}let n=await this.predictorHttps.makeFootballPrediction(r);return n.fixtures.forEach(a=>{a.matchId=a.matchModel.id}),n};delete=async e=>await this.predictorHttps.deleteFootballPrediction(e);getMyGameEditions=async(e,r)=>{r=r||!1;let n=this.predictorService.initGameTypePredictions("TOP_X"),a=[],u=await this.predictorHttps.getMyPredictionsNoRemap(n);if(u.length>0){u.forEach(v=>{v.game_instance_id&&a.push(v.game_instance_id)});let f=this.predictorService.initGameFilters("TOP_X",e,a),g=await this.predictorHttps.getUserGameEditions(f,r);return await this.predictorService.addPredictionProp(u,g)}else return new ie};getMyGamePrediction=async e=>{let r=this.predictorService.initGameTypePredictions("TOP_X"),n=await this.predictorHttps.getMyPredictions(r);return n.data.length>0?n.data.filter(u=>u.gameInstanceId===e)[0]:null};getUserGameEditions=async(e,r,n)=>{n=n||!1;let a=this.predictorService.initGameTypePredictions("TOP_X"),u=[],f=await this.predictorHttps.getUserPredictionsNoRemap(e,a);if(f.length>0){f.forEach(T=>{T.game_instance_id&&u.push(T.game_instance_id)});let g=this.predictorService.initGameFilters("TOP_X",r,u),v=await this.predictorHttps.getUserGameEditions(g,n);return await this.predictorService.addPredictionProp(f,v)}else return new ie};getUserGamePrediction=async(e,r,n)=>{n=n||!1;let a=this.predictorService.initGameTypePredictions("TOP_X"),u=await this.predictorHttps.getUserPredictions(e,n,a);return u.data.length>0?u.data.filter(g=>g.gameInstanceId===r)[0]:null}};var Ha=class{topXFacade=null;idMapping=null;constructor(e){this.idMapping=new Te(e),this.topXFacade=new $a(e,this.idMapping)}getGames=async(e,r)=>await this.topXFacade.getGames(e,r);getGameById=async(e,r)=>await this.topXFacade.getGameById(e,r);getGameResults=async(e,r,n)=>await this.topXFacade.getGameResults(e,r,n);getCurrentGameResults=async e=>await this.topXFacade.getCurrentGameResults(e);play=async e=>await this.topXFacade.play(e);delete=async e=>await this.topXFacade.delete(e);getMyGameEditions=async(e,r)=>await this.topXFacade.getMyGameEditions(e,r);getMyGamePrediction=async e=>await this.topXFacade.getMyGamePrediction(e);getUserGameEditions=async(e,r,n)=>await this.topXFacade.getUserGameEditions(e,r,n);getUserGamePrediction=async(e,r,n)=>await this.topXFacade.getUserGamePrediction(e,r,n)};var Va=class{predictorHttps=null;predictorService=null;idMapping=null;constructor(e){this.idMapping=new Te(e),this.predictorHttps=new Wt(e,this.idMapping),this.predictorService=new dt(e,this.idMapping)}play=async e=>{let r=e.fixtures.map(n=>this.predictorService.validateFixture(n.matchId,n.market,n.prediction.value,n.prediction.playerId));if(r){if(this.idMapping.idSchema!=="native"){let n=[],a=[];r.forEach(g=>{n.push(g.matchId),g instanceof nt&&a.push(g.prediction.playerId)});let u=await this.predictorService.remapMatchIdToNative(n),f={};a&&a.length>0&&(f=await this.predictorService.remapPlayerIdMapToNative(a)),r.forEach((g,v)=>{g.matchId=u[v],g instanceof nt&&(g.prediction.playerId=f[g.prediction.playerId])})}}else throw new Error("The prediction is invalid. Please check again have you passed appropriate prediction model");return e.fixtures=r,await this.predictorHttps.makeFootballPrediction(e)};delete=async e=>await this.predictorHttps.deleteFootballPrediction(e);getGames=async(e,r)=>{r=r||!1;let n=this.predictorService.initGameFilters("MATCH_QUIZ",e),a=await this.predictorHttps.getGames(n,r);return await this.predictorService.remapMatchIdsFixtures(a)};getGameById=async(e,r)=>{r=r||!1;let n=await this.predictorHttps.getGameById(e,r);return await this.predictorService.remapMatchIdsFixtures(n)};getGameResults=async(e,r,n)=>{n=n||!1,r&&(r=new Ge(r));let a=await this.predictorHttps.getGameResults(e,n,r);return await this.predictorService.remapMatchIdsFixtures(a)};getCurrentGameResults=async e=>{e=e||!1;let r={status:"OPEN",type:"MATCH_QUIZ"};r=new Ge(r);let n=await this.predictorHttps.getGames(r,e),a=this.predictorService.getCurrentGameId(n);return(await this.getGameResults(a,null,e)).data[0]};getMyGameEditions=async(e,r)=>{r=r||!1;let n=this.predictorService.initGameTypePredictions("MATCH_QUIZ"),a=[],u=await this.predictorHttps.getMyPredictionsNoRemap(n);if(u.length>0){u.forEach(v=>{v.game_instance_id&&a.push(v.game_instance_id)});let f=this.predictorService.initGameFilters("MATCH_QUIZ",e,a),g=await this.predictorHttps.getUserGameEditions(f,r);return await this.predictorService.addPredictionProp(u,g)}else return new ie};getMyGamePrediction=async e=>{let r=this.predictorService.initGameTypePredictions("MATCH_QUIZ"),n=await this.predictorHttps.getMyPredictions(r);return n.data.length>0?n.data.filter(u=>u.gameInstanceId===e)[0]:null};getUserGameEditions=async(e,r,n)=>{n=n||!1;let a=this.predictorService.initGameTypePredictions("MATCH_QUIZ"),u=[],f=await this.predictorHttps.getUserPredictionsNoRemap(e,a);if(f.length>0){f.forEach(T=>{T.game_instance_id&&u.push(T.game_instance_id)});let g=this.predictorService.initGameFilters("MATCH_QUIZ",r,u),v=await this.predictorHttps.getUserGameEditions(g,n);return await this.predictorService.addPredictionProp(f,v)}else return new ie};getUserGamePrediction=async(e,r,n)=>{n=n||!1;let a=this.predictorService.initGameTypePredictions("MATCH_QUIZ"),u=await this.predictorHttps.getUserPredictions(e,n,a);return u.data.length>0?u.data.filter(g=>g.gameInstanceId===r)[0]:null}};var qa=class{matchQuizFacade=null;constructor(e){this.matchQuizFacade=new Va(e)}play=async e=>await this.matchQuizFacade.play(e);delete=async e=>await this.matchQuizFacade.delete(e);getGames=async(e,r)=>await this.matchQuizFacade.getGames(e,r);getGameById=async(e,r)=>await this.matchQuizFacade.getGameById(e,r);getGameResults=async(e,r,n)=>await this.matchQuizFacade.getGameResults(e,r,n);getCurrentGameResults=async e=>await this.matchQuizFacade.getCurrentGameResults(e);getMyGameEditions=async(e,r)=>await this.matchQuizFacade.getMyGameEditions(e,r);getMyGamePrediction=async e=>await this.matchQuizFacade.getMyGamePrediction(e);getUserGameEditions=async(e,r,n)=>await this.matchQuizFacade.getUserGameEditions(e,r,n);getUserGamePrediction=async(e,r,n)=>await this.matchQuizFacade.getUserGamePrediction(e,r,n)};function hx(s){let r=new Xo().validate(s);if(r.idSchema.validation==="missing"&&(console.warn(r.idSchema.message.text),s.idSchema="native"),r.environment.validation==="missing"&&(console.warn(r.environment.message.text),s.environment="prod"),r.lang.validation==="missing"&&(console.warn(r.lang.message.text),s.lang="en"),r.isValid)return{profile:new Dr(s),football:new Yo(s),predictor:new Ra(s),loyalty:new Ga(s),topX:new Ha(s),matchQuiz:new qa(s)};throw new Error("Configuration is not valid")}export{hx as FansUnitedSDK};
22
+ /**
23
+ * @license
24
+ * Lodash <https://lodash.com/>
25
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
26
+ * Released under MIT license <https://lodash.com/license>
27
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
28
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
29
+ */
3
30
  //# sourceMappingURL=index.js.map