fansunited-sdk-esm 1.18.0 → 1.18.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +12 -12
  2. package/index.js.map +2 -2
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -1,26 +1,26 @@
1
- var Av=Object.create;var np=Object.defineProperty;var Ov=Object.getOwnPropertyDescriptor;var Bv=Object.getOwnPropertyNames;var Lv=Object.getPrototypeOf,Nv=Object.prototype.hasOwnProperty;var Dv=s=>np(s,"__esModule",{value:!0});var K=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var Uv=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Bv(e))!Nv.call(s,o)&&(t||o!=="default")&&np(s,o,{get:()=>e[o],enumerable:!(n=Ov(e,o))||n.enumerable});return s},dm=(s,e)=>Uv(Dv(np(s!=null?Av(Lv(s)):{},"default",!e&&s&&s.__esModule?{get:()=>s.default,enumerable:!0}:{value:s,enumerable:!0})),s);var fm=K((Oi,Gr)=>{(function(){var s,e="4.17.21",t=200,n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",p="Invalid `variable` option passed into `_.template`",d="__lodash_hash_undefined__",y=500,g="__lodash_placeholder__",v=1,w=2,S=4,q=1,Fe=2,we=1,ct=2,Se=4,ue=8,Te=16,We=32,ut=64,It=128,yr=256,Ns=512,Nd=30,Dd="...",Ud=800,Hd=16,Lp=1,Gd=2,kd=3,ii=1/0,N=9007199254740991,$d=17976931348623157e292,sn=0/0,mt=4294967295,Vd=mt-1,qd=mt>>>1,Wd=[["ary",It],["bind",we],["bindKey",ct],["curry",ue],["curryRight",Te],["flip",Ns],["partial",We],["partialRight",ut],["rearg",yr]],Mi="[object Arguments]",ln="[object Array]",Kd="[object AsyncFunction]",Mr="[object Boolean]",br="[object Date]",Xd="[object DOMException]",pn="[object Error]",cn="[object Function]",Np="[object GeneratorFunction]",nt="[object Map]",wr="[object Number]",Yd="[object Null]",Pt="[object Object]",Dp="[object Promise]",Qd="[object Proxy]",vr="[object RegExp]",at="[object Set]",_r="[object String]",un="[object Symbol]",zd="[object Undefined]",Ir="[object WeakMap]",Jd="[object WeakSet]",Pr="[object ArrayBuffer]",bi="[object DataView]",Ds="[object Float32Array]",Us="[object Float64Array]",Hs="[object Int8Array]",Gs="[object Int16Array]",ks="[object Int32Array]",$s="[object Uint8Array]",Vs="[object Uint8ClampedArray]",qs="[object Uint16Array]",Ws="[object Uint32Array]",Zd=/\b__p \+= '';/g,jd=/\b(__p \+=) '' \+/g,ef=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Up=/&(?:amp|lt|gt|quot|#39);/g,Hp=/[&<>"']/g,tf=RegExp(Up.source),rf=RegExp(Hp.source),nf=/<%-([\s\S]+?)%>/g,af=/<%([\s\S]+?)%>/g,Gp=/<%=([\s\S]+?)%>/g,of=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,sf=/^\w*$/,lf=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ks=/[\\^$.*+?()[\]{}|]/g,pf=RegExp(Ks.source),Xs=/^\s+/,cf=/\s/,uf=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,mf=/\{\n\/\* \[wrapped with (.+)\] \*/,df=/,? & /,ff=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,hf=/[()=,{}\[\]\/\s]/,gf=/\\(\\)?/g,yf=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,kp=/\w*$/,Mf=/^[-+]0x[0-9a-f]+$/i,bf=/^0b[01]+$/i,wf=/^\[object .+?Constructor\]$/,vf=/^0o[0-7]+$/i,_f=/^(?:0|[1-9]\d*)$/,If=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,mn=/($^)/,Pf=/['\n\r\u2028\u2029\\]/g,dn="\\ud800-\\udfff",Rf="\\u0300-\\u036f",Ff="\\ufe20-\\ufe2f",Sf="\\u20d0-\\u20ff",$p=Rf+Ff+Sf,Vp="\\u2700-\\u27bf",qp="a-z\\xdf-\\xf6\\xf8-\\xff",Tf="\\xac\\xb1\\xd7\\xf7",Ef="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Cf="\\u2000-\\u206f",xf=" \\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",Wp="A-Z\\xc0-\\xd6\\xd8-\\xde",Kp="\\ufe0e\\ufe0f",Xp=Tf+Ef+Cf+xf,Ys="['\u2019]",Af="["+dn+"]",Yp="["+Xp+"]",fn="["+$p+"]",Qp="\\d+",Of="["+Vp+"]",zp="["+qp+"]",Jp="[^"+dn+Xp+Qp+Vp+qp+Wp+"]",Qs="\\ud83c[\\udffb-\\udfff]",Bf="(?:"+fn+"|"+Qs+")",Zp="[^"+dn+"]",zs="(?:\\ud83c[\\udde6-\\uddff]){2}",Js="[\\ud800-\\udbff][\\udc00-\\udfff]",wi="["+Wp+"]",jp="\\u200d",ec="(?:"+zp+"|"+Jp+")",Lf="(?:"+wi+"|"+Jp+")",tc="(?:"+Ys+"(?:d|ll|m|re|s|t|ve))?",ic="(?:"+Ys+"(?:D|LL|M|RE|S|T|VE))?",rc=Bf+"?",nc="["+Kp+"]?",Nf="(?:"+jp+"(?:"+[Zp,zs,Js].join("|")+")"+nc+rc+")*",Df="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Uf="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ac=nc+rc+Nf,Hf="(?:"+[Of,zs,Js].join("|")+")"+ac,Gf="(?:"+[Zp+fn+"?",fn,zs,Js,Af].join("|")+")",kf=RegExp(Ys,"g"),$f=RegExp(fn,"g"),Zs=RegExp(Qs+"(?="+Qs+")|"+Gf+ac,"g"),Vf=RegExp([wi+"?"+zp+"+"+tc+"(?="+[Yp,wi,"$"].join("|")+")",Lf+"+"+ic+"(?="+[Yp,wi+ec,"$"].join("|")+")",wi+"?"+ec+"+"+tc,wi+"+"+ic,Uf,Df,Qp,Hf].join("|"),"g"),qf=RegExp("["+jp+dn+$p+Kp+"]"),Wf=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Kf=["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"],Xf=-1,z={};z[Ds]=z[Us]=z[Hs]=z[Gs]=z[ks]=z[$s]=z[Vs]=z[qs]=z[Ws]=!0,z[Mi]=z[ln]=z[Pr]=z[Mr]=z[bi]=z[br]=z[pn]=z[cn]=z[nt]=z[wr]=z[Pt]=z[vr]=z[at]=z[_r]=z[Ir]=!1;var Q={};Q[Mi]=Q[ln]=Q[Pr]=Q[bi]=Q[Mr]=Q[br]=Q[Ds]=Q[Us]=Q[Hs]=Q[Gs]=Q[ks]=Q[nt]=Q[wr]=Q[Pt]=Q[vr]=Q[at]=Q[_r]=Q[un]=Q[$s]=Q[Vs]=Q[qs]=Q[Ws]=!0,Q[pn]=Q[cn]=Q[Ir]=!1;var Yf={\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"},Qf={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},zf={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Jf={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Zf=parseFloat,jf=parseInt,oc=typeof global=="object"&&global&&global.Object===Object&&global,eh=typeof self=="object"&&self&&self.Object===Object&&self,pe=oc||eh||Function("return this")(),js=typeof Oi=="object"&&Oi&&!Oi.nodeType&&Oi,ri=js&&typeof Gr=="object"&&Gr&&!Gr.nodeType&&Gr,sc=ri&&ri.exports===js,el=sc&&oc.process,Ke=function(){try{var M=ri&&ri.require&&ri.require("util").types;return M||el&&el.binding&&el.binding("util")}catch{}}(),lc=Ke&&Ke.isArrayBuffer,pc=Ke&&Ke.isDate,cc=Ke&&Ke.isMap,uc=Ke&&Ke.isRegExp,mc=Ke&&Ke.isSet,dc=Ke&&Ke.isTypedArray;function De(M,I,_){switch(_.length){case 0:return M.call(I);case 1:return M.call(I,_[0]);case 2:return M.call(I,_[0],_[1]);case 3:return M.call(I,_[0],_[1],_[2])}return M.apply(I,_)}function th(M,I,_,E){for(var B=-1,V=M==null?0:M.length;++B<V;){var se=M[B];I(E,se,_(se),M)}return E}function Xe(M,I){for(var _=-1,E=M==null?0:M.length;++_<E&&I(M[_],_,M)!==!1;);return M}function ih(M,I){for(var _=M==null?0:M.length;_--&&I(M[_],_,M)!==!1;);return M}function fc(M,I){for(var _=-1,E=M==null?0:M.length;++_<E;)if(!I(M[_],_,M))return!1;return!0}function Dt(M,I){for(var _=-1,E=M==null?0:M.length,B=0,V=[];++_<E;){var se=M[_];I(se,_,M)&&(V[B++]=se)}return V}function hn(M,I){var _=M==null?0:M.length;return!!_&&vi(M,I,0)>-1}function tl(M,I,_){for(var E=-1,B=M==null?0:M.length;++E<B;)if(_(I,M[E]))return!0;return!1}function J(M,I){for(var _=-1,E=M==null?0:M.length,B=Array(E);++_<E;)B[_]=I(M[_],_,M);return B}function Ut(M,I){for(var _=-1,E=I.length,B=M.length;++_<E;)M[B+_]=I[_];return M}function il(M,I,_,E){var B=-1,V=M==null?0:M.length;for(E&&V&&(_=M[++B]);++B<V;)_=I(_,M[B],B,M);return _}function rh(M,I,_,E){var B=M==null?0:M.length;for(E&&B&&(_=M[--B]);B--;)_=I(_,M[B],B,M);return _}function rl(M,I){for(var _=-1,E=M==null?0:M.length;++_<E;)if(I(M[_],_,M))return!0;return!1}var nh=nl("length");function ah(M){return M.split("")}function oh(M){return M.match(ff)||[]}function hc(M,I,_){var E;return _(M,function(B,V,se){if(I(B,V,se))return E=V,!1}),E}function gn(M,I,_,E){for(var B=M.length,V=_+(E?1:-1);E?V--:++V<B;)if(I(M[V],V,M))return V;return-1}function vi(M,I,_){return I===I?Mh(M,I,_):gn(M,gc,_)}function sh(M,I,_,E){for(var B=_-1,V=M.length;++B<V;)if(E(M[B],I))return B;return-1}function gc(M){return M!==M}function yc(M,I){var _=M==null?0:M.length;return _?ol(M,I)/_:sn}function nl(M){return function(I){return I==null?s:I[M]}}function al(M){return function(I){return M==null?s:M[I]}}function Mc(M,I,_,E,B){return B(M,function(V,se,Y){_=E?(E=!1,V):I(_,V,se,Y)}),_}function lh(M,I){var _=M.length;for(M.sort(I);_--;)M[_]=M[_].value;return M}function ol(M,I){for(var _,E=-1,B=M.length;++E<B;){var V=I(M[E]);V!==s&&(_=_===s?V:_+V)}return _}function sl(M,I){for(var _=-1,E=Array(M);++_<M;)E[_]=I(_);return E}function ph(M,I){return J(I,function(_){return[_,M[_]]})}function bc(M){return M&&M.slice(0,Ic(M)+1).replace(Xs,"")}function Ue(M){return function(I){return M(I)}}function ll(M,I){return J(I,function(_){return M[_]})}function Rr(M,I){return M.has(I)}function wc(M,I){for(var _=-1,E=M.length;++_<E&&vi(I,M[_],0)>-1;);return _}function vc(M,I){for(var _=M.length;_--&&vi(I,M[_],0)>-1;);return _}function ch(M,I){for(var _=M.length,E=0;_--;)M[_]===I&&++E;return E}var uh=al(Yf),mh=al(Qf);function dh(M){return"\\"+Jf[M]}function fh(M,I){return M==null?s:M[I]}function _i(M){return qf.test(M)}function hh(M){return Wf.test(M)}function gh(M){for(var I,_=[];!(I=M.next()).done;)_.push(I.value);return _}function pl(M){var I=-1,_=Array(M.size);return M.forEach(function(E,B){_[++I]=[B,E]}),_}function _c(M,I){return function(_){return M(I(_))}}function Ht(M,I){for(var _=-1,E=M.length,B=0,V=[];++_<E;){var se=M[_];(se===I||se===g)&&(M[_]=g,V[B++]=_)}return V}function yn(M){var I=-1,_=Array(M.size);return M.forEach(function(E){_[++I]=E}),_}function yh(M){var I=-1,_=Array(M.size);return M.forEach(function(E){_[++I]=[E,E]}),_}function Mh(M,I,_){for(var E=_-1,B=M.length;++E<B;)if(M[E]===I)return E;return-1}function bh(M,I,_){for(var E=_+1;E--;)if(M[E]===I)return E;return E}function Ii(M){return _i(M)?vh(M):nh(M)}function ot(M){return _i(M)?_h(M):ah(M)}function Ic(M){for(var I=M.length;I--&&cf.test(M.charAt(I)););return I}var wh=al(zf);function vh(M){for(var I=Zs.lastIndex=0;Zs.test(M);)++I;return I}function _h(M){return M.match(Zs)||[]}function Ih(M){return M.match(Vf)||[]}var Ph=function M(I){I=I==null?pe:Gt.defaults(pe.Object(),I,Gt.pick(pe,Kf));var _=I.Array,E=I.Date,B=I.Error,V=I.Function,se=I.Math,Y=I.Object,cl=I.RegExp,Rh=I.String,Ye=I.TypeError,Mn=_.prototype,Fh=V.prototype,Pi=Y.prototype,bn=I["__core-js_shared__"],wn=Fh.toString,X=Pi.hasOwnProperty,Sh=0,Pc=function(){var i=/[^.]+$/.exec(bn&&bn.keys&&bn.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""}(),vn=Pi.toString,Th=wn.call(Y),Eh=pe._,Ch=cl("^"+wn.call(X).replace(Ks,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),_n=sc?I.Buffer:s,kt=I.Symbol,In=I.Uint8Array,Rc=_n?_n.allocUnsafe:s,Pn=_c(Y.getPrototypeOf,Y),Fc=Y.create,Sc=Pi.propertyIsEnumerable,Rn=Mn.splice,Tc=kt?kt.isConcatSpreadable:s,Fr=kt?kt.iterator:s,ni=kt?kt.toStringTag:s,Fn=function(){try{var i=pi(Y,"defineProperty");return i({},"",{}),i}catch{}}(),xh=I.clearTimeout!==pe.clearTimeout&&I.clearTimeout,Ah=E&&E.now!==pe.Date.now&&E.now,Oh=I.setTimeout!==pe.setTimeout&&I.setTimeout,Sn=se.ceil,Tn=se.floor,ul=Y.getOwnPropertySymbols,Bh=_n?_n.isBuffer:s,Ec=I.isFinite,Lh=Mn.join,Nh=_c(Y.keys,Y),le=se.max,ge=se.min,Dh=E.now,Uh=I.parseInt,Cc=se.random,Hh=Mn.reverse,ml=pi(I,"DataView"),Sr=pi(I,"Map"),dl=pi(I,"Promise"),Ri=pi(I,"Set"),Tr=pi(I,"WeakMap"),Er=pi(Y,"create"),En=Tr&&new Tr,Fi={},Gh=ci(ml),kh=ci(Sr),$h=ci(dl),Vh=ci(Ri),qh=ci(Tr),Cn=kt?kt.prototype:s,Cr=Cn?Cn.valueOf:s,xc=Cn?Cn.toString:s;function u(i){if(ee(i)&&!L(i)&&!(i instanceof k)){if(i instanceof Qe)return i;if(X.call(i,"__wrapped__"))return Au(i)}return new Qe(i)}var Si=function(){function i(){}return function(r){if(!Z(r))return{};if(Fc)return Fc(r);i.prototype=r;var a=new i;return i.prototype=s,a}}();function xn(){}function Qe(i,r){this.__wrapped__=i,this.__actions__=[],this.__chain__=!!r,this.__index__=0,this.__values__=s}u.templateSettings={escape:nf,evaluate:af,interpolate:Gp,variable:"",imports:{_:u}},u.prototype=xn.prototype,u.prototype.constructor=u,Qe.prototype=Si(xn.prototype),Qe.prototype.constructor=Qe;function k(i){this.__wrapped__=i,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=mt,this.__views__=[]}function Wh(){var i=new k(this.__wrapped__);return i.__actions__=Ee(this.__actions__),i.__dir__=this.__dir__,i.__filtered__=this.__filtered__,i.__iteratees__=Ee(this.__iteratees__),i.__takeCount__=this.__takeCount__,i.__views__=Ee(this.__views__),i}function Kh(){if(this.__filtered__){var i=new k(this);i.__dir__=-1,i.__filtered__=!0}else i=this.clone(),i.__dir__*=-1;return i}function Xh(){var i=this.__wrapped__.value(),r=this.__dir__,a=L(i),l=r<0,c=a?i.length:0,m=ay(0,c,this.__views__),f=m.start,h=m.end,b=h-f,P=l?h:f-1,R=this.__iteratees__,F=R.length,T=0,C=ge(b,this.__takeCount__);if(!a||!l&&c==b&&C==b)return tu(i,this.__actions__);var A=[];e:for(;b--&&T<C;){P+=r;for(var U=-1,O=i[P];++U<F;){var G=R[U],$=G.iteratee,ke=G.type,Ie=$(O);if(ke==Gd)O=Ie;else if(!Ie){if(ke==Lp)continue e;break e}}A[T++]=O}return A}k.prototype=Si(xn.prototype),k.prototype.constructor=k;function ai(i){var r=-1,a=i==null?0:i.length;for(this.clear();++r<a;){var l=i[r];this.set(l[0],l[1])}}function Yh(){this.__data__=Er?Er(null):{},this.size=0}function Qh(i){var r=this.has(i)&&delete this.__data__[i];return this.size-=r?1:0,r}function zh(i){var r=this.__data__;if(Er){var a=r[i];return a===d?s:a}return X.call(r,i)?r[i]:s}function Jh(i){var r=this.__data__;return Er?r[i]!==s:X.call(r,i)}function Zh(i,r){var a=this.__data__;return this.size+=this.has(i)?0:1,a[i]=Er&&r===s?d:r,this}ai.prototype.clear=Yh,ai.prototype.delete=Qh,ai.prototype.get=zh,ai.prototype.has=Jh,ai.prototype.set=Zh;function Rt(i){var r=-1,a=i==null?0:i.length;for(this.clear();++r<a;){var l=i[r];this.set(l[0],l[1])}}function jh(){this.__data__=[],this.size=0}function eg(i){var r=this.__data__,a=An(r,i);if(a<0)return!1;var l=r.length-1;return a==l?r.pop():Rn.call(r,a,1),--this.size,!0}function tg(i){var r=this.__data__,a=An(r,i);return a<0?s:r[a][1]}function ig(i){return An(this.__data__,i)>-1}function rg(i,r){var a=this.__data__,l=An(a,i);return l<0?(++this.size,a.push([i,r])):a[l][1]=r,this}Rt.prototype.clear=jh,Rt.prototype.delete=eg,Rt.prototype.get=tg,Rt.prototype.has=ig,Rt.prototype.set=rg;function Ft(i){var r=-1,a=i==null?0:i.length;for(this.clear();++r<a;){var l=i[r];this.set(l[0],l[1])}}function ng(){this.size=0,this.__data__={hash:new ai,map:new(Sr||Rt),string:new ai}}function ag(i){var r=qn(this,i).delete(i);return this.size-=r?1:0,r}function og(i){return qn(this,i).get(i)}function sg(i){return qn(this,i).has(i)}function lg(i,r){var a=qn(this,i),l=a.size;return a.set(i,r),this.size+=a.size==l?0:1,this}Ft.prototype.clear=ng,Ft.prototype.delete=ag,Ft.prototype.get=og,Ft.prototype.has=sg,Ft.prototype.set=lg;function oi(i){var r=-1,a=i==null?0:i.length;for(this.__data__=new Ft;++r<a;)this.add(i[r])}function pg(i){return this.__data__.set(i,d),this}function cg(i){return this.__data__.has(i)}oi.prototype.add=oi.prototype.push=pg,oi.prototype.has=cg;function st(i){var r=this.__data__=new Rt(i);this.size=r.size}function ug(){this.__data__=new Rt,this.size=0}function mg(i){var r=this.__data__,a=r.delete(i);return this.size=r.size,a}function dg(i){return this.__data__.get(i)}function fg(i){return this.__data__.has(i)}function hg(i,r){var a=this.__data__;if(a instanceof Rt){var l=a.__data__;if(!Sr||l.length<t-1)return l.push([i,r]),this.size=++a.size,this;a=this.__data__=new Ft(l)}return a.set(i,r),this.size=a.size,this}st.prototype.clear=ug,st.prototype.delete=mg,st.prototype.get=dg,st.prototype.has=fg,st.prototype.set=hg;function Ac(i,r){var a=L(i),l=!a&&ui(i),c=!a&&!l&&Kt(i),m=!a&&!l&&!c&&xi(i),f=a||l||c||m,h=f?sl(i.length,Rh):[],b=h.length;for(var P in i)(r||X.call(i,P))&&!(f&&(P=="length"||c&&(P=="offset"||P=="parent")||m&&(P=="buffer"||P=="byteLength"||P=="byteOffset")||Ct(P,b)))&&h.push(P);return h}function Oc(i){var r=i.length;return r?i[Pl(0,r-1)]:s}function gg(i,r){return Wn(Ee(i),si(r,0,i.length))}function yg(i){return Wn(Ee(i))}function fl(i,r,a){(a!==s&&!lt(i[r],a)||a===s&&!(r in i))&&St(i,r,a)}function xr(i,r,a){var l=i[r];(!(X.call(i,r)&&lt(l,a))||a===s&&!(r in i))&&St(i,r,a)}function An(i,r){for(var a=i.length;a--;)if(lt(i[a][0],r))return a;return-1}function Mg(i,r,a,l){return $t(i,function(c,m,f){r(l,c,a(c),f)}),l}function Bc(i,r){return i&&ft(r,ce(r),i)}function bg(i,r){return i&&ft(r,xe(r),i)}function St(i,r,a){r=="__proto__"&&Fn?Fn(i,r,{configurable:!0,enumerable:!0,value:a,writable:!0}):i[r]=a}function hl(i,r){for(var a=-1,l=r.length,c=_(l),m=i==null;++a<l;)c[a]=m?s:Ql(i,r[a]);return c}function si(i,r,a){return i===i&&(a!==s&&(i=i<=a?i:a),r!==s&&(i=i>=r?i:r)),i}function ze(i,r,a,l,c,m){var f,h=r&v,b=r&w,P=r&S;if(a&&(f=c?a(i,l,c,m):a(i)),f!==s)return f;if(!Z(i))return i;var R=L(i);if(R){if(f=sy(i),!h)return Ee(i,f)}else{var F=ye(i),T=F==cn||F==Np;if(Kt(i))return nu(i,h);if(F==Pt||F==Mi||T&&!c){if(f=b||T?{}:Iu(i),!h)return b?zg(i,bg(f,i)):Qg(i,Bc(f,i))}else{if(!Q[F])return c?i:{};f=ly(i,F,h)}}m||(m=new st);var C=m.get(i);if(C)return C;m.set(i,f),Zu(i)?i.forEach(function(O){f.add(ze(O,r,a,O,i,m))}):zu(i)&&i.forEach(function(O,G){f.set(G,ze(O,r,a,G,i,m))});var A=P?b?Ll:Bl:b?xe:ce,U=R?s:A(i);return Xe(U||i,function(O,G){U&&(G=O,O=i[G]),xr(f,G,ze(O,r,a,G,i,m))}),f}function wg(i){var r=ce(i);return function(a){return Lc(a,i,r)}}function Lc(i,r,a){var l=a.length;if(i==null)return!l;for(i=Y(i);l--;){var c=a[l],m=r[c],f=i[c];if(f===s&&!(c in i)||!m(f))return!1}return!0}function Nc(i,r,a){if(typeof i!="function")throw new Ye(o);return Ur(function(){i.apply(s,a)},r)}function Ar(i,r,a,l){var c=-1,m=hn,f=!0,h=i.length,b=[],P=r.length;if(!h)return b;a&&(r=J(r,Ue(a))),l?(m=tl,f=!1):r.length>=t&&(m=Rr,f=!1,r=new oi(r));e:for(;++c<h;){var R=i[c],F=a==null?R:a(R);if(R=l||R!==0?R:0,f&&F===F){for(var T=P;T--;)if(r[T]===F)continue e;b.push(R)}else m(r,F,l)||b.push(R)}return b}var $t=pu(dt),Dc=pu(yl,!0);function vg(i,r){var a=!0;return $t(i,function(l,c,m){return a=!!r(l,c,m),a}),a}function On(i,r,a){for(var l=-1,c=i.length;++l<c;){var m=i[l],f=r(m);if(f!=null&&(h===s?f===f&&!Ge(f):a(f,h)))var h=f,b=m}return b}function _g(i,r,a,l){var c=i.length;for(a=D(a),a<0&&(a=-a>c?0:c+a),l=l===s||l>c?c:D(l),l<0&&(l+=c),l=a>l?0:em(l);a<l;)i[a++]=r;return i}function Uc(i,r){var a=[];return $t(i,function(l,c,m){r(l,c,m)&&a.push(l)}),a}function me(i,r,a,l,c){var m=-1,f=i.length;for(a||(a=cy),c||(c=[]);++m<f;){var h=i[m];r>0&&a(h)?r>1?me(h,r-1,a,l,c):Ut(c,h):l||(c[c.length]=h)}return c}var gl=cu(),Hc=cu(!0);function dt(i,r){return i&&gl(i,r,ce)}function yl(i,r){return i&&Hc(i,r,ce)}function Bn(i,r){return Dt(r,function(a){return xt(i[a])})}function li(i,r){r=qt(r,i);for(var a=0,l=r.length;i!=null&&a<l;)i=i[ht(r[a++])];return a&&a==l?i:s}function Gc(i,r,a){var l=r(i);return L(i)?l:Ut(l,a(i))}function ve(i){return i==null?i===s?zd:Yd:ni&&ni in Y(i)?ny(i):yy(i)}function Ml(i,r){return i>r}function Ig(i,r){return i!=null&&X.call(i,r)}function Pg(i,r){return i!=null&&r in Y(i)}function Rg(i,r,a){return i>=ge(r,a)&&i<le(r,a)}function bl(i,r,a){for(var l=a?tl:hn,c=i[0].length,m=i.length,f=m,h=_(m),b=1/0,P=[];f--;){var R=i[f];f&&r&&(R=J(R,Ue(r))),b=ge(R.length,b),h[f]=!a&&(r||c>=120&&R.length>=120)?new oi(f&&R):s}R=i[0];var F=-1,T=h[0];e:for(;++F<c&&P.length<b;){var C=R[F],A=r?r(C):C;if(C=a||C!==0?C:0,!(T?Rr(T,A):l(P,A,a))){for(f=m;--f;){var U=h[f];if(!(U?Rr(U,A):l(i[f],A,a)))continue e}T&&T.push(A),P.push(C)}}return P}function Fg(i,r,a,l){return dt(i,function(c,m,f){r(l,a(c),m,f)}),l}function Or(i,r,a){r=qt(r,i),i=Su(i,r);var l=i==null?i:i[ht(Ze(r))];return l==null?s:De(l,i,a)}function kc(i){return ee(i)&&ve(i)==Mi}function Sg(i){return ee(i)&&ve(i)==Pr}function Tg(i){return ee(i)&&ve(i)==br}function Br(i,r,a,l,c){return i===r?!0:i==null||r==null||!ee(i)&&!ee(r)?i!==i&&r!==r:Eg(i,r,a,l,Br,c)}function Eg(i,r,a,l,c,m){var f=L(i),h=L(r),b=f?ln:ye(i),P=h?ln:ye(r);b=b==Mi?Pt:b,P=P==Mi?Pt:P;var R=b==Pt,F=P==Pt,T=b==P;if(T&&Kt(i)){if(!Kt(r))return!1;f=!0,R=!1}if(T&&!R)return m||(m=new st),f||xi(i)?wu(i,r,a,l,c,m):iy(i,r,b,a,l,c,m);if(!(a&q)){var C=R&&X.call(i,"__wrapped__"),A=F&&X.call(r,"__wrapped__");if(C||A){var U=C?i.value():i,O=A?r.value():r;return m||(m=new st),c(U,O,a,l,m)}}return T?(m||(m=new st),ry(i,r,a,l,c,m)):!1}function Cg(i){return ee(i)&&ye(i)==nt}function wl(i,r,a,l){var c=a.length,m=c,f=!l;if(i==null)return!m;for(i=Y(i);c--;){var h=a[c];if(f&&h[2]?h[1]!==i[h[0]]:!(h[0]in i))return!1}for(;++c<m;){h=a[c];var b=h[0],P=i[b],R=h[1];if(f&&h[2]){if(P===s&&!(b in i))return!1}else{var F=new st;if(l)var T=l(P,R,b,i,r,F);if(!(T===s?Br(R,P,q|Fe,l,F):T))return!1}}return!0}function $c(i){if(!Z(i)||my(i))return!1;var r=xt(i)?Ch:wf;return r.test(ci(i))}function xg(i){return ee(i)&&ve(i)==vr}function Ag(i){return ee(i)&&ye(i)==at}function Og(i){return ee(i)&&Jn(i.length)&&!!z[ve(i)]}function Vc(i){return typeof i=="function"?i:i==null?Ae:typeof i=="object"?L(i)?Kc(i[0],i[1]):Wc(i):um(i)}function vl(i){if(!Dr(i))return Nh(i);var r=[];for(var a in Y(i))X.call(i,a)&&a!="constructor"&&r.push(a);return r}function Bg(i){if(!Z(i))return gy(i);var r=Dr(i),a=[];for(var l in i)l=="constructor"&&(r||!X.call(i,l))||a.push(l);return a}function _l(i,r){return i<r}function qc(i,r){var a=-1,l=Ce(i)?_(i.length):[];return $t(i,function(c,m,f){l[++a]=r(c,m,f)}),l}function Wc(i){var r=Dl(i);return r.length==1&&r[0][2]?Ru(r[0][0],r[0][1]):function(a){return a===i||wl(a,i,r)}}function Kc(i,r){return Hl(i)&&Pu(r)?Ru(ht(i),r):function(a){var l=Ql(a,i);return l===s&&l===r?zl(a,i):Br(r,l,q|Fe)}}function Ln(i,r,a,l,c){i!==r&&gl(r,function(m,f){if(c||(c=new st),Z(m))Lg(i,r,f,a,Ln,l,c);else{var h=l?l(kl(i,f),m,f+"",i,r,c):s;h===s&&(h=m),fl(i,f,h)}},xe)}function Lg(i,r,a,l,c,m,f){var h=kl(i,a),b=kl(r,a),P=f.get(b);if(P){fl(i,a,P);return}var R=m?m(h,b,a+"",i,r,f):s,F=R===s;if(F){var T=L(b),C=!T&&Kt(b),A=!T&&!C&&xi(b);R=b,T||C||A?L(h)?R=h:te(h)?R=Ee(h):C?(F=!1,R=nu(b,!0)):A?(F=!1,R=au(b,!0)):R=[]:Hr(b)||ui(b)?(R=h,ui(h)?R=tm(h):(!Z(h)||xt(h))&&(R=Iu(b))):F=!1}F&&(f.set(b,R),c(R,b,l,m,f),f.delete(b)),fl(i,a,R)}function Xc(i,r){var a=i.length;if(!!a)return r+=r<0?a:0,Ct(r,a)?i[r]:s}function Yc(i,r,a){r.length?r=J(r,function(m){return L(m)?function(f){return li(f,m.length===1?m[0]:m)}:m}):r=[Ae];var l=-1;r=J(r,Ue(x()));var c=qc(i,function(m,f,h){var b=J(r,function(P){return P(m)});return{criteria:b,index:++l,value:m}});return lh(c,function(m,f){return Yg(m,f,a)})}function Ng(i,r){return Qc(i,r,function(a,l){return zl(i,l)})}function Qc(i,r,a){for(var l=-1,c=r.length,m={};++l<c;){var f=r[l],h=li(i,f);a(h,f)&&Lr(m,qt(f,i),h)}return m}function Dg(i){return function(r){return li(r,i)}}function Il(i,r,a,l){var c=l?sh:vi,m=-1,f=r.length,h=i;for(i===r&&(r=Ee(r)),a&&(h=J(i,Ue(a)));++m<f;)for(var b=0,P=r[m],R=a?a(P):P;(b=c(h,R,b,l))>-1;)h!==i&&Rn.call(h,b,1),Rn.call(i,b,1);return i}function zc(i,r){for(var a=i?r.length:0,l=a-1;a--;){var c=r[a];if(a==l||c!==m){var m=c;Ct(c)?Rn.call(i,c,1):Sl(i,c)}}return i}function Pl(i,r){return i+Tn(Cc()*(r-i+1))}function Ug(i,r,a,l){for(var c=-1,m=le(Sn((r-i)/(a||1)),0),f=_(m);m--;)f[l?m:++c]=i,i+=a;return f}function Rl(i,r){var a="";if(!i||r<1||r>N)return a;do r%2&&(a+=i),r=Tn(r/2),r&&(i+=i);while(r);return a}function H(i,r){return $l(Fu(i,r,Ae),i+"")}function Hg(i){return Oc(Ai(i))}function Gg(i,r){var a=Ai(i);return Wn(a,si(r,0,a.length))}function Lr(i,r,a,l){if(!Z(i))return i;r=qt(r,i);for(var c=-1,m=r.length,f=m-1,h=i;h!=null&&++c<m;){var b=ht(r[c]),P=a;if(b==="__proto__"||b==="constructor"||b==="prototype")return i;if(c!=f){var R=h[b];P=l?l(R,b,h):s,P===s&&(P=Z(R)?R:Ct(r[c+1])?[]:{})}xr(h,b,P),h=h[b]}return i}var Jc=En?function(i,r){return En.set(i,r),i}:Ae,kg=Fn?function(i,r){return Fn(i,"toString",{configurable:!0,enumerable:!1,value:Zl(r),writable:!0})}:Ae;function $g(i){return Wn(Ai(i))}function Je(i,r,a){var l=-1,c=i.length;r<0&&(r=-r>c?0:c+r),a=a>c?c:a,a<0&&(a+=c),c=r>a?0:a-r>>>0,r>>>=0;for(var m=_(c);++l<c;)m[l]=i[l+r];return m}function Vg(i,r){var a;return $t(i,function(l,c,m){return a=r(l,c,m),!a}),!!a}function Nn(i,r,a){var l=0,c=i==null?l:i.length;if(typeof r=="number"&&r===r&&c<=qd){for(;l<c;){var m=l+c>>>1,f=i[m];f!==null&&!Ge(f)&&(a?f<=r:f<r)?l=m+1:c=m}return c}return Fl(i,r,Ae,a)}function Fl(i,r,a,l){var c=0,m=i==null?0:i.length;if(m===0)return 0;r=a(r);for(var f=r!==r,h=r===null,b=Ge(r),P=r===s;c<m;){var R=Tn((c+m)/2),F=a(i[R]),T=F!==s,C=F===null,A=F===F,U=Ge(F);if(f)var O=l||A;else P?O=A&&(l||T):h?O=A&&T&&(l||!C):b?O=A&&T&&!C&&(l||!U):C||U?O=!1:O=l?F<=r:F<r;O?c=R+1:m=R}return ge(m,Vd)}function Zc(i,r){for(var a=-1,l=i.length,c=0,m=[];++a<l;){var f=i[a],h=r?r(f):f;if(!a||!lt(h,b)){var b=h;m[c++]=f===0?0:f}}return m}function jc(i){return typeof i=="number"?i:Ge(i)?sn:+i}function He(i){if(typeof i=="string")return i;if(L(i))return J(i,He)+"";if(Ge(i))return xc?xc.call(i):"";var r=i+"";return r=="0"&&1/i==-ii?"-0":r}function Vt(i,r,a){var l=-1,c=hn,m=i.length,f=!0,h=[],b=h;if(a)f=!1,c=tl;else if(m>=t){var P=r?null:ey(i);if(P)return yn(P);f=!1,c=Rr,b=new oi}else b=r?[]:h;e:for(;++l<m;){var R=i[l],F=r?r(R):R;if(R=a||R!==0?R:0,f&&F===F){for(var T=b.length;T--;)if(b[T]===F)continue e;r&&b.push(F),h.push(R)}else c(b,F,a)||(b!==h&&b.push(F),h.push(R))}return h}function Sl(i,r){return r=qt(r,i),i=Su(i,r),i==null||delete i[ht(Ze(r))]}function eu(i,r,a,l){return Lr(i,r,a(li(i,r)),l)}function Dn(i,r,a,l){for(var c=i.length,m=l?c:-1;(l?m--:++m<c)&&r(i[m],m,i););return a?Je(i,l?0:m,l?m+1:c):Je(i,l?m+1:0,l?c:m)}function tu(i,r){var a=i;return a instanceof k&&(a=a.value()),il(r,function(l,c){return c.func.apply(c.thisArg,Ut([l],c.args))},a)}function Tl(i,r,a){var l=i.length;if(l<2)return l?Vt(i[0]):[];for(var c=-1,m=_(l);++c<l;)for(var f=i[c],h=-1;++h<l;)h!=c&&(m[c]=Ar(m[c]||f,i[h],r,a));return Vt(me(m,1),r,a)}function iu(i,r,a){for(var l=-1,c=i.length,m=r.length,f={};++l<c;){var h=l<m?r[l]:s;a(f,i[l],h)}return f}function El(i){return te(i)?i:[]}function Cl(i){return typeof i=="function"?i:Ae}function qt(i,r){return L(i)?i:Hl(i,r)?[i]:xu(W(i))}var qg=H;function Wt(i,r,a){var l=i.length;return a=a===s?l:a,!r&&a>=l?i:Je(i,r,a)}var ru=xh||function(i){return pe.clearTimeout(i)};function nu(i,r){if(r)return i.slice();var a=i.length,l=Rc?Rc(a):new i.constructor(a);return i.copy(l),l}function xl(i){var r=new i.constructor(i.byteLength);return new In(r).set(new In(i)),r}function Wg(i,r){var a=r?xl(i.buffer):i.buffer;return new i.constructor(a,i.byteOffset,i.byteLength)}function Kg(i){var r=new i.constructor(i.source,kp.exec(i));return r.lastIndex=i.lastIndex,r}function Xg(i){return Cr?Y(Cr.call(i)):{}}function au(i,r){var a=r?xl(i.buffer):i.buffer;return new i.constructor(a,i.byteOffset,i.length)}function ou(i,r){if(i!==r){var a=i!==s,l=i===null,c=i===i,m=Ge(i),f=r!==s,h=r===null,b=r===r,P=Ge(r);if(!h&&!P&&!m&&i>r||m&&f&&b&&!h&&!P||l&&f&&b||!a&&b||!c)return 1;if(!l&&!m&&!P&&i<r||P&&a&&c&&!l&&!m||h&&a&&c||!f&&c||!b)return-1}return 0}function Yg(i,r,a){for(var l=-1,c=i.criteria,m=r.criteria,f=c.length,h=a.length;++l<f;){var b=ou(c[l],m[l]);if(b){if(l>=h)return b;var P=a[l];return b*(P=="desc"?-1:1)}}return i.index-r.index}function su(i,r,a,l){for(var c=-1,m=i.length,f=a.length,h=-1,b=r.length,P=le(m-f,0),R=_(b+P),F=!l;++h<b;)R[h]=r[h];for(;++c<f;)(F||c<m)&&(R[a[c]]=i[c]);for(;P--;)R[h++]=i[c++];return R}function lu(i,r,a,l){for(var c=-1,m=i.length,f=-1,h=a.length,b=-1,P=r.length,R=le(m-h,0),F=_(R+P),T=!l;++c<R;)F[c]=i[c];for(var C=c;++b<P;)F[C+b]=r[b];for(;++f<h;)(T||c<m)&&(F[C+a[f]]=i[c++]);return F}function Ee(i,r){var a=-1,l=i.length;for(r||(r=_(l));++a<l;)r[a]=i[a];return r}function ft(i,r,a,l){var c=!a;a||(a={});for(var m=-1,f=r.length;++m<f;){var h=r[m],b=l?l(a[h],i[h],h,a,i):s;b===s&&(b=i[h]),c?St(a,h,b):xr(a,h,b)}return a}function Qg(i,r){return ft(i,Ul(i),r)}function zg(i,r){return ft(i,vu(i),r)}function Un(i,r){return function(a,l){var c=L(a)?th:Mg,m=r?r():{};return c(a,i,x(l,2),m)}}function Ti(i){return H(function(r,a){var l=-1,c=a.length,m=c>1?a[c-1]:s,f=c>2?a[2]:s;for(m=i.length>3&&typeof m=="function"?(c--,m):s,f&&_e(a[0],a[1],f)&&(m=c<3?s:m,c=1),r=Y(r);++l<c;){var h=a[l];h&&i(r,h,l,m)}return r})}function pu(i,r){return function(a,l){if(a==null)return a;if(!Ce(a))return i(a,l);for(var c=a.length,m=r?c:-1,f=Y(a);(r?m--:++m<c)&&l(f[m],m,f)!==!1;);return a}}function cu(i){return function(r,a,l){for(var c=-1,m=Y(r),f=l(r),h=f.length;h--;){var b=f[i?h:++c];if(a(m[b],b,m)===!1)break}return r}}function Jg(i,r,a){var l=r&we,c=Nr(i);function m(){var f=this&&this!==pe&&this instanceof m?c:i;return f.apply(l?a:this,arguments)}return m}function uu(i){return function(r){r=W(r);var a=_i(r)?ot(r):s,l=a?a[0]:r.charAt(0),c=a?Wt(a,1).join(""):r.slice(1);return l[i]()+c}}function Ei(i){return function(r){return il(pm(lm(r).replace(kf,"")),i,"")}}function Nr(i){return function(){var r=arguments;switch(r.length){case 0:return new i;case 1:return new i(r[0]);case 2:return new i(r[0],r[1]);case 3:return new i(r[0],r[1],r[2]);case 4:return new i(r[0],r[1],r[2],r[3]);case 5:return new i(r[0],r[1],r[2],r[3],r[4]);case 6:return new i(r[0],r[1],r[2],r[3],r[4],r[5]);case 7:return new i(r[0],r[1],r[2],r[3],r[4],r[5],r[6])}var a=Si(i.prototype),l=i.apply(a,r);return Z(l)?l:a}}function Zg(i,r,a){var l=Nr(i);function c(){for(var m=arguments.length,f=_(m),h=m,b=Ci(c);h--;)f[h]=arguments[h];var P=m<3&&f[0]!==b&&f[m-1]!==b?[]:Ht(f,b);if(m-=P.length,m<a)return gu(i,r,Hn,c.placeholder,s,f,P,s,s,a-m);var R=this&&this!==pe&&this instanceof c?l:i;return De(R,this,f)}return c}function mu(i){return function(r,a,l){var c=Y(r);if(!Ce(r)){var m=x(a,3);r=ce(r),a=function(h){return m(c[h],h,c)}}var f=i(r,a,l);return f>-1?c[m?r[f]:f]:s}}function du(i){return Et(function(r){var a=r.length,l=a,c=Qe.prototype.thru;for(i&&r.reverse();l--;){var m=r[l];if(typeof m!="function")throw new Ye(o);if(c&&!f&&Vn(m)=="wrapper")var f=new Qe([],!0)}for(l=f?l:a;++l<a;){m=r[l];var h=Vn(m),b=h=="wrapper"?Nl(m):s;b&&Gl(b[0])&&b[1]==(It|ue|We|yr)&&!b[4].length&&b[9]==1?f=f[Vn(b[0])].apply(f,b[3]):f=m.length==1&&Gl(m)?f[h]():f.thru(m)}return function(){var P=arguments,R=P[0];if(f&&P.length==1&&L(R))return f.plant(R).value();for(var F=0,T=a?r[F].apply(this,P):R;++F<a;)T=r[F].call(this,T);return T}})}function Hn(i,r,a,l,c,m,f,h,b,P){var R=r&It,F=r&we,T=r&ct,C=r&(ue|Te),A=r&Ns,U=T?s:Nr(i);function O(){for(var G=arguments.length,$=_(G),ke=G;ke--;)$[ke]=arguments[ke];if(C)var Ie=Ci(O),$e=ch($,Ie);if(l&&($=su($,l,c,C)),m&&($=lu($,m,f,C)),G-=$e,C&&G<P){var ie=Ht($,Ie);return gu(i,r,Hn,O.placeholder,a,$,ie,h,b,P-G)}var pt=F?a:this,Ot=T?pt[i]:i;return G=$.length,h?$=My($,h):A&&G>1&&$.reverse(),R&&b<G&&($.length=b),this&&this!==pe&&this instanceof O&&(Ot=U||Nr(Ot)),Ot.apply(pt,$)}return O}function fu(i,r){return function(a,l){return Fg(a,i,r(l),{})}}function Gn(i,r){return function(a,l){var c;if(a===s&&l===s)return r;if(a!==s&&(c=a),l!==s){if(c===s)return l;typeof a=="string"||typeof l=="string"?(a=He(a),l=He(l)):(a=jc(a),l=jc(l)),c=i(a,l)}return c}}function Al(i){return Et(function(r){return r=J(r,Ue(x())),H(function(a){var l=this;return i(r,function(c){return De(c,l,a)})})})}function kn(i,r){r=r===s?" ":He(r);var a=r.length;if(a<2)return a?Rl(r,i):r;var l=Rl(r,Sn(i/Ii(r)));return _i(r)?Wt(ot(l),0,i).join(""):l.slice(0,i)}function jg(i,r,a,l){var c=r&we,m=Nr(i);function f(){for(var h=-1,b=arguments.length,P=-1,R=l.length,F=_(R+b),T=this&&this!==pe&&this instanceof f?m:i;++P<R;)F[P]=l[P];for(;b--;)F[P++]=arguments[++h];return De(T,c?a:this,F)}return f}function hu(i){return function(r,a,l){return l&&typeof l!="number"&&_e(r,a,l)&&(a=l=s),r=At(r),a===s?(a=r,r=0):a=At(a),l=l===s?r<a?1:-1:At(l),Ug(r,a,l,i)}}function $n(i){return function(r,a){return typeof r=="string"&&typeof a=="string"||(r=je(r),a=je(a)),i(r,a)}}function gu(i,r,a,l,c,m,f,h,b,P){var R=r&ue,F=R?f:s,T=R?s:f,C=R?m:s,A=R?s:m;r|=R?We:ut,r&=~(R?ut:We),r&Se||(r&=~(we|ct));var U=[i,r,c,C,F,A,T,h,b,P],O=a.apply(s,U);return Gl(i)&&Tu(O,U),O.placeholder=l,Eu(O,i,r)}function Ol(i){var r=se[i];return function(a,l){if(a=je(a),l=l==null?0:ge(D(l),292),l&&Ec(a)){var c=(W(a)+"e").split("e"),m=r(c[0]+"e"+(+c[1]+l));return c=(W(m)+"e").split("e"),+(c[0]+"e"+(+c[1]-l))}return r(a)}}var ey=Ri&&1/yn(new Ri([,-0]))[1]==ii?function(i){return new Ri(i)}:tp;function yu(i){return function(r){var a=ye(r);return a==nt?pl(r):a==at?yh(r):ph(r,i(r))}}function Tt(i,r,a,l,c,m,f,h){var b=r&ct;if(!b&&typeof i!="function")throw new Ye(o);var P=l?l.length:0;if(P||(r&=~(We|ut),l=c=s),f=f===s?f:le(D(f),0),h=h===s?h:D(h),P-=c?c.length:0,r&ut){var R=l,F=c;l=c=s}var T=b?s:Nl(i),C=[i,r,a,l,c,R,F,m,f,h];if(T&&hy(C,T),i=C[0],r=C[1],a=C[2],l=C[3],c=C[4],h=C[9]=C[9]===s?b?0:i.length:le(C[9]-P,0),!h&&r&(ue|Te)&&(r&=~(ue|Te)),!r||r==we)var A=Jg(i,r,a);else r==ue||r==Te?A=Zg(i,r,h):(r==We||r==(we|We))&&!c.length?A=jg(i,r,a,l):A=Hn.apply(s,C);var U=T?Jc:Tu;return Eu(U(A,C),i,r)}function Mu(i,r,a,l){return i===s||lt(i,Pi[a])&&!X.call(l,a)?r:i}function bu(i,r,a,l,c,m){return Z(i)&&Z(r)&&(m.set(r,i),Ln(i,r,s,bu,m),m.delete(r)),i}function ty(i){return Hr(i)?s:i}function wu(i,r,a,l,c,m){var f=a&q,h=i.length,b=r.length;if(h!=b&&!(f&&b>h))return!1;var P=m.get(i),R=m.get(r);if(P&&R)return P==r&&R==i;var F=-1,T=!0,C=a&Fe?new oi:s;for(m.set(i,r),m.set(r,i);++F<h;){var A=i[F],U=r[F];if(l)var O=f?l(U,A,F,r,i,m):l(A,U,F,i,r,m);if(O!==s){if(O)continue;T=!1;break}if(C){if(!rl(r,function(G,$){if(!Rr(C,$)&&(A===G||c(A,G,a,l,m)))return C.push($)})){T=!1;break}}else if(!(A===U||c(A,U,a,l,m))){T=!1;break}}return m.delete(i),m.delete(r),T}function iy(i,r,a,l,c,m,f){switch(a){case bi:if(i.byteLength!=r.byteLength||i.byteOffset!=r.byteOffset)return!1;i=i.buffer,r=r.buffer;case Pr:return!(i.byteLength!=r.byteLength||!m(new In(i),new In(r)));case Mr:case br:case wr:return lt(+i,+r);case pn:return i.name==r.name&&i.message==r.message;case vr:case _r:return i==r+"";case nt:var h=pl;case at:var b=l&q;if(h||(h=yn),i.size!=r.size&&!b)return!1;var P=f.get(i);if(P)return P==r;l|=Fe,f.set(i,r);var R=wu(h(i),h(r),l,c,m,f);return f.delete(i),R;case un:if(Cr)return Cr.call(i)==Cr.call(r)}return!1}function ry(i,r,a,l,c,m){var f=a&q,h=Bl(i),b=h.length,P=Bl(r),R=P.length;if(b!=R&&!f)return!1;for(var F=b;F--;){var T=h[F];if(!(f?T in r:X.call(r,T)))return!1}var C=m.get(i),A=m.get(r);if(C&&A)return C==r&&A==i;var U=!0;m.set(i,r),m.set(r,i);for(var O=f;++F<b;){T=h[F];var G=i[T],$=r[T];if(l)var ke=f?l($,G,T,r,i,m):l(G,$,T,i,r,m);if(!(ke===s?G===$||c(G,$,a,l,m):ke)){U=!1;break}O||(O=T=="constructor")}if(U&&!O){var Ie=i.constructor,$e=r.constructor;Ie!=$e&&"constructor"in i&&"constructor"in r&&!(typeof Ie=="function"&&Ie instanceof Ie&&typeof $e=="function"&&$e instanceof $e)&&(U=!1)}return m.delete(i),m.delete(r),U}function Et(i){return $l(Fu(i,s,Lu),i+"")}function Bl(i){return Gc(i,ce,Ul)}function Ll(i){return Gc(i,xe,vu)}var Nl=En?function(i){return En.get(i)}:tp;function Vn(i){for(var r=i.name+"",a=Fi[r],l=X.call(Fi,r)?a.length:0;l--;){var c=a[l],m=c.func;if(m==null||m==i)return c.name}return r}function Ci(i){var r=X.call(u,"placeholder")?u:i;return r.placeholder}function x(){var i=u.iteratee||jl;return i=i===jl?Vc:i,arguments.length?i(arguments[0],arguments[1]):i}function qn(i,r){var a=i.__data__;return uy(r)?a[typeof r=="string"?"string":"hash"]:a.map}function Dl(i){for(var r=ce(i),a=r.length;a--;){var l=r[a],c=i[l];r[a]=[l,c,Pu(c)]}return r}function pi(i,r){var a=fh(i,r);return $c(a)?a:s}function ny(i){var r=X.call(i,ni),a=i[ni];try{i[ni]=s;var l=!0}catch{}var c=vn.call(i);return l&&(r?i[ni]=a:delete i[ni]),c}var Ul=ul?function(i){return i==null?[]:(i=Y(i),Dt(ul(i),function(r){return Sc.call(i,r)}))}:ip,vu=ul?function(i){for(var r=[];i;)Ut(r,Ul(i)),i=Pn(i);return r}:ip,ye=ve;(ml&&ye(new ml(new ArrayBuffer(1)))!=bi||Sr&&ye(new Sr)!=nt||dl&&ye(dl.resolve())!=Dp||Ri&&ye(new Ri)!=at||Tr&&ye(new Tr)!=Ir)&&(ye=function(i){var r=ve(i),a=r==Pt?i.constructor:s,l=a?ci(a):"";if(l)switch(l){case Gh:return bi;case kh:return nt;case $h:return Dp;case Vh:return at;case qh:return Ir}return r});function ay(i,r,a){for(var l=-1,c=a.length;++l<c;){var m=a[l],f=m.size;switch(m.type){case"drop":i+=f;break;case"dropRight":r-=f;break;case"take":r=ge(r,i+f);break;case"takeRight":i=le(i,r-f);break}}return{start:i,end:r}}function oy(i){var r=i.match(mf);return r?r[1].split(df):[]}function _u(i,r,a){r=qt(r,i);for(var l=-1,c=r.length,m=!1;++l<c;){var f=ht(r[l]);if(!(m=i!=null&&a(i,f)))break;i=i[f]}return m||++l!=c?m:(c=i==null?0:i.length,!!c&&Jn(c)&&Ct(f,c)&&(L(i)||ui(i)))}function sy(i){var r=i.length,a=new i.constructor(r);return r&&typeof i[0]=="string"&&X.call(i,"index")&&(a.index=i.index,a.input=i.input),a}function Iu(i){return typeof i.constructor=="function"&&!Dr(i)?Si(Pn(i)):{}}function ly(i,r,a){var l=i.constructor;switch(r){case Pr:return xl(i);case Mr:case br:return new l(+i);case bi:return Wg(i,a);case Ds:case Us:case Hs:case Gs:case ks:case $s:case Vs:case qs:case Ws:return au(i,a);case nt:return new l;case wr:case _r:return new l(i);case vr:return Kg(i);case at:return new l;case un:return Xg(i)}}function py(i,r){var a=r.length;if(!a)return i;var l=a-1;return r[l]=(a>1?"& ":"")+r[l],r=r.join(a>2?", ":" "),i.replace(uf,`{
1
+ var xv=Object.create;var np=Object.defineProperty;var Ov=Object.getOwnPropertyDescriptor;var Bv=Object.getOwnPropertyNames;var Lv=Object.getPrototypeOf,Nv=Object.prototype.hasOwnProperty;var Dv=s=>np(s,"__esModule",{value:!0});var K=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var Uv=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Bv(e))!Nv.call(s,o)&&(t||o!=="default")&&np(s,o,{get:()=>e[o],enumerable:!(n=Ov(e,o))||n.enumerable});return s},dm=(s,e)=>Uv(Dv(np(s!=null?xv(Lv(s)):{},"default",!e&&s&&s.__esModule?{get:()=>s.default,enumerable:!0}:{value:s,enumerable:!0})),s);var fm=K((Oi,Hr)=>{(function(){var s,e="4.17.21",t=200,n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",p="Invalid `variable` option passed into `_.template`",d="__lodash_hash_undefined__",y=500,g="__lodash_placeholder__",w=1,v=2,S=4,B=1,Fe=2,we=1,ct=2,Se=4,ue=8,Te=16,We=32,ut=64,It=128,yr=256,Ns=512,Nd=30,Dd="...",Ud=800,Gd=16,Lp=1,Hd=2,kd=3,ii=1/0,D=9007199254740991,$d=17976931348623157e292,sn=0/0,mt=4294967295,Vd=mt-1,qd=mt>>>1,Wd=[["ary",It],["bind",we],["bindKey",ct],["curry",ue],["curryRight",Te],["flip",Ns],["partial",We],["partialRight",ut],["rearg",yr]],Mi="[object Arguments]",ln="[object Array]",Kd="[object AsyncFunction]",Mr="[object Boolean]",br="[object Date]",Xd="[object DOMException]",pn="[object Error]",cn="[object Function]",Np="[object GeneratorFunction]",nt="[object Map]",wr="[object Number]",Yd="[object Null]",Pt="[object Object]",Dp="[object Promise]",Qd="[object Proxy]",vr="[object RegExp]",at="[object Set]",_r="[object String]",un="[object Symbol]",zd="[object Undefined]",Ir="[object WeakMap]",Jd="[object WeakSet]",Pr="[object ArrayBuffer]",bi="[object DataView]",Ds="[object Float32Array]",Us="[object Float64Array]",Gs="[object Int8Array]",Hs="[object Int16Array]",ks="[object Int32Array]",$s="[object Uint8Array]",Vs="[object Uint8ClampedArray]",qs="[object Uint16Array]",Ws="[object Uint32Array]",Zd=/\b__p \+= '';/g,jd=/\b(__p \+=) '' \+/g,ef=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Up=/&(?:amp|lt|gt|quot|#39);/g,Gp=/[&<>"']/g,tf=RegExp(Up.source),rf=RegExp(Gp.source),nf=/<%-([\s\S]+?)%>/g,af=/<%([\s\S]+?)%>/g,Hp=/<%=([\s\S]+?)%>/g,of=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,sf=/^\w*$/,lf=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ks=/[\\^$.*+?()[\]{}|]/g,pf=RegExp(Ks.source),Xs=/^\s+/,cf=/\s/,uf=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,mf=/\{\n\/\* \[wrapped with (.+)\] \*/,df=/,? & /,ff=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,hf=/[()=,{}\[\]\/\s]/,gf=/\\(\\)?/g,yf=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,kp=/\w*$/,Mf=/^[-+]0x[0-9a-f]+$/i,bf=/^0b[01]+$/i,wf=/^\[object .+?Constructor\]$/,vf=/^0o[0-7]+$/i,_f=/^(?:0|[1-9]\d*)$/,If=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,mn=/($^)/,Pf=/['\n\r\u2028\u2029\\]/g,dn="\\ud800-\\udfff",Rf="\\u0300-\\u036f",Ff="\\ufe20-\\ufe2f",Sf="\\u20d0-\\u20ff",$p=Rf+Ff+Sf,Vp="\\u2700-\\u27bf",qp="a-z\\xdf-\\xf6\\xf8-\\xff",Tf="\\xac\\xb1\\xd7\\xf7",Ef="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Cf="\\u2000-\\u206f",Af=" \\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",Wp="A-Z\\xc0-\\xd6\\xd8-\\xde",Kp="\\ufe0e\\ufe0f",Xp=Tf+Ef+Cf+Af,Ys="['\u2019]",xf="["+dn+"]",Yp="["+Xp+"]",fn="["+$p+"]",Qp="\\d+",Of="["+Vp+"]",zp="["+qp+"]",Jp="[^"+dn+Xp+Qp+Vp+qp+Wp+"]",Qs="\\ud83c[\\udffb-\\udfff]",Bf="(?:"+fn+"|"+Qs+")",Zp="[^"+dn+"]",zs="(?:\\ud83c[\\udde6-\\uddff]){2}",Js="[\\ud800-\\udbff][\\udc00-\\udfff]",wi="["+Wp+"]",jp="\\u200d",ec="(?:"+zp+"|"+Jp+")",Lf="(?:"+wi+"|"+Jp+")",tc="(?:"+Ys+"(?:d|ll|m|re|s|t|ve))?",ic="(?:"+Ys+"(?:D|LL|M|RE|S|T|VE))?",rc=Bf+"?",nc="["+Kp+"]?",Nf="(?:"+jp+"(?:"+[Zp,zs,Js].join("|")+")"+nc+rc+")*",Df="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Uf="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ac=nc+rc+Nf,Gf="(?:"+[Of,zs,Js].join("|")+")"+ac,Hf="(?:"+[Zp+fn+"?",fn,zs,Js,xf].join("|")+")",kf=RegExp(Ys,"g"),$f=RegExp(fn,"g"),Zs=RegExp(Qs+"(?="+Qs+")|"+Hf+ac,"g"),Vf=RegExp([wi+"?"+zp+"+"+tc+"(?="+[Yp,wi,"$"].join("|")+")",Lf+"+"+ic+"(?="+[Yp,wi+ec,"$"].join("|")+")",wi+"?"+ec+"+"+tc,wi+"+"+ic,Uf,Df,Qp,Gf].join("|"),"g"),qf=RegExp("["+jp+dn+$p+Kp+"]"),Wf=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Kf=["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"],Xf=-1,z={};z[Ds]=z[Us]=z[Gs]=z[Hs]=z[ks]=z[$s]=z[Vs]=z[qs]=z[Ws]=!0,z[Mi]=z[ln]=z[Pr]=z[Mr]=z[bi]=z[br]=z[pn]=z[cn]=z[nt]=z[wr]=z[Pt]=z[vr]=z[at]=z[_r]=z[Ir]=!1;var Q={};Q[Mi]=Q[ln]=Q[Pr]=Q[bi]=Q[Mr]=Q[br]=Q[Ds]=Q[Us]=Q[Gs]=Q[Hs]=Q[ks]=Q[nt]=Q[wr]=Q[Pt]=Q[vr]=Q[at]=Q[_r]=Q[un]=Q[$s]=Q[Vs]=Q[qs]=Q[Ws]=!0,Q[pn]=Q[cn]=Q[Ir]=!1;var Yf={\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"},Qf={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},zf={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Jf={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Zf=parseFloat,jf=parseInt,oc=typeof global=="object"&&global&&global.Object===Object&&global,eh=typeof self=="object"&&self&&self.Object===Object&&self,pe=oc||eh||Function("return this")(),js=typeof Oi=="object"&&Oi&&!Oi.nodeType&&Oi,ri=js&&typeof Hr=="object"&&Hr&&!Hr.nodeType&&Hr,sc=ri&&ri.exports===js,el=sc&&oc.process,Ke=function(){try{var M=ri&&ri.require&&ri.require("util").types;return M||el&&el.binding&&el.binding("util")}catch{}}(),lc=Ke&&Ke.isArrayBuffer,pc=Ke&&Ke.isDate,cc=Ke&&Ke.isMap,uc=Ke&&Ke.isRegExp,mc=Ke&&Ke.isSet,dc=Ke&&Ke.isTypedArray;function De(M,I,_){switch(_.length){case 0:return M.call(I);case 1:return M.call(I,_[0]);case 2:return M.call(I,_[0],_[1]);case 3:return M.call(I,_[0],_[1],_[2])}return M.apply(I,_)}function th(M,I,_,E){for(var L=-1,q=M==null?0:M.length;++L<q;){var se=M[L];I(E,se,_(se),M)}return E}function Xe(M,I){for(var _=-1,E=M==null?0:M.length;++_<E&&I(M[_],_,M)!==!1;);return M}function ih(M,I){for(var _=M==null?0:M.length;_--&&I(M[_],_,M)!==!1;);return M}function fc(M,I){for(var _=-1,E=M==null?0:M.length;++_<E;)if(!I(M[_],_,M))return!1;return!0}function Dt(M,I){for(var _=-1,E=M==null?0:M.length,L=0,q=[];++_<E;){var se=M[_];I(se,_,M)&&(q[L++]=se)}return q}function hn(M,I){var _=M==null?0:M.length;return!!_&&vi(M,I,0)>-1}function tl(M,I,_){for(var E=-1,L=M==null?0:M.length;++E<L;)if(_(I,M[E]))return!0;return!1}function J(M,I){for(var _=-1,E=M==null?0:M.length,L=Array(E);++_<E;)L[_]=I(M[_],_,M);return L}function Ut(M,I){for(var _=-1,E=I.length,L=M.length;++_<E;)M[L+_]=I[_];return M}function il(M,I,_,E){var L=-1,q=M==null?0:M.length;for(E&&q&&(_=M[++L]);++L<q;)_=I(_,M[L],L,M);return _}function rh(M,I,_,E){var L=M==null?0:M.length;for(E&&L&&(_=M[--L]);L--;)_=I(_,M[L],L,M);return _}function rl(M,I){for(var _=-1,E=M==null?0:M.length;++_<E;)if(I(M[_],_,M))return!0;return!1}var nh=nl("length");function ah(M){return M.split("")}function oh(M){return M.match(ff)||[]}function hc(M,I,_){var E;return _(M,function(L,q,se){if(I(L,q,se))return E=q,!1}),E}function gn(M,I,_,E){for(var L=M.length,q=_+(E?1:-1);E?q--:++q<L;)if(I(M[q],q,M))return q;return-1}function vi(M,I,_){return I===I?Mh(M,I,_):gn(M,gc,_)}function sh(M,I,_,E){for(var L=_-1,q=M.length;++L<q;)if(E(M[L],I))return L;return-1}function gc(M){return M!==M}function yc(M,I){var _=M==null?0:M.length;return _?ol(M,I)/_:sn}function nl(M){return function(I){return I==null?s:I[M]}}function al(M){return function(I){return M==null?s:M[I]}}function Mc(M,I,_,E,L){return L(M,function(q,se,Y){_=E?(E=!1,q):I(_,q,se,Y)}),_}function lh(M,I){var _=M.length;for(M.sort(I);_--;)M[_]=M[_].value;return M}function ol(M,I){for(var _,E=-1,L=M.length;++E<L;){var q=I(M[E]);q!==s&&(_=_===s?q:_+q)}return _}function sl(M,I){for(var _=-1,E=Array(M);++_<M;)E[_]=I(_);return E}function ph(M,I){return J(I,function(_){return[_,M[_]]})}function bc(M){return M&&M.slice(0,Ic(M)+1).replace(Xs,"")}function Ue(M){return function(I){return M(I)}}function ll(M,I){return J(I,function(_){return M[_]})}function Rr(M,I){return M.has(I)}function wc(M,I){for(var _=-1,E=M.length;++_<E&&vi(I,M[_],0)>-1;);return _}function vc(M,I){for(var _=M.length;_--&&vi(I,M[_],0)>-1;);return _}function ch(M,I){for(var _=M.length,E=0;_--;)M[_]===I&&++E;return E}var uh=al(Yf),mh=al(Qf);function dh(M){return"\\"+Jf[M]}function fh(M,I){return M==null?s:M[I]}function _i(M){return qf.test(M)}function hh(M){return Wf.test(M)}function gh(M){for(var I,_=[];!(I=M.next()).done;)_.push(I.value);return _}function pl(M){var I=-1,_=Array(M.size);return M.forEach(function(E,L){_[++I]=[L,E]}),_}function _c(M,I){return function(_){return M(I(_))}}function Gt(M,I){for(var _=-1,E=M.length,L=0,q=[];++_<E;){var se=M[_];(se===I||se===g)&&(M[_]=g,q[L++]=_)}return q}function yn(M){var I=-1,_=Array(M.size);return M.forEach(function(E){_[++I]=E}),_}function yh(M){var I=-1,_=Array(M.size);return M.forEach(function(E){_[++I]=[E,E]}),_}function Mh(M,I,_){for(var E=_-1,L=M.length;++E<L;)if(M[E]===I)return E;return-1}function bh(M,I,_){for(var E=_+1;E--;)if(M[E]===I)return E;return E}function Ii(M){return _i(M)?vh(M):nh(M)}function ot(M){return _i(M)?_h(M):ah(M)}function Ic(M){for(var I=M.length;I--&&cf.test(M.charAt(I)););return I}var wh=al(zf);function vh(M){for(var I=Zs.lastIndex=0;Zs.test(M);)++I;return I}function _h(M){return M.match(Zs)||[]}function Ih(M){return M.match(Vf)||[]}var Ph=function M(I){I=I==null?pe:Ht.defaults(pe.Object(),I,Ht.pick(pe,Kf));var _=I.Array,E=I.Date,L=I.Error,q=I.Function,se=I.Math,Y=I.Object,cl=I.RegExp,Rh=I.String,Ye=I.TypeError,Mn=_.prototype,Fh=q.prototype,Pi=Y.prototype,bn=I["__core-js_shared__"],wn=Fh.toString,X=Pi.hasOwnProperty,Sh=0,Pc=function(){var i=/[^.]+$/.exec(bn&&bn.keys&&bn.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""}(),vn=Pi.toString,Th=wn.call(Y),Eh=pe._,Ch=cl("^"+wn.call(X).replace(Ks,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),_n=sc?I.Buffer:s,kt=I.Symbol,In=I.Uint8Array,Rc=_n?_n.allocUnsafe:s,Pn=_c(Y.getPrototypeOf,Y),Fc=Y.create,Sc=Pi.propertyIsEnumerable,Rn=Mn.splice,Tc=kt?kt.isConcatSpreadable:s,Fr=kt?kt.iterator:s,ni=kt?kt.toStringTag:s,Fn=function(){try{var i=pi(Y,"defineProperty");return i({},"",{}),i}catch{}}(),Ah=I.clearTimeout!==pe.clearTimeout&&I.clearTimeout,xh=E&&E.now!==pe.Date.now&&E.now,Oh=I.setTimeout!==pe.setTimeout&&I.setTimeout,Sn=se.ceil,Tn=se.floor,ul=Y.getOwnPropertySymbols,Bh=_n?_n.isBuffer:s,Ec=I.isFinite,Lh=Mn.join,Nh=_c(Y.keys,Y),le=se.max,ge=se.min,Dh=E.now,Uh=I.parseInt,Cc=se.random,Gh=Mn.reverse,ml=pi(I,"DataView"),Sr=pi(I,"Map"),dl=pi(I,"Promise"),Ri=pi(I,"Set"),Tr=pi(I,"WeakMap"),Er=pi(Y,"create"),En=Tr&&new Tr,Fi={},Hh=ci(ml),kh=ci(Sr),$h=ci(dl),Vh=ci(Ri),qh=ci(Tr),Cn=kt?kt.prototype:s,Cr=Cn?Cn.valueOf:s,Ac=Cn?Cn.toString:s;function u(i){if(ee(i)&&!N(i)&&!(i instanceof $)){if(i instanceof Qe)return i;if(X.call(i,"__wrapped__"))return xu(i)}return new Qe(i)}var Si=function(){function i(){}return function(r){if(!Z(r))return{};if(Fc)return Fc(r);i.prototype=r;var a=new i;return i.prototype=s,a}}();function An(){}function Qe(i,r){this.__wrapped__=i,this.__actions__=[],this.__chain__=!!r,this.__index__=0,this.__values__=s}u.templateSettings={escape:nf,evaluate:af,interpolate:Hp,variable:"",imports:{_:u}},u.prototype=An.prototype,u.prototype.constructor=u,Qe.prototype=Si(An.prototype),Qe.prototype.constructor=Qe;function $(i){this.__wrapped__=i,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=mt,this.__views__=[]}function Wh(){var i=new $(this.__wrapped__);return i.__actions__=Ee(this.__actions__),i.__dir__=this.__dir__,i.__filtered__=this.__filtered__,i.__iteratees__=Ee(this.__iteratees__),i.__takeCount__=this.__takeCount__,i.__views__=Ee(this.__views__),i}function Kh(){if(this.__filtered__){var i=new $(this);i.__dir__=-1,i.__filtered__=!0}else i=this.clone(),i.__dir__*=-1;return i}function Xh(){var i=this.__wrapped__.value(),r=this.__dir__,a=N(i),l=r<0,c=a?i.length:0,m=ay(0,c,this.__views__),f=m.start,h=m.end,b=h-f,P=l?h:f-1,R=this.__iteratees__,F=R.length,T=0,C=ge(b,this.__takeCount__);if(!a||!l&&c==b&&C==b)return tu(i,this.__actions__);var x=[];e:for(;b--&&T<C;){P+=r;for(var G=-1,O=i[P];++G<F;){var k=R[G],V=k.iteratee,ke=k.type,Ie=V(O);if(ke==Hd)O=Ie;else if(!Ie){if(ke==Lp)continue e;break e}}x[T++]=O}return x}$.prototype=Si(An.prototype),$.prototype.constructor=$;function ai(i){var r=-1,a=i==null?0:i.length;for(this.clear();++r<a;){var l=i[r];this.set(l[0],l[1])}}function Yh(){this.__data__=Er?Er(null):{},this.size=0}function Qh(i){var r=this.has(i)&&delete this.__data__[i];return this.size-=r?1:0,r}function zh(i){var r=this.__data__;if(Er){var a=r[i];return a===d?s:a}return X.call(r,i)?r[i]:s}function Jh(i){var r=this.__data__;return Er?r[i]!==s:X.call(r,i)}function Zh(i,r){var a=this.__data__;return this.size+=this.has(i)?0:1,a[i]=Er&&r===s?d:r,this}ai.prototype.clear=Yh,ai.prototype.delete=Qh,ai.prototype.get=zh,ai.prototype.has=Jh,ai.prototype.set=Zh;function Rt(i){var r=-1,a=i==null?0:i.length;for(this.clear();++r<a;){var l=i[r];this.set(l[0],l[1])}}function jh(){this.__data__=[],this.size=0}function eg(i){var r=this.__data__,a=xn(r,i);if(a<0)return!1;var l=r.length-1;return a==l?r.pop():Rn.call(r,a,1),--this.size,!0}function tg(i){var r=this.__data__,a=xn(r,i);return a<0?s:r[a][1]}function ig(i){return xn(this.__data__,i)>-1}function rg(i,r){var a=this.__data__,l=xn(a,i);return l<0?(++this.size,a.push([i,r])):a[l][1]=r,this}Rt.prototype.clear=jh,Rt.prototype.delete=eg,Rt.prototype.get=tg,Rt.prototype.has=ig,Rt.prototype.set=rg;function Ft(i){var r=-1,a=i==null?0:i.length;for(this.clear();++r<a;){var l=i[r];this.set(l[0],l[1])}}function ng(){this.size=0,this.__data__={hash:new ai,map:new(Sr||Rt),string:new ai}}function ag(i){var r=qn(this,i).delete(i);return this.size-=r?1:0,r}function og(i){return qn(this,i).get(i)}function sg(i){return qn(this,i).has(i)}function lg(i,r){var a=qn(this,i),l=a.size;return a.set(i,r),this.size+=a.size==l?0:1,this}Ft.prototype.clear=ng,Ft.prototype.delete=ag,Ft.prototype.get=og,Ft.prototype.has=sg,Ft.prototype.set=lg;function oi(i){var r=-1,a=i==null?0:i.length;for(this.__data__=new Ft;++r<a;)this.add(i[r])}function pg(i){return this.__data__.set(i,d),this}function cg(i){return this.__data__.has(i)}oi.prototype.add=oi.prototype.push=pg,oi.prototype.has=cg;function st(i){var r=this.__data__=new Rt(i);this.size=r.size}function ug(){this.__data__=new Rt,this.size=0}function mg(i){var r=this.__data__,a=r.delete(i);return this.size=r.size,a}function dg(i){return this.__data__.get(i)}function fg(i){return this.__data__.has(i)}function hg(i,r){var a=this.__data__;if(a instanceof Rt){var l=a.__data__;if(!Sr||l.length<t-1)return l.push([i,r]),this.size=++a.size,this;a=this.__data__=new Ft(l)}return a.set(i,r),this.size=a.size,this}st.prototype.clear=ug,st.prototype.delete=mg,st.prototype.get=dg,st.prototype.has=fg,st.prototype.set=hg;function xc(i,r){var a=N(i),l=!a&&ui(i),c=!a&&!l&&Kt(i),m=!a&&!l&&!c&&Ai(i),f=a||l||c||m,h=f?sl(i.length,Rh):[],b=h.length;for(var P in i)(r||X.call(i,P))&&!(f&&(P=="length"||c&&(P=="offset"||P=="parent")||m&&(P=="buffer"||P=="byteLength"||P=="byteOffset")||Ct(P,b)))&&h.push(P);return h}function Oc(i){var r=i.length;return r?i[Pl(0,r-1)]:s}function gg(i,r){return Wn(Ee(i),si(r,0,i.length))}function yg(i){return Wn(Ee(i))}function fl(i,r,a){(a!==s&&!lt(i[r],a)||a===s&&!(r in i))&&St(i,r,a)}function Ar(i,r,a){var l=i[r];(!(X.call(i,r)&&lt(l,a))||a===s&&!(r in i))&&St(i,r,a)}function xn(i,r){for(var a=i.length;a--;)if(lt(i[a][0],r))return a;return-1}function Mg(i,r,a,l){return $t(i,function(c,m,f){r(l,c,a(c),f)}),l}function Bc(i,r){return i&&ft(r,ce(r),i)}function bg(i,r){return i&&ft(r,Ae(r),i)}function St(i,r,a){r=="__proto__"&&Fn?Fn(i,r,{configurable:!0,enumerable:!0,value:a,writable:!0}):i[r]=a}function hl(i,r){for(var a=-1,l=r.length,c=_(l),m=i==null;++a<l;)c[a]=m?s:Ql(i,r[a]);return c}function si(i,r,a){return i===i&&(a!==s&&(i=i<=a?i:a),r!==s&&(i=i>=r?i:r)),i}function ze(i,r,a,l,c,m){var f,h=r&w,b=r&v,P=r&S;if(a&&(f=c?a(i,l,c,m):a(i)),f!==s)return f;if(!Z(i))return i;var R=N(i);if(R){if(f=sy(i),!h)return Ee(i,f)}else{var F=ye(i),T=F==cn||F==Np;if(Kt(i))return nu(i,h);if(F==Pt||F==Mi||T&&!c){if(f=b||T?{}:Iu(i),!h)return b?zg(i,bg(f,i)):Qg(i,Bc(f,i))}else{if(!Q[F])return c?i:{};f=ly(i,F,h)}}m||(m=new st);var C=m.get(i);if(C)return C;m.set(i,f),Zu(i)?i.forEach(function(O){f.add(ze(O,r,a,O,i,m))}):zu(i)&&i.forEach(function(O,k){f.set(k,ze(O,r,a,k,i,m))});var x=P?b?Ll:Bl:b?Ae:ce,G=R?s:x(i);return Xe(G||i,function(O,k){G&&(k=O,O=i[k]),Ar(f,k,ze(O,r,a,k,i,m))}),f}function wg(i){var r=ce(i);return function(a){return Lc(a,i,r)}}function Lc(i,r,a){var l=a.length;if(i==null)return!l;for(i=Y(i);l--;){var c=a[l],m=r[c],f=i[c];if(f===s&&!(c in i)||!m(f))return!1}return!0}function Nc(i,r,a){if(typeof i!="function")throw new Ye(o);return Ur(function(){i.apply(s,a)},r)}function xr(i,r,a,l){var c=-1,m=hn,f=!0,h=i.length,b=[],P=r.length;if(!h)return b;a&&(r=J(r,Ue(a))),l?(m=tl,f=!1):r.length>=t&&(m=Rr,f=!1,r=new oi(r));e:for(;++c<h;){var R=i[c],F=a==null?R:a(R);if(R=l||R!==0?R:0,f&&F===F){for(var T=P;T--;)if(r[T]===F)continue e;b.push(R)}else m(r,F,l)||b.push(R)}return b}var $t=pu(dt),Dc=pu(yl,!0);function vg(i,r){var a=!0;return $t(i,function(l,c,m){return a=!!r(l,c,m),a}),a}function On(i,r,a){for(var l=-1,c=i.length;++l<c;){var m=i[l],f=r(m);if(f!=null&&(h===s?f===f&&!He(f):a(f,h)))var h=f,b=m}return b}function _g(i,r,a,l){var c=i.length;for(a=U(a),a<0&&(a=-a>c?0:c+a),l=l===s||l>c?c:U(l),l<0&&(l+=c),l=a>l?0:em(l);a<l;)i[a++]=r;return i}function Uc(i,r){var a=[];return $t(i,function(l,c,m){r(l,c,m)&&a.push(l)}),a}function me(i,r,a,l,c){var m=-1,f=i.length;for(a||(a=cy),c||(c=[]);++m<f;){var h=i[m];r>0&&a(h)?r>1?me(h,r-1,a,l,c):Ut(c,h):l||(c[c.length]=h)}return c}var gl=cu(),Gc=cu(!0);function dt(i,r){return i&&gl(i,r,ce)}function yl(i,r){return i&&Gc(i,r,ce)}function Bn(i,r){return Dt(r,function(a){return At(i[a])})}function li(i,r){r=qt(r,i);for(var a=0,l=r.length;i!=null&&a<l;)i=i[ht(r[a++])];return a&&a==l?i:s}function Hc(i,r,a){var l=r(i);return N(i)?l:Ut(l,a(i))}function ve(i){return i==null?i===s?zd:Yd:ni&&ni in Y(i)?ny(i):yy(i)}function Ml(i,r){return i>r}function Ig(i,r){return i!=null&&X.call(i,r)}function Pg(i,r){return i!=null&&r in Y(i)}function Rg(i,r,a){return i>=ge(r,a)&&i<le(r,a)}function bl(i,r,a){for(var l=a?tl:hn,c=i[0].length,m=i.length,f=m,h=_(m),b=1/0,P=[];f--;){var R=i[f];f&&r&&(R=J(R,Ue(r))),b=ge(R.length,b),h[f]=!a&&(r||c>=120&&R.length>=120)?new oi(f&&R):s}R=i[0];var F=-1,T=h[0];e:for(;++F<c&&P.length<b;){var C=R[F],x=r?r(C):C;if(C=a||C!==0?C:0,!(T?Rr(T,x):l(P,x,a))){for(f=m;--f;){var G=h[f];if(!(G?Rr(G,x):l(i[f],x,a)))continue e}T&&T.push(x),P.push(C)}}return P}function Fg(i,r,a,l){return dt(i,function(c,m,f){r(l,a(c),m,f)}),l}function Or(i,r,a){r=qt(r,i),i=Su(i,r);var l=i==null?i:i[ht(Ze(r))];return l==null?s:De(l,i,a)}function kc(i){return ee(i)&&ve(i)==Mi}function Sg(i){return ee(i)&&ve(i)==Pr}function Tg(i){return ee(i)&&ve(i)==br}function Br(i,r,a,l,c){return i===r?!0:i==null||r==null||!ee(i)&&!ee(r)?i!==i&&r!==r:Eg(i,r,a,l,Br,c)}function Eg(i,r,a,l,c,m){var f=N(i),h=N(r),b=f?ln:ye(i),P=h?ln:ye(r);b=b==Mi?Pt:b,P=P==Mi?Pt:P;var R=b==Pt,F=P==Pt,T=b==P;if(T&&Kt(i)){if(!Kt(r))return!1;f=!0,R=!1}if(T&&!R)return m||(m=new st),f||Ai(i)?wu(i,r,a,l,c,m):iy(i,r,b,a,l,c,m);if(!(a&B)){var C=R&&X.call(i,"__wrapped__"),x=F&&X.call(r,"__wrapped__");if(C||x){var G=C?i.value():i,O=x?r.value():r;return m||(m=new st),c(G,O,a,l,m)}}return T?(m||(m=new st),ry(i,r,a,l,c,m)):!1}function Cg(i){return ee(i)&&ye(i)==nt}function wl(i,r,a,l){var c=a.length,m=c,f=!l;if(i==null)return!m;for(i=Y(i);c--;){var h=a[c];if(f&&h[2]?h[1]!==i[h[0]]:!(h[0]in i))return!1}for(;++c<m;){h=a[c];var b=h[0],P=i[b],R=h[1];if(f&&h[2]){if(P===s&&!(b in i))return!1}else{var F=new st;if(l)var T=l(P,R,b,i,r,F);if(!(T===s?Br(R,P,B|Fe,l,F):T))return!1}}return!0}function $c(i){if(!Z(i)||my(i))return!1;var r=At(i)?Ch:wf;return r.test(ci(i))}function Ag(i){return ee(i)&&ve(i)==vr}function xg(i){return ee(i)&&ye(i)==at}function Og(i){return ee(i)&&Jn(i.length)&&!!z[ve(i)]}function Vc(i){return typeof i=="function"?i:i==null?xe:typeof i=="object"?N(i)?Kc(i[0],i[1]):Wc(i):um(i)}function vl(i){if(!Dr(i))return Nh(i);var r=[];for(var a in Y(i))X.call(i,a)&&a!="constructor"&&r.push(a);return r}function Bg(i){if(!Z(i))return gy(i);var r=Dr(i),a=[];for(var l in i)l=="constructor"&&(r||!X.call(i,l))||a.push(l);return a}function _l(i,r){return i<r}function qc(i,r){var a=-1,l=Ce(i)?_(i.length):[];return $t(i,function(c,m,f){l[++a]=r(c,m,f)}),l}function Wc(i){var r=Dl(i);return r.length==1&&r[0][2]?Ru(r[0][0],r[0][1]):function(a){return a===i||wl(a,i,r)}}function Kc(i,r){return Gl(i)&&Pu(r)?Ru(ht(i),r):function(a){var l=Ql(a,i);return l===s&&l===r?zl(a,i):Br(r,l,B|Fe)}}function Ln(i,r,a,l,c){i!==r&&gl(r,function(m,f){if(c||(c=new st),Z(m))Lg(i,r,f,a,Ln,l,c);else{var h=l?l(kl(i,f),m,f+"",i,r,c):s;h===s&&(h=m),fl(i,f,h)}},Ae)}function Lg(i,r,a,l,c,m,f){var h=kl(i,a),b=kl(r,a),P=f.get(b);if(P){fl(i,a,P);return}var R=m?m(h,b,a+"",i,r,f):s,F=R===s;if(F){var T=N(b),C=!T&&Kt(b),x=!T&&!C&&Ai(b);R=b,T||C||x?N(h)?R=h:te(h)?R=Ee(h):C?(F=!1,R=nu(b,!0)):x?(F=!1,R=au(b,!0)):R=[]:Gr(b)||ui(b)?(R=h,ui(h)?R=tm(h):(!Z(h)||At(h))&&(R=Iu(b))):F=!1}F&&(f.set(b,R),c(R,b,l,m,f),f.delete(b)),fl(i,a,R)}function Xc(i,r){var a=i.length;if(!!a)return r+=r<0?a:0,Ct(r,a)?i[r]:s}function Yc(i,r,a){r.length?r=J(r,function(m){return N(m)?function(f){return li(f,m.length===1?m[0]:m)}:m}):r=[xe];var l=-1;r=J(r,Ue(A()));var c=qc(i,function(m,f,h){var b=J(r,function(P){return P(m)});return{criteria:b,index:++l,value:m}});return lh(c,function(m,f){return Yg(m,f,a)})}function Ng(i,r){return Qc(i,r,function(a,l){return zl(i,l)})}function Qc(i,r,a){for(var l=-1,c=r.length,m={};++l<c;){var f=r[l],h=li(i,f);a(h,f)&&Lr(m,qt(f,i),h)}return m}function Dg(i){return function(r){return li(r,i)}}function Il(i,r,a,l){var c=l?sh:vi,m=-1,f=r.length,h=i;for(i===r&&(r=Ee(r)),a&&(h=J(i,Ue(a)));++m<f;)for(var b=0,P=r[m],R=a?a(P):P;(b=c(h,R,b,l))>-1;)h!==i&&Rn.call(h,b,1),Rn.call(i,b,1);return i}function zc(i,r){for(var a=i?r.length:0,l=a-1;a--;){var c=r[a];if(a==l||c!==m){var m=c;Ct(c)?Rn.call(i,c,1):Sl(i,c)}}return i}function Pl(i,r){return i+Tn(Cc()*(r-i+1))}function Ug(i,r,a,l){for(var c=-1,m=le(Sn((r-i)/(a||1)),0),f=_(m);m--;)f[l?m:++c]=i,i+=a;return f}function Rl(i,r){var a="";if(!i||r<1||r>D)return a;do r%2&&(a+=i),r=Tn(r/2),r&&(i+=i);while(r);return a}function H(i,r){return $l(Fu(i,r,xe),i+"")}function Gg(i){return Oc(xi(i))}function Hg(i,r){var a=xi(i);return Wn(a,si(r,0,a.length))}function Lr(i,r,a,l){if(!Z(i))return i;r=qt(r,i);for(var c=-1,m=r.length,f=m-1,h=i;h!=null&&++c<m;){var b=ht(r[c]),P=a;if(b==="__proto__"||b==="constructor"||b==="prototype")return i;if(c!=f){var R=h[b];P=l?l(R,b,h):s,P===s&&(P=Z(R)?R:Ct(r[c+1])?[]:{})}Ar(h,b,P),h=h[b]}return i}var Jc=En?function(i,r){return En.set(i,r),i}:xe,kg=Fn?function(i,r){return Fn(i,"toString",{configurable:!0,enumerable:!1,value:Zl(r),writable:!0})}:xe;function $g(i){return Wn(xi(i))}function Je(i,r,a){var l=-1,c=i.length;r<0&&(r=-r>c?0:c+r),a=a>c?c:a,a<0&&(a+=c),c=r>a?0:a-r>>>0,r>>>=0;for(var m=_(c);++l<c;)m[l]=i[l+r];return m}function Vg(i,r){var a;return $t(i,function(l,c,m){return a=r(l,c,m),!a}),!!a}function Nn(i,r,a){var l=0,c=i==null?l:i.length;if(typeof r=="number"&&r===r&&c<=qd){for(;l<c;){var m=l+c>>>1,f=i[m];f!==null&&!He(f)&&(a?f<=r:f<r)?l=m+1:c=m}return c}return Fl(i,r,xe,a)}function Fl(i,r,a,l){var c=0,m=i==null?0:i.length;if(m===0)return 0;r=a(r);for(var f=r!==r,h=r===null,b=He(r),P=r===s;c<m;){var R=Tn((c+m)/2),F=a(i[R]),T=F!==s,C=F===null,x=F===F,G=He(F);if(f)var O=l||x;else P?O=x&&(l||T):h?O=x&&T&&(l||!C):b?O=x&&T&&!C&&(l||!G):C||G?O=!1:O=l?F<=r:F<r;O?c=R+1:m=R}return ge(m,Vd)}function Zc(i,r){for(var a=-1,l=i.length,c=0,m=[];++a<l;){var f=i[a],h=r?r(f):f;if(!a||!lt(h,b)){var b=h;m[c++]=f===0?0:f}}return m}function jc(i){return typeof i=="number"?i:He(i)?sn:+i}function Ge(i){if(typeof i=="string")return i;if(N(i))return J(i,Ge)+"";if(He(i))return Ac?Ac.call(i):"";var r=i+"";return r=="0"&&1/i==-ii?"-0":r}function Vt(i,r,a){var l=-1,c=hn,m=i.length,f=!0,h=[],b=h;if(a)f=!1,c=tl;else if(m>=t){var P=r?null:ey(i);if(P)return yn(P);f=!1,c=Rr,b=new oi}else b=r?[]:h;e:for(;++l<m;){var R=i[l],F=r?r(R):R;if(R=a||R!==0?R:0,f&&F===F){for(var T=b.length;T--;)if(b[T]===F)continue e;r&&b.push(F),h.push(R)}else c(b,F,a)||(b!==h&&b.push(F),h.push(R))}return h}function Sl(i,r){return r=qt(r,i),i=Su(i,r),i==null||delete i[ht(Ze(r))]}function eu(i,r,a,l){return Lr(i,r,a(li(i,r)),l)}function Dn(i,r,a,l){for(var c=i.length,m=l?c:-1;(l?m--:++m<c)&&r(i[m],m,i););return a?Je(i,l?0:m,l?m+1:c):Je(i,l?m+1:0,l?c:m)}function tu(i,r){var a=i;return a instanceof $&&(a=a.value()),il(r,function(l,c){return c.func.apply(c.thisArg,Ut([l],c.args))},a)}function Tl(i,r,a){var l=i.length;if(l<2)return l?Vt(i[0]):[];for(var c=-1,m=_(l);++c<l;)for(var f=i[c],h=-1;++h<l;)h!=c&&(m[c]=xr(m[c]||f,i[h],r,a));return Vt(me(m,1),r,a)}function iu(i,r,a){for(var l=-1,c=i.length,m=r.length,f={};++l<c;){var h=l<m?r[l]:s;a(f,i[l],h)}return f}function El(i){return te(i)?i:[]}function Cl(i){return typeof i=="function"?i:xe}function qt(i,r){return N(i)?i:Gl(i,r)?[i]:Au(W(i))}var qg=H;function Wt(i,r,a){var l=i.length;return a=a===s?l:a,!r&&a>=l?i:Je(i,r,a)}var ru=Ah||function(i){return pe.clearTimeout(i)};function nu(i,r){if(r)return i.slice();var a=i.length,l=Rc?Rc(a):new i.constructor(a);return i.copy(l),l}function Al(i){var r=new i.constructor(i.byteLength);return new In(r).set(new In(i)),r}function Wg(i,r){var a=r?Al(i.buffer):i.buffer;return new i.constructor(a,i.byteOffset,i.byteLength)}function Kg(i){var r=new i.constructor(i.source,kp.exec(i));return r.lastIndex=i.lastIndex,r}function Xg(i){return Cr?Y(Cr.call(i)):{}}function au(i,r){var a=r?Al(i.buffer):i.buffer;return new i.constructor(a,i.byteOffset,i.length)}function ou(i,r){if(i!==r){var a=i!==s,l=i===null,c=i===i,m=He(i),f=r!==s,h=r===null,b=r===r,P=He(r);if(!h&&!P&&!m&&i>r||m&&f&&b&&!h&&!P||l&&f&&b||!a&&b||!c)return 1;if(!l&&!m&&!P&&i<r||P&&a&&c&&!l&&!m||h&&a&&c||!f&&c||!b)return-1}return 0}function Yg(i,r,a){for(var l=-1,c=i.criteria,m=r.criteria,f=c.length,h=a.length;++l<f;){var b=ou(c[l],m[l]);if(b){if(l>=h)return b;var P=a[l];return b*(P=="desc"?-1:1)}}return i.index-r.index}function su(i,r,a,l){for(var c=-1,m=i.length,f=a.length,h=-1,b=r.length,P=le(m-f,0),R=_(b+P),F=!l;++h<b;)R[h]=r[h];for(;++c<f;)(F||c<m)&&(R[a[c]]=i[c]);for(;P--;)R[h++]=i[c++];return R}function lu(i,r,a,l){for(var c=-1,m=i.length,f=-1,h=a.length,b=-1,P=r.length,R=le(m-h,0),F=_(R+P),T=!l;++c<R;)F[c]=i[c];for(var C=c;++b<P;)F[C+b]=r[b];for(;++f<h;)(T||c<m)&&(F[C+a[f]]=i[c++]);return F}function Ee(i,r){var a=-1,l=i.length;for(r||(r=_(l));++a<l;)r[a]=i[a];return r}function ft(i,r,a,l){var c=!a;a||(a={});for(var m=-1,f=r.length;++m<f;){var h=r[m],b=l?l(a[h],i[h],h,a,i):s;b===s&&(b=i[h]),c?St(a,h,b):Ar(a,h,b)}return a}function Qg(i,r){return ft(i,Ul(i),r)}function zg(i,r){return ft(i,vu(i),r)}function Un(i,r){return function(a,l){var c=N(a)?th:Mg,m=r?r():{};return c(a,i,A(l,2),m)}}function Ti(i){return H(function(r,a){var l=-1,c=a.length,m=c>1?a[c-1]:s,f=c>2?a[2]:s;for(m=i.length>3&&typeof m=="function"?(c--,m):s,f&&_e(a[0],a[1],f)&&(m=c<3?s:m,c=1),r=Y(r);++l<c;){var h=a[l];h&&i(r,h,l,m)}return r})}function pu(i,r){return function(a,l){if(a==null)return a;if(!Ce(a))return i(a,l);for(var c=a.length,m=r?c:-1,f=Y(a);(r?m--:++m<c)&&l(f[m],m,f)!==!1;);return a}}function cu(i){return function(r,a,l){for(var c=-1,m=Y(r),f=l(r),h=f.length;h--;){var b=f[i?h:++c];if(a(m[b],b,m)===!1)break}return r}}function Jg(i,r,a){var l=r&we,c=Nr(i);function m(){var f=this&&this!==pe&&this instanceof m?c:i;return f.apply(l?a:this,arguments)}return m}function uu(i){return function(r){r=W(r);var a=_i(r)?ot(r):s,l=a?a[0]:r.charAt(0),c=a?Wt(a,1).join(""):r.slice(1);return l[i]()+c}}function Ei(i){return function(r){return il(pm(lm(r).replace(kf,"")),i,"")}}function Nr(i){return function(){var r=arguments;switch(r.length){case 0:return new i;case 1:return new i(r[0]);case 2:return new i(r[0],r[1]);case 3:return new i(r[0],r[1],r[2]);case 4:return new i(r[0],r[1],r[2],r[3]);case 5:return new i(r[0],r[1],r[2],r[3],r[4]);case 6:return new i(r[0],r[1],r[2],r[3],r[4],r[5]);case 7:return new i(r[0],r[1],r[2],r[3],r[4],r[5],r[6])}var a=Si(i.prototype),l=i.apply(a,r);return Z(l)?l:a}}function Zg(i,r,a){var l=Nr(i);function c(){for(var m=arguments.length,f=_(m),h=m,b=Ci(c);h--;)f[h]=arguments[h];var P=m<3&&f[0]!==b&&f[m-1]!==b?[]:Gt(f,b);if(m-=P.length,m<a)return gu(i,r,Gn,c.placeholder,s,f,P,s,s,a-m);var R=this&&this!==pe&&this instanceof c?l:i;return De(R,this,f)}return c}function mu(i){return function(r,a,l){var c=Y(r);if(!Ce(r)){var m=A(a,3);r=ce(r),a=function(h){return m(c[h],h,c)}}var f=i(r,a,l);return f>-1?c[m?r[f]:f]:s}}function du(i){return Et(function(r){var a=r.length,l=a,c=Qe.prototype.thru;for(i&&r.reverse();l--;){var m=r[l];if(typeof m!="function")throw new Ye(o);if(c&&!f&&Vn(m)=="wrapper")var f=new Qe([],!0)}for(l=f?l:a;++l<a;){m=r[l];var h=Vn(m),b=h=="wrapper"?Nl(m):s;b&&Hl(b[0])&&b[1]==(It|ue|We|yr)&&!b[4].length&&b[9]==1?f=f[Vn(b[0])].apply(f,b[3]):f=m.length==1&&Hl(m)?f[h]():f.thru(m)}return function(){var P=arguments,R=P[0];if(f&&P.length==1&&N(R))return f.plant(R).value();for(var F=0,T=a?r[F].apply(this,P):R;++F<a;)T=r[F].call(this,T);return T}})}function Gn(i,r,a,l,c,m,f,h,b,P){var R=r&It,F=r&we,T=r&ct,C=r&(ue|Te),x=r&Ns,G=T?s:Nr(i);function O(){for(var k=arguments.length,V=_(k),ke=k;ke--;)V[ke]=arguments[ke];if(C)var Ie=Ci(O),$e=ch(V,Ie);if(l&&(V=su(V,l,c,C)),m&&(V=lu(V,m,f,C)),k-=$e,C&&k<P){var ie=Gt(V,Ie);return gu(i,r,Gn,O.placeholder,a,V,ie,h,b,P-k)}var pt=F?a:this,Ot=T?pt[i]:i;return k=V.length,h?V=My(V,h):x&&k>1&&V.reverse(),R&&b<k&&(V.length=b),this&&this!==pe&&this instanceof O&&(Ot=G||Nr(Ot)),Ot.apply(pt,V)}return O}function fu(i,r){return function(a,l){return Fg(a,i,r(l),{})}}function Hn(i,r){return function(a,l){var c;if(a===s&&l===s)return r;if(a!==s&&(c=a),l!==s){if(c===s)return l;typeof a=="string"||typeof l=="string"?(a=Ge(a),l=Ge(l)):(a=jc(a),l=jc(l)),c=i(a,l)}return c}}function xl(i){return Et(function(r){return r=J(r,Ue(A())),H(function(a){var l=this;return i(r,function(c){return De(c,l,a)})})})}function kn(i,r){r=r===s?" ":Ge(r);var a=r.length;if(a<2)return a?Rl(r,i):r;var l=Rl(r,Sn(i/Ii(r)));return _i(r)?Wt(ot(l),0,i).join(""):l.slice(0,i)}function jg(i,r,a,l){var c=r&we,m=Nr(i);function f(){for(var h=-1,b=arguments.length,P=-1,R=l.length,F=_(R+b),T=this&&this!==pe&&this instanceof f?m:i;++P<R;)F[P]=l[P];for(;b--;)F[P++]=arguments[++h];return De(T,c?a:this,F)}return f}function hu(i){return function(r,a,l){return l&&typeof l!="number"&&_e(r,a,l)&&(a=l=s),r=xt(r),a===s?(a=r,r=0):a=xt(a),l=l===s?r<a?1:-1:xt(l),Ug(r,a,l,i)}}function $n(i){return function(r,a){return typeof r=="string"&&typeof a=="string"||(r=je(r),a=je(a)),i(r,a)}}function gu(i,r,a,l,c,m,f,h,b,P){var R=r&ue,F=R?f:s,T=R?s:f,C=R?m:s,x=R?s:m;r|=R?We:ut,r&=~(R?ut:We),r&Se||(r&=~(we|ct));var G=[i,r,c,C,F,x,T,h,b,P],O=a.apply(s,G);return Hl(i)&&Tu(O,G),O.placeholder=l,Eu(O,i,r)}function Ol(i){var r=se[i];return function(a,l){if(a=je(a),l=l==null?0:ge(U(l),292),l&&Ec(a)){var c=(W(a)+"e").split("e"),m=r(c[0]+"e"+(+c[1]+l));return c=(W(m)+"e").split("e"),+(c[0]+"e"+(+c[1]-l))}return r(a)}}var ey=Ri&&1/yn(new Ri([,-0]))[1]==ii?function(i){return new Ri(i)}:tp;function yu(i){return function(r){var a=ye(r);return a==nt?pl(r):a==at?yh(r):ph(r,i(r))}}function Tt(i,r,a,l,c,m,f,h){var b=r&ct;if(!b&&typeof i!="function")throw new Ye(o);var P=l?l.length:0;if(P||(r&=~(We|ut),l=c=s),f=f===s?f:le(U(f),0),h=h===s?h:U(h),P-=c?c.length:0,r&ut){var R=l,F=c;l=c=s}var T=b?s:Nl(i),C=[i,r,a,l,c,R,F,m,f,h];if(T&&hy(C,T),i=C[0],r=C[1],a=C[2],l=C[3],c=C[4],h=C[9]=C[9]===s?b?0:i.length:le(C[9]-P,0),!h&&r&(ue|Te)&&(r&=~(ue|Te)),!r||r==we)var x=Jg(i,r,a);else r==ue||r==Te?x=Zg(i,r,h):(r==We||r==(we|We))&&!c.length?x=jg(i,r,a,l):x=Gn.apply(s,C);var G=T?Jc:Tu;return Eu(G(x,C),i,r)}function Mu(i,r,a,l){return i===s||lt(i,Pi[a])&&!X.call(l,a)?r:i}function bu(i,r,a,l,c,m){return Z(i)&&Z(r)&&(m.set(r,i),Ln(i,r,s,bu,m),m.delete(r)),i}function ty(i){return Gr(i)?s:i}function wu(i,r,a,l,c,m){var f=a&B,h=i.length,b=r.length;if(h!=b&&!(f&&b>h))return!1;var P=m.get(i),R=m.get(r);if(P&&R)return P==r&&R==i;var F=-1,T=!0,C=a&Fe?new oi:s;for(m.set(i,r),m.set(r,i);++F<h;){var x=i[F],G=r[F];if(l)var O=f?l(G,x,F,r,i,m):l(x,G,F,i,r,m);if(O!==s){if(O)continue;T=!1;break}if(C){if(!rl(r,function(k,V){if(!Rr(C,V)&&(x===k||c(x,k,a,l,m)))return C.push(V)})){T=!1;break}}else if(!(x===G||c(x,G,a,l,m))){T=!1;break}}return m.delete(i),m.delete(r),T}function iy(i,r,a,l,c,m,f){switch(a){case bi:if(i.byteLength!=r.byteLength||i.byteOffset!=r.byteOffset)return!1;i=i.buffer,r=r.buffer;case Pr:return!(i.byteLength!=r.byteLength||!m(new In(i),new In(r)));case Mr:case br:case wr:return lt(+i,+r);case pn:return i.name==r.name&&i.message==r.message;case vr:case _r:return i==r+"";case nt:var h=pl;case at:var b=l&B;if(h||(h=yn),i.size!=r.size&&!b)return!1;var P=f.get(i);if(P)return P==r;l|=Fe,f.set(i,r);var R=wu(h(i),h(r),l,c,m,f);return f.delete(i),R;case un:if(Cr)return Cr.call(i)==Cr.call(r)}return!1}function ry(i,r,a,l,c,m){var f=a&B,h=Bl(i),b=h.length,P=Bl(r),R=P.length;if(b!=R&&!f)return!1;for(var F=b;F--;){var T=h[F];if(!(f?T in r:X.call(r,T)))return!1}var C=m.get(i),x=m.get(r);if(C&&x)return C==r&&x==i;var G=!0;m.set(i,r),m.set(r,i);for(var O=f;++F<b;){T=h[F];var k=i[T],V=r[T];if(l)var ke=f?l(V,k,T,r,i,m):l(k,V,T,i,r,m);if(!(ke===s?k===V||c(k,V,a,l,m):ke)){G=!1;break}O||(O=T=="constructor")}if(G&&!O){var Ie=i.constructor,$e=r.constructor;Ie!=$e&&"constructor"in i&&"constructor"in r&&!(typeof Ie=="function"&&Ie instanceof Ie&&typeof $e=="function"&&$e instanceof $e)&&(G=!1)}return m.delete(i),m.delete(r),G}function Et(i){return $l(Fu(i,s,Lu),i+"")}function Bl(i){return Hc(i,ce,Ul)}function Ll(i){return Hc(i,Ae,vu)}var Nl=En?function(i){return En.get(i)}:tp;function Vn(i){for(var r=i.name+"",a=Fi[r],l=X.call(Fi,r)?a.length:0;l--;){var c=a[l],m=c.func;if(m==null||m==i)return c.name}return r}function Ci(i){var r=X.call(u,"placeholder")?u:i;return r.placeholder}function A(){var i=u.iteratee||jl;return i=i===jl?Vc:i,arguments.length?i(arguments[0],arguments[1]):i}function qn(i,r){var a=i.__data__;return uy(r)?a[typeof r=="string"?"string":"hash"]:a.map}function Dl(i){for(var r=ce(i),a=r.length;a--;){var l=r[a],c=i[l];r[a]=[l,c,Pu(c)]}return r}function pi(i,r){var a=fh(i,r);return $c(a)?a:s}function ny(i){var r=X.call(i,ni),a=i[ni];try{i[ni]=s;var l=!0}catch{}var c=vn.call(i);return l&&(r?i[ni]=a:delete i[ni]),c}var Ul=ul?function(i){return i==null?[]:(i=Y(i),Dt(ul(i),function(r){return Sc.call(i,r)}))}:ip,vu=ul?function(i){for(var r=[];i;)Ut(r,Ul(i)),i=Pn(i);return r}:ip,ye=ve;(ml&&ye(new ml(new ArrayBuffer(1)))!=bi||Sr&&ye(new Sr)!=nt||dl&&ye(dl.resolve())!=Dp||Ri&&ye(new Ri)!=at||Tr&&ye(new Tr)!=Ir)&&(ye=function(i){var r=ve(i),a=r==Pt?i.constructor:s,l=a?ci(a):"";if(l)switch(l){case Hh:return bi;case kh:return nt;case $h:return Dp;case Vh:return at;case qh:return Ir}return r});function ay(i,r,a){for(var l=-1,c=a.length;++l<c;){var m=a[l],f=m.size;switch(m.type){case"drop":i+=f;break;case"dropRight":r-=f;break;case"take":r=ge(r,i+f);break;case"takeRight":i=le(i,r-f);break}}return{start:i,end:r}}function oy(i){var r=i.match(mf);return r?r[1].split(df):[]}function _u(i,r,a){r=qt(r,i);for(var l=-1,c=r.length,m=!1;++l<c;){var f=ht(r[l]);if(!(m=i!=null&&a(i,f)))break;i=i[f]}return m||++l!=c?m:(c=i==null?0:i.length,!!c&&Jn(c)&&Ct(f,c)&&(N(i)||ui(i)))}function sy(i){var r=i.length,a=new i.constructor(r);return r&&typeof i[0]=="string"&&X.call(i,"index")&&(a.index=i.index,a.input=i.input),a}function Iu(i){return typeof i.constructor=="function"&&!Dr(i)?Si(Pn(i)):{}}function ly(i,r,a){var l=i.constructor;switch(r){case Pr:return Al(i);case Mr:case br:return new l(+i);case bi:return Wg(i,a);case Ds:case Us:case Gs:case Hs:case ks:case $s:case Vs:case qs:case Ws:return au(i,a);case nt:return new l;case wr:case _r:return new l(i);case vr:return Kg(i);case at:return new l;case un:return Xg(i)}}function py(i,r){var a=r.length;if(!a)return i;var l=a-1;return r[l]=(a>1?"& ":"")+r[l],r=r.join(a>2?", ":" "),i.replace(uf,`{
2
2
  /* [wrapped with `+r+`] */
3
- `)}function cy(i){return L(i)||ui(i)||!!(Tc&&i&&i[Tc])}function Ct(i,r){var a=typeof i;return r=r??N,!!r&&(a=="number"||a!="symbol"&&_f.test(i))&&i>-1&&i%1==0&&i<r}function _e(i,r,a){if(!Z(a))return!1;var l=typeof r;return(l=="number"?Ce(a)&&Ct(r,a.length):l=="string"&&r in a)?lt(a[r],i):!1}function Hl(i,r){if(L(i))return!1;var a=typeof i;return a=="number"||a=="symbol"||a=="boolean"||i==null||Ge(i)?!0:sf.test(i)||!of.test(i)||r!=null&&i in Y(r)}function uy(i){var r=typeof i;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?i!=="__proto__":i===null}function Gl(i){var r=Vn(i),a=u[r];if(typeof a!="function"||!(r in k.prototype))return!1;if(i===a)return!0;var l=Nl(a);return!!l&&i===l[0]}function my(i){return!!Pc&&Pc in i}var dy=bn?xt:rp;function Dr(i){var r=i&&i.constructor,a=typeof r=="function"&&r.prototype||Pi;return i===a}function Pu(i){return i===i&&!Z(i)}function Ru(i,r){return function(a){return a==null?!1:a[i]===r&&(r!==s||i in Y(a))}}function fy(i){var r=Qn(i,function(l){return a.size===y&&a.clear(),l}),a=r.cache;return r}function hy(i,r){var a=i[1],l=r[1],c=a|l,m=c<(we|ct|It),f=l==It&&a==ue||l==It&&a==yr&&i[7].length<=r[8]||l==(It|yr)&&r[7].length<=r[8]&&a==ue;if(!(m||f))return i;l&we&&(i[2]=r[2],c|=a&we?0:Se);var h=r[3];if(h){var b=i[3];i[3]=b?su(b,h,r[4]):h,i[4]=b?Ht(i[3],g):r[4]}return h=r[5],h&&(b=i[5],i[5]=b?lu(b,h,r[6]):h,i[6]=b?Ht(i[5],g):r[6]),h=r[7],h&&(i[7]=h),l&It&&(i[8]=i[8]==null?r[8]:ge(i[8],r[8])),i[9]==null&&(i[9]=r[9]),i[0]=r[0],i[1]=c,i}function gy(i){var r=[];if(i!=null)for(var a in Y(i))r.push(a);return r}function yy(i){return vn.call(i)}function Fu(i,r,a){return r=le(r===s?i.length-1:r,0),function(){for(var l=arguments,c=-1,m=le(l.length-r,0),f=_(m);++c<m;)f[c]=l[r+c];c=-1;for(var h=_(r+1);++c<r;)h[c]=l[c];return h[r]=a(f),De(i,this,h)}}function Su(i,r){return r.length<2?i:li(i,Je(r,0,-1))}function My(i,r){for(var a=i.length,l=ge(r.length,a),c=Ee(i);l--;){var m=r[l];i[l]=Ct(m,a)?c[m]:s}return i}function kl(i,r){if(!(r==="constructor"&&typeof i[r]=="function")&&r!="__proto__")return i[r]}var Tu=Cu(Jc),Ur=Oh||function(i,r){return pe.setTimeout(i,r)},$l=Cu(kg);function Eu(i,r,a){var l=r+"";return $l(i,py(l,by(oy(l),a)))}function Cu(i){var r=0,a=0;return function(){var l=Dh(),c=Hd-(l-a);if(a=l,c>0){if(++r>=Ud)return arguments[0]}else r=0;return i.apply(s,arguments)}}function Wn(i,r){var a=-1,l=i.length,c=l-1;for(r=r===s?l:r;++a<r;){var m=Pl(a,c),f=i[m];i[m]=i[a],i[a]=f}return i.length=r,i}var xu=fy(function(i){var r=[];return i.charCodeAt(0)===46&&r.push(""),i.replace(lf,function(a,l,c,m){r.push(c?m.replace(gf,"$1"):l||a)}),r});function ht(i){if(typeof i=="string"||Ge(i))return i;var r=i+"";return r=="0"&&1/i==-ii?"-0":r}function ci(i){if(i!=null){try{return wn.call(i)}catch{}try{return i+""}catch{}}return""}function by(i,r){return Xe(Wd,function(a){var l="_."+a[0];r&a[1]&&!hn(i,l)&&i.push(l)}),i.sort()}function Au(i){if(i instanceof k)return i.clone();var r=new Qe(i.__wrapped__,i.__chain__);return r.__actions__=Ee(i.__actions__),r.__index__=i.__index__,r.__values__=i.__values__,r}function wy(i,r,a){(a?_e(i,r,a):r===s)?r=1:r=le(D(r),0);var l=i==null?0:i.length;if(!l||r<1)return[];for(var c=0,m=0,f=_(Sn(l/r));c<l;)f[m++]=Je(i,c,c+=r);return f}function vy(i){for(var r=-1,a=i==null?0:i.length,l=0,c=[];++r<a;){var m=i[r];m&&(c[l++]=m)}return c}function _y(){var i=arguments.length;if(!i)return[];for(var r=_(i-1),a=arguments[0],l=i;l--;)r[l-1]=arguments[l];return Ut(L(a)?Ee(a):[a],me(r,1))}var Iy=H(function(i,r){return te(i)?Ar(i,me(r,1,te,!0)):[]}),Py=H(function(i,r){var a=Ze(r);return te(a)&&(a=s),te(i)?Ar(i,me(r,1,te,!0),x(a,2)):[]}),Ry=H(function(i,r){var a=Ze(r);return te(a)&&(a=s),te(i)?Ar(i,me(r,1,te,!0),s,a):[]});function Fy(i,r,a){var l=i==null?0:i.length;return l?(r=a||r===s?1:D(r),Je(i,r<0?0:r,l)):[]}function Sy(i,r,a){var l=i==null?0:i.length;return l?(r=a||r===s?1:D(r),r=l-r,Je(i,0,r<0?0:r)):[]}function Ty(i,r){return i&&i.length?Dn(i,x(r,3),!0,!0):[]}function Ey(i,r){return i&&i.length?Dn(i,x(r,3),!0):[]}function Cy(i,r,a,l){var c=i==null?0:i.length;return c?(a&&typeof a!="number"&&_e(i,r,a)&&(a=0,l=c),_g(i,r,a,l)):[]}function Ou(i,r,a){var l=i==null?0:i.length;if(!l)return-1;var c=a==null?0:D(a);return c<0&&(c=le(l+c,0)),gn(i,x(r,3),c)}function Bu(i,r,a){var l=i==null?0:i.length;if(!l)return-1;var c=l-1;return a!==s&&(c=D(a),c=a<0?le(l+c,0):ge(c,l-1)),gn(i,x(r,3),c,!0)}function Lu(i){var r=i==null?0:i.length;return r?me(i,1):[]}function xy(i){var r=i==null?0:i.length;return r?me(i,ii):[]}function Ay(i,r){var a=i==null?0:i.length;return a?(r=r===s?1:D(r),me(i,r)):[]}function Oy(i){for(var r=-1,a=i==null?0:i.length,l={};++r<a;){var c=i[r];l[c[0]]=c[1]}return l}function Nu(i){return i&&i.length?i[0]:s}function By(i,r,a){var l=i==null?0:i.length;if(!l)return-1;var c=a==null?0:D(a);return c<0&&(c=le(l+c,0)),vi(i,r,c)}function Ly(i){var r=i==null?0:i.length;return r?Je(i,0,-1):[]}var Ny=H(function(i){var r=J(i,El);return r.length&&r[0]===i[0]?bl(r):[]}),Dy=H(function(i){var r=Ze(i),a=J(i,El);return r===Ze(a)?r=s:a.pop(),a.length&&a[0]===i[0]?bl(a,x(r,2)):[]}),Uy=H(function(i){var r=Ze(i),a=J(i,El);return r=typeof r=="function"?r:s,r&&a.pop(),a.length&&a[0]===i[0]?bl(a,s,r):[]});function Hy(i,r){return i==null?"":Lh.call(i,r)}function Ze(i){var r=i==null?0:i.length;return r?i[r-1]:s}function Gy(i,r,a){var l=i==null?0:i.length;if(!l)return-1;var c=l;return a!==s&&(c=D(a),c=c<0?le(l+c,0):ge(c,l-1)),r===r?bh(i,r,c):gn(i,gc,c,!0)}function ky(i,r){return i&&i.length?Xc(i,D(r)):s}var $y=H(Du);function Du(i,r){return i&&i.length&&r&&r.length?Il(i,r):i}function Vy(i,r,a){return i&&i.length&&r&&r.length?Il(i,r,x(a,2)):i}function qy(i,r,a){return i&&i.length&&r&&r.length?Il(i,r,s,a):i}var Wy=Et(function(i,r){var a=i==null?0:i.length,l=hl(i,r);return zc(i,J(r,function(c){return Ct(c,a)?+c:c}).sort(ou)),l});function Ky(i,r){var a=[];if(!(i&&i.length))return a;var l=-1,c=[],m=i.length;for(r=x(r,3);++l<m;){var f=i[l];r(f,l,i)&&(a.push(f),c.push(l))}return zc(i,c),a}function Vl(i){return i==null?i:Hh.call(i)}function Xy(i,r,a){var l=i==null?0:i.length;return l?(a&&typeof a!="number"&&_e(i,r,a)?(r=0,a=l):(r=r==null?0:D(r),a=a===s?l:D(a)),Je(i,r,a)):[]}function Yy(i,r){return Nn(i,r)}function Qy(i,r,a){return Fl(i,r,x(a,2))}function zy(i,r){var a=i==null?0:i.length;if(a){var l=Nn(i,r);if(l<a&&lt(i[l],r))return l}return-1}function Jy(i,r){return Nn(i,r,!0)}function Zy(i,r,a){return Fl(i,r,x(a,2),!0)}function jy(i,r){var a=i==null?0:i.length;if(a){var l=Nn(i,r,!0)-1;if(lt(i[l],r))return l}return-1}function eM(i){return i&&i.length?Zc(i):[]}function tM(i,r){return i&&i.length?Zc(i,x(r,2)):[]}function iM(i){var r=i==null?0:i.length;return r?Je(i,1,r):[]}function rM(i,r,a){return i&&i.length?(r=a||r===s?1:D(r),Je(i,0,r<0?0:r)):[]}function nM(i,r,a){var l=i==null?0:i.length;return l?(r=a||r===s?1:D(r),r=l-r,Je(i,r<0?0:r,l)):[]}function aM(i,r){return i&&i.length?Dn(i,x(r,3),!1,!0):[]}function oM(i,r){return i&&i.length?Dn(i,x(r,3)):[]}var sM=H(function(i){return Vt(me(i,1,te,!0))}),lM=H(function(i){var r=Ze(i);return te(r)&&(r=s),Vt(me(i,1,te,!0),x(r,2))}),pM=H(function(i){var r=Ze(i);return r=typeof r=="function"?r:s,Vt(me(i,1,te,!0),s,r)});function cM(i){return i&&i.length?Vt(i):[]}function uM(i,r){return i&&i.length?Vt(i,x(r,2)):[]}function mM(i,r){return r=typeof r=="function"?r:s,i&&i.length?Vt(i,s,r):[]}function ql(i){if(!(i&&i.length))return[];var r=0;return i=Dt(i,function(a){if(te(a))return r=le(a.length,r),!0}),sl(r,function(a){return J(i,nl(a))})}function Uu(i,r){if(!(i&&i.length))return[];var a=ql(i);return r==null?a:J(a,function(l){return De(r,s,l)})}var dM=H(function(i,r){return te(i)?Ar(i,r):[]}),fM=H(function(i){return Tl(Dt(i,te))}),hM=H(function(i){var r=Ze(i);return te(r)&&(r=s),Tl(Dt(i,te),x(r,2))}),gM=H(function(i){var r=Ze(i);return r=typeof r=="function"?r:s,Tl(Dt(i,te),s,r)}),yM=H(ql);function MM(i,r){return iu(i||[],r||[],xr)}function bM(i,r){return iu(i||[],r||[],Lr)}var wM=H(function(i){var r=i.length,a=r>1?i[r-1]:s;return a=typeof a=="function"?(i.pop(),a):s,Uu(i,a)});function Hu(i){var r=u(i);return r.__chain__=!0,r}function vM(i,r){return r(i),i}function Kn(i,r){return r(i)}var _M=Et(function(i){var r=i.length,a=r?i[0]:0,l=this.__wrapped__,c=function(m){return hl(m,i)};return r>1||this.__actions__.length||!(l instanceof k)||!Ct(a)?this.thru(c):(l=l.slice(a,+a+(r?1:0)),l.__actions__.push({func:Kn,args:[c],thisArg:s}),new Qe(l,this.__chain__).thru(function(m){return r&&!m.length&&m.push(s),m}))});function IM(){return Hu(this)}function PM(){return new Qe(this.value(),this.__chain__)}function RM(){this.__values__===s&&(this.__values__=ju(this.value()));var i=this.__index__>=this.__values__.length,r=i?s:this.__values__[this.__index__++];return{done:i,value:r}}function FM(){return this}function SM(i){for(var r,a=this;a instanceof xn;){var l=Au(a);l.__index__=0,l.__values__=s,r?c.__wrapped__=l:r=l;var c=l;a=a.__wrapped__}return c.__wrapped__=i,r}function TM(){var i=this.__wrapped__;if(i instanceof k){var r=i;return this.__actions__.length&&(r=new k(this)),r=r.reverse(),r.__actions__.push({func:Kn,args:[Vl],thisArg:s}),new Qe(r,this.__chain__)}return this.thru(Vl)}function EM(){return tu(this.__wrapped__,this.__actions__)}var CM=Un(function(i,r,a){X.call(i,a)?++i[a]:St(i,a,1)});function xM(i,r,a){var l=L(i)?fc:vg;return a&&_e(i,r,a)&&(r=s),l(i,x(r,3))}function AM(i,r){var a=L(i)?Dt:Uc;return a(i,x(r,3))}var OM=mu(Ou),BM=mu(Bu);function LM(i,r){return me(Xn(i,r),1)}function NM(i,r){return me(Xn(i,r),ii)}function DM(i,r,a){return a=a===s?1:D(a),me(Xn(i,r),a)}function Gu(i,r){var a=L(i)?Xe:$t;return a(i,x(r,3))}function ku(i,r){var a=L(i)?ih:Dc;return a(i,x(r,3))}var UM=Un(function(i,r,a){X.call(i,a)?i[a].push(r):St(i,a,[r])});function HM(i,r,a,l){i=Ce(i)?i:Ai(i),a=a&&!l?D(a):0;var c=i.length;return a<0&&(a=le(c+a,0)),Zn(i)?a<=c&&i.indexOf(r,a)>-1:!!c&&vi(i,r,a)>-1}var GM=H(function(i,r,a){var l=-1,c=typeof r=="function",m=Ce(i)?_(i.length):[];return $t(i,function(f){m[++l]=c?De(r,f,a):Or(f,r,a)}),m}),kM=Un(function(i,r,a){St(i,a,r)});function Xn(i,r){var a=L(i)?J:qc;return a(i,x(r,3))}function $M(i,r,a,l){return i==null?[]:(L(r)||(r=r==null?[]:[r]),a=l?s:a,L(a)||(a=a==null?[]:[a]),Yc(i,r,a))}var VM=Un(function(i,r,a){i[a?0:1].push(r)},function(){return[[],[]]});function qM(i,r,a){var l=L(i)?il:Mc,c=arguments.length<3;return l(i,x(r,4),a,c,$t)}function WM(i,r,a){var l=L(i)?rh:Mc,c=arguments.length<3;return l(i,x(r,4),a,c,Dc)}function KM(i,r){var a=L(i)?Dt:Uc;return a(i,zn(x(r,3)))}function XM(i){var r=L(i)?Oc:Hg;return r(i)}function YM(i,r,a){(a?_e(i,r,a):r===s)?r=1:r=D(r);var l=L(i)?gg:Gg;return l(i,r)}function QM(i){var r=L(i)?yg:$g;return r(i)}function zM(i){if(i==null)return 0;if(Ce(i))return Zn(i)?Ii(i):i.length;var r=ye(i);return r==nt||r==at?i.size:vl(i).length}function JM(i,r,a){var l=L(i)?rl:Vg;return a&&_e(i,r,a)&&(r=s),l(i,x(r,3))}var ZM=H(function(i,r){if(i==null)return[];var a=r.length;return a>1&&_e(i,r[0],r[1])?r=[]:a>2&&_e(r[0],r[1],r[2])&&(r=[r[0]]),Yc(i,me(r,1),[])}),Yn=Ah||function(){return pe.Date.now()};function jM(i,r){if(typeof r!="function")throw new Ye(o);return i=D(i),function(){if(--i<1)return r.apply(this,arguments)}}function $u(i,r,a){return r=a?s:r,r=i&&r==null?i.length:r,Tt(i,It,s,s,s,s,r)}function Vu(i,r){var a;if(typeof r!="function")throw new Ye(o);return i=D(i),function(){return--i>0&&(a=r.apply(this,arguments)),i<=1&&(r=s),a}}var Wl=H(function(i,r,a){var l=we;if(a.length){var c=Ht(a,Ci(Wl));l|=We}return Tt(i,l,r,a,c)}),qu=H(function(i,r,a){var l=we|ct;if(a.length){var c=Ht(a,Ci(qu));l|=We}return Tt(r,l,i,a,c)});function Wu(i,r,a){r=a?s:r;var l=Tt(i,ue,s,s,s,s,s,r);return l.placeholder=Wu.placeholder,l}function Ku(i,r,a){r=a?s:r;var l=Tt(i,Te,s,s,s,s,s,r);return l.placeholder=Ku.placeholder,l}function Xu(i,r,a){var l,c,m,f,h,b,P=0,R=!1,F=!1,T=!0;if(typeof i!="function")throw new Ye(o);r=je(r)||0,Z(a)&&(R=!!a.leading,F="maxWait"in a,m=F?le(je(a.maxWait)||0,r):m,T="trailing"in a?!!a.trailing:T);function C(ie){var pt=l,Ot=c;return l=c=s,P=ie,f=i.apply(Ot,pt),f}function A(ie){return P=ie,h=Ur(G,r),R?C(ie):f}function U(ie){var pt=ie-b,Ot=ie-P,mm=r-pt;return F?ge(mm,m-Ot):mm}function O(ie){var pt=ie-b,Ot=ie-P;return b===s||pt>=r||pt<0||F&&Ot>=m}function G(){var ie=Yn();if(O(ie))return $(ie);h=Ur(G,U(ie))}function $(ie){return h=s,T&&l?C(ie):(l=c=s,f)}function ke(){h!==s&&ru(h),P=0,l=b=c=h=s}function Ie(){return h===s?f:$(Yn())}function $e(){var ie=Yn(),pt=O(ie);if(l=arguments,c=this,b=ie,pt){if(h===s)return A(b);if(F)return ru(h),h=Ur(G,r),C(b)}return h===s&&(h=Ur(G,r)),f}return $e.cancel=ke,$e.flush=Ie,$e}var eb=H(function(i,r){return Nc(i,1,r)}),tb=H(function(i,r,a){return Nc(i,je(r)||0,a)});function ib(i){return Tt(i,Ns)}function Qn(i,r){if(typeof i!="function"||r!=null&&typeof r!="function")throw new Ye(o);var a=function(){var l=arguments,c=r?r.apply(this,l):l[0],m=a.cache;if(m.has(c))return m.get(c);var f=i.apply(this,l);return a.cache=m.set(c,f)||m,f};return a.cache=new(Qn.Cache||Ft),a}Qn.Cache=Ft;function zn(i){if(typeof i!="function")throw new Ye(o);return function(){var r=arguments;switch(r.length){case 0:return!i.call(this);case 1:return!i.call(this,r[0]);case 2:return!i.call(this,r[0],r[1]);case 3:return!i.call(this,r[0],r[1],r[2])}return!i.apply(this,r)}}function rb(i){return Vu(2,i)}var nb=qg(function(i,r){r=r.length==1&&L(r[0])?J(r[0],Ue(x())):J(me(r,1),Ue(x()));var a=r.length;return H(function(l){for(var c=-1,m=ge(l.length,a);++c<m;)l[c]=r[c].call(this,l[c]);return De(i,this,l)})}),Kl=H(function(i,r){var a=Ht(r,Ci(Kl));return Tt(i,We,s,r,a)}),Yu=H(function(i,r){var a=Ht(r,Ci(Yu));return Tt(i,ut,s,r,a)}),ab=Et(function(i,r){return Tt(i,yr,s,s,s,r)});function ob(i,r){if(typeof i!="function")throw new Ye(o);return r=r===s?r:D(r),H(i,r)}function sb(i,r){if(typeof i!="function")throw new Ye(o);return r=r==null?0:le(D(r),0),H(function(a){var l=a[r],c=Wt(a,0,r);return l&&Ut(c,l),De(i,this,c)})}function lb(i,r,a){var l=!0,c=!0;if(typeof i!="function")throw new Ye(o);return Z(a)&&(l="leading"in a?!!a.leading:l,c="trailing"in a?!!a.trailing:c),Xu(i,r,{leading:l,maxWait:r,trailing:c})}function pb(i){return $u(i,1)}function cb(i,r){return Kl(Cl(r),i)}function ub(){if(!arguments.length)return[];var i=arguments[0];return L(i)?i:[i]}function mb(i){return ze(i,S)}function db(i,r){return r=typeof r=="function"?r:s,ze(i,S,r)}function fb(i){return ze(i,v|S)}function hb(i,r){return r=typeof r=="function"?r:s,ze(i,v|S,r)}function gb(i,r){return r==null||Lc(i,r,ce(r))}function lt(i,r){return i===r||i!==i&&r!==r}var yb=$n(Ml),Mb=$n(function(i,r){return i>=r}),ui=kc(function(){return arguments}())?kc:function(i){return ee(i)&&X.call(i,"callee")&&!Sc.call(i,"callee")},L=_.isArray,bb=lc?Ue(lc):Sg;function Ce(i){return i!=null&&Jn(i.length)&&!xt(i)}function te(i){return ee(i)&&Ce(i)}function wb(i){return i===!0||i===!1||ee(i)&&ve(i)==Mr}var Kt=Bh||rp,vb=pc?Ue(pc):Tg;function _b(i){return ee(i)&&i.nodeType===1&&!Hr(i)}function Ib(i){if(i==null)return!0;if(Ce(i)&&(L(i)||typeof i=="string"||typeof i.splice=="function"||Kt(i)||xi(i)||ui(i)))return!i.length;var r=ye(i);if(r==nt||r==at)return!i.size;if(Dr(i))return!vl(i).length;for(var a in i)if(X.call(i,a))return!1;return!0}function Pb(i,r){return Br(i,r)}function Rb(i,r,a){a=typeof a=="function"?a:s;var l=a?a(i,r):s;return l===s?Br(i,r,s,a):!!l}function Xl(i){if(!ee(i))return!1;var r=ve(i);return r==pn||r==Xd||typeof i.message=="string"&&typeof i.name=="string"&&!Hr(i)}function Fb(i){return typeof i=="number"&&Ec(i)}function xt(i){if(!Z(i))return!1;var r=ve(i);return r==cn||r==Np||r==Kd||r==Qd}function Qu(i){return typeof i=="number"&&i==D(i)}function Jn(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=N}function Z(i){var r=typeof i;return i!=null&&(r=="object"||r=="function")}function ee(i){return i!=null&&typeof i=="object"}var zu=cc?Ue(cc):Cg;function Sb(i,r){return i===r||wl(i,r,Dl(r))}function Tb(i,r,a){return a=typeof a=="function"?a:s,wl(i,r,Dl(r),a)}function Eb(i){return Ju(i)&&i!=+i}function Cb(i){if(dy(i))throw new B(n);return $c(i)}function xb(i){return i===null}function Ab(i){return i==null}function Ju(i){return typeof i=="number"||ee(i)&&ve(i)==wr}function Hr(i){if(!ee(i)||ve(i)!=Pt)return!1;var r=Pn(i);if(r===null)return!0;var a=X.call(r,"constructor")&&r.constructor;return typeof a=="function"&&a instanceof a&&wn.call(a)==Th}var Yl=uc?Ue(uc):xg;function Ob(i){return Qu(i)&&i>=-N&&i<=N}var Zu=mc?Ue(mc):Ag;function Zn(i){return typeof i=="string"||!L(i)&&ee(i)&&ve(i)==_r}function Ge(i){return typeof i=="symbol"||ee(i)&&ve(i)==un}var xi=dc?Ue(dc):Og;function Bb(i){return i===s}function Lb(i){return ee(i)&&ye(i)==Ir}function Nb(i){return ee(i)&&ve(i)==Jd}var Db=$n(_l),Ub=$n(function(i,r){return i<=r});function ju(i){if(!i)return[];if(Ce(i))return Zn(i)?ot(i):Ee(i);if(Fr&&i[Fr])return gh(i[Fr]());var r=ye(i),a=r==nt?pl:r==at?yn:Ai;return a(i)}function At(i){if(!i)return i===0?i:0;if(i=je(i),i===ii||i===-ii){var r=i<0?-1:1;return r*$d}return i===i?i:0}function D(i){var r=At(i),a=r%1;return r===r?a?r-a:r:0}function em(i){return i?si(D(i),0,mt):0}function je(i){if(typeof i=="number")return i;if(Ge(i))return sn;if(Z(i)){var r=typeof i.valueOf=="function"?i.valueOf():i;i=Z(r)?r+"":r}if(typeof i!="string")return i===0?i:+i;i=bc(i);var a=bf.test(i);return a||vf.test(i)?jf(i.slice(2),a?2:8):Mf.test(i)?sn:+i}function tm(i){return ft(i,xe(i))}function Hb(i){return i?si(D(i),-N,N):i===0?i:0}function W(i){return i==null?"":He(i)}var Gb=Ti(function(i,r){if(Dr(r)||Ce(r)){ft(r,ce(r),i);return}for(var a in r)X.call(r,a)&&xr(i,a,r[a])}),im=Ti(function(i,r){ft(r,xe(r),i)}),jn=Ti(function(i,r,a,l){ft(r,xe(r),i,l)}),kb=Ti(function(i,r,a,l){ft(r,ce(r),i,l)}),$b=Et(hl);function Vb(i,r){var a=Si(i);return r==null?a:Bc(a,r)}var qb=H(function(i,r){i=Y(i);var a=-1,l=r.length,c=l>2?r[2]:s;for(c&&_e(r[0],r[1],c)&&(l=1);++a<l;)for(var m=r[a],f=xe(m),h=-1,b=f.length;++h<b;){var P=f[h],R=i[P];(R===s||lt(R,Pi[P])&&!X.call(i,P))&&(i[P]=m[P])}return i}),Wb=H(function(i){return i.push(s,bu),De(rm,s,i)});function Kb(i,r){return hc(i,x(r,3),dt)}function Xb(i,r){return hc(i,x(r,3),yl)}function Yb(i,r){return i==null?i:gl(i,x(r,3),xe)}function Qb(i,r){return i==null?i:Hc(i,x(r,3),xe)}function zb(i,r){return i&&dt(i,x(r,3))}function Jb(i,r){return i&&yl(i,x(r,3))}function Zb(i){return i==null?[]:Bn(i,ce(i))}function jb(i){return i==null?[]:Bn(i,xe(i))}function Ql(i,r,a){var l=i==null?s:li(i,r);return l===s?a:l}function ew(i,r){return i!=null&&_u(i,r,Ig)}function zl(i,r){return i!=null&&_u(i,r,Pg)}var tw=fu(function(i,r,a){r!=null&&typeof r.toString!="function"&&(r=vn.call(r)),i[r]=a},Zl(Ae)),iw=fu(function(i,r,a){r!=null&&typeof r.toString!="function"&&(r=vn.call(r)),X.call(i,r)?i[r].push(a):i[r]=[a]},x),rw=H(Or);function ce(i){return Ce(i)?Ac(i):vl(i)}function xe(i){return Ce(i)?Ac(i,!0):Bg(i)}function nw(i,r){var a={};return r=x(r,3),dt(i,function(l,c,m){St(a,r(l,c,m),l)}),a}function aw(i,r){var a={};return r=x(r,3),dt(i,function(l,c,m){St(a,c,r(l,c,m))}),a}var ow=Ti(function(i,r,a){Ln(i,r,a)}),rm=Ti(function(i,r,a,l){Ln(i,r,a,l)}),sw=Et(function(i,r){var a={};if(i==null)return a;var l=!1;r=J(r,function(m){return m=qt(m,i),l||(l=m.length>1),m}),ft(i,Ll(i),a),l&&(a=ze(a,v|w|S,ty));for(var c=r.length;c--;)Sl(a,r[c]);return a});function lw(i,r){return nm(i,zn(x(r)))}var pw=Et(function(i,r){return i==null?{}:Ng(i,r)});function nm(i,r){if(i==null)return{};var a=J(Ll(i),function(l){return[l]});return r=x(r),Qc(i,a,function(l,c){return r(l,c[0])})}function cw(i,r,a){r=qt(r,i);var l=-1,c=r.length;for(c||(c=1,i=s);++l<c;){var m=i==null?s:i[ht(r[l])];m===s&&(l=c,m=a),i=xt(m)?m.call(i):m}return i}function uw(i,r,a){return i==null?i:Lr(i,r,a)}function mw(i,r,a,l){return l=typeof l=="function"?l:s,i==null?i:Lr(i,r,a,l)}var am=yu(ce),om=yu(xe);function dw(i,r,a){var l=L(i),c=l||Kt(i)||xi(i);if(r=x(r,4),a==null){var m=i&&i.constructor;c?a=l?new m:[]:Z(i)?a=xt(m)?Si(Pn(i)):{}:a={}}return(c?Xe:dt)(i,function(f,h,b){return r(a,f,h,b)}),a}function fw(i,r){return i==null?!0:Sl(i,r)}function hw(i,r,a){return i==null?i:eu(i,r,Cl(a))}function gw(i,r,a,l){return l=typeof l=="function"?l:s,i==null?i:eu(i,r,Cl(a),l)}function Ai(i){return i==null?[]:ll(i,ce(i))}function yw(i){return i==null?[]:ll(i,xe(i))}function Mw(i,r,a){return a===s&&(a=r,r=s),a!==s&&(a=je(a),a=a===a?a:0),r!==s&&(r=je(r),r=r===r?r:0),si(je(i),r,a)}function bw(i,r,a){return r=At(r),a===s?(a=r,r=0):a=At(a),i=je(i),Rg(i,r,a)}function ww(i,r,a){if(a&&typeof a!="boolean"&&_e(i,r,a)&&(r=a=s),a===s&&(typeof r=="boolean"?(a=r,r=s):typeof i=="boolean"&&(a=i,i=s)),i===s&&r===s?(i=0,r=1):(i=At(i),r===s?(r=i,i=0):r=At(r)),i>r){var l=i;i=r,r=l}if(a||i%1||r%1){var c=Cc();return ge(i+c*(r-i+Zf("1e-"+((c+"").length-1))),r)}return Pl(i,r)}var vw=Ei(function(i,r,a){return r=r.toLowerCase(),i+(a?sm(r):r)});function sm(i){return Jl(W(i).toLowerCase())}function lm(i){return i=W(i),i&&i.replace(If,uh).replace($f,"")}function _w(i,r,a){i=W(i),r=He(r);var l=i.length;a=a===s?l:si(D(a),0,l);var c=a;return a-=r.length,a>=0&&i.slice(a,c)==r}function Iw(i){return i=W(i),i&&rf.test(i)?i.replace(Hp,mh):i}function Pw(i){return i=W(i),i&&pf.test(i)?i.replace(Ks,"\\$&"):i}var Rw=Ei(function(i,r,a){return i+(a?"-":"")+r.toLowerCase()}),Fw=Ei(function(i,r,a){return i+(a?" ":"")+r.toLowerCase()}),Sw=uu("toLowerCase");function Tw(i,r,a){i=W(i),r=D(r);var l=r?Ii(i):0;if(!r||l>=r)return i;var c=(r-l)/2;return kn(Tn(c),a)+i+kn(Sn(c),a)}function Ew(i,r,a){i=W(i),r=D(r);var l=r?Ii(i):0;return r&&l<r?i+kn(r-l,a):i}function Cw(i,r,a){i=W(i),r=D(r);var l=r?Ii(i):0;return r&&l<r?kn(r-l,a)+i:i}function xw(i,r,a){return a||r==null?r=0:r&&(r=+r),Uh(W(i).replace(Xs,""),r||0)}function Aw(i,r,a){return(a?_e(i,r,a):r===s)?r=1:r=D(r),Rl(W(i),r)}function Ow(){var i=arguments,r=W(i[0]);return i.length<3?r:r.replace(i[1],i[2])}var Bw=Ei(function(i,r,a){return i+(a?"_":"")+r.toLowerCase()});function Lw(i,r,a){return a&&typeof a!="number"&&_e(i,r,a)&&(r=a=s),a=a===s?mt:a>>>0,a?(i=W(i),i&&(typeof r=="string"||r!=null&&!Yl(r))&&(r=He(r),!r&&_i(i))?Wt(ot(i),0,a):i.split(r,a)):[]}var Nw=Ei(function(i,r,a){return i+(a?" ":"")+Jl(r)});function Dw(i,r,a){return i=W(i),a=a==null?0:si(D(a),0,i.length),r=He(r),i.slice(a,a+r.length)==r}function Uw(i,r,a){var l=u.templateSettings;a&&_e(i,r,a)&&(r=s),i=W(i),r=jn({},r,l,Mu);var c=jn({},r.imports,l.imports,Mu),m=ce(c),f=ll(c,m),h,b,P=0,R=r.interpolate||mn,F="__p += '",T=cl((r.escape||mn).source+"|"+R.source+"|"+(R===Gp?yf:mn).source+"|"+(r.evaluate||mn).source+"|$","g"),C="//# sourceURL="+(X.call(r,"sourceURL")?(r.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Xf+"]")+`
4
- `;i.replace(T,function(O,G,$,ke,Ie,$e){return $||($=ke),F+=i.slice(P,$e).replace(Pf,dh),G&&(h=!0,F+=`' +
5
- __e(`+G+`) +
3
+ `)}function cy(i){return N(i)||ui(i)||!!(Tc&&i&&i[Tc])}function Ct(i,r){var a=typeof i;return r=r??D,!!r&&(a=="number"||a!="symbol"&&_f.test(i))&&i>-1&&i%1==0&&i<r}function _e(i,r,a){if(!Z(a))return!1;var l=typeof r;return(l=="number"?Ce(a)&&Ct(r,a.length):l=="string"&&r in a)?lt(a[r],i):!1}function Gl(i,r){if(N(i))return!1;var a=typeof i;return a=="number"||a=="symbol"||a=="boolean"||i==null||He(i)?!0:sf.test(i)||!of.test(i)||r!=null&&i in Y(r)}function uy(i){var r=typeof i;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?i!=="__proto__":i===null}function Hl(i){var r=Vn(i),a=u[r];if(typeof a!="function"||!(r in $.prototype))return!1;if(i===a)return!0;var l=Nl(a);return!!l&&i===l[0]}function my(i){return!!Pc&&Pc in i}var dy=bn?At:rp;function Dr(i){var r=i&&i.constructor,a=typeof r=="function"&&r.prototype||Pi;return i===a}function Pu(i){return i===i&&!Z(i)}function Ru(i,r){return function(a){return a==null?!1:a[i]===r&&(r!==s||i in Y(a))}}function fy(i){var r=Qn(i,function(l){return a.size===y&&a.clear(),l}),a=r.cache;return r}function hy(i,r){var a=i[1],l=r[1],c=a|l,m=c<(we|ct|It),f=l==It&&a==ue||l==It&&a==yr&&i[7].length<=r[8]||l==(It|yr)&&r[7].length<=r[8]&&a==ue;if(!(m||f))return i;l&we&&(i[2]=r[2],c|=a&we?0:Se);var h=r[3];if(h){var b=i[3];i[3]=b?su(b,h,r[4]):h,i[4]=b?Gt(i[3],g):r[4]}return h=r[5],h&&(b=i[5],i[5]=b?lu(b,h,r[6]):h,i[6]=b?Gt(i[5],g):r[6]),h=r[7],h&&(i[7]=h),l&It&&(i[8]=i[8]==null?r[8]:ge(i[8],r[8])),i[9]==null&&(i[9]=r[9]),i[0]=r[0],i[1]=c,i}function gy(i){var r=[];if(i!=null)for(var a in Y(i))r.push(a);return r}function yy(i){return vn.call(i)}function Fu(i,r,a){return r=le(r===s?i.length-1:r,0),function(){for(var l=arguments,c=-1,m=le(l.length-r,0),f=_(m);++c<m;)f[c]=l[r+c];c=-1;for(var h=_(r+1);++c<r;)h[c]=l[c];return h[r]=a(f),De(i,this,h)}}function Su(i,r){return r.length<2?i:li(i,Je(r,0,-1))}function My(i,r){for(var a=i.length,l=ge(r.length,a),c=Ee(i);l--;){var m=r[l];i[l]=Ct(m,a)?c[m]:s}return i}function kl(i,r){if(!(r==="constructor"&&typeof i[r]=="function")&&r!="__proto__")return i[r]}var Tu=Cu(Jc),Ur=Oh||function(i,r){return pe.setTimeout(i,r)},$l=Cu(kg);function Eu(i,r,a){var l=r+"";return $l(i,py(l,by(oy(l),a)))}function Cu(i){var r=0,a=0;return function(){var l=Dh(),c=Gd-(l-a);if(a=l,c>0){if(++r>=Ud)return arguments[0]}else r=0;return i.apply(s,arguments)}}function Wn(i,r){var a=-1,l=i.length,c=l-1;for(r=r===s?l:r;++a<r;){var m=Pl(a,c),f=i[m];i[m]=i[a],i[a]=f}return i.length=r,i}var Au=fy(function(i){var r=[];return i.charCodeAt(0)===46&&r.push(""),i.replace(lf,function(a,l,c,m){r.push(c?m.replace(gf,"$1"):l||a)}),r});function ht(i){if(typeof i=="string"||He(i))return i;var r=i+"";return r=="0"&&1/i==-ii?"-0":r}function ci(i){if(i!=null){try{return wn.call(i)}catch{}try{return i+""}catch{}}return""}function by(i,r){return Xe(Wd,function(a){var l="_."+a[0];r&a[1]&&!hn(i,l)&&i.push(l)}),i.sort()}function xu(i){if(i instanceof $)return i.clone();var r=new Qe(i.__wrapped__,i.__chain__);return r.__actions__=Ee(i.__actions__),r.__index__=i.__index__,r.__values__=i.__values__,r}function wy(i,r,a){(a?_e(i,r,a):r===s)?r=1:r=le(U(r),0);var l=i==null?0:i.length;if(!l||r<1)return[];for(var c=0,m=0,f=_(Sn(l/r));c<l;)f[m++]=Je(i,c,c+=r);return f}function vy(i){for(var r=-1,a=i==null?0:i.length,l=0,c=[];++r<a;){var m=i[r];m&&(c[l++]=m)}return c}function _y(){var i=arguments.length;if(!i)return[];for(var r=_(i-1),a=arguments[0],l=i;l--;)r[l-1]=arguments[l];return Ut(N(a)?Ee(a):[a],me(r,1))}var Iy=H(function(i,r){return te(i)?xr(i,me(r,1,te,!0)):[]}),Py=H(function(i,r){var a=Ze(r);return te(a)&&(a=s),te(i)?xr(i,me(r,1,te,!0),A(a,2)):[]}),Ry=H(function(i,r){var a=Ze(r);return te(a)&&(a=s),te(i)?xr(i,me(r,1,te,!0),s,a):[]});function Fy(i,r,a){var l=i==null?0:i.length;return l?(r=a||r===s?1:U(r),Je(i,r<0?0:r,l)):[]}function Sy(i,r,a){var l=i==null?0:i.length;return l?(r=a||r===s?1:U(r),r=l-r,Je(i,0,r<0?0:r)):[]}function Ty(i,r){return i&&i.length?Dn(i,A(r,3),!0,!0):[]}function Ey(i,r){return i&&i.length?Dn(i,A(r,3),!0):[]}function Cy(i,r,a,l){var c=i==null?0:i.length;return c?(a&&typeof a!="number"&&_e(i,r,a)&&(a=0,l=c),_g(i,r,a,l)):[]}function Ou(i,r,a){var l=i==null?0:i.length;if(!l)return-1;var c=a==null?0:U(a);return c<0&&(c=le(l+c,0)),gn(i,A(r,3),c)}function Bu(i,r,a){var l=i==null?0:i.length;if(!l)return-1;var c=l-1;return a!==s&&(c=U(a),c=a<0?le(l+c,0):ge(c,l-1)),gn(i,A(r,3),c,!0)}function Lu(i){var r=i==null?0:i.length;return r?me(i,1):[]}function Ay(i){var r=i==null?0:i.length;return r?me(i,ii):[]}function xy(i,r){var a=i==null?0:i.length;return a?(r=r===s?1:U(r),me(i,r)):[]}function Oy(i){for(var r=-1,a=i==null?0:i.length,l={};++r<a;){var c=i[r];l[c[0]]=c[1]}return l}function Nu(i){return i&&i.length?i[0]:s}function By(i,r,a){var l=i==null?0:i.length;if(!l)return-1;var c=a==null?0:U(a);return c<0&&(c=le(l+c,0)),vi(i,r,c)}function Ly(i){var r=i==null?0:i.length;return r?Je(i,0,-1):[]}var Ny=H(function(i){var r=J(i,El);return r.length&&r[0]===i[0]?bl(r):[]}),Dy=H(function(i){var r=Ze(i),a=J(i,El);return r===Ze(a)?r=s:a.pop(),a.length&&a[0]===i[0]?bl(a,A(r,2)):[]}),Uy=H(function(i){var r=Ze(i),a=J(i,El);return r=typeof r=="function"?r:s,r&&a.pop(),a.length&&a[0]===i[0]?bl(a,s,r):[]});function Gy(i,r){return i==null?"":Lh.call(i,r)}function Ze(i){var r=i==null?0:i.length;return r?i[r-1]:s}function Hy(i,r,a){var l=i==null?0:i.length;if(!l)return-1;var c=l;return a!==s&&(c=U(a),c=c<0?le(l+c,0):ge(c,l-1)),r===r?bh(i,r,c):gn(i,gc,c,!0)}function ky(i,r){return i&&i.length?Xc(i,U(r)):s}var $y=H(Du);function Du(i,r){return i&&i.length&&r&&r.length?Il(i,r):i}function Vy(i,r,a){return i&&i.length&&r&&r.length?Il(i,r,A(a,2)):i}function qy(i,r,a){return i&&i.length&&r&&r.length?Il(i,r,s,a):i}var Wy=Et(function(i,r){var a=i==null?0:i.length,l=hl(i,r);return zc(i,J(r,function(c){return Ct(c,a)?+c:c}).sort(ou)),l});function Ky(i,r){var a=[];if(!(i&&i.length))return a;var l=-1,c=[],m=i.length;for(r=A(r,3);++l<m;){var f=i[l];r(f,l,i)&&(a.push(f),c.push(l))}return zc(i,c),a}function Vl(i){return i==null?i:Gh.call(i)}function Xy(i,r,a){var l=i==null?0:i.length;return l?(a&&typeof a!="number"&&_e(i,r,a)?(r=0,a=l):(r=r==null?0:U(r),a=a===s?l:U(a)),Je(i,r,a)):[]}function Yy(i,r){return Nn(i,r)}function Qy(i,r,a){return Fl(i,r,A(a,2))}function zy(i,r){var a=i==null?0:i.length;if(a){var l=Nn(i,r);if(l<a&&lt(i[l],r))return l}return-1}function Jy(i,r){return Nn(i,r,!0)}function Zy(i,r,a){return Fl(i,r,A(a,2),!0)}function jy(i,r){var a=i==null?0:i.length;if(a){var l=Nn(i,r,!0)-1;if(lt(i[l],r))return l}return-1}function eM(i){return i&&i.length?Zc(i):[]}function tM(i,r){return i&&i.length?Zc(i,A(r,2)):[]}function iM(i){var r=i==null?0:i.length;return r?Je(i,1,r):[]}function rM(i,r,a){return i&&i.length?(r=a||r===s?1:U(r),Je(i,0,r<0?0:r)):[]}function nM(i,r,a){var l=i==null?0:i.length;return l?(r=a||r===s?1:U(r),r=l-r,Je(i,r<0?0:r,l)):[]}function aM(i,r){return i&&i.length?Dn(i,A(r,3),!1,!0):[]}function oM(i,r){return i&&i.length?Dn(i,A(r,3)):[]}var sM=H(function(i){return Vt(me(i,1,te,!0))}),lM=H(function(i){var r=Ze(i);return te(r)&&(r=s),Vt(me(i,1,te,!0),A(r,2))}),pM=H(function(i){var r=Ze(i);return r=typeof r=="function"?r:s,Vt(me(i,1,te,!0),s,r)});function cM(i){return i&&i.length?Vt(i):[]}function uM(i,r){return i&&i.length?Vt(i,A(r,2)):[]}function mM(i,r){return r=typeof r=="function"?r:s,i&&i.length?Vt(i,s,r):[]}function ql(i){if(!(i&&i.length))return[];var r=0;return i=Dt(i,function(a){if(te(a))return r=le(a.length,r),!0}),sl(r,function(a){return J(i,nl(a))})}function Uu(i,r){if(!(i&&i.length))return[];var a=ql(i);return r==null?a:J(a,function(l){return De(r,s,l)})}var dM=H(function(i,r){return te(i)?xr(i,r):[]}),fM=H(function(i){return Tl(Dt(i,te))}),hM=H(function(i){var r=Ze(i);return te(r)&&(r=s),Tl(Dt(i,te),A(r,2))}),gM=H(function(i){var r=Ze(i);return r=typeof r=="function"?r:s,Tl(Dt(i,te),s,r)}),yM=H(ql);function MM(i,r){return iu(i||[],r||[],Ar)}function bM(i,r){return iu(i||[],r||[],Lr)}var wM=H(function(i){var r=i.length,a=r>1?i[r-1]:s;return a=typeof a=="function"?(i.pop(),a):s,Uu(i,a)});function Gu(i){var r=u(i);return r.__chain__=!0,r}function vM(i,r){return r(i),i}function Kn(i,r){return r(i)}var _M=Et(function(i){var r=i.length,a=r?i[0]:0,l=this.__wrapped__,c=function(m){return hl(m,i)};return r>1||this.__actions__.length||!(l instanceof $)||!Ct(a)?this.thru(c):(l=l.slice(a,+a+(r?1:0)),l.__actions__.push({func:Kn,args:[c],thisArg:s}),new Qe(l,this.__chain__).thru(function(m){return r&&!m.length&&m.push(s),m}))});function IM(){return Gu(this)}function PM(){return new Qe(this.value(),this.__chain__)}function RM(){this.__values__===s&&(this.__values__=ju(this.value()));var i=this.__index__>=this.__values__.length,r=i?s:this.__values__[this.__index__++];return{done:i,value:r}}function FM(){return this}function SM(i){for(var r,a=this;a instanceof An;){var l=xu(a);l.__index__=0,l.__values__=s,r?c.__wrapped__=l:r=l;var c=l;a=a.__wrapped__}return c.__wrapped__=i,r}function TM(){var i=this.__wrapped__;if(i instanceof $){var r=i;return this.__actions__.length&&(r=new $(this)),r=r.reverse(),r.__actions__.push({func:Kn,args:[Vl],thisArg:s}),new Qe(r,this.__chain__)}return this.thru(Vl)}function EM(){return tu(this.__wrapped__,this.__actions__)}var CM=Un(function(i,r,a){X.call(i,a)?++i[a]:St(i,a,1)});function AM(i,r,a){var l=N(i)?fc:vg;return a&&_e(i,r,a)&&(r=s),l(i,A(r,3))}function xM(i,r){var a=N(i)?Dt:Uc;return a(i,A(r,3))}var OM=mu(Ou),BM=mu(Bu);function LM(i,r){return me(Xn(i,r),1)}function NM(i,r){return me(Xn(i,r),ii)}function DM(i,r,a){return a=a===s?1:U(a),me(Xn(i,r),a)}function Hu(i,r){var a=N(i)?Xe:$t;return a(i,A(r,3))}function ku(i,r){var a=N(i)?ih:Dc;return a(i,A(r,3))}var UM=Un(function(i,r,a){X.call(i,a)?i[a].push(r):St(i,a,[r])});function GM(i,r,a,l){i=Ce(i)?i:xi(i),a=a&&!l?U(a):0;var c=i.length;return a<0&&(a=le(c+a,0)),Zn(i)?a<=c&&i.indexOf(r,a)>-1:!!c&&vi(i,r,a)>-1}var HM=H(function(i,r,a){var l=-1,c=typeof r=="function",m=Ce(i)?_(i.length):[];return $t(i,function(f){m[++l]=c?De(r,f,a):Or(f,r,a)}),m}),kM=Un(function(i,r,a){St(i,a,r)});function Xn(i,r){var a=N(i)?J:qc;return a(i,A(r,3))}function $M(i,r,a,l){return i==null?[]:(N(r)||(r=r==null?[]:[r]),a=l?s:a,N(a)||(a=a==null?[]:[a]),Yc(i,r,a))}var VM=Un(function(i,r,a){i[a?0:1].push(r)},function(){return[[],[]]});function qM(i,r,a){var l=N(i)?il:Mc,c=arguments.length<3;return l(i,A(r,4),a,c,$t)}function WM(i,r,a){var l=N(i)?rh:Mc,c=arguments.length<3;return l(i,A(r,4),a,c,Dc)}function KM(i,r){var a=N(i)?Dt:Uc;return a(i,zn(A(r,3)))}function XM(i){var r=N(i)?Oc:Gg;return r(i)}function YM(i,r,a){(a?_e(i,r,a):r===s)?r=1:r=U(r);var l=N(i)?gg:Hg;return l(i,r)}function QM(i){var r=N(i)?yg:$g;return r(i)}function zM(i){if(i==null)return 0;if(Ce(i))return Zn(i)?Ii(i):i.length;var r=ye(i);return r==nt||r==at?i.size:vl(i).length}function JM(i,r,a){var l=N(i)?rl:Vg;return a&&_e(i,r,a)&&(r=s),l(i,A(r,3))}var ZM=H(function(i,r){if(i==null)return[];var a=r.length;return a>1&&_e(i,r[0],r[1])?r=[]:a>2&&_e(r[0],r[1],r[2])&&(r=[r[0]]),Yc(i,me(r,1),[])}),Yn=xh||function(){return pe.Date.now()};function jM(i,r){if(typeof r!="function")throw new Ye(o);return i=U(i),function(){if(--i<1)return r.apply(this,arguments)}}function $u(i,r,a){return r=a?s:r,r=i&&r==null?i.length:r,Tt(i,It,s,s,s,s,r)}function Vu(i,r){var a;if(typeof r!="function")throw new Ye(o);return i=U(i),function(){return--i>0&&(a=r.apply(this,arguments)),i<=1&&(r=s),a}}var Wl=H(function(i,r,a){var l=we;if(a.length){var c=Gt(a,Ci(Wl));l|=We}return Tt(i,l,r,a,c)}),qu=H(function(i,r,a){var l=we|ct;if(a.length){var c=Gt(a,Ci(qu));l|=We}return Tt(r,l,i,a,c)});function Wu(i,r,a){r=a?s:r;var l=Tt(i,ue,s,s,s,s,s,r);return l.placeholder=Wu.placeholder,l}function Ku(i,r,a){r=a?s:r;var l=Tt(i,Te,s,s,s,s,s,r);return l.placeholder=Ku.placeholder,l}function Xu(i,r,a){var l,c,m,f,h,b,P=0,R=!1,F=!1,T=!0;if(typeof i!="function")throw new Ye(o);r=je(r)||0,Z(a)&&(R=!!a.leading,F="maxWait"in a,m=F?le(je(a.maxWait)||0,r):m,T="trailing"in a?!!a.trailing:T);function C(ie){var pt=l,Ot=c;return l=c=s,P=ie,f=i.apply(Ot,pt),f}function x(ie){return P=ie,h=Ur(k,r),R?C(ie):f}function G(ie){var pt=ie-b,Ot=ie-P,mm=r-pt;return F?ge(mm,m-Ot):mm}function O(ie){var pt=ie-b,Ot=ie-P;return b===s||pt>=r||pt<0||F&&Ot>=m}function k(){var ie=Yn();if(O(ie))return V(ie);h=Ur(k,G(ie))}function V(ie){return h=s,T&&l?C(ie):(l=c=s,f)}function ke(){h!==s&&ru(h),P=0,l=b=c=h=s}function Ie(){return h===s?f:V(Yn())}function $e(){var ie=Yn(),pt=O(ie);if(l=arguments,c=this,b=ie,pt){if(h===s)return x(b);if(F)return ru(h),h=Ur(k,r),C(b)}return h===s&&(h=Ur(k,r)),f}return $e.cancel=ke,$e.flush=Ie,$e}var eb=H(function(i,r){return Nc(i,1,r)}),tb=H(function(i,r,a){return Nc(i,je(r)||0,a)});function ib(i){return Tt(i,Ns)}function Qn(i,r){if(typeof i!="function"||r!=null&&typeof r!="function")throw new Ye(o);var a=function(){var l=arguments,c=r?r.apply(this,l):l[0],m=a.cache;if(m.has(c))return m.get(c);var f=i.apply(this,l);return a.cache=m.set(c,f)||m,f};return a.cache=new(Qn.Cache||Ft),a}Qn.Cache=Ft;function zn(i){if(typeof i!="function")throw new Ye(o);return function(){var r=arguments;switch(r.length){case 0:return!i.call(this);case 1:return!i.call(this,r[0]);case 2:return!i.call(this,r[0],r[1]);case 3:return!i.call(this,r[0],r[1],r[2])}return!i.apply(this,r)}}function rb(i){return Vu(2,i)}var nb=qg(function(i,r){r=r.length==1&&N(r[0])?J(r[0],Ue(A())):J(me(r,1),Ue(A()));var a=r.length;return H(function(l){for(var c=-1,m=ge(l.length,a);++c<m;)l[c]=r[c].call(this,l[c]);return De(i,this,l)})}),Kl=H(function(i,r){var a=Gt(r,Ci(Kl));return Tt(i,We,s,r,a)}),Yu=H(function(i,r){var a=Gt(r,Ci(Yu));return Tt(i,ut,s,r,a)}),ab=Et(function(i,r){return Tt(i,yr,s,s,s,r)});function ob(i,r){if(typeof i!="function")throw new Ye(o);return r=r===s?r:U(r),H(i,r)}function sb(i,r){if(typeof i!="function")throw new Ye(o);return r=r==null?0:le(U(r),0),H(function(a){var l=a[r],c=Wt(a,0,r);return l&&Ut(c,l),De(i,this,c)})}function lb(i,r,a){var l=!0,c=!0;if(typeof i!="function")throw new Ye(o);return Z(a)&&(l="leading"in a?!!a.leading:l,c="trailing"in a?!!a.trailing:c),Xu(i,r,{leading:l,maxWait:r,trailing:c})}function pb(i){return $u(i,1)}function cb(i,r){return Kl(Cl(r),i)}function ub(){if(!arguments.length)return[];var i=arguments[0];return N(i)?i:[i]}function mb(i){return ze(i,S)}function db(i,r){return r=typeof r=="function"?r:s,ze(i,S,r)}function fb(i){return ze(i,w|S)}function hb(i,r){return r=typeof r=="function"?r:s,ze(i,w|S,r)}function gb(i,r){return r==null||Lc(i,r,ce(r))}function lt(i,r){return i===r||i!==i&&r!==r}var yb=$n(Ml),Mb=$n(function(i,r){return i>=r}),ui=kc(function(){return arguments}())?kc:function(i){return ee(i)&&X.call(i,"callee")&&!Sc.call(i,"callee")},N=_.isArray,bb=lc?Ue(lc):Sg;function Ce(i){return i!=null&&Jn(i.length)&&!At(i)}function te(i){return ee(i)&&Ce(i)}function wb(i){return i===!0||i===!1||ee(i)&&ve(i)==Mr}var Kt=Bh||rp,vb=pc?Ue(pc):Tg;function _b(i){return ee(i)&&i.nodeType===1&&!Gr(i)}function Ib(i){if(i==null)return!0;if(Ce(i)&&(N(i)||typeof i=="string"||typeof i.splice=="function"||Kt(i)||Ai(i)||ui(i)))return!i.length;var r=ye(i);if(r==nt||r==at)return!i.size;if(Dr(i))return!vl(i).length;for(var a in i)if(X.call(i,a))return!1;return!0}function Pb(i,r){return Br(i,r)}function Rb(i,r,a){a=typeof a=="function"?a:s;var l=a?a(i,r):s;return l===s?Br(i,r,s,a):!!l}function Xl(i){if(!ee(i))return!1;var r=ve(i);return r==pn||r==Xd||typeof i.message=="string"&&typeof i.name=="string"&&!Gr(i)}function Fb(i){return typeof i=="number"&&Ec(i)}function At(i){if(!Z(i))return!1;var r=ve(i);return r==cn||r==Np||r==Kd||r==Qd}function Qu(i){return typeof i=="number"&&i==U(i)}function Jn(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=D}function Z(i){var r=typeof i;return i!=null&&(r=="object"||r=="function")}function ee(i){return i!=null&&typeof i=="object"}var zu=cc?Ue(cc):Cg;function Sb(i,r){return i===r||wl(i,r,Dl(r))}function Tb(i,r,a){return a=typeof a=="function"?a:s,wl(i,r,Dl(r),a)}function Eb(i){return Ju(i)&&i!=+i}function Cb(i){if(dy(i))throw new L(n);return $c(i)}function Ab(i){return i===null}function xb(i){return i==null}function Ju(i){return typeof i=="number"||ee(i)&&ve(i)==wr}function Gr(i){if(!ee(i)||ve(i)!=Pt)return!1;var r=Pn(i);if(r===null)return!0;var a=X.call(r,"constructor")&&r.constructor;return typeof a=="function"&&a instanceof a&&wn.call(a)==Th}var Yl=uc?Ue(uc):Ag;function Ob(i){return Qu(i)&&i>=-D&&i<=D}var Zu=mc?Ue(mc):xg;function Zn(i){return typeof i=="string"||!N(i)&&ee(i)&&ve(i)==_r}function He(i){return typeof i=="symbol"||ee(i)&&ve(i)==un}var Ai=dc?Ue(dc):Og;function Bb(i){return i===s}function Lb(i){return ee(i)&&ye(i)==Ir}function Nb(i){return ee(i)&&ve(i)==Jd}var Db=$n(_l),Ub=$n(function(i,r){return i<=r});function ju(i){if(!i)return[];if(Ce(i))return Zn(i)?ot(i):Ee(i);if(Fr&&i[Fr])return gh(i[Fr]());var r=ye(i),a=r==nt?pl:r==at?yn:xi;return a(i)}function xt(i){if(!i)return i===0?i:0;if(i=je(i),i===ii||i===-ii){var r=i<0?-1:1;return r*$d}return i===i?i:0}function U(i){var r=xt(i),a=r%1;return r===r?a?r-a:r:0}function em(i){return i?si(U(i),0,mt):0}function je(i){if(typeof i=="number")return i;if(He(i))return sn;if(Z(i)){var r=typeof i.valueOf=="function"?i.valueOf():i;i=Z(r)?r+"":r}if(typeof i!="string")return i===0?i:+i;i=bc(i);var a=bf.test(i);return a||vf.test(i)?jf(i.slice(2),a?2:8):Mf.test(i)?sn:+i}function tm(i){return ft(i,Ae(i))}function Gb(i){return i?si(U(i),-D,D):i===0?i:0}function W(i){return i==null?"":Ge(i)}var Hb=Ti(function(i,r){if(Dr(r)||Ce(r)){ft(r,ce(r),i);return}for(var a in r)X.call(r,a)&&Ar(i,a,r[a])}),im=Ti(function(i,r){ft(r,Ae(r),i)}),jn=Ti(function(i,r,a,l){ft(r,Ae(r),i,l)}),kb=Ti(function(i,r,a,l){ft(r,ce(r),i,l)}),$b=Et(hl);function Vb(i,r){var a=Si(i);return r==null?a:Bc(a,r)}var qb=H(function(i,r){i=Y(i);var a=-1,l=r.length,c=l>2?r[2]:s;for(c&&_e(r[0],r[1],c)&&(l=1);++a<l;)for(var m=r[a],f=Ae(m),h=-1,b=f.length;++h<b;){var P=f[h],R=i[P];(R===s||lt(R,Pi[P])&&!X.call(i,P))&&(i[P]=m[P])}return i}),Wb=H(function(i){return i.push(s,bu),De(rm,s,i)});function Kb(i,r){return hc(i,A(r,3),dt)}function Xb(i,r){return hc(i,A(r,3),yl)}function Yb(i,r){return i==null?i:gl(i,A(r,3),Ae)}function Qb(i,r){return i==null?i:Gc(i,A(r,3),Ae)}function zb(i,r){return i&&dt(i,A(r,3))}function Jb(i,r){return i&&yl(i,A(r,3))}function Zb(i){return i==null?[]:Bn(i,ce(i))}function jb(i){return i==null?[]:Bn(i,Ae(i))}function Ql(i,r,a){var l=i==null?s:li(i,r);return l===s?a:l}function ew(i,r){return i!=null&&_u(i,r,Ig)}function zl(i,r){return i!=null&&_u(i,r,Pg)}var tw=fu(function(i,r,a){r!=null&&typeof r.toString!="function"&&(r=vn.call(r)),i[r]=a},Zl(xe)),iw=fu(function(i,r,a){r!=null&&typeof r.toString!="function"&&(r=vn.call(r)),X.call(i,r)?i[r].push(a):i[r]=[a]},A),rw=H(Or);function ce(i){return Ce(i)?xc(i):vl(i)}function Ae(i){return Ce(i)?xc(i,!0):Bg(i)}function nw(i,r){var a={};return r=A(r,3),dt(i,function(l,c,m){St(a,r(l,c,m),l)}),a}function aw(i,r){var a={};return r=A(r,3),dt(i,function(l,c,m){St(a,c,r(l,c,m))}),a}var ow=Ti(function(i,r,a){Ln(i,r,a)}),rm=Ti(function(i,r,a,l){Ln(i,r,a,l)}),sw=Et(function(i,r){var a={};if(i==null)return a;var l=!1;r=J(r,function(m){return m=qt(m,i),l||(l=m.length>1),m}),ft(i,Ll(i),a),l&&(a=ze(a,w|v|S,ty));for(var c=r.length;c--;)Sl(a,r[c]);return a});function lw(i,r){return nm(i,zn(A(r)))}var pw=Et(function(i,r){return i==null?{}:Ng(i,r)});function nm(i,r){if(i==null)return{};var a=J(Ll(i),function(l){return[l]});return r=A(r),Qc(i,a,function(l,c){return r(l,c[0])})}function cw(i,r,a){r=qt(r,i);var l=-1,c=r.length;for(c||(c=1,i=s);++l<c;){var m=i==null?s:i[ht(r[l])];m===s&&(l=c,m=a),i=At(m)?m.call(i):m}return i}function uw(i,r,a){return i==null?i:Lr(i,r,a)}function mw(i,r,a,l){return l=typeof l=="function"?l:s,i==null?i:Lr(i,r,a,l)}var am=yu(ce),om=yu(Ae);function dw(i,r,a){var l=N(i),c=l||Kt(i)||Ai(i);if(r=A(r,4),a==null){var m=i&&i.constructor;c?a=l?new m:[]:Z(i)?a=At(m)?Si(Pn(i)):{}:a={}}return(c?Xe:dt)(i,function(f,h,b){return r(a,f,h,b)}),a}function fw(i,r){return i==null?!0:Sl(i,r)}function hw(i,r,a){return i==null?i:eu(i,r,Cl(a))}function gw(i,r,a,l){return l=typeof l=="function"?l:s,i==null?i:eu(i,r,Cl(a),l)}function xi(i){return i==null?[]:ll(i,ce(i))}function yw(i){return i==null?[]:ll(i,Ae(i))}function Mw(i,r,a){return a===s&&(a=r,r=s),a!==s&&(a=je(a),a=a===a?a:0),r!==s&&(r=je(r),r=r===r?r:0),si(je(i),r,a)}function bw(i,r,a){return r=xt(r),a===s?(a=r,r=0):a=xt(a),i=je(i),Rg(i,r,a)}function ww(i,r,a){if(a&&typeof a!="boolean"&&_e(i,r,a)&&(r=a=s),a===s&&(typeof r=="boolean"?(a=r,r=s):typeof i=="boolean"&&(a=i,i=s)),i===s&&r===s?(i=0,r=1):(i=xt(i),r===s?(r=i,i=0):r=xt(r)),i>r){var l=i;i=r,r=l}if(a||i%1||r%1){var c=Cc();return ge(i+c*(r-i+Zf("1e-"+((c+"").length-1))),r)}return Pl(i,r)}var vw=Ei(function(i,r,a){return r=r.toLowerCase(),i+(a?sm(r):r)});function sm(i){return Jl(W(i).toLowerCase())}function lm(i){return i=W(i),i&&i.replace(If,uh).replace($f,"")}function _w(i,r,a){i=W(i),r=Ge(r);var l=i.length;a=a===s?l:si(U(a),0,l);var c=a;return a-=r.length,a>=0&&i.slice(a,c)==r}function Iw(i){return i=W(i),i&&rf.test(i)?i.replace(Gp,mh):i}function Pw(i){return i=W(i),i&&pf.test(i)?i.replace(Ks,"\\$&"):i}var Rw=Ei(function(i,r,a){return i+(a?"-":"")+r.toLowerCase()}),Fw=Ei(function(i,r,a){return i+(a?" ":"")+r.toLowerCase()}),Sw=uu("toLowerCase");function Tw(i,r,a){i=W(i),r=U(r);var l=r?Ii(i):0;if(!r||l>=r)return i;var c=(r-l)/2;return kn(Tn(c),a)+i+kn(Sn(c),a)}function Ew(i,r,a){i=W(i),r=U(r);var l=r?Ii(i):0;return r&&l<r?i+kn(r-l,a):i}function Cw(i,r,a){i=W(i),r=U(r);var l=r?Ii(i):0;return r&&l<r?kn(r-l,a)+i:i}function Aw(i,r,a){return a||r==null?r=0:r&&(r=+r),Uh(W(i).replace(Xs,""),r||0)}function xw(i,r,a){return(a?_e(i,r,a):r===s)?r=1:r=U(r),Rl(W(i),r)}function Ow(){var i=arguments,r=W(i[0]);return i.length<3?r:r.replace(i[1],i[2])}var Bw=Ei(function(i,r,a){return i+(a?"_":"")+r.toLowerCase()});function Lw(i,r,a){return a&&typeof a!="number"&&_e(i,r,a)&&(r=a=s),a=a===s?mt:a>>>0,a?(i=W(i),i&&(typeof r=="string"||r!=null&&!Yl(r))&&(r=Ge(r),!r&&_i(i))?Wt(ot(i),0,a):i.split(r,a)):[]}var Nw=Ei(function(i,r,a){return i+(a?" ":"")+Jl(r)});function Dw(i,r,a){return i=W(i),a=a==null?0:si(U(a),0,i.length),r=Ge(r),i.slice(a,a+r.length)==r}function Uw(i,r,a){var l=u.templateSettings;a&&_e(i,r,a)&&(r=s),i=W(i),r=jn({},r,l,Mu);var c=jn({},r.imports,l.imports,Mu),m=ce(c),f=ll(c,m),h,b,P=0,R=r.interpolate||mn,F="__p += '",T=cl((r.escape||mn).source+"|"+R.source+"|"+(R===Hp?yf:mn).source+"|"+(r.evaluate||mn).source+"|$","g"),C="//# sourceURL="+(X.call(r,"sourceURL")?(r.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Xf+"]")+`
4
+ `;i.replace(T,function(O,k,V,ke,Ie,$e){return V||(V=ke),F+=i.slice(P,$e).replace(Pf,dh),k&&(h=!0,F+=`' +
5
+ __e(`+k+`) +
6
6
  '`),Ie&&(b=!0,F+=`';
7
7
  `+Ie+`;
8
- __p += '`),$&&(F+=`' +
9
- ((__t = (`+$+`)) == null ? '' : __t) +
8
+ __p += '`),V&&(F+=`' +
9
+ ((__t = (`+V+`)) == null ? '' : __t) +
10
10
  '`),P=$e+O.length,O}),F+=`';
11
- `;var A=X.call(r,"variable")&&r.variable;if(!A)F=`with (obj) {
11
+ `;var x=X.call(r,"variable")&&r.variable;if(!x)F=`with (obj) {
12
12
  `+F+`
13
13
  }
14
- `;else if(hf.test(A))throw new B(p);F=(b?F.replace(Zd,""):F).replace(jd,"$1").replace(ef,"$1;"),F="function("+(A||"obj")+`) {
15
- `+(A?"":`obj || (obj = {});
14
+ `;else if(hf.test(x))throw new L(p);F=(b?F.replace(Zd,""):F).replace(jd,"$1").replace(ef,"$1;"),F="function("+(x||"obj")+`) {
15
+ `+(x?"":`obj || (obj = {});
16
16
  `)+"var __t, __p = ''"+(h?", __e = _.escape":"")+(b?`, __j = Array.prototype.join;
17
17
  function print() { __p += __j.call(arguments, '') }
18
18
  `:`;
19
19
  `)+F+`return __p
20
- }`;var U=cm(function(){return V(m,C+"return "+F).apply(s,f)});if(U.source=F,Xl(U))throw U;return U}function Hw(i){return W(i).toLowerCase()}function Gw(i){return W(i).toUpperCase()}function kw(i,r,a){if(i=W(i),i&&(a||r===s))return bc(i);if(!i||!(r=He(r)))return i;var l=ot(i),c=ot(r),m=wc(l,c),f=vc(l,c)+1;return Wt(l,m,f).join("")}function $w(i,r,a){if(i=W(i),i&&(a||r===s))return i.slice(0,Ic(i)+1);if(!i||!(r=He(r)))return i;var l=ot(i),c=vc(l,ot(r))+1;return Wt(l,0,c).join("")}function Vw(i,r,a){if(i=W(i),i&&(a||r===s))return i.replace(Xs,"");if(!i||!(r=He(r)))return i;var l=ot(i),c=wc(l,ot(r));return Wt(l,c).join("")}function qw(i,r){var a=Nd,l=Dd;if(Z(r)){var c="separator"in r?r.separator:c;a="length"in r?D(r.length):a,l="omission"in r?He(r.omission):l}i=W(i);var m=i.length;if(_i(i)){var f=ot(i);m=f.length}if(a>=m)return i;var h=a-Ii(l);if(h<1)return l;var b=f?Wt(f,0,h).join(""):i.slice(0,h);if(c===s)return b+l;if(f&&(h+=b.length-h),Yl(c)){if(i.slice(h).search(c)){var P,R=b;for(c.global||(c=cl(c.source,W(kp.exec(c))+"g")),c.lastIndex=0;P=c.exec(R);)var F=P.index;b=b.slice(0,F===s?h:F)}}else if(i.indexOf(He(c),h)!=h){var T=b.lastIndexOf(c);T>-1&&(b=b.slice(0,T))}return b+l}function Ww(i){return i=W(i),i&&tf.test(i)?i.replace(Up,wh):i}var Kw=Ei(function(i,r,a){return i+(a?" ":"")+r.toUpperCase()}),Jl=uu("toUpperCase");function pm(i,r,a){return i=W(i),r=a?s:r,r===s?hh(i)?Ih(i):oh(i):i.match(r)||[]}var cm=H(function(i,r){try{return De(i,s,r)}catch(a){return Xl(a)?a:new B(a)}}),Xw=Et(function(i,r){return Xe(r,function(a){a=ht(a),St(i,a,Wl(i[a],i))}),i});function Yw(i){var r=i==null?0:i.length,a=x();return i=r?J(i,function(l){if(typeof l[1]!="function")throw new Ye(o);return[a(l[0]),l[1]]}):[],H(function(l){for(var c=-1;++c<r;){var m=i[c];if(De(m[0],this,l))return De(m[1],this,l)}})}function Qw(i){return wg(ze(i,v))}function Zl(i){return function(){return i}}function zw(i,r){return i==null||i!==i?r:i}var Jw=du(),Zw=du(!0);function Ae(i){return i}function jl(i){return Vc(typeof i=="function"?i:ze(i,v))}function jw(i){return Wc(ze(i,v))}function ev(i,r){return Kc(i,ze(r,v))}var tv=H(function(i,r){return function(a){return Or(a,i,r)}}),iv=H(function(i,r){return function(a){return Or(i,a,r)}});function ep(i,r,a){var l=ce(r),c=Bn(r,l);a==null&&!(Z(r)&&(c.length||!l.length))&&(a=r,r=i,i=this,c=Bn(r,ce(r)));var m=!(Z(a)&&"chain"in a)||!!a.chain,f=xt(i);return Xe(c,function(h){var b=r[h];i[h]=b,f&&(i.prototype[h]=function(){var P=this.__chain__;if(m||P){var R=i(this.__wrapped__),F=R.__actions__=Ee(this.__actions__);return F.push({func:b,args:arguments,thisArg:i}),R.__chain__=P,R}return b.apply(i,Ut([this.value()],arguments))})}),i}function rv(){return pe._===this&&(pe._=Eh),this}function tp(){}function nv(i){return i=D(i),H(function(r){return Xc(r,i)})}var av=Al(J),ov=Al(fc),sv=Al(rl);function um(i){return Hl(i)?nl(ht(i)):Dg(i)}function lv(i){return function(r){return i==null?s:li(i,r)}}var pv=hu(),cv=hu(!0);function ip(){return[]}function rp(){return!1}function uv(){return{}}function mv(){return""}function dv(){return!0}function fv(i,r){if(i=D(i),i<1||i>N)return[];var a=mt,l=ge(i,mt);r=x(r),i-=mt;for(var c=sl(l,r);++a<i;)r(a);return c}function hv(i){return L(i)?J(i,ht):Ge(i)?[i]:Ee(xu(W(i)))}function gv(i){var r=++Sh;return W(i)+r}var yv=Gn(function(i,r){return i+r},0),Mv=Ol("ceil"),bv=Gn(function(i,r){return i/r},1),wv=Ol("floor");function vv(i){return i&&i.length?On(i,Ae,Ml):s}function _v(i,r){return i&&i.length?On(i,x(r,2),Ml):s}function Iv(i){return yc(i,Ae)}function Pv(i,r){return yc(i,x(r,2))}function Rv(i){return i&&i.length?On(i,Ae,_l):s}function Fv(i,r){return i&&i.length?On(i,x(r,2),_l):s}var Sv=Gn(function(i,r){return i*r},1),Tv=Ol("round"),Ev=Gn(function(i,r){return i-r},0);function Cv(i){return i&&i.length?ol(i,Ae):0}function xv(i,r){return i&&i.length?ol(i,x(r,2)):0}return u.after=jM,u.ary=$u,u.assign=Gb,u.assignIn=im,u.assignInWith=jn,u.assignWith=kb,u.at=$b,u.before=Vu,u.bind=Wl,u.bindAll=Xw,u.bindKey=qu,u.castArray=ub,u.chain=Hu,u.chunk=wy,u.compact=vy,u.concat=_y,u.cond=Yw,u.conforms=Qw,u.constant=Zl,u.countBy=CM,u.create=Vb,u.curry=Wu,u.curryRight=Ku,u.debounce=Xu,u.defaults=qb,u.defaultsDeep=Wb,u.defer=eb,u.delay=tb,u.difference=Iy,u.differenceBy=Py,u.differenceWith=Ry,u.drop=Fy,u.dropRight=Sy,u.dropRightWhile=Ty,u.dropWhile=Ey,u.fill=Cy,u.filter=AM,u.flatMap=LM,u.flatMapDeep=NM,u.flatMapDepth=DM,u.flatten=Lu,u.flattenDeep=xy,u.flattenDepth=Ay,u.flip=ib,u.flow=Jw,u.flowRight=Zw,u.fromPairs=Oy,u.functions=Zb,u.functionsIn=jb,u.groupBy=UM,u.initial=Ly,u.intersection=Ny,u.intersectionBy=Dy,u.intersectionWith=Uy,u.invert=tw,u.invertBy=iw,u.invokeMap=GM,u.iteratee=jl,u.keyBy=kM,u.keys=ce,u.keysIn=xe,u.map=Xn,u.mapKeys=nw,u.mapValues=aw,u.matches=jw,u.matchesProperty=ev,u.memoize=Qn,u.merge=ow,u.mergeWith=rm,u.method=tv,u.methodOf=iv,u.mixin=ep,u.negate=zn,u.nthArg=nv,u.omit=sw,u.omitBy=lw,u.once=rb,u.orderBy=$M,u.over=av,u.overArgs=nb,u.overEvery=ov,u.overSome=sv,u.partial=Kl,u.partialRight=Yu,u.partition=VM,u.pick=pw,u.pickBy=nm,u.property=um,u.propertyOf=lv,u.pull=$y,u.pullAll=Du,u.pullAllBy=Vy,u.pullAllWith=qy,u.pullAt=Wy,u.range=pv,u.rangeRight=cv,u.rearg=ab,u.reject=KM,u.remove=Ky,u.rest=ob,u.reverse=Vl,u.sampleSize=YM,u.set=uw,u.setWith=mw,u.shuffle=QM,u.slice=Xy,u.sortBy=ZM,u.sortedUniq=eM,u.sortedUniqBy=tM,u.split=Lw,u.spread=sb,u.tail=iM,u.take=rM,u.takeRight=nM,u.takeRightWhile=aM,u.takeWhile=oM,u.tap=vM,u.throttle=lb,u.thru=Kn,u.toArray=ju,u.toPairs=am,u.toPairsIn=om,u.toPath=hv,u.toPlainObject=tm,u.transform=dw,u.unary=pb,u.union=sM,u.unionBy=lM,u.unionWith=pM,u.uniq=cM,u.uniqBy=uM,u.uniqWith=mM,u.unset=fw,u.unzip=ql,u.unzipWith=Uu,u.update=hw,u.updateWith=gw,u.values=Ai,u.valuesIn=yw,u.without=dM,u.words=pm,u.wrap=cb,u.xor=fM,u.xorBy=hM,u.xorWith=gM,u.zip=yM,u.zipObject=MM,u.zipObjectDeep=bM,u.zipWith=wM,u.entries=am,u.entriesIn=om,u.extend=im,u.extendWith=jn,ep(u,u),u.add=yv,u.attempt=cm,u.camelCase=vw,u.capitalize=sm,u.ceil=Mv,u.clamp=Mw,u.clone=mb,u.cloneDeep=fb,u.cloneDeepWith=hb,u.cloneWith=db,u.conformsTo=gb,u.deburr=lm,u.defaultTo=zw,u.divide=bv,u.endsWith=_w,u.eq=lt,u.escape=Iw,u.escapeRegExp=Pw,u.every=xM,u.find=OM,u.findIndex=Ou,u.findKey=Kb,u.findLast=BM,u.findLastIndex=Bu,u.findLastKey=Xb,u.floor=wv,u.forEach=Gu,u.forEachRight=ku,u.forIn=Yb,u.forInRight=Qb,u.forOwn=zb,u.forOwnRight=Jb,u.get=Ql,u.gt=yb,u.gte=Mb,u.has=ew,u.hasIn=zl,u.head=Nu,u.identity=Ae,u.includes=HM,u.indexOf=By,u.inRange=bw,u.invoke=rw,u.isArguments=ui,u.isArray=L,u.isArrayBuffer=bb,u.isArrayLike=Ce,u.isArrayLikeObject=te,u.isBoolean=wb,u.isBuffer=Kt,u.isDate=vb,u.isElement=_b,u.isEmpty=Ib,u.isEqual=Pb,u.isEqualWith=Rb,u.isError=Xl,u.isFinite=Fb,u.isFunction=xt,u.isInteger=Qu,u.isLength=Jn,u.isMap=zu,u.isMatch=Sb,u.isMatchWith=Tb,u.isNaN=Eb,u.isNative=Cb,u.isNil=Ab,u.isNull=xb,u.isNumber=Ju,u.isObject=Z,u.isObjectLike=ee,u.isPlainObject=Hr,u.isRegExp=Yl,u.isSafeInteger=Ob,u.isSet=Zu,u.isString=Zn,u.isSymbol=Ge,u.isTypedArray=xi,u.isUndefined=Bb,u.isWeakMap=Lb,u.isWeakSet=Nb,u.join=Hy,u.kebabCase=Rw,u.last=Ze,u.lastIndexOf=Gy,u.lowerCase=Fw,u.lowerFirst=Sw,u.lt=Db,u.lte=Ub,u.max=vv,u.maxBy=_v,u.mean=Iv,u.meanBy=Pv,u.min=Rv,u.minBy=Fv,u.stubArray=ip,u.stubFalse=rp,u.stubObject=uv,u.stubString=mv,u.stubTrue=dv,u.multiply=Sv,u.nth=ky,u.noConflict=rv,u.noop=tp,u.now=Yn,u.pad=Tw,u.padEnd=Ew,u.padStart=Cw,u.parseInt=xw,u.random=ww,u.reduce=qM,u.reduceRight=WM,u.repeat=Aw,u.replace=Ow,u.result=cw,u.round=Tv,u.runInContext=M,u.sample=XM,u.size=zM,u.snakeCase=Bw,u.some=JM,u.sortedIndex=Yy,u.sortedIndexBy=Qy,u.sortedIndexOf=zy,u.sortedLastIndex=Jy,u.sortedLastIndexBy=Zy,u.sortedLastIndexOf=jy,u.startCase=Nw,u.startsWith=Dw,u.subtract=Ev,u.sum=Cv,u.sumBy=xv,u.template=Uw,u.times=fv,u.toFinite=At,u.toInteger=D,u.toLength=em,u.toLower=Hw,u.toNumber=je,u.toSafeInteger=Hb,u.toString=W,u.toUpper=Gw,u.trim=kw,u.trimEnd=$w,u.trimStart=Vw,u.truncate=qw,u.unescape=Ww,u.uniqueId=gv,u.upperCase=Kw,u.upperFirst=Jl,u.each=Gu,u.eachRight=ku,u.first=Nu,ep(u,function(){var i={};return dt(u,function(r,a){X.call(u.prototype,a)||(i[a]=r)}),i}(),{chain:!1}),u.VERSION=e,Xe(["bind","bindKey","curry","curryRight","partial","partialRight"],function(i){u[i].placeholder=u}),Xe(["drop","take"],function(i,r){k.prototype[i]=function(a){a=a===s?1:le(D(a),0);var l=this.__filtered__&&!r?new k(this):this.clone();return l.__filtered__?l.__takeCount__=ge(a,l.__takeCount__):l.__views__.push({size:ge(a,mt),type:i+(l.__dir__<0?"Right":"")}),l},k.prototype[i+"Right"]=function(a){return this.reverse()[i](a).reverse()}}),Xe(["filter","map","takeWhile"],function(i,r){var a=r+1,l=a==Lp||a==kd;k.prototype[i]=function(c){var m=this.clone();return m.__iteratees__.push({iteratee:x(c,3),type:a}),m.__filtered__=m.__filtered__||l,m}}),Xe(["head","last"],function(i,r){var a="take"+(r?"Right":"");k.prototype[i]=function(){return this[a](1).value()[0]}}),Xe(["initial","tail"],function(i,r){var a="drop"+(r?"":"Right");k.prototype[i]=function(){return this.__filtered__?new k(this):this[a](1)}}),k.prototype.compact=function(){return this.filter(Ae)},k.prototype.find=function(i){return this.filter(i).head()},k.prototype.findLast=function(i){return this.reverse().find(i)},k.prototype.invokeMap=H(function(i,r){return typeof i=="function"?new k(this):this.map(function(a){return Or(a,i,r)})}),k.prototype.reject=function(i){return this.filter(zn(x(i)))},k.prototype.slice=function(i,r){i=D(i);var a=this;return a.__filtered__&&(i>0||r<0)?new k(a):(i<0?a=a.takeRight(-i):i&&(a=a.drop(i)),r!==s&&(r=D(r),a=r<0?a.dropRight(-r):a.take(r-i)),a)},k.prototype.takeRightWhile=function(i){return this.reverse().takeWhile(i).reverse()},k.prototype.toArray=function(){return this.take(mt)},dt(k.prototype,function(i,r){var a=/^(?:filter|find|map|reject)|While$/.test(r),l=/^(?:head|last)$/.test(r),c=u[l?"take"+(r=="last"?"Right":""):r],m=l||/^find/.test(r);!c||(u.prototype[r]=function(){var f=this.__wrapped__,h=l?[1]:arguments,b=f instanceof k,P=h[0],R=b||L(f),F=function(G){var $=c.apply(u,Ut([G],h));return l&&T?$[0]:$};R&&a&&typeof P=="function"&&P.length!=1&&(b=R=!1);var T=this.__chain__,C=!!this.__actions__.length,A=m&&!T,U=b&&!C;if(!m&&R){f=U?f:new k(this);var O=i.apply(f,h);return O.__actions__.push({func:Kn,args:[F],thisArg:s}),new Qe(O,T)}return A&&U?i.apply(this,h):(O=this.thru(F),A?l?O.value()[0]:O.value():O)})}),Xe(["pop","push","shift","sort","splice","unshift"],function(i){var r=Mn[i],a=/^(?:push|sort|unshift)$/.test(i)?"tap":"thru",l=/^(?:pop|shift)$/.test(i);u.prototype[i]=function(){var c=arguments;if(l&&!this.__chain__){var m=this.value();return r.apply(L(m)?m:[],c)}return this[a](function(f){return r.apply(L(f)?f:[],c)})}}),dt(k.prototype,function(i,r){var a=u[r];if(a){var l=a.name+"";X.call(Fi,l)||(Fi[l]=[]),Fi[l].push({name:r,func:a})}}),Fi[Hn(s,ct).name]=[{name:"wrapper",func:s}],k.prototype.clone=Wh,k.prototype.reverse=Kh,k.prototype.value=Xh,u.prototype.at=_M,u.prototype.chain=IM,u.prototype.commit=PM,u.prototype.next=RM,u.prototype.plant=SM,u.prototype.reverse=TM,u.prototype.toJSON=u.prototype.valueOf=u.prototype.value=EM,u.prototype.first=u.prototype.head,Fr&&(u.prototype[Fr]=FM),u},Gt=Ph();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(pe._=Gt,define(function(){return Gt})):ri?((ri.exports=Gt)._=Gt,js._=Gt):pe._=Gt}).call(Oi)});var op=K((nI,ym)=>{"use strict";ym.exports=function(e,t){return function(){for(var o=new Array(arguments.length),p=0;p<o.length;p++)o[p]=arguments[p];return e.apply(t,o)}}});var Be=K((aI,wm)=>{"use strict";var Hv=op(),mi=Object.prototype.toString;function sp(s){return mi.call(s)==="[object Array]"}function lp(s){return typeof s=="undefined"}function Gv(s){return s!==null&&!lp(s)&&s.constructor!==null&&!lp(s.constructor)&&typeof s.constructor.isBuffer=="function"&&s.constructor.isBuffer(s)}function kv(s){return mi.call(s)==="[object ArrayBuffer]"}function $v(s){return typeof FormData!="undefined"&&s instanceof FormData}function Vv(s){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(s):e=s&&s.buffer&&s.buffer instanceof ArrayBuffer,e}function qv(s){return typeof s=="string"}function Wv(s){return typeof s=="number"}function Mm(s){return s!==null&&typeof s=="object"}function pa(s){if(mi.call(s)!=="[object Object]")return!1;var e=Object.getPrototypeOf(s);return e===null||e===Object.prototype}function Kv(s){return mi.call(s)==="[object Date]"}function Xv(s){return mi.call(s)==="[object File]"}function Yv(s){return mi.call(s)==="[object Blob]"}function bm(s){return mi.call(s)==="[object Function]"}function Qv(s){return Mm(s)&&bm(s.pipe)}function zv(s){return typeof URLSearchParams!="undefined"&&s instanceof URLSearchParams}function Jv(s){return s.trim?s.trim():s.replace(/^\s+|\s+$/g,"")}function Zv(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function pp(s,e){if(!(s===null||typeof s=="undefined"))if(typeof s!="object"&&(s=[s]),sp(s))for(var t=0,n=s.length;t<n;t++)e.call(null,s[t],t,s);else for(var o in s)Object.prototype.hasOwnProperty.call(s,o)&&e.call(null,s[o],o,s)}function cp(){var s={};function e(o,p){pa(s[p])&&pa(o)?s[p]=cp(s[p],o):pa(o)?s[p]=cp({},o):sp(o)?s[p]=o.slice():s[p]=o}for(var t=0,n=arguments.length;t<n;t++)pp(arguments[t],e);return s}function jv(s,e,t){return pp(e,function(o,p){t&&typeof o=="function"?s[p]=Hv(o,t):s[p]=o}),s}function e_(s){return s.charCodeAt(0)===65279&&(s=s.slice(1)),s}wm.exports={isArray:sp,isArrayBuffer:kv,isBuffer:Gv,isFormData:$v,isArrayBufferView:Vv,isString:qv,isNumber:Wv,isObject:Mm,isPlainObject:pa,isUndefined:lp,isDate:Kv,isFile:Xv,isBlob:Yv,isFunction:bm,isStream:Qv,isURLSearchParams:zv,isStandardBrowserEnv:Zv,forEach:pp,merge:cp,extend:jv,trim:Jv,stripBOM:e_}});var up=K((oI,_m)=>{"use strict";var Li=Be();function vm(s){return encodeURIComponent(s).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}_m.exports=function(e,t,n){if(!t)return e;var o;if(n)o=n(t);else if(Li.isURLSearchParams(t))o=t.toString();else{var p=[];Li.forEach(t,function(g,v){g===null||typeof g=="undefined"||(Li.isArray(g)?v=v+"[]":g=[g],Li.forEach(g,function(S){Li.isDate(S)?S=S.toISOString():Li.isObject(S)&&(S=JSON.stringify(S)),p.push(vm(v)+"="+vm(S))}))}),o=p.join("&")}if(o){var d=e.indexOf("#");d!==-1&&(e=e.slice(0,d)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}});var Pm=K((sI,Im)=>{"use strict";var t_=Be();function ca(){this.handlers=[]}ca.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};ca.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};ca.prototype.forEach=function(e){t_.forEach(this.handlers,function(n){n!==null&&e(n)})};Im.exports=ca});var Fm=K((lI,Rm)=>{"use strict";var i_=Be();Rm.exports=function(e,t){i_.forEach(e,function(o,p){p!==t&&p.toUpperCase()===t.toUpperCase()&&(e[t]=o,delete e[p])})}});var mp=K((pI,Sm)=>{"use strict";Sm.exports=function(e,t,n,o,p){return e.config=t,n&&(e.code=n),e.request=o,e.response=p,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 dp=K((cI,Tm)=>{"use strict";var r_=mp();Tm.exports=function(e,t,n,o,p){var d=new Error(e);return r_(d,t,n,o,p)}});var Cm=K((uI,Em)=>{"use strict";var n_=dp();Em.exports=function(e,t,n){var o=n.config.validateStatus;!n.status||!o||o(n.status)?e(n):t(n_("Request failed with status code "+n.status,n.config,null,n.request,n))}});var Am=K((mI,xm)=>{"use strict";var ua=Be();xm.exports=ua.isStandardBrowserEnv()?function(){return{write:function(t,n,o,p,d,y){var g=[];g.push(t+"="+encodeURIComponent(n)),ua.isNumber(o)&&g.push("expires="+new Date(o).toGMTString()),ua.isString(p)&&g.push("path="+p),ua.isString(d)&&g.push("domain="+d),y===!0&&g.push("secure"),document.cookie=g.join("; ")},read:function(t){var n=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var Bm=K((dI,Om)=>{"use strict";Om.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var Nm=K((fI,Lm)=>{"use strict";Lm.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}});var Um=K((hI,Dm)=>{"use strict";var a_=Bm(),o_=Nm();Dm.exports=function(e,t){return e&&!a_(t)?o_(e,t):t}});var Gm=K((gI,Hm)=>{"use strict";var fp=Be(),s_=["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"];Hm.exports=function(e){var t={},n,o,p;return e&&fp.forEach(e.split(`
21
- `),function(y){if(p=y.indexOf(":"),n=fp.trim(y.substr(0,p)).toLowerCase(),o=fp.trim(y.substr(p+1)),n){if(t[n]&&s_.indexOf(n)>=0)return;n==="set-cookie"?t[n]=(t[n]?t[n]:[]).concat([o]):t[n]=t[n]?t[n]+", "+o:o}}),t}});var Vm=K((yI,$m)=>{"use strict";var km=Be();$m.exports=km.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a"),n;function o(p){var d=p;return e&&(t.setAttribute("href",d),d=t.href),t.setAttribute("href",d),{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 n=o(window.location.href),function(d){var y=km.isString(d)?o(d):d;return y.protocol===n.protocol&&y.host===n.host}}():function(){return function(){return!0}}()});var Vr=K((MI,qm)=>{"use strict";function hp(s){this.message=s}hp.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};hp.prototype.__CANCEL__=!0;qm.exports=hp});var yp=K((bI,Wm)=>{"use strict";var ma=Be(),l_=Cm(),p_=Am(),c_=up(),u_=Um(),m_=Gm(),d_=Vm(),gp=dp(),f_=qr(),h_=Vr();Wm.exports=function(e){return new Promise(function(n,o){var p=e.data,d=e.headers,y=e.responseType,g;function v(){e.cancelToken&&e.cancelToken.unsubscribe(g),e.signal&&e.signal.removeEventListener("abort",g)}ma.isFormData(p)&&delete d["Content-Type"];var w=new XMLHttpRequest;if(e.auth){var S=e.auth.username||"",q=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";d.Authorization="Basic "+btoa(S+":"+q)}var Fe=u_(e.baseURL,e.url);w.open(e.method.toUpperCase(),c_(Fe,e.params,e.paramsSerializer),!0),w.timeout=e.timeout;function we(){if(!!w){var Se="getAllResponseHeaders"in w?m_(w.getAllResponseHeaders()):null,ue=!y||y==="text"||y==="json"?w.responseText:w.response,Te={data:ue,status:w.status,statusText:w.statusText,headers:Se,config:e,request:w};l_(function(ut){n(ut),v()},function(ut){o(ut),v()},Te),w=null}}if("onloadend"in w?w.onloadend=we:w.onreadystatechange=function(){!w||w.readyState!==4||w.status===0&&!(w.responseURL&&w.responseURL.indexOf("file:")===0)||setTimeout(we)},w.onabort=function(){!w||(o(gp("Request aborted",e,"ECONNABORTED",w)),w=null)},w.onerror=function(){o(gp("Network Error",e,null,w)),w=null},w.ontimeout=function(){var ue=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",Te=e.transitional||f_.transitional;e.timeoutErrorMessage&&(ue=e.timeoutErrorMessage),o(gp(ue,e,Te.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",w)),w=null},ma.isStandardBrowserEnv()){var ct=(e.withCredentials||d_(Fe))&&e.xsrfCookieName?p_.read(e.xsrfCookieName):void 0;ct&&(d[e.xsrfHeaderName]=ct)}"setRequestHeader"in w&&ma.forEach(d,function(ue,Te){typeof p=="undefined"&&Te.toLowerCase()==="content-type"?delete d[Te]:w.setRequestHeader(Te,ue)}),ma.isUndefined(e.withCredentials)||(w.withCredentials=!!e.withCredentials),y&&y!=="json"&&(w.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&w.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&w.upload&&w.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(g=function(Se){!w||(o(!Se||Se&&Se.type?new h_("canceled"):Se),w.abort(),w=null)},e.cancelToken&&e.cancelToken.subscribe(g),e.signal&&(e.signal.aborted?g():e.signal.addEventListener("abort",g))),p||(p=null),w.send(p)})}});var qr=K((wI,Ym)=>{"use strict";var he=Be(),Km=Fm(),g_=mp(),y_={"Content-Type":"application/x-www-form-urlencoded"};function Xm(s,e){!he.isUndefined(s)&&he.isUndefined(s["Content-Type"])&&(s["Content-Type"]=e)}function M_(){var s;return typeof XMLHttpRequest!="undefined"?s=yp():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(s=yp()),s}function b_(s,e,t){if(he.isString(s))try{return(e||JSON.parse)(s),he.trim(s)}catch(n){if(n.name!=="SyntaxError")throw n}return(t||JSON.stringify)(s)}var da={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:M_(),transformRequest:[function(e,t){return Km(t,"Accept"),Km(t,"Content-Type"),he.isFormData(e)||he.isArrayBuffer(e)||he.isBuffer(e)||he.isStream(e)||he.isFile(e)||he.isBlob(e)?e:he.isArrayBufferView(e)?e.buffer:he.isURLSearchParams(e)?(Xm(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):he.isObject(e)||t&&t["Content-Type"]==="application/json"?(Xm(t,"application/json"),b_(e)):e}],transformResponse:[function(e){var t=this.transitional||da.transitional,n=t&&t.silentJSONParsing,o=t&&t.forcedJSONParsing,p=!n&&this.responseType==="json";if(p||o&&he.isString(e)&&e.length)try{return JSON.parse(e)}catch(d){if(p)throw d.name==="SyntaxError"?g_(d,this,"E_JSON_PARSE"):d}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, */*"}}};he.forEach(["delete","get","head"],function(e){da.headers[e]={}});he.forEach(["post","put","patch"],function(e){da.headers[e]=he.merge(y_)});Ym.exports=da});var zm=K((vI,Qm)=>{"use strict";var w_=Be(),v_=qr();Qm.exports=function(e,t,n){var o=this||v_;return w_.forEach(n,function(d){e=d.call(o,e,t)}),e}});var Mp=K((_I,Jm)=>{"use strict";Jm.exports=function(e){return!!(e&&e.__CANCEL__)}});var ed=K((II,jm)=>{"use strict";var Zm=Be(),bp=zm(),__=Mp(),I_=qr(),P_=Vr();function wp(s){if(s.cancelToken&&s.cancelToken.throwIfRequested(),s.signal&&s.signal.aborted)throw new P_("canceled")}jm.exports=function(e){wp(e),e.headers=e.headers||{},e.data=bp.call(e,e.data,e.headers,e.transformRequest),e.headers=Zm.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Zm.forEach(["delete","get","head","post","put","patch","common"],function(o){delete e.headers[o]});var t=e.adapter||I_.adapter;return t(e).then(function(o){return wp(e),o.data=bp.call(e,o.data,o.headers,e.transformResponse),o},function(o){return __(o)||(wp(e),o&&o.response&&(o.response.data=bp.call(e,o.response.data,o.response.headers,e.transformResponse))),Promise.reject(o)})}});var vp=K((PI,td)=>{"use strict";var Ve=Be();td.exports=function(e,t){t=t||{};var n={};function o(w,S){return Ve.isPlainObject(w)&&Ve.isPlainObject(S)?Ve.merge(w,S):Ve.isPlainObject(S)?Ve.merge({},S):Ve.isArray(S)?S.slice():S}function p(w){if(Ve.isUndefined(t[w])){if(!Ve.isUndefined(e[w]))return o(void 0,e[w])}else return o(e[w],t[w])}function d(w){if(!Ve.isUndefined(t[w]))return o(void 0,t[w])}function y(w){if(Ve.isUndefined(t[w])){if(!Ve.isUndefined(e[w]))return o(void 0,e[w])}else return o(void 0,t[w])}function g(w){if(w in t)return o(e[w],t[w]);if(w in e)return o(void 0,e[w])}var v={url:d,method:d,data:d,baseURL:y,transformRequest:y,transformResponse:y,paramsSerializer:y,timeout:y,timeoutMessage:y,withCredentials:y,adapter:y,responseType:y,xsrfCookieName:y,xsrfHeaderName:y,onUploadProgress:y,onDownloadProgress:y,decompress:y,maxContentLength:y,maxBodyLength:y,transport:y,httpAgent:y,httpsAgent:y,cancelToken:y,socketPath:y,responseEncoding:y,validateStatus:g};return Ve.forEach(Object.keys(e).concat(Object.keys(t)),function(S){var q=v[S]||p,Fe=q(S);Ve.isUndefined(Fe)&&q!==g||(n[S]=Fe)}),n}});var _p=K((RI,id)=>{id.exports={version:"0.24.0"}});var ad=K((FI,nd)=>{"use strict";var R_=_p().version,Ip={};["object","boolean","number","function","string","symbol"].forEach(function(s,e){Ip[s]=function(n){return typeof n===s||"a"+(e<1?"n ":" ")+s}});var rd={};Ip.transitional=function(e,t,n){function o(p,d){return"[Axios v"+R_+"] Transitional option '"+p+"'"+d+(n?". "+n:"")}return function(p,d,y){if(e===!1)throw new Error(o(d," has been removed"+(t?" in "+t:"")));return t&&!rd[d]&&(rd[d]=!0,console.warn(o(d," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(p,d,y):!0}};function F_(s,e,t){if(typeof s!="object")throw new TypeError("options must be an object");for(var n=Object.keys(s),o=n.length;o-- >0;){var p=n[o],d=e[p];if(d){var y=s[p],g=y===void 0||d(y,p,s);if(g!==!0)throw new TypeError("option "+p+" must be "+g);continue}if(t!==!0)throw Error("Unknown option "+p)}}nd.exports={assertOptions:F_,validators:Ip}});var ud=K((SI,cd)=>{"use strict";var od=Be(),S_=up(),sd=Pm(),ld=ed(),fa=vp(),pd=ad(),Ni=pd.validators;function Wr(s){this.defaults=s,this.interceptors={request:new sd,response:new sd}}Wr.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=fa(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&&pd.assertOptions(t,{silentJSONParsing:Ni.transitional(Ni.boolean),forcedJSONParsing:Ni.transitional(Ni.boolean),clarifyTimeoutError:Ni.transitional(Ni.boolean)},!1);var n=[],o=!0;this.interceptors.request.forEach(function(q){typeof q.runWhen=="function"&&q.runWhen(e)===!1||(o=o&&q.synchronous,n.unshift(q.fulfilled,q.rejected))});var p=[];this.interceptors.response.forEach(function(q){p.push(q.fulfilled,q.rejected)});var d;if(!o){var y=[ld,void 0];for(Array.prototype.unshift.apply(y,n),y=y.concat(p),d=Promise.resolve(e);y.length;)d=d.then(y.shift(),y.shift());return d}for(var g=e;n.length;){var v=n.shift(),w=n.shift();try{g=v(g)}catch(S){w(S);break}}try{d=ld(g)}catch(S){return Promise.reject(S)}for(;p.length;)d=d.then(p.shift(),p.shift());return d};Wr.prototype.getUri=function(e){return e=fa(this.defaults,e),S_(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};od.forEach(["delete","get","head","options"],function(e){Wr.prototype[e]=function(t,n){return this.request(fa(n||{},{method:e,url:t,data:(n||{}).data}))}});od.forEach(["post","put","patch"],function(e){Wr.prototype[e]=function(t,n,o){return this.request(fa(o||{},{method:e,url:t,data:n}))}});cd.exports=Wr});var dd=K((TI,md)=>{"use strict";var T_=Vr();function Di(s){if(typeof s!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(o){e=o});var t=this;this.promise.then(function(n){if(!!t._listeners){var o,p=t._listeners.length;for(o=0;o<p;o++)t._listeners[o](n);t._listeners=null}}),this.promise.then=function(n){var o,p=new Promise(function(d){t.subscribe(d),o=d}).then(n);return p.cancel=function(){t.unsubscribe(o)},p},s(function(o){t.reason||(t.reason=new T_(o),e(t.reason))})}Di.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};Di.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};Di.prototype.unsubscribe=function(e){if(!!this._listeners){var t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}};Di.source=function(){var e,t=new Di(function(o){e=o});return{token:t,cancel:e}};md.exports=Di});var hd=K((EI,fd)=>{"use strict";fd.exports=function(e){return function(n){return e.apply(null,n)}}});var yd=K((CI,gd)=>{"use strict";gd.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var wd=K((xI,Pp)=>{"use strict";var Md=Be(),E_=op(),ha=ud(),C_=vp(),x_=qr();function bd(s){var e=new ha(s),t=E_(ha.prototype.request,e);return Md.extend(t,ha.prototype,e),Md.extend(t,e),t.create=function(o){return bd(C_(s,o))},t}var gt=bd(x_);gt.Axios=ha;gt.Cancel=Vr();gt.CancelToken=dd();gt.isCancel=Mp();gt.VERSION=_p().version;gt.all=function(e){return Promise.all(e)};gt.spread=hd();gt.isAxiosError=yd();Pp.exports=gt;Pp.exports.default=gt});var _d=K((AI,vd)=>{vd.exports=wd()});var gm=dm(fm());var ap=s=>{let e=200,t=[],n=0;return t[n]=[],s.forEach(o=>{t[n].length<=e-1?t[n].push(o):(n++,t[n]=[o])}),t},ea=s=>{let e=[],t=200;for(;s.length>t;){let n=s.splice(0,t);e.push(n)}return e.push(s),e},Oe=(s,e)=>{let t="",n={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"},o={profile:"http://localhost:8010/v1",football:"http://localhost:8080/v1",idMapping:"http://localhost:8030/v1",predictor:"http://localhost:8040/v1",client:"http://localhost:8070/v1",loyalty:"http://localhost:8060/v1"},p={profile:"https://profile.fansunitedstagingapi.com/v1",football:"https://football.fansunitedstagingapi.com/v1",idMapping:"https://id-mapping.fansunitedstagingapi.com/v1",predictor:"https://prediction.fansunitedstagingapi.com/v1",client:"https://client.fansunitedstagingapi.com/v1",loyalty:"https://loyalty.fansunitedstagingapi.com/v1"};return s==="prod"?t=n[e]:s==="dev"?t=o[e]:t=p[e],t},Xt=s=>s.filter((t,n,o)=>n===o.indexOf(t)),ta=s=>Array.isArray(s)?s.map(e=>ta(e)):s!=null&&s.constructor===Object?Object.keys(s).reduce((e,t)=>({...e,[(0,gm.camelCase)(t)]:ta(s[t])}),{}):s,de=s=>s||!1,fe=()=>`&disable_cache=${Date.now()}`,kr=s=>s.sort((e,t)=>e.localeCompare(t));var ia=class{id=null;name=null;nickname=null;avatar=null;gender=null;country=null;birthDate=null;interests=[];followingCount=0;followersCount=0};var ra=class{profilesFromResponse=e=>e?e.map(t=>this.fullProfileFromResponse(t)):null;fullProfileFromResponse=e=>{let t=new ia;return t.id=e.id,t.name=e.name,t.nickname=e.nickname,t.avatar=e.avatar,t.gender=e.gender,t.country=e.country,t.birthDate=e.birth_date,t.interests=e.interests?e.interests:[],t.followingCount=e.following_count,t.followersCount=e.followers_count,t}};var na=class{nextPageStartsAfter=null;itemsPerPage=null};var Bi=class{pagination=new na};var re=class{meta=new Bi;data=[]};var aa=class{avatar=null;followingId=null;name=null;nickname=null;profileId=null};var oa=class{followResponse=e=>e.map(t=>this.remapResponse(t));followingFromResponse=e=>{let t=new re;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(n=>this.remapResponse(n)),t};remapResponse=e=>{let t=new aa;return t.avatar=e.avatar,t.followingId=e.following_id,t.name=e.name,t.profileId=e.profile_id,t.nickname=e.nickname,t}};var sa=class{avatar=null;followerId=null;name=null;nickname=null;profileId=null};var la=class{followersFromResponse=e=>{let t=new re;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(n=>this.remapResponse(n)),t};remapResponse=e=>{let t=new sa;return t.avatar=e.avatar,t.followerId=e.follower_id,t.name=e.name,t.profileId=e.profile_id,t}};var $r=class{profile_ids=[]};var ya=dm(_d());function Rp(s){this.message=s}Rp.prototype=new Error,Rp.prototype.name="InvalidCharacterError";var Id=typeof window!="undefined"&&window.atob&&window.atob.bind(window)||function(s){var e=String(s).replace(/=+$/,"");if(e.length%4==1)throw new Rp("'atob' failed: The string to be decoded is not correctly encoded.");for(var t,n,o=0,p=0,d="";n=e.charAt(p++);~n&&(t=o%4?64*t+n:n,o++%4)?d+=String.fromCharCode(255&t>>(-2*o&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return d};function A_(s){var e=s.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw"Illegal base64url string!"}try{return function(t){return decodeURIComponent(Id(t).replace(/(.)/g,function(n,o){var p=o.charCodeAt(0).toString(16).toUpperCase();return p.length<2&&(p="0"+p),"%"+p}))}(e)}catch{return Id(e)}}function ga(s){this.message=s}function O_(s,e){if(typeof s!="string")throw new ga("Invalid token specified");var t=(e=e||{}).header===!0?0:1;try{return JSON.parse(A_(s.split(".")[t]))}catch(n){throw new ga("Invalid token specified: "+n.message)}}ga.prototype=new Error,ga.prototype.name="InvalidTokenError";var Pd=O_;var Rd=(s,e,t)=>{let n={data:s.data,status:e,statusText:t,headers:s.headers,config:s};return{code:String(e),config:s,isAxiosError:!0,toJSON:()=>({}),name:"Unauthorized",message:t,response:n}};var Me=class{instanceAuth=null;instance=null;constructor(e,t){this.instanceAuth=ya.default.create({baseURL:t,headers:{Authorization:`Bearer ${e.authProvider.getIdToken()}`,"Content-Type":"application/json"}}),this.instanceAuth.interceptors.request.use(n=>{let o=null;try{o=Pd(e.authProvider.getIdToken())}catch(d){throw Rd(n,401,d.message)}return Date.now()>o.exp&&(ya.default.defaults.headers.common.Authorization=`Bearer ${e.authProvider.getIdToken()}`,n.headers.Authorization=`Bearer ${e.authProvider.getIdToken()}`),n},n=>{Promise.reject(n)}),this.instanceAuth.interceptors.response.use(n=>n,n=>{let o=n.config;if((n.response?.status===403||n.response?.status===401)&&!o._retry){o._retry=!0;let p=e.authProvider.getIdToken();return o.headers.Authorization=`Bearer ${p}`,this.instanceAuth(o)}return Promise.reject(n)}),this.instance=ya.default.create({baseURL:t,headers:{"Content-Type":"application/json"}})}};var B_="/countries",Le="/profile",Fd="/profiles",Ui=class extends Me{apiSignInUrl=null;profileRemapper=null;followingRemapper=null;followersRemapper=null;lang=null;constructor(e){super(e,Oe(e.environment,"profile"));this.lang=e.lang,this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}`,this.profileRemapper=new ra,this.followingRemapper=new oa,this.followersRemapper=new la}getCountries=async e=>{try{let t=`&lang=${this.lang}`,n=`${B_}${this.apiSignInUrl}${t}`,o=Date.now();return e&&(n+=`&disable_cache=${o}`),(await this.instance.get(n)).data.data}catch(t){throw console.warn("There was a problem fetching the countries:",t),t.response}};getProfile=async e=>{let t=`${Le}${this.apiSignInUrl}`;if(e){t=`${Fd}/${e}${this.apiSignInUrl}`;try{let n=await this.instance.get(t);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(t);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,t)=>{try{let n=`${Fd}${this.apiSignInUrl}&profile_ids=${e.join(",")}`,o=Date.now();t&&(n+=`&disable_cache=${o}`);let p=await this.instance.get(n);return this.profileRemapper.profilesFromResponse(p.data.data)}catch(n){throw console.warn(`There was a problem fetching the following profiles: ${e.join(",")}`,n),n.response}};getFollowers=async(e,t)=>{let n=`${Le}/followers${this.apiSignInUrl}`;if(e&&!t){n=`${Le}/followers${this.apiSignInUrl}${e.constructFilterUrl()}`;try{let o=await this.instanceAuth.get(n);return this.followersRemapper.followersFromResponse(o.data)}catch(o){throw console.warn("There was a problem fetching the followers for own profile",o),o.response}}else if(!e&&!t)try{let o=await this.instanceAuth.get(n);return this.followersRemapper.followersFromResponse(o.data)}catch(o){throw console.warn("There was a problem fetching the followers for own profile",o),o.response}e&&t?n=`${Le}/${t}/followers${this.apiSignInUrl}${e.constructFilterUrl()}`:!e&&t&&(n=`${Le}/${t}/followers${this.apiSignInUrl}`);try{let o=await this.instance.get(n);return this.followersRemapper.followersFromResponse(o.data)}catch(o){throw console.warn(`There was a problem fetching the followers for profile: ${t}`,o),o.response}};getFollowing=async(e,t)=>{let n=`${Le}/following${this.apiSignInUrl}`;if(e&&!t){n=`${Le}/following${this.apiSignInUrl}${e.constructFilterUrl()}`;try{let o=await this.instanceAuth.get(n);return this.followingRemapper.followingFromResponse(o.data)}catch(o){throw console.warn("There was a problem fetching the followers of own profile",o),o.response}}else if(!e&&!t)try{let o=await this.instanceAuth.get(n);return this.followingRemapper.followingFromResponse(o.data)}catch(o){throw console.warn("There was a problem fetching the followers of own profile",o),o.response}e&&t?n=`${Le}/${t}/following${this.apiSignInUrl}${e.constructFilterUrl()}`:!e&&t&&(n=`${Le}/${t}/following${this.apiSignInUrl}`);try{let o=await this.instance.get(n);return this.followingRemapper.followingFromResponse(o.data)}catch(o){throw console.warn(`There was a problem fetching the followers of the following profile: ${t}`,o),o.response}};follow=async e=>{let t=new $r;t.profile_ids=e;try{let n=await this.instanceAuth.post(`${Le}/follow${this.apiSignInUrl}`,JSON.stringify(t));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 t=new $r;t.profile_ids=e;try{return await this.instanceAuth.delete(`${Le}/follow${this.apiSignInUrl}`,{data:JSON.stringify(t)}),!0}catch(n){throw console.warn(`There was a problem with DELETE request for profiles: ${e.join(",")} `,n),n.response}};getBadges=async e=>{let t=`${Le}/badges${this.apiSignInUrl}`;try{return e?(t=`${Le}/${e}/badges${this.apiSignInUrl}`,(await this.instance.get(t)).data.data):(await this.instanceAuth.get(t)).data.data}catch(n){throw console.warn("There was a problem with fetching the badges",n),n.response}};updateProfile=async e=>{try{let t=await this.instanceAuth.patch(`${Le}${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 Bt={native:"id",sportradar:"sportradar_id",sportal365:"sportal365_id",enetpulse:"enetpulse_id"},Fp={PREDICTOR_USER_RELATED_OPERATION:"https://docs.fansunitedmedia.com/docs/predictor-operations#user-related-operations"},Sp=["matchId","matchType","market","prediction"];var Sd="FansUnited",Tp={football:{ids:[],countries:[],competitions:[]},profile:{info:{},statistics:{},badges:null,countries:[],exparations:{profile:0,statistics:0,badges:0}}},yt=class{idSchema="";expirationTimeout=600;expirationBadgesTimeout=3600;constructor(e){this.idSchema=e.idSchema,(this.getData()===void 0||this.getData()===null)&&this.setData(Tp)}clearData=()=>{this.setData(Tp)};getEntityById=(e="",t="")=>this.getData().football.ids.find(n=>{let o=Bt[this.idSchema];return n&&`${n[o]}`===t&&n.resource===e});getEntity=(e,t,n)=>Array.isArray(e)?this.getData().football.ids.filter(o=>{let p=Bt[n];return o&&e.includes(`${o[p]}`)&&o.resource===t}):this.getData().football.ids.find(o=>{let p=Bt[n];return o&&`${o[p]}`===e&&o.resource===t});getEntityByNativeId=(e="",t="")=>this.getData().football.ids.find(n=>n&&`${n.id}`===t&&n.resource===e);checkForExistingIdObjs=(e,t)=>{let n=Bt[t],o={};return Object.keys(e).forEach(p=>{let d=e[p],g=this.getEntity(d,p,t).map(w=>w[n]),v=e[p].filter(w=>!g.includes(w));o[p]=d.map(w=>v.includes(w)?{id:w,exists:!1}:{id:w,exists:!0})}),o};getIdsByType=(e,t,n)=>{let o=Bt[n],p=Bt[t],d={};return Object.keys(e).forEach(y=>{let g=e[y],v=[];this.getData().football.ids.forEach(w=>{g.forEach((S,q)=>{S===w[p]&&y===w.resource&&(v[q]=w[o])})}),d[y]=v}),d};addIdMapping=e=>{let t=this.getData();t.football.ids.push(e),this.setData(t)};addIdMappings=e=>{let t=this.getData(),n=t.football.ids;n=[...n,...e],t.football.ids=n,this.setData(t)};setOwnProfile=e=>{let t=this.getData();t.profile.info=e,t.profile.exparations.profile=Math.floor(Date.now()/1e3)+this.expirationTimeout,this.setData(t)};getOwnProfile=()=>this.getData().profile.info;getProfileCountries=()=>this.getData().profile.countries;setProfileCountries=e=>{let t=this.getData();t.profile.countries=e,this.setData(t)};getProfileStats=()=>this.getData().profile.statistics;setProfileStats=e=>{let t=this.getData();t.profile.statistics=e,t.profile.exparations.statistics=Math.floor(Date.now()/1e3)+this.expirationTimeout,this.setData(t)};getProfileBadges=()=>this.getData().profile.badges;setProfileBadges=e=>{let t=this.getData();t.profile.badges=e,t.profile.exparations.badges=Math.floor(Date.now()/1e3)+this.expirationBadgesTimeout,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(),n=[...t.football.competitions];n.push(...e),t.football.competitions=this.makeCompetitionsUnique(n),this.setData(t)};getCompetitionsLength=()=>{let{football:e}=this.getData();return e.competitions.length};getExpiration=e=>{let t=this.getData();switch(this.initialNewSchema("exparations"),e){case"profile":return t.profile.exparations.profile;case"statistics":return t.profile.exparations.statistics;case"badges":return t.profile.exparations.badges}};makeCompetitionsUnique=e=>{let t=new Set;return e.filter(n=>{let o=!t.has(n.id);return t.add(n.id),o})};getData=()=>JSON.parse(localStorage.getItem(Sd));setData=e=>{localStorage.setItem(Sd,JSON.stringify(e))};initialNewSchema=e=>{this.getData().profile[e]||this.setData(Tp)}};var Kr={player:"players",team:"teams",homeTeam:"teams",awayTeam:"teams",country:"countries",competition:"competitions",match:"matches"},Ma=class extends Me{apiSignInUrl="";constructor(e){super(e,Oe(e.environment,"idMapping"));this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}`}getEntityById=(e,t)=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${config.idSchema}&${Kr[e]}=${t}`)}catch(n){throw console.warn(`There was a problem with id mapping request for the following id:${t}`,n),n.response}};getEntityByIdAndSchema=(e,t,n)=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${n}&${Kr[e]}=${t}`)}catch(o){throw console.warn(`There was a problem with id mapping request for the following id:${t}`,o),o.response}};getEntityIdsByIdsAndSchema=(e,t,n)=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${n}&${Kr[e]}=${t.join(",")}`)}catch(o){throw console.warn(`There was a problem with id mapping request for the following ids:${t.join(",")}`,o),o.response}};getEntitiesByIds=(e,t,n)=>{t.sort((d,y)=>d.localeCompare(y));let p=ap(t).map(d=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${n}&${Kr[e]}=${d.join(",")}`)}catch(y){throw console.warn(`There was a problem with id mapping request for the following ids:${d.join(",")}`,y),y.response}});return Promise.all(p).then(d=>{let y=[];return d.forEach(g=>{y.push(...g.data.data)}),y})};getEntitiesByIdObjs=async(e,t)=>{let n=[],o={},p=[];Object.keys(e).forEach(v=>{n.push.apply(n,e[v])});let d=Xt(n),y=ap(d);for(let v of y){let w="";if(Object.keys(e).forEach(S=>{o[S]=[];let q=v.filter(Fe=>e[S].includes(Fe));q&&q.length>0&&(o[S]=q)}),Object.keys(o).forEach(S=>{o[S].length>0&&(o[S].sort((q,Fe)=>q.localeCompare(Fe)),w+="&",w+=`${Kr[S]}=${o[S].join(",")}`)}),w&&w.length>0)try{let S=await this.instance.get(`/football${this.apiSignInUrl}&input_provider=${t||"native"}${w}`);p.push(S.data.data)}catch(S){throw console.warn("There was a problem with id mapping request",S),S.response}else p.push([])}return Array.prototype.concat.apply([],p)}};var ba=class{isBrowser=!1;localStorage=null;https=null;constructor(e){this.isBrowser=typeof window!="undefined",this.localStorage=new yt(e),this.https=new Ma(e)}getEntitiesByIds=async(e,t,n)=>{if(this.isBrowser)try{let o=this.localStorage.checkForExistingIdObjs(e,t),p=this.splitForRequestAndExisting(o),d=await this.https.getEntitiesByIdObjs(p.request,t);return this.localStorage.addIdMappings(d),this.localStorage.getIdsByType(e,t,n)}catch(o){return console.warn("There was a problem retrieving the entity ids ",o),Promise.resolve([])}else try{let o=await this.https.getEntitiesByIdObjs(e,t);return Object.keys(e).forEach(p=>{e[p]=o.filter(d=>d.resource===p).map(d=>d[Bt[n]])}),e}catch(o){return console.warn("There was a problem retrieving the entity ids ",o),Promise.resolve([])}};getEntityById=async(e,t,n)=>{if(this.isBrowser){let o=this.localStorage.getEntity(e,t,n);if(o)return o;{let p=await this.requestEntity(e,t,n);return this.localStorage.addIdMappings(p),p}}else return await this.requestEntity(e,t,n)};splitForRequestAndExisting=e=>{let t={},n={};return Object.keys(e).forEach(o=>{t[o]=e[o].filter(p=>!p.exists).map(p=>p.id),n[o]=e[o].filter(p=>p.exists).map(p=>p.id)}),{existing:n,request:t}};requestEntity=async(e,t,n)=>{try{return e=Array.isArray(e)?e:[e],await this.https.getEntitiesByIds(t,e,n)}catch(o){return console.warn(`There was a problem retrieving the requested entity: ${o}`),null}}};var wa=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 va=class{extractedObjIds={};traverse=(e,t)=>(t=wa(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(n=>{this.traverseObjExtract(n,t)})};traverseObjExtract=(e,t)=>{e&&Object.keys(e).length>0&&Object.keys(e).forEach(n=>{let o=e[n];n==="id"||n==="teamId"?(this.extractedObjIds.hasOwnProperty(t)||(this.extractedObjIds[t]=[]),o&&this.extractedObjIds[t].push(o)):e[n]&&this.traverse(e[n],n)})}};var _a=class{replaceObjIdsIndex=null;remappedIdsObj={};traverse=(e,t,n)=>(t=wa(t),this.replaceObjIdsIndex===null&&(this.initReplaceObjIdsIndex(n),this.remappedIdsObj=n),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(n=>{this.traverseObjReplace(n,t)})};traverseObjReplace=(e,t)=>{e&&Object.keys(e).length>0&&Object.keys(e).forEach(n=>{n==="id"||n==="teamId"?e[n]&&(e[n]=this.remappedIdsObj[t][this.replaceObjIdsIndex[t]],this.replaceObjIdsIndex[t]=this.replaceObjIdsIndex[t]+1):e[n]&&this.traverse(e[n],n,this.remappedIdsObj)})}};var ae=class{idSchema="";idMappingFacade=null;constructor(e){this.idSchema=e.idSchema,this.idMappingFacade=new ba(e)}getEntityIdBySchemaId=(e,t)=>this.idMappingFacade.getEntityById(e,t,this.idSchema);remapEntities=async(e,t)=>{let n=JSON.parse(JSON.stringify(e));try{if(this.idSchema!=="native"){let p=new va().traverse(n,t);return this.idMappingFacade.getEntitiesByIds(p,"native",this.idSchema).then(d=>new _a().traverse(n,t,d))}else return e}catch(o){return console.warn(`There was a problem remapping entity: ${t} with inner entity `,o),[]}};getEntityIdsBySchemaId=async(e,t,n)=>{let o={};return o[t]=e,this.idSchema!=="native"?await this.idMappingFacade.getEntitiesByIds(o,this.idSchema,n):o}};var qe=class{completed=!1;percentage;constructor(e){this.percentage=e}};var Ia=class{teamFollowed=new qe(10);teamFavourite=new qe(15);playerFollowed=new qe(10);playerFavourite=new qe(10);competitionFollowed=new qe(10);competitionFavourite=new qe(5);addedBirthdate=new qe(10);addedGender=new qe(10);addedCountry=new qe(10);addedAvatar=new qe(10)};var Pa=class{totalPercentage;breakdown=new Ia};var Xr=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 Mt=class{isBrowser=!1;localStorage={};profileHttps=null;activityHttps=null;constructor(e,t,n){this.isBrowser=typeof window!="undefined",this.localStorage=e,this.profileHttps=t,this.activityHttps=n}getOwn=async()=>{if(this.isBrowser){let e=this.getLocalStorageData("profile");if(e)return JSON.parse(JSON.stringify(e));try{let t=await this.profileHttps.getProfile();return this.localStorage.setOwnProfile(t),t}catch(t){throw console.warn("There was a problem retrieving your profile: ",t),t}}else try{return await this.profileHttps.getProfile()}catch(e){throw console.warn("There was a problem retrieving your profile: ",e),e}};updateOwnProfile=async()=>{try{let e=await this.profileHttps.getProfile();return this.localStorage.setOwnProfile(e),e}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.profileHttps.getProfiles(e,t)}catch(n){throw console.warn(`There was a problem retrieving the selected profiles: ${e.join(",")} `,n),n}};getById=async e=>{try{return await this.profileHttps.getProfile(e)}catch(t){throw console.warn(`There was a problem retrieving the selected profile: ${e} `,t),t}};getCountries=async e=>{if(e=e||!1,this.isBrowser){let t=this.localStorage.getProfileCountries();if(t&&t.length>0)return t;try{let n=await this.profileHttps.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.profileHttps.getCountries(e)}catch(t){throw console.warn("There was a problem retrieving profile countries: ",t),t}};getFollowers=async(e,t)=>{try{e&&(e=new Xr(e));let n=await this.profileHttps.getFollowers(e,t),o=n.data.map(p=>p.followerId);if(o.length){let p=await this.getByIds(o),d=n.data.map(y=>(p.forEach(g=>{y.followerId===g.id&&(y.name=g.name,y.nickname=g.nickname,y.avatar=g.avatar)}),y));return n.data=d,n}return n}catch(n){throw console.warn("There was a problem retrieving your followers: ",n),n}};getFollowing=async(e,t)=>{try{e&&(e=new Xr(e));let n=await this.profileHttps.getFollowing(e,t),o=n.data.map(p=>p.followingId);if(o.length){let p=await this.getByIds(o),d=n.data.map(y=>(p.forEach(g=>{y.followingId===g.id&&(y.name=g.name,y.nickname=g.nickname,y.avatar=g.avatar)}),y));return n.data=d,n}return n}catch(n){throw console.warn("There was a problem retrieving your following profiles: ",n),n}};follow=async e=>{try{return await this.profileHttps.follow(e)}catch(t){throw console.warn(`There was a problem following profiles: ${e.join(",")} `,t),t}};unfollow=async e=>{try{return await this.profileHttps.unfollow(e)}catch(t){throw console.warn(`There was a problem unfollowing profiles: ${e.join(",")} `,t),t}};showFullnessProfile=e=>{let t=new Pa,n=0;return e.avatar&&(t.breakdown.addedAvatar.completed=!0,n+=t.breakdown.addedAvatar.percentage),e.birthDate&&(t.breakdown.addedBirthdate.completed=!0,n+=t.breakdown.addedBirthdate.percentage),e.country&&(t.breakdown.addedCountry.completed=!0,n+=t.breakdown.addedCountry.percentage),e.gender&&(t.breakdown.addedGender.completed=!0,n+=t.breakdown.addedGender.percentage),e.interests&&e.interests.length>0&&(e.interests.find(w=>w.type==="team"&&w.favourite)&&(t.breakdown.teamFavourite.completed=!0,n+=t.breakdown.teamFavourite.percentage),e.interests.find(w=>w.type==="team")&&(t.breakdown.teamFollowed.completed=!0,n+=t.breakdown.teamFollowed.percentage),e.interests.find(w=>w.type==="player"&&w.favourite)&&(t.breakdown.playerFavourite.completed=!0,n+=t.breakdown.playerFavourite.percentage),e.interests.find(w=>w.type==="player")&&(t.breakdown.playerFollowed.completed=!0,n+=t.breakdown.playerFollowed.percentage),e.interests.find(w=>w.type==="competition"&&w.favourite)&&(t.breakdown.competitionFavourite.completed=!0,n+=t.breakdown.competitionFavourite.percentage),e.interests.find(w=>w.type==="competition")&&(t.breakdown.competitionFollowed.completed=!0,n+=t.breakdown.competitionFollowed.percentage)),t.totalPercentage=n,t};getStats=async()=>{if(this.isBrowser){let e=this.getLocalStorageData("statistics");if(e&&Object.keys(e).length)return JSON.parse(JSON.stringify(e));try{let t=await this.activityHttps.getStats();return this.localStorage.setProfileStats(t),t}catch(t){throw console.warn("There was a problem retrieving own profile statistics: ",t),t}}else try{return await this.activityHttps.getStats()}catch(e){throw console.warn("There was a problem retrieving own profile statistics: ",e),e}};getBadges=async()=>{if(this.isBrowser){let e=this.getLocalStorageData("badges");if(e)return e;try{let t=await this.profileHttps.getBadges();return this.localStorage.setProfileBadges(t),t}catch(t){throw console.warn("There was a problem retrieving own profile badges: ",t),t}}else try{return await this.profileHttps.getBadges()}catch(e){throw console.warn("There was a problem retrieving own profile badges: ",e),e}};getLocalStorageData=e=>{let t=Math.floor(Date.now()/1e3),n=this.localStorage.getExpiration(e);switch(e){case"profile":if(n>t)return this.localStorage.getOwnProfile();case"statistics":if(n>t)return this.localStorage.getProfileStats();case"badges":if(n>t)return this.localStorage.getProfileBadges();default:return null}}};var Ra=class{id=null;name=null;assets=null};var Fa=class{extractUpdatedProps=(e,t)=>{let n=["name","nickname","gender"],o={};return Object.keys(e).forEach(p=>{if(n.includes(p)&&e[p]!==t[p])o[p]=t[p];else if(p==="birthDate")(t[p]===null||e[p]===null&&t[p]||e[p]!==t[p])&&(o.birth_date=t[p]);else if(p==="country")t[p]===null?o.country_id=t[p]:(e[p]===null&&t[p]||e[p].id!==t[p].id)&&(o.country_id=t[p].id);else if(p==="interests"){let d=e[p],y=t[p];y.length&&this.isNewInterest(d,y)?o[p]=this.updateInterests(d,y):(!y.length&&d.length||d.length!==y.length&&!this.isNewInterest(d,y))&&(o[p]=y)}}),o};updateInterests=(e,t)=>{if(e.length===t.length){let[n,o]=this.extractSameAndNewInterests(e,t);return[...o,...n]}else return t};isNewInterest=(e,t)=>{let n=!1,[o]=this.extractSameAndNewInterests(e,t);return o.length&&(n=!0),n};extractSameAndNewInterests=(e,t)=>{let n=t.filter(p=>e.some(d=>p.id===d.id&&p.type===d.type&&p.source===d.source&&p.favourite===d.favourite));return[t.filter(p=>!e.some(d=>p.id===d.id&&p.type===d.type&&p.source===d.source&&p.favourite===d.favourite)),n]}};var Sa=class{idsRemapper=null;profileHttps=null;profileService=null;localStorage=null;profileFacade=null;ownProfile=null;modified=!1;expireAt=0;promises=[];isFetching=!1;constructor(e,t,n,o,p,d){this.idsRemapper=e,this.localStorage=t,this.profileHttps=n,this.profileService=new Fa,this.profileFacade=new Mt(t,n,o)}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(t){throw this.isFetching=!1,t}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};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=JSON.parse(JSON.stringify(e));return await this.idsRemapper.remapInterests(t.interests)};showFullInterests=async()=>{let e=await this.getOwnProfile(),t=JSON.parse(JSON.stringify(e));return await this.idsRemapper.showFullInterests(t.interests)};getFollowers=async e=>await this.profileFacade.getFollowers(e);getFollowing=async e=>await this.profileFacade.getFollowing(e);follow=async e=>{let t=await this.profileFacade.follow(e),n=await this.profileFacade.updateOwnProfile();return this.setOwnProfile(n),t};unfollow=async e=>{let t=await this.profileFacade.unfollow(e),n=await this.profileFacade.updateOwnProfile();return this.setOwnProfile(n),t};getStats=async()=>{let e=await this.profileFacade.getStats();return await this.idsRemapper.remapSuccessRatesEntities(e)};getBadges=async()=>await this.profileFacade.getBadges();addInterestPromise=async e=>{this.modified=!0,await this.getOwnProfile();let t=null;e.source!=="custom"?t=await this.idsRemapper.remapInterestToNative(e):t=e;let n=this.ownProfile.interests.filter(o=>o.id!==t.id||o.type!==t.type||o.source!==t.source);return this.ownProfile.interests=[...n],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.idsRemapper.remapInterestToNative(e):t=e,this.ownProfile.interests=this.ownProfile.interests.filter(n=>n.id!==t.id||n.type!==t.type||n.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);setNicknamePromise=async e=>(this.modified=!0,await this.getOwnProfile(),this.ownProfile.nickname=e,this);setNickname=e=>(this.promises.push(this.setNicknamePromise(e)),this);setNamePromise=async e=>(this.modified=!0,await this.getOwnProfile(),this.ownProfile.name=e,this);setName=e=>(this.promises.push(this.setNamePromise(e)),this);setCountryPromise=async e=>(this.modified=!0,await this.getOwnProfile(),e&&!this.ownProfile.country?(this.ownProfile.country=new Ra,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(),n=this.profileService.extractUpdatedProps(e,t);if(this.modified=!1,this.expireAt=0,Object.keys(n).length){let p=await this.profileHttps.updateProfile(n),d=JSON.parse(JSON.stringify(p));return this.setOwnProfile(d),this.localStorage.setOwnProfile(d),delete p.interests,p}let o=JSON.parse(JSON.stringify(this.ownProfile));return delete o.interests,o}};var Ta=class{idsRemapper=null;profileHttps=null;activityHttps=null;profileFacade=null;profileId="";constructor(e,t,n,o){this.idsRemapper=e,this.profileHttps=n,this.activityHttps=o,this.profileFacade=new Mt(t,n,o)}setId=e=>(this.profileId=e,this);getProfile=async()=>await this.profileFacade.getById(this.profileId);getInfo=async()=>{let e=await this.getProfile();return delete e.interests,e};showInterests=async()=>{let e=await this.getProfile(),t=JSON.parse(JSON.stringify(e));return await this.idsRemapper.remapInterests(t.interests)};showFullInterests=async()=>{let e=await this.getProfile(),t=JSON.parse(JSON.stringify(e));return await this.idsRemapper.showFullInterests(t.interests)};getFollowers=async e=>await this.profileFacade.getFollowers(e,this.profileId);getFollowing=async e=>await this.profileFacade.getFollowing(e,this.profileId);showFullnessProfile=async()=>{let e=await this.getProfile();return this.profileFacade.showFullnessProfile(e)};getStats=async e=>{let t=await this.activityHttps.getStats(this.profileId,e);return await this.idsRemapper.remapSuccessRatesEntities(t)};getBadges=async()=>await this.profileHttps.getBadges(this.profileId)};var Ea=class{isBrowser=!1;localStorage={};https=null;idMapping=null;constructor(e,t,n){this.isBrowser=typeof window!="undefined",this.localStorage=e,this.idMapping=n,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 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 Yr=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(n=>{let o=!0;return t.forEach(p=>{p!=="sortOrder"&&p!=="sortField"&&(p==="countryId"?o&&=n.country.id===this[p]:p==="name"?o&&=n.name.toLocaleLowerCase().includes(this[p].toLocaleLowerCase()):p==="competitionIds"?o&&=this[p].some(d=>n.id===d):o&&=n[p].toLocaleLowerCase()===this[p].toLocaleLowerCase())}),o})};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((n,o)=>this.sortOrder&&this.sortOrder==="desc"?o.name.localeCompare(n.name):n.name.localeCompare(o.name)):this.sortField==="country"?t=e.sort((n,o)=>this.sortOrder&&this.sortOrder==="desc"?o.country.name.localeCompare(n.country.name):n.country.name.localeCompare(o.country.name)):this.sortField==="scope"?e.forEach(n=>t[this.competitionIds.indexOf(n.id)]=n):!this.sortField&&this.sortOrder==="desc"&&(t=e.sort((n,o)=>o.id.localeCompare(n.id))),t}};var Ca=class{isBrowser=!1;localStorage={};https=null;idMapping=null;constructor(e,t,n){this.isBrowser=typeof window!="undefined",this.localStorage=e,this.idMapping=n,this.https=t}getCompetitionsIdMapping=async(e,t)=>{try{let n=!1;if(e){if(e=new Yr(e),e.countryId){let p=await this.idMapping.getEntityIdsBySchemaId([`${e.countryId}`],"country","native");p.country.length===0&&(n=!0),e.countryId=p.country[0]}if(e.competitionIds){let p=await this.idMapping.getEntityIdsBySchemaId(e.competitionIds,"competition","native");p.competition.length===0&&(n=!0),e.competitionIds=p.competition}if(n)return[]}let o=await this.getCompetitions(e,t);return await this.idMapping.remapEntities(o,"competition")}catch(n){throw console.warn("There was a problem browsing all of the competitions",n),n}};getCompetitionsMapWithNativeIds=async e=>{let t=new Map,n=e.length,o=new Yr({competitionIds:e,limit:n}),p=await this.getCompetitions(o);p.sort((y,g)=>y.id.localeCompare(g.id));let d=await this.idMapping.remapEntities(p,"competition");return e.forEach((y,g)=>t.set(y,d[g])),t};getCompetitions=async(e,t)=>{let n=null;if(t=t||!1,this.isBrowser){if(!this.localStorage.getCompetitionsLength()){try{n=await this.https.getCompetitions()}catch(o){throw console.warn("There was a problem retrieving all competitions",o),o}this.localStorage.setCompetitions(n)}return this.localStorage.getCompetitions(e)}else return this.https.getCompetitions(e,t)};getCompetitionByIdIdMapping=async(e,t)=>{try{let o=(await this.idMapping.getEntityIdsBySchemaId([e],"competition","native")).competition[0],p=await this.getCompetitionById(o,t);return await this.idMapping.remapEntities(p,"competition")}catch(n){throw console.warn(`There was a problem browsing the following competition:${e}`,n),n}};getCompetitionById=async(e,t)=>{try{return t=t||!1,await this.https.getCompetitionById(e,t)}catch(n){throw console.warn(`There was a problem retrieving the competition with the following id: ${e}`,n),n}};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 Qr=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 xa=class{general=[];predictor=[];topX=[];matchQuiz=[]};var Hi=class{points=null;gameParticipationCount=null;entityId=null;entityType=null;predictionsMade=null;correctPredictions=null};var Aa=class{id;enabled;requirements=new Hi};var Oa=class{id;weight;multiplier;conditions};var Ba=class{value=[new Oa]};var Gi=class{points=null;tiers=null;badges=null};var La=class{enabled=!1;conditions={list:null};actions=new Ba;rewards=new Gi};var Na=class{general=null;comments=null;predictor=null;activity=null;topX=null;matchQuiz=null};var ki=class{enabled=!1;defaultMarkets=null;competitionsWhitelist=null};var $i=class{enabled=!1;minFixtures=null;maxFixtures=null;competitionsWhitelist=null};var Da=class{competitions=[];teams=[];markets=[]};var Vi=class{enabled=!1;fullCoverageCompetitions=null;markets=null;successRateScopes=new Da};var Ua=class{remapPredictorConfig=e=>{let t=new Vi;return t.enabled=e.enabled,t.fullCoverageCompetitions=e.full_coverage_competitions,t.markets=e.markets,t.successRateScopes=e.success_rate_scopes,t};remapTopXConfig=e=>{let t=new $i;return t.enabled=e.enabled,t.minFixtures=e.min_fixtures,t.maxFixtures=e.max_fixtures,t.competitionsWhitelist=e.competitions_whitelist,t};remapMatchQuizConfig=e=>{let t=new ki;return t.enabled=e.enabled,t.defaultMarkets=e.default_markets,t.competitionsWhitelist=e.competitions_whitelist,t};remapLoyaltyConfig=e=>{let t=new La;return t.enabled=e.enabled,t.conditions.list=e.conditions.list,t.actions.value=e.actions.value,t.rewards=this.remapRewards(e.rewards),t};remapRewards=e=>{let t=new Gi;return t.points=this.remapPoints(e.points),t.tiers=e.tiers,t.badges=this.remapBadges(e.badges),t};remapPoints=e=>{let t=new Na;return t.general=e.general,t.comments=e.comments,t.predictor=e.predictor,t.activity=e.activity,t.topX=e.top_x,t.matchQuiz=e.match_quiz,t};remapBadges=e=>{let t=new xa;return t.general=e.general,t.predictor=this.remapBadgeValues(e.predictor),t.topX=this.remapBadgeValues(e.top_x),t.matchQuiz=this.remapBadgeValues(e.match_quiz),t};remapBadgeValues=e=>e.map(t=>{let n=new Aa;return n.id=t.id,n.enabled=t.enabled,n.requirements=this.remapRequirements(t.requirements),n});remapRequirements=e=>{let t=new Hi;return t.points=e.points,t.gameParticipationCount=e.game_participation_count,t.entityId=e.entity_id,t.entityType=e.entity_type,t.predictionsMade=e.predictions_made,t.correctPredictions=e.correct_predictions,t}};var et=class extends Me{apiSignInUrl="";featureConfigRemapper=null;constructor(e){super(e,Oe(e.environment,"client"));this.apiSignInUrl=`/clients/${e.clientId}/features?key=${e.apiKey}`,this.featureConfigRemapper=new Ua}getConfig=async e=>{try{let t=await this.instance.get(`${this.apiSignInUrl}`);switch(e){case"predictor":return this.featureConfigRemapper.remapPredictorConfig(t.data.data.predictor);case"topX":return this.featureConfigRemapper.remapTopXConfig(t.data.data.top_x);case"matchQuiz":return this.featureConfigRemapper.remapMatchQuizConfig(t.data.data.match_quiz);case"loyalty":return this.featureConfigRemapper.remapLoyaltyConfig(t.data.data.loyalty)}}catch(t){throw console.warn("There was a problem fetching configuration from Client API",t),t.response}}};var Yt=class{clientHttps=null;constructor(e){this.clientHttps=new et(e)}setAvailableMarketsForMatch=async e=>{let{fullCoverageCompetitions:t,markets:n}=await this.clientHttps.getConfig("predictor");if(Array.isArray(e))return e.map(o=>this.setAvailableMarkets(o,t,n));if(typeof e=="object"&&Object.keys(e).length)return this.setAvailableMarkets(e,t,n)};setAvailableMarkets=(e,t,n)=>{let o=e.context.competition?.id;return o&&this.isMatchInCoverageCompetition(o,t)?(e.availableMarkets=n.all,e):(e.availableMarkets=n.main,e)};isMatchInCoverageCompetition=(e,t)=>{let n=!1;return t.includes(e)&&(n=!0),n}};var Ga=class{footballService=null;https=null;idMapping=null;constructor(e,t,n){this.idMapping=n,this.https=t,this.footballService=new Yt(e)}getTeamsIdMapping=async(e,t)=>{try{let n=!1;if(e){if(e=new Qr(e),e.countryId){let p=await this.idMapping.getEntityIdsBySchemaId([`${e.countryId}`],"country","native");p.country.length===0&&(n=!0),e.countryId=p.country[0]}if(e.scope){let p=await this.idMapping.getEntityIdsBySchemaId(e.scope,"competition","native");p.competition.length===0&&(n=!0),e.scope=p.competition}if(e.teamIds){let p=await this.idMapping.getEntityIdsBySchemaId(e.teamIds,"team","native");p.team.length===0&&(n=!0),e.teamIds=p.team}}if(n)return[];let o=await this.getTeams(e,t);return o.data=await this.idMapping.remapEntities(o.data,"team"),o}catch(n){throw console.warn("There was a problem browsing all teams",n),n}};getTeamsMapWithNativeIds=async e=>{let t=new Map,n=e.length,o=new Qr({teamIds:e,limit:n}),{data:p}=await this.getTeams(o);p.sort((y,g)=>y.id.localeCompare(g.id));let d=await this.idMapping.remapEntities(p,"team");return e.forEach((y,g)=>t.set(y,d[g])),t};getTeams=async(e,t)=>{try{return t=t||!1,await this.https.getTeams(e,t)}catch(n){throw console.warn("There was a problem retrieving all teams",n),n}};getTeamByIdIdMapping=async(e,t)=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"team","native")).team[0];let o=await this.getTeamById(e,t);return await this.idMapping.remapEntities(o,"team")}catch(n){throw console.warn(`There was a problem browsing the following team:${e}`,n),n}};getTeamById=async(e,t)=>{try{return t=t||!1,await this.https.getTeamById(e,t)}catch(n){throw console.warn(`There was a problem retrieving the following team: ${e}`,n),n}};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 o=await this.getNextMatchForTeam(e,t);return await this.idMapping.remapEntities(o,"match")}catch(n){throw console.warn(`There was a problem browsing the next match for the following team:${e}`,n),n}};getNextMatchForTeam=async(e,t)=>{try{t=t||!1;let n=await this.https.getNextMatchForTeam(e,t);return await this.footballService.setAvailableMarketsForMatch(n)}catch(n){throw console.warn(`There was a problem retrieving the next match for the following team: ${e}`,n),n}};getPrevMatchForTeamIdMapping=async(e,t)=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"team","native")).team[0];let o=await this.getPrevMatchForTeam(e,t);return await this.idMapping.remapEntities(o,"match")}catch(n){throw console.warn(`There was a problem browsing the previous match for the following team:${e}`,n),n}};getPrevMatchForTeam=async(e,t)=>{try{t=t||!1;let n=await this.https.getPrevMatchForTeam(e,t);return await this.footballService.setAvailableMarketsForMatch(n)}catch(n){throw console.warn(`There was a problem retrieving the previous match for the following team: ${e}`,n),n}}};var zr=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 Qt=class{https=null;footballService=null;idMapping=null;constructor(e,t,n){this.idMapping=n,this.https=t,this.footballService=new Yt(e)}getPlayersIdMapping=async(e,t)=>{try{let n=!1;if(e){if(e=new zr(e),e.countryId){let p=await this.idMapping.getEntityIdsBySchemaId([e.countryId],"country","native");p.country.length===0&&(n=!0),e.countryId=p.country[0]}if(e.playerIds){let p=await this.idMapping.getEntityIdsBySchemaId(e.playerIds,"player","native");p.player.length===0&&(n=!0),e.playerIds=p.player}if(e.scope){let p=await this.idMapping.getEntityIdsBySchemaId(e.scope,"competition","native");p.competition.length===0&&(n=!0),e.scope=p.competition}if(n)return[]}let o=await this.getPlayers(e,t);return o.data=await this.idMapping.remapEntities(o.data,"player"),o}catch(n){throw console.warn("There was a problem browsing the players",n),n}};getPlayersWithNativeIds=async e=>{let t=e.length,n=new zr({playerIds:e,limit:t}),o=await this.getPlayers(n);return o.data.sort((p,d)=>p.id.localeCompare(d.id)),await this.idMapping.remapEntities(o.data,"player")};getPlayersMapWithNativeIds=async e=>{let t={},n=Xt(e);n.sort((p,d)=>p.localeCompare(d));let o=await this.getPlayersWithNativeIds(n);return n.forEach((p,d)=>t[p]=o[d]),t};getPlayers=async(e,t)=>{try{return t=t||!1,await this.https.getPlayers(e,t)}catch(n){throw console.warn("There was a problem retrieving the players",n),n}};getPlayerIdMapping=async(e,t)=>{try{let n=await this.idMapping.getEntityIdsBySchemaId([e],"player","native"),o=await this.getPlayerById(n.player[0],t);return await this.idMapping.remapEntities(o,"player")}catch(n){throw console.warn(`There was a problem browsing the following player:${e}`,n),n}};getPlayerById=async(e,t)=>{try{return t=t||!1,await this.https.getPlayerById(e,t)}catch(n){throw console.warn(`There was a problem retrieving the following player: ${e}`,n),n}};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 o=await this.getNextMatchForPlayer(e,t);return await this.idMapping.remapEntities(o,"match")}catch(n){throw console.warn(`There was a problem browsing the next match for player:${e}`,n),n}};getNextMatchForPlayer=async(e,t)=>{try{t=t||!1;let n=await this.https.getNextMatchForPlayer(e,t);return await this.footballService.setAvailableMarketsForMatch(n)}catch(n){throw console.warn(`There was a problem retrieving the next match for player: ${e}`,n),n}};getPrevMatchForPlayerIdMapping=async(e,t)=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"player","native")).player[0];let o=await this.getPrevMatchForPlayer(e,t);return await this.idMapping.remapEntities(o,"match")}catch(n){throw console.warn(`There was a problem browsing the previous match for player:${e}`,n),n}};getPrevMatchForPlayer=async(e,t)=>{try{t=t||!1;let n=await this.https.getPrevMatchForPlayer(e,t);return await this.footballService.setAvailableMarketsForMatch(n)}catch(n){throw console.warn(`There was a problem retrieving the previous match for player: ${e}`,n),n}}};var Jr=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 zt=class{https=null;idMapping=null;footballService=null;constructor(e,t,n){this.https=t,this.idMapping=n,this.footballService=new Yt(e)}getMatchesIdMapping=async(e,t)=>{try{if(e){if(e=new Jr(e),e.countryIds){let o=await this.idMapping.getEntityIdsBySchemaId(e.countryIds,"country","native");e.countryIds=o.country}if(e.competitionIds){let o=await this.idMapping.getEntityIdsBySchemaId(e.competitionIds,"competition","native");e.competitionIds=o.competition}if(e.matchIds){let o=await this.idMapping.getEntityIdsBySchemaId(e.matchIds,"match","native");e.matchIds=o.match}if(e.teamIds){let o=await this.idMapping.getEntityIdsBySchemaId(e.teamIds,"team","native");e.teamIds=o.team}}let n=await this.getMatches(e,t);return n.data=await this.footballService.setAvailableMarketsForMatch([...n.data]),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 t=e.length,n=new Jr({matchIds:e,limit:t}),o=await this.getMatches(n);return o.data.sort((p,d)=>p.id.localeCompare(d.id)),await this.idMapping.remapEntities(o.data,"match")};getMatchesMapWithNativeIds=async e=>{let t={},n=Xt(e);n.sort((p,d)=>p.localeCompare(d));let o=await this.getMatchesWithNativeIds(n);return n.forEach((p,d)=>t[p]=o[d]),t};getMatches=async(e,t)=>{try{return t=t||!1,await this.https.getMatches(e,t)}catch(n){throw console.warn("There was a problem retrieving the matches",n),n}};getMatchIdMapping=async(e,t)=>{try{let n=await this.idMapping.getEntityIdsBySchemaId([e],"match","native"),o=await this.getMatchById(n.match[0],t),p=await this.footballService.setAvailableMarketsForMatch(o);return await this.idMapping.remapEntities(p,"match")}catch(n){throw console.warn(`There was a problem browsing the following match: ${e}`,n),n}};getMatchById=async(e,t)=>{try{return t=t||!1,await this.https.getMatchById(e,t)}catch(n){throw console.warn(`There was a problem retrieving the following match: ${e}`,n),n}}};var ka=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 $a=class{https=null;idMapping=null;constructor(e,t){this.https=e,this.idMapping=t}searchIdMapping=async(e,t)=>{try{if(e=new ka(e),e.scope){let o=await this.idMapping.getEntityIdsBySchemaId(e.scope,"competition","native");e.scope=o.competition}let n=await this.search(e,t);if(n.teams&&n.teams.length>0){let o=await this.idMapping.remapEntities(n.teams,"team");n.teams=o}if(n.players&&n.players.length>0){let o=await this.idMapping.remapEntities(n.players,"player");n.players=o}if(n.competitions&&n.competitions.length>0){let o=await this.idMapping.remapEntities(n.competitions,"competition");n.competitions=o}return n}catch(n){throw console.warn("There was a problem with browsing the search result",n),n}};search=async(e,t)=>{try{return await this.https.search(e,t)}catch(n){throw console.warn("There was a problem retrieving the search response",n),n}}};var qi=class{countriesFacade=null;competitionsFacade=null;teamsFacade=null;playerFacade=null;matchFacade=null;searchFacade=null;constructor(e,t,n,o){this.countriesFacade=new Ea(t,n,o),this.competitionsFacade=new Ca(t,n,o),this.teamsFacade=new Ga(e,n,o),this.playerFacade=new Qt(e,n,o),this.matchFacade=new zt(e,n,o),this.searchFacade=new $a(n,o)}getCountries=async e=>this.countriesFacade.getCountriesWithIdMapping(e);getCompetitions=async(e,t)=>this.competitionsFacade.getCompetitionsIdMapping(e,t);getCompetitionById=async(e,t)=>this.competitionsFacade.getCompetitionByIdIdMapping(e,t);getTopCompetitions=async e=>this.competitionsFacade.getTopCompetitionsIdMapping(e);getCompetitionsMapWithNativeIds=async e=>await this.competitionsFacade.getCompetitionsMapWithNativeIds(e);getTeams=async(e,t)=>this.teamsFacade.getTeamsIdMapping(e,t);getTeamById=async(e,t)=>this.teamsFacade.getTeamByIdIdMapping(e,t);getTopTeams=async e=>this.teamsFacade.getTopTeamsIdMapping(e);getNextMatchForTeam=async(e,t)=>this.teamsFacade.getNextMatchForTeamIdMapping(e,t);getPrevMatchForTeam=async(e,t)=>this.teamsFacade.getPrevMatchForTeamIdMapping(e,t);getTeamsMapWithNativeIds=async e=>await this.teamsFacade.getTeamsMapWithNativeIds(e);getPlayers=async(e,t)=>this.playerFacade.getPlayersIdMapping(e,t);getPlayerById=async(e,t)=>this.playerFacade.getPlayerIdMapping(e,t);getTopPlayers=async e=>this.playerFacade.getTopPlayersIdMapping(e);getNextMatchForPlayer=async(e,t)=>this.playerFacade.getNextMatchForPlayerIdMapping(e,t);getPrevMatchForPlayer=async(e,t)=>this.playerFacade.getPrevMatchForPlayerIdMapping(e,t);getPlayersMapWithNativeIds=async e=>this.playerFacade.getPlayersMapWithNativeIds(e);getMatches=async(e,t)=>this.matchFacade.getMatchesIdMapping(e,t);getMatchById=async(e,t)=>this.matchFacade.getMatchIdMapping(e,t);search=async(e,t)=>this.searchFacade.searchIdMapping(e,t)};var Va=class{id="";alias="";countryCode="";assets=null;name=""};var oe=class{countriesFromResponse=e=>{if(e)return e.map(t=>this.countryFromResponse(t))};countryFromResponse=e=>{try{if(e){let t=new Va;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 qa=class{id="";country=null;gender="";assets=null;type="";name=""};var Ne=class{countryRemapper=null;constructor(){this.countryRemapper=new oe}fromResponse(e){try{let t=new qa;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 Wa=class{id="";country=null;gender="";assets=null;type="";name="";participants=[]};var Ka=class{id="";country=null;gender="";assets=null;name="";code="";national=!1;fullName="";shortName=""};var be=class{countryRemapper=null;constructor(){this.countryRemapper=new oe}fromResponse(e){try{let t=new Ka;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 Xa=class{countryRemapper=null;teamBasicRemapper=null;constructor(){this.countryRemapper=new oe,this.teamBasicRemapper=new be}fromResponse(e){try{let t=new Wa;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(n=>this.teamBasicRemapper.fromResponse(n)),t}catch(t){throw console.warn("There was a problem remapping the competition response",t),t}}};var Ya=class{id="";country=null;gender="";assets=null;name="";competitions=[];code="";national=!1;fullName="";shortName="";squad=[]};var Qa=class{id="";startDate="";endDate="";shirtNumber;loan=!1;position="";country=null;name="";assets=null;birthDate=""};var za=class{countryRemapper=null;constructor(){this.countryRemapper=new oe}fromResponse(e){try{let t=new Qa;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 Ja=class{countryRemapper=null;competitionRemapper=null;playerRemapper=null;constructor(){this.countryRemapper=new oe,this.competitionRemapper=new Ne,this.playerRemapper=new za}fromResponse(e){try{let t=new Ya;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(n=>this.competitionRemapper.fromResponse(n)):[],t.squad=e.squad?e.squad.map(n=>this.playerRemapper.fromResponse(n)):[],t}catch(t){throw console.warn("There was a problem remapping team response",t),t}}};var Za=class{id="";kickoffAt="";finishedAt="";updatedAt="";availableMarkets=null;homeTeam=null;awayTeam=null;lineupsConfirmed=!1;startedAt="";minute="";scores=null;context={competition:null};status={type:null,subType:null}};var ja=class{ftScore=null;htScore=null;aetScore=null;aggScore=null;penScore=null};var Wi=class{fromResponse(e){try{let t=new ja;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 eo=class{teamRemapper=null;competitionRemapper=null;scoresRemapper=null;constructor(){this.teamRemapper=new be,this.competitionRemapper=new Ne,this.scoresRemapper=new Wi}fromResponse(e){try{let t=new Za;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 to=class{id="";kickoffAt="";finishedAt="";updatedAt="";availableMarkets=null;homeTeam=null;awayTeam=null;lineupsConfirmed=!1;startedAt="";minute="";scores=null;stats=null;context={competition:null};timeline=[];status={type:null,subType:null};lineups=null};var io=class{corners=null;cornersFirstHalf=null;cornersSecondHalf=null;cornersExtraTime=null;crosses=null;crossesFirstHalf=null;crossesSecondHalf=null;crossesExtraTime=null;offside=null;offsideFirstHalf=null;offsideSecondHalf=null;offsideExtraTime=null;shotsOn=null;shotsOnFirstHalf=null;shotsOnSecondHalf=null;shotsOnExtraTime=null;throwIn=null;throwInFirstHalf=null;throwInSecondHalf=null;throwInExtraTime=null;redCards=null;redCardsFirstHalf=null;redCardsSecondHalf=null;redCardsExtraTime=null;shotsOff=null;shotsOffFirstHalf=null;shotsOffSecondHalf=null;shotsOffExtraTime=null;goalKicks=null;goalKicksFirstHalf=null;goalKicksSecondHalf=null;goalKicksExtraTime=null;possession=null;possessionFirstHalf=null;possessionSecondHalf=null;possessionExtraTime=null;treatments=null;treatmentsFirstHalf=null;treatmentsSecondHalf=null;treatmentsExtraTime=null;yellowCards=null;yellowCardsFirstHalf=null;yellowCardsSecondHalf=null;yellowCardsExtraTime=null;shotsBlocked=null;shotsBlockedFirstHalf=null;shotsBlockedSecondHalf=null;shotsBlockedExtraTime=null;substitutions=null;substitutionsFirstHalf=null;substitutionsSecondHalf=null;substitutionsExtraTime=null;counterAttacks=null;counterAttacksFirstHalf=null;counterAttacksSecondHalf=null;counterAttacksExtraTime=null;foulsCommitted=null;foulsCommittedFirstHalf=null;foulsCommittedSecondHalf=null;foulsCommittedExtraTime=null};var ro=class{fromResponse(e){try{let t=new io;return t.corners=this.statEntityFromResponse(e.corners),t.cornersFirstHalf=this.statEntityFromResponse(e.corners_1h),t.cornersSecondHalf=this.statEntityFromResponse(e.corners_2h),t.cornersExtraTime=this.statEntityFromResponse(e.corners_et),t.crosses=this.statEntityFromResponse(e.crosses),t.crossesFirstHalf=this.statEntityFromResponse(e.crosses_1h),t.crossesSecondHalf=this.statEntityFromResponse(e.crosses_2h),t.crossesExtraTime=this.statEntityFromResponse(e.crosses_et),t.offside=this.statEntityFromResponse(e.offside),t.offsideFirstHalf=this.statEntityFromResponse(e.offside_1h),t.offsideSecondHalf=this.statEntityFromResponse(e.offside_2h),t.offsideExtraTime=this.statEntityFromResponse(e.offside_et),t.shotsOn=this.statEntityFromResponse(e.shots_on),t.shotsOnFirstHalf=this.statEntityFromResponse(e.shots_on_1h),t.shotsOnSecondHalf=this.statEntityFromResponse(e.shots_on_2h),t.shotsOnExtraTime=this.statEntityFromResponse(e.shots_on_et),t.throwIn=this.statEntityFromResponse(e.throw_in),t.throwInFirstHalf=this.statEntityFromResponse(e.throw_in_1h),t.throwInSecondHalf=this.statEntityFromResponse(e.throw_in_2h),t.throwInExtraTime=this.statEntityFromResponse(e.throw_in_et),t.redCards=this.statEntityFromResponse(e.red_cards),t.redCardsFirstHalf=this.statEntityFromResponse(e.red_cards_1h),t.redCardsSecondHalf=this.statEntityFromResponse(e.red_cards_2h),t.redCardsExtraTime=this.statEntityFromResponse(e.red_cards_et),t.shotsOff=this.statEntityFromResponse(e.shots_off),t.shotsOffFirstHalf=this.statEntityFromResponse(e.shots_off_1h),t.shotsOffSecondHalf=this.statEntityFromResponse(e.shots_off_2h),t.shotsOffExtraTime=this.statEntityFromResponse(e.shots_off_et),t.goalKicks=this.statEntityFromResponse(e.goal_kicks),t.goalKicksFirstHalf=this.statEntityFromResponse(e.goal_kicks_1h),t.goalKicksSecondHalf=this.statEntityFromResponse(e.goal_kicks_2h),t.goalKicksExtraTime=this.statEntityFromResponse(e.goal_kicks_et),t.possession=this.statEntityFromResponse(e.possession),t.possessionFirstHalf=this.statEntityFromResponse(e.possession_1h),t.possessionSecondHalf=this.statEntityFromResponse(e.possession_2h),t.possessionExtraTime=this.statEntityFromResponse(e.possession_et),t.treatments=this.statEntityFromResponse(e.treatments),t.treatmentsFirstHalf=this.statEntityFromResponse(e.treatments_1h),t.treatmentsSecondHalf=this.statEntityFromResponse(e.treatments_2h),t.treatmentsExtraTime=this.statEntityFromResponse(e.treatments_et),t.yellowCards=this.statEntityFromResponse(e.yellow_cards),t.yellowCardsFirstHalf=this.statEntityFromResponse(e.yellow_cards_1h),t.yellowCardsSecondHalf=this.statEntityFromResponse(e.yellow_cards_2h),t.yellowCardsExtraTime=this.statEntityFromResponse(e.yellow_cards_et),t.shotsBlocked=this.statEntityFromResponse(e.shots_blocked),t.shotsBlockedFirstHalf=this.statEntityFromResponse(e.shots_blocked_1h),t.shotsBlockedSecondHalf=this.statEntityFromResponse(e.shots_blocked_2h),t.shotsBlockedExtraTime=this.statEntityFromResponse(e.shots_blocked_et),t.substitutions=this.statEntityFromResponse(e.substitutions),t.substitutionsFirstHalf=this.statEntityFromResponse(e.substitutions_1h),t.substitutionsSecondHalf=this.statEntityFromResponse(e.substitutions_2h),t.substitutionsExtraTime=this.statEntityFromResponse(e.substitutions_et),t.counterAttacks=this.statEntityFromResponse(e.counter_attacks),t.counterAttacksFirstHalf=this.statEntityFromResponse(e.counter_attacks_1h),t.counterAttacksSecondHalf=this.statEntityFromResponse(e.counter_attacks_2h),t.counterAttacksExtraTime=this.statEntityFromResponse(e.counter_attacks_et),t.foulsCommitted=this.statEntityFromResponse(e.fouls_committed),t.foulsCommittedFirstHalf=this.statEntityFromResponse(e.fouls_committed_1h),t.foulsCommittedSecondHalf=this.statEntityFromResponse(e.fouls_committed_2h),t.foulsCommittedExtraTime=this.statEntityFromResponse(e.fouls_committed_et),t}catch(t){throw console.warn("There was a problem remapping the stats",t),t}}statEntityFromResponse=e=>({homeTeam:e?e.home_team:null,awayTeam:e?e.away_team:null})};var Ki=class{homeTeam={players:[]};awayTeam={players:[]}};var no=class{id="";name="";position="";shirtNumber;assets=null;type=""};var Xi=class{fromResponse(e){try{let t=new no;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 ao=class{playerRemapper=null;constructor(){this.playerRemapper=new Xi}fromResponse(e){try{let t=new Ki;return t.homeTeam.players=e.home_team&&e.home_team.players?e.home_team.players.map(n=>this.playerRemapper.fromResponse(n)):[],t.awayTeam.players=e.away_team&&e.away_team.players?e.away_team.players.map(n=>this.playerRemapper.fromResponse(n)):[],t}catch(t){throw console.warn("There was a problem remapping the lineups",t),t}}};var oo=class{minute="";type="";teamId="";player=null;relatedPlayer=null;updatedAt=""};var so=class{playerRemapper=null;constructor(){this.playerRemapper=new Xi}fromResponse(e){try{let t=new oo;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 lo=class{teamMapper=null;competitionsMapper=null;lineupsMapper=null;scoresMapper=null;statsMapper=null;timelineMapper=null;constructor(){this.teamMapper=new be,this.competitionsMapper=new Ne,this.lineupsMapper=new ao,this.scoresMapper=new Wi,this.statsMapper=new ro,this.timelineMapper=new so}fromResponse(e){try{let t=new to;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(n=>this.timelineMapper.fromResponse(n)):[],t.status={type:e.status.type,subType:e.status.sub_type},t.lineups=e.lineups?this.lineupsMapper.fromResponse(e.lineups):new Ki,t}catch(t){throw console.warn("There was a problem remapping the match response",t),t}}};var po=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null};var co=class{countryRemapper=null;constructor(){this.countryRemapper=new oe}fromResponse(e){try{let t=new po;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 uo=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;teams=[]};var Yi=class{countryRemapper=null;teamRemapper=null;constructor(){this.countryRemapper=new oe,this.teamRemapper=new be}fromResponse(e){try{let t=new uo;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(n=>this.teamRemapper.fromResponse(n)):[],t.position=e.position,t}catch(t){throw console.warn("There was a problem remapping players response",t),t}}};var mo=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;competitions=[];teams=[]};var fo=class{countryRemapper=null;teamRemapper=null;competitionRemapper=null;constructor(){this.countryRemapper=new oe,this.teamRemapper=new be,this.competitionRemapper=new Ne}fromResponse(e){try{let t=new mo;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(n=>this.teamRemapper.fromResponse(n)):[],t.position=e.position,t.competitions=e.competitions?e.competitions.map(n=>this.competitionRemapper.fromResponse(n)):[],t}catch(t){throw console.warn("There was a problem remapping player response",t),t}}};var ho=class{teams=null;players=null;competitions=null};var go=class{teamRemapper=null;playerRemapper=null;competitionremapper=null;constructor(){this.teamRemapper=new be,this.playerRemapper=new Yi,this.competitionremapper=new Ne}fromResponse(e){try{let t=new ho;return t.teams=e.teams?e.teams.map(n=>this.teamRemapper.fromResponse(n)):[],t.players=e.players?e.players.map(n=>this.playerRemapper.fromResponse(n)):[],t.competitions=e.competitions?e.competitions.map(n=>this.competitionremapper.fromResponse(n)):[],t}catch(t){throw console.warn("There was a problem remapping search response",t),t}}};var Qi=class{currentPage=null;itemsPerPage=null;totalItems=null;numberOfPages=null};var Jt=class{pagination=new Qi};var zi=class{meta=new Jt;data=[]};var yo=class{remapMetaProp=e=>{let t=new Jt;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 bt=class extends Me{apiSignInUrl="";clientId="";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){super(e,Oe(e.environment,"football"));this.clientId=e.clientId,this.apiSignInUrl=`?key=${e.apiKey}&lang=${e.lang}`,this.countryRemapper=new oe,this.competitionBasicRemapper=new Ne,this.competitionFullRemapper=new Xa,this.teamBasicRemapper=new be,this.teamFullRemapper=new Ja,this.matchBasicRemapper=new eo,this.matchFullRemapper=new lo,this.playerBasicRemapper=new Yi,this.playerFullRemapper=new fo,this.topPlayerRemapper=new co,this.searchRemapper=new go,this.footballMetaRemapper=new yo}getCountries=async e=>{try{let t=`/countries${this.apiSignInUrl}`,n=Date.now();e&&(t+=`&disable_cache=${n}`);let o=await this.instance.get(t);return this.countryRemapper.countriesFromResponse(o.data.data)}catch(t){throw console.warn("There was a problem with the football countries request",t),t}};getCompetitions=async(e,t)=>{try{let n={},o=Date.now();if(t=t||!1,e&&e.competitionIds&&e.competitionIds.length>this.limitIds-1){let p=[],d=ea(e.competitionIds);for(let g of d){e.competitionIds=g;let v=`/competitions${this.apiSignInUrl}${e.constructFilterUrl()}`;t&&(v+=`&disable_cache=${o}`),n=await this.instance.get(v),p.push(n.data.data.map(w=>this.competitionBasicRemapper.fromResponse(w)))}return Array.prototype.concat.apply([],p)}else{let p=`/competitions${this.apiSignInUrl}`;return e&&(p+=`${e.constructFilterUrl()}`),t&&(p+=`&disable_cache=${o}`),n=await this.instance.get(p),n.data.data.map(d=>this.competitionBasicRemapper.fromResponse(d))}}catch(n){throw console.warn("There was a problem with getCompetitions request",n),n.response}};getCompetitionById=async(e,t)=>{try{let n=`/competitions/${e}${this.apiSignInUrl}`,o=Date.now();t&&(n+=`&disable_cache=${o}`);let p=await this.instance.get(n);return this.competitionFullRemapper.fromResponse(p.data.data)}catch(n){throw console.warn("There was a problem with getCompetitionById request",n),n.response}};getTopCompetitions=async e=>{try{let t=`/competitions/top${this.apiSignInUrl}&client_id=${this.clientId}`,n=Date.now();return e&&(t+=`&disable_cache=${n}`),(await this.instance.get(t)).data.data.map(p=>this.competitionBasicRemapper.fromResponse(p))}catch(t){throw console.warn("There was a problem with getTopCompetitions request",t),t.response}};getTeams=async(e,t)=>{try{let n={},o=Date.now();if(e&&e.teamIds&&e.teamIds.length>this.limitIds){let p=[],d=ea(e.teamIds);for(let g of d){e.teamIds=g;let v=`/teams${this.apiSignInUrl}${e.constructFilterUrl()}`;t&&(v+=`disable_cache=${o}`),n=await this.instance.get(v),p.push(n.data.data.map(w=>this.teamBasicRemapper.fromResponse(w)))}return Array.prototype.concat.apply([],p)}else{let p=new zi,d=`/teams${this.apiSignInUrl}`;return e&&(d+=`${e.constructFilterUrl()}`),t&&(d+=`&disable_cache=${o}`),n=await this.instance.get(d),p.meta=this.footballMetaRemapper.remapMetaProp(n.data.meta),p.data=n.data.data.map(y=>this.teamBasicRemapper.fromResponse(y)),p}}catch(n){throw console.warn("There was a problem with getTeams request",n),n.response}};getTeamById=async(e,t)=>{try{let n=`/teams/${e}${this.apiSignInUrl}`,o=Date.now();t&&(n+=`disable_cache=${o}`);let p=await this.instance.get(n);return this.teamFullRemapper.fromResponse(p.data.data)}catch(n){throw console.warn("There was a problem with getTeamById request",n),n.response}};getTopTeams=async e=>{try{let t=`/teams/top${this.apiSignInUrl}&client_id=${this.clientId}`,n=Date.now();e&&(t+=`$disable_cache=${n}`);let o=await this.instance.get(t);return o.data.data?o.data.data.map(p=>this.teamBasicRemapper.fromResponse(p)):[]}catch(t){throw console.warn("There was a problem with getTopTeams request",t),t.response}};getNextMatchForTeam=async(e,t)=>{try{let n=`/teams/${e}/next-match${this.apiSignInUrl}`,o=Date.now();t&&(n+=`&disable_cache=${o}`);let p=await this.instance.get(n);return this.matchFullRemapper.fromResponse(p.data.data)}catch(n){throw console.warn("There was a problem with getNextMatchForTeam request",n),n.response}};getPrevMatchForTeam=async(e,t)=>{try{let n=`/teams/${e}/previous-match${this.apiSignInUrl}`,o=Date.now();t&&(n+=`disable_cache=${o}`);let p=await this.instance.get(n);return this.matchFullRemapper.fromResponse(p.data.data)}catch(n){throw console.warn("There was a problem with getPrevMatchForTeam request",n),n.response}};getPlayers=async(e,t)=>{try{let n={},o=Date.now();if(e&&e.playerIds&&e.playerIds.length>this.limitIds-1){let p=[],d=ea(e.playerIds);for(let g of d){e.playerIds=g;let v=`/players${this.apiSignInUrl}${e.constructFilterUrl()}`;t&&(v+=`&disable_cache=${o}`),n=await this.instance.get(v),p.push(n.data.data.map(w=>this.teamBasicRemapper.fromResponse(w)))}return Array.prototype.concat.apply([],p)}else{let p=new zi,d=`/players${this.apiSignInUrl}`;return e&&(d+=`${e.constructFilterUrl()}`),t&&(d+=`&disable_cache=${o}`),n=await this.instance.get(d),p.meta=this.footballMetaRemapper.remapMetaProp(n.data.meta),p.data=n.data.data.map(y=>this.playerBasicRemapper.fromResponse(y)),p}}catch(n){throw console.warn("There was a problem with getPlayers request",n),n.response}};getPlayerById=async(e,t)=>{try{let n=`/players/${e}${this.apiSignInUrl}`,o=Date.now();t&&(n+=`&disable_cache=${o}`);let p=await this.instance.get(n);return this.playerFullRemapper.fromResponse(p.data.data)}catch(n){throw console.warn("There was a problem with getPlayerById request",n),n.response}};getTopPlayers=async e=>{try{let t=`/players/top${this.apiSignInUrl}&client_id=${this.clientId}`,n=Date.now();return e&&(t+=`&disable_cache=${n}`),(await this.instance.get(t)).data.data.map(p=>this.topPlayerRemapper.fromResponse(p))}catch(t){throw console.warn("There was a problem with getTopPlayers request",t),t.response}};getNextMatchForPlayer=async(e,t)=>{try{let n=`/players/${e}/next-match${this.apiSignInUrl}`,o=Date.now();t&&(n+=`&disable_cache=${o}`);let p=await this.instance.get(n);return this.matchFullRemapper.fromResponse(p.data.data)}catch(n){throw console.warn("There was a problem with getNextMatchForPlayer request",n),n.response}};getPrevMatchForPlayer=async(e,t)=>{try{let n=`/players/${e}/previous-match${this.apiSignInUrl}`,o=Date.now();t&&(n+=`&disable_cache=${o}`);let p=await this.instance.get(n);return this.matchFullRemapper.fromResponse(p.data.data)}catch(n){throw console.warn("There was a problem with getPrevMatchForPlayer request",n),n.response}};getMatchById=async(e,t)=>{try{let n=`/matches/${e}${this.apiSignInUrl}`,o=Date.now();t&&(n+=`&disable_cache=${o}`);let p=await this.instance.get(n);return this.matchFullRemapper.fromResponse(p.data.data)}catch(n){throw console.warn("There was a problem with getMatchById request",n),n.response}};getMatches=async(e,t)=>{try{let n=new zi,o=`/matches${this.apiSignInUrl}`,p=Date.now();e&&(o+=`${e.constructFilterUrl()}`),t&&(o+=`&disable_cache=${p}`);let d=await this.instance.get(o);return n.meta=this.footballMetaRemapper.remapMetaProp(d.data.meta),n.data=d.data.data.map(y=>this.matchBasicRemapper.fromResponse(y)),n}catch(n){throw console.warn("There was a problem with getMatches request",n),n.response}};search=async(e,t)=>{try{let n=`/search${this.apiSignInUrl}${e.constructFilterUrl()}`,o=Date.now();t&&(n+=`&disable_cache=${o}`);let p=await this.instance.get(n);return this.searchRemapper.fromResponse(p.data.data)}catch(n){throw console.warn("There was a problem with search request",n),n.response}}};var Pe=(N=>(N.FT_1X2="FT_1X2",N.HT_1X2="HT_1X2",N.BOTH_TEAMS_SCORE="BOTH_TEAMS_SCORE",N.DOUBLE_CHANCE="DOUBLE_CHANCE",N.HT_FT="HT_FT",N.PLAYER_SCORE="PLAYER_SCORE",N.PLAYER_YELLOW_CARD="PLAYER_YELLOW_CARD",N.PLAYER_RED_CARD="PLAYER_RED_CARD",N.RED_CARD_MATCH="RED_CARD_MATCH",N.PENALTY_MATCH="PENALTY_MATCH",N.PLAYER_SCORE_FIRST_GOAL="PLAYER_SCORE_FIRST_GOAL",N.CORNERS_MATCH="CORNERS_MATCH",N.CORRECT_SCORE="CORRECT_SCORE",N.CORRECT_SCORE_ADVANCED="CORRECT_SCORE_ADVANCED",N.CORRECT_SCORE_HT="CORRECT_SCORE_HT",N.PLAYER_SCORE_HATTRICK="PLAYER_SCORE_HATTRICK",N.PLAYER_SCORE_TWICE="PLAYER_SCORE_TWICE",N.OVER_GOALS_0_5="OVER_GOALS_0_5",N.OVER_GOALS_1_5="OVER_GOALS_1_5",N.OVER_GOALS_2_5="OVER_GOALS_2_5",N.OVER_GOALS_3_5="OVER_GOALS_3_5",N.OVER_GOALS_4_5="OVER_GOALS_4_5",N.OVER_GOALS_5_5="OVER_GOALS_5_5",N.OVER_GOALS_6_5="OVER_GOALS_6_5",N.OVER_CORNERS_6_5="OVER_CORNERS_6_5",N.OVER_CORNERS_7_5="OVER_CORNERS_7_5",N.OVER_CORNERS_8_5="OVER_CORNERS_8_5",N.OVER_CORNERS_9_5="OVER_CORNERS_9_5",N.OVER_CORNERS_10_5="OVER_CORNERS_10_5",N.OVER_CORNERS_11_5="OVER_CORNERS_11_5",N.OVER_CORNERS_12_5="OVER_CORNERS_12_5",N.OVER_CORNERS_13_5="OVER_CORNERS_13_5",N))(Pe||{}),Td=["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"],Ed=["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"],wt=["PLAYER_RED_CARD","PLAYER_SCORE","PLAYER_SCORE_FIRST_GOAL","PLAYER_SCORE_HATTRICK","PLAYER_SCORE_TWICE","PLAYER_YELLOW_CARD"],Cd=["FT_1X2","HT_1X2","HT_FT","DOUBLE_CHANCE","CORNERS_MATCH","CORRECT_SCORE","CORRECT_SCORE_HT","CORRECT_SCORE_ADVANCED"],Zr="PLAYER_SCORE_FIRST_GOAL";var Mo=class{overallPercent;byFootballCompetition;byFootballTeam;byFootballMarket};var bo=class{profileId;tier;points;successRates=new Mo};var wo=class{successRatePercent;model=null};var vo=class{id=null;label=null};var _o=class{type=null;id=null;label=null};var Ji=class{content=new _o;tags=[];campaign=new vo};var Zi=class{id=null;profileId=null;action=null;context=new Ji;points=0};var Io=class{totalItems=0};var Po=class{meta=new Io;data=[new Zi]};var Ro=class{remapSingleResponse=e=>{let t=new Zi;return t.id=e.id,t.profileId=e.profile_id,t.action=e.action,t.context.content=e.context.content??t.context.content,t.context.tags=e.context.tags,t.context.campaign=e.context.campaign??t.context.campaign,t.points=e.points,t};remapActivitiesResponse=e=>{let t=new Po;return t.meta.totalItems=e.meta.total_items,t.data=e.data.map(n=>this.remapSingleResponse(n)),t};remapStatsReponse=e=>{let t=new bo;return t.profileId=e.profile_id,t.tier=e.tier,t.points=e.points,t.successRates.overallPercent=e.success_rates.overall_percent,t.successRates.byFootballCompetition=this.constructNewRecord(e.success_rates.by_competition),t.successRates.byFootballTeam=this.constructNewRecord(e.success_rates.by_team),t.successRates.byFootballMarket=this.constructNewRecord(e.success_rates.by_market),t};constructNewRecord=e=>{let t;if(Object.entries(e).length)Object.entries(e).forEach(([n,o])=>{t={...t,[n]:this.remapSuccessRatePercent(o)},Pe[n]&&delete t[n].model});else return e;return t};remapSuccessRatePercent=e=>{let t=new wo;return t.successRatePercent=e.success_rate_percent,t}};var ji=class extends Me{activityRemapper=null;apiSignInUrl=null;constructor(e){super(e,Oe(e.environment,"loyalty"));this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}`,this.activityRemapper=new Ro}createActivity=async e=>{try{let t=`/activities${this.apiSignInUrl}`,n=await this.instanceAuth.post(t,JSON.stringify(e));return this.activityRemapper.remapSingleResponse(n.data)}catch(t){throw console.warn("There was a problem with creating activity for user",t),t}};deleteActivity=async e=>{try{let t=`/activities/${e}${this.apiSignInUrl}`;return await this.instanceAuth.delete(t),!0}catch(t){throw console.warn(`There was a problem deleting the following activity: ${e}`,t),t.response}};getOwnActivities=async(e,t)=>{try{let n=`/activities${this.apiSignInUrl}`,o=Date.now();e&&(n+=`${e.constructFilterUrl()}`),t&&(n+=`disable_cache=${o}`);let p=await this.instanceAuth.get(n);return this.activityRemapper.remapActivitiesResponse(p.data)}catch(n){throw console.warn("There was a problem with fetching own activities",n),n}};getActivitiesForUser=async(e,t,n)=>{try{let o=`/users/${e}/activities${this.apiSignInUrl}`,p=Date.now();t&&(o+=`${t.constructFilterUrl()}`),n&&(o+=`disable_cache=${p}`);let d=await this.instance.get(o);return this.activityRemapper.remapActivitiesResponse(d.data)}catch(o){throw console.warn(`There was a problem with fetching activities for user ${e}`,o),o}};getStats=async(e,t)=>{try{let n="",o=null;return e?(n+=de(t)?`/users/${e}/statistics${this.apiSignInUrl}${fe()}`:`/users/${e}/statistics${this.apiSignInUrl}`,o=await this.instance.get(n)):(n+=`/statistics${this.apiSignInUrl}`,o=await this.instanceAuth.get(n)),this.activityRemapper.remapStatsReponse(o.data.data)}catch(n){throw console.warn("There was a problem fetching profile`s statistics:",n),n.response}}};var Fo=class{idMapping=null;idSchema=null;native="native";footballFacade=null;constructor(e,t,n){this.idMapping=n,this.idSchema=e.idSchema,this.footballFacade=t}remapSuccessRatesEntities=async e=>{let{successRates:t}=e,n={competition:this.getIdsKeys(t.byFootballCompetition),team:this.getIdsKeys(t.byFootballTeam)};if(Object.values(n.competition).length){let o=e.successRates.byFootballCompetition;e.successRates.byFootballCompetition=await this.setModels(o,n.competition,"competition")}if(Object.values(n.team).length){let o=e.successRates.byFootballTeam;e.successRates.byFootballTeam=await this.setModels(o,n.team,"team")}return e};setModels=async(e,t,n)=>{let o=null,p;switch(t=kr(t),n){case"competition":o=await this.footballFacade.getCompetitionsMapWithNativeIds(t);break;case"team":o=await this.footballFacade.getTeamsMapWithNativeIds(t);break}return Object.keys(e).forEach(d=>{let y=o.get(d);p={...p,[y.id]:e[d]},p[y.id].model=y}),p};getIdsKeys=e=>{let t=JSON.parse(JSON.stringify(e));return Object.keys(t)};remapInterestsToIdSchema=async e=>{if(this.idSchema!==this.native)if(e&&e.length>0){let t={},n={};e.forEach(d=>{t.hasOwnProperty(d.type)||(t[d.type]=[],n[d.type]=[]),t[d.type].push(d.id),n[d.type].push(d)});let o=await this.remapIdsObj(t,this.native,this.idSchema),p=[];for(let[d,y]of Object.entries(n))y.forEach((g,v)=>{g.id=o[d][v],p.push(g)});return p}else return e;return e};remapInterestToNative=async e=>{if(this.idSchema!==this.native){let t={},{id:n,type:o}=e;t[o]=[n];let p=await this.remapIdsObj(t,this.idSchema,this.native);return e.id=p[o][0],e}return e};inquiryCustomInterests=e=>{let t=[];return e&&e.length>0&&(t=e.filter(n=>n.source.toLocaleUpperCase()==="CUSTOM")),t};remapInterests=async e=>{let t=this.inquiryCustomInterests(e);if(t&&t.length>0){let n=e.filter(p=>p.source.toLocaleUpperCase()!=="CUSTOM"),o=await this.remapInterestsToIdSchema(n);return t.forEach(p=>o.push(p)),o}return await this.remapInterestsToIdSchema(e)};showFullInterests=async e=>{let t=[];if(e&&e.length>0){let n=this.inquiryCustomInterests(e);t.push(n);let o=e.filter(v=>v.source.toLocaleUpperCase()!=="CUSTOM"),{competitionsMap:p,teamsMap:d,playersMap:y}=await this.getInterestsEntitiesMap(o),g=o.map(v=>{let w=null;if(v.type==="competition")return w=p.get(v.id),w&&(v.id=w.id),v.model=w,v;if(v.type==="team")return w=d.get(v.id),w&&(v.id=w.id),v.model=w,v;if(v.type==="player")return y?(v.model=y[v.id],v.id=y[v.id].id):v.model=w,v});return t.push(g),t.flat()}return t};getInterestsEntitiesMap=async e=>{let t=[],n=[],o=[],p=new Map,d=new Map,y=null;if(e.forEach(g=>{g.type==="competition"?t.push(g.id):g.type==="team"?n.push(g.id):g.type==="player"&&o.push(g.id)}),t.length){let g=kr(t);p=await this.footballFacade.getCompetitionsMapWithNativeIds(g)}if(n.length){let g=kr(n);d=await this.footballFacade.getTeamsMapWithNativeIds(g)}if(o.length){let g=kr(o);y=await this.footballFacade.getPlayersMapWithNativeIds(g)}return{competitionsMap:p,teamsMap:d,playersMap:y}};remapIdsObj=async(e,t,n)=>await this.idMapping.idMappingFacade.getEntitiesByIds(e,t,n)};var So=class{idMapping=null;profileOperations=null;constructor(e,t){this.idMapping=new ae(e),this.profileOperations=new Fo(e,t,this.idMapping)}remapSuccessRatesEntities=async e=>await this.profileOperations.remapSuccessRatesEntities(e);remapInterestToNative=async e=>await this.profileOperations.remapInterestToNative(e);remapInterests=async e=>await this.profileOperations.remapInterests(e);showFullInterests=async e=>await this.profileOperations.showFullInterests(e)};var er=class{idsRemapper=null;profileHttps=null;activityHttps=null;footballHttps=null;footballFacade=null;idMapping=null;localStorage=null;profileFacade=null;ownProfileBuilder=null;profileBuilder=null;constructor(e){this.profileHttps=new Ui(e),this.activityHttps=new ji(e),this.footballHttps=new bt(e),this.idMapping=new ae(e),this.localStorage=new yt(e),this.footballFacade=new qi(e,this.localStorage,this.footballHttps,this.idMapping),this.profileFacade=new Mt(this.localStorage,this.profileHttps,this.activityHttps),this.idsRemapper=new So(e,this.footballFacade),this.ownProfileBuilder=new Sa(this.idsRemapper,this.localStorage,this.profileHttps,this.activityHttps,this.idMapping,this.footballFacade),this.profileBuilder=new Ta(this.idsRemapper,this.localStorage,this.profileHttps,this.activityHttps)}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 To=class{validate=e=>{let t=this.validateField(e.lang),n=this.generateMessage(t);return{validation:t,message:n}};validateField=e=>{let t=["bg","ro","en"],n=null;return e!=null&&e.length>0?t.includes(e)?n="valid":n="invalid":n="missing",n};generateMessage=e=>{let t=null,n="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,n=null),{text:t,type:n}}};var Eo=class{validate(e){let t=this.validateField(e.environment),n=this.generateMessage(t);return{validation:t,message:n}}validateField=e=>{let t=["dev","staging","prod"],n=null;return e!=null&&e.length>0?t.includes(e)?n="valid":n="invalid":n="missing",n};generateMessage=e=>{let t=null,n="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,n=null),{text:t,type:n}}};var Co=class{validate(e){let t=this.validateField(e.apiKey),n=this.generateMessage(t);return{validation:t,message:n}}validateField=e=>{let t=null;return e!=null&&e.length>0?t="valid":t="missing",t};generateMessage=e=>{let t=null,n="error";return e==="missing"&&(t="The field apiKey with valid value must be provided to use Fans United JS SDK"),e==="valid"&&(n=null),{text:t,type:n}}};var xo=class{validate(e){let t=this.validateField(e.idSchema),n=this.generateMessage(t);return{validation:t,message:n}}validateField=e=>{let t=["native","sportal365","enetpulse","sportradar"],n=null;return e!=null&&e.length>0?t.includes(e)?n="valid":n="invalid":n="missing",n};generateMessage=e=>{let t=null,n="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,n=null),{text:t,type:n}}};var fi=class{getIdToken=null;logout=null};var ir=class{text=null;type=null};var Ao=class{validation=null;message=new ir;getIdToken={validation:null,message:new ir};logout={validation:null,message:new ir}};var Oo=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 fi),n=new Ao;if(e){let p=Object.keys(e).filter(d=>!t.includes(d));p.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:"} ${p.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,t)=>(Object.keys(new fi).forEach(o=>{e[o]?t[o].validation="valid":t[o].validation="missing"}),t);generateAuthProviderConfigMessages=e=>(Object.keys(e).filter(t=>t!=="validation"&&t!=="message").forEach(t=>{let n=e[t];n.validation==="missing"&&(n.message.text=`${"The following property is missing from the authProvider object:"} ${t}`,n.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 en=class{validation;message};var Bo=class{apiKey=null;environment=null;idSchema=null;clientId=null;lang=null;authProvider={getIdToken:new en,logout:new en};isValid=!1};var Lo=class{validate(e){let t=this.validateField(e.clientId),n=this.generateMessage(t);return{validation:t,message:n}}validateField=e=>{let t=null;return e!=null&&e.length>0?t="valid":t="missing",t};generateMessage=e=>{let t=null,n="error";return e==="missing"&&(t="The field clientId must be provided to use Fans United JS SDK"),e==="valid"&&(t=null,n=null),{text:t,type:n}}};var No=class{validate=e=>{let t=this.checkFieldsForValues(e);return t.isValid=this.containsErrorMessage(t),t};checkFieldsForValues=e=>{let t=new Bo,n={apiKey:new Co,environment:new Eo,idSchema:new xo,clientId:new Lo,lang:new To,authProvider:new Oo};for(let[o,p]of Object.entries(t))o!=="isValid"&&(p=n[o].validate(e));return Object.keys(n).forEach(o=>{t[o]=n[o].validate(e)}),t};containsErrorMessage=e=>{let t=!0;for(let[n,o]of Object.entries(e))if(n!=="authProvider"){if(n!=="isValid"&&o.message.type==="error")return t=!1,t;if(n!=="isValid"&&o.message.type==="warning")return t=!0,t}else if(o.message.type==="error")return t=!1,t;return t}};var Do=class{https=null;idMapping=null;localStorage=null;footballFacade=null;constructor(e){this.https=new bt(e),this.idMapping=new ae(e),this.localStorage=new yt(e),this.footballFacade=new qi(e,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 Uo=class{value=null;playerId=null;playerModel=null};var rr=class{market=null;matchId=null;matchType=null;matchModel=null;prediction=new Uo;result=null};var Ho=class{value=!1;playerId=null};var tt=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(e,t,n,o){this.matchId=e,this.market=t,this.prediction=new Ho,this.prediction.value=n,this.prediction.playerId=o}};var nr=class{settledAt=null;resettledAt=null;status=null;outcome=null;points=0};var Go=class{value=null};var Zt=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(e,t,n){this.matchId=e,this.market=t,this.prediction=new Go,this.prediction.value=n}};var it=class{value=!1};var ar=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(e,t,n){this.matchId=e,this.market=t,this.prediction=new it,this.prediction.value=n}};var or=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(e,t,n){this.matchId=e,this.market=t,this.prediction=new it,this.prediction.value=n}};var ko=class{matchFacade=null;playerFacade=null;predictorService=null;constructor(e,t,n){this.matchFacade=e,this.playerFacade=t,this.predictorService=n}remapFixturesRequest=e=>{let t={};if(t.match_id=e.matchId,t.match_type="FOOTBALL",e instanceof tt)t.market=e.market,t.prediction=e.prediction.value,t.player_id=e.prediction.playerId;else if(e instanceof ar||e instanceof or)t.market=e.market,t.prediction=e.prediction.value;else if(e instanceof Zt){t.market=e.market;let n=e.prediction.value.split(":");t.goals_home=Number(n[0]),t.goals_away=Number(n[1])}else t.market=e.market,t.prediction=e.prediction.value;return t};remapFixturesResponse=async e=>{let t="OWN_GOAL",n=[],o=[],p=null,d=[];e.length>1&&e.sort((g,v)=>g.match_id.localeCompare(v.match_id));for(let g of e)n.push(g.match_id),g.player_id&&!o.includes(g.player_id)&&o.push(g.player_id);let y=await this.matchFacade.getMatchesMapWithNativeIds(n);o.sort((g,v)=>g.localeCompare(v)),o&&o.length>0&&!o.includes(t)&&(p=await this.playerFacade.getPlayersMapWithNativeIds(o));for(let g of e){let v=new rr;g.target?v.market=this.predictorService.convertMarketForResponseModel(g.market,g.target):v.market=g.market,v.matchId=y[g.match_id].id,v.matchType=g.match_type,v.matchModel=y?y[g.match_id]:null,delete v.matchModel.availableMarkets,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.playerId!==t&&(v.prediction.playerModel=p[g.player_id],v.prediction.playerId=p[g.player_id].id),v.result=this.remapResult(g.result),d.push(v)}return d};remapResult=e=>{let t=new nr;return t.settledAt=e.settled_at,t.resettledAt=e.resettled_at,t.status=e.status,t.outcome=e.outcome,t.points=e.points,t}};var jt=class{goldenGoal=null};var tn=class{id=null;gameInstanceId=null;gameType=null;wager=null;totalFixtures=null;settledFixtures=null;userId=null;fixtures=[];status=null;tiebreaker=new jt;points=null;createdAt=null;updatedAt=null};var j=class{no=0;yes=0};var sr=class{fullTimeOneXTwo={};halfTimeOneXTwo={};bothTeamsScore=new j;doubleChance={};halfTimeFullTime={};playerScore={};playerYellowCard={};playerRedCard={};redCardMatch=new j;penaltyMatch=new j;playerScoreFirstGoal={};cornersMatch={};correctScore={};correctScoreHalfTime={};correctScoreAdvanced={};playerScoreHattrick={};playerScoreTwice={};overZeroPointFiveGoals=new j;overOnePointFiveGoals=new j;overTwoPointFiveGoals=new j;overThreePointFiveGoals=new j;overFourPointFiveGoals=new j;overFivePointFiveGoals=new j;overSixPointFiveGoals=new j;overSixPointFiveCorners=new j;overSevenPointFiveCorners=new j;overEightPointFiveCorners=new j;overNinePointFiveCorners=new j;overTenPointFiveCorners=new j;overElevenPointFiveCorners=new j;overTwelvePointFiveCorners=new j;overThirteenPointFiveCorners=new j};var vt=class{timeTiebreaker=!1};var hi=class{id=null;title=null;description=null;type=null;status=null;outcome=null;predictionsCutoff=null;fixtures=[];tiebreaker=new vt;predictionId=null;participantsCount=0;related=null;excludedProfileIds=null;rules=null;flags=null;points=null;createdAt=null;updatedAt=null;predictionsMadeAt=null;scheduleOpenAt=null;images=null};var gi=class{userId=null;points=null;results=[];tiebreaker=null};var $o=(p=>(p.ACTIVE="ACTIVE",p.WON="WON",p.LOST="LOST",p.PARTIALLY_WON="PARTIALLY_WON",p.CANCELED="CANCELED",p))($o||{}),Ep=["WON","LOST","PARTIALLY_WON","CANCELED"];var Re=class{limit=null;startAfter=null;status=null;type=null;matchIds=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.matchIds=e.matchIds?e.matchIds:null}constructFiltersUrl=()=>{let e="",t=!1;return this.status&&(t=Object.values($o).some(n=>this.status.includes(n))),this.limit&&(e+="&",e+=`limit=${this.limit}`),this.startAfter&&(e+="&",e+=`start_after=${this.startAfter}`),this.status&&t&&(e+="&",e+=`status=${this.status.join(",")}`),this.type&&(e+="&",e+=`game_types=${this.type}`),this.matchIds&&(e+="&",e+=`match_ids=${this.matchIds.join(",")}`),e}};var lr=class{limit;startAfter;constructor(e){this.limit=e.limit?e.limit:null,this.startAfter=e.startAfter?e.startAfter:null}constructMainFiltersUrl(){let e="";return this.limit&&(e+="&",e+=`limit=${this.limit}`),this.startAfter&&(e+="&",e+=`start_after=${this.startAfter}`),e}};var rn=(d=>(d.OPEN="OPEN",d.LIVE="LIVE",d.PENDING="PENDING",d.CANCELED="CANCELED",d.CLOSED="CLOSED",d.SETTLED="SETTLED",d))(rn||{});var rt=class extends lr{status=null;type=null;gameIds=null;sortOrder=null;constructor(e){super(e);this.status=e.status?e.status:null,this.type=e.type?e.type:null,this.gameIds=e.gameIds?e.gameIds:null,this.sortOrder=e.sortOrder?e.sortOrder:null}constructFiltersUrl=()=>{let e=super.constructMainFiltersUrl();return this.status&&Object.values(rn).includes(this.status)&&(e+="&",e+=`status=${this.status}`),this.type&&(e+="&",e+=`type=${this.type}`),this.gameIds&&this.gameIds.length>0&&(e+="&",e+=`game_ids=${this.gameIds.join(",")}`),this.sortOrder&&(e+="&",e+=`sort_order=${this.sortOrder}`),e}};var pr=class{main=null;cover=null;mobile=null};var yi=class{id=null;title=null;description=null;type=null;status=null;scheduleOpenAt=null;predictionsCutoff=null;fixtures=[];tiebreaker=new vt;participantsCount=0;related=null;excludedProfileIds=null;rules=null;flags=null;images=new pr;createdAt=null;updatedAt=null};var Nt=class{id=null;title=null;description=null;type=null;status=null;outcome=null;predictionsCutoff=null;fixtures=[];tiebreaker=new vt;predictionId=null;participantsCount=0;related=null;excludedProfileIds=null;rules=null;flags=null;points=null;createdAt=null;updatedAt=null;predictionsMadeAt=null;images=null;scheduleOpenAt=null};var Cp={UNEXPECTED_STATUS_PROP:`Unexpected provided property 'status'. You can NOT use this property for this method. For more information visit our documentation:
20
+ }`;var G=cm(function(){return q(m,C+"return "+F).apply(s,f)});if(G.source=F,Xl(G))throw G;return G}function Gw(i){return W(i).toLowerCase()}function Hw(i){return W(i).toUpperCase()}function kw(i,r,a){if(i=W(i),i&&(a||r===s))return bc(i);if(!i||!(r=Ge(r)))return i;var l=ot(i),c=ot(r),m=wc(l,c),f=vc(l,c)+1;return Wt(l,m,f).join("")}function $w(i,r,a){if(i=W(i),i&&(a||r===s))return i.slice(0,Ic(i)+1);if(!i||!(r=Ge(r)))return i;var l=ot(i),c=vc(l,ot(r))+1;return Wt(l,0,c).join("")}function Vw(i,r,a){if(i=W(i),i&&(a||r===s))return i.replace(Xs,"");if(!i||!(r=Ge(r)))return i;var l=ot(i),c=wc(l,ot(r));return Wt(l,c).join("")}function qw(i,r){var a=Nd,l=Dd;if(Z(r)){var c="separator"in r?r.separator:c;a="length"in r?U(r.length):a,l="omission"in r?Ge(r.omission):l}i=W(i);var m=i.length;if(_i(i)){var f=ot(i);m=f.length}if(a>=m)return i;var h=a-Ii(l);if(h<1)return l;var b=f?Wt(f,0,h).join(""):i.slice(0,h);if(c===s)return b+l;if(f&&(h+=b.length-h),Yl(c)){if(i.slice(h).search(c)){var P,R=b;for(c.global||(c=cl(c.source,W(kp.exec(c))+"g")),c.lastIndex=0;P=c.exec(R);)var F=P.index;b=b.slice(0,F===s?h:F)}}else if(i.indexOf(Ge(c),h)!=h){var T=b.lastIndexOf(c);T>-1&&(b=b.slice(0,T))}return b+l}function Ww(i){return i=W(i),i&&tf.test(i)?i.replace(Up,wh):i}var Kw=Ei(function(i,r,a){return i+(a?" ":"")+r.toUpperCase()}),Jl=uu("toUpperCase");function pm(i,r,a){return i=W(i),r=a?s:r,r===s?hh(i)?Ih(i):oh(i):i.match(r)||[]}var cm=H(function(i,r){try{return De(i,s,r)}catch(a){return Xl(a)?a:new L(a)}}),Xw=Et(function(i,r){return Xe(r,function(a){a=ht(a),St(i,a,Wl(i[a],i))}),i});function Yw(i){var r=i==null?0:i.length,a=A();return i=r?J(i,function(l){if(typeof l[1]!="function")throw new Ye(o);return[a(l[0]),l[1]]}):[],H(function(l){for(var c=-1;++c<r;){var m=i[c];if(De(m[0],this,l))return De(m[1],this,l)}})}function Qw(i){return wg(ze(i,w))}function Zl(i){return function(){return i}}function zw(i,r){return i==null||i!==i?r:i}var Jw=du(),Zw=du(!0);function xe(i){return i}function jl(i){return Vc(typeof i=="function"?i:ze(i,w))}function jw(i){return Wc(ze(i,w))}function ev(i,r){return Kc(i,ze(r,w))}var tv=H(function(i,r){return function(a){return Or(a,i,r)}}),iv=H(function(i,r){return function(a){return Or(i,a,r)}});function ep(i,r,a){var l=ce(r),c=Bn(r,l);a==null&&!(Z(r)&&(c.length||!l.length))&&(a=r,r=i,i=this,c=Bn(r,ce(r)));var m=!(Z(a)&&"chain"in a)||!!a.chain,f=At(i);return Xe(c,function(h){var b=r[h];i[h]=b,f&&(i.prototype[h]=function(){var P=this.__chain__;if(m||P){var R=i(this.__wrapped__),F=R.__actions__=Ee(this.__actions__);return F.push({func:b,args:arguments,thisArg:i}),R.__chain__=P,R}return b.apply(i,Ut([this.value()],arguments))})}),i}function rv(){return pe._===this&&(pe._=Eh),this}function tp(){}function nv(i){return i=U(i),H(function(r){return Xc(r,i)})}var av=xl(J),ov=xl(fc),sv=xl(rl);function um(i){return Gl(i)?nl(ht(i)):Dg(i)}function lv(i){return function(r){return i==null?s:li(i,r)}}var pv=hu(),cv=hu(!0);function ip(){return[]}function rp(){return!1}function uv(){return{}}function mv(){return""}function dv(){return!0}function fv(i,r){if(i=U(i),i<1||i>D)return[];var a=mt,l=ge(i,mt);r=A(r),i-=mt;for(var c=sl(l,r);++a<i;)r(a);return c}function hv(i){return N(i)?J(i,ht):He(i)?[i]:Ee(Au(W(i)))}function gv(i){var r=++Sh;return W(i)+r}var yv=Hn(function(i,r){return i+r},0),Mv=Ol("ceil"),bv=Hn(function(i,r){return i/r},1),wv=Ol("floor");function vv(i){return i&&i.length?On(i,xe,Ml):s}function _v(i,r){return i&&i.length?On(i,A(r,2),Ml):s}function Iv(i){return yc(i,xe)}function Pv(i,r){return yc(i,A(r,2))}function Rv(i){return i&&i.length?On(i,xe,_l):s}function Fv(i,r){return i&&i.length?On(i,A(r,2),_l):s}var Sv=Hn(function(i,r){return i*r},1),Tv=Ol("round"),Ev=Hn(function(i,r){return i-r},0);function Cv(i){return i&&i.length?ol(i,xe):0}function Av(i,r){return i&&i.length?ol(i,A(r,2)):0}return u.after=jM,u.ary=$u,u.assign=Hb,u.assignIn=im,u.assignInWith=jn,u.assignWith=kb,u.at=$b,u.before=Vu,u.bind=Wl,u.bindAll=Xw,u.bindKey=qu,u.castArray=ub,u.chain=Gu,u.chunk=wy,u.compact=vy,u.concat=_y,u.cond=Yw,u.conforms=Qw,u.constant=Zl,u.countBy=CM,u.create=Vb,u.curry=Wu,u.curryRight=Ku,u.debounce=Xu,u.defaults=qb,u.defaultsDeep=Wb,u.defer=eb,u.delay=tb,u.difference=Iy,u.differenceBy=Py,u.differenceWith=Ry,u.drop=Fy,u.dropRight=Sy,u.dropRightWhile=Ty,u.dropWhile=Ey,u.fill=Cy,u.filter=xM,u.flatMap=LM,u.flatMapDeep=NM,u.flatMapDepth=DM,u.flatten=Lu,u.flattenDeep=Ay,u.flattenDepth=xy,u.flip=ib,u.flow=Jw,u.flowRight=Zw,u.fromPairs=Oy,u.functions=Zb,u.functionsIn=jb,u.groupBy=UM,u.initial=Ly,u.intersection=Ny,u.intersectionBy=Dy,u.intersectionWith=Uy,u.invert=tw,u.invertBy=iw,u.invokeMap=HM,u.iteratee=jl,u.keyBy=kM,u.keys=ce,u.keysIn=Ae,u.map=Xn,u.mapKeys=nw,u.mapValues=aw,u.matches=jw,u.matchesProperty=ev,u.memoize=Qn,u.merge=ow,u.mergeWith=rm,u.method=tv,u.methodOf=iv,u.mixin=ep,u.negate=zn,u.nthArg=nv,u.omit=sw,u.omitBy=lw,u.once=rb,u.orderBy=$M,u.over=av,u.overArgs=nb,u.overEvery=ov,u.overSome=sv,u.partial=Kl,u.partialRight=Yu,u.partition=VM,u.pick=pw,u.pickBy=nm,u.property=um,u.propertyOf=lv,u.pull=$y,u.pullAll=Du,u.pullAllBy=Vy,u.pullAllWith=qy,u.pullAt=Wy,u.range=pv,u.rangeRight=cv,u.rearg=ab,u.reject=KM,u.remove=Ky,u.rest=ob,u.reverse=Vl,u.sampleSize=YM,u.set=uw,u.setWith=mw,u.shuffle=QM,u.slice=Xy,u.sortBy=ZM,u.sortedUniq=eM,u.sortedUniqBy=tM,u.split=Lw,u.spread=sb,u.tail=iM,u.take=rM,u.takeRight=nM,u.takeRightWhile=aM,u.takeWhile=oM,u.tap=vM,u.throttle=lb,u.thru=Kn,u.toArray=ju,u.toPairs=am,u.toPairsIn=om,u.toPath=hv,u.toPlainObject=tm,u.transform=dw,u.unary=pb,u.union=sM,u.unionBy=lM,u.unionWith=pM,u.uniq=cM,u.uniqBy=uM,u.uniqWith=mM,u.unset=fw,u.unzip=ql,u.unzipWith=Uu,u.update=hw,u.updateWith=gw,u.values=xi,u.valuesIn=yw,u.without=dM,u.words=pm,u.wrap=cb,u.xor=fM,u.xorBy=hM,u.xorWith=gM,u.zip=yM,u.zipObject=MM,u.zipObjectDeep=bM,u.zipWith=wM,u.entries=am,u.entriesIn=om,u.extend=im,u.extendWith=jn,ep(u,u),u.add=yv,u.attempt=cm,u.camelCase=vw,u.capitalize=sm,u.ceil=Mv,u.clamp=Mw,u.clone=mb,u.cloneDeep=fb,u.cloneDeepWith=hb,u.cloneWith=db,u.conformsTo=gb,u.deburr=lm,u.defaultTo=zw,u.divide=bv,u.endsWith=_w,u.eq=lt,u.escape=Iw,u.escapeRegExp=Pw,u.every=AM,u.find=OM,u.findIndex=Ou,u.findKey=Kb,u.findLast=BM,u.findLastIndex=Bu,u.findLastKey=Xb,u.floor=wv,u.forEach=Hu,u.forEachRight=ku,u.forIn=Yb,u.forInRight=Qb,u.forOwn=zb,u.forOwnRight=Jb,u.get=Ql,u.gt=yb,u.gte=Mb,u.has=ew,u.hasIn=zl,u.head=Nu,u.identity=xe,u.includes=GM,u.indexOf=By,u.inRange=bw,u.invoke=rw,u.isArguments=ui,u.isArray=N,u.isArrayBuffer=bb,u.isArrayLike=Ce,u.isArrayLikeObject=te,u.isBoolean=wb,u.isBuffer=Kt,u.isDate=vb,u.isElement=_b,u.isEmpty=Ib,u.isEqual=Pb,u.isEqualWith=Rb,u.isError=Xl,u.isFinite=Fb,u.isFunction=At,u.isInteger=Qu,u.isLength=Jn,u.isMap=zu,u.isMatch=Sb,u.isMatchWith=Tb,u.isNaN=Eb,u.isNative=Cb,u.isNil=xb,u.isNull=Ab,u.isNumber=Ju,u.isObject=Z,u.isObjectLike=ee,u.isPlainObject=Gr,u.isRegExp=Yl,u.isSafeInteger=Ob,u.isSet=Zu,u.isString=Zn,u.isSymbol=He,u.isTypedArray=Ai,u.isUndefined=Bb,u.isWeakMap=Lb,u.isWeakSet=Nb,u.join=Gy,u.kebabCase=Rw,u.last=Ze,u.lastIndexOf=Hy,u.lowerCase=Fw,u.lowerFirst=Sw,u.lt=Db,u.lte=Ub,u.max=vv,u.maxBy=_v,u.mean=Iv,u.meanBy=Pv,u.min=Rv,u.minBy=Fv,u.stubArray=ip,u.stubFalse=rp,u.stubObject=uv,u.stubString=mv,u.stubTrue=dv,u.multiply=Sv,u.nth=ky,u.noConflict=rv,u.noop=tp,u.now=Yn,u.pad=Tw,u.padEnd=Ew,u.padStart=Cw,u.parseInt=Aw,u.random=ww,u.reduce=qM,u.reduceRight=WM,u.repeat=xw,u.replace=Ow,u.result=cw,u.round=Tv,u.runInContext=M,u.sample=XM,u.size=zM,u.snakeCase=Bw,u.some=JM,u.sortedIndex=Yy,u.sortedIndexBy=Qy,u.sortedIndexOf=zy,u.sortedLastIndex=Jy,u.sortedLastIndexBy=Zy,u.sortedLastIndexOf=jy,u.startCase=Nw,u.startsWith=Dw,u.subtract=Ev,u.sum=Cv,u.sumBy=Av,u.template=Uw,u.times=fv,u.toFinite=xt,u.toInteger=U,u.toLength=em,u.toLower=Gw,u.toNumber=je,u.toSafeInteger=Gb,u.toString=W,u.toUpper=Hw,u.trim=kw,u.trimEnd=$w,u.trimStart=Vw,u.truncate=qw,u.unescape=Ww,u.uniqueId=gv,u.upperCase=Kw,u.upperFirst=Jl,u.each=Hu,u.eachRight=ku,u.first=Nu,ep(u,function(){var i={};return dt(u,function(r,a){X.call(u.prototype,a)||(i[a]=r)}),i}(),{chain:!1}),u.VERSION=e,Xe(["bind","bindKey","curry","curryRight","partial","partialRight"],function(i){u[i].placeholder=u}),Xe(["drop","take"],function(i,r){$.prototype[i]=function(a){a=a===s?1:le(U(a),0);var l=this.__filtered__&&!r?new $(this):this.clone();return l.__filtered__?l.__takeCount__=ge(a,l.__takeCount__):l.__views__.push({size:ge(a,mt),type:i+(l.__dir__<0?"Right":"")}),l},$.prototype[i+"Right"]=function(a){return this.reverse()[i](a).reverse()}}),Xe(["filter","map","takeWhile"],function(i,r){var a=r+1,l=a==Lp||a==kd;$.prototype[i]=function(c){var m=this.clone();return m.__iteratees__.push({iteratee:A(c,3),type:a}),m.__filtered__=m.__filtered__||l,m}}),Xe(["head","last"],function(i,r){var a="take"+(r?"Right":"");$.prototype[i]=function(){return this[a](1).value()[0]}}),Xe(["initial","tail"],function(i,r){var a="drop"+(r?"":"Right");$.prototype[i]=function(){return this.__filtered__?new $(this):this[a](1)}}),$.prototype.compact=function(){return this.filter(xe)},$.prototype.find=function(i){return this.filter(i).head()},$.prototype.findLast=function(i){return this.reverse().find(i)},$.prototype.invokeMap=H(function(i,r){return typeof i=="function"?new $(this):this.map(function(a){return Or(a,i,r)})}),$.prototype.reject=function(i){return this.filter(zn(A(i)))},$.prototype.slice=function(i,r){i=U(i);var a=this;return a.__filtered__&&(i>0||r<0)?new $(a):(i<0?a=a.takeRight(-i):i&&(a=a.drop(i)),r!==s&&(r=U(r),a=r<0?a.dropRight(-r):a.take(r-i)),a)},$.prototype.takeRightWhile=function(i){return this.reverse().takeWhile(i).reverse()},$.prototype.toArray=function(){return this.take(mt)},dt($.prototype,function(i,r){var a=/^(?:filter|find|map|reject)|While$/.test(r),l=/^(?:head|last)$/.test(r),c=u[l?"take"+(r=="last"?"Right":""):r],m=l||/^find/.test(r);!c||(u.prototype[r]=function(){var f=this.__wrapped__,h=l?[1]:arguments,b=f instanceof $,P=h[0],R=b||N(f),F=function(k){var V=c.apply(u,Ut([k],h));return l&&T?V[0]:V};R&&a&&typeof P=="function"&&P.length!=1&&(b=R=!1);var T=this.__chain__,C=!!this.__actions__.length,x=m&&!T,G=b&&!C;if(!m&&R){f=G?f:new $(this);var O=i.apply(f,h);return O.__actions__.push({func:Kn,args:[F],thisArg:s}),new Qe(O,T)}return x&&G?i.apply(this,h):(O=this.thru(F),x?l?O.value()[0]:O.value():O)})}),Xe(["pop","push","shift","sort","splice","unshift"],function(i){var r=Mn[i],a=/^(?:push|sort|unshift)$/.test(i)?"tap":"thru",l=/^(?:pop|shift)$/.test(i);u.prototype[i]=function(){var c=arguments;if(l&&!this.__chain__){var m=this.value();return r.apply(N(m)?m:[],c)}return this[a](function(f){return r.apply(N(f)?f:[],c)})}}),dt($.prototype,function(i,r){var a=u[r];if(a){var l=a.name+"";X.call(Fi,l)||(Fi[l]=[]),Fi[l].push({name:r,func:a})}}),Fi[Gn(s,ct).name]=[{name:"wrapper",func:s}],$.prototype.clone=Wh,$.prototype.reverse=Kh,$.prototype.value=Xh,u.prototype.at=_M,u.prototype.chain=IM,u.prototype.commit=PM,u.prototype.next=RM,u.prototype.plant=SM,u.prototype.reverse=TM,u.prototype.toJSON=u.prototype.valueOf=u.prototype.value=EM,u.prototype.first=u.prototype.head,Fr&&(u.prototype[Fr]=FM),u},Ht=Ph();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(pe._=Ht,define(function(){return Ht})):ri?((ri.exports=Ht)._=Ht,js._=Ht):pe._=Ht}).call(Oi)});var op=K((nI,ym)=>{"use strict";ym.exports=function(e,t){return function(){for(var o=new Array(arguments.length),p=0;p<o.length;p++)o[p]=arguments[p];return e.apply(t,o)}}});var Be=K((aI,wm)=>{"use strict";var Gv=op(),mi=Object.prototype.toString;function sp(s){return mi.call(s)==="[object Array]"}function lp(s){return typeof s=="undefined"}function Hv(s){return s!==null&&!lp(s)&&s.constructor!==null&&!lp(s.constructor)&&typeof s.constructor.isBuffer=="function"&&s.constructor.isBuffer(s)}function kv(s){return mi.call(s)==="[object ArrayBuffer]"}function $v(s){return typeof FormData!="undefined"&&s instanceof FormData}function Vv(s){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(s):e=s&&s.buffer&&s.buffer instanceof ArrayBuffer,e}function qv(s){return typeof s=="string"}function Wv(s){return typeof s=="number"}function Mm(s){return s!==null&&typeof s=="object"}function pa(s){if(mi.call(s)!=="[object Object]")return!1;var e=Object.getPrototypeOf(s);return e===null||e===Object.prototype}function Kv(s){return mi.call(s)==="[object Date]"}function Xv(s){return mi.call(s)==="[object File]"}function Yv(s){return mi.call(s)==="[object Blob]"}function bm(s){return mi.call(s)==="[object Function]"}function Qv(s){return Mm(s)&&bm(s.pipe)}function zv(s){return typeof URLSearchParams!="undefined"&&s instanceof URLSearchParams}function Jv(s){return s.trim?s.trim():s.replace(/^\s+|\s+$/g,"")}function Zv(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function pp(s,e){if(!(s===null||typeof s=="undefined"))if(typeof s!="object"&&(s=[s]),sp(s))for(var t=0,n=s.length;t<n;t++)e.call(null,s[t],t,s);else for(var o in s)Object.prototype.hasOwnProperty.call(s,o)&&e.call(null,s[o],o,s)}function cp(){var s={};function e(o,p){pa(s[p])&&pa(o)?s[p]=cp(s[p],o):pa(o)?s[p]=cp({},o):sp(o)?s[p]=o.slice():s[p]=o}for(var t=0,n=arguments.length;t<n;t++)pp(arguments[t],e);return s}function jv(s,e,t){return pp(e,function(o,p){t&&typeof o=="function"?s[p]=Gv(o,t):s[p]=o}),s}function e_(s){return s.charCodeAt(0)===65279&&(s=s.slice(1)),s}wm.exports={isArray:sp,isArrayBuffer:kv,isBuffer:Hv,isFormData:$v,isArrayBufferView:Vv,isString:qv,isNumber:Wv,isObject:Mm,isPlainObject:pa,isUndefined:lp,isDate:Kv,isFile:Xv,isBlob:Yv,isFunction:bm,isStream:Qv,isURLSearchParams:zv,isStandardBrowserEnv:Zv,forEach:pp,merge:cp,extend:jv,trim:Jv,stripBOM:e_}});var up=K((oI,_m)=>{"use strict";var Li=Be();function vm(s){return encodeURIComponent(s).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}_m.exports=function(e,t,n){if(!t)return e;var o;if(n)o=n(t);else if(Li.isURLSearchParams(t))o=t.toString();else{var p=[];Li.forEach(t,function(g,w){g===null||typeof g=="undefined"||(Li.isArray(g)?w=w+"[]":g=[g],Li.forEach(g,function(S){Li.isDate(S)?S=S.toISOString():Li.isObject(S)&&(S=JSON.stringify(S)),p.push(vm(w)+"="+vm(S))}))}),o=p.join("&")}if(o){var d=e.indexOf("#");d!==-1&&(e=e.slice(0,d)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}});var Pm=K((sI,Im)=>{"use strict";var t_=Be();function ca(){this.handlers=[]}ca.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};ca.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};ca.prototype.forEach=function(e){t_.forEach(this.handlers,function(n){n!==null&&e(n)})};Im.exports=ca});var Fm=K((lI,Rm)=>{"use strict";var i_=Be();Rm.exports=function(e,t){i_.forEach(e,function(o,p){p!==t&&p.toUpperCase()===t.toUpperCase()&&(e[t]=o,delete e[p])})}});var mp=K((pI,Sm)=>{"use strict";Sm.exports=function(e,t,n,o,p){return e.config=t,n&&(e.code=n),e.request=o,e.response=p,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 dp=K((cI,Tm)=>{"use strict";var r_=mp();Tm.exports=function(e,t,n,o,p){var d=new Error(e);return r_(d,t,n,o,p)}});var Cm=K((uI,Em)=>{"use strict";var n_=dp();Em.exports=function(e,t,n){var o=n.config.validateStatus;!n.status||!o||o(n.status)?e(n):t(n_("Request failed with status code "+n.status,n.config,null,n.request,n))}});var xm=K((mI,Am)=>{"use strict";var ua=Be();Am.exports=ua.isStandardBrowserEnv()?function(){return{write:function(t,n,o,p,d,y){var g=[];g.push(t+"="+encodeURIComponent(n)),ua.isNumber(o)&&g.push("expires="+new Date(o).toGMTString()),ua.isString(p)&&g.push("path="+p),ua.isString(d)&&g.push("domain="+d),y===!0&&g.push("secure"),document.cookie=g.join("; ")},read:function(t){var n=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var Bm=K((dI,Om)=>{"use strict";Om.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var Nm=K((fI,Lm)=>{"use strict";Lm.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}});var Um=K((hI,Dm)=>{"use strict";var a_=Bm(),o_=Nm();Dm.exports=function(e,t){return e&&!a_(t)?o_(e,t):t}});var Hm=K((gI,Gm)=>{"use strict";var fp=Be(),s_=["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"];Gm.exports=function(e){var t={},n,o,p;return e&&fp.forEach(e.split(`
21
+ `),function(y){if(p=y.indexOf(":"),n=fp.trim(y.substr(0,p)).toLowerCase(),o=fp.trim(y.substr(p+1)),n){if(t[n]&&s_.indexOf(n)>=0)return;n==="set-cookie"?t[n]=(t[n]?t[n]:[]).concat([o]):t[n]=t[n]?t[n]+", "+o:o}}),t}});var Vm=K((yI,$m)=>{"use strict";var km=Be();$m.exports=km.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a"),n;function o(p){var d=p;return e&&(t.setAttribute("href",d),d=t.href),t.setAttribute("href",d),{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 n=o(window.location.href),function(d){var y=km.isString(d)?o(d):d;return y.protocol===n.protocol&&y.host===n.host}}():function(){return function(){return!0}}()});var Vr=K((MI,qm)=>{"use strict";function hp(s){this.message=s}hp.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};hp.prototype.__CANCEL__=!0;qm.exports=hp});var yp=K((bI,Wm)=>{"use strict";var ma=Be(),l_=Cm(),p_=xm(),c_=up(),u_=Um(),m_=Hm(),d_=Vm(),gp=dp(),f_=qr(),h_=Vr();Wm.exports=function(e){return new Promise(function(n,o){var p=e.data,d=e.headers,y=e.responseType,g;function w(){e.cancelToken&&e.cancelToken.unsubscribe(g),e.signal&&e.signal.removeEventListener("abort",g)}ma.isFormData(p)&&delete d["Content-Type"];var v=new XMLHttpRequest;if(e.auth){var S=e.auth.username||"",B=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";d.Authorization="Basic "+btoa(S+":"+B)}var Fe=u_(e.baseURL,e.url);v.open(e.method.toUpperCase(),c_(Fe,e.params,e.paramsSerializer),!0),v.timeout=e.timeout;function we(){if(!!v){var Se="getAllResponseHeaders"in v?m_(v.getAllResponseHeaders()):null,ue=!y||y==="text"||y==="json"?v.responseText:v.response,Te={data:ue,status:v.status,statusText:v.statusText,headers:Se,config:e,request:v};l_(function(ut){n(ut),w()},function(ut){o(ut),w()},Te),v=null}}if("onloadend"in v?v.onloadend=we:v.onreadystatechange=function(){!v||v.readyState!==4||v.status===0&&!(v.responseURL&&v.responseURL.indexOf("file:")===0)||setTimeout(we)},v.onabort=function(){!v||(o(gp("Request aborted",e,"ECONNABORTED",v)),v=null)},v.onerror=function(){o(gp("Network Error",e,null,v)),v=null},v.ontimeout=function(){var ue=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",Te=e.transitional||f_.transitional;e.timeoutErrorMessage&&(ue=e.timeoutErrorMessage),o(gp(ue,e,Te.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",v)),v=null},ma.isStandardBrowserEnv()){var ct=(e.withCredentials||d_(Fe))&&e.xsrfCookieName?p_.read(e.xsrfCookieName):void 0;ct&&(d[e.xsrfHeaderName]=ct)}"setRequestHeader"in v&&ma.forEach(d,function(ue,Te){typeof p=="undefined"&&Te.toLowerCase()==="content-type"?delete d[Te]:v.setRequestHeader(Te,ue)}),ma.isUndefined(e.withCredentials)||(v.withCredentials=!!e.withCredentials),y&&y!=="json"&&(v.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&v.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&v.upload&&v.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(g=function(Se){!v||(o(!Se||Se&&Se.type?new h_("canceled"):Se),v.abort(),v=null)},e.cancelToken&&e.cancelToken.subscribe(g),e.signal&&(e.signal.aborted?g():e.signal.addEventListener("abort",g))),p||(p=null),v.send(p)})}});var qr=K((wI,Ym)=>{"use strict";var he=Be(),Km=Fm(),g_=mp(),y_={"Content-Type":"application/x-www-form-urlencoded"};function Xm(s,e){!he.isUndefined(s)&&he.isUndefined(s["Content-Type"])&&(s["Content-Type"]=e)}function M_(){var s;return typeof XMLHttpRequest!="undefined"?s=yp():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(s=yp()),s}function b_(s,e,t){if(he.isString(s))try{return(e||JSON.parse)(s),he.trim(s)}catch(n){if(n.name!=="SyntaxError")throw n}return(t||JSON.stringify)(s)}var da={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:M_(),transformRequest:[function(e,t){return Km(t,"Accept"),Km(t,"Content-Type"),he.isFormData(e)||he.isArrayBuffer(e)||he.isBuffer(e)||he.isStream(e)||he.isFile(e)||he.isBlob(e)?e:he.isArrayBufferView(e)?e.buffer:he.isURLSearchParams(e)?(Xm(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):he.isObject(e)||t&&t["Content-Type"]==="application/json"?(Xm(t,"application/json"),b_(e)):e}],transformResponse:[function(e){var t=this.transitional||da.transitional,n=t&&t.silentJSONParsing,o=t&&t.forcedJSONParsing,p=!n&&this.responseType==="json";if(p||o&&he.isString(e)&&e.length)try{return JSON.parse(e)}catch(d){if(p)throw d.name==="SyntaxError"?g_(d,this,"E_JSON_PARSE"):d}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, */*"}}};he.forEach(["delete","get","head"],function(e){da.headers[e]={}});he.forEach(["post","put","patch"],function(e){da.headers[e]=he.merge(y_)});Ym.exports=da});var zm=K((vI,Qm)=>{"use strict";var w_=Be(),v_=qr();Qm.exports=function(e,t,n){var o=this||v_;return w_.forEach(n,function(d){e=d.call(o,e,t)}),e}});var Mp=K((_I,Jm)=>{"use strict";Jm.exports=function(e){return!!(e&&e.__CANCEL__)}});var ed=K((II,jm)=>{"use strict";var Zm=Be(),bp=zm(),__=Mp(),I_=qr(),P_=Vr();function wp(s){if(s.cancelToken&&s.cancelToken.throwIfRequested(),s.signal&&s.signal.aborted)throw new P_("canceled")}jm.exports=function(e){wp(e),e.headers=e.headers||{},e.data=bp.call(e,e.data,e.headers,e.transformRequest),e.headers=Zm.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Zm.forEach(["delete","get","head","post","put","patch","common"],function(o){delete e.headers[o]});var t=e.adapter||I_.adapter;return t(e).then(function(o){return wp(e),o.data=bp.call(e,o.data,o.headers,e.transformResponse),o},function(o){return __(o)||(wp(e),o&&o.response&&(o.response.data=bp.call(e,o.response.data,o.response.headers,e.transformResponse))),Promise.reject(o)})}});var vp=K((PI,td)=>{"use strict";var Ve=Be();td.exports=function(e,t){t=t||{};var n={};function o(v,S){return Ve.isPlainObject(v)&&Ve.isPlainObject(S)?Ve.merge(v,S):Ve.isPlainObject(S)?Ve.merge({},S):Ve.isArray(S)?S.slice():S}function p(v){if(Ve.isUndefined(t[v])){if(!Ve.isUndefined(e[v]))return o(void 0,e[v])}else return o(e[v],t[v])}function d(v){if(!Ve.isUndefined(t[v]))return o(void 0,t[v])}function y(v){if(Ve.isUndefined(t[v])){if(!Ve.isUndefined(e[v]))return o(void 0,e[v])}else return o(void 0,t[v])}function g(v){if(v in t)return o(e[v],t[v]);if(v in e)return o(void 0,e[v])}var w={url:d,method:d,data:d,baseURL:y,transformRequest:y,transformResponse:y,paramsSerializer:y,timeout:y,timeoutMessage:y,withCredentials:y,adapter:y,responseType:y,xsrfCookieName:y,xsrfHeaderName:y,onUploadProgress:y,onDownloadProgress:y,decompress:y,maxContentLength:y,maxBodyLength:y,transport:y,httpAgent:y,httpsAgent:y,cancelToken:y,socketPath:y,responseEncoding:y,validateStatus:g};return Ve.forEach(Object.keys(e).concat(Object.keys(t)),function(S){var B=w[S]||p,Fe=B(S);Ve.isUndefined(Fe)&&B!==g||(n[S]=Fe)}),n}});var _p=K((RI,id)=>{id.exports={version:"0.24.0"}});var ad=K((FI,nd)=>{"use strict";var R_=_p().version,Ip={};["object","boolean","number","function","string","symbol"].forEach(function(s,e){Ip[s]=function(n){return typeof n===s||"a"+(e<1?"n ":" ")+s}});var rd={};Ip.transitional=function(e,t,n){function o(p,d){return"[Axios v"+R_+"] Transitional option '"+p+"'"+d+(n?". "+n:"")}return function(p,d,y){if(e===!1)throw new Error(o(d," has been removed"+(t?" in "+t:"")));return t&&!rd[d]&&(rd[d]=!0,console.warn(o(d," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(p,d,y):!0}};function F_(s,e,t){if(typeof s!="object")throw new TypeError("options must be an object");for(var n=Object.keys(s),o=n.length;o-- >0;){var p=n[o],d=e[p];if(d){var y=s[p],g=y===void 0||d(y,p,s);if(g!==!0)throw new TypeError("option "+p+" must be "+g);continue}if(t!==!0)throw Error("Unknown option "+p)}}nd.exports={assertOptions:F_,validators:Ip}});var ud=K((SI,cd)=>{"use strict";var od=Be(),S_=up(),sd=Pm(),ld=ed(),fa=vp(),pd=ad(),Ni=pd.validators;function Wr(s){this.defaults=s,this.interceptors={request:new sd,response:new sd}}Wr.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=fa(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&&pd.assertOptions(t,{silentJSONParsing:Ni.transitional(Ni.boolean),forcedJSONParsing:Ni.transitional(Ni.boolean),clarifyTimeoutError:Ni.transitional(Ni.boolean)},!1);var n=[],o=!0;this.interceptors.request.forEach(function(B){typeof B.runWhen=="function"&&B.runWhen(e)===!1||(o=o&&B.synchronous,n.unshift(B.fulfilled,B.rejected))});var p=[];this.interceptors.response.forEach(function(B){p.push(B.fulfilled,B.rejected)});var d;if(!o){var y=[ld,void 0];for(Array.prototype.unshift.apply(y,n),y=y.concat(p),d=Promise.resolve(e);y.length;)d=d.then(y.shift(),y.shift());return d}for(var g=e;n.length;){var w=n.shift(),v=n.shift();try{g=w(g)}catch(S){v(S);break}}try{d=ld(g)}catch(S){return Promise.reject(S)}for(;p.length;)d=d.then(p.shift(),p.shift());return d};Wr.prototype.getUri=function(e){return e=fa(this.defaults,e),S_(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};od.forEach(["delete","get","head","options"],function(e){Wr.prototype[e]=function(t,n){return this.request(fa(n||{},{method:e,url:t,data:(n||{}).data}))}});od.forEach(["post","put","patch"],function(e){Wr.prototype[e]=function(t,n,o){return this.request(fa(o||{},{method:e,url:t,data:n}))}});cd.exports=Wr});var dd=K((TI,md)=>{"use strict";var T_=Vr();function Di(s){if(typeof s!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(o){e=o});var t=this;this.promise.then(function(n){if(!!t._listeners){var o,p=t._listeners.length;for(o=0;o<p;o++)t._listeners[o](n);t._listeners=null}}),this.promise.then=function(n){var o,p=new Promise(function(d){t.subscribe(d),o=d}).then(n);return p.cancel=function(){t.unsubscribe(o)},p},s(function(o){t.reason||(t.reason=new T_(o),e(t.reason))})}Di.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};Di.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};Di.prototype.unsubscribe=function(e){if(!!this._listeners){var t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}};Di.source=function(){var e,t=new Di(function(o){e=o});return{token:t,cancel:e}};md.exports=Di});var hd=K((EI,fd)=>{"use strict";fd.exports=function(e){return function(n){return e.apply(null,n)}}});var yd=K((CI,gd)=>{"use strict";gd.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var wd=K((AI,Pp)=>{"use strict";var Md=Be(),E_=op(),ha=ud(),C_=vp(),A_=qr();function bd(s){var e=new ha(s),t=E_(ha.prototype.request,e);return Md.extend(t,ha.prototype,e),Md.extend(t,e),t.create=function(o){return bd(C_(s,o))},t}var gt=bd(A_);gt.Axios=ha;gt.Cancel=Vr();gt.CancelToken=dd();gt.isCancel=Mp();gt.VERSION=_p().version;gt.all=function(e){return Promise.all(e)};gt.spread=hd();gt.isAxiosError=yd();Pp.exports=gt;Pp.exports.default=gt});var _d=K((xI,vd)=>{vd.exports=wd()});var gm=dm(fm());var ap=s=>{let e=200,t=[],n=0;return t[n]=[],s.forEach(o=>{t[n].length<=e-1?t[n].push(o):(n++,t[n]=[o])}),t},ea=s=>{let e=[],t=200;for(;s.length>t;){let n=s.splice(0,t);e.push(n)}return e.push(s),e},Oe=(s,e)=>{let t="",n={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"},o={profile:"http://localhost:8010/v1",football:"http://localhost:8080/v1",idMapping:"http://localhost:8030/v1",predictor:"http://localhost:8040/v1",client:"http://localhost:8070/v1",loyalty:"http://localhost:8060/v1"},p={profile:"https://profile.fansunitedstagingapi.com/v1",football:"https://football.fansunitedstagingapi.com/v1",idMapping:"https://id-mapping.fansunitedstagingapi.com/v1",predictor:"https://prediction.fansunitedstagingapi.com/v1",client:"https://client.fansunitedstagingapi.com/v1",loyalty:"https://loyalty.fansunitedstagingapi.com/v1"};return s==="prod"?t=n[e]:s==="dev"?t=o[e]:t=p[e],t},Xt=s=>s.filter((t,n,o)=>n===o.indexOf(t)),ta=s=>Array.isArray(s)?s.map(e=>ta(e)):s!=null&&s.constructor===Object?Object.keys(s).reduce((e,t)=>({...e,[(0,gm.camelCase)(t)]:ta(s[t])}),{}):s,de=s=>s||!1,fe=()=>`&disable_cache=${Date.now()}`,kr=s=>s.sort((e,t)=>e.localeCompare(t));var ia=class{id=null;name=null;nickname=null;avatar=null;gender=null;country=null;birthDate=null;interests=[];followingCount=0;followersCount=0};var ra=class{profilesFromResponse=e=>e?e.map(t=>this.fullProfileFromResponse(t)):null;fullProfileFromResponse=e=>{let t=new ia;return t.id=e.id,t.name=e.name,t.nickname=e.nickname,t.avatar=e.avatar,t.gender=e.gender,t.country=e.country,t.birthDate=e.birth_date,t.interests=e.interests?e.interests:[],t.followingCount=e.following_count,t.followersCount=e.followers_count,t}};var na=class{nextPageStartsAfter=null;itemsPerPage=null};var Bi=class{pagination=new na};var re=class{meta=new Bi;data=[]};var aa=class{avatar=null;followingId=null;name=null;nickname=null;profileId=null};var oa=class{followResponse=e=>e.map(t=>this.remapResponse(t));followingFromResponse=e=>{let t=new re;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(n=>this.remapResponse(n)),t};remapResponse=e=>{let t=new aa;return t.avatar=e.avatar,t.followingId=e.following_id,t.name=e.name,t.profileId=e.profile_id,t.nickname=e.nickname,t}};var sa=class{avatar=null;followerId=null;name=null;nickname=null;profileId=null};var la=class{followersFromResponse=e=>{let t=new re;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(n=>this.remapResponse(n)),t};remapResponse=e=>{let t=new sa;return t.avatar=e.avatar,t.followerId=e.follower_id,t.name=e.name,t.profileId=e.profile_id,t}};var $r=class{profile_ids=[]};var ya=dm(_d());function Rp(s){this.message=s}Rp.prototype=new Error,Rp.prototype.name="InvalidCharacterError";var Id=typeof window!="undefined"&&window.atob&&window.atob.bind(window)||function(s){var e=String(s).replace(/=+$/,"");if(e.length%4==1)throw new Rp("'atob' failed: The string to be decoded is not correctly encoded.");for(var t,n,o=0,p=0,d="";n=e.charAt(p++);~n&&(t=o%4?64*t+n:n,o++%4)?d+=String.fromCharCode(255&t>>(-2*o&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return d};function x_(s){var e=s.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw"Illegal base64url string!"}try{return function(t){return decodeURIComponent(Id(t).replace(/(.)/g,function(n,o){var p=o.charCodeAt(0).toString(16).toUpperCase();return p.length<2&&(p="0"+p),"%"+p}))}(e)}catch{return Id(e)}}function ga(s){this.message=s}function O_(s,e){if(typeof s!="string")throw new ga("Invalid token specified");var t=(e=e||{}).header===!0?0:1;try{return JSON.parse(x_(s.split(".")[t]))}catch(n){throw new ga("Invalid token specified: "+n.message)}}ga.prototype=new Error,ga.prototype.name="InvalidTokenError";var Pd=O_;var Rd=(s,e,t)=>{let n={data:s.data,status:e,statusText:t,headers:s.headers,config:s};return{code:String(e),config:s,isAxiosError:!0,toJSON:()=>({}),name:"Unauthorized",message:t,response:n}};var Me=class{instanceAuth=null;instance=null;constructor(e,t){this.instanceAuth=ya.default.create({baseURL:t,headers:{Authorization:`Bearer ${e.authProvider.getIdToken()}`,"Content-Type":"application/json"}}),this.instanceAuth.interceptors.request.use(n=>{let o=null;try{o=Pd(e.authProvider.getIdToken())}catch(d){throw Rd(n,401,d.message)}return Date.now()>o.exp&&(ya.default.defaults.headers.common.Authorization=`Bearer ${e.authProvider.getIdToken()}`,n.headers.Authorization=`Bearer ${e.authProvider.getIdToken()}`),n},n=>{Promise.reject(n)}),this.instanceAuth.interceptors.response.use(n=>n,n=>{let o=n.config;if((n.response?.status===403||n.response?.status===401)&&!o._retry){o._retry=!0;let p=e.authProvider.getIdToken();return o.headers.Authorization=`Bearer ${p}`,this.instanceAuth(o)}return Promise.reject(n)}),this.instance=ya.default.create({baseURL:t,headers:{"Content-Type":"application/json"}})}};var B_="/countries",Le="/profile",Fd="/profiles",Ui=class extends Me{apiSignInUrl=null;profileRemapper=null;followingRemapper=null;followersRemapper=null;lang=null;constructor(e){super(e,Oe(e.environment,"profile"));this.lang=e.lang,this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}`,this.profileRemapper=new ra,this.followingRemapper=new oa,this.followersRemapper=new la}getCountries=async e=>{try{let t=`&lang=${this.lang}`,n=`${B_}${this.apiSignInUrl}${t}`,o=Date.now();return e&&(n+=`&disable_cache=${o}`),(await this.instance.get(n)).data.data}catch(t){throw console.warn("There was a problem fetching the countries:",t),t.response}};getProfile=async e=>{let t=`${Le}${this.apiSignInUrl}`;if(e){t=`${Fd}/${e}${this.apiSignInUrl}`;try{let n=await this.instance.get(t);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(t);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,t)=>{try{let n=`${Fd}${this.apiSignInUrl}&profile_ids=${e.join(",")}`,o=Date.now();t&&(n+=`&disable_cache=${o}`);let p=await this.instance.get(n);return this.profileRemapper.profilesFromResponse(p.data.data)}catch(n){throw console.warn(`There was a problem fetching the following profiles: ${e.join(",")}`,n),n.response}};getFollowers=async(e,t)=>{let n=`${Le}/followers${this.apiSignInUrl}`;if(e&&!t){n=`${Le}/followers${this.apiSignInUrl}${e.constructFilterUrl()}`;try{let o=await this.instanceAuth.get(n);return this.followersRemapper.followersFromResponse(o.data)}catch(o){throw console.warn("There was a problem fetching the followers for own profile",o),o.response}}else if(!e&&!t)try{let o=await this.instanceAuth.get(n);return this.followersRemapper.followersFromResponse(o.data)}catch(o){throw console.warn("There was a problem fetching the followers for own profile",o),o.response}e&&t?n=`${Le}/${t}/followers${this.apiSignInUrl}${e.constructFilterUrl()}`:!e&&t&&(n=`${Le}/${t}/followers${this.apiSignInUrl}`);try{let o=await this.instance.get(n);return this.followersRemapper.followersFromResponse(o.data)}catch(o){throw console.warn(`There was a problem fetching the followers for profile: ${t}`,o),o.response}};getFollowing=async(e,t)=>{let n=`${Le}/following${this.apiSignInUrl}`;if(e&&!t){n=`${Le}/following${this.apiSignInUrl}${e.constructFilterUrl()}`;try{let o=await this.instanceAuth.get(n);return this.followingRemapper.followingFromResponse(o.data)}catch(o){throw console.warn("There was a problem fetching the followers of own profile",o),o.response}}else if(!e&&!t)try{let o=await this.instanceAuth.get(n);return this.followingRemapper.followingFromResponse(o.data)}catch(o){throw console.warn("There was a problem fetching the followers of own profile",o),o.response}e&&t?n=`${Le}/${t}/following${this.apiSignInUrl}${e.constructFilterUrl()}`:!e&&t&&(n=`${Le}/${t}/following${this.apiSignInUrl}`);try{let o=await this.instance.get(n);return this.followingRemapper.followingFromResponse(o.data)}catch(o){throw console.warn(`There was a problem fetching the followers of the following profile: ${t}`,o),o.response}};follow=async e=>{let t=new $r;t.profile_ids=e;try{let n=await this.instanceAuth.post(`${Le}/follow${this.apiSignInUrl}`,JSON.stringify(t));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 t=new $r;t.profile_ids=e;try{return await this.instanceAuth.delete(`${Le}/follow${this.apiSignInUrl}`,{data:JSON.stringify(t)}),!0}catch(n){throw console.warn(`There was a problem with DELETE request for profiles: ${e.join(",")} `,n),n.response}};getBadges=async e=>{let t=`${Le}/badges${this.apiSignInUrl}`;try{return e?(t=`${Le}/${e}/badges${this.apiSignInUrl}`,(await this.instance.get(t)).data.data):(await this.instanceAuth.get(t)).data.data}catch(n){throw console.warn("There was a problem with fetching the badges",n),n.response}};updateProfile=async e=>{try{let t=await this.instanceAuth.patch(`${Le}${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 Bt={native:"id",sportradar:"sportradar_id",sportal365:"sportal365_id",enetpulse:"enetpulse_id"},Fp={PREDICTOR_USER_RELATED_OPERATION:"https://docs.fansunitedmedia.com/docs/predictor-operations#user-related-operations"},Sp=["matchId","matchType","market","prediction"];var Sd="FansUnited",Tp={football:{ids:[],countries:[],competitions:[]},profile:{info:{},statistics:{},badges:null,countries:[],exparations:{profile:0,statistics:0,badges:0}}},yt=class{idSchema="";expirationTimeout=600;expirationBadgesTimeout=3600;constructor(e){this.idSchema=e.idSchema,(this.getData()===void 0||this.getData()===null)&&this.setData(Tp)}clearData=()=>{this.setData(Tp)};getEntityById=(e="",t="")=>this.getData().football.ids.find(n=>{let o=Bt[this.idSchema];return n&&`${n[o]}`===t&&n.resource===e});getEntity=(e,t,n)=>Array.isArray(e)?this.getData().football.ids.filter(o=>{let p=Bt[n];return o&&e.includes(`${o[p]}`)&&o.resource===t}):this.getData().football.ids.find(o=>{let p=Bt[n];return o&&`${o[p]}`===e&&o.resource===t});getEntityByNativeId=(e="",t="")=>this.getData().football.ids.find(n=>n&&`${n.id}`===t&&n.resource===e);checkForExistingIdObjs=(e,t)=>{let n=Bt[t],o={};return Object.keys(e).forEach(p=>{let d=e[p],g=this.getEntity(d,p,t).map(v=>v[n]),w=e[p].filter(v=>!g.includes(v));o[p]=d.map(v=>w.includes(v)?{id:v,exists:!1}:{id:v,exists:!0})}),o};getIdsByType=(e,t,n)=>{let o=Bt[n],p=Bt[t],d={};return Object.keys(e).forEach(y=>{let g=e[y],w=[];this.getData().football.ids.forEach(v=>{g.forEach((S,B)=>{S===v[p]&&y===v.resource&&(w[B]=v[o])})}),d[y]=w}),d};addIdMapping=e=>{let t=this.getData();t.football.ids.push(e),this.setData(t)};addIdMappings=e=>{let t=this.getData(),n=t.football.ids;n=[...n,...e],t.football.ids=n,this.setData(t)};setOwnProfile=e=>{let t=this.getData();t.profile.info=e,t.profile.exparations.profile=Math.floor(Date.now()/1e3)+this.expirationTimeout,this.setData(t)};getOwnProfile=()=>this.getData().profile.info;getProfileCountries=()=>this.getData().profile.countries;setProfileCountries=e=>{let t=this.getData();t.profile.countries=e,this.setData(t)};getProfileStats=()=>this.getData().profile.statistics;setProfileStats=e=>{let t=this.getData();t.profile.statistics=e,t.profile.exparations.statistics=Math.floor(Date.now()/1e3)+this.expirationTimeout,this.setData(t)};getProfileBadges=()=>this.getData().profile.badges;setProfileBadges=e=>{let t=this.getData();t.profile.badges=e,t.profile.exparations.badges=Math.floor(Date.now()/1e3)+this.expirationBadgesTimeout,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(),n=[...t.football.competitions];n.push(...e),t.football.competitions=this.makeCompetitionsUnique(n),this.setData(t)};getCompetitionsLength=()=>{let{football:e}=this.getData();return e.competitions.length};getExpiration=e=>{let t=this.getData();switch(this.initialNewSchema("exparations"),e){case"profile":return t.profile.exparations.profile;case"statistics":return t.profile.exparations.statistics;case"badges":return t.profile.exparations.badges}};makeCompetitionsUnique=e=>{let t=new Set;return e.filter(n=>{let o=!t.has(n.id);return t.add(n.id),o})};getData=()=>JSON.parse(localStorage.getItem(Sd));setData=e=>{localStorage.setItem(Sd,JSON.stringify(e))};initialNewSchema=e=>{this.getData().profile[e]||this.setData(Tp)}};var Kr={player:"players",team:"teams",homeTeam:"teams",awayTeam:"teams",country:"countries",competition:"competitions",match:"matches"},Ma=class extends Me{apiSignInUrl="";constructor(e){super(e,Oe(e.environment,"idMapping"));this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}`}getEntityById=(e,t)=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${config.idSchema}&${Kr[e]}=${t}`)}catch(n){throw console.warn(`There was a problem with id mapping request for the following id:${t}`,n),n.response}};getEntityByIdAndSchema=(e,t,n)=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${n}&${Kr[e]}=${t}`)}catch(o){throw console.warn(`There was a problem with id mapping request for the following id:${t}`,o),o.response}};getEntityIdsByIdsAndSchema=(e,t,n)=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${n}&${Kr[e]}=${t.join(",")}`)}catch(o){throw console.warn(`There was a problem with id mapping request for the following ids:${t.join(",")}`,o),o.response}};getEntitiesByIds=(e,t,n)=>{t.sort((d,y)=>d.localeCompare(y));let p=ap(t).map(d=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${n}&${Kr[e]}=${d.join(",")}`)}catch(y){throw console.warn(`There was a problem with id mapping request for the following ids:${d.join(",")}`,y),y.response}});return Promise.all(p).then(d=>{let y=[];return d.forEach(g=>{y.push(...g.data.data)}),y})};getEntitiesByIdObjs=async(e,t)=>{let n=[],o={},p=[];Object.keys(e).forEach(w=>{n.push.apply(n,e[w])});let d=Xt(n),y=ap(d);for(let w of y){let v="";if(Object.keys(e).forEach(S=>{o[S]=[];let B=w.filter(Fe=>e[S].includes(Fe));B&&B.length>0&&(o[S]=B)}),Object.keys(o).forEach(S=>{o[S].length>0&&(o[S].sort((B,Fe)=>B.localeCompare(Fe)),v+="&",v+=`${Kr[S]}=${o[S].join(",")}`)}),v&&v.length>0)try{let S=await this.instance.get(`/football${this.apiSignInUrl}&input_provider=${t||"native"}${v}`);p.push(S.data.data)}catch(S){throw console.warn("There was a problem with id mapping request",S),S.response}else p.push([])}return Array.prototype.concat.apply([],p)}};var ba=class{isBrowser=!1;localStorage=null;https=null;constructor(e){this.isBrowser=typeof window!="undefined",this.localStorage=new yt(e),this.https=new Ma(e)}getEntitiesByIds=async(e,t,n)=>{if(this.isBrowser)try{let o=this.localStorage.checkForExistingIdObjs(e,t),p=this.splitForRequestAndExisting(o),d=await this.https.getEntitiesByIdObjs(p.request,t);return this.localStorage.addIdMappings(d),this.localStorage.getIdsByType(e,t,n)}catch(o){return console.warn("There was a problem retrieving the entity ids ",o),Promise.resolve([])}else try{let o=await this.https.getEntitiesByIdObjs(e,t);return Object.keys(e).forEach(p=>{e[p]=o.filter(d=>d.resource===p).map(d=>d[Bt[n]])}),e}catch(o){return console.warn("There was a problem retrieving the entity ids ",o),Promise.resolve([])}};getEntityById=async(e,t,n)=>{if(this.isBrowser){let o=this.localStorage.getEntity(e,t,n);if(o)return o;{let p=await this.requestEntity(e,t,n);return this.localStorage.addIdMappings(p),p}}else return await this.requestEntity(e,t,n)};splitForRequestAndExisting=e=>{let t={},n={};return Object.keys(e).forEach(o=>{t[o]=e[o].filter(p=>!p.exists).map(p=>p.id),n[o]=e[o].filter(p=>p.exists).map(p=>p.id)}),{existing:n,request:t}};requestEntity=async(e,t,n)=>{try{return e=Array.isArray(e)?e:[e],await this.https.getEntitiesByIds(t,e,n)}catch(o){return console.warn(`There was a problem retrieving the requested entity: ${o}`),null}}};var wa=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 va=class{extractedObjIds={};traverse=(e,t)=>(t=wa(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(n=>{this.traverseObjExtract(n,t)})};traverseObjExtract=(e,t)=>{e&&Object.keys(e).length>0&&Object.keys(e).forEach(n=>{let o=e[n];n==="id"||n==="teamId"?(this.extractedObjIds.hasOwnProperty(t)||(this.extractedObjIds[t]=[]),o&&this.extractedObjIds[t].push(o)):e[n]&&this.traverse(e[n],n)})}};var _a=class{replaceObjIdsIndex=null;remappedIdsObj={};traverse=(e,t,n)=>(t=wa(t),this.replaceObjIdsIndex===null&&(this.initReplaceObjIdsIndex(n),this.remappedIdsObj=n),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(n=>{this.traverseObjReplace(n,t)})};traverseObjReplace=(e,t)=>{e&&Object.keys(e).length>0&&Object.keys(e).forEach(n=>{n==="id"||n==="teamId"?e[n]&&(e[n]=this.remappedIdsObj[t][this.replaceObjIdsIndex[t]],this.replaceObjIdsIndex[t]=this.replaceObjIdsIndex[t]+1):e[n]&&this.traverse(e[n],n,this.remappedIdsObj)})}};var ae=class{idSchema="";idMappingFacade=null;constructor(e){this.idSchema=e.idSchema,this.idMappingFacade=new ba(e)}getEntityIdBySchemaId=(e,t)=>this.idMappingFacade.getEntityById(e,t,this.idSchema);remapEntities=async(e,t)=>{let n=JSON.parse(JSON.stringify(e));try{if(this.idSchema!=="native"){let p=new va().traverse(n,t);return this.idMappingFacade.getEntitiesByIds(p,"native",this.idSchema).then(d=>new _a().traverse(n,t,d))}else return e}catch(o){return console.warn(`There was a problem remapping entity: ${t} with inner entity `,o),[]}};getEntityIdsBySchemaId=async(e,t,n)=>{let o={};return o[t]=e,this.idSchema!=="native"?await this.idMappingFacade.getEntitiesByIds(o,this.idSchema,n):o}};var qe=class{completed=!1;percentage;constructor(e){this.percentage=e}};var Ia=class{teamFollowed=new qe(10);teamFavourite=new qe(15);playerFollowed=new qe(10);playerFavourite=new qe(10);competitionFollowed=new qe(10);competitionFavourite=new qe(5);addedBirthdate=new qe(10);addedGender=new qe(10);addedCountry=new qe(10);addedAvatar=new qe(10)};var Pa=class{totalPercentage;breakdown=new Ia};var Xr=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 Mt=class{isBrowser=!1;localStorage={};profileHttps=null;activityHttps=null;constructor(e,t,n){this.isBrowser=typeof window!="undefined",this.localStorage=e,this.profileHttps=t,this.activityHttps=n}getOwn=async()=>{if(this.isBrowser){let e=this.getLocalStorageData("profile");if(e)return JSON.parse(JSON.stringify(e));try{let t=await this.profileHttps.getProfile();return this.localStorage.setOwnProfile(t),t}catch(t){throw console.warn("There was a problem retrieving your profile: ",t),t}}else try{return await this.profileHttps.getProfile()}catch(e){throw console.warn("There was a problem retrieving your profile: ",e),e}};updateOwnProfile=async()=>{try{let e=await this.profileHttps.getProfile();return this.localStorage.setOwnProfile(e),e}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.profileHttps.getProfiles(e,t)}catch(n){throw console.warn(`There was a problem retrieving the selected profiles: ${e.join(",")} `,n),n}};getById=async e=>{try{return await this.profileHttps.getProfile(e)}catch(t){throw console.warn(`There was a problem retrieving the selected profile: ${e} `,t),t}};getCountries=async e=>{if(e=e||!1,this.isBrowser){let t=this.localStorage.getProfileCountries();if(t&&t.length>0)return t;try{let n=await this.profileHttps.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.profileHttps.getCountries(e)}catch(t){throw console.warn("There was a problem retrieving profile countries: ",t),t}};getFollowers=async(e,t)=>{try{e&&(e=new Xr(e));let n=await this.profileHttps.getFollowers(e,t),o=n.data.map(p=>p.followerId);if(o.length){let p=await this.getByIds(o),d=n.data.map(y=>(p.forEach(g=>{y.followerId===g.id&&(y.name=g.name,y.nickname=g.nickname,y.avatar=g.avatar)}),y));return n.data=d,n}return n}catch(n){throw console.warn("There was a problem retrieving your followers: ",n),n}};getFollowing=async(e,t)=>{try{e&&(e=new Xr(e));let n=await this.profileHttps.getFollowing(e,t),o=n.data.map(p=>p.followingId);if(o.length){let p=await this.getByIds(o),d=n.data.map(y=>(p.forEach(g=>{y.followingId===g.id&&(y.name=g.name,y.nickname=g.nickname,y.avatar=g.avatar)}),y));return n.data=d,n}return n}catch(n){throw console.warn("There was a problem retrieving your following profiles: ",n),n}};follow=async e=>{try{return await this.profileHttps.follow(e)}catch(t){throw console.warn(`There was a problem following profiles: ${e.join(",")} `,t),t}};unfollow=async e=>{try{return await this.profileHttps.unfollow(e)}catch(t){throw console.warn(`There was a problem unfollowing profiles: ${e.join(",")} `,t),t}};showFullnessProfile=e=>{let t=new Pa,n=0;return e.avatar&&(t.breakdown.addedAvatar.completed=!0,n+=t.breakdown.addedAvatar.percentage),e.birthDate&&(t.breakdown.addedBirthdate.completed=!0,n+=t.breakdown.addedBirthdate.percentage),e.country&&(t.breakdown.addedCountry.completed=!0,n+=t.breakdown.addedCountry.percentage),e.gender&&(t.breakdown.addedGender.completed=!0,n+=t.breakdown.addedGender.percentage),e.interests&&e.interests.length>0&&(e.interests.find(v=>v.type==="team"&&v.favourite)&&(t.breakdown.teamFavourite.completed=!0,n+=t.breakdown.teamFavourite.percentage),e.interests.find(v=>v.type==="team")&&(t.breakdown.teamFollowed.completed=!0,n+=t.breakdown.teamFollowed.percentage),e.interests.find(v=>v.type==="player"&&v.favourite)&&(t.breakdown.playerFavourite.completed=!0,n+=t.breakdown.playerFavourite.percentage),e.interests.find(v=>v.type==="player")&&(t.breakdown.playerFollowed.completed=!0,n+=t.breakdown.playerFollowed.percentage),e.interests.find(v=>v.type==="competition"&&v.favourite)&&(t.breakdown.competitionFavourite.completed=!0,n+=t.breakdown.competitionFavourite.percentage),e.interests.find(v=>v.type==="competition")&&(t.breakdown.competitionFollowed.completed=!0,n+=t.breakdown.competitionFollowed.percentage)),t.totalPercentage=n,t};getStats=async()=>{if(this.isBrowser){let e=this.getLocalStorageData("statistics");if(e&&Object.keys(e).length)return JSON.parse(JSON.stringify(e));try{let t=await this.activityHttps.getStats();return this.localStorage.setProfileStats(t),t}catch(t){throw console.warn("There was a problem retrieving own profile statistics: ",t),t}}else try{return await this.activityHttps.getStats()}catch(e){throw console.warn("There was a problem retrieving own profile statistics: ",e),e}};getBadges=async()=>{if(this.isBrowser){let e=this.getLocalStorageData("badges");if(e)return e;try{let t=await this.profileHttps.getBadges();return this.localStorage.setProfileBadges(t),t}catch(t){throw console.warn("There was a problem retrieving own profile badges: ",t),t}}else try{return await this.profileHttps.getBadges()}catch(e){throw console.warn("There was a problem retrieving own profile badges: ",e),e}};getLocalStorageData=e=>{let t=Math.floor(Date.now()/1e3),n=this.localStorage.getExpiration(e);switch(e){case"profile":if(n>t)return this.localStorage.getOwnProfile();case"statistics":if(n>t)return this.localStorage.getProfileStats();case"badges":if(n>t)return this.localStorage.getProfileBadges();default:return null}}};var Ra=class{id=null;name=null;assets=null};var Fa=class{extractUpdatedProps=(e,t)=>{let n=["name","nickname","gender"],o={};return Object.keys(e).forEach(p=>{if(n.includes(p)&&e[p]!==t[p])o[p]=t[p];else if(p==="birthDate")(t[p]===null||e[p]===null&&t[p]||e[p]!==t[p])&&(o.birth_date=t[p]);else if(p==="country")t[p]===null?o.country_id=t[p]:(e[p]===null&&t[p]||e[p].id!==t[p].id)&&(o.country_id=t[p].id);else if(p==="interests"){let d=e[p],y=t[p];y.length&&this.isNewInterest(d,y)?o[p]=this.updateInterests(d,y):(!y.length&&d.length||d.length!==y.length&&!this.isNewInterest(d,y))&&(o[p]=y)}}),o};updateInterests=(e,t)=>{if(e.length===t.length){let[n,o]=this.extractSameAndNewInterests(e,t);return[...o,...n]}else return t};isNewInterest=(e,t)=>{let n=!1,[o]=this.extractSameAndNewInterests(e,t);return o.length&&(n=!0),n};extractSameAndNewInterests=(e,t)=>{let n=t.filter(p=>e.some(d=>p.id===d.id&&p.type===d.type&&p.source===d.source&&p.favourite===d.favourite));return[t.filter(p=>!e.some(d=>p.id===d.id&&p.type===d.type&&p.source===d.source&&p.favourite===d.favourite)),n]}};var Sa=class{idsRemapper=null;profileHttps=null;profileService=null;localStorage=null;profileFacade=null;ownProfile=null;modified=!1;expireAt=0;promises=[];isFetching=!1;constructor(e,t,n,o,p,d){this.idsRemapper=e,this.localStorage=t,this.profileHttps=n,this.profileService=new Fa,this.profileFacade=new Mt(t,n,o)}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(t){throw this.isFetching=!1,t}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};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=JSON.parse(JSON.stringify(e));return await this.idsRemapper.remapInterests(t.interests)};showFullInterests=async()=>{let e=await this.getOwnProfile(),t=JSON.parse(JSON.stringify(e));return await this.idsRemapper.showFullInterests(t.interests)};getFollowers=async e=>await this.profileFacade.getFollowers(e);getFollowing=async e=>await this.profileFacade.getFollowing(e);follow=async e=>{let t=await this.profileFacade.follow(e),n=await this.profileFacade.updateOwnProfile();return this.setOwnProfile(n),t};unfollow=async e=>{let t=await this.profileFacade.unfollow(e),n=await this.profileFacade.updateOwnProfile();return this.setOwnProfile(n),t};getStats=async()=>{let e=await this.profileFacade.getStats();return await this.idsRemapper.remapSuccessRatesEntities(e)};getBadges=async()=>await this.profileFacade.getBadges();addInterestPromise=async e=>{this.modified=!0,await this.getOwnProfile();let t=null;e.source!=="custom"?t=await this.idsRemapper.remapInterestToNative(e):t=e;let n=this.ownProfile.interests.filter(o=>o.id!==t.id||o.type!==t.type||o.source!==t.source);return this.ownProfile.interests=[...n],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.idsRemapper.remapInterestToNative(e):t=e,this.ownProfile.interests=this.ownProfile.interests.filter(n=>n.id!==t.id||n.type!==t.type||n.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);setNicknamePromise=async e=>(this.modified=!0,await this.getOwnProfile(),this.ownProfile.nickname=e,this);setNickname=e=>(this.promises.push(this.setNicknamePromise(e)),this);setNamePromise=async e=>(this.modified=!0,await this.getOwnProfile(),this.ownProfile.name=e,this);setName=e=>(this.promises.push(this.setNamePromise(e)),this);setCountryPromise=async e=>(this.modified=!0,await this.getOwnProfile(),e&&!this.ownProfile.country?(this.ownProfile.country=new Ra,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(),n=this.profileService.extractUpdatedProps(e,t);if(this.modified=!1,this.expireAt=0,Object.keys(n).length){let p=await this.profileHttps.updateProfile(n),d=JSON.parse(JSON.stringify(p));return this.setOwnProfile(d),this.localStorage.setOwnProfile(d),delete p.interests,p}let o=JSON.parse(JSON.stringify(this.ownProfile));return delete o.interests,o}};var Ta=class{idsRemapper=null;profileHttps=null;activityHttps=null;profileFacade=null;profileId="";constructor(e,t,n,o){this.idsRemapper=e,this.profileHttps=n,this.activityHttps=o,this.profileFacade=new Mt(t,n,o)}setId=e=>(this.profileId=e,this);getProfile=async()=>await this.profileFacade.getById(this.profileId);getInfo=async()=>{let e=await this.getProfile();return delete e.interests,e};showInterests=async()=>{let e=await this.getProfile(),t=JSON.parse(JSON.stringify(e));return await this.idsRemapper.remapInterests(t.interests)};showFullInterests=async()=>{let e=await this.getProfile(),t=JSON.parse(JSON.stringify(e));return await this.idsRemapper.showFullInterests(t.interests)};getFollowers=async e=>await this.profileFacade.getFollowers(e,this.profileId);getFollowing=async e=>await this.profileFacade.getFollowing(e,this.profileId);showFullnessProfile=async()=>{let e=await this.getProfile();return this.profileFacade.showFullnessProfile(e)};getStats=async e=>{let t=await this.activityHttps.getStats(this.profileId,e);return await this.idsRemapper.remapSuccessRatesEntities(t)};getBadges=async()=>await this.profileHttps.getBadges(this.profileId)};var Ea=class{isBrowser=!1;localStorage={};https=null;idMapping=null;constructor(e,t,n){this.isBrowser=typeof window!="undefined",this.localStorage=e,this.idMapping=n,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 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 Yr=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(n=>{let o=!0;return t.forEach(p=>{p!=="sortOrder"&&p!=="sortField"&&(p==="countryId"?o&&=n.country.id===this[p]:p==="name"?o&&=n.name.toLocaleLowerCase().includes(this[p].toLocaleLowerCase()):p==="competitionIds"?o&&=this[p].some(d=>n.id===d):o&&=n[p].toLocaleLowerCase()===this[p].toLocaleLowerCase())}),o})};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((n,o)=>this.sortOrder&&this.sortOrder==="desc"?o.name.localeCompare(n.name):n.name.localeCompare(o.name)):this.sortField==="country"?t=e.sort((n,o)=>this.sortOrder&&this.sortOrder==="desc"?o.country.name.localeCompare(n.country.name):n.country.name.localeCompare(o.country.name)):this.sortField==="scope"?e.forEach(n=>t[this.competitionIds.indexOf(n.id)]=n):!this.sortField&&this.sortOrder==="desc"&&(t=e.sort((n,o)=>o.id.localeCompare(n.id))),t}};var Ca=class{isBrowser=!1;localStorage={};https=null;idMapping=null;constructor(e,t,n){this.isBrowser=typeof window!="undefined",this.localStorage=e,this.idMapping=n,this.https=t}getCompetitionsIdMapping=async(e,t)=>{try{let n=!1;if(e){if(e=new Yr(e),e.countryId){let p=await this.idMapping.getEntityIdsBySchemaId([`${e.countryId}`],"country","native");p.country.length===0&&(n=!0),e.countryId=p.country[0]}if(e.competitionIds){let p=await this.idMapping.getEntityIdsBySchemaId(e.competitionIds,"competition","native");p.competition.length===0&&(n=!0),e.competitionIds=p.competition}if(n)return[]}let o=await this.getCompetitions(e,t);return await this.idMapping.remapEntities(o,"competition")}catch(n){throw console.warn("There was a problem browsing all of the competitions",n),n}};getCompetitionsMapWithNativeIds=async e=>{let t=new Map,n=e.length,o=new Yr({competitionIds:e,limit:n}),p=await this.getCompetitions(o);p.sort((y,g)=>y.id.localeCompare(g.id));let d=await this.idMapping.remapEntities(p,"competition");return e.forEach((y,g)=>t.set(y,d[g])),t};getCompetitions=async(e,t)=>{let n=null;if(t=t||!1,this.isBrowser){if(!this.localStorage.getCompetitionsLength()){try{n=await this.https.getCompetitions()}catch(o){throw console.warn("There was a problem retrieving all competitions",o),o}this.localStorage.setCompetitions(n)}return this.localStorage.getCompetitions(e)}else return this.https.getCompetitions(e,t)};getCompetitionByIdIdMapping=async(e,t)=>{try{let o=(await this.idMapping.getEntityIdsBySchemaId([e],"competition","native")).competition[0],p=await this.getCompetitionById(o,t);return await this.idMapping.remapEntities(p,"competition")}catch(n){throw console.warn(`There was a problem browsing the following competition:${e}`,n),n}};getCompetitionById=async(e,t)=>{try{return t=t||!1,await this.https.getCompetitionById(e,t)}catch(n){throw console.warn(`There was a problem retrieving the competition with the following id: ${e}`,n),n}};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 Qr=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 Aa=class{general=[];predictor=[];topX=[];matchQuiz=[]};var Gi=class{points=null;gameParticipationCount=null;entityId=null;entityType=null;predictionsMade=null;correctPredictions=null};var xa=class{id;enabled;requirements=new Gi};var Oa=class{id;weight;multiplier;conditions};var Ba=class{value=[new Oa]};var Hi=class{points=null;tiers=null;badges=null};var La=class{enabled=!1;conditions={list:null};actions=new Ba;rewards=new Hi};var Na=class{general=null;comments=null;predictor=null;activity=null;topX=null;matchQuiz=null};var ki=class{enabled=!1;defaultMarkets=null;competitionsWhitelist=null};var $i=class{enabled=!1;minFixtures=null;maxFixtures=null;competitionsWhitelist=null};var Da=class{competitions=[];teams=[];markets=[]};var Vi=class{enabled=!1;fullCoverageCompetitions=null;markets=null;successRateScopes=new Da};var Ua=class{remapPredictorConfig=e=>{let t=new Vi;return t.enabled=e.enabled,t.fullCoverageCompetitions=e.full_coverage_competitions,t.markets=e.markets,t.successRateScopes=e.success_rate_scopes,t};remapTopXConfig=e=>{let t=new $i;return t.enabled=e.enabled,t.minFixtures=e.min_fixtures,t.maxFixtures=e.max_fixtures,t.competitionsWhitelist=e.competitions_whitelist,t};remapMatchQuizConfig=e=>{let t=new ki;return t.enabled=e.enabled,t.defaultMarkets=e.default_markets,t.competitionsWhitelist=e.competitions_whitelist,t};remapLoyaltyConfig=e=>{let t=new La;return t.enabled=e.enabled,t.conditions.list=e.conditions.list,t.actions.value=e.actions.value,t.rewards=this.remapRewards(e.rewards),t};remapRewards=e=>{let t=new Hi;return t.points=this.remapPoints(e.points),t.tiers=e.tiers,t.badges=this.remapBadges(e.badges),t};remapPoints=e=>{let t=new Na;return t.general=e.general,t.comments=e.comments,t.predictor=e.predictor,t.activity=e.activity,t.topX=e.top_x,t.matchQuiz=e.match_quiz,t};remapBadges=e=>{let t=new Aa;return t.general=e.general,t.predictor=this.remapBadgeValues(e.predictor),t.topX=this.remapBadgeValues(e.top_x),t.matchQuiz=this.remapBadgeValues(e.match_quiz),t};remapBadgeValues=e=>e.map(t=>{let n=new xa;return n.id=t.id,n.enabled=t.enabled,n.requirements=this.remapRequirements(t.requirements),n});remapRequirements=e=>{let t=new Gi;return t.points=e.points,t.gameParticipationCount=e.game_participation_count,t.entityId=e.entity_id,t.entityType=e.entity_type,t.predictionsMade=e.predictions_made,t.correctPredictions=e.correct_predictions,t}};var et=class extends Me{apiSignInUrl="";featureConfigRemapper=null;constructor(e){super(e,Oe(e.environment,"client"));this.apiSignInUrl=`/clients/${e.clientId}/features?key=${e.apiKey}`,this.featureConfigRemapper=new Ua}getConfig=async e=>{try{let t=await this.instance.get(`${this.apiSignInUrl}`);switch(e){case"predictor":return this.featureConfigRemapper.remapPredictorConfig(t.data.data.predictor);case"topX":return this.featureConfigRemapper.remapTopXConfig(t.data.data.top_x);case"matchQuiz":return this.featureConfigRemapper.remapMatchQuizConfig(t.data.data.match_quiz);case"loyalty":return this.featureConfigRemapper.remapLoyaltyConfig(t.data.data.loyalty)}}catch(t){throw console.warn("There was a problem fetching configuration from Client API",t),t.response}}};var Yt=class{clientHttps=null;constructor(e){this.clientHttps=new et(e)}setAvailableMarketsForMatch=async e=>{let{fullCoverageCompetitions:t,markets:n}=await this.clientHttps.getConfig("predictor");if(Array.isArray(e))return e.map(o=>this.setAvailableMarkets(o,t,n));if(typeof e=="object"&&Object.keys(e).length)return this.setAvailableMarkets(e,t,n)};setAvailableMarkets=(e,t,n)=>{let o=e.context.competition?.id;return o&&this.isMatchInCoverageCompetition(o,t)?(e.availableMarkets=n.all,e):(e.availableMarkets=n.main,e)};isMatchInCoverageCompetition=(e,t)=>{let n=!1;return t.includes(e)&&(n=!0),n}};var Ha=class{footballService=null;https=null;idMapping=null;constructor(e,t,n){this.idMapping=n,this.https=t,this.footballService=new Yt(e)}getTeamsIdMapping=async(e,t)=>{try{let n=!1;if(e){if(e=new Qr(e),e.countryId){let p=await this.idMapping.getEntityIdsBySchemaId([`${e.countryId}`],"country","native");p.country.length===0&&(n=!0),e.countryId=p.country[0]}if(e.scope){let p=await this.idMapping.getEntityIdsBySchemaId(e.scope,"competition","native");p.competition.length===0&&(n=!0),e.scope=p.competition}if(e.teamIds){let p=await this.idMapping.getEntityIdsBySchemaId(e.teamIds,"team","native");p.team.length===0&&(n=!0),e.teamIds=p.team}}if(n)return[];let o=await this.getTeams(e,t);return o.data=await this.idMapping.remapEntities(o.data,"team"),o}catch(n){throw console.warn("There was a problem browsing all teams",n),n}};getTeamsMapWithNativeIds=async e=>{let t=new Map,n=e.length,o=new Qr({teamIds:e,limit:n}),{data:p}=await this.getTeams(o);p.sort((y,g)=>y.id.localeCompare(g.id));let d=await this.idMapping.remapEntities(p,"team");return e.forEach((y,g)=>t.set(y,d[g])),t};getTeams=async(e,t)=>{try{return t=t||!1,await this.https.getTeams(e,t)}catch(n){throw console.warn("There was a problem retrieving all teams",n),n}};getTeamByIdIdMapping=async(e,t)=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"team","native")).team[0];let o=await this.getTeamById(e,t);return await this.idMapping.remapEntities(o,"team")}catch(n){throw console.warn(`There was a problem browsing the following team:${e}`,n),n}};getTeamById=async(e,t)=>{try{return t=t||!1,await this.https.getTeamById(e,t)}catch(n){throw console.warn(`There was a problem retrieving the following team: ${e}`,n),n}};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 o=await this.getNextMatchForTeam(e,t);return await this.idMapping.remapEntities(o,"match")}catch(n){throw console.warn(`There was a problem browsing the next match for the following team:${e}`,n),n}};getNextMatchForTeam=async(e,t)=>{try{t=t||!1;let n=await this.https.getNextMatchForTeam(e,t);return await this.footballService.setAvailableMarketsForMatch(n)}catch(n){throw console.warn(`There was a problem retrieving the next match for the following team: ${e}`,n),n}};getPrevMatchForTeamIdMapping=async(e,t)=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"team","native")).team[0];let o=await this.getPrevMatchForTeam(e,t);return await this.idMapping.remapEntities(o,"match")}catch(n){throw console.warn(`There was a problem browsing the previous match for the following team:${e}`,n),n}};getPrevMatchForTeam=async(e,t)=>{try{t=t||!1;let n=await this.https.getPrevMatchForTeam(e,t);return await this.footballService.setAvailableMarketsForMatch(n)}catch(n){throw console.warn(`There was a problem retrieving the previous match for the following team: ${e}`,n),n}}};var zr=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 Qt=class{https=null;footballService=null;idMapping=null;constructor(e,t,n){this.idMapping=n,this.https=t,this.footballService=new Yt(e)}getPlayersIdMapping=async(e,t)=>{try{let n=!1;if(e){if(e=new zr(e),e.countryId){let p=await this.idMapping.getEntityIdsBySchemaId([e.countryId],"country","native");p.country.length===0&&(n=!0),e.countryId=p.country[0]}if(e.playerIds){let p=await this.idMapping.getEntityIdsBySchemaId(e.playerIds,"player","native");p.player.length===0&&(n=!0),e.playerIds=p.player}if(e.scope){let p=await this.idMapping.getEntityIdsBySchemaId(e.scope,"competition","native");p.competition.length===0&&(n=!0),e.scope=p.competition}if(n)return[]}let o=await this.getPlayers(e,t);return o.data=await this.idMapping.remapEntities(o.data,"player"),o}catch(n){throw console.warn("There was a problem browsing the players",n),n}};getPlayersWithNativeIds=async e=>{let t=e.length,n=new zr({playerIds:e,limit:t}),o=await this.getPlayers(n);return o.data.sort((p,d)=>p.id.localeCompare(d.id)),await this.idMapping.remapEntities(o.data,"player")};getPlayersMapWithNativeIds=async e=>{let t={},n=Xt(e);n.sort((p,d)=>p.localeCompare(d));let o=await this.getPlayersWithNativeIds(n);return n.forEach((p,d)=>t[p]=o[d]),t};getPlayers=async(e,t)=>{try{return t=t||!1,await this.https.getPlayers(e,t)}catch(n){throw console.warn("There was a problem retrieving the players",n),n}};getPlayerIdMapping=async(e,t)=>{try{let n=await this.idMapping.getEntityIdsBySchemaId([e],"player","native"),o=await this.getPlayerById(n.player[0],t);return await this.idMapping.remapEntities(o,"player")}catch(n){throw console.warn(`There was a problem browsing the following player:${e}`,n),n}};getPlayerById=async(e,t)=>{try{return t=t||!1,await this.https.getPlayerById(e,t)}catch(n){throw console.warn(`There was a problem retrieving the following player: ${e}`,n),n}};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 o=await this.getNextMatchForPlayer(e,t);return await this.idMapping.remapEntities(o,"match")}catch(n){throw console.warn(`There was a problem browsing the next match for player:${e}`,n),n}};getNextMatchForPlayer=async(e,t)=>{try{t=t||!1;let n=await this.https.getNextMatchForPlayer(e,t);return await this.footballService.setAvailableMarketsForMatch(n)}catch(n){throw console.warn(`There was a problem retrieving the next match for player: ${e}`,n),n}};getPrevMatchForPlayerIdMapping=async(e,t)=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"player","native")).player[0];let o=await this.getPrevMatchForPlayer(e,t);return await this.idMapping.remapEntities(o,"match")}catch(n){throw console.warn(`There was a problem browsing the previous match for player:${e}`,n),n}};getPrevMatchForPlayer=async(e,t)=>{try{t=t||!1;let n=await this.https.getPrevMatchForPlayer(e,t);return await this.footballService.setAvailableMarketsForMatch(n)}catch(n){throw console.warn(`There was a problem retrieving the previous match for player: ${e}`,n),n}}};var Jr=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 zt=class{https=null;idMapping=null;footballService=null;constructor(e,t,n){this.https=t,this.idMapping=n,this.footballService=new Yt(e)}getMatchesIdMapping=async(e,t)=>{try{if(e){if(e=new Jr(e),e.countryIds){let o=await this.idMapping.getEntityIdsBySchemaId(e.countryIds,"country","native");e.countryIds=o.country}if(e.competitionIds){let o=await this.idMapping.getEntityIdsBySchemaId(e.competitionIds,"competition","native");e.competitionIds=o.competition}if(e.matchIds){let o=await this.idMapping.getEntityIdsBySchemaId(e.matchIds,"match","native");e.matchIds=o.match}if(e.teamIds){let o=await this.idMapping.getEntityIdsBySchemaId(e.teamIds,"team","native");e.teamIds=o.team}}let n=await this.getMatches(e,t);return n.data=await this.footballService.setAvailableMarketsForMatch([...n.data]),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 t=e.length,n=new Jr({matchIds:e,limit:t}),o=await this.getMatches(n);return o.data.sort((p,d)=>p.id.localeCompare(d.id)),await this.idMapping.remapEntities(o.data,"match")};getMatchesMapWithNativeIds=async e=>{let t={},n=Xt(e);n.sort((p,d)=>p.localeCompare(d));let o=await this.getMatchesWithNativeIds(n);return n.forEach((p,d)=>t[p]=o[d]),t};getMatches=async(e,t)=>{try{return t=t||!1,await this.https.getMatches(e,t)}catch(n){throw console.warn("There was a problem retrieving the matches",n),n}};getMatchIdMapping=async(e,t)=>{try{let n=await this.idMapping.getEntityIdsBySchemaId([e],"match","native"),o=await this.getMatchById(n.match[0],t),p=await this.footballService.setAvailableMarketsForMatch(o);return await this.idMapping.remapEntities(p,"match")}catch(n){throw console.warn(`There was a problem browsing the following match: ${e}`,n),n}};getMatchById=async(e,t)=>{try{return t=t||!1,await this.https.getMatchById(e,t)}catch(n){throw console.warn(`There was a problem retrieving the following match: ${e}`,n),n}}};var ka=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 $a=class{https=null;idMapping=null;constructor(e,t){this.https=e,this.idMapping=t}searchIdMapping=async(e,t)=>{try{if(e=new ka(e),e.scope){let o=await this.idMapping.getEntityIdsBySchemaId(e.scope,"competition","native");e.scope=o.competition}let n=await this.search(e,t);if(n.teams&&n.teams.length>0){let o=await this.idMapping.remapEntities(n.teams,"team");n.teams=o}if(n.players&&n.players.length>0){let o=await this.idMapping.remapEntities(n.players,"player");n.players=o}if(n.competitions&&n.competitions.length>0){let o=await this.idMapping.remapEntities(n.competitions,"competition");n.competitions=o}return n}catch(n){throw console.warn("There was a problem with browsing the search result",n),n}};search=async(e,t)=>{try{return await this.https.search(e,t)}catch(n){throw console.warn("There was a problem retrieving the search response",n),n}}};var qi=class{countriesFacade=null;competitionsFacade=null;teamsFacade=null;playerFacade=null;matchFacade=null;searchFacade=null;constructor(e,t,n,o){this.countriesFacade=new Ea(t,n,o),this.competitionsFacade=new Ca(t,n,o),this.teamsFacade=new Ha(e,n,o),this.playerFacade=new Qt(e,n,o),this.matchFacade=new zt(e,n,o),this.searchFacade=new $a(n,o)}getCountries=async e=>this.countriesFacade.getCountriesWithIdMapping(e);getCompetitions=async(e,t)=>this.competitionsFacade.getCompetitionsIdMapping(e,t);getCompetitionById=async(e,t)=>this.competitionsFacade.getCompetitionByIdIdMapping(e,t);getTopCompetitions=async e=>this.competitionsFacade.getTopCompetitionsIdMapping(e);getCompetitionsMapWithNativeIds=async e=>await this.competitionsFacade.getCompetitionsMapWithNativeIds(e);getTeams=async(e,t)=>this.teamsFacade.getTeamsIdMapping(e,t);getTeamById=async(e,t)=>this.teamsFacade.getTeamByIdIdMapping(e,t);getTopTeams=async e=>this.teamsFacade.getTopTeamsIdMapping(e);getNextMatchForTeam=async(e,t)=>this.teamsFacade.getNextMatchForTeamIdMapping(e,t);getPrevMatchForTeam=async(e,t)=>this.teamsFacade.getPrevMatchForTeamIdMapping(e,t);getTeamsMapWithNativeIds=async e=>await this.teamsFacade.getTeamsMapWithNativeIds(e);getPlayers=async(e,t)=>this.playerFacade.getPlayersIdMapping(e,t);getPlayerById=async(e,t)=>this.playerFacade.getPlayerIdMapping(e,t);getTopPlayers=async e=>this.playerFacade.getTopPlayersIdMapping(e);getNextMatchForPlayer=async(e,t)=>this.playerFacade.getNextMatchForPlayerIdMapping(e,t);getPrevMatchForPlayer=async(e,t)=>this.playerFacade.getPrevMatchForPlayerIdMapping(e,t);getPlayersMapWithNativeIds=async e=>this.playerFacade.getPlayersMapWithNativeIds(e);getMatches=async(e,t)=>this.matchFacade.getMatchesIdMapping(e,t);getMatchById=async(e,t)=>this.matchFacade.getMatchIdMapping(e,t);search=async(e,t)=>this.searchFacade.searchIdMapping(e,t)};var Va=class{id="";alias="";countryCode="";assets=null;name=""};var oe=class{countriesFromResponse=e=>{if(e)return e.map(t=>this.countryFromResponse(t))};countryFromResponse=e=>{try{if(e){let t=new Va;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 qa=class{id="";country=null;gender="";assets=null;type="";name=""};var Ne=class{countryRemapper=null;constructor(){this.countryRemapper=new oe}fromResponse(e){try{let t=new qa;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 Wa=class{id="";country=null;gender="";assets=null;type="";name="";participants=[]};var Ka=class{id="";country=null;gender="";assets=null;name="";code="";national=!1;fullName="";shortName=""};var be=class{countryRemapper=null;constructor(){this.countryRemapper=new oe}fromResponse(e){try{let t=new Ka;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 Xa=class{countryRemapper=null;teamBasicRemapper=null;constructor(){this.countryRemapper=new oe,this.teamBasicRemapper=new be}fromResponse(e){try{let t=new Wa;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(n=>this.teamBasicRemapper.fromResponse(n)),t}catch(t){throw console.warn("There was a problem remapping the competition response",t),t}}};var Ya=class{id="";country=null;gender="";assets=null;name="";competitions=[];code="";national=!1;fullName="";shortName="";squad=[]};var Qa=class{id="";startDate="";endDate="";shirtNumber;loan=!1;position="";country=null;name="";assets=null;birthDate=""};var za=class{countryRemapper=null;constructor(){this.countryRemapper=new oe}fromResponse(e){try{let t=new Qa;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 Ja=class{countryRemapper=null;competitionRemapper=null;playerRemapper=null;constructor(){this.countryRemapper=new oe,this.competitionRemapper=new Ne,this.playerRemapper=new za}fromResponse(e){try{let t=new Ya;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(n=>this.competitionRemapper.fromResponse(n)):[],t.squad=e.squad?e.squad.map(n=>this.playerRemapper.fromResponse(n)):[],t}catch(t){throw console.warn("There was a problem remapping team response",t),t}}};var Za=class{id="";kickoffAt="";finishedAt="";updatedAt="";availableMarkets=null;homeTeam=null;awayTeam=null;lineupsConfirmed=!1;startedAt="";minute="";scores=null;context={competition:null};status={type:null,subType:null}};var ja=class{ftScore=null;htScore=null;aetScore=null;aggScore=null;penScore=null};var Wi=class{fromResponse(e){try{let t=new ja;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 eo=class{teamRemapper=null;competitionRemapper=null;scoresRemapper=null;constructor(){this.teamRemapper=new be,this.competitionRemapper=new Ne,this.scoresRemapper=new Wi}fromResponse(e){try{let t=new Za;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 to=class{id="";kickoffAt="";finishedAt="";updatedAt="";availableMarkets=null;homeTeam=null;awayTeam=null;lineupsConfirmed=!1;startedAt="";minute="";scores=null;stats=null;context={competition:null};timeline=[];status={type:null,subType:null};lineups=null};var io=class{corners=null;cornersFirstHalf=null;cornersSecondHalf=null;cornersExtraTime=null;crosses=null;crossesFirstHalf=null;crossesSecondHalf=null;crossesExtraTime=null;offside=null;offsideFirstHalf=null;offsideSecondHalf=null;offsideExtraTime=null;shotsOn=null;shotsOnFirstHalf=null;shotsOnSecondHalf=null;shotsOnExtraTime=null;throwIn=null;throwInFirstHalf=null;throwInSecondHalf=null;throwInExtraTime=null;redCards=null;redCardsFirstHalf=null;redCardsSecondHalf=null;redCardsExtraTime=null;shotsOff=null;shotsOffFirstHalf=null;shotsOffSecondHalf=null;shotsOffExtraTime=null;goalKicks=null;goalKicksFirstHalf=null;goalKicksSecondHalf=null;goalKicksExtraTime=null;possession=null;possessionFirstHalf=null;possessionSecondHalf=null;possessionExtraTime=null;treatments=null;treatmentsFirstHalf=null;treatmentsSecondHalf=null;treatmentsExtraTime=null;yellowCards=null;yellowCardsFirstHalf=null;yellowCardsSecondHalf=null;yellowCardsExtraTime=null;shotsBlocked=null;shotsBlockedFirstHalf=null;shotsBlockedSecondHalf=null;shotsBlockedExtraTime=null;substitutions=null;substitutionsFirstHalf=null;substitutionsSecondHalf=null;substitutionsExtraTime=null;counterAttacks=null;counterAttacksFirstHalf=null;counterAttacksSecondHalf=null;counterAttacksExtraTime=null;foulsCommitted=null;foulsCommittedFirstHalf=null;foulsCommittedSecondHalf=null;foulsCommittedExtraTime=null};var ro=class{fromResponse(e){try{let t=new io;return t.corners=this.statEntityFromResponse(e.corners),t.cornersFirstHalf=this.statEntityFromResponse(e.corners_1h),t.cornersSecondHalf=this.statEntityFromResponse(e.corners_2h),t.cornersExtraTime=this.statEntityFromResponse(e.corners_et),t.crosses=this.statEntityFromResponse(e.crosses),t.crossesFirstHalf=this.statEntityFromResponse(e.crosses_1h),t.crossesSecondHalf=this.statEntityFromResponse(e.crosses_2h),t.crossesExtraTime=this.statEntityFromResponse(e.crosses_et),t.offside=this.statEntityFromResponse(e.offside),t.offsideFirstHalf=this.statEntityFromResponse(e.offside_1h),t.offsideSecondHalf=this.statEntityFromResponse(e.offside_2h),t.offsideExtraTime=this.statEntityFromResponse(e.offside_et),t.shotsOn=this.statEntityFromResponse(e.shots_on),t.shotsOnFirstHalf=this.statEntityFromResponse(e.shots_on_1h),t.shotsOnSecondHalf=this.statEntityFromResponse(e.shots_on_2h),t.shotsOnExtraTime=this.statEntityFromResponse(e.shots_on_et),t.throwIn=this.statEntityFromResponse(e.throw_in),t.throwInFirstHalf=this.statEntityFromResponse(e.throw_in_1h),t.throwInSecondHalf=this.statEntityFromResponse(e.throw_in_2h),t.throwInExtraTime=this.statEntityFromResponse(e.throw_in_et),t.redCards=this.statEntityFromResponse(e.red_cards),t.redCardsFirstHalf=this.statEntityFromResponse(e.red_cards_1h),t.redCardsSecondHalf=this.statEntityFromResponse(e.red_cards_2h),t.redCardsExtraTime=this.statEntityFromResponse(e.red_cards_et),t.shotsOff=this.statEntityFromResponse(e.shots_off),t.shotsOffFirstHalf=this.statEntityFromResponse(e.shots_off_1h),t.shotsOffSecondHalf=this.statEntityFromResponse(e.shots_off_2h),t.shotsOffExtraTime=this.statEntityFromResponse(e.shots_off_et),t.goalKicks=this.statEntityFromResponse(e.goal_kicks),t.goalKicksFirstHalf=this.statEntityFromResponse(e.goal_kicks_1h),t.goalKicksSecondHalf=this.statEntityFromResponse(e.goal_kicks_2h),t.goalKicksExtraTime=this.statEntityFromResponse(e.goal_kicks_et),t.possession=this.statEntityFromResponse(e.possession),t.possessionFirstHalf=this.statEntityFromResponse(e.possession_1h),t.possessionSecondHalf=this.statEntityFromResponse(e.possession_2h),t.possessionExtraTime=this.statEntityFromResponse(e.possession_et),t.treatments=this.statEntityFromResponse(e.treatments),t.treatmentsFirstHalf=this.statEntityFromResponse(e.treatments_1h),t.treatmentsSecondHalf=this.statEntityFromResponse(e.treatments_2h),t.treatmentsExtraTime=this.statEntityFromResponse(e.treatments_et),t.yellowCards=this.statEntityFromResponse(e.yellow_cards),t.yellowCardsFirstHalf=this.statEntityFromResponse(e.yellow_cards_1h),t.yellowCardsSecondHalf=this.statEntityFromResponse(e.yellow_cards_2h),t.yellowCardsExtraTime=this.statEntityFromResponse(e.yellow_cards_et),t.shotsBlocked=this.statEntityFromResponse(e.shots_blocked),t.shotsBlockedFirstHalf=this.statEntityFromResponse(e.shots_blocked_1h),t.shotsBlockedSecondHalf=this.statEntityFromResponse(e.shots_blocked_2h),t.shotsBlockedExtraTime=this.statEntityFromResponse(e.shots_blocked_et),t.substitutions=this.statEntityFromResponse(e.substitutions),t.substitutionsFirstHalf=this.statEntityFromResponse(e.substitutions_1h),t.substitutionsSecondHalf=this.statEntityFromResponse(e.substitutions_2h),t.substitutionsExtraTime=this.statEntityFromResponse(e.substitutions_et),t.counterAttacks=this.statEntityFromResponse(e.counter_attacks),t.counterAttacksFirstHalf=this.statEntityFromResponse(e.counter_attacks_1h),t.counterAttacksSecondHalf=this.statEntityFromResponse(e.counter_attacks_2h),t.counterAttacksExtraTime=this.statEntityFromResponse(e.counter_attacks_et),t.foulsCommitted=this.statEntityFromResponse(e.fouls_committed),t.foulsCommittedFirstHalf=this.statEntityFromResponse(e.fouls_committed_1h),t.foulsCommittedSecondHalf=this.statEntityFromResponse(e.fouls_committed_2h),t.foulsCommittedExtraTime=this.statEntityFromResponse(e.fouls_committed_et),t}catch(t){throw console.warn("There was a problem remapping the stats",t),t}}statEntityFromResponse=e=>({homeTeam:e?e.home_team:null,awayTeam:e?e.away_team:null})};var Ki=class{homeTeam={players:[]};awayTeam={players:[]}};var no=class{id="";name="";position="";shirtNumber;assets=null;type=""};var Xi=class{fromResponse(e){try{let t=new no;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 ao=class{playerRemapper=null;constructor(){this.playerRemapper=new Xi}fromResponse(e){try{let t=new Ki;return t.homeTeam.players=e.home_team&&e.home_team.players?e.home_team.players.map(n=>this.playerRemapper.fromResponse(n)):[],t.awayTeam.players=e.away_team&&e.away_team.players?e.away_team.players.map(n=>this.playerRemapper.fromResponse(n)):[],t}catch(t){throw console.warn("There was a problem remapping the lineups",t),t}}};var oo=class{minute="";type="";teamId="";player=null;relatedPlayer=null;updatedAt=""};var so=class{playerRemapper=null;constructor(){this.playerRemapper=new Xi}fromResponse(e){try{let t=new oo;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 lo=class{teamMapper=null;competitionsMapper=null;lineupsMapper=null;scoresMapper=null;statsMapper=null;timelineMapper=null;constructor(){this.teamMapper=new be,this.competitionsMapper=new Ne,this.lineupsMapper=new ao,this.scoresMapper=new Wi,this.statsMapper=new ro,this.timelineMapper=new so}fromResponse(e){try{let t=new to;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(n=>this.timelineMapper.fromResponse(n)):[],t.status={type:e.status.type,subType:e.status.sub_type},t.lineups=e.lineups?this.lineupsMapper.fromResponse(e.lineups):new Ki,t}catch(t){throw console.warn("There was a problem remapping the match response",t),t}}};var po=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null};var co=class{countryRemapper=null;constructor(){this.countryRemapper=new oe}fromResponse(e){try{let t=new po;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 uo=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;teams=[]};var Yi=class{countryRemapper=null;teamRemapper=null;constructor(){this.countryRemapper=new oe,this.teamRemapper=new be}fromResponse(e){try{let t=new uo;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(n=>this.teamRemapper.fromResponse(n)):[],t.position=e.position,t}catch(t){throw console.warn("There was a problem remapping players response",t),t}}};var mo=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;competitions=[];teams=[]};var fo=class{countryRemapper=null;teamRemapper=null;competitionRemapper=null;constructor(){this.countryRemapper=new oe,this.teamRemapper=new be,this.competitionRemapper=new Ne}fromResponse(e){try{let t=new mo;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(n=>this.teamRemapper.fromResponse(n)):[],t.position=e.position,t.competitions=e.competitions?e.competitions.map(n=>this.competitionRemapper.fromResponse(n)):[],t}catch(t){throw console.warn("There was a problem remapping player response",t),t}}};var ho=class{teams=null;players=null;competitions=null};var go=class{teamRemapper=null;playerRemapper=null;competitionremapper=null;constructor(){this.teamRemapper=new be,this.playerRemapper=new Yi,this.competitionremapper=new Ne}fromResponse(e){try{let t=new ho;return t.teams=e.teams?e.teams.map(n=>this.teamRemapper.fromResponse(n)):[],t.players=e.players?e.players.map(n=>this.playerRemapper.fromResponse(n)):[],t.competitions=e.competitions?e.competitions.map(n=>this.competitionremapper.fromResponse(n)):[],t}catch(t){throw console.warn("There was a problem remapping search response",t),t}}};var Qi=class{currentPage=null;itemsPerPage=null;totalItems=null;numberOfPages=null};var Jt=class{pagination=new Qi};var zi=class{meta=new Jt;data=[]};var yo=class{remapMetaProp=e=>{let t=new Jt;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 bt=class extends Me{apiSignInUrl="";clientId="";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){super(e,Oe(e.environment,"football"));this.clientId=e.clientId,this.apiSignInUrl=`?key=${e.apiKey}&lang=${e.lang}`,this.countryRemapper=new oe,this.competitionBasicRemapper=new Ne,this.competitionFullRemapper=new Xa,this.teamBasicRemapper=new be,this.teamFullRemapper=new Ja,this.matchBasicRemapper=new eo,this.matchFullRemapper=new lo,this.playerBasicRemapper=new Yi,this.playerFullRemapper=new fo,this.topPlayerRemapper=new co,this.searchRemapper=new go,this.footballMetaRemapper=new yo}getCountries=async e=>{try{let t=`/countries${this.apiSignInUrl}`,n=Date.now();e&&(t+=`&disable_cache=${n}`);let o=await this.instance.get(t);return this.countryRemapper.countriesFromResponse(o.data.data)}catch(t){throw console.warn("There was a problem with the football countries request",t),t}};getCompetitions=async(e,t)=>{try{let n={},o=Date.now();if(t=t||!1,e&&e.competitionIds&&e.competitionIds.length>this.limitIds-1){let p=[],d=ea(e.competitionIds);for(let g of d){e.competitionIds=g;let w=`/competitions${this.apiSignInUrl}${e.constructFilterUrl()}`;t&&(w+=`&disable_cache=${o}`),n=await this.instance.get(w),p.push(n.data.data.map(v=>this.competitionBasicRemapper.fromResponse(v)))}return Array.prototype.concat.apply([],p)}else{let p=`/competitions${this.apiSignInUrl}`;return e&&(p+=`${e.constructFilterUrl()}`),t&&(p+=`&disable_cache=${o}`),n=await this.instance.get(p),n.data.data.map(d=>this.competitionBasicRemapper.fromResponse(d))}}catch(n){throw console.warn("There was a problem with getCompetitions request",n),n.response}};getCompetitionById=async(e,t)=>{try{let n=`/competitions/${e}${this.apiSignInUrl}`,o=Date.now();t&&(n+=`&disable_cache=${o}`);let p=await this.instance.get(n);return this.competitionFullRemapper.fromResponse(p.data.data)}catch(n){throw console.warn("There was a problem with getCompetitionById request",n),n.response}};getTopCompetitions=async e=>{try{let t=`/competitions/top${this.apiSignInUrl}&client_id=${this.clientId}`,n=Date.now();return e&&(t+=`&disable_cache=${n}`),(await this.instance.get(t)).data.data.map(p=>this.competitionBasicRemapper.fromResponse(p))}catch(t){throw console.warn("There was a problem with getTopCompetitions request",t),t.response}};getTeams=async(e,t)=>{try{let n={},o=Date.now();if(e&&e.teamIds&&e.teamIds.length>this.limitIds){let p=[],d=ea(e.teamIds);for(let g of d){e.teamIds=g;let w=`/teams${this.apiSignInUrl}${e.constructFilterUrl()}`;t&&(w+=`disable_cache=${o}`),n=await this.instance.get(w),p.push(n.data.data.map(v=>this.teamBasicRemapper.fromResponse(v)))}return Array.prototype.concat.apply([],p)}else{let p=new zi,d=`/teams${this.apiSignInUrl}`;return e&&(d+=`${e.constructFilterUrl()}`),t&&(d+=`&disable_cache=${o}`),n=await this.instance.get(d),p.meta=this.footballMetaRemapper.remapMetaProp(n.data.meta),p.data=n.data.data.map(y=>this.teamBasicRemapper.fromResponse(y)),p}}catch(n){throw console.warn("There was a problem with getTeams request",n),n.response}};getTeamById=async(e,t)=>{try{let n=`/teams/${e}${this.apiSignInUrl}`,o=Date.now();t&&(n+=`disable_cache=${o}`);let p=await this.instance.get(n);return this.teamFullRemapper.fromResponse(p.data.data)}catch(n){throw console.warn("There was a problem with getTeamById request",n),n.response}};getTopTeams=async e=>{try{let t=`/teams/top${this.apiSignInUrl}&client_id=${this.clientId}`,n=Date.now();e&&(t+=`$disable_cache=${n}`);let o=await this.instance.get(t);return o.data.data?o.data.data.map(p=>this.teamBasicRemapper.fromResponse(p)):[]}catch(t){throw console.warn("There was a problem with getTopTeams request",t),t.response}};getNextMatchForTeam=async(e,t)=>{try{let n=`/teams/${e}/next-match${this.apiSignInUrl}`,o=Date.now();t&&(n+=`&disable_cache=${o}`);let p=await this.instance.get(n);return this.matchFullRemapper.fromResponse(p.data.data)}catch(n){throw console.warn("There was a problem with getNextMatchForTeam request",n),n.response}};getPrevMatchForTeam=async(e,t)=>{try{let n=`/teams/${e}/previous-match${this.apiSignInUrl}`,o=Date.now();t&&(n+=`disable_cache=${o}`);let p=await this.instance.get(n);return this.matchFullRemapper.fromResponse(p.data.data)}catch(n){throw console.warn("There was a problem with getPrevMatchForTeam request",n),n.response}};getPlayers=async(e,t)=>{try{let n={},o=Date.now();if(e&&e.playerIds&&e.playerIds.length>this.limitIds-1){let p=[],d=ea(e.playerIds);for(let g of d){e.playerIds=g;let w=`/players${this.apiSignInUrl}${e.constructFilterUrl()}`;t&&(w+=`&disable_cache=${o}`),n=await this.instance.get(w),p.push(n.data.data.map(v=>this.teamBasicRemapper.fromResponse(v)))}return Array.prototype.concat.apply([],p)}else{let p=new zi,d=`/players${this.apiSignInUrl}`;return e&&(d+=`${e.constructFilterUrl()}`),t&&(d+=`&disable_cache=${o}`),n=await this.instance.get(d),p.meta=this.footballMetaRemapper.remapMetaProp(n.data.meta),p.data=n.data.data.map(y=>this.playerBasicRemapper.fromResponse(y)),p}}catch(n){throw console.warn("There was a problem with getPlayers request",n),n.response}};getPlayerById=async(e,t)=>{try{let n=`/players/${e}${this.apiSignInUrl}`,o=Date.now();t&&(n+=`&disable_cache=${o}`);let p=await this.instance.get(n);return this.playerFullRemapper.fromResponse(p.data.data)}catch(n){throw console.warn("There was a problem with getPlayerById request",n),n.response}};getTopPlayers=async e=>{try{let t=`/players/top${this.apiSignInUrl}&client_id=${this.clientId}`,n=Date.now();return e&&(t+=`&disable_cache=${n}`),(await this.instance.get(t)).data.data.map(p=>this.topPlayerRemapper.fromResponse(p))}catch(t){throw console.warn("There was a problem with getTopPlayers request",t),t.response}};getNextMatchForPlayer=async(e,t)=>{try{let n=`/players/${e}/next-match${this.apiSignInUrl}`,o=Date.now();t&&(n+=`&disable_cache=${o}`);let p=await this.instance.get(n);return this.matchFullRemapper.fromResponse(p.data.data)}catch(n){throw console.warn("There was a problem with getNextMatchForPlayer request",n),n.response}};getPrevMatchForPlayer=async(e,t)=>{try{let n=`/players/${e}/previous-match${this.apiSignInUrl}`,o=Date.now();t&&(n+=`&disable_cache=${o}`);let p=await this.instance.get(n);return this.matchFullRemapper.fromResponse(p.data.data)}catch(n){throw console.warn("There was a problem with getPrevMatchForPlayer request",n),n.response}};getMatchById=async(e,t)=>{try{let n=`/matches/${e}${this.apiSignInUrl}`,o=Date.now();t&&(n+=`&disable_cache=${o}`);let p=await this.instance.get(n);return this.matchFullRemapper.fromResponse(p.data.data)}catch(n){throw console.warn("There was a problem with getMatchById request",n),n.response}};getMatches=async(e,t)=>{try{let n=new zi,o=`/matches${this.apiSignInUrl}`,p=Date.now();e&&(o+=`${e.constructFilterUrl()}`),t&&(o+=`&disable_cache=${p}`);let d=await this.instance.get(o);return n.meta=this.footballMetaRemapper.remapMetaProp(d.data.meta),n.data=d.data.data.map(y=>this.matchBasicRemapper.fromResponse(y)),n}catch(n){throw console.warn("There was a problem with getMatches request",n),n.response}};search=async(e,t)=>{try{let n=`/search${this.apiSignInUrl}${e.constructFilterUrl()}`,o=Date.now();t&&(n+=`&disable_cache=${o}`);let p=await this.instance.get(n);return this.searchRemapper.fromResponse(p.data.data)}catch(n){throw console.warn("There was a problem with search request",n),n.response}}};var Pe=(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.CORRECT_SCORE_ADVANCED="CORRECT_SCORE_ADVANCED",D.CORRECT_SCORE_HT="CORRECT_SCORE_HT",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))(Pe||{}),Td=["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"],Ed=["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"],wt=["PLAYER_RED_CARD","PLAYER_SCORE","PLAYER_SCORE_FIRST_GOAL","PLAYER_SCORE_HATTRICK","PLAYER_SCORE_TWICE","PLAYER_YELLOW_CARD"],Cd=["FT_1X2","HT_1X2","HT_FT","DOUBLE_CHANCE","CORNERS_MATCH","CORRECT_SCORE","CORRECT_SCORE_HT","CORRECT_SCORE_ADVANCED"],Zr="PLAYER_SCORE_FIRST_GOAL";var Mo=class{overallPercent;byFootballCompetition;byFootballTeam;byFootballMarket};var bo=class{profileId;tier;points;successRates=new Mo};var wo=class{successRatePercent;model=null};var vo=class{id=null;label=null};var _o=class{type=null;id=null;label=null};var Ji=class{content=new _o;tags=[];campaign=new vo};var Zi=class{id=null;profileId=null;action=null;context=new Ji;points=0};var Io=class{totalItems=0};var Po=class{meta=new Io;data=[new Zi]};var Ro=class{remapSingleResponse=e=>{let t=new Zi;return t.id=e.id,t.profileId=e.profile_id,t.action=e.action,t.context.content=e.context.content??t.context.content,t.context.tags=e.context.tags,t.context.campaign=e.context.campaign??t.context.campaign,t.points=e.points,t};remapActivitiesResponse=e=>{let t=new Po;return t.meta.totalItems=e.meta.total_items,t.data=e.data.map(n=>this.remapSingleResponse(n)),t};remapStatsReponse=e=>{let t=new bo;return t.profileId=e.profile_id,t.tier=e.tier,t.points=e.points,t.successRates.overallPercent=e.success_rates.overall_percent,t.successRates.byFootballCompetition=this.constructNewRecord(e.success_rates.by_competition),t.successRates.byFootballTeam=this.constructNewRecord(e.success_rates.by_team),t.successRates.byFootballMarket=this.constructNewRecord(e.success_rates.by_market),t};constructNewRecord=e=>{let t;if(Object.entries(e).length)Object.entries(e).forEach(([n,o])=>{t={...t,[n]:this.remapSuccessRatePercent(o)},Pe[n]&&delete t[n].model});else return e;return t};remapSuccessRatePercent=e=>{let t=new wo;return t.successRatePercent=e.success_rate_percent,t}};var ji=class extends Me{activityRemapper=null;apiSignInUrl=null;constructor(e){super(e,Oe(e.environment,"loyalty"));this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}`,this.activityRemapper=new Ro}createActivity=async e=>{try{let t=`/activities${this.apiSignInUrl}`,n=await this.instanceAuth.post(t,JSON.stringify(e));return this.activityRemapper.remapSingleResponse(n.data)}catch(t){throw console.warn("There was a problem with creating activity for user",t),t}};deleteActivity=async e=>{try{let t=`/activities/${e}${this.apiSignInUrl}`;return await this.instanceAuth.delete(t),!0}catch(t){throw console.warn(`There was a problem deleting the following activity: ${e}`,t),t.response}};getOwnActivities=async(e,t)=>{try{let n=`/activities${this.apiSignInUrl}`,o=Date.now();e&&(n+=`${e.constructFilterUrl()}`),t&&(n+=`disable_cache=${o}`);let p=await this.instanceAuth.get(n);return this.activityRemapper.remapActivitiesResponse(p.data)}catch(n){throw console.warn("There was a problem with fetching own activities",n),n}};getActivitiesForUser=async(e,t,n)=>{try{let o=`/users/${e}/activities${this.apiSignInUrl}`,p=Date.now();t&&(o+=`${t.constructFilterUrl()}`),n&&(o+=`disable_cache=${p}`);let d=await this.instance.get(o);return this.activityRemapper.remapActivitiesResponse(d.data)}catch(o){throw console.warn(`There was a problem with fetching activities for user ${e}`,o),o}};getStats=async(e,t)=>{try{let n="",o=null;return e?(n+=de(t)?`/users/${e}/statistics${this.apiSignInUrl}${fe()}`:`/users/${e}/statistics${this.apiSignInUrl}`,o=await this.instance.get(n)):(n+=`/statistics${this.apiSignInUrl}`,o=await this.instanceAuth.get(n)),this.activityRemapper.remapStatsReponse(o.data.data)}catch(n){throw console.warn("There was a problem fetching profile`s statistics:",n),n.response}}};var Fo=class{idMapping=null;idSchema=null;native="native";footballFacade=null;constructor(e,t,n){this.idMapping=n,this.idSchema=e.idSchema,this.footballFacade=t}remapSuccessRatesEntities=async e=>{let{successRates:t}=e,n={competition:this.getIdsKeys(t.byFootballCompetition),team:this.getIdsKeys(t.byFootballTeam)};if(Object.values(n.competition).length){let o=e.successRates.byFootballCompetition;e.successRates.byFootballCompetition=await this.setModels(o,n.competition,"competition")}if(Object.values(n.team).length){let o=e.successRates.byFootballTeam;e.successRates.byFootballTeam=await this.setModels(o,n.team,"team")}return e};setModels=async(e,t,n)=>{let o=null,p;switch(t=kr(t),n){case"competition":o=await this.footballFacade.getCompetitionsMapWithNativeIds(t);break;case"team":o=await this.footballFacade.getTeamsMapWithNativeIds(t);break}return Object.keys(e).forEach(d=>{let y=o.get(d);p={...p,[y.id]:e[d]},p[y.id].model=y}),p};getIdsKeys=e=>{let t=JSON.parse(JSON.stringify(e));return Object.keys(t)};remapInterestsToIdSchema=async e=>{if(this.idSchema!==this.native)if(e&&e.length>0){let t={},n={};e.forEach(d=>{t.hasOwnProperty(d.type)||(t[d.type]=[],n[d.type]=[]),t[d.type].push(d.id),n[d.type].push(d)});let o=await this.remapIdsObj(t,this.native,this.idSchema),p=[];for(let[d,y]of Object.entries(n))y.forEach((g,w)=>{g.id=o[d][w],p.push(g)});return p}else return e;return e};remapInterestToNative=async e=>{if(this.idSchema!==this.native){let t={},{id:n,type:o}=e;t[o]=[n];let p=await this.remapIdsObj(t,this.idSchema,this.native);return e.id=p[o][0],e}return e};inquiryCustomInterests=e=>{let t=[];return e&&e.length>0&&(t=e.filter(n=>n.source.toLocaleUpperCase()==="CUSTOM")),t};remapInterests=async e=>{let t=this.inquiryCustomInterests(e);if(t&&t.length>0){let n=e.filter(p=>p.source.toLocaleUpperCase()!=="CUSTOM"),o=await this.remapInterestsToIdSchema(n);return t.forEach(p=>o.push(p)),o}return await this.remapInterestsToIdSchema(e)};showFullInterests=async e=>{let t=[];if(e&&e.length>0){let n=this.inquiryCustomInterests(e);t.push(n);let o=e.filter(w=>w.source.toLocaleUpperCase()!=="CUSTOM"),{competitionsMap:p,teamsMap:d,playersMap:y}=await this.getInterestsEntitiesMap(o),g=o.map(w=>{let v=null;if(w.type==="competition")return v=p.get(w.id),v&&(w.id=v.id),w.model=v,w;if(w.type==="team")return v=d.get(w.id),v&&(w.id=v.id),w.model=v,w;if(w.type==="player")return y?(w.model=y[w.id],w.id=y[w.id].id):w.model=v,w});return t.push(g),t.flat()}return t};getInterestsEntitiesMap=async e=>{let t=[],n=[],o=[],p=new Map,d=new Map,y=null;if(e.forEach(g=>{g.type==="competition"?t.push(g.id):g.type==="team"?n.push(g.id):g.type==="player"&&o.push(g.id)}),t.length){let g=kr(t);p=await this.footballFacade.getCompetitionsMapWithNativeIds(g)}if(n.length){let g=kr(n);d=await this.footballFacade.getTeamsMapWithNativeIds(g)}if(o.length){let g=kr(o);y=await this.footballFacade.getPlayersMapWithNativeIds(g)}return{competitionsMap:p,teamsMap:d,playersMap:y}};remapIdsObj=async(e,t,n)=>await this.idMapping.idMappingFacade.getEntitiesByIds(e,t,n)};var So=class{idMapping=null;profileOperations=null;constructor(e,t){this.idMapping=new ae(e),this.profileOperations=new Fo(e,t,this.idMapping)}remapSuccessRatesEntities=async e=>await this.profileOperations.remapSuccessRatesEntities(e);remapInterestToNative=async e=>await this.profileOperations.remapInterestToNative(e);remapInterests=async e=>await this.profileOperations.remapInterests(e);showFullInterests=async e=>await this.profileOperations.showFullInterests(e)};var er=class{idsRemapper=null;profileHttps=null;activityHttps=null;footballHttps=null;footballFacade=null;idMapping=null;localStorage=null;profileFacade=null;ownProfileBuilder=null;profileBuilder=null;constructor(e){this.profileHttps=new Ui(e),this.activityHttps=new ji(e),this.footballHttps=new bt(e),this.idMapping=new ae(e),this.localStorage=new yt(e),this.footballFacade=new qi(e,this.localStorage,this.footballHttps,this.idMapping),this.profileFacade=new Mt(this.localStorage,this.profileHttps,this.activityHttps),this.idsRemapper=new So(e,this.footballFacade),this.ownProfileBuilder=new Sa(this.idsRemapper,this.localStorage,this.profileHttps,this.activityHttps,this.idMapping,this.footballFacade),this.profileBuilder=new Ta(this.idsRemapper,this.localStorage,this.profileHttps,this.activityHttps)}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 To=class{validate=e=>{let t=this.validateField(e.lang),n=this.generateMessage(t);return{validation:t,message:n}};validateField=e=>{let t=["bg","ro","en"],n=null;return e!=null&&e.length>0?t.includes(e)?n="valid":n="invalid":n="missing",n};generateMessage=e=>{let t=null,n="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,n=null),{text:t,type:n}}};var Eo=class{validate(e){let t=this.validateField(e.environment),n=this.generateMessage(t);return{validation:t,message:n}}validateField=e=>{let t=["dev","staging","prod"],n=null;return e!=null&&e.length>0?t.includes(e)?n="valid":n="invalid":n="missing",n};generateMessage=e=>{let t=null,n="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,n=null),{text:t,type:n}}};var Co=class{validate(e){let t=this.validateField(e.apiKey),n=this.generateMessage(t);return{validation:t,message:n}}validateField=e=>{let t=null;return e!=null&&e.length>0?t="valid":t="missing",t};generateMessage=e=>{let t=null,n="error";return e==="missing"&&(t="The field apiKey with valid value must be provided to use Fans United JS SDK"),e==="valid"&&(n=null),{text:t,type:n}}};var Ao=class{validate(e){let t=this.validateField(e.idSchema),n=this.generateMessage(t);return{validation:t,message:n}}validateField=e=>{let t=["native","sportal365","enetpulse","sportradar"],n=null;return e!=null&&e.length>0?t.includes(e)?n="valid":n="invalid":n="missing",n};generateMessage=e=>{let t=null,n="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,n=null),{text:t,type:n}}};var fi=class{getIdToken=null;logout=null};var ir=class{text=null;type=null};var xo=class{validation=null;message=new ir;getIdToken={validation:null,message:new ir};logout={validation:null,message:new ir}};var Oo=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 fi),n=new xo;if(e){let p=Object.keys(e).filter(d=>!t.includes(d));p.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:"} ${p.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,t)=>(Object.keys(new fi).forEach(o=>{e[o]?t[o].validation="valid":t[o].validation="missing"}),t);generateAuthProviderConfigMessages=e=>(Object.keys(e).filter(t=>t!=="validation"&&t!=="message").forEach(t=>{let n=e[t];n.validation==="missing"&&(n.message.text=`${"The following property is missing from the authProvider object:"} ${t}`,n.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 en=class{validation;message};var Bo=class{apiKey=null;environment=null;idSchema=null;clientId=null;lang=null;authProvider={getIdToken:new en,logout:new en};isValid=!1};var Lo=class{validate(e){let t=this.validateField(e.clientId),n=this.generateMessage(t);return{validation:t,message:n}}validateField=e=>{let t=null;return e!=null&&e.length>0?t="valid":t="missing",t};generateMessage=e=>{let t=null,n="error";return e==="missing"&&(t="The field clientId must be provided to use Fans United JS SDK"),e==="valid"&&(t=null,n=null),{text:t,type:n}}};var No=class{validate=e=>{let t=this.checkFieldsForValues(e);return t.isValid=this.containsErrorMessage(t),t};checkFieldsForValues=e=>{let t=new Bo,n={apiKey:new Co,environment:new Eo,idSchema:new Ao,clientId:new Lo,lang:new To,authProvider:new Oo};for(let[o,p]of Object.entries(t))o!=="isValid"&&(p=n[o].validate(e));return Object.keys(n).forEach(o=>{t[o]=n[o].validate(e)}),t};containsErrorMessage=e=>{let t=!0;for(let[n,o]of Object.entries(e))if(n!=="authProvider"){if(n!=="isValid"&&o.message.type==="error")return t=!1,t;if(n!=="isValid"&&o.message.type==="warning")return t=!0,t}else if(o.message.type==="error")return t=!1,t;return t}};var Do=class{https=null;idMapping=null;localStorage=null;footballFacade=null;constructor(e){this.https=new bt(e),this.idMapping=new ae(e),this.localStorage=new yt(e),this.footballFacade=new qi(e,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 Uo=class{value=null;playerId=null;playerModel=null};var rr=class{market=null;matchId=null;matchType=null;matchModel=null;prediction=new Uo;result=null};var Go=class{value=!1;playerId=null};var tt=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(e,t,n,o){this.matchId=e,this.market=t,this.prediction=new Go,this.prediction.value=n,this.prediction.playerId=o}};var nr=class{settledAt=null;resettledAt=null;status=null;outcome=null;points=0};var Ho=class{value=null};var Zt=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(e,t,n){this.matchId=e,this.market=t,this.prediction=new Ho,this.prediction.value=n}};var it=class{value=!1};var ar=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(e,t,n){this.matchId=e,this.market=t,this.prediction=new it,this.prediction.value=n}};var or=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(e,t,n){this.matchId=e,this.market=t,this.prediction=new it,this.prediction.value=n}};var ko=class{matchFacade=null;playerFacade=null;predictorService=null;constructor(e,t,n){this.matchFacade=e,this.playerFacade=t,this.predictorService=n}remapFixturesRequest=e=>{let t={};if(t.match_id=e.matchId,t.match_type="FOOTBALL",e instanceof tt)t.market=e.market,t.prediction=e.prediction.value,t.player_id=e.prediction.playerId;else if(e instanceof ar||e instanceof or)t.market=e.market,t.prediction=e.prediction.value;else if(e instanceof Zt){t.market=e.market;let n=e.prediction.value.split(":");t.goals_home=Number(n[0]),t.goals_away=Number(n[1])}else t.market=e.market,t.prediction=e.prediction.value;return t};remapFixturesResponse=async e=>{let t="OWN_GOAL",n=[],o=[],p=null,d=[];e.length>1&&e.sort((g,w)=>g.match_id.localeCompare(w.match_id));for(let g of e)n.push(g.match_id),g.player_id&&!o.includes(g.player_id)&&o.push(g.player_id);let y=await this.matchFacade.getMatchesMapWithNativeIds(n);o.sort((g,w)=>g.localeCompare(w)),o&&o.length>0&&!o.includes(t)&&(p=await this.playerFacade.getPlayersMapWithNativeIds(o));for(let g of e){let w=new rr;g.target?w.market=this.predictorService.convertMarketForResponseModel(g.market,g.target):w.market=g.market,w.matchId=y[g.match_id].id,w.matchType=g.match_type,w.matchModel=y?y[g.match_id]:null,delete w.matchModel.availableMarkets,g.goals_home!==void 0&&g.goals_away!==void 0?w.prediction.value=g.goals_home.toString()+":"+g.goals_away.toString():w.prediction.value=g.prediction,w.prediction.playerId=g.player_id?g.player_id:null,w.prediction.playerId&&w.prediction.playerId!==t&&(w.prediction.playerModel=p[g.player_id],w.prediction.playerId=p[g.player_id].id),w.result=this.remapResult(g.result),d.push(w)}return d};remapResult=e=>{let t=new nr;return t.settledAt=e.settled_at,t.resettledAt=e.resettled_at,t.status=e.status,t.outcome=e.outcome,t.points=e.points,t}};var jt=class{goldenGoal=null};var tn=class{id=null;gameInstanceId=null;gameType=null;wager=null;totalFixtures=null;settledFixtures=null;userId=null;fixtures=[];status=null;tiebreaker=new jt;points=null;createdAt=null;updatedAt=null};var j=class{no=0;yes=0};var sr=class{fullTimeOneXTwo={};halfTimeOneXTwo={};bothTeamsScore=new j;doubleChance={};halfTimeFullTime={};playerScore={};playerYellowCard={};playerRedCard={};redCardMatch=new j;penaltyMatch=new j;playerScoreFirstGoal={};cornersMatch={};correctScore={};correctScoreHalfTime={};correctScoreAdvanced={};playerScoreHattrick={};playerScoreTwice={};overZeroPointFiveGoals=new j;overOnePointFiveGoals=new j;overTwoPointFiveGoals=new j;overThreePointFiveGoals=new j;overFourPointFiveGoals=new j;overFivePointFiveGoals=new j;overSixPointFiveGoals=new j;overSixPointFiveCorners=new j;overSevenPointFiveCorners=new j;overEightPointFiveCorners=new j;overNinePointFiveCorners=new j;overTenPointFiveCorners=new j;overElevenPointFiveCorners=new j;overTwelvePointFiveCorners=new j;overThirteenPointFiveCorners=new j};var vt=class{timeTiebreaker=!1};var hi=class{id=null;title=null;description=null;type=null;status=null;outcome=null;predictionsCutoff=null;fixtures=[];tiebreaker=new vt;predictionId=null;participantsCount=0;related=null;excludedProfileIds=null;rules=null;flags=null;points=null;createdAt=null;updatedAt=null;predictionsMadeAt=null;scheduleOpenAt=null;images=null};var gi=class{userId=null;points=null;results=[];tiebreaker=null};var $o=(p=>(p.ACTIVE="ACTIVE",p.WON="WON",p.LOST="LOST",p.PARTIALLY_WON="PARTIALLY_WON",p.CANCELED="CANCELED",p))($o||{}),Ep=["WON","LOST","PARTIALLY_WON","CANCELED"];var Re=class{limit=null;startAfter=null;status=null;type=null;matchIds=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.matchIds=e.matchIds?e.matchIds:null}constructFiltersUrl=()=>{let e="",t=!1;return this.status&&(t=Object.values($o).some(n=>this.status.includes(n))),this.limit&&(e+="&",e+=`limit=${this.limit}`),this.startAfter&&(e+="&",e+=`start_after=${this.startAfter}`),this.status&&t&&(e+="&",e+=`status=${this.status.join(",")}`),this.type&&(e+="&",e+=`game_types=${this.type}`),this.matchIds&&(e+="&",e+=`match_ids=${this.matchIds.join(",")}`),e}};var lr=class{limit;startAfter;constructor(e){this.limit=e.limit?e.limit:null,this.startAfter=e.startAfter?e.startAfter:null}constructMainFiltersUrl(){let e="";return this.limit&&(e+="&",e+=`limit=${this.limit}`),this.startAfter&&(e+="&",e+=`start_after=${this.startAfter}`),e}};var rn=(d=>(d.OPEN="OPEN",d.LIVE="LIVE",d.PENDING="PENDING",d.CANCELED="CANCELED",d.CLOSED="CLOSED",d.SETTLED="SETTLED",d))(rn||{});var rt=class extends lr{status=null;type=null;gameIds=null;sortOrder=null;constructor(e){super(e);this.status=e.status?e.status:null,this.type=e.type?e.type:null,this.gameIds=e.gameIds?e.gameIds:null,this.sortOrder=e.sortOrder?e.sortOrder:null}constructFiltersUrl=()=>{let e=super.constructMainFiltersUrl();return this.status&&Object.values(rn).includes(this.status)&&(e+="&",e+=`status=${this.status}`),this.type&&(e+="&",e+=`type=${this.type}`),this.gameIds&&this.gameIds.length>0&&(e+="&",e+=`game_ids=${this.gameIds.join(",")}`),this.sortOrder&&(e+="&",e+=`sort_order=${this.sortOrder}`),e}};var pr=class{main=null;cover=null;mobile=null};var yi=class{id=null;title=null;description=null;type=null;status=null;scheduleOpenAt=null;predictionsCutoff=null;fixtures=[];tiebreaker=new vt;participantsCount=0;related=null;excludedProfileIds=null;rules=null;flags=null;images=new pr;createdAt=null;updatedAt=null};var Nt=class{id=null;title=null;description=null;type=null;status=null;outcome=null;predictionsCutoff=null;fixtures=[];tiebreaker=new vt;predictionId=null;participantsCount=0;related=null;excludedProfileIds=null;rules=null;flags=null;points=null;createdAt=null;updatedAt=null;predictionsMadeAt=null;images=null;scheduleOpenAt=null};var Cp={UNEXPECTED_STATUS_PROP:`Unexpected provided property 'status'. You can NOT use this property for this method. For more information visit our documentation:
22
22
  ${Fp.PREDICTOR_USER_RELATED_OPERATION}`,UNEXPECTED_TYPE_PROP:`Unexpected provided property 'type'. You can NOT use this property for this method. For more information visit our documentation:
23
- ${Fp.PREDICTOR_USER_RELATED_OPERATION}`},xd=(s,e)=>`The prediction '${s}' is invalid for market '${e}'. Please check again have you passed appropriate prediction model. For more information please visit our documentation: https://docs.fansunitedmedia.com/sdks/js/match.quiz#gamerelatedoperations`,Vo=s=>`The market '${s}' is not supported from Fans United. For more information please visit our documentation: https://docs.fansunitedmedia.com/docs/predictor-operations#make-football-prediction`,Ad=s=>`The market '${s}' is not valid for Top X game. The only available market is CORRECT_SCORE.`,Od=s=>`The field/s '${s.length>1?s.join(", "):s[0]}' is/are invalid. For more information please visit our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk`,Bd=(s,e)=>`The following field/s is/are missing from ${s}: '${e.length>1?e.join(", "):e[0]}'. For more information please visit our documentation: https://docs.fansunitedmedia.com/docs/predictor-operations#make-football-prediction`,Ld=(s,e)=>`The field ${s} has incorrect type. The correct type is ${e}`;var _t=class{footballHttps=null;idMapping=null;matchFacade=null;playerFacade=null;constructor(e,t){this.footballHttps=new bt(e),this.idMapping=t,this.matchFacade=new zt(e,this.footballHttps,t),this.playerFacade=new Qt(e,this.footballHttps,t)}remapMatchIdToNative=async e=>(await this.idMapping.getEntityIdsBySchemaId(e,"match","native")).match;remapPlayerIdToNative=async e=>(await this.idMapping.getEntityIdsBySchemaId(e,"player","native")).player[0];remapPlayerIdMapToNative=async e=>{let t={},n=Xt(e),p=(await this.idMapping.getEntityIdsBySchemaId(n,"player","native")).player;return n.forEach((d,y)=>t[d]=p[y]),t};remapPlayerIdToIdSchema=async e=>{let t=["playerScore","playerYellowCard","playerRedCard","playerScoreFirstGoal","playerScoreHattrick","playerScoreTwice"];for(let[n,o]of Object.entries(e))if(t.includes(n))for(let p of Object.keys(o)){let d={player:[p]},g=(await this.idMapping.idMappingFacade.getEntitiesByIds(d,"native",this.idMapping.idSchema)).player[0];o[g]=o[p],delete o[p]}return e};convertMarket=e=>{let t=Object.keys(new sr),n=Object.values(Pe);for(let o=0;o<n.length;o++)e===n[o]&&(e=t[o]);return e};convertMarketForResponseModel=(e,t)=>{let n=t.toString();return e+"_"+n};getMarketSummary=(e,t,n)=>{let o=this.convertMarket(t),p={};if(p.matchId=e.matchId,p.matchType=e.matchType,Object.keys(e.predictions).includes(o))p[o]=e.predictions[o];else throw new Error("You have passed invalid market");return wt.includes(t)&&n?(p[o][n]||(p[o][n]=new j),p[o][n]):p};remapCompetitionsFromConfig=async e=>{if(e instanceof Vi){let t={competition:e.fullCoverageCompetitions},n={competition:e.successRateScopes.competitions},o={team:e.successRateScopes.teams},p=await this.idMapping.idMappingFacade.getEntitiesByIds(t,"native",this.idMapping.idSchema),d=await this.idMapping.idMappingFacade.getEntitiesByIds(n,"native",this.idMapping.idSchema),y=await this.idMapping.idMappingFacade.getEntitiesByIds(o,"native",this.idMapping.idSchema);return e.fullCoverageCompetitions=p.competition,e.successRateScopes.competitions=d.competition,e.successRateScopes.teams=y.team,e}if(e instanceof $i||e instanceof ki){let t={competition:e.competitionsWhitelist},n=await this.idMapping.idMappingFacade.getEntitiesByIds(t,"native",this.idMapping.idSchema);return e.competitionsWhitelist=n.competition,e}};remapMatchIdsFixtures=async e=>{if(Array.isArray(e.data))if(e.data.length>0){let t=[],n=[];return e.data.forEach(o=>{o instanceof yi||o instanceof hi||o instanceof Nt?(o.fixtures.forEach(p=>t.push(p.matchId)),o instanceof Nt&&o.fixtures.forEach(p=>{p.prediction.playerId&&n.push(p.prediction.playerId)})):o instanceof gi&&o.results.forEach(p=>t.push(p.matchId))}),await this.refactorResponseArrModel(e,t,n)}else return e;else return await this.refactorResponseObjModel(e)};refactorResponseArrModel=async(e,t,n)=>{let o=[],p=await this.matchFacade.getMatchesMapWithNativeIds(t),d={};return n.length>0&&(d=await this.playerFacade.getPlayersMapWithNativeIds(n)),e.data.forEach(y=>{y instanceof yi||y instanceof hi||y instanceof Nt?(y.fixtures.forEach(g=>{g.matchModel=p[g.matchId],delete g.matchModel.availableMarkets,g.matchId=g.matchModel.id,y instanceof Nt&&g.prediction.playerId&&(g.prediction.playerModel=d[g.prediction.playerId],g.prediction.playerId=d[g.prediction.playerId].id)}),o.push(y)):y instanceof gi&&(y.results.forEach(g=>{g.matchModel=p[g.matchId],delete g.matchModel.availableMarkets,g.matchId=g.matchModel.id}),o.push(y))}),e.data=o,e};refactorResponseObjModel=async e=>{let t=[];e.fixtures.forEach(o=>t.push(o.matchId));let n=await this.matchFacade.getMatchesMapWithNativeIds(t);return e.fixtures.forEach(o=>{o.matchModel=n[o.matchId],delete o.matchModel.availableMarkets,o.matchId=n[o.matchId].id}),e};getCurrentGameId=e=>{let t=new Date;if(e.data.length>1){let n=[];return e.data.forEach(p=>n.push(p.predictionsCutoff)),e.data.sort((p,d)=>{let[y,g]=[p.predictionsCutoff,d.predictionsCutoff].map(v=>Math.abs(new Date(v)-t));return y-g})[0].id}else return e.data[0].id};initGameTypePredictions=(e,t)=>{let n={type:e,limit:null,startAfter:null};return t&&(n={...n,limit:t.limit,startAfter:t.startAfter}),n=new Re(n),n};initGameFilters=(e,t,n)=>{if(t&&n)return t.type=e,t.gameIds=n,t=new rt(t),t;if(t&&!n)return t.type=e,t=new rt(t),t;if(!t&&n){let o={type:e,gameIds:n};return o=new rt(o),o}else{let o={type:e};return o=new rt(o),o}};addPredictionProp=async(e,t)=>(t.data.forEach(n=>{e.data.forEach(o=>{n.id===o.game_instance_id&&(n.predictionId=o.id,n.outcome=o.status,n.fixtures.forEach((p,d)=>{o.fixtures[d].goals_home!==void 0&&o.fixtures[d].goals_away!==void 0?p.prediction.value=o.fixtures[d].goals_home+":"+o.fixtures[d].goals_away:p.prediction.value=o.fixtures[d].prediction,o.fixtures[d].player_id?p.prediction.playerId=o.fixtures[d].player_id:o.fixtures[d].target&&(p.prediction.target=o.fixtures[d].target),p.prediction.result=this.remapResult(o.fixtures[d].result)}),n.predictionsMadeAt=o.created_at,n.points=o.points)})}),t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,await this.remapMatchIdsFixtures(t));remapResult=e=>{let t=new nr;return t.settledAt=e.settled_at,t.resettledAt=e.resettled_at,t.status=e.status,t.outcome=e.outcome,t.points=e.points,t};areIdsExceeded=e=>{let t=10;return e.length>t};initPredictionsFilters=(e,t,n)=>{switch(t){case"user":e&&(e=new Re(e));break;case"current":if(e)this.deleteUnexpectedProperties(e),e.status=["ACTIVE"],e=new Re(e);else{let o={status:["ACTIVE"]};e=new Re(o)}break;case"past":if(e)this.deleteUnexpectedProperties(e),e.status=Ep,e=new Re(e);else{let o={status:Ep};e=new Re(o)}break;case"matches":if(e)this.deleteUnexpectedProperties(e),e.matchIds=n,e=new Re(e);else{let o={matchIds:n};e=new Re(o)}break}return e};completeGameMarketResults=async(e,t)=>{switch(t){case"MATCH_QUIZ":let n={},o=e.results[0].matchId,p=e.results.map(v=>wt.includes(v.market)&&!v.result.includes("OWN_GOAL")?[...v.result]:[]).flat(),d=await this.matchFacade.getMatchesMapWithNativeIds([o]);return p.length&&(n=await this.playerFacade.getPlayersMapWithNativeIds(p)),e.results=e.results.map(v=>{if(v.matchModel=d[v.matchId],v.playerModels&&Object.keys(n).length&&v.result.forEach(S=>{let q=n[S];v.playerModels.push(q)}),this.idMapping.idSchema!=="native"&&(v.matchId=d[v.matchId].id,v.playerModels&&Object.keys(n).length)){let w=v.result;v.result=w.map(S=>n[S].id)}return v}),e;case"TOP_X":let y=e.results.map(v=>v.matchId),g=await this.matchFacade.getMatchesMapWithNativeIds(y);if(e.results=e.results.map(v=>(v.matchModel=g[v.matchId],this.idMapping.idSchema!=="native"&&(v.matchId=g[v.matchId].id),v)),e.tieBreakers.goldenGoals.length){let v=e.tieBreakers.goldenGoals.map(S=>S.playerId),w=await this.playerFacade.getPlayersMapWithNativeIds(v);e.tieBreakers.goldenGoals=e.tieBreakers.goldenGoals.map(S=>(S.matchModel=g[S.matchId],S.playerModel=w[S.playerId],this.idMapping.idSchema!=="native"&&(S.matchId=g[S.matchId].id,S.playerId=w[S.playerId].id),S))}return e}};deleteUnexpectedProperties=e=>(e.status&&(console.warn(Cp.UNEXPECTED_STATUS_PROP),delete e.status),e.type&&(console.warn(Cp.UNEXPECTED_TYPE_PROP),delete e.type),e)};var cr=class{gameInstanceId=null;fixtures=[];tiebreaker=null;constructor(e){this.gameInstanceId=e.gameInstanceId,e.fixtures.forEach(t=>this.fixtures.push(new Zt(t.matchId,t.market,t.prediction.value))),this.tiebreaker=e.tiebreaker?e.tiebreaker:null}};var ur=class{fixturesRemapper=null;footballHttps=null;matchFacade=null;playerFacade=null;predictorService=null;constructor(e,t){this.footballHttps=new bt(e),this.matchFacade=new zt(e,this.footballHttps,t),this.playerFacade=new Qt(e,this.footballHttps,t),this.predictorService=new _t(e,t),this.fixturesRemapper=new ko(this.matchFacade,this.playerFacade,this.predictorService)}remapRequestBody=e=>{let t={};return t.game_instance_id=e.gameInstanceId,t.fixtures=e.fixtures.map(n=>this.fixturesRemapper.remapFixturesRequest(n)),e instanceof cr&&e.tiebreaker&&(t.tiebreaker={},t.tiebreaker.golden_goal=e.tiebreaker.goldenGoal?e.tiebreaker.goldenGoal:null),t};remapResponseArrayBody=async e=>{if(e.length){let t=[],n=[],o={},p=[];e.forEach(y=>{y.fixtures.forEach(g=>{t.push(g.match_id),g.player_id&&n.push(g.player_id)})});let d=await this.matchFacade.getMatchesMapWithNativeIds(t);return n.length>0&&(o=await this.playerFacade.getPlayersMapWithNativeIds(n)),e.forEach(y=>{let g=new tn,v=[];g.id=y.id,g.gameInstanceId=y.game_instance_id,g.gameType=y.game_type,g.wager=y.wager,g.totalFixtures=y.total_fixtures,g.settledFixtures=y.settled_fixtures,g.userId=y.user_id,y.fixtures.forEach(w=>{let S=new rr;w.target?S.market=this.predictorService.convertMarketForResponseModel(w.market,w.target):S.market=w.market,S.matchId=d[w.match_id].id,S.matchType=w.match_type,S.matchModel=d[w.match_id],delete S.matchModel.availableMarkets,w.goals_home!==void 0&&w.goals_away!==void 0?S.prediction.value=w.goals_home.toString()+":"+w.goals_away.toString():S.prediction.value=w.prediction,S.prediction.playerId=w.player_id?w.player_id:null,S.prediction.playerId&&(S.prediction.playerModel=o[S.prediction.playerId],S.prediction.playerId=o[S.prediction.playerId].id),S.result=this.fixturesRemapper.remapResult(w.result),v.push(S)}),g.fixtures=v,g.status=y.status,y.tiebreaker?g.tiebreaker.goldenGoal=y.tiebreaker.golden_goal:g.tiebreaker=null,g.points=y.points,g.createdAt=y.created_at,g.updatedAt=y.updated_at,p.push(g)}),p}return e};remapResponseObjBody=async e=>{let t=new tn;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 sr;return t.fullTimeOneXTwo=e.FT_1X2,t.halfTimeOneXTwo=e.HT_1X2,t.bothTeamsScore=e.BOTH_TEAMS_SCORE,t.overZeroPointFiveGoals=e.OVER_GOALS_0_5,t.overOnePointFiveGoals=e.OVER_GOALS_1_5,t.overTwoPointFiveGoals=e.OVER_GOALS_2_5,t.overThreePointFiveGoals=e.OVER_GOALS_3_5,t.overFourPointFiveGoals=e.OVER_GOALS_4_5,t.overFivePointFiveGoals=e.OVER_GOALS_5_5,t.overSixPointFiveGoals=e.OVER_GOALS_6_5,t.overSixPointFiveCorners=e.OVER_CORNERS_6_5,t.overSevenPointFiveCorners=e.OVER_CORNERS_7_5,t.overEightPointFiveCorners=e.OVER_CORNERS_8_5,t.overNinePointFiveCorners=e.OVER_CORNERS_9_5,t.overTenPointFiveCorners=e.OVER_CORNERS_10_5,t.overElevenPointFiveCorners=e.OVER_CORNERS_11_5,t.overTwelvePointFiveCorners=e.OVER_CORNERS_12_5,t.overThirteenPointFiveCorners=e.OVER_CORNERS_13_5,t.doubleChance=e.DOUBLE_CHANCE,t.halfTimeFullTime=e.HT_FT,t.playerScore=e.PLAYER_SCORE,t.playerYellowCard=e.PLAYER_YELLOW_CARD,t.playerRedCard=e.PLAYER_RED_CARD,t.redCardMatch=e.RED_CARD_MATCH,t.penaltyMatch=e.PENALTY_MATCH,t.playerScoreFirstGoal=e.PLAYER_SCORE_FIRST_GOAL,t.cornersMatch=e.CORNERS_MATCH,t.correctScore=e.CORRECT_SCORE,t.correctScoreHalfTime=e.CORRECT_SCORE_HT,t.correctScoreAdvanced=e.CORRECT_SCORE_ADVANCED,t.playerScoreHattrick=e.PLAYER_SCORE_HATTRICK,t.playerScoreTwice=e.PLAYER_SCORE_TWICE,t}};var qo=class{matchId=null;matchType=null;predictions=null};var Wo=class{remapPredictions=null;constructor(e,t){this.remapPredictions=new ur(e,t)}remapResponse=e=>{let t=new qo;return t.matchId=e.match_id,t.matchType=e.match_type,t.predictions=this.remapPredictions.remapPredictionModel(e.predictions),t}};var Ko=class{matchId=null;matchType=null;market=null;matchModel=null};var Xo=class{value=null;target=null;playerId=null;playerModel=null;result=null};var Yo=class{matchId=null;matchType=null;market=null;matchModel=null;prediction=new Xo};var Qo=class{value=null;result=null};var zo=class{matchId=null;matchType=null;market=null;matchModel=null;prediction=new Qo};var Jo=class{matchId=null;matchModel=null;outcome=null};var Zo=class{gameId=null;results=null;tieBreakers=null};var jo=class{entityId=null;entityType=null};var es=class{remapPaginatedGames=e=>{let t=new re;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(n=>this.remapGamesListResponse(n)),t};remapGamesListResponse=e=>{let t=new yi;return t.id=e.id,t.title=e.title,t.description=e.description,t.type=e.type,t.status=e.status,t.scheduleOpenAt=e.schedule_open_at,t.predictionsCutoff=e.predictions_cutoff,t.fixtures=e.fixtures.map(n=>this.remapFixturesResponse(n)),t.tiebreaker=e.tiebreaker?this.remapTimeTiebreaker(e.tiebreaker.time_tiebreaker):null,t.participantsCount=e.participants_count,t.related=e.related?this.remapRelated(e.related):null,t.excludedProfileIds=e.excluded_profile_ids,t.rules=e.rules,t.flags=e.flags,t.images=e.images,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapFixturesResponse=e=>{let t=new Ko;return t.matchId=e.match_id,t.matchType=e.match_type,t.market=e.market,t};remapPaginatedUserTopXEditions=e=>{let t=new re;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(n=>this.remapUserTopXEditionsResponse(n)),t};remapUserTopXEditionsResponse=e=>{let t=new hi;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.scheduleOpenAt=e.schedule_open_at,t.fixtures=e.fixtures.map(n=>this.remapTopXFixturesResponse(n)),t.tiebreaker=e.tiebreaker?this.remapTimeTiebreaker(e.tiebreaker.time_tiebreaker):null,t.participantsCount=e.participants_count,t.related=e.related?this.remapRelated(e.related):null,t.excludedProfileIds=e.excluded_profile_ids,t.rules=e.rules,t.flags=e.flags,t.images=e.images,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapTopXFixturesResponse=e=>{let t=new zo;return t.matchId=e.match_id,t.matchType=e.match_type,t.market=e.market,t};remapPaginatedUserMathQuizEditions=e=>{let t=new re;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(n=>this.remapUserMatchQuizEditionsResponse(n)),t};remapUserMatchQuizEditionsResponse=e=>{let t=new Nt;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.scheduleOpenAt=e.schedule_open_at,t.fixtures=e.fixtures.map(n=>this.remapMatchQuizFixturesResponse(n)),t.tiebreaker=e.tiebreaker?this.remapTimeTiebreaker(e.tiebreaker.time_tiebreaker):null,t.participantsCount=e.participants_count,t.related=e.related?this.remapRelated(e.related):null,t.excludedProfileIds=e.excluded_profile_ids,t.rules=e.rules,t.flags=e.flags,t.images=e.images,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapMatchQuizFixturesResponse=e=>{let t=new Yo;return t.matchId=e.match_id,t.matchType=e.match_type,t.market=e.market,t};remapPaginatedGameResults=e=>{let t=new re;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(n=>this.remapGameResults(n)),t};remapGameResults=e=>{let t=new gi;return t.userId=e.user_id,t.points=e.points?e.points:0,t.results=e.results.map(n=>this.remapResults(n)),t.tiebreaker=e.tiebreaker?this.remapTiebreaker(e.tiebreaker):null,t};remapGameMarketsResults=e=>{let t=new Zo;return t.gameId=e.game_id,t.results=this.remapMarketsResults(e.results),t.tieBreakers=e.tie_breakers?this.remapTieBreakers(e.tie_breakers):null,t};remapTieBreakers=e=>{let t={goldenGoals:[]};return t.goldenGoals=e.golden_goals.map(n=>({minute:n.minute,matchId:n.match_id,matchModel:null,playerId:n.player_id,playerModel:null,goalType:n.goal_type})),t};remapMarketsResults=e=>{let t=[];return e.forEach(n=>{let o={matchId:n.match_id,market:n.market,result:this.remapMarketResult(n.market,n.result),matchModel:null,playerModels:[]};t.push(this.deleteUnusefulField(o))}),t};remapMarketResult=(e,t)=>{if(Cd.includes(e))return t[0];if(wt.includes(e))return t;if(t[0]==="true")return!0;if(t[0]==="false")return!1};deleteUnusefulField=e=>((!wt.includes(e.market)||this.isPlayerMarketWithNoResult(e.market,e.result))&&delete e.playerModels,e);isPlayerMarketWithNoResult=(e,t)=>wt.includes(e)&&t.length===0;remapResults=e=>{let t=new Jo;return t.matchId=e.match_id,t.outcome=e.outcome,t};remapTiebreaker=e=>{let t=new jt;return t.goldenGoal=e.golden_goal,t};remapTimeTiebreaker=e=>{let t=new vt;return t.timeTiebreaker=e,t};remapRelated=e=>e.map(t=>{let n=new jo;return n.entityId=t.entity_id,n.entityType=t.entity_type,n})};var ts=class{remapMetaData=e=>{let t=new Bi;return t.pagination.nextPageStartsAfter=e.pagination.next_page_starts_after,t.pagination.itemsPerPage=e.pagination.items_per_page,t}};var ei=class extends Me{apiSignInUrl=null;predictionRemapper=null;matchSummaryRemapper=null;gamesRemapper=null;metaRemapper=null;constructor(e,t){super(e,Oe(e.environment,"predictor"));this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}`,this.predictionRemapper=new ur(e,t),this.matchSummaryRemapper=new Wo(e,t),this.gamesRemapper=new es,this.metaRemapper=new ts}makeFootballPrediction=async e=>{try{let t=this.predictionRemapper.remapRequestBody(e),n=await this.instanceAuth.post(`/predictions${this.apiSignInUrl}`,JSON.stringify(t));return await this.predictionRemapper.remapResponseObjBody(n.data)}catch(t){throw console.warn("There was a problem making POST request: ",t),t.response}};getMatchSummary=async(e,t)=>{let n=de(t)?`/predictions/summary/${e}${this.apiSignInUrl}${fe()}`:`/predictions/summary/${e}${this.apiSignInUrl}`;try{let o=await this.instance.get(n);return this.matchSummaryRemapper.remapResponse(o.data)}catch(o){throw console.warn(`There was a problem fetching predictions for match: ${e} `,o),o.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 re,n=`/predictions${this.apiSignInUrl}`;e&&(n+=`${e.constructFiltersUrl()}`);let o=await this.instanceAuth.get(n);return t.meta=this.metaRemapper.remapMetaData(o.data.meta),t.data=await this.predictionRemapper.remapResponseArrayBody(o.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}catch(t){throw console.warn("There was a problem fetching own predictions",t),t.response}};getUserPredictions=async(e,t,n)=>{try{let o=new re,p=de(t)?`/predictions/users/${e}${this.apiSignInUrl}${fe()}`:`/predictions/users/${e}${this.apiSignInUrl}`;n&&(p+=`${n.constructFiltersUrl()}`);let d=await this.instance.get(p);return o.meta=this.metaRemapper.remapMetaData(d.data.meta),o.data=await this.predictionRemapper.remapResponseArrayBody(d.data.data),o}catch(o){throw console.warn(`There was a problem fetching predictions for user: ${e}`,o),o.response}};getUserPredictionsNoRemap=async(e,t)=>{try{return(await this.instance.get(`/predictions/users/${e}${this.apiSignInUrl}${t.constructFiltersUrl()}`)).data}catch(n){throw console.warn(`There was a problem fetching predictions for user: ${e}`,n),n.response}};getGames=async(e,t)=>{try{let n=de(t)?`/games/${this.apiSignInUrl}${e.constructFiltersUrl()}${fe()}`:`/games/${this.apiSignInUrl}${e.constructFiltersUrl()}`,o=await this.instance.get(n);return this.gamesRemapper.remapPaginatedGames(o.data)}catch(n){throw console.warn("There was a problem fetching the games list",n),n.response}};getGameById=async(e,t)=>{try{let n=de(t)?`/games/${e}${this.apiSignInUrl}${fe()}`:`/games/${e}${this.apiSignInUrl}`,o=await this.instance.get(n);return this.gamesRemapper.remapGamesListResponse(o.data)}catch(n){throw console.warn(`There was a problem fetching the following game: ${e}`,n),n.response}};getGamePredictions=async(e,t,n)=>{try{let o=new re,p=de(t)?`/games/${e}/predictions${this.apiSignInUrl}${fe()}`:`/games/${e}/predictions${this.apiSignInUrl}`;n&&(p+=`${n.constructFiltersUrl()}`);let d=await this.instance.get(p);return o.meta=this.metaRemapper.remapMetaData(d.data.meta),o.data=await this.predictionRemapper.remapResponseArrayBody(d.data.data),o}catch(o){throw console.warn(`There was a problem fetching the predictions for game: ${e}`,o),o.response}};getUserGameEditions=async(e,t)=>{try{let n=null,o=de(t)?`/games/${this.apiSignInUrl}${e.constructFiltersUrl()}${fe()}`:`/games/${this.apiSignInUrl}${e.constructFiltersUrl()}`,p=await this.instance.get(o);return p.data.data.forEach(d=>{d.type==="TOP_X"?n=this.gamesRemapper.remapPaginatedUserTopXEditions(p.data):d.type==="MATCH_QUIZ"&&(n=this.gamesRemapper.remapPaginatedUserMathQuizEditions(p.data))}),n}catch(n){throw console.warn("There was a problem fetching the games list",n),n.response}};getGameResults=async(e,t,n)=>{try{let o=de(t)?`/games/${e}/results/${this.apiSignInUrl}${fe()}`:`/games/${e}/results/${this.apiSignInUrl}`;n&&(o+=`${n.constructMainFiltersUrl()}`);let p=await this.instance.get(o);return this.gamesRemapper.remapPaginatedGameResults(p.data)}catch(o){throw console.warn(`There was a problem fetching the results for the following game: ${e}`,o),o.response}};getMarketResultsForGame=async(e,t)=>{let n=`/games/${e}/correct-results/${this.apiSignInUrl}`;de(t)&&(n+=`${fe()}`);try{let o=await this.instance.get(n);return this.gamesRemapper.remapGameMarketsResults(o.data.data)}catch(o){throw console.warn(`There was a problem fetching the markets correct results for the following game: ${e}`,o),o.response}}};var mr=class{gameInstanceId=null;fixtures=null};var ne=class extends Error{code=0;status=null;message=null;constructor(e,t,n){super();this.code=e,this.status=t,this.message=n}errorMessage=()=>this.message};var xp=(n=>(n.ONE="1",n.X="x",n.TWO="2",n))(xp||{}),Ap=(n=>(n.ONE_X="1x",n.X_TWO="x2",n.ONE_TWO="12",n))(Ap||{}),Op=(v=>(v.ONE_ONE="1/1",v.ONE_X="1/x",v.ONE_TWO="1/2",v.X_ONE="x/1",v.X_X="x/x",v.X_TWO="x/2",v.TWO_ONE="2/1",v.TWO_X="2/x",v.TWO_TWO="2/2",v))(Op||{});var is=class{matchId=null;market="BOTH_TEAMS_SCORE";matchType="FOOTBALL";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new it,this.prediction.value=t}};var rs=class{value};var ns=class{matchId=null;market="CORNERS_MATCH";matchType="FOOTBALL";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new rs,this.prediction.value=t}};var as=class{value=null};var os=class{matchId=null;market="DOUBLE_CHANCE";matchType="FOOTBALL";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new as,this.prediction.value=t}};var ss=class{value=null};var ls=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(e,t,n){this.matchId=e,this.market=t,this.prediction=new ss,this.prediction.value=n}};var ps=class{value=null};var cs=class{matchId=null;market="HT_FT";matchType="FOOTBALL";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new ps,this.prediction.value=t}};var us=class{matchId=null;market="PENALTY_MATCH";matchType="FOOTBALL";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new it,this.prediction.value=t}};var ms=class{matchId=null;market="RED_CARD_MATCH";matchType="FOOTBALL";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new it,this.prediction.value=t}};var ti=class{validateBodyFields=(e,t)=>{let n=Object.keys(t),o=Object.keys(new mr);switch(e){case"MATCH_QUIZ":n.forEach(g=>{o.includes(g)||this.throwInvalidParamException([g])});break;case"TOP_X":let d=t;d.fixtures.forEach(g=>this.validateMarketTopX(g.market));let y="tiebreaker";n.includes(y)&&d.tiebreaker&&this.validateTiebreaker(d.tiebreaker),n.forEach(g=>{g!=="tiebreaker"&&!o.includes(g)&&this.throwInvalidParamException([g])});break}let p=o.filter(d=>!n.includes(d));return p.length&&this.throwMissingFieldsException("game prediction body",p),t.fixtures.forEach(d=>{this.validateFixtureFields(d)}),t};validateFixture=(e,t,n,o)=>{this.validateMarket(t);let p=Object.values(xp),d=Object.values(Op),y=Object.values(Ap);if(t==="FT_1X2"||t==="HT_1X2"){if(p.includes(n))return new ls(e,t,n)}else if(t==="HT_FT"){if(d.includes(n))return new cs(e,n)}else if(t==="DOUBLE_CHANCE"){if(y.includes(n))return new os(e,n)}else if(t==="CORRECT_SCORE"||t==="CORRECT_SCORE_ADVANCED"||t==="CORRECT_SCORE_HT"){if(typeof n=="string"&&/\d+:\d+/.test(n))return new Zt(e,t,n)}else if(t==="CORNERS_MATCH"){if(typeof n=="number")return new ns(e,n)}else if(t==="BOTH_TEAMS_SCORE"){if(this.isPredictionBoolean(n))return new is(e,n)}else if(t==="RED_CARD_MATCH"){if(this.isPredictionBoolean(n))return new ms(e,n)}else if(t==="PENALTY_MATCH"){if(this.isPredictionBoolean(n))return new us(e,n)}else if(wt.includes(t)){let g="OWN_GOAL";if(this.validatePlayerId(t,o),t===Zr&&this.isPredictionBoolean(n)){let v=o&&o===g?g:o;return new tt(e,t,n,v)}if(o&&this.isPredictionBoolean(n))return new tt(e,t,n,o)}else if(Td.includes(t)){if(this.isPredictionBoolean(n))return new or(e,t,n)}else if(Ed.includes(t)&&this.isPredictionBoolean(n))return new ar(e,t,n);this.throwInvalidPredictionException(n,t)};validateFixtureFields=e=>{let t=Object.keys(e);t.forEach(o=>{Sp.includes(o)||this.throwInvalidParamException([o])});let n=Sp.filter(o=>{if(o!=="matchType"&&!t.includes(o))return o});n.length&&this.throwMissingFieldsException("fixtures",n),this.validatePredictionKey(e.market,e.prediction)};validateTiebreaker=e=>{let t=Object.keys(e);(!t.length||typeof e!="object")&&this.throwInvalidType("tiebreaker","object");let n=Object.keys(new jt)[0];t.forEach(o=>{n!==o&&this.throwInvalidParamException([o])}),t.includes(n)||this.throwMissingFieldsException("tiebreaker",[n]),typeof e.goldenGoal!="number"&&this.throwInvalidType("goldenGoal","number")};validatePredictionKey=(e,t)=>{if(typeof t=="object"){let n=Object.keys(t),o=["value"];if(n.length||this.throwMissingFieldsException("prediction",o),n.length===1&&!n.includes(o[0])&&this.throwInvalidParamException(n),n.length>1){wt.includes(e)&&o.push("playerId");let p=n.filter(d=>!o.includes(d));p.length&&this.throwInvalidParamException(p)}}else this.throwInvalidType("prediction","object")};validatePlayerId=(e,t)=>{let n="playerId";e!==Zr&&(t||this.throwInvalidParamException([n]),typeof t!="string"&&this.throwInvalidType(n,"string"))};validateMarket=e=>{Object.values(Pe).includes(e)||this.throwInvalidMarketException(e)};validateMarketTopX=e=>{e!=="CORRECT_SCORE"&&e!=="CORRECT_SCORE_ADVANCED"&&this.throwInvalidMarketException(e,"TOP_X")};isPredictionBoolean=e=>typeof e=="boolean";throwInvalidPredictionException=(e,t)=>{let n=xd(e,t);throw new ne(400,"INVALID_PREDICTION",n)};throwInvalidMarketException=(e,t)=>{let n=null;throw t&&t==="TOP_X"?n=Ad(e):n=Vo(e),new ne(400,"INVALID_MARKET",n)};throwInvalidParamException=e=>{let t=Od(e);throw new ne(400,"INVALID_FIELD",t)};throwMissingFieldsException=(e,t)=>{let n=Bd(e,t);throw new ne(400,"INVALID_FIELD",n)};throwInvalidType=(e,t)=>{let n=Ld(e,t);throw new ne(400,"INVALID_TYPE",n)}};var fs=class{predictorHttps=null;clientHttps=null;idMapping=null;predictorService=null;predictorValidator=null;constructor(e,t,n,o){this.predictorHttps=t,this.idMapping=o,this.clientHttps=n,this.predictorValidator=new ti,this.predictorService=new _t(e,o)}makeFootballPrediction=async(e,t,n,o)=>{let p=this.predictorValidator.validateFixture(e,t,n,o),d=new mr;if(this.idMapping.idSchema!=="native"){let y=p.matchId,g="",v=await this.predictorService.remapMatchIdToNative([y]);if(p.matchId=v[0],!p.matchId)throw new ne(400,"INVALID_FIELD","Match id is invalid!").errorMessage();if(p instanceof tt&&(g=p.prediction.playerId,p.prediction.playerId=g&&await this.predictorService.remapPlayerIdToNative([g]),p.market!==Zr&&!p.prediction.playerId))throw new ne(400,"INVALID_FIELD","Player id is invalid!").errorMessage();d.fixtures=[p];let w=await this.predictorHttps.makeFootballPrediction(d);return w.fixtures.forEach(S=>{S.prediction.playerId&&(S.prediction.playerId=g),S.matchId=y}),w}else return d.fixtures=[p],await this.predictorHttps.makeFootballPrediction(d)};getMatchSummary=async(e,t)=>{if(this.idMapping.idSchema!=="native"){let o=(await this.predictorService.remapMatchIdToNative([e]))[0],p=await this.predictorHttps.getMatchSummary(o,t);p.matchId=e;let d=p.predictions,y=await this.predictorService.remapPlayerIdToIdSchema(d);return p.predictions=y,p}else return await this.predictorHttps.getMatchSummary(e,t)};getMarketSummary=async(e,t,n,o)=>{try{let p=await this.getMatchSummary(e,o);return this.predictorService.getMarketSummary(p,t,n)}catch(p){return p.message}};getConfig=async()=>{let e=await this.clientHttps.getConfig("predictor");return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(e):e};deleteFootballPrediction=async e=>await this.predictorHttps.deleteFootballPrediction(e);getMyPredictions=async e=>{let t=this.predictorService.initPredictionsFilters(e,"user");return await this.predictorHttps.getMyPredictions(t)};getMyPredictionsForMatches=async(e,t)=>{if(this.predictorService.areIdsExceeded(e))throw new ne(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.").errorMessage();this.idMapping.idSchema!=="native"&&(e=await this.predictorService.remapMatchIdToNative([...e]));let n=this.predictorService.initPredictionsFilters(t,"matches",e);return await this.predictorHttps.getMyPredictions(n)};getMyCurrentPredictions=async e=>{let t=this.predictorService.initPredictionsFilters(e,"current");return await this.predictorHttps.getMyPredictions(t)};getMyPastPredictions=async e=>{let t=this.predictorService.initPredictionsFilters(e,"past");return await this.predictorHttps.getMyPredictions(t)};getUserPredictions=async(e,t,n)=>{let o=this.predictorService.initPredictionsFilters(t,"user");return await this.predictorHttps.getUserPredictions(e,n,o)};getUserCurrentPredictions=async(e,t,n)=>{let o=this.predictorService.initPredictionsFilters(t,"current");return await this.predictorHttps.getUserPredictions(e,n,o)};getUserPastPredictions=async(e,t,n)=>{let o=this.predictorService.initPredictionsFilters(t,"past");return await this.predictorHttps.getUserPredictions(e,n,o)};getUserPredictionsForMatches=async(e,t,n,o)=>{if(this.predictorService.areIdsExceeded(t))throw new ne(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.").errorMessage();this.idMapping.idSchema!=="native"&&(t=await this.predictorService.remapMatchIdToNative([...t]));let p=this.predictorService.initPredictionsFilters(n,"matches",t);return await this.predictorHttps.getUserPredictions(e,o,p)}};var hs=class{predictorHttps=null;clientHttps=null;predictorFacade=null;idMapping=null;constructor(e){this.idMapping=new ae(e),this.predictorHttps=new ei(e,this.idMapping),this.clientHttps=new et(e),this.predictorFacade=new fs(e,this.predictorHttps,this.clientHttps,this.idMapping)}makeFootballPrediction=async(e,t,n,o)=>await this.predictorFacade.makeFootballPrediction(e,t,n,o);getMatchSummary=async(e,t)=>await this.predictorFacade.getMatchSummary(e,t);getMarketSummary=async(e,t,n,o)=>await this.predictorFacade.getMarketSummary(e,t,n,o);getConfig=async()=>await this.predictorFacade.getConfig();deleteFootballPrediction=async e=>await this.predictorFacade.deleteFootballPrediction(e);getMyPredictions=async e=>await this.predictorFacade.getMyPredictions(e);getMyCurrentPredictions=async e=>await this.predictorFacade.getMyCurrentPredictions(e);getMyPastPredictions=async e=>await this.predictorFacade.getMyPastPredictions(e);getMyPredictionsForMatches=async(e,t)=>await this.predictorFacade.getMyPredictionsForMatches(e,t);getUserPredictions=async(e,t,n)=>await this.predictorFacade.getUserPredictions(e,t,n);getUserCurrentPredictions=async(e,t,n)=>await this.predictorFacade.getUserCurrentPredictions(e,t,n);getUserPastPredictions=async(e,t,n)=>await this.predictorFacade.getUserPastPredictions(e,t,n);getUserPredictionsForMatches=async(e,t,n,o)=>await this.predictorFacade.getUserPredictionsForMatches(e,t,n,o)};var gs=class{rankType=null;fromDate=null;toDate=null;pagination=new Qi};var dr=class{position=null;profileId=null;profileModel=null;points=null;predictionsMade=null};var ys=class{remapResponse=e=>(e.meta=this.remapMeta(e.meta),e.data=this.remapData(e.data),e);remapMeta=e=>{let t=new gs;return t.rankType=e.rank_type,t.fromDate=e.from_date,t.toDate=e.to_date,t.pagination.currentPage=e.pagination.current_page,t.pagination.itemsPerPage=e.pagination.items_per_page,t.pagination.totalItems=e.pagination.total_items,t.pagination.numberOfPages=e.pagination.number_of_pages,t};remapData=e=>{let t=[];return e.forEach(n=>{let o=new dr;o.position=n.position,o.profileId=n.profile_id,o.points=n.points,o.predictionsMade=n.predictions_made,t.push(o)}),t}};var Ms=class extends dr{id=null;rankType=null;model=null;gameType=null};var bs=class{remapRankings=e=>(e.meta=this.remapMeta(e.meta),e.data=this.remapData(e.data),e);remapMeta=e=>{let t=new Jt;return t.pagination.currentPage=e.pagination.current_page,t.pagination.itemsPerPage=e.pagination.items_per_page,t.pagination.numberOfPages=e.pagination.number_of_pages,t.pagination.totalItems=e.pagination.total_items,t};remapData(e){let t=[];return e.forEach(n=>{let o=new Ms;o.id=n.id,o.rankType=n.rank_type,o.position=n.position,o.points=n.points,o.gameType=n.game_type,delete o.profileId,delete o.profileModel,delete o.predictionsMade,t.push(o)}),t}};var ws=class{id=null;name=null;description=null;type=null;fromDate=null;toDate=null;markets=[];teamIds=[];matchIds=[];gameIds=[];gameTypes=[];competitionIds=[];excludedProfileIds=[];rules=null;flags=null;images=new pr;status=null;automaticallyChangeStatus=!0};var vs=class{remapResponse=e=>{let t=[];return e.forEach(n=>{let o=new ws;o.id=n.id,o.name=n.name,o.description=n.description,o.type=n.type,o.fromDate=n.from_date,o.toDate=n.to_date,o.markets=n.markets?n.markets:null,o.teamIds=n.team_ids?n.team_ids:null,o.matchIds=n.match_ids?n.match_ids:null,o.gameIds=n.game_ids?n.game_ids:null,o.gameTypes=n.game_types?n.game_types:null,o.competitionIds=n.competition_ids?n.competition_ids:null,o.excludedProfileIds=n.excluded_profile_ids?n.excluded_profile_ids:null,o.rules=n.rules?n.rules:null,o.flags=n.flags?n.flags:null,o.images=n.images?n.images:null,o.status=n.status?n.status:null,o.automaticallyChangeStatus=n.automatically_change_status,t.push(o)}),t};remapMeta=e=>{let t={};return t.totalItems=e.pagination.total_items,t}};var _s=class{position=null;points=null;predictionsMade=null;profileId=null;profileModel=null;successRatePercent=null};var Is=class{remapHighestSuccessRate=e=>e.map(t=>{let n=new _s;return n.position=t.position,n.points=t.points,n.predictionsMade=t.predictions_made,n.profileId=t.profile_id,n.successRatePercent=t.success_rate_percent,n})};var Ps=class extends Me{apiSignInUrl=null;templateRemapper=null;leaderboardRemapper=null;rankingsRemapper=null;highestSuccessRateRemapper=null;constructor(e){super(e,Oe(e.environment,"loyalty"));this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}`,this.templateRemapper=new vs,this.leaderboardRemapper=new ys,this.rankingsRemapper=new bs,this.highestSuccessRateRemapper=new Is}getTemplates=async(e,t)=>{try{let n=de(e)?`/leaderboard/templates/${this.apiSignInUrl}${fe()}`:`/leaderboard/templates/${this.apiSignInUrl}`,o=await this.instance.get(n);if(t){let p=JSON.parse(JSON.stringify(o.data));return p.meta=this.templateRemapper.remapMeta(o.data.meta),p.data=this.templateRemapper.remapResponse(o.data.data),p}return this.templateRemapper.remapResponse(o.data.data)}catch(n){throw console.warn("There was a problem fetching the list of templates",n),n.response}};getLeaderboard=async(e,t,n)=>{try{let o=de(t)?`/leaderboard/${e}/${this.apiSignInUrl}${fe()}`:`/leaderboard/${e}/${this.apiSignInUrl}`;n&&(o+=`${n.constructFiltersUrl()}`);let p=await this.instance.get(o),d=JSON.parse(JSON.stringify(p.data));return this.leaderboardRemapper.remapResponse(d)}catch(o){throw console.warn(`There was a problem fetching the leaderboard for the following template: ${e}`,o),o.response}};getLeaderboardForGame=async(e,t,n)=>{try{let o=de(t)?`/leaderboard/games/${e}/${this.apiSignInUrl}${fe()}`:`/leaderboard/games/${e}/${this.apiSignInUrl}`;n&&(o+=`${n.constructFiltersUrl()}`);let p=await this.instance.get(o),d=JSON.parse(JSON.stringify(p.data));return ta(d)}catch(o){throw console.warn(`There was a problem fetching the leaderboard for the following game: ${e}`,o),o.response}};getUserRankings=async(e,t,n)=>{let o=`/leaderboard/users/${e}/rankings/${this.apiSignInUrl}`;t&&(o+=`${t.constructFiltersUrl()}`),de(n)&&(o+=`${fe()}`);try{let p=await this.instance.get(o);return this.rankingsRemapper.remapRankings(p.data)}catch(p){throw console.warn(`There was a problem fetching the rankings for the following user: ${e}`,p),p.response}};getHighestSuccessRate=async(e,t)=>{let n=de(t)?`/statistics/top${this.apiSignInUrl}${fe()}`:`/statistics/top${this.apiSignInUrl}`;e&&(n+=`&market=${e}`);try{let o=await this.instance.get(n);return this.highestSuccessRateRemapper.remapHighestSuccessRate(o.data.data)}catch(o){throw console.warn("There was a problem fetching highest success rate",o),o.response}}};var Rs=class{general;predictor;topX;matchQuiz};var fr=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 Fs=class extends fr{sortOrder=null;rankType=null;leaderboardIds=null;gameType=null;constructor(e){super(e);this.sortOrder=e.sortOrder,this.rankType=e.rankType,this.leaderboardIds=e.leaderboardIds,this.gameType=e.type&&e.type.toLowerCase()==="game"?e.gameType:null}constructFiltersUrl=()=>{let e=super.constructFiltersUrl();return this.sortOrder&&(e+="&",e+=`sort_order=${this.sortOrder}`),this.rankType&&(e+="&",e+=`rank_type=${this.rankType}`),this.leaderboardIds&&(e+="&",e+=`type_ids=${this.leaderboardIds.join(",")}`),this.gameType&&(e+="&",e+=`game_type=${this.gameType}`),e}};var Ss=class{idMappingService=null;profileNamespace=null;constructor(e){this.idMappingService=new ae(e),this.profileNamespace=new er(e)}remapTemplatesIds=async e=>{if(e.length>0){let t=[],n=[],o=[],p=[],d=[],y=[];e.forEach(w=>{w.teamIds&&w.teamIds.length>0?t=[...t,...w.teamIds]:w.matchIds&&w.matchIds.length>0?o=[...o,...w.matchIds]:w.competitionIds&&w.competitionIds.length>0&&(d=[...d,...w.competitionIds])});let g={team:t,match:o,competition:d},v=await this.idMappingService.idMappingFacade.getEntitiesByIds(g,"native",this.idMappingService.idSchema);return n=[...v.team],p=[...v.match],y=[...v.competition],e.forEach(w=>{w.teamIds&&w.teamIds.length>0?w.teamIds=w.teamIds.map(S=>S=v.team.shift()):w.matchIds&&w.matchIds.length>0?w.matchIds=w.matchIds.map(S=>S=v.match.shift()):w.competitionIds&&w.competitionIds.length>0&&(w.competitionIds=w.competitionIds.map(S=>S=v.competition.shift()))}),e}return e};addProfileModelToLeaderboad=async e=>{if(e.length>0){let t=[],n=[];e.forEach(p=>{t.push(p.profileId)});let o=await this.profileNamespace.getByIds(t);return e.forEach(p=>{o.forEach(d=>{d.id===p.profileId&&(delete d.interests,p.profileModel=d)}),p.profileModel||(p.profileModel=null),n.push(p)}),n}return e};buildClientBadges=e=>{let t=new Rs;return t.general=this.extractEnabledBadgesId(e.general),t.predictor=this.extractEnabledBadgesId(e.predictor),t.topX=this.extractEnabledBadgesId(e.topX),t.matchQuiz=this.extractEnabledBadgesId(e.matchQuiz),t};initFilters=(e,t)=>{switch(t){case"loyalty":e&&(e=new fr(e));break;case"rankings":e&&(e=new Fs(e));break}return e};addProfileModelToHighestSuccessRate=async e=>{let t=e.map(o=>o.profileId),n=await this.profileNamespace.getByIds(t);return e.map(o=>(n.forEach(p=>{p.id===o.profileId&&(delete p.interests,o.profileModel=p)}),o))};extractRankingsIdsMap=e=>{let t=[],n=[],o=[];return e.forEach(p=>{p.rankType==="GAME"&&p.gameType==="TOP_X"?t.push(p.id):p.rankType==="GAME"&&p.gameType==="MATCH_QUIZ"?n.push(p.id):p.rankType==="TEMPLATE"&&o.push(p.id)}),[t,n,o]};setModelsForUserRankings=(e,t,n,o)=>(o.data.forEach(p=>{p.gameType==="MATCH_QUIZ"&&t?p.model=t.filter(d=>d.id===p.id)[0]:p.gameType==="TOP_X"&&e?p.model=e.filter(d=>d.id===p.id)[0]:p.rankType==="TEMPLATE"&&n&&(p.model=n.filter(d=>d.id===p.id)[0])}),o);extractEnabledBadgesId=e=>{let t=[];return e.forEach(n=>{n.enabled&&t.push(n.id)}),t}};var Ts=class{validateMarket=e=>{if(!Object.keys(Pe).includes(e)){let n=Vo(e);throw new ne(400,"INVALID_MARKET",n)}}};var hr=class{idMapping=null;predictorHttps=null;predictorService=null;predictorValidator=null;clientHttps=null;constructor(e,t){this.idMapping=t,this.predictorValidator=new ti,this.predictorHttps=new ei(e,t),this.predictorService=new _t(e,t),this.clientHttps=new et(e)}getConfig=async()=>{let e=await this.clientHttps.getConfig("topX");return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(e):e};getGames=async(e,t)=>{t=t||!1;let n=this.predictorService.initGameFilters("TOP_X",e),o=await this.predictorHttps.getGames(n,t);return await this.predictorService.remapMatchIdsFixtures(o)};getGameById=async(e,t)=>{t=t||!1;let n=await this.predictorHttps.getGameById(e,t);return await this.predictorService.remapMatchIdsFixtures(n)};getGamePredictions=async(e,t,n)=>(n=n||!1,t&&(t.type&&delete t.type,t.status&&delete t.status,t=new Re(t)),await this.predictorHttps.getGamePredictions(e,n,t));getGameResults=async(e,t,n)=>{n=n||!1,t&&(t=new rt(t));let o=await this.predictorHttps.getGameResults(e,n,t);return await this.predictorService.remapMatchIdsFixtures(o)};getCurrentGameResults=async e=>{e=e||!1;let t={status:"OPEN",type:"TOP_X"};t=new rt(t);let n=await this.predictorHttps.getGames(t,e),o=this.predictorService.getCurrentGameId(n);return(await this.getGameResults(o,null,e)).data[0]};play=async e=>{let t=new cr(e);if(t=this.predictorValidator.validateBodyFields("TOP_X",t),t.fixtures=t.fixtures.map(o=>this.predictorValidator.validateFixture(o.matchId,o.market,o.prediction.value)),this.idMapping.idSchema!=="native"){let o=[];t.fixtures.forEach(d=>o.push(d.matchId));let p=await this.predictorService.remapMatchIdToNative(o);t.fixtures.forEach(d=>d.matchId=p.shift())}let n=await this.predictorHttps.makeFootballPrediction(t);return n.fixtures.forEach(o=>{o.matchId=o.matchModel.id}),n};delete=async e=>await this.predictorHttps.deleteFootballPrediction(e);getMyGameEditions=async(e,t)=>{e&&e.limit&&this.validateLimitFilterOnGames(e.limit),t=t||!1;let n=this.predictorService.initGameTypePredictions("TOP_X",e),o=[],p=await this.predictorHttps.getMyPredictionsNoRemap(n);if(p.data.length>0){p.data.forEach(g=>{g.game_instance_id&&o.push(g.game_instance_id)});let d=this.predictorService.initGameFilters("TOP_X",null,o),y=await this.predictorHttps.getUserGameEditions(d,t);return await this.predictorService.addPredictionProp(p,y)}else return new re};getMyGamePrediction=async e=>{let t=this.predictorService.initGameTypePredictions("TOP_X"),n=await this.predictorHttps.getMyPredictions(t);if(n.data.length>0){let o=n.data.filter(p=>p.gameInstanceId===e);return o.length?o[0]:null}return null};getUserGameEditions=async(e,t,n)=>{t&&t.limit&&this.validateLimitFilterOnGames(t.limit),n=n||!1;let o=this.predictorService.initGameTypePredictions("TOP_X",t),p=[],d=await this.predictorHttps.getUserPredictionsNoRemap(e,o);if(d.data.length>0){d.data.forEach(v=>{v.game_instance_id&&p.push(v.game_instance_id)});let y=this.predictorService.initGameFilters("TOP_X",null,p),g=await this.predictorHttps.getUserGameEditions(y,n);return await this.predictorService.addPredictionProp(d,g)}else return new re};getUserGamePrediction=async(e,t,n)=>{n=n||!1;let o=this.predictorService.initGameTypePredictions("TOP_X"),p=await this.predictorHttps.getUserPredictions(e,n,o);if(p.data.length>0){let d=p.data.filter(y=>y.gameInstanceId===t);return d.length?d[0]:null}else return null};getMarketsResultsForGame=async(e,t)=>{let n=await this.predictorHttps.getMarketResultsForGame(e,t);return await this.predictorService.completeGameMarketResults(n,"TOP_X")};validateLimitFilterOnGames=e=>{if(e>50)throw new ne(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.")}};var gr=class{predictorHttps=null;predictorService=null;idMapping=null;clientHttps=null;predictorValidator=null;constructor(e){this.predictorValidator=new ti,this.idMapping=new ae(e),this.predictorHttps=new ei(e,this.idMapping),this.predictorService=new _t(e,this.idMapping),this.clientHttps=new et(e)}getConfig=async()=>{let e=await this.clientHttps.getConfig("matchQuiz");return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(e):e};play=async e=>{e=this.predictorValidator.validateBodyFields("MATCH_QUIZ",e);let t=e.fixtures.map(n=>this.predictorValidator.validateFixture(n.matchId,n.market,n.prediction.value,n.prediction.playerId));if(t&&t.length&&this.idMapping.idSchema!=="native"){let n=[],o=[];t.forEach(y=>{n.push(y.matchId),y instanceof tt&&y.prediction.playerId&&o.push(y.prediction.playerId)});let p=await this.predictorService.remapMatchIdToNative(n),d={};o&&o.length>0&&(d=await this.predictorService.remapPlayerIdMapToNative(o)),t.forEach((y,g)=>{y.matchId=p[g],y instanceof tt&&(y.prediction.playerId=d[y.prediction.playerId])})}return e.fixtures=t,await this.predictorHttps.makeFootballPrediction(e)};delete=async e=>await this.predictorHttps.deleteFootballPrediction(e);getGames=async(e,t)=>{t=t||!1;let n=this.predictorService.initGameFilters("MATCH_QUIZ",e),o=await this.predictorHttps.getGames(n,t);return await this.predictorService.remapMatchIdsFixtures(o)};getGameById=async(e,t)=>{t=t||!1;let n=await this.predictorHttps.getGameById(e,t);return await this.predictorService.remapMatchIdsFixtures(n)};getGamePredictions=async(e,t,n)=>(n=n||!1,t&&(t.type&&delete t.type,t.status&&delete t.status,t=new Re(t)),await this.predictorHttps.getGamePredictions(e,n,t));getGameResults=async(e,t,n)=>{n=n||!1,t&&(t=new lr(t));let o=await this.predictorHttps.getGameResults(e,n,t);return await this.predictorService.remapMatchIdsFixtures(o)};getCurrentGameResults=async e=>{e=e||!1;let t={status:"OPEN",type:"MATCH_QUIZ"};t=new rt(t);let n=await this.predictorHttps.getGames(t,e),o=this.predictorService.getCurrentGameId(n);return(await this.getGameResults(o,null,e)).data[0]};getMyGameEditions=async(e,t)=>{e&&e.limit&&this.validateLimitFilterOnGames(e.limit),t=t||!1;let n=this.predictorService.initGameTypePredictions("MATCH_QUIZ",e),o=[],p=await this.predictorHttps.getMyPredictionsNoRemap(n);if(p.data.length>0){p.data.forEach(g=>{g.game_instance_id&&o.push(g.game_instance_id)});let d=this.predictorService.initGameFilters("MATCH_QUIZ",null,o),y=await this.predictorHttps.getUserGameEditions(d,t);return await this.predictorService.addPredictionProp(p,y)}else return new re};getMyGamePrediction=async e=>{let t=this.predictorService.initGameTypePredictions("MATCH_QUIZ"),n=await this.predictorHttps.getMyPredictions(t);if(n.data.length>0){let o=n.data.filter(p=>p.gameInstanceId===e);return o.length?o[0]:null}return null};getUserGameEditions=async(e,t,n)=>{t&&t.limit&&this.validateLimitFilterOnGames(t.limit),n=n||!1;let o=this.predictorService.initGameTypePredictions("MATCH_QUIZ",t),p=[],d=await this.predictorHttps.getUserPredictionsNoRemap(e,o);if(d.data.length>0){d.data.forEach(v=>{v.game_instance_id&&p.push(v.game_instance_id)});let y=this.predictorService.initGameFilters("MATCH_QUIZ",null,p),g=await this.predictorHttps.getUserGameEditions(y,n);return await this.predictorService.addPredictionProp(d,g)}else return new re};getUserGamePrediction=async(e,t,n)=>{n=n||!1;let o=this.predictorService.initGameTypePredictions("MATCH_QUIZ"),p=await this.predictorHttps.getUserPredictions(e,n,o);if(p.data.length>0){let d=p.data.filter(y=>y.gameInstanceId===t);return d.length?d[0]:null}else return null};getMarketsResultsForGame=async(e,t)=>{let n=await this.predictorHttps.getMarketResultsForGame(e,t);return await this.predictorService.completeGameMarketResults(n,"MATCH_QUIZ")};validateLimitFilterOnGames=e=>{if(e>50)throw new ne(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.")}};var Es=class{config=null;clientHttps=null;loyaltyHttps=null;loyaltyService=null;profileFacade=null;loyaltyValidator=null;idMapping=null;topXFacade=null;matchQuizFacade=null;constructor(e,t,n,o,p){this.config=e,this.clientHttps=t,this.loyaltyHttps=n,this.profileFacade=new Mt(p,o),this.loyaltyService=new Ss(this.config),this.loyaltyValidator=new Ts,this.idMapping=new ae(e),this.topXFacade=new hr(e,this.idMapping),this.matchQuizFacade=new gr(e)}getConfig=async()=>await this.clientHttps.getConfig("loyalty");getClientBadges=async()=>{let e=await this.getConfig();return this.loyaltyService.buildClientBadges(e.rewards.badges)};getTemplates=async e=>{let t=!0;if(this.config.idSchema==="native")return await this.loyaltyHttps.getTemplates(e,t);let n=await this.loyaltyHttps.getTemplates(e,t);return n.data=await this.loyaltyService.remapTemplatesIds([...n.data]),n};getTemplateById=async(e,t)=>{try{let n=!1,p=(await this.loyaltyHttps.getTemplates(t,n)).filter(y=>y.id===e);if(!p.length)throw new ne(400,"INVALID_TEMPLATE","Provided template ID does NOT exist! Try again with existing template ID.").errorMessage();return this.config.idSchema==="native"?p[0]:(await this.loyaltyService.remapTemplatesIds(p))[0]}catch(n){throw console.warn("There was a problem retrieving specified template: ",n),n}};getLeaderboard=async(e,t,n)=>{t=this.loyaltyService.initFilters(t,"loyalty");let o=await this.loyaltyHttps.getLeaderboard(e,n,t);return o.data=await this.loyaltyService.addProfileModelToLeaderboad(o.data),o};getLeaderboardForGame=async(e,t,n)=>{t=this.loyaltyService.initFilters(t,"loyalty");let o=await this.loyaltyHttps.getLeaderboardForGame(e,n,t);return o.data=await this.loyaltyService.addProfileModelToLeaderboad(o.data),o};getOwnRankings=async(e,t)=>{let{id:n}=await this.profileFacade.getOwn();return this.getUserRankings(n,e,t)};getUserRankings=async(e,t,n)=>{t=this.loyaltyService.initFilters(t,"rankings");let o=await this.loyaltyHttps.getUserRankings(e,t,n);return await this.getModelsForUserRankings(o)};getHighestSuccessRate=async(e,t)=>{e&&this.loyaltyValidator.validateMarket(e);let n=await this.loyaltyHttps.getHighestSuccessRate(e,t);return this.loyaltyService.addProfileModelToHighestSuccessRate(n)};getModelsForUserRankings=async e=>{let t=null,n=null,o=null,[p,d,y]=this.loyaltyService.extractRankingsIdsMap(e.data);if(y.length&&(t=(await this.getTemplates()).data.filter(v=>y.includes(v.id))),p.length){let g={gameIds:p};n=(await this.topXFacade.getGames(g)).data}if(d.length){let g={gameIds:d};o=(await this.matchQuizFacade.getGames(g)).data}return this.loyaltyService.setModelsForUserRankings(n,o,t,e)}};var Cs=class{clientHttps=null;profileHttps=null;loyaltyHttps=null;loyaltyFacade=null;localStorage=null;constructor(e){this.clientHttps=new et(e),this.profileHttps=new Ui(e),this.loyaltyHttps=new Ps(e),this.localStorage=new yt(e),this.loyaltyFacade=new Es(e,this.clientHttps,this.loyaltyHttps,this.profileHttps,this.localStorage)}getConfig=async()=>await this.loyaltyFacade.getConfig();getClientBadges=async()=>await this.loyaltyFacade.getClientBadges();getTemplates=async e=>await this.loyaltyFacade.getTemplates(e);getTemplateById=async(e,t)=>await this.loyaltyFacade.getTemplateById(e,t);getLeaderboard=async(e,t,n)=>await this.loyaltyFacade.getLeaderboard(e,t,n);getLeaderboardForGame=async(e,t,n)=>await this.loyaltyFacade.getLeaderboardForGame(e,t,n);getOwnRankings=async(e,t)=>await this.loyaltyFacade.getOwnRankings(e,t);getUserRankings=async(e,t,n)=>await this.loyaltyFacade.getUserRankings(e,t,n);getHighestSuccessRate=async(e,t)=>await this.loyaltyFacade.getHighestSuccessRate(e,t)};var xs=class{topXFacade=null;idMapping=null;constructor(e){this.idMapping=new ae(e),this.topXFacade=new hr(e,this.idMapping)}getConfig=async()=>await this.topXFacade.getConfig();getGames=async(e,t)=>await this.topXFacade.getGames(e,t);getGameById=async(e,t)=>await this.topXFacade.getGameById(e,t);getGamePredictions=async(e,t,n)=>await this.topXFacade.getGamePredictions(e,t,n);getGameResults=async(e,t,n)=>await this.topXFacade.getGameResults(e,t,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,t)=>await this.topXFacade.getMyGameEditions(e,t);getMyGamePrediction=async e=>await this.topXFacade.getMyGamePrediction(e);getUserGameEditions=async(e,t,n)=>await this.topXFacade.getUserGameEditions(e,t,n);getUserGamePrediction=async(e,t,n)=>await this.topXFacade.getUserGamePrediction(e,t,n);getMarketsResultsForGame=async(e,t)=>await this.topXFacade.getMarketsResultsForGame(e,t)};var As=class{matchQuizFacade=null;constructor(e){this.matchQuizFacade=new gr(e)}getConfig=async()=>await this.matchQuizFacade.getConfig();play=async e=>await this.matchQuizFacade.play(e);delete=async e=>await this.matchQuizFacade.delete(e);getGames=async(e,t)=>await this.matchQuizFacade.getGames(e,t);getGameById=async(e,t)=>await this.matchQuizFacade.getGameById(e,t);getGamePredictions=async(e,t,n)=>await this.matchQuizFacade.getGamePredictions(e,t,n);getGameResults=async(e,t,n)=>await this.matchQuizFacade.getGameResults(e,t,n);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,n)=>await this.matchQuizFacade.getUserGameEditions(e,t,n);getUserGamePrediction=async(e,t,n)=>await this.matchQuizFacade.getUserGamePrediction(e,t,n);getMarketsResultsForGame=async(e,t)=>await this.matchQuizFacade.getMarketsResultsForGame(e,t)};var an=class{action=null;page=null;limit=null;constructor(e){this.action=e.action?e.action:null,this.page=e.page?e.page:null,this.limit=e.limit?e.limit:null}constructFilterUrl=()=>{let e="";return this.action&&(e+="&",e+=`action=${this.action}`),this.page&&(e+="&",e+=`page=${this.page}`),this.limit&&(e+="&",e+=`limit=${this.limit}`),e}};var on=class{action=null;context=new Ji;constructor(e,t,n,o){this.action=e,this.context.tags=t,n&&(this.context.content=n),o&&(this.context.campaign=o)}};var Os=class{idSchema;idMapping;constructor(e){this.idSchema=e.idSchema,this.idMapping=new ae(e)}remapTagsIds=async(e,t,n)=>{let o={},p={},d=[];e.forEach(g=>{o.hasOwnProperty(g.type)||(o[g.type]=[],p[g.type]=[]),o[g.type].push(g.id),p[g.type].push(g)});let y=await this.idMapping.idMappingFacade.getEntitiesByIds(o,t,n);for(let[g,v]of Object.entries(p))v.forEach((w,S)=>{w.id=y[g][S],d.push(w)});return d}};var Bs=class{idSchema;activityHttps;activityService;constructor(e){this.idSchema=e.idSchema,this.activityHttps=new ji(e),this.activityService=new Os(e)}add=async(e,t,n,o)=>{if(this.idSchema!="native"){let d=JSON.parse(JSON.stringify(t)),y=await this.activityService.remapTagsIds(t,this.idSchema,"native"),g=new on(e,y,n,o),v=await this.activityHttps.createActivity(g);return v.context.tags=d,v}let p=new on(e,t,n,o);return this.activityHttps.createActivity(p)};delete=async e=>await this.activityHttps.deleteActivity(e);like=async(e,t,n)=>{let o="like";return await this.add(o,e,t,n)};dislike=async(e,t,n)=>{let o="dislike";return await this.add(o,e,t,n)};addPageview=async(e,t,n)=>{let o="page_view";return await this.add(o,e,t,n)};addContentConsumed=async(e,t,n)=>{let o="content_consumed";return await this.add(o,e,t,n)};addShare=async(e,t,n)=>{let o="share";return await this.add(o,e,t,n)};addComment=async(e,t,n)=>{let o="comment";return await this.add(o,e,t,n)};addClickAd=async(e,t,n)=>{let o="click_ad";return await this.add(o,e,t,n)};addConversion=async(e,t,n)=>{let o="conversion";return await this.add(o,e,t,n)};getOwn=async(e,t)=>{if(t=t||!1,e&&(e=new an(e)),this.idSchema!="native"){let n=await this.activityHttps.getOwnActivities(e,t);for(let o of n.data)await this.activityService.remapTagsIds(o.context.tags,"native",this.idSchema);return n}return await this.activityHttps.getOwnActivities(e,t)};getForUser=async(e,t,n)=>{if(n=n||!1,t&&(t=new an(t)),this.idSchema!="native"){let o=await this.activityHttps.getActivitiesForUser(e,t,n);for(let p of o.data)await this.activityService.remapTagsIds(p.context.tags,"native",this.idSchema);return o}return await this.activityHttps.getActivitiesForUser(e,t,n)}};var Ls=class{activityFacade;constructor(e){this.activityFacade=new Bs(e)}add=async(e,t,n,o)=>await this.activityFacade.add(e,t,n,o);delete=async e=>await this.activityFacade.delete(e);like=async(e,t,n)=>await this.activityFacade.like(e,t,n);dislike=async(e,t,n)=>await this.activityFacade.dislike(e,t,n);addPageview=async(e,t,n)=>await this.activityFacade.addPageview(e,t,n);addContentConsumed=async(e,t,n)=>await this.activityFacade.addContentConsumed(e,t,n);addShare=async(e,t,n)=>await this.activityFacade.addShare(e,t,n);addComment=async(e,t,n)=>await this.activityFacade.addComment(e,t,n);addClickAd=async(e,t,n)=>await this.activityFacade.addClickAd(e,t,n);addConversion=async(e,t,n)=>await this.activityFacade.addConversion(e,t,n);getOwn=async(e,t)=>await this.activityFacade.getOwn(e,t);getForUser=async(e,t,n)=>await this.activityFacade.getForUser(e,t,n)};function wB(s){let t=new No().validate(s);if((t.idSchema.validation==="missing"||t.idSchema.validation==="invalid")&&(console.warn(t.idSchema.message.text),s.idSchema="native"),(t.environment.validation==="missing"||t.environment.validation==="invalid")&&(console.warn(t.environment.message.text),s.environment="prod"),(t.lang.validation==="missing"||t.lang.validation==="invalid")&&(console.warn(t.lang.message.text),s.lang="en"),t.authProvider.validation==="invalid"&&console.warn(t.authProvider.message.text),t.isValid)return{profile:new er(s),football:new Do(s),predictor:new hs(s),loyalty:new Cs(s),topX:new xs(s),matchQuiz:new As(s),activity:new Ls(s)};N_(t)}var N_=s=>{let e="authProvider",t="isValid";Object.keys(s).forEach(n=>{let o=s[n];if(n!==t&&n!==e){if(o.message.type==="error")throw new Error(o.message.text)}else n!==t&&n===e&&Object.keys(new fi).forEach(p=>{if(o[p].message.type==="error")throw new Error(o[p].message.text)})})};export{wB as FansUnitedSDK};
23
+ ${Fp.PREDICTOR_USER_RELATED_OPERATION}`},Ad=(s,e)=>`The prediction '${s}' is invalid for market '${e}'. Please check again have you passed appropriate prediction model. For more information please visit our documentation: https://docs.fansunitedmedia.com/sdks/js/match.quiz#gamerelatedoperations`,Vo=s=>`The market '${s}' is not supported from Fans United. For more information please visit our documentation: https://docs.fansunitedmedia.com/docs/predictor-operations#make-football-prediction`,xd=s=>`The market '${s}' is not valid for Top X game. The only available market is CORRECT_SCORE.`,Od=s=>`The field/s '${s.length>1?s.join(", "):s[0]}' is/are invalid. For more information please visit our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk`,Bd=(s,e)=>`The following field/s is/are missing from ${s}: '${e.length>1?e.join(", "):e[0]}'. For more information please visit our documentation: https://docs.fansunitedmedia.com/docs/predictor-operations#make-football-prediction`,Ld=(s,e)=>`The field ${s} has incorrect type. The correct type is ${e}`;var _t=class{footballHttps=null;idMapping=null;matchFacade=null;playerFacade=null;constructor(e,t){this.footballHttps=new bt(e),this.idMapping=t,this.matchFacade=new zt(e,this.footballHttps,t),this.playerFacade=new Qt(e,this.footballHttps,t)}remapMatchIdToNative=async e=>(await this.idMapping.getEntityIdsBySchemaId(e,"match","native")).match;remapPlayerIdToNative=async e=>(await this.idMapping.getEntityIdsBySchemaId(e,"player","native")).player[0];remapPlayerIdMapToNative=async e=>{let t={},n=Xt(e),p=(await this.idMapping.getEntityIdsBySchemaId(n,"player","native")).player;return n.forEach((d,y)=>t[d]=p[y]),t};remapPlayerIdToIdSchema=async e=>{let t=["playerScore","playerYellowCard","playerRedCard","playerScoreFirstGoal","playerScoreHattrick","playerScoreTwice"];for(let[n,o]of Object.entries(e))if(t.includes(n)){for(let p of Object.keys(o))if(p!=="NOBODY"&&p!=="OWN_GOAL"){let y=(await this.idMapping.idMappingFacade.getEntitiesByIds({player:[p]},"native",this.idMapping.idSchema)).player[0];o[y]=o[p],delete o[p]}}return e};convertMarket=e=>{let t=Object.keys(new sr),n=Object.values(Pe);for(let o=0;o<n.length;o++)e===n[o]&&(e=t[o]);return e};convertMarketForResponseModel=(e,t)=>{let n=t.toString();return e+"_"+n};getMarketSummary=(e,t,n)=>{let o=this.convertMarket(t),p={};if(p.matchId=e.matchId,p.matchType=e.matchType,Object.keys(e.predictions).includes(o))p[o]=e.predictions[o];else throw new Error("You have passed invalid market");return wt.includes(t)&&n?(p[o][n]||(p[o][n]=new j),p[o][n]):p};remapCompetitionsFromConfig=async e=>{if(e instanceof Vi){let t={competition:e.fullCoverageCompetitions},n={competition:e.successRateScopes.competitions},o={team:e.successRateScopes.teams},p=await this.idMapping.idMappingFacade.getEntitiesByIds(t,"native",this.idMapping.idSchema),d=await this.idMapping.idMappingFacade.getEntitiesByIds(n,"native",this.idMapping.idSchema),y=await this.idMapping.idMappingFacade.getEntitiesByIds(o,"native",this.idMapping.idSchema);return e.fullCoverageCompetitions=p.competition,e.successRateScopes.competitions=d.competition,e.successRateScopes.teams=y.team,e}if(e instanceof $i||e instanceof ki){let t={competition:e.competitionsWhitelist},n=await this.idMapping.idMappingFacade.getEntitiesByIds(t,"native",this.idMapping.idSchema);return e.competitionsWhitelist=n.competition,e}};remapMatchIdsFixtures=async e=>{if(Array.isArray(e.data))if(e.data.length>0){let t=[],n=[];return e.data.forEach(o=>{o instanceof yi||o instanceof hi||o instanceof Nt?(o.fixtures.forEach(p=>t.push(p.matchId)),o instanceof Nt&&o.fixtures.forEach(p=>{p.prediction.playerId&&p.prediction.playerId!=="OWN_GOAL"&&n.push(p.prediction.playerId)})):o instanceof gi&&o.results.forEach(p=>t.push(p.matchId))}),await this.refactorResponseArrModel(e,t,n)}else return e;else return await this.refactorResponseObjModel(e)};refactorResponseArrModel=async(e,t,n)=>{let o=[],p=await this.matchFacade.getMatchesMapWithNativeIds(t),d={};return n.length>0&&(d=await this.playerFacade.getPlayersMapWithNativeIds(n)),e.data.forEach(y=>{y instanceof yi||y instanceof hi||y instanceof Nt?(y.fixtures.forEach(g=>{g.matchModel=p[g.matchId],delete g.matchModel.availableMarkets,g.matchId=g.matchModel.id,y instanceof Nt&&g.prediction.playerId&&g.prediction.playerId!=="OWN_GOAL"&&(g.prediction.playerModel=d[g.prediction.playerId],g.prediction.playerId=d[g.prediction.playerId].id)}),o.push(y)):y instanceof gi&&(y.results.forEach(g=>{g.matchModel=p[g.matchId],delete g.matchModel.availableMarkets,g.matchId=g.matchModel.id}),o.push(y))}),e.data=o,e};refactorResponseObjModel=async e=>{let t=[];e.fixtures.forEach(o=>t.push(o.matchId));let n=await this.matchFacade.getMatchesMapWithNativeIds(t);return e.fixtures.forEach(o=>{o.matchModel=n[o.matchId],delete o.matchModel.availableMarkets,o.matchId=n[o.matchId].id}),e};getCurrentGameId=e=>{let t=new Date;if(e.data.length>1){let n=[];return e.data.forEach(p=>n.push(p.predictionsCutoff)),e.data.sort((p,d)=>{let[y,g]=[p.predictionsCutoff,d.predictionsCutoff].map(w=>Math.abs(new Date(w)-t));return y-g})[0].id}else return e.data[0].id};initGameTypePredictions=(e,t)=>{let n={type:e,limit:null,startAfter:null};return t&&(n={...n,limit:t.limit,startAfter:t.startAfter}),n=new Re(n),n};initGameFilters=(e,t,n)=>{if(t&&n)return t.type=e,t.gameIds=n,t=new rt(t),t;if(t&&!n)return t.type=e,t=new rt(t),t;if(!t&&n){let o={type:e,gameIds:n};return o=new rt(o),o}else{let o={type:e};return o=new rt(o),o}};addPredictionProp=async(e,t)=>(t.data.forEach(n=>{e.data.forEach(o=>{n.id===o.game_instance_id&&(n.predictionId=o.id,n.outcome=o.status,n.fixtures.forEach((p,d)=>{o.fixtures[d].goals_home!==void 0&&o.fixtures[d].goals_away!==void 0?p.prediction.value=o.fixtures[d].goals_home+":"+o.fixtures[d].goals_away:p.prediction.value=o.fixtures[d].prediction,o.fixtures[d].player_id?p.prediction.playerId=o.fixtures[d].player_id:o.fixtures[d].target&&(p.prediction.target=o.fixtures[d].target),p.prediction.result=this.remapResult(o.fixtures[d].result)}),n.predictionsMadeAt=o.created_at,n.points=o.points)})}),t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,await this.remapMatchIdsFixtures(t));remapResult=e=>{let t=new nr;return t.settledAt=e.settled_at,t.resettledAt=e.resettled_at,t.status=e.status,t.outcome=e.outcome,t.points=e.points,t};areIdsExceeded=e=>{let t=10;return e.length>t};initPredictionsFilters=(e,t,n)=>{switch(t){case"user":e&&(e=new Re(e));break;case"current":if(e)this.deleteUnexpectedProperties(e),e.status=["ACTIVE"],e=new Re(e);else{let o={status:["ACTIVE"]};e=new Re(o)}break;case"past":if(e)this.deleteUnexpectedProperties(e),e.status=Ep,e=new Re(e);else{let o={status:Ep};e=new Re(o)}break;case"matches":if(e)this.deleteUnexpectedProperties(e),e.matchIds=n,e=new Re(e);else{let o={matchIds:n};e=new Re(o)}break}return e};completeGameMarketResults=async(e,t)=>{switch(t){case"MATCH_QUIZ":let n={},o=e.results[0].matchId,p=e.results.map(w=>wt.includes(w.market)&&!w.result.includes("OWN_GOAL")?[...w.result]:[]).flat(),d=await this.matchFacade.getMatchesMapWithNativeIds([o]);return p.length&&(n=await this.playerFacade.getPlayersMapWithNativeIds(p)),e.results=e.results.map(w=>{if(w.matchModel=d[w.matchId],w.playerModels&&Object.keys(n).length&&w.result.forEach(S=>{let B=n[S];w.playerModels.push(B)}),this.idMapping.idSchema!=="native"&&(w.matchId=d[w.matchId].id,w.playerModels&&Object.keys(n).length)){let v=w.result;w.result=v.map(S=>n[S].id)}return w}),e;case"TOP_X":let y=e.results.map(w=>w.matchId),g=await this.matchFacade.getMatchesMapWithNativeIds(y);if(e.results=e.results.map(w=>(w.matchModel=g[w.matchId],this.idMapping.idSchema!=="native"&&(w.matchId=g[w.matchId].id),w)),e.tieBreakers.goldenGoals.length){let w=e.tieBreakers.goldenGoals.map(S=>S.playerId),v=await this.playerFacade.getPlayersMapWithNativeIds(w);e.tieBreakers.goldenGoals=e.tieBreakers.goldenGoals.map(S=>(S.matchModel=g[S.matchId],S.playerModel=v[S.playerId],this.idMapping.idSchema!=="native"&&(S.matchId=g[S.matchId].id,S.playerId=v[S.playerId].id),S))}return e}};deleteUnexpectedProperties=e=>(e.status&&(console.warn(Cp.UNEXPECTED_STATUS_PROP),delete e.status),e.type&&(console.warn(Cp.UNEXPECTED_TYPE_PROP),delete e.type),e)};var cr=class{gameInstanceId=null;fixtures=[];tiebreaker=null;constructor(e){this.gameInstanceId=e.gameInstanceId,e.fixtures.forEach(t=>this.fixtures.push(new Zt(t.matchId,t.market,t.prediction.value))),this.tiebreaker=e.tiebreaker?e.tiebreaker:null}};var ur=class{fixturesRemapper=null;footballHttps=null;matchFacade=null;playerFacade=null;predictorService=null;constructor(e,t){this.footballHttps=new bt(e),this.matchFacade=new zt(e,this.footballHttps,t),this.playerFacade=new Qt(e,this.footballHttps,t),this.predictorService=new _t(e,t),this.fixturesRemapper=new ko(this.matchFacade,this.playerFacade,this.predictorService)}remapRequestBody=e=>{let t={};return t.game_instance_id=e.gameInstanceId,t.fixtures=e.fixtures.map(n=>this.fixturesRemapper.remapFixturesRequest(n)),e instanceof cr&&e.tiebreaker&&(t.tiebreaker={},t.tiebreaker.golden_goal=e.tiebreaker.goldenGoal?e.tiebreaker.goldenGoal:null),t};remapResponseArrayBody=async e=>{if(e.length){let t="OWN_GOAL",n=[],o=[],p={},d=[];e.forEach(g=>{g.fixtures.forEach(w=>{n.push(w.match_id),w.player_id&&w.player_id!==t&&o.push(w.player_id)})});let y=await this.matchFacade.getMatchesMapWithNativeIds(n);return o.length>0&&(p=await this.playerFacade.getPlayersMapWithNativeIds(o)),e.forEach(g=>{let w=new tn,v=[];w.id=g.id,w.gameInstanceId=g.game_instance_id,w.gameType=g.game_type,w.wager=g.wager,w.totalFixtures=g.total_fixtures,w.settledFixtures=g.settled_fixtures,w.userId=g.user_id,g.fixtures.forEach(S=>{let B=new rr;S.target?B.market=this.predictorService.convertMarketForResponseModel(S.market,S.target):B.market=S.market,B.matchId=y[S.match_id].id,B.matchType=S.match_type,B.matchModel=y[S.match_id],delete B.matchModel.availableMarkets,S.goals_home!==void 0&&S.goals_away!==void 0?B.prediction.value=S.goals_home.toString()+":"+S.goals_away.toString():B.prediction.value=S.prediction,B.prediction.playerId=S.player_id?S.player_id:null,B.prediction.playerId&&B.prediction.playerId!==t&&(B.prediction.playerModel=p[B.prediction.playerId],B.prediction.playerId=p[B.prediction.playerId].id),B.result=this.fixturesRemapper.remapResult(S.result),v.push(B)}),w.fixtures=v,w.status=g.status,g.tiebreaker?w.tiebreaker.goldenGoal=g.tiebreaker.golden_goal:w.tiebreaker=null,w.points=g.points,w.createdAt=g.created_at,w.updatedAt=g.updated_at,d.push(w)}),d}return e};remapResponseObjBody=async e=>{let t=new tn;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 sr;return t.fullTimeOneXTwo=e.FT_1X2,t.halfTimeOneXTwo=e.HT_1X2,t.bothTeamsScore=e.BOTH_TEAMS_SCORE,t.overZeroPointFiveGoals=e.OVER_GOALS_0_5,t.overOnePointFiveGoals=e.OVER_GOALS_1_5,t.overTwoPointFiveGoals=e.OVER_GOALS_2_5,t.overThreePointFiveGoals=e.OVER_GOALS_3_5,t.overFourPointFiveGoals=e.OVER_GOALS_4_5,t.overFivePointFiveGoals=e.OVER_GOALS_5_5,t.overSixPointFiveGoals=e.OVER_GOALS_6_5,t.overSixPointFiveCorners=e.OVER_CORNERS_6_5,t.overSevenPointFiveCorners=e.OVER_CORNERS_7_5,t.overEightPointFiveCorners=e.OVER_CORNERS_8_5,t.overNinePointFiveCorners=e.OVER_CORNERS_9_5,t.overTenPointFiveCorners=e.OVER_CORNERS_10_5,t.overElevenPointFiveCorners=e.OVER_CORNERS_11_5,t.overTwelvePointFiveCorners=e.OVER_CORNERS_12_5,t.overThirteenPointFiveCorners=e.OVER_CORNERS_13_5,t.doubleChance=e.DOUBLE_CHANCE,t.halfTimeFullTime=e.HT_FT,t.playerScore=e.PLAYER_SCORE,t.playerYellowCard=e.PLAYER_YELLOW_CARD,t.playerRedCard=e.PLAYER_RED_CARD,t.redCardMatch=e.RED_CARD_MATCH,t.penaltyMatch=e.PENALTY_MATCH,t.playerScoreFirstGoal=e.PLAYER_SCORE_FIRST_GOAL,t.cornersMatch=e.CORNERS_MATCH,t.correctScore=e.CORRECT_SCORE,t.correctScoreHalfTime=e.CORRECT_SCORE_HT,t.correctScoreAdvanced=e.CORRECT_SCORE_ADVANCED,t.playerScoreHattrick=e.PLAYER_SCORE_HATTRICK,t.playerScoreTwice=e.PLAYER_SCORE_TWICE,t}};var qo=class{matchId=null;matchType=null;predictions=null};var Wo=class{remapPredictions=null;constructor(e,t){this.remapPredictions=new ur(e,t)}remapResponse=e=>{let t=new qo;return t.matchId=e.match_id,t.matchType=e.match_type,t.predictions=this.remapPredictions.remapPredictionModel(e.predictions),t}};var Ko=class{matchId=null;matchType=null;market=null;matchModel=null};var Xo=class{value=null;target=null;playerId=null;playerModel=null;result=null};var Yo=class{matchId=null;matchType=null;market=null;matchModel=null;prediction=new Xo};var Qo=class{value=null;result=null};var zo=class{matchId=null;matchType=null;market=null;matchModel=null;prediction=new Qo};var Jo=class{matchId=null;matchModel=null;outcome=null};var Zo=class{gameId=null;results=null;tieBreakers=null};var jo=class{entityId=null;entityType=null};var es=class{remapPaginatedGames=e=>{let t=new re;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(n=>this.remapGamesListResponse(n)),t};remapGamesListResponse=e=>{let t=new yi;return t.id=e.id,t.title=e.title,t.description=e.description,t.type=e.type,t.status=e.status,t.scheduleOpenAt=e.schedule_open_at,t.predictionsCutoff=e.predictions_cutoff,t.fixtures=e.fixtures.map(n=>this.remapFixturesResponse(n)),t.tiebreaker=e.tiebreaker?this.remapTimeTiebreaker(e.tiebreaker.time_tiebreaker):null,t.participantsCount=e.participants_count,t.related=e.related?this.remapRelated(e.related):null,t.excludedProfileIds=e.excluded_profile_ids,t.rules=e.rules,t.flags=e.flags,t.images=e.images,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapFixturesResponse=e=>{let t=new Ko;return t.matchId=e.match_id,t.matchType=e.match_type,t.market=e.market,t};remapPaginatedUserTopXEditions=e=>{let t=new re;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(n=>this.remapUserTopXEditionsResponse(n)),t};remapUserTopXEditionsResponse=e=>{let t=new hi;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.scheduleOpenAt=e.schedule_open_at,t.fixtures=e.fixtures.map(n=>this.remapTopXFixturesResponse(n)),t.tiebreaker=e.tiebreaker?this.remapTimeTiebreaker(e.tiebreaker.time_tiebreaker):null,t.participantsCount=e.participants_count,t.related=e.related?this.remapRelated(e.related):null,t.excludedProfileIds=e.excluded_profile_ids,t.rules=e.rules,t.flags=e.flags,t.images=e.images,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapTopXFixturesResponse=e=>{let t=new zo;return t.matchId=e.match_id,t.matchType=e.match_type,t.market=e.market,t};remapPaginatedUserMathQuizEditions=e=>{let t=new re;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(n=>this.remapUserMatchQuizEditionsResponse(n)),t};remapUserMatchQuizEditionsResponse=e=>{let t=new Nt;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.scheduleOpenAt=e.schedule_open_at,t.fixtures=e.fixtures.map(n=>this.remapMatchQuizFixturesResponse(n)),t.tiebreaker=e.tiebreaker?this.remapTimeTiebreaker(e.tiebreaker.time_tiebreaker):null,t.participantsCount=e.participants_count,t.related=e.related?this.remapRelated(e.related):null,t.excludedProfileIds=e.excluded_profile_ids,t.rules=e.rules,t.flags=e.flags,t.images=e.images,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapMatchQuizFixturesResponse=e=>{let t=new Yo;return t.matchId=e.match_id,t.matchType=e.match_type,t.market=e.market,t};remapPaginatedGameResults=e=>{let t=new re;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(n=>this.remapGameResults(n)),t};remapGameResults=e=>{let t=new gi;return t.userId=e.user_id,t.points=e.points?e.points:0,t.results=e.results.map(n=>this.remapResults(n)),t.tiebreaker=e.tiebreaker?this.remapTiebreaker(e.tiebreaker):null,t};remapGameMarketsResults=e=>{let t=new Zo;return t.gameId=e.game_id,t.results=this.remapMarketsResults(e.results),t.tieBreakers=e.tie_breakers?this.remapTieBreakers(e.tie_breakers):null,t};remapTieBreakers=e=>{let t={goldenGoals:[]};return t.goldenGoals=e.golden_goals.map(n=>({minute:n.minute,matchId:n.match_id,matchModel:null,playerId:n.player_id,playerModel:null,goalType:n.goal_type})),t};remapMarketsResults=e=>{let t=[];return e.forEach(n=>{let o={matchId:n.match_id,market:n.market,result:this.remapMarketResult(n.market,n.result),matchModel:null,playerModels:[]};t.push(this.deleteUnusefulField(o))}),t};remapMarketResult=(e,t)=>{if(Cd.includes(e))return t[0];if(wt.includes(e))return t;if(t[0]==="true")return!0;if(t[0]==="false")return!1};deleteUnusefulField=e=>((!wt.includes(e.market)||this.isPlayerMarketWithNoResult(e.market,e.result))&&delete e.playerModels,e);isPlayerMarketWithNoResult=(e,t)=>wt.includes(e)&&t.length===0;remapResults=e=>{let t=new Jo;return t.matchId=e.match_id,t.outcome=e.outcome,t};remapTiebreaker=e=>{let t=new jt;return t.goldenGoal=e.golden_goal,t};remapTimeTiebreaker=e=>{let t=new vt;return t.timeTiebreaker=e,t};remapRelated=e=>e.map(t=>{let n=new jo;return n.entityId=t.entity_id,n.entityType=t.entity_type,n})};var ts=class{remapMetaData=e=>{let t=new Bi;return t.pagination.nextPageStartsAfter=e.pagination.next_page_starts_after,t.pagination.itemsPerPage=e.pagination.items_per_page,t}};var ei=class extends Me{apiSignInUrl=null;predictionRemapper=null;matchSummaryRemapper=null;gamesRemapper=null;metaRemapper=null;constructor(e,t){super(e,Oe(e.environment,"predictor"));this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}`,this.predictionRemapper=new ur(e,t),this.matchSummaryRemapper=new Wo(e,t),this.gamesRemapper=new es,this.metaRemapper=new ts}makeFootballPrediction=async e=>{try{let t=this.predictionRemapper.remapRequestBody(e),n=await this.instanceAuth.post(`/predictions${this.apiSignInUrl}`,JSON.stringify(t));return await this.predictionRemapper.remapResponseObjBody(n.data)}catch(t){throw console.warn("There was a problem making POST request: ",t),t.response}};getMatchSummary=async(e,t)=>{let n=de(t)?`/predictions/summary/${e}${this.apiSignInUrl}${fe()}`:`/predictions/summary/${e}${this.apiSignInUrl}`;try{let o=await this.instance.get(n);return this.matchSummaryRemapper.remapResponse(o.data)}catch(o){throw console.warn(`There was a problem fetching predictions for match: ${e} `,o),o.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 re,n=`/predictions${this.apiSignInUrl}`;e&&(n+=`${e.constructFiltersUrl()}`);let o=await this.instanceAuth.get(n);return t.meta=this.metaRemapper.remapMetaData(o.data.meta),t.data=await this.predictionRemapper.remapResponseArrayBody(o.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}catch(t){throw console.warn("There was a problem fetching own predictions",t),t.response}};getUserPredictions=async(e,t,n)=>{try{let o=new re,p=de(t)?`/predictions/users/${e}${this.apiSignInUrl}${fe()}`:`/predictions/users/${e}${this.apiSignInUrl}`;n&&(p+=`${n.constructFiltersUrl()}`);let d=await this.instance.get(p);return o.meta=this.metaRemapper.remapMetaData(d.data.meta),o.data=await this.predictionRemapper.remapResponseArrayBody(d.data.data),o}catch(o){throw console.warn(`There was a problem fetching predictions for user: ${e}`,o),o.response}};getUserPredictionsNoRemap=async(e,t)=>{try{return(await this.instance.get(`/predictions/users/${e}${this.apiSignInUrl}${t.constructFiltersUrl()}`)).data}catch(n){throw console.warn(`There was a problem fetching predictions for user: ${e}`,n),n.response}};getGames=async(e,t)=>{try{let n=de(t)?`/games/${this.apiSignInUrl}${e.constructFiltersUrl()}${fe()}`:`/games/${this.apiSignInUrl}${e.constructFiltersUrl()}`,o=await this.instance.get(n);return this.gamesRemapper.remapPaginatedGames(o.data)}catch(n){throw console.warn("There was a problem fetching the games list",n),n.response}};getGameById=async(e,t)=>{try{let n=de(t)?`/games/${e}${this.apiSignInUrl}${fe()}`:`/games/${e}${this.apiSignInUrl}`,o=await this.instance.get(n);return this.gamesRemapper.remapGamesListResponse(o.data)}catch(n){throw console.warn(`There was a problem fetching the following game: ${e}`,n),n.response}};getGamePredictions=async(e,t,n)=>{try{let o=new re,p=de(t)?`/games/${e}/predictions${this.apiSignInUrl}${fe()}`:`/games/${e}/predictions${this.apiSignInUrl}`;n&&(p+=`${n.constructFiltersUrl()}`);let d=await this.instance.get(p);return o.meta=this.metaRemapper.remapMetaData(d.data.meta),o.data=await this.predictionRemapper.remapResponseArrayBody(d.data.data),o}catch(o){throw console.warn(`There was a problem fetching the predictions for game: ${e}`,o),o.response}};getUserGameEditions=async(e,t)=>{try{let n=null,o=de(t)?`/games/${this.apiSignInUrl}${e.constructFiltersUrl()}${fe()}`:`/games/${this.apiSignInUrl}${e.constructFiltersUrl()}`,p=await this.instance.get(o);return p.data.data.forEach(d=>{d.type==="TOP_X"?n=this.gamesRemapper.remapPaginatedUserTopXEditions(p.data):d.type==="MATCH_QUIZ"&&(n=this.gamesRemapper.remapPaginatedUserMathQuizEditions(p.data))}),n}catch(n){throw console.warn("There was a problem fetching the games list",n),n.response}};getGameResults=async(e,t,n)=>{try{let o=de(t)?`/games/${e}/results/${this.apiSignInUrl}${fe()}`:`/games/${e}/results/${this.apiSignInUrl}`;n&&(o+=`${n.constructMainFiltersUrl()}`);let p=await this.instance.get(o);return this.gamesRemapper.remapPaginatedGameResults(p.data)}catch(o){throw console.warn(`There was a problem fetching the results for the following game: ${e}`,o),o.response}};getMarketResultsForGame=async(e,t)=>{let n=`/games/${e}/correct-results/${this.apiSignInUrl}`;de(t)&&(n+=`${fe()}`);try{let o=await this.instance.get(n);return this.gamesRemapper.remapGameMarketsResults(o.data.data)}catch(o){throw console.warn(`There was a problem fetching the markets correct results for the following game: ${e}`,o),o.response}}};var mr=class{gameInstanceId=null;fixtures=null};var ne=class extends Error{code=0;status=null;message=null;constructor(e,t,n){super();this.code=e,this.status=t,this.message=n}errorMessage=()=>this.message};var Ap=(n=>(n.ONE="1",n.X="x",n.TWO="2",n))(Ap||{}),xp=(n=>(n.ONE_X="1x",n.X_TWO="x2",n.ONE_TWO="12",n))(xp||{}),Op=(w=>(w.ONE_ONE="1/1",w.ONE_X="1/x",w.ONE_TWO="1/2",w.X_ONE="x/1",w.X_X="x/x",w.X_TWO="x/2",w.TWO_ONE="2/1",w.TWO_X="2/x",w.TWO_TWO="2/2",w))(Op||{});var is=class{matchId=null;market="BOTH_TEAMS_SCORE";matchType="FOOTBALL";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new it,this.prediction.value=t}};var rs=class{value};var ns=class{matchId=null;market="CORNERS_MATCH";matchType="FOOTBALL";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new rs,this.prediction.value=t}};var as=class{value=null};var os=class{matchId=null;market="DOUBLE_CHANCE";matchType="FOOTBALL";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new as,this.prediction.value=t}};var ss=class{value=null};var ls=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(e,t,n){this.matchId=e,this.market=t,this.prediction=new ss,this.prediction.value=n}};var ps=class{value=null};var cs=class{matchId=null;market="HT_FT";matchType="FOOTBALL";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new ps,this.prediction.value=t}};var us=class{matchId=null;market="PENALTY_MATCH";matchType="FOOTBALL";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new it,this.prediction.value=t}};var ms=class{matchId=null;market="RED_CARD_MATCH";matchType="FOOTBALL";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new it,this.prediction.value=t}};var ti=class{validateBodyFields=(e,t)=>{let n=Object.keys(t),o=Object.keys(new mr);switch(e){case"MATCH_QUIZ":n.forEach(g=>{o.includes(g)||this.throwInvalidParamException([g])});break;case"TOP_X":let d=t;d.fixtures.forEach(g=>this.validateMarketTopX(g.market));let y="tiebreaker";n.includes(y)&&d.tiebreaker&&this.validateTiebreaker(d.tiebreaker),n.forEach(g=>{g!=="tiebreaker"&&!o.includes(g)&&this.throwInvalidParamException([g])});break}let p=o.filter(d=>!n.includes(d));return p.length&&this.throwMissingFieldsException("game prediction body",p),t.fixtures.forEach(d=>{this.validateFixtureFields(d)}),t};validateFixture=(e,t,n,o)=>{this.validateMarket(t);let p=Object.values(Ap),d=Object.values(Op),y=Object.values(xp);if(t==="FT_1X2"||t==="HT_1X2"){if(p.includes(n))return new ls(e,t,n)}else if(t==="HT_FT"){if(d.includes(n))return new cs(e,n)}else if(t==="DOUBLE_CHANCE"){if(y.includes(n))return new os(e,n)}else if(t==="CORRECT_SCORE"||t==="CORRECT_SCORE_ADVANCED"||t==="CORRECT_SCORE_HT"){if(typeof n=="string"&&/\d+:\d+/.test(n))return new Zt(e,t,n)}else if(t==="CORNERS_MATCH"){if(typeof n=="number")return new ns(e,n)}else if(t==="BOTH_TEAMS_SCORE"){if(this.isPredictionBoolean(n))return new is(e,n)}else if(t==="RED_CARD_MATCH"){if(this.isPredictionBoolean(n))return new ms(e,n)}else if(t==="PENALTY_MATCH"){if(this.isPredictionBoolean(n))return new us(e,n)}else if(wt.includes(t)){let g="OWN_GOAL";if(this.validatePlayerId(t,o),t===Zr&&this.isPredictionBoolean(n)){let w=o&&o===g?g:o;return new tt(e,t,n,w)}if(o&&this.isPredictionBoolean(n))return new tt(e,t,n,o)}else if(Td.includes(t)){if(this.isPredictionBoolean(n))return new or(e,t,n)}else if(Ed.includes(t)&&this.isPredictionBoolean(n))return new ar(e,t,n);this.throwInvalidPredictionException(n,t)};validateFixtureFields=e=>{let t=Object.keys(e);t.forEach(o=>{Sp.includes(o)||this.throwInvalidParamException([o])});let n=Sp.filter(o=>{if(o!=="matchType"&&!t.includes(o))return o});n.length&&this.throwMissingFieldsException("fixtures",n),this.validatePredictionKey(e.market,e.prediction)};validateTiebreaker=e=>{let t=Object.keys(e);(!t.length||typeof e!="object")&&this.throwInvalidType("tiebreaker","object");let n=Object.keys(new jt)[0];t.forEach(o=>{n!==o&&this.throwInvalidParamException([o])}),t.includes(n)||this.throwMissingFieldsException("tiebreaker",[n]),typeof e.goldenGoal!="number"&&this.throwInvalidType("goldenGoal","number")};validatePredictionKey=(e,t)=>{if(typeof t=="object"){let n=Object.keys(t),o=["value"];if(n.length||this.throwMissingFieldsException("prediction",o),n.length===1&&!n.includes(o[0])&&this.throwInvalidParamException(n),n.length>1){wt.includes(e)&&o.push("playerId");let p=n.filter(d=>!o.includes(d));p.length&&this.throwInvalidParamException(p)}}else this.throwInvalidType("prediction","object")};validatePlayerId=(e,t)=>{let n="playerId";e!==Zr&&(t||this.throwInvalidParamException([n]),typeof t!="string"&&this.throwInvalidType(n,"string"))};validateMarket=e=>{Object.values(Pe).includes(e)||this.throwInvalidMarketException(e)};validateMarketTopX=e=>{e!=="CORRECT_SCORE"&&e!=="CORRECT_SCORE_ADVANCED"&&this.throwInvalidMarketException(e,"TOP_X")};isPredictionBoolean=e=>typeof e=="boolean";throwInvalidPredictionException=(e,t)=>{let n=Ad(e,t);throw new ne(400,"INVALID_PREDICTION",n)};throwInvalidMarketException=(e,t)=>{let n=null;throw t&&t==="TOP_X"?n=xd(e):n=Vo(e),new ne(400,"INVALID_MARKET",n)};throwInvalidParamException=e=>{let t=Od(e);throw new ne(400,"INVALID_FIELD",t)};throwMissingFieldsException=(e,t)=>{let n=Bd(e,t);throw new ne(400,"INVALID_FIELD",n)};throwInvalidType=(e,t)=>{let n=Ld(e,t);throw new ne(400,"INVALID_TYPE",n)}};var fs=class{predictorHttps=null;clientHttps=null;idMapping=null;predictorService=null;predictorValidator=null;constructor(e,t,n,o){this.predictorHttps=t,this.idMapping=o,this.clientHttps=n,this.predictorValidator=new ti,this.predictorService=new _t(e,o)}makeFootballPrediction=async(e,t,n,o)=>{let p=this.predictorValidator.validateFixture(e,t,n,o),d=new mr;if(this.idMapping.idSchema!=="native"){let y=p.matchId,g="",w=await this.predictorService.remapMatchIdToNative([y]);if(p.matchId=w[0],!p.matchId)throw new ne(400,"INVALID_FIELD","Match id is invalid!").errorMessage();if(p instanceof tt&&p.prediction.playerId!=="OWN_GOAL"&&(p.prediction.playerId&&(g=p.prediction.playerId,p.prediction.playerId=await this.predictorService.remapPlayerIdToNative([g])),p.market!==Zr&&!p.prediction.playerId))throw new ne(400,"INVALID_FIELD","Player id is invalid!").errorMessage();d.fixtures=[p];let v=await this.predictorHttps.makeFootballPrediction(d);return v.fixtures.forEach(S=>{S.prediction.playerId&&S.prediction.playerId!=="OWN_GOAL"&&(S.prediction.playerId=g),S.matchId=y}),v}else return d.fixtures=[p],await this.predictorHttps.makeFootballPrediction(d)};getMatchSummary=async(e,t)=>{if(this.idMapping.idSchema!=="native"){let o=(await this.predictorService.remapMatchIdToNative([e]))[0],p=await this.predictorHttps.getMatchSummary(o,t);p.matchId=e;let d=p.predictions,y=await this.predictorService.remapPlayerIdToIdSchema(d);return p.predictions=y,p}else return await this.predictorHttps.getMatchSummary(e,t)};getMarketSummary=async(e,t,n,o)=>{try{let p=await this.getMatchSummary(e,o);return this.predictorService.getMarketSummary(p,t,n)}catch(p){return p.message}};getConfig=async()=>{let e=await this.clientHttps.getConfig("predictor");return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(e):e};deleteFootballPrediction=async e=>await this.predictorHttps.deleteFootballPrediction(e);getMyPredictions=async e=>{let t=this.predictorService.initPredictionsFilters(e,"user");return await this.predictorHttps.getMyPredictions(t)};getMyPredictionsForMatches=async(e,t)=>{if(this.predictorService.areIdsExceeded(e))throw new ne(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.").errorMessage();this.idMapping.idSchema!=="native"&&(e=await this.predictorService.remapMatchIdToNative([...e]));let n=this.predictorService.initPredictionsFilters(t,"matches",e);return await this.predictorHttps.getMyPredictions(n)};getMyCurrentPredictions=async e=>{let t=this.predictorService.initPredictionsFilters(e,"current");return await this.predictorHttps.getMyPredictions(t)};getMyPastPredictions=async e=>{let t=this.predictorService.initPredictionsFilters(e,"past");return await this.predictorHttps.getMyPredictions(t)};getUserPredictions=async(e,t,n)=>{let o=this.predictorService.initPredictionsFilters(t,"user");return await this.predictorHttps.getUserPredictions(e,n,o)};getUserCurrentPredictions=async(e,t,n)=>{let o=this.predictorService.initPredictionsFilters(t,"current");return await this.predictorHttps.getUserPredictions(e,n,o)};getUserPastPredictions=async(e,t,n)=>{let o=this.predictorService.initPredictionsFilters(t,"past");return await this.predictorHttps.getUserPredictions(e,n,o)};getUserPredictionsForMatches=async(e,t,n,o)=>{if(this.predictorService.areIdsExceeded(t))throw new ne(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.").errorMessage();this.idMapping.idSchema!=="native"&&(t=await this.predictorService.remapMatchIdToNative([...t]));let p=this.predictorService.initPredictionsFilters(n,"matches",t);return await this.predictorHttps.getUserPredictions(e,o,p)}};var hs=class{predictorHttps=null;clientHttps=null;predictorFacade=null;idMapping=null;constructor(e){this.idMapping=new ae(e),this.predictorHttps=new ei(e,this.idMapping),this.clientHttps=new et(e),this.predictorFacade=new fs(e,this.predictorHttps,this.clientHttps,this.idMapping)}makeFootballPrediction=async(e,t,n,o)=>await this.predictorFacade.makeFootballPrediction(e,t,n,o);getMatchSummary=async(e,t)=>await this.predictorFacade.getMatchSummary(e,t);getMarketSummary=async(e,t,n,o)=>await this.predictorFacade.getMarketSummary(e,t,n,o);getConfig=async()=>await this.predictorFacade.getConfig();deleteFootballPrediction=async e=>await this.predictorFacade.deleteFootballPrediction(e);getMyPredictions=async e=>await this.predictorFacade.getMyPredictions(e);getMyCurrentPredictions=async e=>await this.predictorFacade.getMyCurrentPredictions(e);getMyPastPredictions=async e=>await this.predictorFacade.getMyPastPredictions(e);getMyPredictionsForMatches=async(e,t)=>await this.predictorFacade.getMyPredictionsForMatches(e,t);getUserPredictions=async(e,t,n)=>await this.predictorFacade.getUserPredictions(e,t,n);getUserCurrentPredictions=async(e,t,n)=>await this.predictorFacade.getUserCurrentPredictions(e,t,n);getUserPastPredictions=async(e,t,n)=>await this.predictorFacade.getUserPastPredictions(e,t,n);getUserPredictionsForMatches=async(e,t,n,o)=>await this.predictorFacade.getUserPredictionsForMatches(e,t,n,o)};var gs=class{rankType=null;fromDate=null;toDate=null;pagination=new Qi};var dr=class{position=null;profileId=null;profileModel=null;points=null;predictionsMade=null};var ys=class{remapResponse=e=>(e.meta=this.remapMeta(e.meta),e.data=this.remapData(e.data),e);remapMeta=e=>{let t=new gs;return t.rankType=e.rank_type,t.fromDate=e.from_date,t.toDate=e.to_date,t.pagination.currentPage=e.pagination.current_page,t.pagination.itemsPerPage=e.pagination.items_per_page,t.pagination.totalItems=e.pagination.total_items,t.pagination.numberOfPages=e.pagination.number_of_pages,t};remapData=e=>{let t=[];return e.forEach(n=>{let o=new dr;o.position=n.position,o.profileId=n.profile_id,o.points=n.points,o.predictionsMade=n.predictions_made,t.push(o)}),t}};var Ms=class extends dr{id=null;rankType=null;model=null;gameType=null};var bs=class{remapRankings=e=>(e.meta=this.remapMeta(e.meta),e.data=this.remapData(e.data),e);remapMeta=e=>{let t=new Jt;return t.pagination.currentPage=e.pagination.current_page,t.pagination.itemsPerPage=e.pagination.items_per_page,t.pagination.numberOfPages=e.pagination.number_of_pages,t.pagination.totalItems=e.pagination.total_items,t};remapData(e){let t=[];return e.forEach(n=>{let o=new Ms;o.id=n.id,o.rankType=n.rank_type,o.position=n.position,o.points=n.points,o.gameType=n.game_type,delete o.profileId,delete o.profileModel,delete o.predictionsMade,t.push(o)}),t}};var ws=class{id=null;name=null;description=null;type=null;fromDate=null;toDate=null;markets=[];teamIds=[];matchIds=[];gameIds=[];gameTypes=[];competitionIds=[];excludedProfileIds=[];rules=null;flags=null;images=new pr;status=null;automaticallyChangeStatus=!0};var vs=class{remapResponse=e=>{let t=[];return e.forEach(n=>{let o=new ws;o.id=n.id,o.name=n.name,o.description=n.description,o.type=n.type,o.fromDate=n.from_date,o.toDate=n.to_date,o.markets=n.markets?n.markets:null,o.teamIds=n.team_ids?n.team_ids:null,o.matchIds=n.match_ids?n.match_ids:null,o.gameIds=n.game_ids?n.game_ids:null,o.gameTypes=n.game_types?n.game_types:null,o.competitionIds=n.competition_ids?n.competition_ids:null,o.excludedProfileIds=n.excluded_profile_ids?n.excluded_profile_ids:null,o.rules=n.rules?n.rules:null,o.flags=n.flags?n.flags:null,o.images=n.images?n.images:null,o.status=n.status?n.status:null,o.automaticallyChangeStatus=n.automatically_change_status,t.push(o)}),t};remapMeta=e=>{let t={};return t.totalItems=e.pagination.total_items,t}};var _s=class{position=null;points=null;predictionsMade=null;profileId=null;profileModel=null;successRatePercent=null};var Is=class{remapHighestSuccessRate=e=>e.map(t=>{let n=new _s;return n.position=t.position,n.points=t.points,n.predictionsMade=t.predictions_made,n.profileId=t.profile_id,n.successRatePercent=t.success_rate_percent,n})};var Ps=class extends Me{apiSignInUrl=null;templateRemapper=null;leaderboardRemapper=null;rankingsRemapper=null;highestSuccessRateRemapper=null;constructor(e){super(e,Oe(e.environment,"loyalty"));this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}`,this.templateRemapper=new vs,this.leaderboardRemapper=new ys,this.rankingsRemapper=new bs,this.highestSuccessRateRemapper=new Is}getTemplates=async(e,t)=>{try{let n=de(e)?`/leaderboard/templates/${this.apiSignInUrl}${fe()}`:`/leaderboard/templates/${this.apiSignInUrl}`,o=await this.instance.get(n);if(t){let p=JSON.parse(JSON.stringify(o.data));return p.meta=this.templateRemapper.remapMeta(o.data.meta),p.data=this.templateRemapper.remapResponse(o.data.data),p}return this.templateRemapper.remapResponse(o.data.data)}catch(n){throw console.warn("There was a problem fetching the list of templates",n),n.response}};getLeaderboard=async(e,t,n)=>{try{let o=de(t)?`/leaderboard/${e}/${this.apiSignInUrl}${fe()}`:`/leaderboard/${e}/${this.apiSignInUrl}`;n&&(o+=`${n.constructFiltersUrl()}`);let p=await this.instance.get(o),d=JSON.parse(JSON.stringify(p.data));return this.leaderboardRemapper.remapResponse(d)}catch(o){throw console.warn(`There was a problem fetching the leaderboard for the following template: ${e}`,o),o.response}};getLeaderboardForGame=async(e,t,n)=>{try{let o=de(t)?`/leaderboard/games/${e}/${this.apiSignInUrl}${fe()}`:`/leaderboard/games/${e}/${this.apiSignInUrl}`;n&&(o+=`${n.constructFiltersUrl()}`);let p=await this.instance.get(o),d=JSON.parse(JSON.stringify(p.data));return ta(d)}catch(o){throw console.warn(`There was a problem fetching the leaderboard for the following game: ${e}`,o),o.response}};getUserRankings=async(e,t,n)=>{let o=`/leaderboard/users/${e}/rankings/${this.apiSignInUrl}`;t&&(o+=`${t.constructFiltersUrl()}`),de(n)&&(o+=`${fe()}`);try{let p=await this.instance.get(o);return this.rankingsRemapper.remapRankings(p.data)}catch(p){throw console.warn(`There was a problem fetching the rankings for the following user: ${e}`,p),p.response}};getHighestSuccessRate=async(e,t)=>{let n=de(t)?`/statistics/top${this.apiSignInUrl}${fe()}`:`/statistics/top${this.apiSignInUrl}`;e&&(n+=`&market=${e}`);try{let o=await this.instance.get(n);return this.highestSuccessRateRemapper.remapHighestSuccessRate(o.data.data)}catch(o){throw console.warn("There was a problem fetching highest success rate",o),o.response}}};var Rs=class{general;predictor;topX;matchQuiz};var fr=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 Fs=class extends fr{sortOrder=null;rankType=null;leaderboardIds=null;gameType=null;constructor(e){super(e);this.sortOrder=e.sortOrder,this.rankType=e.rankType,this.leaderboardIds=e.leaderboardIds,this.gameType=e.type&&e.type.toLowerCase()==="game"?e.gameType:null}constructFiltersUrl=()=>{let e=super.constructFiltersUrl();return this.sortOrder&&(e+="&",e+=`sort_order=${this.sortOrder}`),this.rankType&&(e+="&",e+=`rank_type=${this.rankType}`),this.leaderboardIds&&(e+="&",e+=`type_ids=${this.leaderboardIds.join(",")}`),this.gameType&&(e+="&",e+=`game_type=${this.gameType}`),e}};var Ss=class{idMappingService=null;profileNamespace=null;constructor(e){this.idMappingService=new ae(e),this.profileNamespace=new er(e)}remapTemplatesIds=async e=>{if(e.length>0){let t=[],n=[],o=[],p=[],d=[],y=[];e.forEach(v=>{v.teamIds&&v.teamIds.length>0?t=[...t,...v.teamIds]:v.matchIds&&v.matchIds.length>0?o=[...o,...v.matchIds]:v.competitionIds&&v.competitionIds.length>0&&(d=[...d,...v.competitionIds])});let g={team:t,match:o,competition:d},w=await this.idMappingService.idMappingFacade.getEntitiesByIds(g,"native",this.idMappingService.idSchema);return n=[...w.team],p=[...w.match],y=[...w.competition],e.forEach(v=>{v.teamIds&&v.teamIds.length>0?v.teamIds=v.teamIds.map(S=>S=w.team.shift()):v.matchIds&&v.matchIds.length>0?v.matchIds=v.matchIds.map(S=>S=w.match.shift()):v.competitionIds&&v.competitionIds.length>0&&(v.competitionIds=v.competitionIds.map(S=>S=w.competition.shift()))}),e}return e};addProfileModelToLeaderboad=async e=>{if(e.length>0){let t=[],n=[];e.forEach(p=>{t.push(p.profileId)});let o=await this.profileNamespace.getByIds(t);return e.forEach(p=>{o.forEach(d=>{d.id===p.profileId&&(delete d.interests,p.profileModel=d)}),p.profileModel||(p.profileModel=null),n.push(p)}),n}return e};buildClientBadges=e=>{let t=new Rs;return t.general=this.extractEnabledBadgesId(e.general),t.predictor=this.extractEnabledBadgesId(e.predictor),t.topX=this.extractEnabledBadgesId(e.topX),t.matchQuiz=this.extractEnabledBadgesId(e.matchQuiz),t};initFilters=(e,t)=>{switch(t){case"loyalty":e&&(e=new fr(e));break;case"rankings":e&&(e=new Fs(e));break}return e};addProfileModelToHighestSuccessRate=async e=>{let t=e.map(o=>o.profileId),n=await this.profileNamespace.getByIds(t);return e.map(o=>(n.forEach(p=>{p.id===o.profileId&&(delete p.interests,o.profileModel=p)}),o))};extractRankingsIdsMap=e=>{let t=[],n=[],o=[];return e.forEach(p=>{p.rankType==="GAME"&&p.gameType==="TOP_X"?t.push(p.id):p.rankType==="GAME"&&p.gameType==="MATCH_QUIZ"?n.push(p.id):p.rankType==="TEMPLATE"&&o.push(p.id)}),[t,n,o]};setModelsForUserRankings=(e,t,n,o)=>(o.data.forEach(p=>{p.gameType==="MATCH_QUIZ"&&t?p.model=t.filter(d=>d.id===p.id)[0]:p.gameType==="TOP_X"&&e?p.model=e.filter(d=>d.id===p.id)[0]:p.rankType==="TEMPLATE"&&n&&(p.model=n.filter(d=>d.id===p.id)[0])}),o);extractEnabledBadgesId=e=>{let t=[];return e.forEach(n=>{n.enabled&&t.push(n.id)}),t}};var Ts=class{validateMarket=e=>{if(!Object.keys(Pe).includes(e)){let n=Vo(e);throw new ne(400,"INVALID_MARKET",n)}}};var hr=class{idMapping=null;predictorHttps=null;predictorService=null;predictorValidator=null;clientHttps=null;constructor(e,t){this.idMapping=t,this.predictorValidator=new ti,this.predictorHttps=new ei(e,t),this.predictorService=new _t(e,t),this.clientHttps=new et(e)}getConfig=async()=>{let e=await this.clientHttps.getConfig("topX");return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(e):e};getGames=async(e,t)=>{t=t||!1;let n=this.predictorService.initGameFilters("TOP_X",e),o=await this.predictorHttps.getGames(n,t);return await this.predictorService.remapMatchIdsFixtures(o)};getGameById=async(e,t)=>{t=t||!1;let n=await this.predictorHttps.getGameById(e,t);return await this.predictorService.remapMatchIdsFixtures(n)};getGamePredictions=async(e,t,n)=>(n=n||!1,t&&(t.type&&delete t.type,t.status&&delete t.status,t=new Re(t)),await this.predictorHttps.getGamePredictions(e,n,t));getGameResults=async(e,t,n)=>{n=n||!1,t&&(t=new rt(t));let o=await this.predictorHttps.getGameResults(e,n,t);return await this.predictorService.remapMatchIdsFixtures(o)};getCurrentGameResults=async e=>{e=e||!1;let t={status:"OPEN",type:"TOP_X"};t=new rt(t);let n=await this.predictorHttps.getGames(t,e),o=this.predictorService.getCurrentGameId(n);return(await this.getGameResults(o,null,e)).data[0]};play=async e=>{let t=new cr(e);if(t=this.predictorValidator.validateBodyFields("TOP_X",t),t.fixtures=t.fixtures.map(o=>this.predictorValidator.validateFixture(o.matchId,o.market,o.prediction.value)),this.idMapping.idSchema!=="native"){let o=[];t.fixtures.forEach(d=>o.push(d.matchId));let p=await this.predictorService.remapMatchIdToNative(o);t.fixtures.forEach(d=>d.matchId=p.shift())}let n=await this.predictorHttps.makeFootballPrediction(t);return n.fixtures.forEach(o=>{o.matchId=o.matchModel.id}),n};delete=async e=>await this.predictorHttps.deleteFootballPrediction(e);getMyGameEditions=async(e,t)=>{e&&e.limit&&this.validateLimitFilterOnGames(e.limit),t=t||!1;let n=this.predictorService.initGameTypePredictions("TOP_X",e),o=[],p=await this.predictorHttps.getMyPredictionsNoRemap(n);if(p.data.length>0){p.data.forEach(g=>{g.game_instance_id&&o.push(g.game_instance_id)});let d=this.predictorService.initGameFilters("TOP_X",null,o),y=await this.predictorHttps.getUserGameEditions(d,t);return await this.predictorService.addPredictionProp(p,y)}else return new re};getMyGamePrediction=async e=>{let t=this.predictorService.initGameTypePredictions("TOP_X"),n=await this.predictorHttps.getMyPredictions(t);if(n.data.length>0){let o=n.data.filter(p=>p.gameInstanceId===e);return o.length?o[0]:null}return null};getUserGameEditions=async(e,t,n)=>{t&&t.limit&&this.validateLimitFilterOnGames(t.limit),n=n||!1;let o=this.predictorService.initGameTypePredictions("TOP_X",t),p=[],d=await this.predictorHttps.getUserPredictionsNoRemap(e,o);if(d.data.length>0){d.data.forEach(w=>{w.game_instance_id&&p.push(w.game_instance_id)});let y=this.predictorService.initGameFilters("TOP_X",null,p),g=await this.predictorHttps.getUserGameEditions(y,n);return await this.predictorService.addPredictionProp(d,g)}else return new re};getUserGamePrediction=async(e,t,n)=>{n=n||!1;let o=this.predictorService.initGameTypePredictions("TOP_X"),p=await this.predictorHttps.getUserPredictions(e,n,o);if(p.data.length>0){let d=p.data.filter(y=>y.gameInstanceId===t);return d.length?d[0]:null}else return null};getMarketsResultsForGame=async(e,t)=>{let n=await this.predictorHttps.getMarketResultsForGame(e,t);return await this.predictorService.completeGameMarketResults(n,"TOP_X")};validateLimitFilterOnGames=e=>{if(e>50)throw new ne(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.")}};var gr=class{predictorHttps=null;predictorService=null;idMapping=null;clientHttps=null;predictorValidator=null;constructor(e){this.predictorValidator=new ti,this.idMapping=new ae(e),this.predictorHttps=new ei(e,this.idMapping),this.predictorService=new _t(e,this.idMapping),this.clientHttps=new et(e)}getConfig=async()=>{let e=await this.clientHttps.getConfig("matchQuiz");return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(e):e};play=async e=>{e=this.predictorValidator.validateBodyFields("MATCH_QUIZ",e);let t=e.fixtures.map(n=>this.predictorValidator.validateFixture(n.matchId,n.market,n.prediction.value,n.prediction.playerId));if(t&&t.length&&this.idMapping.idSchema!=="native"){let n=[],o=[];t.forEach(y=>{n.push(y.matchId),y instanceof tt&&y.prediction.playerId&&y.prediction.playerId!=="OWN_GOAL"&&o.push(y.prediction.playerId)});let p=await this.predictorService.remapMatchIdToNative(n),d={};o&&o.length>0&&(d=await this.predictorService.remapPlayerIdMapToNative(o)),t.forEach((y,g)=>{y.matchId=p[g],y instanceof tt&&y.prediction.playerId!=="OWN_GOAL"&&(y.prediction.playerId=d[y.prediction.playerId])})}return e.fixtures=t,await this.predictorHttps.makeFootballPrediction(e)};delete=async e=>await this.predictorHttps.deleteFootballPrediction(e);getGames=async(e,t)=>{t=t||!1;let n=this.predictorService.initGameFilters("MATCH_QUIZ",e),o=await this.predictorHttps.getGames(n,t);return await this.predictorService.remapMatchIdsFixtures(o)};getGameById=async(e,t)=>{t=t||!1;let n=await this.predictorHttps.getGameById(e,t);return await this.predictorService.remapMatchIdsFixtures(n)};getGamePredictions=async(e,t,n)=>(n=n||!1,t&&(t.type&&delete t.type,t.status&&delete t.status,t=new Re(t)),await this.predictorHttps.getGamePredictions(e,n,t));getGameResults=async(e,t,n)=>{n=n||!1,t&&(t=new lr(t));let o=await this.predictorHttps.getGameResults(e,n,t);return await this.predictorService.remapMatchIdsFixtures(o)};getCurrentGameResults=async e=>{e=e||!1;let t={status:"OPEN",type:"MATCH_QUIZ"};t=new rt(t);let n=await this.predictorHttps.getGames(t,e),o=this.predictorService.getCurrentGameId(n);return(await this.getGameResults(o,null,e)).data[0]};getMyGameEditions=async(e,t)=>{e&&e.limit&&this.validateLimitFilterOnGames(e.limit),t=t||!1;let n=this.predictorService.initGameTypePredictions("MATCH_QUIZ",e),o=[],p=await this.predictorHttps.getMyPredictionsNoRemap(n);if(p.data.length>0){p.data.forEach(g=>{g.game_instance_id&&o.push(g.game_instance_id)});let d=this.predictorService.initGameFilters("MATCH_QUIZ",null,o),y=await this.predictorHttps.getUserGameEditions(d,t);return await this.predictorService.addPredictionProp(p,y)}else return new re};getMyGamePrediction=async e=>{let t=this.predictorService.initGameTypePredictions("MATCH_QUIZ"),n=await this.predictorHttps.getMyPredictions(t);if(n.data.length>0){let o=n.data.filter(p=>p.gameInstanceId===e);return o.length?o[0]:null}return null};getUserGameEditions=async(e,t,n)=>{t&&t.limit&&this.validateLimitFilterOnGames(t.limit),n=n||!1;let o=this.predictorService.initGameTypePredictions("MATCH_QUIZ",t),p=[],d=await this.predictorHttps.getUserPredictionsNoRemap(e,o);if(d.data.length>0){d.data.forEach(w=>{w.game_instance_id&&p.push(w.game_instance_id)});let y=this.predictorService.initGameFilters("MATCH_QUIZ",null,p),g=await this.predictorHttps.getUserGameEditions(y,n);return await this.predictorService.addPredictionProp(d,g)}else return new re};getUserGamePrediction=async(e,t,n)=>{n=n||!1;let o=this.predictorService.initGameTypePredictions("MATCH_QUIZ"),p=await this.predictorHttps.getUserPredictions(e,n,o);if(p.data.length>0){let d=p.data.filter(y=>y.gameInstanceId===t);return d.length?d[0]:null}else return null};getMarketsResultsForGame=async(e,t)=>{let n=await this.predictorHttps.getMarketResultsForGame(e,t);return await this.predictorService.completeGameMarketResults(n,"MATCH_QUIZ")};validateLimitFilterOnGames=e=>{if(e>50)throw new ne(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.")}};var Es=class{config=null;clientHttps=null;loyaltyHttps=null;loyaltyService=null;profileFacade=null;loyaltyValidator=null;idMapping=null;topXFacade=null;matchQuizFacade=null;constructor(e,t,n,o,p){this.config=e,this.clientHttps=t,this.loyaltyHttps=n,this.profileFacade=new Mt(p,o),this.loyaltyService=new Ss(this.config),this.loyaltyValidator=new Ts,this.idMapping=new ae(e),this.topXFacade=new hr(e,this.idMapping),this.matchQuizFacade=new gr(e)}getConfig=async()=>await this.clientHttps.getConfig("loyalty");getClientBadges=async()=>{let e=await this.getConfig();return this.loyaltyService.buildClientBadges(e.rewards.badges)};getTemplates=async e=>{let t=!0;if(this.config.idSchema==="native")return await this.loyaltyHttps.getTemplates(e,t);let n=await this.loyaltyHttps.getTemplates(e,t);return n.data=await this.loyaltyService.remapTemplatesIds([...n.data]),n};getTemplateById=async(e,t)=>{try{let n=!1,p=(await this.loyaltyHttps.getTemplates(t,n)).filter(y=>y.id===e);if(!p.length)throw new ne(400,"INVALID_TEMPLATE","Provided template ID does NOT exist! Try again with existing template ID.").errorMessage();return this.config.idSchema==="native"?p[0]:(await this.loyaltyService.remapTemplatesIds(p))[0]}catch(n){throw console.warn("There was a problem retrieving specified template: ",n),n}};getLeaderboard=async(e,t,n)=>{t=this.loyaltyService.initFilters(t,"loyalty");let o=await this.loyaltyHttps.getLeaderboard(e,n,t);return o.data=await this.loyaltyService.addProfileModelToLeaderboad(o.data),o};getLeaderboardForGame=async(e,t,n)=>{t=this.loyaltyService.initFilters(t,"loyalty");let o=await this.loyaltyHttps.getLeaderboardForGame(e,n,t);return o.data=await this.loyaltyService.addProfileModelToLeaderboad(o.data),o};getOwnRankings=async(e,t)=>{let{id:n}=await this.profileFacade.getOwn();return this.getUserRankings(n,e,t)};getUserRankings=async(e,t,n)=>{t=this.loyaltyService.initFilters(t,"rankings");let o=await this.loyaltyHttps.getUserRankings(e,t,n);return await this.getModelsForUserRankings(o)};getHighestSuccessRate=async(e,t)=>{e&&this.loyaltyValidator.validateMarket(e);let n=await this.loyaltyHttps.getHighestSuccessRate(e,t);return this.loyaltyService.addProfileModelToHighestSuccessRate(n)};getModelsForUserRankings=async e=>{let t=null,n=null,o=null,[p,d,y]=this.loyaltyService.extractRankingsIdsMap(e.data);if(y.length&&(t=(await this.getTemplates()).data.filter(w=>y.includes(w.id))),p.length){let g={gameIds:p};n=(await this.topXFacade.getGames(g)).data}if(d.length){let g={gameIds:d};o=(await this.matchQuizFacade.getGames(g)).data}return this.loyaltyService.setModelsForUserRankings(n,o,t,e)}};var Cs=class{clientHttps=null;profileHttps=null;loyaltyHttps=null;loyaltyFacade=null;localStorage=null;constructor(e){this.clientHttps=new et(e),this.profileHttps=new Ui(e),this.loyaltyHttps=new Ps(e),this.localStorage=new yt(e),this.loyaltyFacade=new Es(e,this.clientHttps,this.loyaltyHttps,this.profileHttps,this.localStorage)}getConfig=async()=>await this.loyaltyFacade.getConfig();getClientBadges=async()=>await this.loyaltyFacade.getClientBadges();getTemplates=async e=>await this.loyaltyFacade.getTemplates(e);getTemplateById=async(e,t)=>await this.loyaltyFacade.getTemplateById(e,t);getLeaderboard=async(e,t,n)=>await this.loyaltyFacade.getLeaderboard(e,t,n);getLeaderboardForGame=async(e,t,n)=>await this.loyaltyFacade.getLeaderboardForGame(e,t,n);getOwnRankings=async(e,t)=>await this.loyaltyFacade.getOwnRankings(e,t);getUserRankings=async(e,t,n)=>await this.loyaltyFacade.getUserRankings(e,t,n);getHighestSuccessRate=async(e,t)=>await this.loyaltyFacade.getHighestSuccessRate(e,t)};var As=class{topXFacade=null;idMapping=null;constructor(e){this.idMapping=new ae(e),this.topXFacade=new hr(e,this.idMapping)}getConfig=async()=>await this.topXFacade.getConfig();getGames=async(e,t)=>await this.topXFacade.getGames(e,t);getGameById=async(e,t)=>await this.topXFacade.getGameById(e,t);getGamePredictions=async(e,t,n)=>await this.topXFacade.getGamePredictions(e,t,n);getGameResults=async(e,t,n)=>await this.topXFacade.getGameResults(e,t,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,t)=>await this.topXFacade.getMyGameEditions(e,t);getMyGamePrediction=async e=>await this.topXFacade.getMyGamePrediction(e);getUserGameEditions=async(e,t,n)=>await this.topXFacade.getUserGameEditions(e,t,n);getUserGamePrediction=async(e,t,n)=>await this.topXFacade.getUserGamePrediction(e,t,n);getMarketsResultsForGame=async(e,t)=>await this.topXFacade.getMarketsResultsForGame(e,t)};var xs=class{matchQuizFacade=null;constructor(e){this.matchQuizFacade=new gr(e)}getConfig=async()=>await this.matchQuizFacade.getConfig();play=async e=>await this.matchQuizFacade.play(e);delete=async e=>await this.matchQuizFacade.delete(e);getGames=async(e,t)=>await this.matchQuizFacade.getGames(e,t);getGameById=async(e,t)=>await this.matchQuizFacade.getGameById(e,t);getGamePredictions=async(e,t,n)=>await this.matchQuizFacade.getGamePredictions(e,t,n);getGameResults=async(e,t,n)=>await this.matchQuizFacade.getGameResults(e,t,n);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,n)=>await this.matchQuizFacade.getUserGameEditions(e,t,n);getUserGamePrediction=async(e,t,n)=>await this.matchQuizFacade.getUserGamePrediction(e,t,n);getMarketsResultsForGame=async(e,t)=>await this.matchQuizFacade.getMarketsResultsForGame(e,t)};var an=class{action=null;page=null;limit=null;constructor(e){this.action=e.action?e.action:null,this.page=e.page?e.page:null,this.limit=e.limit?e.limit:null}constructFilterUrl=()=>{let e="";return this.action&&(e+="&",e+=`action=${this.action}`),this.page&&(e+="&",e+=`page=${this.page}`),this.limit&&(e+="&",e+=`limit=${this.limit}`),e}};var on=class{action=null;context=new Ji;constructor(e,t,n,o){this.action=e,this.context.tags=t,n&&(this.context.content=n),o&&(this.context.campaign=o)}};var Os=class{idSchema;idMapping;constructor(e){this.idSchema=e.idSchema,this.idMapping=new ae(e)}remapTagsIds=async(e,t,n)=>{let o={},p={},d=[];e.forEach(g=>{o.hasOwnProperty(g.type)||(o[g.type]=[],p[g.type]=[]),o[g.type].push(g.id),p[g.type].push(g)});let y=await this.idMapping.idMappingFacade.getEntitiesByIds(o,t,n);for(let[g,w]of Object.entries(p))w.forEach((v,S)=>{v.id=y[g][S],d.push(v)});return d}};var Bs=class{idSchema;activityHttps;activityService;constructor(e){this.idSchema=e.idSchema,this.activityHttps=new ji(e),this.activityService=new Os(e)}add=async(e,t,n,o)=>{if(this.idSchema!="native"){let d=JSON.parse(JSON.stringify(t)),y=await this.activityService.remapTagsIds(t,this.idSchema,"native"),g=new on(e,y,n,o),w=await this.activityHttps.createActivity(g);return w.context.tags=d,w}let p=new on(e,t,n,o);return this.activityHttps.createActivity(p)};delete=async e=>await this.activityHttps.deleteActivity(e);like=async(e,t,n)=>{let o="like";return await this.add(o,e,t,n)};dislike=async(e,t,n)=>{let o="dislike";return await this.add(o,e,t,n)};addPageview=async(e,t,n)=>{let o="page_view";return await this.add(o,e,t,n)};addContentConsumed=async(e,t,n)=>{let o="content_consumed";return await this.add(o,e,t,n)};addShare=async(e,t,n)=>{let o="share";return await this.add(o,e,t,n)};addComment=async(e,t,n)=>{let o="comment";return await this.add(o,e,t,n)};addClickAd=async(e,t,n)=>{let o="click_ad";return await this.add(o,e,t,n)};addConversion=async(e,t,n)=>{let o="conversion";return await this.add(o,e,t,n)};getOwn=async(e,t)=>{if(t=t||!1,e&&(e=new an(e)),this.idSchema!="native"){let n=await this.activityHttps.getOwnActivities(e,t);for(let o of n.data)await this.activityService.remapTagsIds(o.context.tags,"native",this.idSchema);return n}return await this.activityHttps.getOwnActivities(e,t)};getForUser=async(e,t,n)=>{if(n=n||!1,t&&(t=new an(t)),this.idSchema!="native"){let o=await this.activityHttps.getActivitiesForUser(e,t,n);for(let p of o.data)await this.activityService.remapTagsIds(p.context.tags,"native",this.idSchema);return o}return await this.activityHttps.getActivitiesForUser(e,t,n)}};var Ls=class{activityFacade;constructor(e){this.activityFacade=new Bs(e)}add=async(e,t,n,o)=>await this.activityFacade.add(e,t,n,o);delete=async e=>await this.activityFacade.delete(e);like=async(e,t,n)=>await this.activityFacade.like(e,t,n);dislike=async(e,t,n)=>await this.activityFacade.dislike(e,t,n);addPageview=async(e,t,n)=>await this.activityFacade.addPageview(e,t,n);addContentConsumed=async(e,t,n)=>await this.activityFacade.addContentConsumed(e,t,n);addShare=async(e,t,n)=>await this.activityFacade.addShare(e,t,n);addComment=async(e,t,n)=>await this.activityFacade.addComment(e,t,n);addClickAd=async(e,t,n)=>await this.activityFacade.addClickAd(e,t,n);addConversion=async(e,t,n)=>await this.activityFacade.addConversion(e,t,n);getOwn=async(e,t)=>await this.activityFacade.getOwn(e,t);getForUser=async(e,t,n)=>await this.activityFacade.getForUser(e,t,n)};function wB(s){let t=new No().validate(s);if((t.idSchema.validation==="missing"||t.idSchema.validation==="invalid")&&(console.warn(t.idSchema.message.text),s.idSchema="native"),(t.environment.validation==="missing"||t.environment.validation==="invalid")&&(console.warn(t.environment.message.text),s.environment="prod"),(t.lang.validation==="missing"||t.lang.validation==="invalid")&&(console.warn(t.lang.message.text),s.lang="en"),t.authProvider.validation==="invalid"&&console.warn(t.authProvider.message.text),t.isValid)return{profile:new er(s),football:new Do(s),predictor:new hs(s),loyalty:new Cs(s),topX:new As(s),matchQuiz:new xs(s),activity:new Ls(s)};N_(t)}var N_=s=>{let e="authProvider",t="isValid";Object.keys(s).forEach(n=>{let o=s[n];if(n!==t&&n!==e){if(o.message.type==="error")throw new Error(o.message.text)}else n!==t&&n===e&&Object.keys(new fi).forEach(p=>{if(o[p].message.type==="error")throw new Error(o[p].message.text)})})};export{wB as FansUnitedSDK};
24
24
  /**
25
25
  * @license
26
26
  * Lodash <https://lodash.com/>