1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/web-BTKjgNWi.js","assets/index-D7X09KaW.js","assets/web-DrnmiJwl.js","assets/web-zGdTQjwI.js","assets/react-Dz3Vtyqi.js","assets/web-BqPfuhyq.js","assets/questions-index-qKVbteC9.js","assets/questions-CrFJ2YoL.js","assets/questionConflicts-Dy7NvfCv.js","assets/web-BFHr-46P.js","assets/web-Cu_9C3mn.js","assets/web-DM1yJZq6.js","assets/client-BDfdeOeq.js","assets/footleXp-CPwbKYZl.js","assets/StoreBadge-DL3l1YWG.js","assets/wordleStatus-BOVqYAS7.js","assets/webpushVisitor-C990_5lI.js","assets/webpushVisitor-DsT0674R.css","assets/clubColour-CGVN3LDl.js","assets/preload-helper-3FF0Ycn8.js","assets/supabase-BIZ8dl4x.js","assets/main-ByhrPmYy.js","assets/main-vihrps-0.css","assets/SiteHeader-Dmn8OENO.js","assets/SiteHeader-C2BRGDzk.css","assets/mysteryPlayer-C2VIb23l.js","assets/trail-De0UO8zJ.js","assets/ReportButton-DnDe1PH-.js","assets/mysterySchedule-nut2p9VY.js","assets/index-B1a9aOMK.js","assets/web-Dloatx8e.js","assets/ReviewScreen-BUDCFAng.js","assets/ProfileScreen-Bn6CWcdL.js","assets/Login-DD3Ssnp1.js","assets/OnlineHubTab-VJzrI7KP.js","assets/profilePhotos-CIiQpZdg.js","assets/DailyScreen-Cy4otleR.js","assets/FootballWordle-CJulJwrh.js","assets/DailyDone-DQ72rQCI.js","assets/FootballWordle-Ddr1WGGF.css","assets/ResultsScreen-DTl_HEaG.js","assets/CountUp-_p3AJ3Dw.js","assets/ResultsCloseBtn-D8TTORnk.js","assets/stump-B17NR90a.js","assets/ModeResults-BFApqkXw.js","assets/SettingsScreen-DCaIAIqx.js","assets/ReviewScreens-p2A7mhbv.js","assets/ClubQuizScreen-HkNqqGuY.js","assets/PrivacyScreen-Ho_N78UW.js","assets/StumpScreen-c-K83JRY.js","assets/LocalPlay-D6zV9KZe.js","assets/TransferTrail-CZDDy5EP.js","assets/playerSearch-DbG2HV7i.js","assets/useKeyboardAwareInput-B8xXxFcT.js","assets/StadiumGame-D58yH4GI.js","assets/MysteryPlayer-DqUvSLE4.js","assets/OnlineMultiplayer-B80MS-91.js","assets/dailyDraw-n3hWIJZ2.js"])))=>i.map(i=>d[i]); 2import{j as t}from"./client-BDfdeOeq.js";import{r as l,R as me}from"./react-Dz3Vtyqi.js";import{M as jt,s as Ne,A as Ce,g as qt,T as br,F as Ll,S as El,a as Ho,c as Il,b as ql}from"./footleXp-CPwbKYZl.js";import{t as et,l as Is}from"./clubColour-CGVN3LDl.js";import{r as yt,C as Ze}from"./index-D7X09KaW.js";import{_ as le}from"./preload-helper-3FF0Ycn8.js";import{c as Rl}from"./supabase-BIZ8dl4x.js";import{c as Le,s as rr,a as or,b as ot,d as Da,m as $a,E as qs,e as Tl,
2n as Go,f as Qo,w as Vo,g as Jo,u as Ml}from"./main-ByhrPmYy.js";import{b as zr,c as Or,d as St,e as mn,M as gn,k as Ko,i as Bl,g as Pl,P as Dl,h as zl}from"./StoreBadge-DL3l1YWG.js";import{c as ze,B as Ol,g as _n,C as Wl,F as ma,v as Ul,e as $l,a as Rs,R as Ts,U as Ms}from"./webpushVisitor-C990_5lI.js";import{S as Hl}from"./SiteHeader-Dmn8OENO.js";import{a as Gl,b as Ql,l as Vl,m as Jl,M as sr}from"./mysteryPlayer-C2VIb23l.js";import{r as va,g as Kl,c as Yl}from"./wordleStatus-BOVqYAS7.js";import{g as vr,l as Bs,a as Zl}from"./trail-De0UO8zJ.js";import{R as Xl}from"./ReportButton-DnDe1PH-.js";import{M as ec,S as tc}from"./mysterySchedule-nut2p9VY.js";import{SplashScreen as ac}from"./index-B1a9aOMK.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="d41578cb-ce3c-42b0-af0c-6479a8e4941e",e._sentryDebugIdIdentifier="sentry-dbid-d41578cb-ce3c-42b0-af0c-6479a8e4941e")}catch{}})();/** 3 * @license lucide-react v0.383.0 - ISC 4 * 5 * This source code is licensed under the ISC license. 6 * See the LICENSE file in the root directory of this source tree. 7 */const nc=ze("BrickWall",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 9v6",key:"199k2o"}],["path",{d:"M16 15v6",key:"8rj2es"}],["path",{d:"M16 3v6",key:"1j6rpj"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M8 15v6",key:"1stoo3"}],["path",{d:"M8 3v6",key:"vlvjmk"}]]);/** 8 * @license lucide-react v0.383.0 - ISC 9 * 10 * This source code is licensed under the ISC license. 11 * See the LICENSE file in the root directory of this source tree. 12 */const Ps=ze("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);/** 13 * @license lucide-react v0.383.0 - ISC 14 * 15 * This source code is licensed under the ISC license. 16 * See the LICENSE file in the root directory of this source tree. 17 */const rc=ze("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** 18 * @license lucide-react v0.383.0 - ISC 19 * 20 * This source code is licensed under the ISC license. 21 * See the LICENSE file in the root directory of this source tree. 22 */const oc=ze("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** 23 * @license lucide-react v0.383.0 - ISC 24 * 25 * This source code is licensed under the ISC license. 26 * See the LICENSE file in the root directory of this source tree. 27 */const sc=ze("Flag",[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]]);/** 28 * @license lucide-react v0.383.0 - ISC 29 * 30 * This source code is licensed under the ISC license. 31 * See the LICENSE file in the root directory of this source tree. 32 */const ic=ze("Gamepad2",[["line",{x1:"6",x2:"10",y1:"11",y2:"11",key:"1gktln"}],["line",{x1:"8",x2:"8",y1:"9",y2:"13",key:"qnk9ow"}],["line",{x1:"15",x2:"15.01",y1:"12",y2:"12",key:"krot7o"}],["line",{x1:"18",x2:"18.01",y1:"10",y2:"10",key:"1lcuu1"}],["path",{d:"M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z",key:"mfqc10"}]]);/** 33 * @license lucide-react v0.383.0 - ISC 34 * 35 * This source code is licensed under the ISC license. 36 * See the LICENSE file in the root directory of this source tree. 37 */const Ds=ze("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** 38 * @license lucide-react v0.383.0 - ISC 39 * 40 * This source code is licensed under the ISC license. 41 * See the LICENSE file in the root directory of this source tree. 42 */const lc=ze("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/** 43 * @license lucide-react v0.383.0 - ISC 44 * 45 * This source code is licensed under the ISC license. 46 * See the LICENSE file in the root directory of this source tree. 47 */const zs=ze("Home",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]]);/** 48 * @license lucide-react v0.383.0 - ISC 49 * 50 * This source code is licensed under the ISC license. 51 * See the LICENSE file in the root directory of this source tree. 52 */const cc=ze("LandPlot",[["path",{d:"m12 8 6-3-6-3v10",key:"mvpnpy"}],["path",{d:"m8 11.99-5.5 3.14a1 1 0 0 0 0 1.74l8.5 4.86a2 2 0 0 0 2 0l8.5-4.86a1 1 0 0 0 0-1.74L16 12",key:"ek95tt"}],["path",{d:"m6.49 12.85 11.02 6.3",key:"1kt42w"}],["path",{d:"M17.51 12.85 6.5 19.15",key:"v55bdg"}]]);/** 53 * @license lucide-react v0.383.0 - ISC 54 * 55 * This source code is licensed under the ISC license. 56 * See the LICENSE file in the root directory of this source tree. 57 */const qn=ze("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/** 58 * @license lucide-react v0.383.0 - ISC 59 * 60 * This source code is licensed under the ISC license. 61 * See the LICENSE file in the root directory of this source tree. 62 */const dc=ze("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/** 63 * @license lucide-react v0.383.0 - ISC 64 * 65 * This source code is licensed under the ISC license. 66 * See the LICENSE file in the root directory of this source tree. 67 */const uc=ze("Newspaper",[["path",{d:"M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2",key:"7pis2x"}],["path",{d:"M18 14h-8",key:"sponae"}],["path",{d:"M15 18h-5",key:"95g1m2"}],["path",{d:"M10 6h8v4h-8V6Z",key:"smlsk5"}]]);/** 68 * @license lucide-react v0.383.0 - ISC 69 * 70 * This source code is licensed under the ISC license. 71 * See the LICENSE file in the root directory of this source tree. 72 */const fc=ze("Pencil",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** 73 * @license lucide-react v0.383.0 - ISC 74 * 75 * This source code is licensed under the ISC license. 76 * See the LICENSE file in the root directory of this source tree. 77 */const hc=ze("ScrollText",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** 78 * @license lucide-react v0.383.0 - ISC 79 * 80 * This source code is licensed under the ISC license. 81 * See the LICENSE file in the root directory of this source tree. 82 */const Wr=ze("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** 83 * @license lucide-react v0.383.0 - ISC 84 * 85 * This source code is licensed under the ISC license. 86 * See the LICENSE file in the root directory of this source tree. 87 */const mc=ze("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/** 88 * @license lucide-react v0.383.0 - ISC 89 * 90 * This source code is licensed under the ISC license. 91 * See the LICENSE file in the root directory of this source tree. 92 */const gc=ze("Star",[["polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",key:"8f66p6"}]]);/** 93 * @license lucide-react v0.383.0 - ISC 94 * 95 * This source code is licensed under the ISC license. 96 * See the LICENSE file in the root directory of this source tree. 97 */const pc=ze("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/** 98 * @license lucide-react v0.383.0 - ISC 99 * 100 * This source code is licensed under the ISC license. 101 * See the LICENSE file in the root directory of this source tree. 102 */const Os=ze("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** 103 * @license lucide-react v0.383.0 - ISC 104 * 105 * This source code is licensed under the ISC license. 106 * See the LICENSE file in the root directory of this source tree. 107 */const yc=ze("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** 108 * @license lucide-react v0.383.0 - ISC 109 * 110 * This source code is licensed under the ISC license. 111 * See the LICENSE file in the root directory of this source tree. 112 */const bc=ze("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),ga=[{id:"c01",bg:"#C8102E",ink:"#FFFFFF"},{id:"c02",bg:"#034694",ink:"#FFFFFF"},{id:"c03",bg:"#6C1D45",ink:"#FFFFFF"},{id:"c04",bg:"#0057B8",ink:"#FFFFFF"},{id:"c05",bg:"#FFB81C",ink:"#231F20"},{id:"c06",bg:"#00A398",ink:"#04231F"},{id:"c07",bg:"#7A1FA2",ink:"#FFFFFF"},{id:"c08",bg:"#E8541E",ink:"#1F0A02"},{id:"c09",bg:"#1B7F3B",ink:"#FFFFFF"},{id:"c10",bg:"#2E3192",ink:"#FFFFFF"},{id:"c11",bg:"#B0134D",ink:"#FFFFFF"},{id:"c12",bg:"#0E7C9E",ink:"#FFFFFF"},{id:"c13",bg:"#8C6A1F",ink:"#FFFFFF"},{id:"c14",bg:"#495A6B",ink:"#FFFFFF"},{id:"c15",bg:"#A31515",ink:"#FFFFFF"},{id:"c16",bg:"#3D2E86",ink:"#FFFFFF"}],Yo=new Map(ga.map(e=>[e.id,e]));function Ws(e){const a=String(e||"");let n=2166136261;for(let r=0;r<a.length;
112r+=1)n^=a.charCodeAt(r),n=Math.imul(n,16777619)>>>0;return n>>>0}function vc(e){return ga[Ws(e)%ga.length].id}function Us(e,a){if(e&&Yo.has(e))return Yo.get(e);const n=e||a||"";return n?ga[Ws(n)%ga.length]:ga[0]}const Dt={measured:"2026-09-11",n:112,median:.5746,anchors:[[0,52],[.3,60],[.3957,67],[.5014,72],[.5746,77],[.6539,83],[.7204,88],[.7981,93],[1,99]],mult:{easy:1,medium:1.25,hard:1.5},avgMult:1.2552,baseline:.7212},Ha=[{abbr:"EPL",cat:"PL",name:"Premier League",short:"Premier League",icon:"ð´ó §ó ¢ó ¥ó ®ó §ó ¿",color:"#3D195B"},{abbr:"UCL",cat:"UCL",name:"Champions League",short:"Champions League",icon:"â",color:"#123A8F"},{abbr:"NATIONS",cat:"WorldCup",name:"International",short:"International",icon:"ð",color:"#8A6D1B"},{abbr:"CLUBS",cat:"Clubs",name:"Clubs worldwide",short:"Club Football",icon:"ð¡ï¸",color:"#EE8707"},{abbr:"LEGENDS",cat:"Legends",name:"Legends & History",short:"Legends",icon:"ð",color:"#B03A2E"},{abbr:"RECORDS",cat:"Records",name:"Records & Managers",short:"Records",icon:"ð",color:"#1B7F79"}],wa={ChampionsLeague:"UCL",Euros:"WorldCup",LaLiga:"Clubs",SerieA:"Clubs",Bundesliga:"Clubs",Ligue1:"Clubs",SuperLig:"Clubs",Primeira:"Clubs",ClubQuiz:"Clubs",History:"Legends",Managers:"Records",Transfers:"Records"},pa=[{abbr:"EPL",cat:"PL",name:"Premier League",icon:"ð´ó §ó ¢ó ¥ó ®ó §ó ¿",color:"#3D195B"},{abbr:"LA LIGA",cat:"LaLiga",name:"La Liga",icon:"ðªð¸",color:"#EE8707"},{abbr:"SERIE A",cat:"SerieA",name:"Serie A",icon:"ð®ð¹",color:"#0578D3"},{abbr:"BUNDESLIGA",cat:"Bundesliga",name:"Bundesliga",icon:"ð©ðª",color:"#D20515"},{abbr:"LIGUE 1",cat:"Ligue1",name:"Ligue 1",icon:"ð«ð·",color:"#1B2447"},{abbr:"SÃPER LIG",cat:"SuperLig",name:"Süper Lig",icon:"ð¹ð·",color:"#E30A17"},{abbr:"PRIMEIRA",cat:"Primeira",name:"Primeira Liga",icon:"ðµð¹",color:"#046A38"}],Ur=new Set(pa.map(e=>e.cat));function $s(e){const a=pa.find(i=>i.cat===e);if(a)return a.color;const n=Ha.find(i=>i.cat===e);if(n)return n.color;const r=wa[e];if(r){const i=Ha.find(c=>c.cat===r)||pa.find(c=>c.cat===r);if(i)return i.color}return null}function wc(e){const a=$s(e);return a?{"--q-accent":Is(a)}:void 0}function xc(e){const a=$s(e);if(a)return{color:Is(a),background:et(a,.1),borderColor:et(a,.25)}}function Sc(e,a){const n=(e||"").length;return n>=10?{size:+(a*.8).toFixed(2),tracking:.2}:n>=8?{size:+(a*.88).toFixed(2),tracking:.4}:{size:a,tracking:1}}function Hs(e={},a){const n=a?pa.find(d=>d.cat===a):null;if(n)return n;const r=d=>Ga((e||{})[d]),c=pa.map(d=>({l:d,n:r(d.cat)})).sort((d,o)=>o.n-d.n)[0];return!c||c.n<=0?pa[0]:c.l}function Gs(e={},a){return[Hs(e,a),...Ha.slice(1)]}const kc=new Set(["chaos"]),Qs=new Set(Ha.map(e=>e.cat)),_c=new Set(["PL","UCL","WorldCup","Clubs"]);let wr={};function Cc(e){wr=e||{}}function jc(e){if(!e)return null;const a=e.realCat||e.cat;return _c.has(a)||Ur.has(a)?a:e.club&&wr[e.club]?wr[e.club]:Qs.has(a)?a:wa[a]?wa[a]:null}function Ac(e,a,n){const r=Gs(a||{},n),i=r[0].cat,c=e===i?e:Ur.has(e)?"Clubs":Qs.has(e)?e:wa[e]||null;return c&&(r.find(d=>d.cat===c)||{}).abbr||null}const Fc=3,Zo=20,ir=Dt.mult,Vt=Dt.avgMult,Vs=Dt.baseline;function Js(e){const n=(Number.isFinite(e)?e:Vs)/Vt,r=Dt.anchors;let i;if(n<=r[0][0])i=r[0][1];else if(n>=r[r.length-1][0])i=r[r.length-1][1];else{i=r[r.length-1][1];for(let c=1;c<r.length;c++)if(n<=r[c][0]){const[d,o]=r[c-1],[u,m]=r[c];i=u===d?m:o+(m-o)*(n-d)/(u-d);break}}return Math.max(40,Math.min(99,Math.round(i)))}const Nc={e:ir.easy,m:ir.medium,h:ir.hard,u:Vt};function Qt(e){if(!e)return{s:0,n:0};if(Number.isFinite(e.s)&&Number.isFinite(e.n)&&e.n>0)return{s:e.s,n:e.n};let a=0,n=0;const r=e.d;if(r&&typeof r=="object")for(const o of["e","m","h","u"]){const u=r[o];Array.isArray(u)&&(a+=Nc[o]*(u[0]||0),n+=u[1]||0)}const i=e.a||0,c=e.c||0,d=i-n;return d>0&&i>0&&(a+=Vt*(c/i)*d,n+=d),{s:a,n}}const Lc=300;function Ec(e={},a){if(!a||!(a.a>0)||!(a.c>=0)||a.c>a.a||a.a>=1&&!(a.c>0))return null;let n=0;for(const i of Object.values(e||{}))n+=Qt(i).n;if(a.a<=n)return null;const r=Math.min(Lc,a.a-n);return{s:Vt*(a.c/a.a)*r,n:r}}function Ic(e={},a){const n=Ks(e,a);if(n===e)return e;const r={};for(const[i,c]of Object.entries(n)){const d=Qt(e[i]),o=Math.round((c.n||0)-d.n),u=Math.round(((c.s||0)-d.s)/Vt),{s:m,n:p,...g}=c;if(o<=0){r[i]=g;continue}const k={...g.d||{}},b=Array.isArray(k.u)?k.u:[0,0];k.u=[(b[0]||0)+Math.max(0,Math.min(o,u)),(b[1]||0)+o],r[i]={...g,d:k}}return r}function Ks(e={},a){const n=Ec(e,a);if(!n)return e;let r=0;for(const c of Object.values(e||{}))r+=Qt(c).n;if(!(r>0))return e;const i={};for(const[c,d]of Object.entries(e||{})){const o=Qt(d),u=o.n/r;i[c]={...d,s:o.s+n.s*u,n:o.n+n.n*u}}return i}function Ga(e){if(!e)return 0;const a=e.d;let n=0;if(a&&typeof a=="object")for(const r of["e","m","h","u"])n+=Array.isArray(a[r])&&a[r][1]||0;
112return Math.max(n,e.a||0)}function Ys(e={}){return Object.values(e||{}).some(a=>Number.isFinite(a?.s)&&Number.isFinite(a?.n)&&a.n>0||a?.d&&typeof a.d=="object"&&["e","m","h","u"].some(n=>Array.isArray(a.d[n])&&(a.d[n][1]||0)>0))}function lr(e={},a=[],n){const r={...e||{}},i=(a||[]).filter(o=>o&&o.cat);if(!i.length)return r;let c=r;Ys(r)||(c=Ic(r,n));const d={...c};for(const o of i){const u=jc(o)||o.cat,m=d[u]||{c:0,a:0},p=o.isCorrect?1:0,g=o.diff==="easy"||o.diff==="hard"||o.diff==="medium"?o.diff:o.diff==="unknown"?"unknown":"medium",k={...m.d||{}},b=g==="unknown"?"u":g[0];k[b]=[((k[b]||[0,0])[0]||0)+p,((k[b]||[0,0])[1]||0)+1],d[u]={...m,d:k}}return d}function Xo(e){if(!e)return{c:0,n:0};if(Number.isFinite(e.rc)&&Number.isFinite(e.rn)&&e.rn>0)return{c:e.rc,n:e.rn};let a=0,n=0;const r=e.d;if(r&&typeof r=="object")for(const o of["e","m","h","u"]){const u=r[o];Array.isArray(u)&&(a+=u[0]||0,n+=u[1]||0)}const i=e.a||0,c=e.c||0,d=i-n;return d>0&&i>0&&(a+=c/i*d,n+=d),{c:a,n}}function qc(e={},a){let n=0,r=0,i=0;for(const c of Object.values(e||{})){const d=Qt(c);n+=d.s,r+=d.n,i+=Ga(c)}return{mean:(n+Vs*Zo)/(r+Zo),answered:i}}const es=8;function Rc(e,a=Dt.median){const{s:n,n:r}=Qt(e),i=Number.isFinite(a)?a:Dt.median,c=Math.max(.25,Math.min(.75,i))*Vt;return Js((n+c*es)/(r+es))}function Tc(e){return e>=75?"gold":e>=62?"silver":"bronze"}const cr={gold:{bg:"linear-gradient(160deg,#2a2410 0%,#0B0C10 100%)",accent:"#FFC107",text:"#FFF6E0",label:"GOLD"},silver:{bg:"linear-gradient(160deg,#1b212a 0%,#080a0f 100%)",accent:"#C7D2E0",text:"#EDF1F7",label:"SILVER"},bronze:{bg:"linear-gradient(160deg,#2a1a0e 0%,#0b0705 100%)",accent:"#D08A4E",text:"#F6E7D8",label:"BRONZE"}},Mc={elite:"gold",pro:"silver",prospect:"bronze"};function Zs(e){return cr[e]||cr[Mc[e]]||cr.silver}function Bc(e,a){if(!e&&!a)return null;const n={};for(const r of["e","m","h","u"]){const i=Array.isArray(e?.[r])?e[r]:[0,0],c=Array.isArray(a?.[r])?a[r]:[0,0];(i[1]||c[1])&&(n[r]=[(i[0]||0)+(c[0]||0),(i[1]||0)+(c[1]||0)])}return Object.keys(n).length?n:null}function xa(e={},a,n,r){const i=Hs(e,r).cat,c={};for(const[j,_]of Object.entries(e||{})){if(kc.has(j))continue;const w=j===i?j:Ur.has(j)?"Clubs":wa[j]||j,A=c[w]||{s:0,n:0,rc:0,rn:0,c:0,a:0},q=Qt(_),Z=Xo(_),W=Bc(A.d,_?.d);c[w]={s:A.s+q.s,n:A.n+q.n,rc:A.rc+Z.c,rn:A.rn+Z.n,c:A.c+(_?.c||0),a:A.a+(_?.a||0),...W?{d:W}:{}}}const d=Ys(e)?c:Ks(c,n),{mean:o,answered:u}=qc(d),m=o/Vt,p=Js(o),g=Gs(e,r).map(j=>{const _=d[j.cat],w=Ga(_);return{abbr:j.abbr,cat:j.cat,name:j.name,short:j.short||j.name,icon:j.icon,color:j.color,rating:Rc(_,m),answered:w,rated:w>=jt,provisional:w>=Fc&&w<jt}});let k=0,b=0;for(const j of Object.values(d)){const _=Xo(j);k+=_.c,b+=_.n}const N=u>=jt;return{ratings:g,overall:p,tier:N?Tc(p):"silver",answeredTotal:u,rated:N,accuracy:m,rawAccuracy:b>0?k/b:null,rawAnswered:b,rawCorrect:k,mean:o,calibration:{measured:Dt.measured,n:Dt.n}}}function Pc(e,a,n,r,i){const c=xa(e||{},void 0,n,i),d=xa(a||{},void 0,r,i),o=new Map(c.ratings.map(m=>[m.cat,m])),u=d.ratings.map(m=>{const p=o.get(m.cat);return{abbr:m.abbr,name:m.name,color:m.color,cat:m.cat,before:p?p.rating:m.rating,after:m.rating,shown:m.rated||m.provisional,wasShown:!!p&&(p.rated||p.provisional)}}).filter(m=>m.shown&&(m.before!==m.after||!m.wasShown));return{before:c.overall,after:d.overall,ratedBefore:c.rated,ratedAfter:d.rated,answered:d.answeredTotal,toRated:Math.max(0,jt-Math.floor(d.answeredTotal)),faces:u}}const Xs="biq_last_card_delta",ei=()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`};function Dc(e){try{e&&localStorage.setItem(Xs,JSON.stringify({day:ei(),delta:e}))}catch{}}function ts(){try{const e=JSON.parse(localStorage.getItem(Xs)||"null");return e&&e.day===ei()?e.delta:null}catch{return null}}function as(e,a=null,n="Ball IQ"){if(!e||!e.rated)return`Can you beat me at ${n}? â½`;const i=e.ratings.filter(u=>u.rated).sort((u,m)=>m.rating-u.rating)[0],c=a&&a.ratedAfter&&a.faces&&a.faces.find(u=>u.after>u.before),d=i?`${n} ${e.overall} · ${i.abbr} ${i.rating}`:`${n} ${e.overall}`,o=c?` â ${c.abbr} ${c.before} â ${c.after} today`:"";return`${d}${o}. Can you beat me? â½`}const ns="biq_pending_rounds";function zc(){let e=null;try{if(e=localStorage.getItem(ns),!e)return[];localStorage.removeItem(ns)}catch{return[]}let a;try{a=JSON.parse(e)}catch{return[]}if(!Array.isArray(a))return[];const n=new Set(Ha.map(i=>i.cat)),r=i=>n.has(i)?i:wa[i]||null;return a.filter(i=>i&&r(i.cat)&&typeof i.isCorrect=="boolean").slice(0,400).map(i=>({cat:r(i.cat),diff:i.diff==="easy"||i.diff==="hard"?i.diff:"medium",isCorrect:i.isCorrect}))}const ra=yt("Browser",{web:()=>le(()=>import("./web-BTKjgNWi.js"),__vite__mapDeps([0,1])).then(e=>new e.BrowserWeb)}),ua=yt("App",{web:()=>le(()=>
112import("./web-DrnmiJwl.js"),__vite__mapDeps([2,1])).then(e=>new e.AppWeb)}),Oc=yt("SignInWithApple",{web:()=>le(()=>import("./web-zGdTQjwI.js"),__vite__mapDeps([3,1,4])).then(e=>new e.SignInWithAppleWeb)}),Oa=yt("Preferences",{web:()=>le(()=>import("./web-BqPfuhyq.js"),__vite__mapDeps([5,1])).then(e=>new e.PreferencesWeb)}),Wc="https://blcisypmngimqkwxrrdm.supabase.co".trim(),Uc="sb_publishable_FluGERu-3n3KSIlgM37Jbg_P0KhDsiR".trim(),xr="sb-blcisypmngimqkwxrrdm-auth-token",ti=(()=>{try{return Ze.isNativePlatform()}catch{return!1}})(),Ut=new Map,$c=async e=>{try{return(await Oa.get({key:e})).value}catch{try{return(await Oa.get({key:e})).value}catch{return}}},$r={getItem:async e=>{if(Ut.has(e))return Ut.get(e);const a=await $c(e);if(a!=null)return Ut.set(e,a),a;let n=null;try{n=typeof localStorage<"u"?localStorage.getItem(e):null}catch{}if(n!=null){Ut.set(e,n);try{await Oa.set({key:e,value:n})}catch{}return n}return a===void 0||Ut.set(e,null),null},setItem:async(e,a)=>{Ut.set(e,a);try{await Oa.set({key:e,value:a})}catch{}},removeItem:async e=>{Ut.set(e,null);try{await Oa.remove({key:e})}catch{}try{typeof localStorage<"u"&&localStorage.removeItem(e)}catch{}}},$=Rl(Wc,Uc,{auth:{storageKey:xr,...ti?{storage:$r}:{}}});async function ai(){try{const e=ti?await $r.getItem(xr):typeof localStorage<"u"?localStorage.getItem(xr):null;if(!e)return null;const a=JSON.parse(e);return a?.user?.id?a:null}catch{return null}}const Hc=Object.freeze(Object.defineProperty({__proto__:null,nativeStorage:$r,readStoredSession:ai,supabase:$},Symbol.toStringTag,{value:"Module"}));typeof performance<"u"&&performance.now();const Gc=["fuck","shit","cunt","bitch","nigg","fag","faggot","tranny","kike","spic","chink","gook","wetback","retard","rape","pedo","molest","neger","judensau","fotze","maricon","puto","pendejo","pute","salope","pede","encule","frocio","troia","stronzo","viado","puta","bicha"],Qc=["scunthorpe","penistone","arsenal","arshavin","mexes","esposito","shittu"];function Vc(e){if(!e)return"";let a=e.toLowerCase();return a=a.replace(/[@4]/g,"a").replace(/3/g,"e").replace(/[1!]/g,"i").replace(/0/g,"o").replace(/[$5]/g,"s").replace(/7/g,"t"),a=a.replace(/[^a-zà -ÿ]/g,""),a}function ni(e){let a=Vc(e);if(!a)return!1;for(const n of Qc)n&&(a=a.split(n).join("_"));for(const n of Gc)if(a.includes(n))return!0;return!1}const da=yt("PushNotifications",{});function Hr(){try{return Ze.isNativePlatform()}catch{return!1}}let rs=!1,Gr=null,Sr=null,Sn=null,os=!1,kr=null;async function Jc(e){if(!(!Gr||!e)){kr=e;try{const{error:a}=await $.rpc("register_device_token",{p_token:e,p_platform:Ze.getPlatform(),p_tz_offset:-new Date().getTimezoneOffset()});a&&(console.warn("[push] register_device_token",a.message),Le(a,{tags:{area:"push-token"}}))}catch(a){console.warn("[push] register_device_token threw",a?.message||a)}}}function Kc(e){if(Sr=e,Sn){const a=Sn;Sn=null;try{e?.(a)}catch{}}}function ri(){if(!(!Hr()||os)){os=!0;try{da.addListener("pushNotificationActionPerformed",e=>{const a=e?.notification?.data||{};if(Sr)try{Sr(a)}catch{}else Sn=a})}catch{}}}async function oi(e,{requestPermission:a=!0}={}){if(!(!Hr()||!e)){Gr=e;try{if((a?await da.requestPermissions():await da.checkPermissions()).receive!=="granted")return;rs||(rs=!0,da.addListener("registration",r=>{Jc(r.value)}),da.addListener("registrationError",r=>{try{Le(new Error(`push registration failed: ${r?.error||"unknown"}`),{tags:{platform:Ze.getPlatform(),area:"push"}})}catch{}})),ri(),await da.register()}catch(n){try{Le(n,{tags:{platform:Ze.getPlatform(),area:"push"}})}catch{}}}}async function Yc(e){if(!Hr())return;Gr=null;const a=kr;if(kr=null,!(!e||!a))try{const{error:n}=await $.from("device_tokens").delete().eq("user_id",e).eq("token",a);n&&(console.warn("[push] unregister",n.message||n),Le(n,{tags:{area:"push-token",op:"unregister"}}))}catch(n){console.warn("[push] unregister threw",n?.message||n)}}const dr="app.balliq://auth/callback",Zc="app.balliq",si=l.createContext(null),Xc=["biq_xp","biq_stats","biq_login_streak","biq_iq_history","biq_hotstreak_best","biq_skill_level","biq_profile","biq_review_idx","biq_seen_history_v2","biq_pending_join","biq_last_email","biq_mp_history","biq_ledger_reconcile_at"],ed=["b
112iq_daily_","biq_wordle_"];function ss(){try{for(const a of Xc)localStorage.removeItem(a);const e=[];for(let a=0;a<localStorage.length;a++){const n=localStorage.key(a);n&&ed.some(r=>n.startsWith(r))&&e.push(n)}for(const a of e)localStorage.removeItem(a)}catch{}}function td({children:e}){const[a,n]=l.useState(null),[r,i]=l.useState(null),[c,d]=l.useState(!0),[o,u]=l.useState(!1),[m,p]=l.useState(!1),[g,k]=l.useState(null),[b,N]=l.useState(!1),j=l.useRef(null);l.useEffect(()=>{a?.id?_(a.id,a):i(null)},[a?.id]),l.useEffect(()=>{localStorage.getItem("ballIQ_guestMode")==="true"&&u(!0);const R=I=>{if(j.current=I?.user?.id??null,n(I?.user??null),I?.user){u(!1);try{rr({id:I.user.id,segment:"authenticated"})}catch{}}else u(!0);d(!1)};let L=!1;const x=setTimeout(()=>{L||ai().then(I=>{L||(I?.user?R({user:I.user}):R(null))})},5e3);$.auth.getSession().then(({data:{session:I}})=>{I?.user,L=!0,clearTimeout(x),R(I)}).catch(I=>{L=!0,clearTimeout(x),console.warn("[useAuth] getSession failed â entering as guest",I),R(null)});const{data:{subscription:E}}=$.auth.onAuthStateChange((I,v)=>{if(j.current=v?.user?.id??null,n(v?.user??null),I==="PASSWORD_RECOVERY"&&N(!0),v?.user){u(!1),p(!1),localStorage.removeItem("ballIQ_guestMode");try{rr({id:v.user.id,segment:"authenticated"})}catch{}try{const G=localStorage.getItem("biq_auth_attempt");if(G&&localStorage.removeItem("biq_auth_attempt"),G==="1"||Number(G)>0&&Date.now()-Number(G)<6e5){const H=Date.parse(v.user.created_at||"")||0,ee=H>0&&Date.now()-H<12e4,te=localStorage.getItem("biq_signup_pending_clear")==="1";if(te||ee){if(!te)try{localStorage.setItem("biq_needs_username","1")}catch{}}else{const de=(()=>{const ye=new Date;return`${ye.getFullYear()}-${String(ye.getMonth()+1).padStart(2,"0")}-${String(ye.getDate()).padStart(2,"0")}`})(),we={};for(const ye of["biq_pending_join",`biq_wordle_${de}`,`biq_daily_${de}`])try{const Be=localStorage.getItem(ye);Be!=null&&(we[ye]=Be)}catch{}ss();for(const ye of Object.keys(we))try{localStorage.setItem(ye,we[ye])}catch{}}localStorage.removeItem("biq_signup_pending_clear")}}catch{}}else{try{rr(null)}catch{}u(!0)}if(d(!1),I==="SIGNED_OUT"){let G=!1;try{const U=parseInt(localStorage.getItem("biq_signout_intentional_at")||"0",10);G=U>0&&Date.now()-U<5e3}catch{}if(!G){try{window.dispatchEvent(new CustomEvent("biq:session-expired"))}catch{}k("expired"),p(!0)}}});return()=>{clearTimeout(x),E.unsubscribe()}},[]);async function _(R,L){const x=L?.user_metadata?.username,E={id:R,username:x||"Player",avatar_id:vc(R),total_score:0,games_played:0,correct_answers:0};i(E);try{const[I,v]=await Promise.all([$.from("profiles").select("*").eq("id",R).maybeSingle(),$.from("user_game_state").select("*").eq("user_id",R).maybeSingle()]),{data:G,error:U,status:H}=I,{data:ee,error:te,status:be}=v;if(U){console.error("[loadProfile] profiles error",{userId:R,status:H,code:U.code,message:U.message,details:U.details,hint:U.hint});return}if(!G){console.warn("[loadProfile] no profile row found for user â keeping metadata fallback",{userId:R,username:x}),or("Empty result: profiles row missing for authenticated user",{level:"warning",tags:{check:"empty-profile"},extra:{user_id:R}});return}let de=null;te?console.error("[loadProfile] user_game_state error (non-fatal)",{userId:R,status:be,code:te.code,message:te.message}):ee?de=ee:(console.warn("[loadProfile] no user_game_state row for user â trigger should have created one",{userId:R}),or("Empty result: user_game_state row missing for authenticated user",{level:"warning",tags:{check:"empty-user-game-state"},extra:{user_id:R}}));const we={...G,daily_scores:de?.daily_scores,daily_wrong_answers:de?.daily_wrong_answers,daily_all_answers:de?.daily_all_answers,wordle_state:de?.wordle_state,login_streak:de?.login_streak,username:G.username||x||"Player"};i(we),w(R,we).catch(ye=>{console.error("[hydrate] failed",ye?.message||ye)})}catch(I){console.error("[loadProfile] exception",{userId:R,error:I})}}async function w(R,L){if(!L)return;if(j.current!==R){console.warn("[hydrate] aborted â userId changed mid-flight",{capturedUserId:R,currentUserId:j.current});return}let x=0;try{x=parseInt(localStorage.getItem("biq_xp")||"0",10)||0}catch{}let E={};try{E=JSON.parse(localStorage.getItem("biq_stats")||"{}")||{}}catch{}
112const I=L.xp||0,v=L.total_score||0,G=L.games_played||0,U=L.correct_answers||0,H=L.stats&&typeof L.stats=="object"?L.stats:{},ee=Math.max(x,I),te=Math.max(E.gamesPlayed||0,G),be=Math.max(E.totalCorrect||0,v,U),de=["bestScore","bestStreak","bestIQ","bestHotStreak","bestTrueFalse","totalAnswered"],we={...E,gamesPlayed:te,totalCorrect:be};for(const S of de)we[S]=Math.max(E[S]||0,H[S]||0);const ye=E.catStats&&typeof E.catStats=="object"?E.catStats:{},Be=H.catStats&&typeof H.catStats=="object"?H.catStats:{},P={};for(const S of new Set([...Object.keys(ye),...Object.keys(Be)])){const z=ye[S]||{c:0,a:0},ne=Be[S]||{c:0,a:0},J=Ga(ne)>Ga(z)?ne:z,re=J===ne?z:ne,qe={...J.d||{}};for(const[ke,Oe]of Object.entries(re.d||{})){if(!Array.isArray(Oe))continue;const gt=qe[ke];(!Array.isArray(gt)||(Oe[1]||0)>(gt[1]||0))&&(qe[ke]=Oe)}P[S]=Object.keys(qe).length?{...J,d:qe}:J}we.catStats=P,Ne("biq_xp",String(ee)),Ne("biq_stats",JSON.stringify(we));try{const S="biq_ledger_reconcile_at",z=parseInt(localStorage.getItem(S)||"0",10)||0;if(Date.now()-z>5*60*1e3){const ne=ee-I,J=be-v;if(ne>0||J>0){if(Ne(S,String(Date.now())),ne>0){const{error:re}=await $.rpc("increment_xp",{user_id:R,xp_delta:ne});re&&console.warn("[hydrate] xp reconcile failed",re.message)}if(J>0){const{error:re}=await $.rpc("increment_score",{user_id:R,score_delta:J});re&&console.warn("[hydrate] score reconcile failed",re.message)}}}}catch{}const Je=L.daily_scores&&typeof L.daily_scores=="object"?L.daily_scores:{},Ie=A(/^biq_daily_(\d{4}-\d{2}-\d{2})$/,S=>typeof S?.score=="number"?S.score:null),vt={...Ie,...Je},lt=L.daily_wrong_answers&&typeof L.daily_wrong_answers=="object"?L.daily_wrong_answers:{},At=A(/^biq_daily_(\d{4}-\d{2}-\d{2})$/,S=>Array.isArray(S?.wrongAnswers)&&S.wrongAnswers.length>0?S.wrongAnswers:null),Ft={...At,...lt},Jt=L.daily_all_answers&&typeof L.daily_all_answers=="object"?L.daily_all_answers:{},wt=A(/^biq_daily_(\d{4}-\d{2}-\d{2})$/,S=>Array.isArray(S?.allAnswers)&&S.allAnswers.length>0?S.allAnswers:null),Kt={...wt,...Jt},_a=new Set([...Object.keys(vt),...Object.keys(Ft),...Object.keys(Kt)]);for(const S of _a){const z=vt[S];if(typeof z!="number")continue;const ne=Ft[S],J=Kt[S],re={score:z};ne&&(re.wrongAnswers=ne),J&&(re.allAnswers=J),Ne(`biq_daily_${S}`,JSON.stringify(re))}const Tt=Object.keys(Ie).filter(S=>!(S in Je));Tt.length>0&&Promise.all(Tt.map(S=>$.rpc("upsert_daily_score",{p_ymd:S,p_score:Ie[S]}).then(({error:z})=>{z&&console.warn("[hydrate back-sync daily]",S,z.message)}))).catch(S=>console.warn("[hydrate back-sync daily]",S?.message||S));const V=Object.keys(At).filter(S=>!(S in lt));V.length>0&&Promise.all(V.map(S=>$.rpc("upsert_daily_wrong_answers",{p_ymd:S,p_wrongs:At[S]}).then(({error:z})=>{z&&console.warn("[hydrate back-sync daily wa]",S,z.message)}))).catch(S=>console.warn("[hydrate back-sync daily wa]",S?.message||S));const Pe=Object.keys(wt).filter(S=>!(S in Jt));Pe.length>0&&Promise.all(Pe.map(S=>$.rpc("upsert_daily_all_answers",{p_ymd:S,p_answers:wt[S]}).then(({error:z})=>{z&&console.warn("[hydrate back-sync daily aa]",S,z.message)}))).catch(S=>console.warn("[hydrate back-sync daily aa]",S?.message||S));const Nt=L.wordle_state&&typeof L.wordle_state=="object"?L.wordle_state:{},at=A(/^biq_wordle_(\d{4}-\d{2}-\d{2})$/,S=>S&&Array.isArray(S.guesses)&&typeof S.status=="string"?S:null),kt={...at,...Nt};for(const[S,z]of Object.entries(kt))Ne(`biq_wordle_${S}`,JSON.stringify(z));const Re=Object.keys(at).filter(S=>!(S in Nt));Re.length>0&&Promise.all(Re.map(S=>$.rpc("upsert_wordle_state",{p_ymd:S,p_state:at[S]}).then(({error:z})=>{z&&console.warn("[hydrate back-sync wordle]",S,z.message)}))).catch(S=>console.warn("[hydrate back-sync wordle]",S?.message||S));try{window.dispatchEvent(new CustomEvent("biq:hydrated",{detail:{xp:ee,stats:we,dailyScores:vt,wordleState:kt,loginStreak:L?.login_streak||null}}))}catch{}}function A(R,L){const x={};try{for(let E=0;E<localStorage.length;E++){const I=localStorage.key(E),v=I&&I.match(R);if(v)try{const G=JSON.parse(localStorage.getItem(I)),U=L(G);U!=null&&(x[v[1]]=U)}catch{}}}catch{}return x}async function q(R,L,x){ot({category:"auth",message:"sign-up attempted",level:"info"});try{localStorage.setItem("biq_auth_attempt",String(Date.now()))}catch{}const{data:E,error:I}=await $.auth.signUp({email:R,password:L,options:{data:{username:x},emailRedirectTo:"https://balliq.app/play"}});if(I)return{error:I};Ne("biq_last_email",R);try{Array.isArray(E?.user?.identities)&&E.user.identities.length>0&&localStorage.setItem("biq_signup_pending_clear","1")}catch{}return{data:E}}async function Z(R,L){ot({category:"auth",message:"sign-in attempted",level:"info"});try{localStorage.setItem("biq_auth_attempt",String(Date.now()))}catch{}const x=await $.auth.signInWithPassword({email:R,password:L});return!x.error&&x.data?.session&&Ne("biq_last_email",R),x}async function W(){ot({category:"auth",message:"anonymous sign-in attempted",level:"info"});const{data:R,error:L}=await $.auth.signInAnonymously();return L?{error:L}:{data:R}}async function Q(R,L,x){ot({category:"auth",message:"anon-upgrade attempted",level:"info"});const{data:E,error:I}=await $.auth.updateUser({email:R,password:L,data:{username:x}});if(I)return{error:I};Ne("biq_last_email",R);let v=null;const G=j.current;if(x&&G){const{error:U}=await $.from("profiles").update({username:x}).eq("id",G);U?(console.warn("[upgradeAnonAccount] username claim failed",U.message),v=U.message):i(H=>H&&{...H,username:x})}return{data:E,usernameWarning:v}}async function B(R){return ot({category:"auth",message:"password-reset requested",level:"info"}),$.auth.resetPasswordForEmail(R,{redirectTo:"https://balliq.app/reset"})}async function T(R){return ot({category:"auth",message:"password-update attempted",level:"info"}),$.auth.updateUser({password:R})}async function K(R){ot({category:"auth",message:`oauth ${R} attempted`,level:"info"});try{localStorage.setItem("biq_auth_attempt",String(Date.now()))}catch{}if(Ze.isNativePlatform?.()){console.log("[OAuth] start",{provider:R,redirectTo:dr});const{data:v,error:G}=await $.auth.signInWithOAuth({provider:R,options:{redirectTo:dr,skipBrowserRedirect:!0}});if(G)return console.log("[OAuth] supabase.signInWithOAuth error",G.message),{error:G};try{const U=new URL(v?.url||"");console.log("[OAuth] supabase returned URL",{host:U.host,path:U.pathname,redirect_to:U.searchParams.get("redirect_to"),provider:U.searchParams.get("provider"),hasCodeChallenge:!!U.searchParams.get("code_challenge")})}catch(U){console.log("[OAuth] could not parse supabase URL",{url:v?.url,err:U?.message})}if(v?.url)try{console.log("[OAuth] opening browser sheet"),await ra.open({url:v.url,presentationStyle:"popover"}),console.log("[OAuth] Browser.open resolved â sheet presented")}catch(U){return console.log("[OAuth] Browser.open threw",U?.message),{error:{message:U?.message||"Could not open sign-in browser"}}}return{data:v,pending:!0}}let x;if(typeof window<"u"){const v=window.location.pathname,G=v!=="/";x=window.location.origin+(G?v:"/play")}const{data:E,error:I}=await $.auth.signInWithOAuth({provider:R,options:{redirectTo:x}});return{data:E,error:I}}async function ae(){return K("google")}async function ue(){ot({category:"auth",message:"apple sign-in attempted",level:"info"});try{localStorage.setItem("biq_auth_attempt",String(Date.now()))}catch{}if(!Ze.isNativePlatform?.())return K("apple");try{return await ie()}catch(L){const x=L?.message||"",E=L?.code||L?.errorCode||"";if(/1001|cancell?ed|cancel/i.test(x)||String(E).includes("1001")||x.toLowerCase().includes("user canceled"))return console.log("[OAuth] n
112ative Apple: user cancelled, no fallback"),{error:{message:"Sign-in cancelled"},cancelled:!0};console.log("[OAuth] native Apple failed, falling back to browser",{msg:x,code:E});try{or("Native Apple sign-in fallback to browser",{level:"warning",tags:{feature:"auth-apple-fallback"},extra:{error:x,code:E}})}catch{}return K("apple")}}async function ie(){console.log("[OAuth] native Apple sheet â start");const R=typeof crypto?.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2),L=await xe(R),x=await Oc.authorize({clientId:Zc,redirectURI:dr,scopes:"email name",state:"native",nonce:L});console.log("[OAuth] native Apple sheet returned",{hasIdentityToken:!!x?.response?.identityToken,hasAuthCode:!!x?.response?.authorizationCode,hasGivenName:!!x?.response?.givenName,hasFamilyName:!!x?.response?.familyName,hasEmail:!!x?.response?.email,userIdLen:x?.response?.user?.length});const E=x?.response?.identityToken;if(!E)throw new Error("Apple sign-in returned no identity token");const{data:I,error:v}=await $.auth.signInWithIdToken({provider:"apple",token:E,nonce:R});if(console.log("[OAuth] signInWithIdToken returned",{hasSession:!!I?.session,userId:I?.session?.user?.id||I?.user?.id,error:v?.message}),v)throw v;const G=[x.response.givenName,x.response.familyName].filter(Boolean).join(" ").trim(),U=I?.user||I?.session?.user;return G&&U&&se(U.id,G,"apple-native").catch(H=>{console.log("[OAuth] deriveUsernameFromIdentity (apple-native) failed",H?.message);try{Le(H,{tags:{feature:"username-derive"},extra:{source:"apple-native"}})}catch{}}),{data:I}}async function xe(R){const L=new TextEncoder().encode(R),x=await crypto.subtle.digest("SHA-256",L);return Array.from(new Uint8Array(x)).map(E=>E.toString(16).padStart(2,"0")).join("")}async function se(R,L,x){if(!R||!L)return;console.log("[OAuth] deriveUsername start",{userId:R,source:x,name:L});const{data:E,error:I}=await $.from("profiles").select("username").eq("id",R).maybeSingle();if(I){console.log("[OAuth] deriveUsername: fetch failed",I.message);return}const v=E?.username||"";if(!(/^player(_|$)/i.test(v)||v==="Player")){console.log("[OAuth] deriveUsername: existing username is user-set, skipping",v);return}const U=L.trim().replace(/\s+/g," ").slice(0,24);if(U.length<3){console.log("[OAuth] deriveUsername: cleaned name too short, skipping");return}if(ni(U)){console.log("[OAuth] deriveUsername: profanity-filtered, keeping default");return}for(let H=0;H<50;H++){const ee=H===0?U:`${U} ${H+1}`;if(ee.length>30)break;const{data:te}=await $.from("profiles").select("id").eq("username",ee).maybeSingle();if(!te){const{error:be}=await $.from("profiles").update({username:ee}).eq("id",R);if(be){console.log("[OAuth] deriveUsername: update failed",be.message);return}console.log("[OAuth] deriveUsername: set to",ee);return}}console.log("[OAuth] deriveUsername: too many collisions, keeping default")}function M(R,L){if(!R)return;const x=R.user_metadata||{},I=[x.full_name,x.name,x.preferred_username,[x.given_name,x.family_name].filter(Boolean).join(" "),x.display_name].filter(v=>typeof v=="string"&&v.trim().length>0)[0];if(!I){console.log("[OAuth] tryDeriveUsernameFromUser: no name in user_metadata",{source:L,keys:Object.keys(x)});return}se(R.id,I,L).catch(v=>{console.log("[OAuth] tryDeriveUsernameFromUser failed",v?.message);try{Le(v,{tags:{feature:"username-derive"},extra:{source:L}})}catch{}})}l.useEffect(()=>{if(!Ze.isNativePlatform?.())return;ua.getLaunchUrl().then(L=>{L?.url&&console.log("[OAuth] CapApp.getLaunchUrl on mount",{url:L.url})}).catch(L=>console.log("[OAuth] getLaunchUrl failed",L?.message));let R=ua.addListener("appUrlOpen",L=>{const x=L?.url;if(console.log("[OAuth] appUrlOpen fired",{url:x}),!x){console.log("[OAuth] appUrlOpen: empty url, ignoring");return}try{const E=new URL(x),I=E.hash?.startsWith("#")?E.hash.slice(1):E.hash||"",v=I?Array.from(new URLSearchParams(I).keys()):[];console.log("[OAuth] appUrlOpen parsed",{protocol:E.protocol,host:E.host,pathname:E.pathname,paramKeys:Array.from(E.searchParams.keys()),hashKeys:v}),E.protocol==="app.balliq:"&&(E.host==="auth"||E.pathname.startsWith("/auth"))?(console.log("[OAuth] URL matched auth pattern, calling exchangeOAuthCallback"),Se(x)):console.log("[OAuth] URL did NOT match auth pattern (protocol+host check failed)")}catch(E){console.log("[OAuth] URL parse failed in appUrlOpen",E?.message)}});return()=>{Promise.resolve(R).then(L=>L?.remove?.()).catch(()=>{})}},[]);async function Se(R){console.log("[OAuth] exchangeOAuthCallback start");try{const L=new URL(R),x=L.searchParams,E=L.hash?.startsWith("#")?L.hash.slice(1):L.hash||"",I=new URLSearchParams(E),v=x.get("code"),G=I.get("access_token"),U=I.get("refresh_token"),H=x.get("error_description")||I.get("error_description");if(console.log("[OAuth] callback parsed",{hasCode:!!v,hasAccessToken:!!G,hasRefreshToken:!!U,errDesc:H}),H){console.log("[OAuth] supabase returned error_description",H);try{await ra.close()}catch{}return{error:{message:decodeURIComponent(H)}}}if(G&&U){console.log("[OAuth] implicit flow detected â calling setSession");const{data:ee,error:te}=await $.auth.setSession({access_token:G,refresh_token:U});
112console.log("[OAuth] setSession returned",{hasSession:!!ee?.session,userId:ee?.session?.user?.id,error:te?.message});try{await ra.close()}catch{}return te?{error:te}:(M(ee?.user||ee?.session?.user,"browser-implicit"),{data:ee})}if(v){console.log("[OAuth] PKCE flow detected â calling exchangeCodeForSession");const{data:ee,error:te}=await $.auth.exchangeCodeForSession(v);console.log("[OAuth] exchangeCodeForSession returned",{hasSession:!!ee?.session,userId:ee?.session?.user?.id,error:te?.message});try{await ra.close()}catch{}return te?{error:te}:(M(ee?.user||ee?.session?.user,"browser-pkce"),{data:ee})}console.log("[OAuth] callback had neither code nor tokens");try{await ra.close()}catch{}return{error:{message:"Auth callback missing code and tokens"}}}catch(L){console.log("[OAuth] exchangeOAuthCallback threw",L?.message);try{await ra.close()}catch{}return{error:{message:L?.message||"Auth callback parse failed"}}}}async function ge(){ot({category:"auth",message:"sign-out initiated",level:"info"});try{localStorage.setItem("biq_signout_intentional_at",String(Date.now()))}catch{}const R=j.current;j.current=null,ss();try{await Yc(R)}catch{}await $.auth.signOut(),localStorage.removeItem("ballIQ_guestMode"),u(!1)}function ce(){localStorage.setItem("ballIQ_guestMode","true"),u(!0)}function je(){localStorage.removeItem("ballIQ_guestMode"),u(!1)}function Fe(R=null){k(R),p(!0)}function Me(){p(!1)}async function Ue(R,L,x){let E;try{E=await new Promise((be,de)=>{const we=new FileReader;we.onload=()=>be(we.result),we.onerror=()=>de(new Error("FileReader error: "+(we.error?.message||"unknown"))),we.readAsDataURL(R)})}catch(be){throw console.error("[uploadAvatar] resize: FileReader failed",be),be}let I;try{I=await new Promise((be,de)=>{const we=new Image;we.onload=()=>be(we),we.onerror=()=>de(new Error("Image decode failed (format may be unsupported â e.g. HEIC)")),we.src=E})}catch(be){throw console.error("[uploadAvatar] resize: image decode failed",be),be}const v=Math.min(I.width,I.height);if(!v)throw console.error("[uploadAvatar] resize: image has zero dimensions"),new Error("Image has no dimensions");const G=(I.width-v)/2,U=(I.height-v)/2,H=document.createElement("canvas");H.width=L,H.height=x;const ee=H.getContext("2d");if(!ee)throw console.error("[uploadAvatar] resize: could not get canvas 2d context"),new Error("Canvas 2d unavailable");return ee.drawImage(I,G,U,v,v,0,0,L,x),await new Promise((be,de)=>{H.toBlob(we=>we?be(we):de(new Error("Canvas toBlob returned null")),"image/jpeg",.85)})}function mt(R){if(!R)return null;const L={},x=["message","statusCode","status","error","cause","name","code","details","hint","stack","originalError","body"];for(const E of x)try{R[E]!==void 0&&(L[E]=R[E])}catch{}try{for(const E of Object.getOwnPropertyNames(R))L[E]===void 0&&(L[E]=R[E])}catch{}return L}async function it(R){if(!R)return console.error("[uploadAvatar] aborted: no file"),{error:"No file provided"};if(R.size>10*1024*1024)return{error:"Photo is too large â please pick one under 10MB"};const{data:L,error:x}=await $.auth.getSession();x&&console.error("[uploadAvatar] getSession error",mt(x));const E=L?.session?.access_token,I=L?.session?.user?.id;if(!E||!I)return console.error("[uploadAvatar] aborted: no session token / user id"),{error:"No session"};let v;try{if(v=await Ue(R,400,400),!v||v.size===0)return{error:"Empty blob after resize"}}catch(te){return console.error("[uploadAvatar] resize threw",mt(te)),{error:te?.message||"Resize failed"}}const G=`${I}.jpg`,U=`https://blcisypmngimqkwxrrdm.supabase.co/storage/v1/object/avatars/${G}`;let H;try{H=await fetch(U,{method:"POST",headers:{Authorization:`Bearer ${E}`,"Content-Type":"image/jpeg","x-upsert":"true"},body:v})}catch(te){return console.error("[uploadAvatar] fetch threw (network-level failure)",mt(te)),{error:te?.message||"Network error"}}if(!H.ok){const te=await H.text().catch(()=>"<unreadable body>");return console.error("[uploadAvatar] Storage upload failed:",H.status,te),console.error("[uploadAvatar] response details",{status:H.status,statusText:H.statusText,url:H.url,contentType:H.headers.get("content-type")}),{error:te}}const ee=`https://blcisypmngimqkwxrrdm.supabase.co/storage/v1/object/public/avatars/${G}?t=${Date.now()}`;try{const{error:te}=await $.from("profiles").update({avatar_url:ee}).eq("id",I);te&&console.error("[uploadAvatar] profile update failed",mt(te))}catch(te){console.error("[uploadAvatar] profile update threw",mt(te))}return j.current!==I?{url:ee}:(i(te=>te&&{...te,avatar_url:ee}),{url:ee})}return t.jsx(si.Provider,{value:{user:a,profile:r,loading:c,isGuest:o,isAnonUser:!!a?.is_anonymous,signInAsGuest:W,upgradeAnonAccount:Q,signUp:q,signIn:Z,resetPassword:B,updatePassword:T,passwordRecovery:b,clearPasswordRecovery:()=>N(!1),signInWithGoogle:ae,signInWithApple:ue,exchangeOAuthCallback:Se,signOut:ge,continueAsGuest:ce,exitGuestMode:je,uploadAvatar:it,authPromptOpen:m,authPromptReason:g,openAuthPrompt:Fe,closeAuthPrompt:Me},children:e})}function Rn(){return l.useContext(si)}const ad={advance_question:{attempts:3,backoffMs:[500,1500,3e3]},submit_answer:{attempts:2,backoffMs:[200,500]},start_game:{attempts:3,backoffMs:[500,1500,3e3]},join_room:{attempts:3,backoffMs:[500,1500,3e3]},room_lookup:{attempts:2,backoffMs:[300,800]},create_room:{attempts:1,backoffMs:[]},end_game:{attempts:3,backoffMs:[500,1500,3e3]},leave_room:{attempts:3,backoffMs:[500,1500,3e3]},set_room_mode:{attempts:3,backoffMs:[500,1500,3e3]},set_player_ready:{attempts:3,backoffMs:[500,1500,3e3]},start_next_round:{attempts:3,backoffMs:[500,1500,3e3]},claim_rematch:{attempts:3,backoffMs:[500,1500,3e3]}};
112function nd(e){return Math.round(e*(.8+Math.random()*.4))}function rd(e){return new Promise(a=>setTimeout(a,e))}function od(e){if(!e)return!1;const a=e.message||"";if(a.includes("Load failed")||a.includes("Failed to fetch")||a.includes("NetworkError")||a.includes("timeout")||a.includes("aborted"))return!0;const n=typeof e.status=="number"?e.status:null;return n!==null&&(n>=500&&n<600||n===408||n===429)}const _r=new Set;let Qa=0;function is(){for(const e of _r)e(Qa)}function oh(){const[e,a]=l.useState(Qa);return l.useEffect(()=>{const n=r=>a(r);return _r.add(n),n(Qa),()=>{_r.delete(n)}},[]),{retrying:e>0,count:e}}async function bt(e,a){let n=ad[e];n||(Le(new Error(`[multiplayerRpc] no retry config for RPC ${e}`),{tags:{rpc:e}}),n={attempts:1,backoffMs:[]});let r=null,i=!1;try{for(let c=0;c<n.attempts;c++){c>0&&(i||(i=!0,Qa++,is()),await rd(nd(n.backoffMs[c-1])));const{data:d,error:o}=await $.rpc(e,a);if(!o)return{data:d,error:null};if(r=o,!od(o))return{data:null,error:o}}return Le(r instanceof Error?r:new Error(r?.message??String(r)),{tags:{rpc:e},extra:{retry_attempts:n.attempts}}),{data:null,error:r}}finally{i&&(Qa--,is())}}async function sh({p_capacity:e,p_name:a,p_avatar:n}){const{data:r,error:i}=await bt("create_room",{p_capacity:e,p_name:a,p_avatar:n});return i?{code:null,error:i.message??String(i)}:r}async function ih({p_code:e,p_name:a,p_avatar:n}){const{data:r,error:i}=await bt("claim_rematch",{p_code:e,p_name:a,p_avatar:n});return i?{code:null,error:i.message??String(i)}:r}async function ls(e){const a=String(e||"").toUpperCase().trim();if(a.length<4)return{found:!1,joinable:!1};const{data:n,error:r}=await bt("room_lookup",{p_code:a});if(r||!n||typeof n!="object")return{found:null,joinable:!1,error:r?.message};const i=n.found===!0,c=n.state||null,d=Number(n.players||0)>=Number(n.capacity||0)&&Number(n.capacity||0)>0;return{found:i,state:c,players:Number(n.players||0),capacity:Number(n.capacity||0),joinable:i&&c!=="ended"&&!d}}async function sd({p_code:e,p_name:a,p_avatar:n}){const{data:r,error:i}=await bt("join_room",{p_code:e,p_name:a,p_avatar:n});return i?{room_id:null,error:i.message,code:i.code}:r}async function lh({p_code:e,p_ready:a}){const{data:n,error:r}=await bt("set_player_ready",{p_code:e,p_ready:a});return r?{error:r.message??String(r)}:n}async function ch({p_code:e,p_questions:a}){const{data:n,error:r}=await bt("start_next_round",{p_code:e,p_questions:a});return r?{started:!1,error:r.message??String(r)}:n}async function dh({p_code:e,p_questions:a,p_capacity:n}){const{data:r,error:i}=await bt("start_game",{p_code:e,p_questions:a,p_capacity:n});return i?{started:!1,error:i.message}:r}async function uh({p_code:e,p_question_idx:a,p_answer_idx:n,p_lock_time:r}){const{data:i,error:c}=await bt("submit_answer",{p_code:e,p_question_idx:a,p_answer_idx:n,p_lock_time:r});return c?{accepted:!1,error:c.message}:i}async function fh({p_code:e,p_expected_question:a}){const{data:n,error:r}=await bt("advance_question",{p_code:e,p_expected_question:a});return r?{advanced:!1,error:r.message}:n}async function hh({p_code:e}){const{data:a,error:n}=await bt("end_game",{p_code:e});return n?{ended:!1,error:n.message}:a}async function id({p_code:e}){const{data:a,error:n}=await bt("leave_room",{p_code:e});return n?{left:!1,error:n.message}:a}async function mh({p_code:e,p_mode:a}){const{data:n,error:r}=await bt("set_room_mode",{p_code:e,p_mode:a});return r?{ok:!1,error:r.message}:n}async function gh({p_code:e,p_name:a}){const{data:n,error:r}=await $.rpc("set_player_name",{p_code:e,p_name:a});return r?{ok:!1,error:r.message,code:r.code}:{ok:!0,...n}}async function ph({p_code:e,p_question_idx:a}){const{data:n,error:r}=await $.rpc("reveal_question",{p_code:e,p_question_idx:a});return r?{revealed:!1,error:r.message}:n}const oa={width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};function ld({tab:e,setTab:a,setScreen:n,dailyDone:r,onHomeClick:i,active:c,notifCount:d=0,onOpenNotifs:o}){const u=p=>()=>{n("home"),a(p)},m=c===void 0?e:c;return t.jsxs("aside",{className:"biq-nav","aria-label":"Primary",children:[t.jsxs("button",{className:"bn-brand",onClick:i,"aria-label":"Home",children:[t.jsx("img",{src:"/marketing/ball.png",alt:"",width:32,height:32}),t.jsxs("span",{children:["Ball ",t.jsx("em",{children:"IQ"})]})]}),t.jsxs("nav",{className:"bn-list",children:[t.jsxs("button",{className:"bn-item","data-active":m==="home",onClick:u("home"),children:[t.jsxs("svg",{...oa,children:[t.jsx("path",{d:"M3 10.5 12 3l9 7.5"}),t.jsx("path",{d:"M5 9.5V21h5v-6h4v6h5V9.5"})]}),t.jsx("span",{children:"Home"})]}),t.jsxs("button",{className:"bn-item","data-active":m==="daily",onClick:u("daily"),children:[t.jsxs("svg",{...oa,children:[t.jsx("rect",{x:"3",y:"5",width:"18",height:"16",rx:"3"}),t.jsx("path",{d:"M8 3v4M16 3v4M3 10h18"})]}),t.jsx("span",{children:"History"}),!r&&t.jsx("span",{className:"bn-dot","aria-label":"new"})]}),t.jsxs("button",{className:"bn-item","data-active":m==="profile",onClick:u("profile"),children:[t.jsxs("svg",{...oa,children:[t.jsx("circle",{cx:"12",cy:"8",r:"4"}),t.jsx("path",{d:"M4 21c1.5-3.8 4.5-5.5 8-5.5s6.5 1.7 8 5.5"})]}),t.jsx("span",{children:"Profile"})]}),t.jsxs("button",{className:"bn-item","data-active":m==="online",onClick:u("online"),children:[t.jsxs("svg",{...oa,children:[t.jsx("circle",{cx:"12",cy:"12",r:"9"}),t.jsx("path",{d:"M3 12h18M12 3c2.5 2.5 3.8 5.6 3.8 9S14.5 18.5 12 21c-2.5-2.5-3.8-5.6-3.8-9S9.5 5.5 12 3z"})]}),t.jsx("span",{children:"Multiplayer"})]}),o&&t.jsxs("button",{className:"bn-item",onClick:o,children:[t.jsxs("svg",{...oa,children:[t.jsx("path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"}),t.jsx("path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0"})]}),t.jsx("span",{children:"Notifications"}),d>0&&t.jsx("span",{className:"bn-badge",children:d>9?"9+":d})]})]}),t.jsx("div",{className:"bn-spacer"}),t.jsx("div",{className:"bn-divider"}),t.jsx("nav",{className:"bn-list",children:t.jsxs("button",{className:"bn-item","data-active":m==="settings",onClick:()=>n("settings"),children:[t.jsxs("svg",{...oa,children:[t.jsx("circle",{cx:"12",cy:"12",r:"3.2"}),t.jsx("path",{d:"M19.4 13.5a1.6 1.6 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.6 1.6 0 0 0-2.7 1.1v.2a2 2 0 0 1-4 0v-.1
112a1.6 1.6 0 0 0-2.7-1.2l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.6 1.6 0 0 0-1.1-2.7H1a2 2 0 0 1 0-4h.1a1.6 1.6 0 0 0 1.2-2.7l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.6 1.6 0 0 0 1.8.3H7a1.6 1.6 0 0 0 1-1.5V2a2 2 0 0 1 4 0v.1a1.6 1.6 0 0 0 2.7 1.2l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.6 1.6 0 0 0-.3 1.8V8a1.6 1.6 0 0 0 1.5 1H22a2 2 0 0 1 0 4h-.1a1.6 1.6 0 0 0-1.5 1z"})]}),t.jsx("span",{children:"Settings"})]})}),t.jsxs("div",{className:"bn-cta",children:[t.jsx("div",{className:"bn-cta-eyebrow",children:"Get the app"}),t.jsxs("a",{className:"bn-store",href:zr(),target:"_blank",rel:"noopener",children:[t.jsx("svg",{width:"16",height:"16",viewBox:"0 0 384 512",fill:"#E8EAF0","aria-hidden":"true",children:t.jsx("path",{d:"M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z"})}),t.jsx("span",{children:"App Store"})]}),t.jsxs("a",{className:"bn-store",href:Or,target:"_blank",rel:"noopener",children:[t.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"#E8EAF0","aria-hidden":"true",children:t.jsx("path",{d:"M4 3.5 20 12 4 20.5z"})}),t.jsx("span",{children:"Google Play"})]})]})]})}const cd=[{id:"home",Icon:zs,label:"Play"},{id:"daily",Icon:Ps,label:"History"},{id:"online",Icon:Ds,label:"Multiplayer"},{id:"profile",Icon:Os,label:"Profile"}];function dd({tab:e,active:a,setTab:n,setScreen:r,dailyDone:i,notifCount:c=0,onOpenNotifs:d}){const o=a===void 0?e:a,u=m=>()=>{r("home"),n(m)};return t.jsx("nav",{className:"fd-appbar","aria-label":"App",children:t.jsxs("div",{className:"fd-w fd-appbar-in",children:[cd.map(({id:m,Icon:p,label:g})=>t.jsxs("button",{type:"button",className:"fd-appbar-tab","aria-label":g,"aria-current":o===m?"page":void 0,onClick:u(m),children:[t.jsx(p,{size:16,strokeWidth:2.25,"aria-hidden":"true"}),t.jsx("span",{children:g}),m==="daily"&&!i&&t.jsx("i",{className:"fd-appbar-dot","aria-hidden":"true"})]},m)),t.jsx("span",{className:"fd-appbar-spacer"}),d&&t.jsxs("button",{type:"button",className:"fd-appbar-tab",onClick:d,"aria-label":c>0?`Notifications, ${c} new`:"Notifications",children:[t.jsx(Ol,{size:16,strokeWidth:2.25,"aria-hidden":"true"}),c>0&&t.jsx("i",{className:"fd-appbar-dot","aria-hidden":"true"})]}),t.jsxs("button",{type:"button",className:"fd-appbar-tab fd-appbar-settings","aria-label":"Settings","aria-current":o==="settings"?"page":void 0,onClick:()=>r("settings"),children:[t.jsx(Wr,{size:16,strokeWidth:2.25,"aria-hidden":"true"}),t.jsx("span",{children:"Settings"})]})]})})}let pn=null,sa=null;function ud(){return pn?Promise.resolve(pn):sa||(sa=le(()=>import("./questions-index-qKVbteC9.js"),__vite__mapDeps([6,4])).then(e=>(pn=e.QB_INDEX,sa=null,pn)).catch(e=>{throw sa=null,e}),sa)}function fd(){ud().catch(e=>{console.warn("[questions-loader] index prefetch failed",e?.message||e)})}let yn=null,ia=null;function Ct(){return yn?Promise.resolve(yn):ia||(ia=Promise.all([le(()=>import("./questions-CrFJ2YoL.js"),__vite__mapDeps([7,4])),le(()=>import("./questionConflicts-Dy7NvfCv.js"),__vite__mapDeps([8,4]))]).then(([e,a])=>{const n=e.QB,r=e.TF_STATEMENTS,i=a.conflictsWith;for(const d of n)d&&d.cat==="chaos"&&!d.diff&&(d.diff="medium");const c=n.filter(d=>d&&(d.cat==="chaos"||d.tag==="chaos"));return yn={QB:n,TF_STATEMENTS:r,QB_CHAOS:c,conflictsWith:i},ia=null,yn}).catch(e=>{throw ia=null,e}),ia)}function ii(){Ct().catch(e=>{console.warn("[questions-loader] prefetch failed",e?.message||e)})}function yh(e,a){let n=a>>>0;const r=()=>(n^=n<<13,n^=n>>17,n^=n<<5,(n>>>0)/4294967296),i=[...e];for(let c=i.length-1;c>0;c--){const d=Math.floor(r()*(c+1));[i[c],i[d]]=[i[d],i[c]]}return i}const bh=1013904223,hd=1950;function cs(e){return(String(e).match(/\b(1[6-9]\d\d|20\d\d)s?\b/g)||[]).map(a=>{const n=parseInt(a,10);return/s$/.test(a)?n+9:n})}function vh(e,a=hd){if(e&&e.preEra===!0)return!1;const n=Array.isArray(e.o)?e.o:[],r=Number.isInteger(e.a)&&n[e.a]!=null?String(n[e.a]):"",i=cs(`${e.q||""} ${r}`);if(i.length>0&&Math.max(...i)<a)return!1;const c=cs(`${e.q||""} ${n.join(" ")}`);return c.length===0||Math.max(...c)>=a}function Cr(e,a,n){const r=[],i=[],c=new Set;for(const d of e){if(r.length>=a)break;if((n(d.id)||[]).some(u=>c.has(u))){i.push(d);continue}r.push(d),c.add(d.id)}for(const d of i){if(r.length>=a)break;r.push(d)}return r}const fa=null,Cn=new Set(["summer2026"]);function md(e,a=20){if(!e)return a;const n=String(e.q||"").length+(Array.isArray(e.o)?e.o.reduce((r,i)=>r+String(i||"").length,0):0);return a+Math.max(0,Math.min(10,Math.round((n-150)/25)))}var jn={},gd=()=>{window.si||(window.si=function(...a){window.siq=window.siq||[],window.siq.push(a)})},pd="@vercel/speed-insights",yd="2.0.0";function bd(){return typeof window<"u"}function vd(){try{const e="production"}catch{}return"production"}function li(){return vd()==="development"}function wd(e){return e.scriptSrc?An(e.scriptSrc):li()?"https://va.vercel-scripts.com/v1/speed-insights/script.debug.js":e.dsn?"https://va.vercel-scripts.com/v1/speed-insights/script.
112js":e.basePath?An(`${e.basePath}/speed-insights/script.js`):"/_vercel/speed-insights/script.js"}function xd(e,a){var n;let r=e;if(a)try{r={...(n=JSON.parse(a))==null?void 0:n.speedInsights,...e}}catch{}const i={sdkn:pd+(r.framework?`/${r.framework}`:""),sdkv:yd};return r.sampleRate&&(i.sampleRate=r.sampleRate.toString()),r.route&&(i.route=r.route),li()&&r.debug===!1&&(i.debug="false"),r.dsn&&(i.dsn=r.dsn),r.endpoint?i.endpoint=An(r.endpoint):r.basePath&&(i.endpoint=An(`${r.basePath}/speed-insights/vitals`)),{src:wd(r),beforeSend:r.beforeSend,dataset:i}}function An(e){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")?e:`/${e}`}function Sd(e={},a){var n;if(!bd()||e.route===null)return null;gd();const{beforeSend:r,src:i,dataset:c}=xd(e,a);if(document.head.querySelector(`script[src*="${i}"]`))return null;r&&((n=window.si)==null||n.call(window,"beforeSend",r));const d=document.createElement("script");d.src=i,d.defer=!0;for(const[o,u]of Object.entries(c))d.dataset[o]=u;return d.onerror=()=>{console.log(`[Vercel Speed Insights] Failed to load script from ${i}. Please check if any content blockers are enabled and try again.`)},document.head.appendChild(d),{setRoute:o=>{d.dataset.route=o??void 0}}}function kd(){if(!(typeof process>"u"||typeof jn>"u"))return jn.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH}function _d(){if(!(typeof process>"u"||typeof jn>"u"))return jn.REACT_APP_VERCEL_OBSERVABILITY_CLIENT_CONFIG}function Cd(e){l.useEffect(()=>{var n;e.beforeSend&&((n=window.si)==null||n.call(window,"beforeSend",e.beforeSend))},[e.beforeSend]);const a=l.useRef(null);return l.useEffect(()=>{if(!a.current){const n=Sd({framework:e.framework??"react",basePath:e.basePath??kd(),...e},e.configString??_d());n&&(a.current=n.setRoute)}},[e]),l.useEffect(()=>{a.current&&e.route&&a.current(e.route)},[e.route]),null}const jd='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';function ds(e){return e?Array.from(e.querySelectorAll(jd)).filter(a=>!a.disabled&&a.offsetParent!==null):[]}const ya=[];let us=!1,jr=!1;function Ad(){us||(us=!0,window.addEventListener("popstate",()=>{if(jr){jr=!1;return}const e=ya.pop();if(e){e.viaPopstate=!0;try{e.onClose()}catch{}}}))}function Fd(){if(ya.length===0)return!1;try{window.history.back()}catch{const e=ya.pop();if(e){e.viaPopstate=!0;try{e.onClose()}catch{}}}return!0}function ft({isOpen:e,onClose:a,ref:n}){l.useEffect(()=>{if(!e)return;const r=n.current;if(!r)return;Ad();const i=document.activeElement,c=ds(r);c.length>0?c[0].focus():typeof r.focus=="function"&&r.focus();const d=`m${Math.random().toString(36).slice(2)}`,o={onClose:a,viaPopstate:!1,myId:d};ya.push(o);try{window.history.pushState({biq_modal:1,biq_modal_id:d},"")}catch{}function u(m){if(m.key==="Escape"){m.preventDefault(),a();return}if(m.key!=="Tab")return;const p=ds(r);if(p.length===0){m.preventDefault(),typeof r.focus=="function"&&r.focus();return}const g=p[0],k=p[p.length-1],b=document.activeElement;if(!r.contains(b)){m.preventDefault(),g.focus();return}m.shiftKey&&b===g?(m.preventDefault(),k.focus()):!m.shiftKey&&b===k&&(m.preventDefault(),g.focus())}return window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",u);const m=ya.indexOf(o);if(m!==-1&&ya.splice(m,1),!o.viaPopstate){const p=(()=>{try{return window.history.state}catch{return null}})();if(p&&p.biq_modal_id===o.myId){jr=!0;try{window.history.back()}catch{}}}if(i&&typeof i.focus=="function")try{i.focus()}catch{}}},[e,a,n])}const Nd=5*60*1e3,Ld=45*60*1e3,Ed="a5c5da7";function Id(){const[e,a]=l.useState(!1);return l.useEffect(()=>{let n=!1;async function r(){try{const d=await fetch("/version.json",{cache:"no-store"});if(!d.ok||n)return;const o=await d.json();if(n)return;o?.sha&&o.sha!==Ed&&a(!0)}catch{}}r();const i=setInterval(()=>{document.visibilityState==="visible"&&r()},Nd),c=()=>{document.visibilityState==="visible"&&r()};return document.addEventListener("visibilitychange",c),()=>{n=!0,clearInterval(i),document.removeEventListener("visibilitychange",c)}},[]),e}function qd(){const e=Id(),[a,n]=l.useState(!1),r=l.useRef(null);return l.useEffect(()=>{if(a)return r.current=setTimeout(()=>
112n(!1),Ld),()=>clearTimeout(r.current)},[a]),!e||a?null:t.jsxs("div",{className:"version-banner",role:"status","aria-live":"polite",children:[t.jsx("span",{className:"version-banner-text",children:"â» A new version of Ball IQ is available."}),t.jsxs("div",{className:"version-banner-actions",children:[t.jsx("button",{type:"button",className:"version-banner-refresh",onClick:()=>window.location.reload(),children:"Refresh"}),t.jsx("button",{type:"button",className:"version-banner-later",onClick:()=>n(!0),"aria-label":"Dismiss for now",children:"Later"})]})]})}const fs="biq_usage_v1";function ur(e){try{const a=localStorage.getItem(fs),n=a?JSON.parse(a):{};n[e]=(n[e]||0)+1,n._since=n._since||new Date().toISOString().slice(0,10),localStorage.setItem(fs,JSON.stringify(n))}catch{}}var hs;(function(e){e[e.Sunday=1]="Sunday",e[e.Monday=2]="Monday",e[e.Tuesday=3]="Tuesday",e[e.Wednesday=4]="Wednesday",e[e.Thursday=5]="Thursday",e[e.Friday=6]="Friday",e[e.Saturday=7]="Saturday"})(hs||(hs={}));const ka=yt("LocalNotifications",{web:()=>le(()=>import("./web-BFHr-46P.js"),__vite__mapDeps([9,1])).then(e=>new e.LocalNotificationsWeb)}),Rd=7,Td=[{off:8,body:"Your streak misses you â 2 minutes gets it back ð¥"},{off:11,body:"New Daily 7 and Footle drop every day â today's are waiting â½"},{off:15,body:"Club quizzes: 17 clubs, deep cuts only. Still know yours? ð¡ï¸"},{off:22,body:"Your rivals are pulling ahead on the leaderboard ð"},{off:30,body:"One quiz. Two minutes. See what you still remember â½"}],Va=7e5,Qr=Va+40,ms=20,Md=30;function pt(){try{return Ze.isNativePlatform()}catch{return!1}}async function Ar(){if(!pt())return"unsupported";try{return(await ka.checkPermissions()).display}catch{return"unsupported"}}async function Bd(){if(!pt())return!1;try{return(await ka.requestPermissions()).display==="granted"}catch{return!1}}function gs(e){const a=new Date,n=new Date(a.getFullYear(),a.getMonth(),a.getDate()+e,_n(),0,0,0);return n.getTime()>a.getTime()?n:null}const ps=["Today's Footle & Daily 7 are still open â keep your streak going ð¥","Two minutes, seven questions â today's Daily 7 is waiting â½","Tonight's Footle is still unsolved. One good guess could do it ð§ ","Don't lose the streak â today's puzzles close at midnight ð¥","Quick one before the day ends? Footle & the Daily 7 are open â½","Your daily fix: Footle and the 7. Still time tonight ð¯","Streak check â today's games are still open ð¥"];async function fr({skipToday:e=!1,streak:a=0}={}){if(pt())try{if(await Ar()!=="granted")return;await Fr();try{const{supabase:r}=await le(async()=>{const{supabase:i}=await Promise.resolve().then(()=>Hc);return{supabase:i}},void 0);r.rpc("set_reminder_hour",{p_hour:_n(),p_local:!0}).then(({error:i})=>{i&&console.warn("[reminders] set_reminder_hour",i.message)}).catch(()=>{})}catch{}const n=[];for(let r=e?1:0;r<Rd;r++){const i=gs(r);i&&n.push({id:Va+r,title:"Ball IQ",body:ps[i.getDay()%ps.length],schedule:{at:i,allowWhileIdle:!0}})}if(!e&&a>=2&&_n()<ms){const r=new Date,i=new Date(r.getFullYear(),r.getMonth(),r.getDate(),ms,Md,0,0);i.getTime()>r.getTime()&&n.push({id:Qr,title:"Ball IQ",body:`Your ${a}-day daily streak ends at midnight â today's puzzles are still open ð¥`,schedule:{at:i,allowWhileIdle:!0}})}for(const r of Td){const i=gs(r.off);i&&n.push({id:Va+r.off,title:"Ball IQ",body:r.body,schedule:{at:i,allowWhileIdle:!0}})}n.length&&await ka.schedule({notifications:n})}catch{}}function Pd(e){if(!pt())return()=>{};const a=ka.addListener("localNotificationActionPerformed",()=>{try{e()}catch{}});return()=>{a.then(n=>n.remove()).catch(()=>{})}}async function Dd(){if(pt())try{await ka.cancel({notifications:[{id:Va},{id:Qr}]})}catch{}}async function Fr(){if(pt())try{const e=[];for(let a=0;a<=31;a++)e.push({id:Va+a});e.push({id:Qr}),await ka.cancel({notifications:e})}catch{}}const ci="BLL3MY-5aGz_7iCfnUy6GWk8F0vsfrVYFHnADYFSm_bU2ofnKHqcN9NdxiIDUg9x8n2x1S1jnnRabnAo8TIJpJA";function Rt(){try{return Ze.isNativePlatform()||typeof window>"u"||!("serviceWorker"in navigator)||!("PushManager"in window)||typeof Notification>"u"?!1:ci.length>0}catch{return!1}}
112function Wa(){if(!Rt())return"unsupported";try{return Notification.permission}catch{return"unsupported"}}function zd(e){const a="=".repeat((4-e.length%4)%4),n=(e+a).replace(/-/g,"+").replace(/_/g,"/"),r=atob(n),i=new Uint8Array(r.length);for(let c=0;c<r.length;c++)i[c]=r.charCodeAt(c);return i}async function Nr(e){const a=e.toJSON(),{data:{user:n}={}}=await $.auth.getUser();if(!n?.id)return!1;const r=-new Date().getTimezoneOffset(),{error:i}=await $.from("web_push_subscriptions").upsert({user_id:n.id,subscription:a,endpoint:a.endpoint,tz_offset_minutes:r,reminder_hour:_n(),last_seen_at:new Date().toISOString()},{onConflict:"endpoint"});return i?(console.warn("[webpush] persist failed:",i.message),!1):!0}async function di(){if(!Rt())return!1;try{if(await Notification.requestPermission()!=="granted")return!1;const a=await navigator.serviceWorker.ready,n=zd(ci),r=await a.pushManager.getSubscription();if(r){if(r.options?.applicationServerKey&&new Uint8Array(r.options.applicationServerKey).every((d,o)=>d===n[o]))return await Nr(r);await r.unsubscribe()}const i=await a.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:n});return await Nr(i)}catch(e){return console.warn("[webpush] enable failed:",e?.message||e),!1}}async function Od(){if(Rt())try{const a=await(await navigator.serviceWorker.ready).pushManager.getSubscription();if(!a)return;const n=a.endpoint;await a.unsubscribe();const{error:r}=await $.from("web_push_subscriptions").delete().eq("endpoint",n);r&&console.warn("[webpush] delete failed:",r.message)}catch(e){console.warn("[webpush] disable failed:",e?.message||e)}}async function Wd(){if(Rt()&&Notification.permission==="granted")try{const a=await(await navigator.serviceWorker.ready).pushManager.getSubscription();a?await Nr(a):await di()}catch{}}const ui="biq_score_outbox",Ud=7*24*60*60*1e3,$d=200;function fi(){try{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID()}catch{}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const a=Math.random()*16|0;return(e==="x"?a:a&3|8).toString(16)})}function Lr(){try{const e=localStorage.getItem(ui);if(!e)return[];const a=JSON.parse(e);return Array.isArray(a)?a:[]}catch{return[]}}function hi(e){try{Ne(ui,JSON.stringify(e.slice(-$d)))}catch{}}function hr(e){const a={...e,id:e.id||fi(),queued_at:Date.now()};return hi([...Lr(),a]),a}async function la(e,a){const n={...a,id:a.id||fi()};if(!e)return hr(n),{queued:!0};try{const{error:r}=await $.from("scores").insert({...n,user_id:e});return r&&r.code!=="23505"?(hr(n),{queued:!0,error:r}):{saved:!0}}catch(r){return hr(n),{queued:!0,error:r}}}async function Hd(e){if(!e)return{sent:0,dropped:0,kept:Lr().length};const a=Lr();if(!a.length)return{sent:0,dropped:0,kept:0};const n=Date.now(),r=[],i=[];for(const m of a)(n-(m.queued_at||0)>Ud?i:r).push(m);const c=[];let d=0,o=0;for(;o<r.length;o+=1){const{queued_at:m,...p}=r[o],g=m?new Date(Math.min(m,n)).toISOString():void 0;try{const{error:k}=await $.from("scores").insert({...p,user_id:e,...g?{created_at:g}:{}});if(k&&k.code!=="23505"){c.push(r[o]);continue}d+=1}catch{c.push(r[o]),o+=1;break}}const u=r.slice(o);return hi([...c,...u]),{sent:d,dropped:i.length,kept:c.length+u.length}}const mi="biq_acct_funnel";function Gd(){try{const e=localStorage.getItem(mi);if(!e)return{};const a=JSON.parse(e);return a&&typeof a=="object"?a:{}}catch{return{}}}function ca(e,a,n,r){if(!e||!a||typeof n!="function")return!1;try{const c=Gd()[e]||{};return c[a]?!1:(c[a]=1,Ne(mi,JSON.stringify({[e]:c})),n(a,r),!0)}catch{return!1}}function gi(e){const a=String(e||"").trim();if(!a)return"";const n=a.match(/\p{L}/u);return(n?n[0]:Array.from(a)[0]).toUpperCase()}function Fn({value:e,url:a,name:n,seed:r,className:i,style:c}){const[d,o]=l.useState(!1);if(l.useEffect(()=>{o(!1)},[a]),a&&!d)return t.jsx("img",{src:a,alt:"","aria-hidden":"true",className:i,style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%",display:"block",...c},onError:()=>o(!0)});const u=Us(e,r),m=gi(n);return t.jsx("div",{"aria-hidden":"true",className:i,style:{width:"100%",height:"100%",borderRadius:"50%",background:u.bg,overflow:"hidden",display:"block",boxShadow:"inset 0 0 0 1.5px rgba(0,0,0,0.30)",...c},children:t.jsx("svg",{viewBox:"0 0 100 100",width:"100%",height:"100%",style:{display:"block"},"aria-hidden":"true",focusable:"false",children:m?t.jsx("text",{x:"50",y:"50",textAnchor:"middle",dominantBaseline:"central",fill:u.ink,fontSize:"46",fontWeight:"800",letterSpacing:"-1",fontFamily:"Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",children:m}):t.jsxs("g",{transform:"translate(50 50) scale(2.3) translate(-12 -12)",fill:"none",stroke:u.ink,strokeWidth:"2.25",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}),t.jsx("circle",{cx:"12",cy:"7",r:"4"})]})})})}const Qd=yt("WidgetBridge");async function Vd({date:e,done:a,total:n,streak:r}
112){try{if(!Ze.isNativePlatform()||Ze.getPlatform()!=="android")return;await Qd.update({date:e,done:a,total:n,streak:r})}catch{}}const Jd={england:"PL",spain:"LaLiga",italy:"SerieA",germany:"Bundesliga",france:"Ligue1",turkiye:"SuperLig",portugal:"Primeira"};function Kd(e,a){const n={};for(const[r,i]of Object.entries(e||{})){const c=a?.[r];typeof c!="string"||!c||(n[i]=Jd[c]||"Clubs")}return n}function Er(e=new Date){return Math.floor((e.getTime()-e.getTimezoneOffset()*6e4)/864e5)}function ys(e,a){return Math.min(3,Math.max(0,Math.floor((e||0)/200)-(a||0)))}function bs(e,a=Er(),n=0){const r=Number(e?.streak)||0;if(r<=0)return 0;const i=Number(e?.lastDay);return Number.isFinite(i)&&(i>=a-1||i===a-2&&n>0)?r:0}const $t={q:"Who has scored the most goals in men's international football?",o:["Lionel Messi","Cristiano Ronaldo","Pelé","Neymar"],a:1};function Yd(){try{return(typeof window<"u"?window.__biqPreboot:null)||null}catch{return null}}let vs=!1;function Zd({onDone:e}){const a=l.useRef(null);a.current===null&&(a.current=Yd()||{});const[n,r]=l.useState(typeof a.current.opt=="number"?a.current.opt:null),i=o=>{try{localStorage.setItem("biq_onboarded","1")}catch{}X(n!==null?"onboard-done-answered":"onboard-done-skipped");try{$.auth.getUser().then(({data:u})=>{u?.user?.id&&$.from("profiles").update({onboarded_at:new Date().toISOString()}).eq("id",u.user.id).then(({error:m})=>{m&&(console.warn("[onboarding] onboarded_at write failed",m.message||m),Le(m,{tags:{area:"onboarding-flag",site:"onboard-done"}}))}).catch(m=>Le(m,{tags:{area:"onboarding-flag",site:"onboard-done"}}))})}catch{}e?.(o===!0)},c=()=>{ve("soft"),i(!0)},d=()=>{ve("soft"),i(!1)};return l.useEffect(()=>{!a.current?.act||vs||(vs=!0,i(a.current.act==="start"))},[]),t.jsx("div",{className:"onboard-wrap",children:t.jsx("div",{className:"onboard-viewport",children:t.jsx("div",{className:"onboard-track",children:t.jsxs("div",{className:"onboard-step",children:[t.jsxs("div",{className:"onboard-step-top",children:[t.jsx("div",{className:"onboard-title",style:{marginTop:16},children:"Quick one â give it a go â½"}),t.jsx("div",{className:"onboard-body",style:{marginBottom:14},children:$t.q}),t.jsx("div",{className:"onboard-sample-opts",children:$t.o.map((o,u)=>{const m=n!==null,p=u===$t.a;let g="onboard-sample-opt";return m&&p?g+=" correct":m&&n===u&&(g+=" wrong"),t.jsxs("button",{className:g,disabled:m,onClick:()=>{ve(p?"heavy":"soft"),r(u)},children:[o,m&&p&&t.jsx("span",{"aria-hidden":"true",children:" â"}),m&&!p&&n===u&&t.jsx("span",{"aria-hidden":"true",children:" â"})]},u)})}),t.jsx("div",{className:`onboard-sample-fb${n===$t.a?" is-correct":""}`,children:n===null?"":n===$t.a?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"onboard-fb-tick","aria-hidden":"true",children:t.jsx(Wl,{size:13,strokeWidth:3.5})}),"Nice â youâre a natural"]}):`It's ${$t.o[$t.a]} â the all-time record holder. You'll pick these up fast!`})]}),t.jsxs("div",{className:"onboard-actions",children:[t.jsx("button",{className:"onboard-skip",onClick:d,children:n!=null&&n!==!1?"Look around first":"Skip"}),t.jsx("button",{className:"onboard-btn onboard-btn-inline",onClick:c,children:n===null?"Start playing":"Letâs play"})]})]})})})})}function pi(e){return e===100?"Ballon d'Or form":e>=80?"Top-corner finish":e>=60?"Solid at the back":e>=40?"Squad rotation material":"Sunday league, first half"}function Xd({onComplete:e}){const a=l.useRef(null);return l.useEffect(()=>{if(window.matchMedia?.("(prefers-reduced-motion: reduce)").matches){e?.();return}const n=a.current;if(!n)return;const r=n.getContext("2d");n.width=window.visualViewport?.width??window.innerWidth,n.height=window.visualViewport?.height??window.innerHeight;const i=n.width/2,c=n.height*.55,d=Array.from({length:40},(p,g)=>{const k=g/40*Math.PI*2+(Math.random()-.5)*.3,b=6+Math.random()*6;return{x:i,y:c,vx:Math.cos(k)*b,vy:Math.sin(k)*b-3,w:Math.random()*8+4,h:Math.random()*4+2,r:Math.random()*Math.PI*2,dr:(Math.random()-.5)*.3,life:1,color:["#58CC02","#FFC800","#FBBF24","#16a34a"][Math.floor(Math.random()*4)]}});let o=!0,u=0;const m=()=>{if(!o)return;u++,r.clearRect(0,0,n.width,n.height);let p=!1;d.forEach(g=>{g.x+=g.vx,g.y+=g.vy,g.vy+=.25,g.vx*=.99,g.r+=g.dr,g.life-=.015,g.life>0&&(p=!0,r.save(),r.translate(g.x,g.y),r.rotate(g.r),r.fillStyle=g.color,r.globalAlpha=Math.max(0,g.life),r.fillRect(-g.w/2,-g.h/2,g.w,g.h),r.restore(
112))}),p&&u<90?requestAnimationFrame(m):(o=!1,e&&e())};return requestAnimationFrame(m),()=>{o=!1}},[e]),t.jsx("canvas",{ref:a,"aria-hidden":"true",style:{position:"fixed",top:0,right:0,bottom:0,left:0,inset:0,pointerEvents:"none",zIndex:500}})}function eu({question:e,diff:a,hintsEnabled:n,onAnswer:r}){const[i,c]=l.useState(""),[d,o]=l.useState([]),[u,m]=l.useState(null),[p,g]=l.useState(!1),k=e.o?e.o[e.a]:"",b=k?k[0].toUpperCase():"";l.useEffect(()=>{i.length>=2&&!u?o(tf(i)):o([])},[i,u]);const N=l.useCallback(w=>{const A=(w||i).trim();if(!A||u)return;o([]);const q=ef(A,e);m(q?"correct":"wrong"),c(w||i),r(q,A)},[i,u,e,r]),j=w=>{c(w),o([]),setTimeout(()=>N(w),Sa.AUTOCOMPLETE_DEBOUNCE)},_=w=>{const A=Pt(i),Z=Pt(w).indexOf(A);return Z===-1?w:t.jsxs(t.Fragment,{children:[w.slice(0,Z),t.jsx("span",{className:"ac-hi",children:w.slice(Z,Z+A.length)}),w.slice(Z+A.length)]})};return t.jsxs("div",{children:[t.jsxs("div",{className:"typed-outer",children:[t.jsx("input",{className:`typed-inp${u?` ${u}`:""}`,placeholder:"Type your answerâ¦",value:i,onChange:w=>c(w.target.value),onKeyDown:w=>w.key==="Enter"&&N(),disabled:!!u,autoFocus:!0,autoCorrect:"off",autoCapitalize:"words",spellCheck:!1,autoComplete:"off"}),d.length>0&&t.jsx("div",{className:"ac-list",children:d.map((w,A)=>t.jsx("div",{className:"ac-row",onMouseDown:()=>j(w),children:_(w)},A))})]}),n!==!1&&a==="easy"&&!u&&i.length===0&&b&&t.jsxs("div",{className:"hint-note",children:[t.jsx(qn,{size:12,strokeWidth:2.5,"aria-hidden":"true"}),' Starts with "',b,'"']}),t.jsx("button",{className:"typed-btn",onClick:()=>N(),disabled:!i.trim()||!!u,children:"Submit â"})]})}function tu({questions:e,mode:a,diff:n,timerEnabled:r,timerSecondsOverride:i,soundEnabled:c,hintsEnabled:d,onComplete:o,onBack:u,survivalBest:m,onReport:p,quizLabel:g,onHowToPlay:k}){const[b,N]=l.useState(0),[j,_]=l.useState(null),[w,A]=l.useState(null),[q,Z]=l.useState(!1),W=l.useMemo(()=>md(e?.[b],i||20),[e,b,i]),[Q,B]=l.useState(0),[T,K]=l.useState(0),[ae,ue]=l.useState(0),[ie,xe]=l.useState(0),se=l.useRef(null);l.useEffect(()=>()=>clearTimeout(se.current),[]);const[M,Se]=l.useState(W),[ge,ce]=l.useState(!1),je=l.useRef(null),Fe=l.useRef(null),Me=l.useRef(o);l.useEffect(()=>{Me.current=o},[o]);const Ue=l.useRef(W),mt=l.useRef(W);l.useEffect(()=>{Ue.current=M,mt.current=M},[M]);const[it,R]=l.useState(!1),L=l.useRef(null);ft({isOpen:it,onClose:()=>R(!1),ref:L});const[x,E]=l.useState(!0),[I,v]=l.useState(!1),G=l.useRef(-1),U=l.useRef(null),H=l.useRef([]),ee=l.useRef([]),[te,be]=l.useState([]);l.useEffect(()=>{H.current=[],ee.current=[],be([])},[e]),l.useEffect(()=>{ot({category:"game",message:"quiz started",level:"info",data:{mode:a,diff:n||null,total:e?.length||0}});try{Da("mode",a)}catch{}return()=>{try{Da("mode",void 0)}catch{}}},[]),l.useEffect(()=>{const S=e?.[b]?.id;try{Da("question_id",S||void 0)}catch{}return()=>{try{Da("question_id",void 0)}catch{}}},[b,e]);const[de,we]=l.useState(!1),ye=l.useRef(null);l.useEffect(()=>()=>{ye.current&&clearTimeout(ye.current)},[]);const Be=e?.length||0,P=e?.[b],Je=r!==!1&&a!=="survival"&&a!=="legends"&&a!=="chaos"&&a!=="daily"&&P?.type!=="tf";l.useEffect(()=>{const S=z=>{if(z.preventDefault(),it){R(!1);return}if(b===0&&(!Je||!x)){u();return}R(!0)};return window.addEventListener("biq:hw-back",S),()=>window.removeEventListener("biq:hw-back",S)},[b,it,u,Je,x]);const Ie=P?.type==="typed",vt=P?.type==="tf",lt=j!==null||w!==null,At=l.useRef(null);l.useEffect(()=>{const S=At.current;if(!lt||!S)return;const z=requestAnimationFrame(()=>{try{const ne=(()=>{try{const re=document.querySelector(".q-sticky-foot");return re?Math.ceil(re.getBoundingClientRect().height)+8:160}catch{return 160}})(),J=S.getBoundingClientRect().bottom-(window.innerHeight-ne)+12;J>0&&window.scrollBy({top:J,behavior:"auto"})}catch{}});return()=>cancelAnimationFrame(z)},[lt,b]);const Jt=g||{classic:"Classic",speed:"Speed",daily:"Daily 7",legends:"Legends",chaos:"Chaos",survival:"Survival",local:"Local"}[a]||"Quiz",wt=P&&(Rr[P.cat]||P.cat)||"",Kt=a==="survival"?`Q ${b+1}`:`Q ${String(b+1).padStart(2,"0")} / ${Be}`,_a=Be>0?(b+(lt?1:0))/Be*100:0,Tt=2*Math.PI*33,V=Je?Math.max(0,Math.min(1,M/W)):1,Pe=V>.5?"#58CC02":V>.25?"#FFC107":"#FF4747",Nt=l.useCallback((S,z,ne)=>{if(G.current!==b){if(G.current=b,a==="survival"&&!ne){ot({category:"game",message:"quiz ended (survival fail)",level:"info",data:{mode:a,score:S,answered:b+1}}),ce(!0),Me.current({score:S,total:b+1,bestStreak:z,wrongAnswers:H.current,allAnswers:ee.current});return}if(b+1>=Be){ot({category:"game",message:"quiz ended",level:"info",data:{mode:a,score:S,total:Be}}),ce(!0),Me.current({score:S,total:Be,bestStreak:z,wrongAnswers:H.current,allAnswers:ee.current});return}N(J=>J+1),_(null),A(null),Z(!1),v(!1),Je&&Se(W)}},[b,Be,a,Je]),at=l.useCallback((S,z,ne)=>{if(a==="survival"&&!ne){Nt(S,z,ne);return}if(ne==="timeout"){v({ns:S,nb:z,correct:!1});return}v({ns:S,nb:z,correct:ne})},[a,Nt]);l.useEffect(()=>{U.current=at},[at]);const kt=l.useCallback((S,z,ne)=>{clearInterval(je.current),clearTimeout(Fe.current);const J=S?Q+1:Q,re=S?T+1:0,qe=Math.max(ae,re);B(J),K(re),ue(qe),S&&a!=="survival"&&(re===3||re===5)&&(xe(re),clearTimeout(se.current),se.current=setTimeout(()=>xe(0),1600),ve("hardCorrect"));try{ot({category:"game",message:"answer submitted",level:"info",data:{qid:P?.id||null,idx:b,correct:S===!0,timeout:S==="timeout",type:P?.type||"mcq"}})}catch{}if(!S&&P&&S!=="timeout"&&(H.current=[...H.current,{id:P.id,q:P.q,correct:P.type==="typed"?P.typed_a:P.type==="tf"?P.a?"TRUE":"FALSE":P.o[P.a],user:z,cat:P.cat,hint:P.hint}]),P&&S!=="timeout"){const ke=P.type==="tf"?"tf":P.type==="typed"?"typed":"mcq",Oe=ke==="tf"?["FALSE","TRUE"]:ke==="typed"?null:P.o,gt=ke==="typed"?-1:ke==="tf"?P.a?1:0:P.a,Ca=typeof ne=="number"?ne:-1;ee.current=[...ee.current,{q:P.q,type:ke,cat:P.cat||null,realCat:P.realCat||null,club:P.club||null,diff:P.diff||"medium",options:Oe,userIdx:Ca,correctIdx:gt,userText:ke==="typed"&&z||null,correctText:ke==="typed"?P.typed_a:ke==="tf"?P.a?"TRUE":"FALSE":P.o[P.a],isCorrect:S===!0,timedOut:!1}]}S!=="timeout"&&be(ke=>
112[...ke,S===!0]),at(J,qe,S)},[Q,T,ae,at,a]),Re=l.useCallback(S=>{if(lt||ge)return;_(S);const z=P.a===!0||P.a===1,ne=P.type==="tf"?S===1===z:S===P.a,J=P.type==="tf"?S===1?"TRUE":"FALSE":P.o[S];rt(ne?"correct":"wrong"),ne&&P.diff==="hard"?(ve("hardCorrect"),we(!0),ye.current&&clearTimeout(ye.current),ye.current=setTimeout(()=>we(!1),Sa.ANSWER_REVEAL)):ve(ne?"correct":"wrong"),kt(ne,J,S)},[lt,ge,P,kt,c]);return l.useEffect(()=>{if(!Je||ge||Ie||b===0&&!x)return;Se(W),clearInterval(je.current);const S=Date.now()+W*1e3;let z=!1;je.current=setInterval(()=>{const J=Math.max(0,Math.ceil((S-Date.now())/1e3));if(!z&&J<=5&&J>0){z=!0;try{ve("select")}catch{}}J<=0&&clearInterval(je.current),Se(J)},250);const ne=W*1e3+100;return Fe.current=setTimeout(()=>{const J=e[b];if(J){const re=J.type==="tf"?"tf":J.type==="typed"?"typed":"mcq",qe=re==="tf"?["FALSE","TRUE"]:re==="typed"?null:J.o,ke=re==="typed"?-1:re==="tf"?J.a?1:0:J.a;ee.current=[...ee.current,{q:J.q,type:re,cat:J.cat||null,realCat:J.realCat||null,club:J.club||null,diff:J.diff||"medium",options:qe,userIdx:-1,correctIdx:ke,userText:null,correctText:re==="typed"?J.typed_a:re==="tf"?J.a?"TRUE":"FALSE":J.o[J.a],isCorrect:!1,timedOut:!0}],H.current=[...H.current,{id:J.id,q:J.q,correct:re==="typed"?J.typed_a:re==="tf"?J.a?"TRUE":"FALSE":J.o[J.a],cat:J.cat,hint:J.hint}]}be(re=>[...re,!1]),B(re=>(K(0),ue(qe=>(_(e[b]?.a??-1),Z(!0),U.current?.(re,qe,"timeout"),qe)),re))},ne),()=>{clearInterval(je.current),clearTimeout(Fe.current)}},[b,Je,ge,Ie,x]),ge?null:P?t.jsxs("div",{className:`quiz-wrap qd-wrap${P?.cat?` cat-${P.cat}`:""}`,children:[de&&t.jsx(Xd,{}),de&&t.jsx("div",{style:{position:"fixed",top:"28%",left:"50%",transform:"translate(-50%, -50%)",background:"linear-gradient(135deg, #FBBF24 0%, #F59E0B 100%)",color:"#1a1a1a",padding:"10px 22px",borderRadius:100,fontSize:13,fontWeight:900,letterSpacing:.2,boxShadow:"0 8px 32px rgba(251, 191, 36, 0.5), 0 2px 8px rgba(0,0,0,0.3)",zIndex:501,pointerEvents:"none",fontFamily:"'Inter',sans-serif",animation:"hardRightBadge 1.5s cubic-bezier(0.22, 1, 0.36, 1) forwards"},children:"ð HARD · NAILED IT"}),t.jsxs("div",{className:"qd-topbar",children:[t.jsxs("div",{className:"qd-topbar-l",children:[t.jsxs("span",{className:"qd-badge",children:[t.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"12",cy:"13",r:"7.5"}),t.jsx("path",{d:"M12 13V9M9.5 2.5h5"})]}),Jt]}),wt&&t.jsx("span",{className:"qd-cat",children:wt})]}),t.jsxs("div",{className:"qd-topbar-r",children:[t.jsx("span",{className:"qd-counter",children:Kt}),t.jsx("button",{className:"qd-close",onClick:()=>{if(b===0){u();return}R(!0)},"aria-label":"Quit game",children:t.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:t.jsx("path",{d:"M6 6l12 12M18 6 6 18"})})})]})]}),t.jsx("div",{className:"qd-progress","aria-hidden":"true",children:t.jsx("div",{className:"qd-progress-fill",style:{width:`${_a}%`}})}),t.jsxs("div",{className:"qd-play",children:[t.jsxs("div",{className:"q-top",children:[t.jsx("button",{className:"back-btn",onClick:()=>{if(b===0&&(!Je||!x)){u();return}R(!0)},"aria-label":"Go back",children:"â"}),a==="survival"?t.jsx("div",{style:{flex:1}}):t.jsx("div",{className:"prog-pips","aria-hidden":"true",children:Array.from({length:Be},(S,z)=>t.jsx("i",{className:z<te.length?te[z]?"ok":"no":z===te.length?"now":""},z))}),t.jsxs("div",{className:"q-top-right",children:[t.jsxs("span",{className:"q-score-live","aria-hidden":Q===0||void 0,style:Q===0?{visibility:"hidden"}:void 0,children:[Q,t.jsx("span",{className:"q-score-tick",children:" â"})]}),t.jsx("span",{className:"q-ctr",children:a==="survival"?`Q${b+1}`:`${b+1}/${Be}`}),k&&t.jsx("button",{className:"icon-btn",onClick:k,"aria-label":"How to play",title:"How to play",children:"?"})]})]}),ie>0&&t.jsxs("div",{className:"streak-beat",role:"status",children:[t.jsx(ma,{size:14,strokeWidth:2.4,"aria-hidden":"true"})," ",ie," in a row"]}),a==="survival"&&t.jsxs("div",{className:"streak-bar",children:[t.jsxs("div",{className:"streak-n",children:[t.jsx(ma,{size:18,strokeWidth:2.4,"aria-hidden":"true"}),T]}),t.jsxs("div",{className:"streak-info",children:[t.jsx("strong",{children:T===0?"Survival Mode":T===1?"First one!":T<5?"Keep going!":T<10?"On fire!":"Unstoppable!"}),m>0&&t.jsxs("span",{style:{fontSize:11,color:"var(--t3)",marginLeft:6},children:["PB: ",m]}
112),T>0&&m>0&&T>=m&&t.jsx("span",{style:{fontSize:11,color:"var(--gold)",marginLeft:4,fontWeight:700},children:"New PB"})]})]}),Je&&!Ie&&t.jsxs("div",{className:"timer-row",children:[t.jsx("div",{className:"timer-track",children:t.jsx("div",{className:"timer-fill",style:{width:`${M/W*100}%`,background:M/W>.5?"var(--accent)":M/W>.25?"var(--gold)":"var(--red)",transition:M>Ue.current?"none":void 0}})}),t.jsxs("span",{className:`timer${M/W<=.25?" urgent":""}`,children:[M,"s"]})]}),t.jsx("div",{className:"sr-only",role:"timer","aria-live":"assertive","aria-atomic":"true",children:Je&&!Ie?M===10?"10 seconds left":M===5?"5 seconds left":M===0?"Time's up":"":""}),t.jsxs("div",{className:"qd-meta","aria-hidden":"true",children:[t.jsxs("span",{className:"qd-pill qd-pill-streak",children:[t.jsx("span",{className:"qd-pill-ic",children:t.jsx(ma,{size:13,strokeWidth:2.4,"aria-hidden":"true"})}),T," streak"]}),Je&&!Ie?t.jsxs("div",{className:"qd-ring",children:[t.jsxs("svg",{width:"78",height:"78",viewBox:"0 0 78 78",children:[t.jsx("circle",{cx:"39",cy:"39",r:"33",fill:"none",stroke:"#242730",strokeWidth:"7"}),t.jsx("circle",{cx:"39",cy:"39",r:"33",fill:"none",stroke:Pe,strokeWidth:"7",strokeLinecap:"round",strokeDasharray:Tt,strokeDashoffset:Tt*(1-V),transform:"rotate(-90 39 39)",style:{transition:M>Ue.current?"none":"stroke-dashoffset 0.9s linear, stroke 0.3s ease"}})]}),t.jsx("span",{className:"qd-ring-n",children:M})]}):null,t.jsxs("span",{className:"qd-pill qd-pill-correct",children:[t.jsx("span",{className:"qd-pill-num",children:Q}),"correct"]})]}),t.jsxs("div",{className:"qd-eyebrow","aria-hidden":"true",children:["Question ",b+1]}),t.jsxs("div",{className:"q-card q-fade",style:wc(P.cat),children:[t.jsx("div",{className:"q-tag",style:xc(P.cat),children:Rr[P.cat]||P.cat}),t.jsx("div",{className:"q-text",style:{fontSize:18},children:P.q})]},b),vt?t.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12,marginTop:8},children:[!0,!1].map(S=>{const z=j!==null,ne=P.a===!0||P.a===1,J=S===ne,re=j===(S?1:0);
112let qe="var(--s1)",ke="2px solid var(--border)",Oe="var(--t1)";return z&&(J?(qe="var(--green)",ke="2px solid var(--green)",Oe="#fff"):re?(qe="var(--red)",ke="2px solid var(--red)",Oe="#fff"):(qe="var(--s2)",ke="2px solid var(--border)",Oe="var(--t3)")),t.jsxs("button",{disabled:z,onClick:()=>{ve("select"),Re(S?1:0)},onPointerDown:gt=>{z||(gt.currentTarget.style.transform="scale(0.97)")},onPointerUp:gt=>{gt.currentTarget.style.transform=""},style:{padding:"20px 8px",fontSize:17,fontWeight:800,borderRadius:16,background:qe,border:ke,color:Oe,cursor:z?"default":"pointer",transition:"all 0.2s",fontFamily:"inherit",opacity:z&&!J&&!re?.55:1},children:[z&&J?"â ":z&&re&&!J?"â ":"",S?"TRUE":"FALSE"]},String(S))})}):Ie?t.jsx(eu,{question:P,diff:n,hintsEnabled:d,onAnswer:(S,z)=>{try{document.activeElement?.blur?.()}catch{}A(S?"correct":"wrong"),S&&P.diff==="hard"&&(ve("hardCorrect"),we(!0),ye.current&&clearTimeout(ye.current),ye.current=setTimeout(()=>we(!1),Sa.ANSWER_REVEAL)),kt(S,z,-1)}},b):t.jsx("div",{className:"opts",children:P.o.map((S,z)=>{const ne=j!==null,J=z===P.a,re=z===j;let qe="opt";ne&&(J?qe+=" correct":re?qe+=" wrong":qe+=" neutral-after");const ke=ne&&J?"â":ne&&re?"â":af[z];return t.jsxs("button",{className:qe,"aria-disabled":ne||void 0,onClick:()=>{if(!ne){Re(z);return}I&&Nt(I.ns,I.nb,I.correct)},onPointerDown:Oe=>{ne||(Oe.currentTarget.style.transform="scale(0.97)")},onPointerUp:Oe=>{Oe.currentTarget.style.transform=""},onPointerLeave:Oe=>{Oe.currentTarget.style.transform=""},children:[t.jsx("span",{className:"opt-l",children:ke}),S]},z)})}),lt&&(()=>{const S=!q&&(vt?j===1==(P?.a===!0||P?.a===1):j===P?.a||w==="correct");return t.jsx("div",{role:"status",className:`feedback ${S?"correct":"wrong"}`,children:t.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:S?"â Correct!":q?"Time's up":Ie?`â ${P.typed_a}`:"â Incorrect"})})})(),lt&&P?.hint&&t.jsxs("div",{ref:At,style:{marginTop:10,padding:"10px 14px",background:"var(--s1)",border:"1px solid var(--border)",borderRadius:10,fontSize:13,lineHeight:1.5,color:"var(--t2)",animation:"fadeIn 0.4s ease-out"},children:[t.jsxs("div",{style:{fontSize:10,fontWeight:700,color:"var(--t3)",letterSpacing:.2,fontFamily:"'Inter',sans-serif",marginBottom:4,display:"flex",alignItems:"center",gap:4},children:[t.jsx(qn,{size:11,strokeWidth:2.5,"aria-hidden":"true"})," Why?"]}),t.jsx("div",{children:P.hint})]}),lt&&I&&t.jsxs("div",{className:"q-sticky-foot",children:[lt&&p&&(()=>{const S=P?._histKey||(P?.id!=null?String(P.id):P?.q);return t.jsx(Xl,{onReport:p,idle:t.jsxs(t.Fragment,{children:[t.jsx(sc,{size:13,strokeWidth:2.4,"aria-hidden":"true"})," Report a problem"]}),idleColor:"var(--t3)",info:()=>{const z=vt?j===1?"True":j===0?"False":null:typeof j=="number"&&Array.isArray(P?.o)?P.o[j]:null,ne=vt?P?.a===!0||P?.a===1?"True":"False":Array.isArray(P?.o)&&typeof P?.a=="number"?P.o[P.a]:P?.typed_a||null;return{id:P?.id,q:P?.q,picked:z,correct:ne,mode:a}},style:{display:"block",margin:"16px auto 0",padding:"12px 14px",minHeight:44,background:"transparent",border:"none",borderRadius:10,fontSize:12.5,fontWeight:600}},S)})(),t.jsx("button",{className:"next-btn-primary",onClick:()=>Nt(I.ns,I.nb,I.correct),children:b+1>=Be?"Results â":"Next â"})]})]}),it&&t.jsx("div",{className:"modal-overlay",onClick:()=>R(!1),children:t.jsxs("div",{ref:L,tabIndex:-1,className:"modal-box",role:"dialog","aria-modal":"true","aria-labelledby":"quit-title",onClick:S=>S.stopPropagation(),children:[t.jsx("div",{className:"modal-grab","aria-hidden":"true"}),t.jsxs("div",{className:"modal-head",children:[t.jsx("div",{className:"modal-title",id:"quit-title",children:"Leave this quiz?"}),t.jsx("div",{className:"modal-body",children:b>0?t.jsxs(t.Fragment,{children:[t.jsx("strong",{children:Q})," right from ",t.jsx("strong",{children:b})," answered â that's lost if you quit."]}):"Your progress will be lost."})]}),t.jsxs("div",{className:"modal-btns",children:[t.jsx("button",{className:"modal-btn modal-cancel",onClick:()=>R(!1),children:"Keep playing"}),t.jsx("button",{className:"modal-btn modal-confirm",onClick:()=>{try{$a()}catch{}u()}
112,children:"Quit"})]})]})})]}):t.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"60vh",gap:14,padding:"0 24px",textAlign:"center"},children:[t.jsx("div",{style:{fontSize:36},children:"â½"}),t.jsx("div",{style:{fontFamily:"'Inter',sans-serif",fontSize:16,fontWeight:700,color:"var(--text)"},children:"Couldn't load questions"}),t.jsx("div",{style:{fontFamily:"'Inter',sans-serif",fontSize:13,color:"var(--t2)",lineHeight:1.5},children:"Please try again in a moment."}),t.jsx("button",{onClick:u,className:"btn-3d",style:{marginTop:6,maxWidth:240},children:"Back to Home"})]})}const yi={fontSize:17,fontWeight:700,color:"var(--text)",margin:"28px 0 10px"},Nn={fontSize:15,color:"var(--t2)",marginBottom:12},wh={fontSize:15,color:"var(--t2)",marginBottom:6};function au({user:e,isGuest:a,showToast:n,setPendingJoinCode:r}){const[i,c]=l.useState(!1),[d,o]=l.useState([]),[u,m]=l.useState([]),p=l.useCallback(async()=>{if(!e?.id){o([]),m([]);return}try{const w="id,requester_id,requester:profiles!requester_id(id,username,avatar:avatar_id,photo:avatar_url)",{data:A}=await $.from("friendships").select(w).eq("addressee_id",e.id).eq("status","pending").limit(50);o(Array.isArray(A)?A:[])}catch{}try{const{data:w}=await $.from("notifications").select("id,type,actor_name,actor_avatar,payload,created_at").eq("user_id",e.id).eq("read",!1).order("created_at",{ascending:!1}).limit(50);m(Array.isArray(w)?w:[])}catch{}},[e?.id]);l.useEffect(()=>{p()},[p]),l.useEffect(()=>{const w=()=>p();return window.addEventListener("focus",w),()=>window.removeEventListener("focus",w)},[p]),l.useEffect(()=>{if(!e?.id||a)return;const w=setInterval(()=>{(typeof document>"u"||document.visibilityState==="visible")&&p()},3e4);return()=>clearInterval(w)},[e?.id,a,p]);const g=d.length+u.length,k=l.useCallback(async(w,A)=>{o(q=>q.filter(Z=>Z.id!==w));try{const{error:q}=await $.from("friendships").update({status:A?"accepted":"declined"}).eq("id",w);if(q)throw q;n(A?"â Friend added":"Request declined")}catch(q){console.warn("[friends] respondFriendRequest",q?.message||"Unknown error"),n("Couldn't update â try again"),p()}},[n,p]),b=l.useCallback(async w=>{const A=w?.payload?.code;m(q=>q.filter(Z=>Z.id!==w.id)),c(!1);try{await $.from("notifications").update({read:!0}).eq("id",w.id)}catch{}A?r(String(A).toUpperCase()):n("This invite's room has expired")},[n]),N=l.useCallback(async w=>{m(A=>A.filter(q=>q.id!==w.id));try{await $.from("notifications").update({read:!0}).eq("id",w.id)}catch{}},[]),j=l.useCallback(async(w,A)=>{if(X("share-join"),!w||!A)return!1;try{const{error:q}=await $.rpc("send_play_invite",{p_addressee:w,p_code:A});return q?(/not friends/i.test(q.message||"")||(console.warn("[sendPlayInvite]",q.message),Le(q,{tags:{area:"play-invite"}})),!1):!0}catch(q){return console.warn("[sendPlayInvite]",q?.message||q),!1}},[]),_=l.useCallback(()=>{c(!0),p()},[p]);return{notifOpen:i,setNotifOpen:c,notifRequests:d,notifInvites:u,notifCount:g,loadNotifs:p,respondFriendRequest:k,joinInvite:b,dismissInvite:N,sendPlayInvite:j,openNotifs:_}}function nu({screen:e,inGame:a}){const n=l.useRef(null);return l.useEffect(()=>{const r=n.current;if(!r)return;let i=window.scrollY,c=!1,d=!1;const o=()=>{c=!1;const m=window.scrollY,p=m-i;if(document.documentElement.scrollHeight-window.innerHeight<window.innerHeight*.6){d&&(d=!1,r.classList.remove("tab-bar--tucked"));return}if(Math.abs(p)<14)return;const k=m+window.innerHeight>=document.documentElement.scrollHeight-24,b=p>0&&m>140&&!k;b!==d&&(d=b,r.classList.toggle("tab-bar--tucked",d)),i=m},u=()=>{c||(c=!0,requestAnimationFrame(o))};return window.addEventListener("scroll",u,{passive:!0}),()=>window.removeEventListener("scroll",u)},[e,a]),n}const Ir=yt("Share",{web:()=>le(()=>import("./web-Cu_9C3mn.js"),__vite__mapDeps([10,1])).then(e=>new e.ShareWeb)});function ru({user:e,showToast:a,profile:n,setProfile:r,authProfile:i,stats:c,xp:d,loginStreak:o,dailyScore:u}){const m=l.useRef(!1),[p,g]=l.useState(!1),[k,b]=l.useState(""),N=l.useRef(null),j=l.useCallback(()=>{const B=i?.username;
112if(B&&B!=="Player"&&!/^player_/i.test(B))return B;const T=n?.name;return T&&T!=="Player"?T:""},[i,n]),_=l.useCallback(async B=>{const T=u||0,K=7,ae=new Date().toLocaleDateString("en-GB",{day:"numeric",month:"short"}),ue=Array.from({length:K},(ce,je)=>je<T?"â ":"â").join(""),ie=o>0?`ð¥ ${o}-day streak`:"",xe=(()=>{const ce=new Date;return`${ce.getFullYear()}${String(ce.getMonth()+1).padStart(2,"0")}${String(ce.getDate()).padStart(2,"0")}`})(),se=`${Pr}/c/${T}.${xe}${B?"."+encodeURIComponent(B).replace(/\./g,"%2E"):""}${e?.id?`?f=${e.id}`:""}`,M=[`â½ ${Ce} Daily 7`,`ð ${ae}`,`ð¯ ${T}/${K}`,ie,"",ue,"","Think you can beat me?",se].filter(Boolean),Se=M.join(` 113`),ge=M.slice(0,-1).join(` 114`);try{if(navigator.share){await navigator.share({title:`${Ce} Daily 7`,text:ge,url:se}),X("share-daily-done",{via:"sheet"});return}}catch(ce){if(ce&&ce.name==="AbortError"){X("share-daily-cancel");return}}try{await navigator.clipboard.writeText(Se),a("ð Copied to clipboard"),X("share-daily-done",{via:"clipboard"})}catch{a("Couldn't share â try again")}},[u,o,a]),w=l.useCallback(()=>{X("share-daily");const B=j();if(!B){b(""),m.current=!0,g(!0);return}return _(B)},[j,_]),A=l.useCallback(B=>{const T=String(B||"").trim().slice(0,22);m.current=!1,g(!1),T&&r(K=>({...K,name:T})),_(T)},[r,_]),q=l.useCallback(()=>{m.current=!1,g(!1)},[]);ft({isOpen:p,onClose:q,ref:N});const Z=l.useCallback(async(B,T,K,ae={})=>{const ue=T?Math.round(B/T*100):0,ie="Can you beat me? â½",xe=ae?.club?rf[ae.club]:null,se=ae?.league?of[ae.league]:null,M=xe?`/play?club=${xe}`:se?`/play?quiz=${se}`:"/play",Se=`balliq.app${M}`,ge={daily:(()=>{const Ue=Array.from({length:T},(mt,it)=>it<B?"ð¢":"ð´").join("");return`â½ ${Ce} â Daily 7 115${Ue} 116${B}/${T} correct · ${ue}% accuracy 117${ie} 118${Se}`})(),classic:`${ue===100?"ð":ue>=80?"ð¥":ue>=60?"â½":"ð "} ${Ce} â Classic Quiz 119${pi(ue)} 120${B}/${T} correct · ${ue}% accuracy 121${ie} 122${Se}`,survival:`ð¥ ${Ce} â Survival 123${B} in a row before missing one 124${ie} 125${Se}`,hotstreak:`â¡ð¥ ${Ce} â Hot Streak 126${B} correct in 60 seconds (${T} answered) 127${ie} 128${Se}`,truefalse:`â ${Ce} â True or False 129${B}/${T} correct · ${ue}% accuracy 130${ie} 131${Se}`,legends:`ð ${Ce} â Legends & History 132${B}/${T} correct · ${ue}% accuracy 133${ie} 134${Se}`,local:`ð¤ ${Ce} â Local Multiplayer 135Final scores in â settle it on the rematch. 136${ie} 137${Se}`,chaos:`ð ${Ce} â Chaos 138${B}/${T} correct · ${ue}% accuracy 139${ie} 140${Se}`},ce=ge[K]||ge.classic;if(K==="local"){try{if(He){await Ir.share({title:Ce,text:ce,dialogTitle:"Share result"});return}if(typeof navigator<"u"&&typeof navigator.share=="function"){await navigator.share({title:Ce,text:ce});return}}catch(Ue){if(Ue&&(Ue.name==="AbortError"||/cancel/i.test(Ue?.message||"")))return}try{await navigator.clipboard.writeText(ce),a("Copied to clipboard ð")}catch{}return}const je={classic:"Classic Quiz",daily:"Daily 7",survival:"Survival",hotstreak:"Hot Streak",truefalse:"True or False",legends:"Legends & History",local:"Local Multiplayer",chaos:"Chaos Quiz"};let Fe="standard",Me;K==="hotstreak"?(Fe="hotstreak",Me={score:B}):Me={modeLabel:(ae?.club&&Ke[ae.club]?`${Ke[ae.club].name} Quiz`:ae?.league&&nt[ae.league]?`${nt[ae.league].name} Quiz`:null)||je[K]||"Quiz",score:B,total:T,streak:ae?.streak},Me={...Me,deepLink:M},await En(Fe,Me,{onToast:a,textFallback:ce})},[a]),W=l.useCallback(async()=>{const B=c.totalCorrect||0,T=c.totalAnswered||0,K=xa(c.catStats||{},T>0&&B<=T?B/T:.4,{c:B,a:T},c.cardLeague),ae=ge=>!ge||ge==="Player"||/^player_/i.test(ge),ue=i?.username,ie=ue&&!ae(ue)?ue:n.name&&!ae(n.name)?n.name:`${Ce} Player`,{level:xe}=qt(d);let se=null;const M=i?.avatar_url;M&&(se=await new Promise(ge=>{const ce=new Image;ce.crossOrigin="anonymous",ce.onload=()=>ge(ce),ce.onerror=()=>ge(null),setTimeout(()=>ge(null),3e3),ce.src=M}));const Se=Us(n.avatar,e?.id||ie);await En("iq",{card:K,name:ie,levelName:xe?.name||"",levelIcon:xe?.icon||"ð",xp:d||0,avatarImg:se,avatarBg:Se?.bg,initial:gi(ie)},{onToast:a,textFallback:`${as(K,ts(),Ce)} ${Pr}/play`})},[c,i?.username,i?.avatar_url,n.name,n.avatar,e?.id,d,a]),Q=l.useCallback(async()=>{const{level:B}=qt(d),T=c.bestIQ||0,K=c.totalCorrect||0,ae=c.totalAnswered||0,ue=ae===0||K>ae?"â":`${Math.round(100*K/ae)}%`,ie=xa(c.catStats||{},ae>0&&K<=ae?K/ae:.4,{c:K,a:ae},c.cardLeague),xe=new URLSearchParams({n:(()=>{const ge=je=>!je||je==="Player"||/^player_/i.test(je),ce=i?.username;return ce&&!ge(ce)?ce:n.name&&!ge(n.name)?n.name:`${Ce} Player`})(),l:B.name||"",li:B.icon||"â½",x:String(d||0),g:String(c.gamesPlayed||0),s:String(o||0),a:ue,e:/^c\d\d$/.test(String(n.avatar||""))?"â½":n.avatar||"â½",iq:String(T||0
140),...ie.rated?{ov:String(ie.overall),ti:ie.tier,r:ie.ratings.map(ge=>ge.rated?ge.rating:"").join(","),lg:ie.ratings[0]?.cat||"PL"}:{}}),se=i?.avatar_url;se&&xe.set("img",se);const M=`https://balliq.app/p?${xe.toString()}`;X("share-p");const Se=as(ie,ts(),Ce);try{if(He){await Ir.share({title:Ce,text:Se,url:M,dialogTitle:"Share your profile"});return}if(navigator.share){await navigator.share({title:Ce,text:Se,url:M});return}if(navigator.clipboard){await navigator.clipboard.writeText(`${Se} ${M}`),a("Link copied ð");return}}catch(ge){if(ge&&(ge.name==="AbortError"||/cancel/i.test(ge?.message||"")))return;try{navigator.clipboard&&(await navigator.clipboard.writeText(`${Se} ${M}`),a("Link copied ð"))}catch{}}},[d,c,n,o,a,i]);return{shareScore:Z,saveCardImage:W,shareProfile:Q,shareDaily:w,performDailyShare:_,submitShareName:A,cancelShareName:q,resolveChallengerName:j,askShareName:p,askShareNameRef:m,shareNameDraft:k,setShareNameDraft:b,shareNameRef:N}}function ou({user:e,showToast:a}){const[n,r]=l.useState(()=>{try{return Rt()&&Notification.permission==="granted"}catch{return!1}});l.useEffect(()=>{let c=!1;return(async()=>{try{if(!Rt())return;e?.id&&await Wd();const d=await navigator.serviceWorker.getRegistration(),o=d?await d.pushManager.getSubscription():null;c||r(!!o&&Notification.permission==="granted")}catch{}})(),()=>{c=!0}},[e?.id]);const i=l.useCallback(async c=>{if(c){const d=await di();r(d),a(d?"Daily reminders on ð":Wa()==="denied"?"Blocked in your browser â allow notifications for balliq.app":"Couldn't turn reminders on")}else await Od(),r(!1),a("Daily reminders off")},[a]);return{webPushOn:n,setWebPushOn:r,handleToggleWebPush:i}}function su({user:e,isGuest:a,startModeRef:n}){const[r,i]=l.useState(""),[c,d]=l.useState(()=>{try{const p=window.location.pathname.match(/^\/join\/([A-Za-z0-9]+)/),g=p?p[1]:null,b=new URLSearchParams(window.location.search).get("join"),N=g||b;if(N){try{localStorage.setItem("biq_pending_join",JSON.stringify({c:N,at:Date.now()}))}catch{}try{const _=new URL(window.location.href);_.pathname="/",_.searchParams.delete("join"),window.history.replaceState({},"",_.pathname+_.search+_.hash)}catch{}return Ln(N)}const j=localStorage.getItem("biq_pending_join");if(j){let _=null;try{const A=JSON.parse(j);A?.c&&Date.now()-(A.at||0)<24*3600*1e3&&(_=A.c)}catch{}if(!_){try{localStorage.removeItem("biq_pending_join")}catch{}return null}return/[?&](club|quiz|c)=/.test(window.location.search)||/^\/c\//.test(window.location.pathname)?null:Ln(_)}}catch{}return null}),o=l.useCallback(()=>{d(null),X("join-token-consumed");try{localStorage.removeItem("biq_pending_join")}catch{}},[]);l.useEffect(()=>{const p=g=>{const k=String(g?.detail||"").toUpperCase().replace(/[^A-HJ-NP-Z2-9]/g,"").slice(0,6);k&&d(k)};return window.addEventListener("biq:join-code",p),()=>window.removeEventListener("biq:join-code",p)},[]);const u=l.useRef(null),m=l.useRef(!1);return l.useEffect(()=>{if(!c){m.current=!1;return}!e||a||m.current||(m.current=!0,n.current?.("online"))},[c,e?.id,a]),{pendingJoinCode:c,setPendingJoinCode:d,clearPendingJoin:o,stage1RoomCode:r,setStage1RoomCode:i,joinGateRef:u,autoJoinRoutedRef:m}}function iu({user:e,dailyDone:a,loginStreak:n,showToast:r,initialStreakRef:i,webPushOn:c,handleToggleWebPush:d}){const[o,u]=l.useState(()=>{try{return localStorage.getItem("biq_notif_enabled")==="1"}catch{return!1}}),m=l.useRef(null);l.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]);const[p,g]=l.useState(!1),k=l.useCallback(async A=>{if(A){const q=await Bd();if(X(q?"notif-permission-granted":"notif-permission-denied"),!q){u(!1);try{localStorage.removeItem("biq_notif_enabled")}catch{}r("Turn on notifications for Ball IQ in iOS Settings to get reminders");return}try{localStorage.setItem("biq_notif_enabled","1"),localStorage.removeItem("biq_notif_disabled")}catch{}u(!0),e?.id&&oi(e.id,{requestPermission:!0});const Z=va(),W=a||Z.kind==="won"||Z.kind==="lost";fr({skipToday:W,streak:n}),r("Daily reminders on ð")}else{try{localStorage.removeItem("biq_notif_enabled"),localStorage.setItem("biq_notif_disabled","1")}catch{}u(!1),Fr(),r("Daily reminders off")}},[a,r,e?.id,n]),[b,N]=l.useState(0),j=pt()?o?"on":p?"blocked":"off":Rt()&&e?.id?c?"on":Wa()==="denied"?"blocked":"off":Ul(),_=l.useCallback(async()=>
140{const A=pt()?"native":e?.id?"web":"web-visitor";if(X("results-remind-tap",{engine:A}),pt())await k(!0);else if(e?.id)await d(!0);else{const q=await $l();X(q==="on"?"web-remind-on":q==="blocked"?"web-remind-denied":"web-remind-failed",{engine:A}),N(Z=>Z+1),q==="on"&&r("Daily reminders on ð")}},[k,d,e?.id,r]),w=l.useCallback(async()=>{try{const q=parseInt(localStorage.getItem("biq_notif_last_ask")||"0",10);if(q&&Date.now()-q<24*3600*1e3)return X("notif-prompt-skipped",{reason:"asked-recently",engine:pt()?"native":"web"}),!1}catch{}if(!pt())try{const q=Q=>(X("notif-prompt-skipped",{reason:Q,engine:"web"}),!1);if(!Rt())return q("unsupported");if(!e?.id)return q("guest");if(c)return q("already-on");if(Wa()!=="default")return q(`perm-${Wa()}`);if(parseInt(localStorage.getItem("biq_notif_asks_v2")||"0",10)>=2)return q("asks-exhausted");let W=0;try{W=JSON.parse(localStorage.getItem("biq_stats")||"{}")?.gamesPlayed||0}catch{}return W<2?q("too-early"):(m.current&&clearTimeout(m.current),!1)}catch{return!1}const A=q=>(X("notif-prompt-skipped",{reason:q,engine:"native"}),!1);try{if(localStorage.getItem("biq_notif_enabled")==="1")return A("already-enabled");if(parseInt(localStorage.getItem("biq_notif_asks_v2")||"0",10)>=2)return A("asked-twice");let Z=0;try{Z=JSON.parse(localStorage.getItem("biq_stats")||"{}")?.gamesPlayed||0}catch{}if(Z<2)return A("too-early");const W=await Ar();return W!=="prompt"&&W!=="prompt-with-rationale"?A(`perm-${W}`):(m.current&&clearTimeout(m.current),!1)}catch{return!1}},[e?.id,c]);return l.useEffect(()=>{if(!o)return;const A=va(),q=a||A.kind==="won"||A.kind==="lost";fr({skipToday:q,streak:n})},[o,a,n]),l.useEffect(()=>{if(n>=3&&i.current<3){try{if(localStorage.getItem("biq_notif_streak_asked")==="1")return;localStorage.setItem("biq_notif_streak_asked","1")}catch{}w()}},[n,w]),l.useEffect(()=>{let A=!1;const q=async()=>{let W,Q;try{W=localStorage.getItem("biq_notif_enabled")==="1",Q=localStorage.getItem("biq_notif_disabled")==="1"}catch{return}const B=await Ar();if(!A){if(g(B==="denied"),W&&B!=="granted"){u(!1);try{localStorage.removeItem("biq_notif_enabled")}catch{}Fr()}else if(!W&&!Q&&B==="granted"){try{localStorage.setItem("biq_notif_enabled","1")}catch{}u(!0)}}};q();const Z=()=>{document.visibilityState==="visible"&&q()};return document.addEventListener("visibilitychange",Z),()=>{A=!0,document.removeEventListener("visibilitychange",Z)}},[]),l.useEffect(()=>{if(!o)return;const A=()=>{fr({skipToday:!1,streak:n})};return window.addEventListener("biq:day-rollover",A),()=>window.removeEventListener("biq:day-rollover",A)},[o,n]),{notifEnabled:o,setNotifEnabled:u,notifBlocked:p,notifTimerRef:m,handleToggleNotif:k,resultsRemindState:j,remindFromResults:_,maybePromptNotif:w}}const lu=me.memo(function({onInvite:a,onOpen:n}){const r=l.useCallback(c=>{c?.stopPropagation(),a?.()},[a]),i=l.useCallback(c=>{c?.stopPropagation(),n?.()},[n]);return t.jsxs("div",{className:"todays-seven-secondary mp-row",role:"group","aria-label":"Multiplayer",children:[t.jsxs("button",{type:"button",className:"mp-row-open",onClick:i,"aria-label":"Open the Multiplayer tab",children:[t.jsx("span",{className:"t7s-icon","aria-hidden":"true",children:t.jsx(yc,{size:22,strokeWidth:2})}),t.jsxs("span",{className:"t7s-body",children:[t.jsx("span",{className:"t7s-title",children:"Multiplayer"}),t.jsx("span",{className:"t7s-sub",children:"Up to 8 players · live rooms or one phone"})]})]}),t.jsx("button",{type:"button",className:"t7s-cta mp-row-invite",onClick:r,"aria-label":"Create a room and invite friends",children:"Invite"})]})}),cu=e=>{const a=(e||"").trim();return!a||a==="Player"||/^player_/i.test(a)};function du(e,a){const n=(a?.username||"").trim();if(!cu(n))return n;const r=e?.user_metadata||{},c=([r.full_name,r.name,r.preferred_username,[r.given_name,r.family_name].filter(Boolean).join(" "),r.display_name].filter(d=>typeof d=="string"&&d.trim().length>0)[0]||"").trim().replace(/\s+/g," ").slice(0,24);return c.length>=3?c:""}const uu=()=>{};function fu({user:e,authProfile:a,onSaved:n,onEvent:r}){const i=l.useMemo(()=>du(e,a),[e,a]),c=l.useRef(null);ft({isOpen:!0,onClose:uu,ref:c});const[d,o]=l.useState(i),[u,m]=l.useState(!1),[p,g]=l.useState(""),k=l.useRef(r);k.current=r;const b=l.useCallback((j,_)=>{try{k.current?.(j,_)}catch{}},[]);l.useEffect(()=>{b("username-step-shown",{prefilled:i.length>0,hadSpace:/\s/.test(i)})},[]);const N=async()=>{const j=d.trim().replace(/\s+/g," ");
140if(j.length<3){g("Username must be at least 3 characters"),b("username-step-rejected",{reason:"too-short"});return}if(ni(j)){g("This username isn't allowed. Please choose another."),b("username-step-rejected",{reason:"profanity"});return}if(!e?.id){b("username-step-saved",{path:"local"}),n(j);return}m(!0),g("");try{const{error:_}=await $.from("profiles").update({username:j}).eq("id",e.id);if(_){const w=_.message||"",A=/profiles_username_key|duplicate key|already (?:registered|taken)/i.test(w);g(A?`"${j}" is already taken â try another.`:"Couldn't save â check your connection and try again."),b("username-step-rejected",{reason:A?"duplicate":"write-failed"}),m(!1);return}b("username-step-saved",{path:"profile",changed:j!==i}),n(j)}catch{g("Couldn't save â check your connection and try again."),m(!1)}};return t.jsx("div",{ref:c,tabIndex:-1,className:"onboard-wrap",role:"dialog","aria-modal":"true","aria-label":"Choose your username",children:t.jsx("div",{className:"onboard-viewport",children:t.jsxs("div",{className:"onboard-step",style:{width:"100%"},children:[t.jsxs("div",{className:"onboard-step-top",children:[t.jsx("div",{className:"onboard-icon","aria-hidden":"true",children:"â½ï¸"}),t.jsx("div",{className:"onboard-title",children:"Pick your username"}),t.jsx("div",{className:"onboard-body",children:"This is how you'll show up on leaderboards and to friends. You can change it later in your profile."}),t.jsx("input",{className:"profile-name-input",style:{width:"100%",maxWidth:340,textAlign:"center",marginBottom:10},value:d,onChange:j=>{o(j.target.value.slice(0,24)),p&&g("")},onKeyDown:j=>{j.key==="Enter"&&!u&&N()},placeholder:"Your username",maxLength:24,"aria-label":"Your username","aria-invalid":!!p}),p&&t.jsx("div",{style:{color:"#ef4444",fontSize:13,fontWeight:600,maxWidth:340,marginBottom:6},role:"alert",children:p})]}),t.jsx("div",{className:"onboard-actions",children:t.jsx("button",{className:"onboard-btn",onClick:N,disabled:u||d.trim().length<3,style:u||d.trim().length<3?{opacity:.55}:void 0,children:u?"Savingâ¦":"Continue"})})]})})})}function za(e,a){return e?.avatar_id||a?.avatar||""}const hu=["Arsenal","Liverpool","Barcelona","Chelsea","ManCity","RealMadrid","Tottenham","ManUtd"],ws=e=>{const a=/^#?([0-9a-f]{6})$/i.exec(String(e||""));if(!a)return"#fff";const n=parseInt(a[1],16),r=n>>16&255,i=n>>8&255,c=n&255;return(.2126*r+.7152*i+.0722*c)/255>.62?"#14171A":"#fff"};function mu({clubPacks:e,clubAbbr:a,onPickClub:n,onAllClubs:r}){const[i,c]=me.useState(""),[d,o]=me.useState(!1);if(!e)return null;const u=b=>String(b||"").toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,""),m=u(i.trim()),p=m?Object.entries(e).map(([b,N])=>{const j=u(N.name),_=u(a?.[b]);return j.startsWith(m)||_===m?{key:b,pack:N,rank:0}:j.includes(m)||_.startsWith(m)?{key:b,pack:N,rank:1}:null}).filter(Boolean).sort((b,N)=>b.rank-N.rank||b.pack.name.localeCompare(N.pack.name)).slice(0,8):[],g=b=>{c(""),n(b)},k=Object.keys(e).length;return t.jsxs("div",{className:"club-finder",role:"search",children:[t.jsxs("div",{className:"cf-field",children:[t.jsx(tc,{size:18,strokeWidth:2.25,"aria-hidden":"true",className:"cf-icon"}),t.jsx("input",{type:"search",className:"cf-input",value:i,onChange:b=>c(b.target.value),onFocus:()=>o(!0),onBlur:()=>setTimeout(()=>o(!1),120),onKeyDown:b=>{b.key==="Enter"&&p[0]&&g(p[0].key),b.key==="Escape"&&c("")},placeholder:"Find your clubâ¦","aria-label":"Find your club",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,enterKeyHint:"search"}),m&&d&&t.jsxs("div",{className:"cf-results",role:"listbox","aria-label":"Clubs",children:[p.length===0&&t.jsxs("div",{className:"cf-empty",children:["No club called â",i.trim(),"â on file yet. ",t.jsx("button",{type:"button",className:"cf-link",onClick:r,children:"See every club"})]}),p.map(({key:b,pack:N})=>t.jsxs("button",{type:"button",role:"option",className:"cf-row",onMouseDown:j=>j.preventDefault(),onClick:()=>g(b),children:[t.jsx("span",{className:"cf-abbr",style:{background:N.color||"var(--s2)",color:ws(N.color)},children:a?.[b]||N.name.slice(0,3).toUpperCase()}),t.jsx("span",{className:"cf-name",children:N.name}),t.jsx("span",{className:"cf-go",children:"Play â"})]},b))]})]}),t.jsxs("div",{className:"cf-chips","aria-label":"Most played clubs",children:[hu.filter(b=>e[b]).map(b=>t.jsxs("button",{type:"button",className:"cf-chip",onClick:()=>n(b),children:[t.jsx("span",{className:"cf-abbr",style:{background:e[b].color||"var(--s2)",color:ws(e[b].color)},children:a?.[b]||b.slice(0,3).toUpperCase()}),t.jsx("span",{className:"cf-chip-name",children:e[b].name})]},b)),t.jsxs("button",{type:"button",className:"cf-chip cf-chip-all",onClick:r,children:["All ",k," clubs â"]})]})]})}function gu({showSettings:e=!0,profile:a,loginStreak:n,streakPulsing:r,bestLoginStreak:i,stats:c,xp:d,dailyHistory:o,dailyDone:u,dailyScore:m,setTab:p,setNameEditNonce:g,setScreen:k,showToast:b,viewPuzzleStatus:N,viewDailyScore:j,startMode:_,shareCard:w,challenge:A,onPlayChallenge:q,onDismissChallenge:Z,setOnlineAutoCreate:W,notifCount:Q=0,onOpenNotifs:B,clubPacks:T,clubAbbr:K,launchClubQuiz:ae,firstSession:ue=!1}){const{user:ie,profile:xe,isGuest:se,openAuthPrompt:M}=Rn(),[Se,ge]=me.useState(!1);me.useEffect(()=>{const x=setTimeout(()=>ge(!0),800);return()=>clearTimeout(x)},[]);const[ce,je]=me.useState(()=>{try{return JSON.parse(localStorage.getItem("biq_modes_seen")||"{}")||{}}catch{return{}}}),Fe=me.useCallback(x=>{je(E=>{if(E[x])return E;const I={...E,[x]:1};try{localStorage.setItem("biq_modes_seen",JSON.stringify(I))}catch{}return I})},[]),Me=(()=>{try{return!!vr()}catch{return!1}})(),Ue=(()=>{try{return!!Gl(ec,Ql())}catch{return!1}})(),mt=!1,it=x=>!x||x==="Player"||/^player_/i.test(x),L=(xe?.username&&!it(xe.username)?xe.username:null)||(a?.name&&!it(a.name)?a.name:"Ball I
140Q Player");return t.jsxs("div",{className:"screen tab-content home-screen",children:[t.jsxs("div",{className:"home-col-main",children:[(()=>{(a?.name||"").trim();const x=G=>!G||G==="Player"||/^player_/i.test(G);xe?.username&&!x(xe.username)&&xe.username;const I=(()=>{const U=new Date().getHours();return U<5?"Still up":U<12?"Good morning":U<18?"Good afternoon":"Good evening"})(),v=va();return v.kind==="won"||v.kind,t.jsx("div",{className:"hg-block",style:{padding:"6px 0 8px"},children:t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[t.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:6,flex:1,minWidth:0},children:t.jsx("div",{className:"hg-greet",style:{fontSize:20,fontWeight:800,letterSpacing:"-0.02em",color:"var(--t1)",lineHeight:1.1,maxWidth:"100%"},children:I})}),n>0&&t.jsxs("span",{className:`hst-streak${r?" is-pulsing":""}`,"aria-label":`${n}-day streak`,children:[t.jsx("span",{className:"hst-flame","aria-hidden":"true",children:t.jsx(ma,{size:14,strokeWidth:2.4})}),t.jsx("span",{className:"hst-num",children:n})]}),B&&t.jsxs("button",{onClick:B,className:"icon-btn hdr-ic","aria-label":Q>0?`Notifications, ${Q} new`:"Notifications",style:{flexShrink:0,position:"relative"},children:[t.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[t.jsx("path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"}),t.jsx("path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0"})]}),Q>0&&t.jsx("span",{className:"notif-dot","aria-hidden":"true"})]}),e&&t.jsx("button",{onClick:()=>k("settings"),className:"icon-btn hdr-ic","aria-label":"Settings",style:{flexShrink:0},children:t.jsx(Wr,{size:18,strokeWidth:2.25,"aria-hidden":"true"})})]})})})(),A&&t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",marginBottom:10,background:"linear-gradient(135deg, rgba(88,204,2,0.16), rgba(88,204,2,0.05))",border:"1px solid rgba(88,204,2,0.30)",borderRadius:14},children:[t.jsx("span",{style:{display:"inline-flex",color:"var(--accent)"},"aria-hidden":"true",children:t.jsx(br,{size:22,strokeWidth:2.2})}),t.jsxs("div",{style:{flex:1,minWidth:0},children:[t.jsx("div",{style:{fontSize:13.5,fontWeight:800,color:"var(--t1)",lineHeight:1.25},children:A.name?`${A.name} challenged you`:"You've been challenged"}),t.jsxs("div",{style:{fontSize:12,color:"var(--t2)",marginTop:1},children:["Beat ",A.score,"/7",A.date!==St(new Date).replace(/-/g,"")?" (yesterday's score)":""," on today's Daily 7"]})]}),t.jsx("button",{onClick:q,style:{flexShrink:0,minHeight:36,padding:"8px 14px",background:"var(--accent)",color:"var(--grn-ink)",border:"none",borderRadius:999,boxShadow:"0 8px 22px -8px rgba(88,204,2,0.55)",fontFamily:"inherit",fontSize:13.5,fontWeight:800,cursor:"pointer",WebkitTextFillColor:"var(--grn-ink)"},children:"Play"}),t.jsx("button",{onClick:Z,"aria-label":"Dismiss challenge",style:{flexShrink:0,background:"none",border:"none",color:"var(--t3)",fontSize:18,cursor:"pointer",padding:"4px 2px",lineHeight:1},children:"Ã"})]}),(()=>{const x=va(),E=x.kind==="won"||x.kind==="lost",I=["won","lost"].includes(Bs()?.status),v=Vl(new Date),G=!!(v?.won||v?.gaveUp),U=G?0:v?.guesses?.length||0,H=2+(Me?1:0)+(Ue?1:0),ee=(E?1:0)+(u?1:0)+(Me&&I?1:0)+(Ue&&G?1:0),te=ee===H;return t.jsxs("div",{className:"daily-zone",role:"group","aria-label":"Today's puzzles",children:[t.jsxs("div",{className:"daily-zone-head",children:[t.jsx("span",{className:"hg-dateline",children:new Date().toLocaleDateString(void 0,{weekday:"long",day:"numeric",month:"long"})}),t.jsxs("button",{type:"button",className:`daily-zone-status hit44${te?" is-done":""}`,onClick:()=>p("daily"),"aria-label":te?`All ${H} of today's puzzles done â open History`:`${ee} of ${H} puzzles played today â open History`,children:[te?`${H}/${H} done`:`${ee}/${H} today`,t.jsx("span",{"aria-hidden":"true",style:{marginLeft:5,opacity:.7},children:"âº"})]})]}),t.jsx("div",{className:"daily-well",children:[{key:"footle",name:"Footle",no:Kl(),accent:gn.footle,rgb:mn.footle,icon:t.jsx("span",{className:"fh-tile fh-tile-green t7s-f","aria-hidden":"true",children:"F"}),done:E,open:x.kind==="in-progress",sub:x.kind==="won"?t.jsxs(t.Fragment,{children:["Solved in ",t.jsx("strong",{children:x.used})]}):x.kind==="lost"?t.jsx(t.Fragment,{children:"Out of guesses"}):x.kind==="in-progress"?t.jsxs(t.Fragment,{children:["In progress · ",t.jsx("strong",{children:x.used})," of 6"]}):ue?t.jsx(t.Fragment,{children:"Start here â everyone gets the same player"}):t.jsx(t.Fragment,{children:Ll}),onTap:()=>k("wordle"),aria:E?"Today's Footle: done â review":"Play today's Footle"},{key:"daily",name:"Daily 7",Icon:Rs,accent:gn.daily7,rgb:mn.daily7,done:u,sub:u?t.jsxs(t.Fragment,{children:["Done · ",t.jsxs("strong",{children:[m,"/7"]}
140)]}):t.jsx(t.Fragment,{children:"7 questions · ~3 min"}),onTap:()=>u?j(new Date,m):_("daily"),aria:u?`Daily 7 complete: ${m} out of 7`:"Play Daily 7"},...Me?[{key:"trail",name:"Transfer Trail",no:Zl(),Icon:Ts,accent:gn.trail,rgb:mn.trail,done:I,sub:I?t.jsx(t.Fragment,{children:"Done · today's player"}):t.jsx(t.Fragment,{children:"Follow the moves · name the player"}),onTap:()=>k("trail"),aria:I?"Today's Transfer Trail: done â review":"Play today's Transfer Trail"}]:[],...Ue?[{key:"mystery",Icon:Ms,name:"Mystery Player",no:Jl(),accent:gn.mystery,rgb:mn.mystery,done:G,open:U>0,sub:G?t.jsx(t.Fragment,{children:"Done · guess who"}):U>0?t.jsxs(t.Fragment,{children:[U," ",U===1?"guess":"guesses"," in · keep hunting"]}):t.jsx(t.Fragment,{children:"Guess who from career clues"}),onTap:()=>k("mystery"),aria:G?"Today's Mystery Player: done â review":U>0?`Today's Mystery Player: ${U} ${U===1?"guess":"guesses"} in â continue`:"Play today's Mystery Player"}]:[]].map(de=>t.jsxs("button",{className:`todays-seven-secondary is-mode ${de.key}-row${de.done?" is-done":""}`,style:{"--mode":de.accent,"--mode-rgb":de.rgb},onClick:de.onTap,"aria-label":de.aria,children:[t.jsx("span",{className:"t7s-icon","aria-hidden":"true",children:de.icon||t.jsx(de.Icon,{size:22,strokeWidth:2})}),t.jsxs("span",{className:"t7s-body",children:[t.jsxs("span",{className:"t7s-title",children:[de.name,de.no?t.jsxs("span",{className:"t7s-no",children:["No. ",de.no]}):null]}),t.jsx("span",{className:"t7s-sub",children:de.sub})]}),t.jsx("span",{className:"t7s-cta",children:de.done?"Review":de.open?"Continue":"Play"})]},de.key))})]})})(),t.jsx(lu,{onInvite:()=>{if(!ie||se){M("invite");return}W?.(!0),k("online-stage1")},onOpen:()=>p("online"),showToast:b})]}),t.jsxs("div",{className:"home-rail","aria-label":"Your stats",children:[(()=>{const x=c?.totalAnswered>0&&(c?.totalCorrect||0)<=c.totalAnswered?(c.totalCorrect||0)/c.totalAnswered:.4,E=xa(c?.catStats||{},x,{c:c?.totalCorrect||0,a:c?.totalAnswered||0},c?.cardLeague),I=Zs(E.tier),v=qt(d||0);return t.jsxs("div",{className:"hr-card hr-rating",children:[t.jsx("div",{className:"hr-rating-glow","aria-hidden":"true"}),t.jsxs("div",{className:"hr-rating-id",children:[t.jsx("div",{className:"hr-avatar",style:{borderColor:"var(--accent)"},children:t.jsx(Fn,{value:za(xe,a),url:xe?.avatar_url,name:L})}),t.jsxs("div",{className:"hr-rating-idcol",children:[t.jsxs("div",{className:"hr-rating-name",children:[t.jsx("span",{className:"hr-rating-nametext",children:L}),t.jsxs("svg",{className:"hr-rating-pencil",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[t.jsx("path",{d:"M12 20h9"}),t.jsx("path",{d:"M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4z"})]})]}),t.jsxs("span",{className:"hr-rating-lvl",children:[t.jsx(v.level.Icon,{size:13,strokeWidth:2.3})," ",v.level.name?`${v.level.name} · `:"",(d||0).toLocaleString()," XP"]})]})]}),(c?.totalAnswered||0)>=jt?t.jsxs("div",{className:"hr-rating-score",children:[t.jsx("div",{className:"hr-rating-num",children:E.overall}),t.jsxs("div",{className:"hr-rating-scap",children:[t.jsx("div",{className:"hr-rating-overall",children:"OVERALL"}),t.jsx("div",{className:"hr-rating-tier",children:I.label})]})]}):t.jsxs("div",{className:"hr-rating-score hr-rating-empty",children:[t.jsx("div",{className:"hr-rating-num","aria-hidden":"true",children:"â"}),t.jsxs("div",{className:"hr-rating-scap",children:[t.jsx("div",{className:"hr-rating-overall",children:"OVERALL"}),t.jsx("div",{className:"hr-rating-tier",style:{color:"var(--t2)",textTransform:"none",letterSpacing:0,fontWeight:600},children:"Answer 10 questions to get rated"})]})]}),t.jsx("button",{type:"button",className:"hr-rating-view",onClick:()=>p("profile"),children:"View full profile â"})]})})(),(()=>{const x=Math.max(0,n||0),E=[];for(let v=13;v>=0;v--)E.push({done:v<x,isToday:v===0});const I=Math.max(i||0,n||0);return t.jsxs("div",{className:"hr-card hr-streak",children:[t.jsxs("div",{className:"hr-streak-head",children:[t.jsxs("div",{className:"hr-streak-num",children:[t.jsx("span",{className:"hr-flame","aria-hidden":"true",children:t.jsx(ma,{size:18,strokeWidth:2.3})}),n||0]}),t.jsxs("div",{className:"hr-streak-meta",children:[t.jsx("div",{className:"hr-streak-label",children:"Day streak"}),t.jsxs("div",{className:"hr-streak-best",children:["Best · ",I]})]})]}),t.jsx("div",{className:"hr-form","aria-label":`Login streak: ${n||0} of the last 14 days`,children:E.map((v,G)=>t.jsx("span",{className:`hr-form-cell${v.done?" is-done":""}${v.isToday?" is-today":""}`},G))}),t.jsx("div",{className:"hr-form-cap",children:"Last 14 days"})]})})(),(()=>{const x=c?.totalAnswered||0,E=c?.totalCorrect||0,I=x>0&&E<=x?E/x:.4,v=x>=jt,H=(xa(c?.catStats||{},I,{c:c?.totalCorrect||0,a:c?.totalAnswered||0},c?.cardLeague).ratings||[]).filter(te=>te.answered>=jt).sort((te,be)=>be.rating-te.rating)[0]||null,ee=c?.bestScore||0;return t.jsxs("div",{className:"hr-card hr-yf",children:[t.jsx("div",{className:"hr-yf-title",children:"Your form"}),v?t.jsxs("div",{className:"hr-yf-rows",children:[t.jsxs("div",{className:"hr-yf-row",children:[t.jsx("span",{className:"hr-yf-k",children:"Accuracy"}),t.jsxs("span",{className:"hr-yf-v",children:[Math.round(I*100),"%"]})]}),ee>0&&t.jsxs("div",{className:"hr-yf-row",children:[t.jsx("span",{className:"hr-yf-k",children:"Best score"}),t.jsxs("span",{className:"hr-yf-v",children:[ee," / 10"]})]}),H&&t.jsxs("div",{className:"hr-yf-row",children:[t.jsx("span",{className:"hr-yf-k",children:"Strongest"}),t.jsx("span",{className:"hr-yf-v hr-yf-v-green",children:H.name})]})]}):t.jsx("div",{className:"hr-yf-empty",children:"Play a game to see your form."})]})})()]}),t.jsxs("div",{className:"home-col-below",children:[t.jsx("div",{className:"home-section-title",children:"Find a quiz"}),t.jsx(mu,{clubPacks:T,clubAbbr:K,onPickClub:x=>{ae?ae(x):_("clubquiz")},onAllClubs:()=>_("clubquiz")}
140),t.jsxs("button",{type:"button",className:"todays-seven-secondary mp-row",onClick:()=>_("leaguequiz"),"aria-label":"League Quiz â pick a competition",children:[t.jsx("span",{className:"t7s-icon","aria-hidden":"true",children:t.jsx(br,{size:22,strokeWidth:2})}),t.jsxs("span",{className:"t7s-body",children:[t.jsx("span",{className:"t7s-title",children:"League Quiz"}),t.jsx("span",{className:"t7s-sub",children:"Pick a competition · 10 questions"})]}),t.jsx("span",{className:"t7s-cta",children:"Play"})]}),t.jsx("div",{className:"home-section-title",children:"More modes"}),t.jsx("div",{className:"play-grid",children:[...mt?[{key:fa.key,Icon:uc,name:fa.name,desc:fa.desc,isNew:!0,onTap:()=>_(fa.key)}]:[],{key:"stadiums",Icon:cc,name:"Stadiums",desc:"Name every ground",onTap:()=>k("stadiums")},{key:"classic",Icon:pc,name:"Classic",desc:"10 Qs, easy to hard"},{key:"survival",Icon:lc,name:"Survival",desc:"Die on wrong"},{key:"hotstreak",Icon:ma,name:"Hot Streak",desc:"60-second sprint"},{key:"legends",Icon:hc,name:"Legends",desc:"Pre-2000 greats"},{key:"chaos",Icon:El,name:"Chaos",desc:"Quotes & chaos"}].map(({key:x,Icon:E,name:I,desc:v,onTap:G,iconColor:U,isNew:H})=>{const ee=H&&!ce[x];return t.jsxs("button",{className:"play-card",onClick:()=>{Fe(x),(G||(()=>_(x)))()},children:[t.jsx("span",{className:"play-card-icon",children:t.jsx(E,{size:20,strokeWidth:2.25,color:U||"var(--t2)","aria-hidden":"true"})}),t.jsxs("span",{className:"play-card-body",children:[t.jsx("span",{className:"play-card-name",children:I}),t.jsx("span",{className:"play-card-desc",children:v})]}),ee&&t.jsx("span",{className:"play-card-badge",children:"NEW"})]},x)})}),(()=>{const x=[];return x.length===0?null:t.jsxs("div",{className:"coming-soon-list",children:["Coming soon: ",x.map(E=>E.name).join(" · ")]})})(),t.jsxs("div",{className:"home-app-banner",children:[t.jsxs("div",{className:"hab-copy",children:[t.jsxs("div",{className:"hab-title",children:["Take ",Ce," everywhere"]}),t.jsx("div",{className:"hab-sub",children:"Your streak, rating and friends follow your account â on your phone or in any browser."})]}),t.jsxs("div",{className:"hab-actions",children:[t.jsxs("a",{className:"hab-store",href:zr(),target:"_blank",rel:"noopener","aria-label":"Download on the App Store",children:[t.jsx("svg",{viewBox:"0 0 384 512",width:"20",height:"20","aria-hidden":"true",children:t.jsx("path",{fill:"currentColor",d:"M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z"})}),t.jsxs("span",{className:"hab-store-txt",children:[t.jsx("span",{className:"hab-store-ey",children:"Download on the"}),t.jsx("span",{className:"hab-store-nm",children:"App Store"})]})]}),t.jsxs("a",{className:"hab-store",href:Or,target:"_blank",rel:"noopener","aria-label":"Get it on Google Play",children:[t.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20","aria-hidden":"true",children:t.jsx("path",{fill:"currentColor",d:"M4 3.5 20 12 4 20.5z"})}),t.jsxs("span",{className:"hab-store-txt",children:[t.jsx("span",{className:"hab-store-ey",children:"Get it on"}),t.jsx("span",{className:"hab-store-nm",children:"Google Play"})]})]})]})]})]})]})}const pu=me.memo(gu);var ha;(function(e){e.Heavy="HEAVY",e.Medium="MEDIUM",e.Light="LIGHT"})(ha||(ha={}));var Ua;(function(e){e.Success="SUCCESS",e.Warning="WARNING",e.Error="ERROR"})(Ua||(Ua={}));const Ht=yt("Haptics",{web:()=>le(()=>import("./web-DM1yJZq6.js"),__vite__mapDeps([11,1,12,4,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29])).then(e=>new e.HapticsWeb)});var qr;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(qr||(qr={}));var xs;(function(e){e.None="NONE",e.Slide="SLIDE",e.Fade="FADE"})(xs||(xs={}));const yu=yt("StatusBar");var Gt;(function(e){e.Documents="DOCUMENTS",e.Data="DATA",e.Library="LIBRARY",e.Cache="CACHE",e.External="EXTERNAL",e.ExternalStorage="EXTERNAL_STORAGE"})(Gt||(Gt={}));var Ss;(function(e){e.UTF8="utf8",e.ASCII="ascii",e.UTF16="utf16"})(Ss||(Ss={}));const Ba=yt("Filesystem",{web:()=>le(()=>
140import("./web-Dloatx8e.js"),__vite__mapDeps([30,1,12,4,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29])).then(e=>new e.FilesystemWeb)}),bu=me.lazy(()=>le(()=>import("./ReviewScreen-BUDCFAng.js"),__vite__mapDeps([31,12,4,13,14,15,16,17,18,1,19,20,21,22,23,24,25,26,27,28,29]))),vu=me.lazy(()=>le(()=>import("./ProfileScreen-Bn6CWcdL.js"),__vite__mapDeps([32,12,4,13,14,15,16,17,18,28,1,19,20,21,22,23,24,25,26,27,29])).then(e=>({default:e.ProfileScreen}))),wu=me.lazy(()=>le(()=>import("./ProfileScreen-Bn6CWcdL.js"),__vite__mapDeps([32,12,4,13,14,15,16,17,18,28,1,19,20,21,22,23,24,25,26,27,29])).then(e=>({default:e.FriendProfileScreen}))),xu=me.lazy(()=>le(()=>import("./ProfileScreen-Bn6CWcdL.js"),__vite__mapDeps([32,12,4,13,14,15,16,17,18,28,1,19,20,21,22,23,24,25,26,27,29])).then(e=>({default:e.BlockedUsersScreen}))),st=(e,a)=>me.lazy(()=>e().then(n=>({default:n[a]}))),tt=(e,a="Loading")=>function(r){const i=()=>{try{window.dispatchEvent(new Event("biq:go-home"))}catch{}};return t.jsx(ut,{name:a,onExit:i,children:t.jsx(me.Suspense,{fallback:t.jsx(xt,{label:a}),children:t.jsx(e,{...r})})})},Su=tt(me.lazy(()=>le(()=>import("./Login-DD3Ssnp1.js"),__vite__mapDeps([33,12,4,13,14,15,16,17,18,1,19,20,21,22,23,24,25,26,27,28,29]))),"Loading sign-in"),ku=tt(st(()=>le(()=>import("./OnlineHubTab-VJzrI7KP.js"),__vite__mapDeps([34,12,4,35,16,17,13,14,15,18,1,19,20,21,22,23,24,25,26,27,28,29])),"OnlineHubTab"),"Loading online"),_u=tt(st(()=>le(()=>import("./DailyScreen-Cy4otleR.js"),__vite__mapDeps([36,12,4,14,13,15,16,17,26,25,28,18,1,19,20,21,22,23,24,27,29])),"DailyTabScreen"),"Loading history"),Cu=tt(st(()=>le(()=>import("./FootballWordle-CJulJwrh.js"),__vite__mapDeps([37,12,4,13,14,15,16,17,27,38,39])),"FootballWordle"),"Loading Footle"),ju=tt(st(()=>le(()=>import("./ResultsScreen-DTl_HEaG.js"),__vite__mapDeps([40,12,4,38,14,16,17,41,42,27,15,13,43,18,1,19,20,21,22,23,24,25,26,28,29])),"Results"),"Loading results"),Au=tt(st(()=>le(()=>import("./ModeResults-BFApqkXw.js"),__vite__mapDeps([44,12,4,41,42,13,14,15,16,17,18,1,19,20,21,22,23,24,25,26,27,28,29])),"HotStreakResults"),"Loading results"),Fu=tt(st(()=>le(()=>import("./ModeResults-BFApqkXw.js"),__vite__mapDeps([44,12,4,41,42,13,14,15,16,17,18,1,19,20,21,22,23,24,25,26,27,28,29])),"TrueFalseResults"),"Loading results"),Nu=tt(st(()=>le(()=>import("./SettingsScreen-DCaIAIqx.js"),__vite__mapDeps([45,12,4,21,19,1,22,14,13,15,16,17,18,20,23,24,25,26,27,28,29])),"SettingsScreen"),"Loading settings"),Lu=tt(st(()=>le(()=>import("./ReviewScreens-p2A7mhbv.js"),__vite__mapDeps([46,12,4,14,13,15,16,17,18,1,19,20,21,22,23,24,25,26,27,28,29])),"DailyReviewScreen"),"Loading review"),Eu=tt(st(()=>le(()=>import("./ReviewScreens-p2A7mhbv.js"),__vite__mapDeps([46,12,4,14,13,15,16,17,18,1,19,20,21,22,23,24,25,26,27,28,29])),"PuzzleReviewScreen"),"Loading review"),Iu=tt(st(()=>le(()=>import("./ClubQuizScreen-HkNqqGuY.js"),__vite__mapDeps([47,12,4,18,13,14,15,16,17,1,19,20,21,22,23,24,25,26,27,28,29])),"ClubQuizScreen"),"Loading clubs"),qu=tt(st(()=>le(()=>import("./PrivacyScreen-Ho_N78UW.js"),__vite__mapDeps([48,12,4,13,14,15,16,17,18,1,19,20,21,22,23,24,25,26,27,28,29])),"PrivacyScreen")),Ru=tt(st(()=>le(()=>import("./StumpScreen-c-K83JRY.js"),__vite__mapDeps([49,12,4,43,13,14,15,16,17,18,1,19,20,21,22,23,24,25,26,27,28,29])),"StumpScreen")),Tu=tt(st(()=>le(()=>import("./LocalPlay-D6zV9KZe.js"),__vite__mapDeps([50,12,4,42,16,17,13,14,15,18,1,19,20,21,22,23,24,25,26,27,28,29])),"LocalSetup")),Mu=tt(st(()=>le(()=>import("./LocalPlay-D6zV9KZe.js"),__vite__mapDeps([50,12,4,42,16,17,13,14,15,18,1,19,20,21,22,23,24,25,26,27,28,29])),"LocalGameScreen")),Bu=tt(st(()=>le(()=>import("./LocalPlay-D6zV9KZe.js"),__vite__mapDeps([50,12,4,42,16,17,13,14,15,18,1,19,20,21,22,23,24,25,26,27,28,29])),"LocalResults")),Pu=me.lazy(()=>le(()=>import("./TransferTrail-CZDDy5EP.js"),__vite__mapDeps([51,12,4,14,26,52,19,25,38,16,17,18,53,27]))),Du=me.lazy(()=>le(()=>import("./StadiumGame-D58yH4GI.js"),__vite__mapDeps([54,12,4,53,19,18,13,14,15,16,17,1,20,21,22,23,24,25,26,27,28,29]))),zu=me.lazy(()=>le(()=>import("./MysteryPlayer-DqUvSLE4.js"),__vite__mapDeps([55,12,4,52,19,25,38,14,16,17,53,28]))),Ou=me.lazy(()=>le(()=>import("./OnlineMultiplayer-B80MS-91.js"),__vite__mapDeps([56,12,4,1,13,14,15,16,17,21,19,22,35,18,20,23,24,25,26,27,28,29])).then(e=>({default:e.OnlineEntry}))),Wu=me.lazy(()=>le(()=>import("./OnlineMultiplayer-B80MS-91.js"),__vite__mapDeps([56,12,4,1,13,14,15,16,17,21,19,22,35,18,20,23,24,25,26,27,28,29])).then(e=>({default:e.MultiplayerLobby}))),Uu=yt("ShareCard"),Sa={STREAK_TOAST:3500,ANSWER_REVEAL:1500,AUTOCOMPLETE_DEBOUNCE:60,DAY_MS:864e5,SEEN_WINDOW_MS:14*24*60*60*1e3},$u=new Set(["quiz","online-stage1","online-stage1-lobby"]),Hu=(()=>{try{return window.location.pathname}catch{return"/"}})(),mr=(()=>{try{return window.location.search}catch{return""}})(),Ln=e=>(e||"").toUpperCase().replace(/[^A-HJ-NP-Z2-9]/g,"").slice(0,6)||null;let ks=!1,_s=!1;const Gu=["Andres Iniesta","Iniesta","Mario Götze","Götze","Gotze","Miroslav Klose","Klose","Emiliano Martinez","Emiliano MartÃnez","Martinez","Hugo Lloris","Lloris","Zinedine Zidane","Zidane","Cristiano Ronaldo","Ronaldo","Lionel Messi","Messi","Kylian Mbappe","Kylian Mbappé","Mbappe","Mbappé","Ronaldinho","Pele","Pelé","Diego Maradona","Maradona","David Beckham","Beckham","Erling Haaland","Haaland","Robert Lewandowski","Lewandowski","Karim Benzema","Benzema","Luka Modric","Modric","ModriÄ","Mohamed Salah","Salah","Neymar","Harry Kane","Kane","Vinicius Jr","Vinicius","Victor Osimhen","Osimhen","Divock Origi","Origi","Georginio Wijnaldum","Wijnaldum","Teddy Sheringham","Sheringham","Ole Gunnar Solskjaer","Solskjaer","Solskjær","Alan Shearer","Shearer","Sergio Aguero","Agüero","Aguero","Wes Morgan","Petr Cech","Petr Äech","Cech","Thiago Silva","David Trezeguet","Trezeguet","Hakan Sukur","Hakan Åükür","Sukur","Geoff Hurst","Hurst","George Weah","Weah","Johan Cruyff","Cruyff","Pavel Nedved","Pavel NedvÄd","Nedved","Michel Platini","Platini","Lothar Matthaus","Lothar Matthäus","Matthaus","Xabi Alonso","Alonso","Thomas Muller","Thomas Müller","Muller","Philipp Lahm","Lahm","Manuel Neuer","Neuer","Antoine Griezmann","Griezmann","Paul Pogba","Pogba","Didier Drogba","Drogba","Brian Clough","Clough","Antonio Conte","Conte","Alex Ferguson","Ferguson","Jurgen Klopp","Jürgen Klopp","Klopp","Pep Guardiola","Guardiola","Jose Mourinho","Mourinho","Carlo Ancelotti","Ancelotti","Claudio Ranieri","Ranieri","Otto Rehhagel","Rehhagel","Zlatko Dalic","Zlatko DaliÄ","Dalic","Arsene Wenger","Wenger","Sven Goran Eriksson","Eriksson","Barcelona","FC Barcelona","Real Madrid","Atletico Madrid","Manchester City","Manchester United","Liverpool","Chelsea","Arsenal","Tottenham","Bayern Munich","Borussia Dortmund","Bayer Leverkusen","Inter Milan","AC Milan","Juventus","Napoli","PSG","Ajax","Porto","Istanbul","London","Madrid","Munich","Rome","Signal Iduna Park","Anfield","Camp Nou","Bernabeu","Santiago Bernabeu","Old Trafford","England","Spain","France","Germany","Italy","Brazil","Argentina","Portugal","Netherlands","Denmark","Greece","Croatia","Uruguay"];function Pt(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim()}function Ye(e){const a=[...e];for(let n=a.length-1;n>0;n--){const r=Math.floor(Math.random()*(n+1));[a[n],a[r]]=[a[r],a[n]]}return a}const Qu={liverpool:["liverpool","salah","klopp","slot","gerrard","fowler","origi","wijnaldum","dalglish"],manutd:["manchester united","man united","man utd","solskjær","sheringham","schmeichel","ferguson","cantona","beckham"],mancity:["manchester city","man city","aguero","guardiola","haaland","silva"],arsenal:["arsenal","wenger","henry","bergkamp","invincibles"],chelsea:["chelsea","mourinho","lampard","drogba","cech"],realmadrid:["real madrid","zidane","benzema","modric","bale","ramos"],barcelona:["barcelona","messi","xavi","iniesta","cruyff","guardiola"],bayern:["bayern","lewandowski","müller","muller","neuer","lahm"],leipzig:["leipzig","rb leipzig","rbl","red bull","werner","nagelsmann"],atalanta:["atalanta","bergamo","la dea","gasperini","lookman"],juventus:["juventus","juve","ronaldo","buffon","conte"]};function Cs(e){const a=(e.q+(e.o?e.o.join(" "):"")+(e.typed_a||"")).toLowerCase();for(const[n,r]of Object.entries(Qu))if(r.some(i=>a.includes(i)))return n;return null}const bi="biq_seen_history_v2",vi=Sa.SEEN_WINDOW_MS;let Ja=null;const ht=e=>e&&e.id?`q:${e.id}`:null;function Vu(){try{if(typeof localStorage>"u")return{};const e=localStorage.getItem(bi);if(!e)return{};const a=JSON.parse(e);return a&&typeof a=="object"&&!Array.isArray(a)?a:{}}catch{return{}}}function Vr(e){try{typeof localStorage<"u"&&localStorage.setItem(bi,JSON.stringify(e))}catch{}}function wi(){const e=Vu(),a=Date.now()-vi,n={};for(const r in e){const i=Number(e[r]);i&&i>=a&&(n[r]=i)}return Ja=n,Vr(n),n}function Jr(){return Ja===null&&wi(),Ja}function xi(){const e=Jr(),a=Date.now()-vi,n=new Set;for(const r in e)e[r]>=a&&n.add(r);return n}function ba(e,a,n){const r=xi();if(r.size===0)return e;const i=Jr(),c=[],d=[];for(const o of e){const u=n(o);(!u||!r.has(u)?c:d).push(o)}return c.length>=a?c:(d.sort((o,u)=>(i[n(o)]||0)-(i[n(u)]||0)),[...c,...d.slice(0,Math.max(a*2,a+6))])}function Ju(e,a){const n=xi();if(n.size===0)return e.length;let r=0;for(const i of e){const c=a(i);(!c||!n.has(c))&&(r+=1)}return r}const js="biq_pack_thin_notice";function Ku(e){try{const a=JSON.parse(localStorage.getItem(js)||"{}"),n=new Date().toISOString().slice(0,10);if(a[e]===n)return!1;const r={[e]:n};return Ne(js,JSON.stringify(r)),!0}catch{return!1}}function Si(e){if(!e||!e.length)return;const a=Jr(),n=Date.now();for(const r of e){const i=r&&r._histKey;i&&(a[i]=n)}Ja=a,Vr(a)}function Yu(){Ja={},Vr({})}function xh(e){Array.isArray(e)&&Si(e.map(a=>({_histKey:a&&a.id?`q:${a.id}`:null})))}async function bn({cat:e,tag:a,diff:n,onlyDiff:r,n:i=10,ramp:c=!1,includeLegends:d=!1,noEasy:o=!1,avoidConflicts:u=!1}){const{QB:m,conflictsWith:p}=await Ct();let g=m.filter(w=>w&&typeof w=="object");
140if(g=g.filter(w=>!w.tag||!Cn.has(w.tag)),!d&&e!=="Legends"&&(g=g.filter(w=>w.cat!=="Legends")),e&&e!=="All"&&(g=g.filter(w=>w.cat===e)),a&&(g=g.filter(w=>w.tag===a)),o&&(g=g.filter(w=>w.diff!=="easy")),r&&(g=g.filter(w=>w.diff===r)),g.length<5)return[];if(n==="easy"&&!o?g=g.filter(w=>w.diff==="easy"&&(w.type==="mcq"||w.type==="tf")):n==="medium"&&(g=g.filter(w=>w.diff!=="hard")),g=ba(g,i,ht),g=Ye(g),u&&(g=Cr(g,g.length,p)),n==="hard"){const w=g.filter(q=>q.diff==="hard"),A=g.filter(q=>q.diff!=="hard");g=[...w,...A]}if(c&&i===10){const w=(Q,B)=>{const T=Ye(g.filter(ie=>ie.diff===Q&&(ie.type==="mcq"||ie.type==="tf"))),K=[],ae={},ue={};for(const ie of T){if(K.length>=B)break;const xe=ae[ie.cat]||0;if(xe>=2)continue;const se=Cs(ie);se&&(ue[se]||0)>=1||(K.push(ie),ae[ie.cat]=xe+1,se&&(ue[se]=(ue[se]||0)+1))}return K},A=o?[]:w("easy",3),q=w("medium",o?6:4),Z=w("hard",o?4:3);if([...A,...q,...Z].length===10)return[...Ye(A),...Ye(q),...Ye(Z)].map(Q=>{const B=ht(Q);if(Q.type!=="mcq"||!Q.o)return{...Q,_histKey:B};const T=[0,1,2,3].slice(0,Q.o.length),K=Ye(T);return{...Q,o:K.map(ae=>Q.o[ae]),a:K.indexOf(Q.a),_histKey:B}})}const k=[],b={},N={},j=2,_=1;for(const w of g){if(k.length>=i)break;const A=b[w.cat]||0;if(A>=j)continue;const q=Cs(w);q&&(N[q]||0)>=_||(k.push(w),b[w.cat]=A+1,q&&(N[q]=(N[q]||0)+1))}if(k.length<i){const w=new Set(k);for(const A of g){if(k.length>=i)break;w.has(A)||k.push(A)}}return Ye(k).map(w=>{const A=ht(w);if(w.type!=="mcq"||!w.o)return{...w,_histKey:A};const q=[0,1,2,3].slice(0,w.o.length),Z=Ye(q);return{...w,o:Z.map(W=>w.o[W]),a:Z.indexOf(w.a),_histKey:A}})}async function ki(e){const[{QB:a},{pickDailyQuestions:n}]=await Promise.all([Ct(),le(()=>import("./dailyDraw-n3hWIJZ2.js"),__vite__mapDeps([57,4,12,13,14,15,16,17,18,1,19,20,21,22,23,24,25,26,27,28,29]))]);return n(a,zl(e)).map(r=>{const i=ht(r),c=[0,1,2,3].slice(0,r.o.length),d=Ye(c);return{...r,o:d.map(o=>r.o[o]),a:d.indexOf(r.a),_histKey:i}})}function Zu(){return ki(new Date)}async function Xu(){const{TF_STATEMENTS:e}=await Ct(),a=e.map((i,c)=>({...i,_tfIdx:c})).filter(i=>i.cat!=="chaos"),n=i=>i&&i.id?`tf:${i.id}`:null,r=ba(a,20,n);return Ye(r).slice(0,20).map(i=>({...i,_histKey:n(i)}))}function gr(e,a){const n=e.length,r=a.length,i=Array.from({length:n+1},(c,d)=>Array.from({length:r+1},(o,u)=>d===0?u:u===0?d:0));for(let c=1;c<=n;c++)for(let d=1;d<=r;d++)i[c][d]=e[c-1]===a[d-1]?i[c-1][d-1]:1+Math.min(i[c-1][d],i[c][d-1],i[c-1][d-1]);return i[n][r]}function ef(e,a){const n=Pt(e);if(!n||n.length<2)return!1;const r=Pt(a.typed_a);if(n===r)return!0;const i=r.split(" ");if(i.some(d=>d===n&&n.length>=3))return!0;const c=r.length<=5?1:2;if(gr(n,r)<=c||i.some(d=>d.length>=4&&gr(n,d)<=1)||r.includes(n)&&n.length>=4)return!0;if(a.aliases)for(const d of a.aliases){const o=Pt(d);if(n===o||o.includes(n)&&n.length>=3||gr(n,o)<=1)return!0}return!1}function tf(e){if(!e||e.length<2)return[];const a=Pt(e),n=Gu.filter(c=>{const d=Pt(c);return!!(d.startsWith(a)||d.split(" ").some(o=>o.startsWith(a)))}),r=new Set;return n.filter(c=>{const d=Pt(c);return r.has(d)?!1:(r.add(d),!0)}).slice(0,5)}const af=["A","B","C","D"],Rr={WorldCup:"International",Euros:"Euros",UCL:"Champions League",PL:"Premier League",LaLiga:"La Liga",Bundesliga:"Bundesliga",SerieA:"Serie A",Ligue1:"Ligue 1",SuperLig:"Süper Lig",Primeira:"Primeira Liga",Managers:"Managers",Records:"Records",Legends:"Legends",History:"History",Transfers:"Transfers",ClubQuiz:"Club Quiz",LeagueQuiz:"League Quiz"},Tn={CruzAzul:"Cruz Azul",Guadalajara:"Guadalajara",ClubAmerica:"Club América",SanLorenzo:"San Lorenzo",Independiente:"Independiente",Racing:"Racing Club",Birmingham:"Birmingham City",Cardiff:"Cardiff City",Derby:"Derby County",Norwich:"Norwich City",Portsmouth:"Portsmouth",SheffWed:"Sheffield Wednesday",Middlesbrough:"Middlesbrough",WestBrom:"West Brom",SheffUtd:"Sheffield United",Blackburn:"Blackburn Rovers",Watford:"Watford",QPR:"Queens Park Rangers",Southampton:"Southampton",Stoke:"Stoke City",Swansea:"Swansea City",Wrexham:"Wrexham",Leipzig:"RB Leipzig",Atalanta:"Atalanta",Boca:"Boca Juniors",River:"River Plate",Flamengo:"Flamengo",Palmeiras:"Palmeiras",Corinthians:"Corinthians",SaoPaulo:"São Paulo",Gremio:"Grêmio",Internacional:"Internacional",Cruzeiro:"Cruzeiro",Arsenal:"Arsenal",Liverpool:"Liverpool",ManUtd:"Manchester United",ManCity:"Manchester City",Chelsea:"Chelsea",Tottenham:"Tottenham Hotspur",Newcastle:"Newcastle United",Barcelona:"Barcelona",RealMadrid:"Real Madrid",BayernMunich:"Bayern Munich",Juventus:"Juventus",AcMilan:"AC Milan",Atletico:"Atlético Madrid",Dortmund:"Borussia Dortmund",PSG:"Paris Saint-Germain",InterMilan:"Inter Milan",Ajax:"Ajax",Napoli:"Napoli",Galatasaray:"Galatasaray",Benfica:"Benfica",Fenerba
140hce:"Fenerbahçe",Porto:"Porto",Roma:"Roma",Celtic:"Celtic",Rangers:"Rangers",Marseille:"Marseille",Feyenoord:"Feyenoord",PSV:"PSV",Anderlecht:"Anderlecht",Besiktas:"Besiktas",Trabzonspor:"Trabzonspor",ClubBrugge:"Club Brugge",RedStar:"Red Star Belgrade",DinamoZagreb:"Dinamo Zagreb",Hajduk:"Hajduk Split",Basel:"Basel",Forest:"Nottingham Forest",Villa:"Aston Villa",Everton:"Everton",Leeds:"Leeds United",WestHam:"West Ham",Leicester:"Leicester City",Olympiacos:"Olympiacos",Panathinaikos:"Panathinaikos",Sunderland:"Sunderland",Ipswich:"Ipswich Town",Palace:"Crystal Palace",Fulham:"Fulham",Brighton:"Brighton",Bournemouth:"Bournemouth",Brentford:"Brentford",Burnley:"Burnley",Wolves:"Wolves",Coventry:"Coventry City",HullCity:"Hull City",Athletic:"Athletic Bilbao",Sevilla:"Sevilla",Betis:"Real Betis",Santos:"Santos",RealSociedad:"Real Sociedad",Schalke:"Schalke 04",Hamburg:"Hamburger SV",Frankfurt:"Eintracht Frankfurt",Fiorentina:"Fiorentina",Lazio:"Lazio",Torino:"Torino",Sporting:"Sporting CP",SaintEtienne:"Saint-Ãtienne",Valencia:"Valencia",Leverkusen:"Bayer Leverkusen",Lyon:"Olympique Lyonnais",Parma:"Parma",Monaco:"AS Monaco"},nf={CruzAzul:"mexico",Guadalajara:"mexico",ClubAmerica:"mexico",SanLorenzo:"argentina",Independiente:"argentina",Racing:"argentina",Arsenal:"england",ManUtd:"england",Liverpool:"england",ManCity:"england",Chelsea:"england",Tottenham:"england",Newcastle:"england",Everton:"england",Villa:"england",WestHam:"england",Forest:"england",Leeds:"england",Leicester:"england",Olympiacos:"other",Panathinaikos:"other",Palace:"england",Fulham:"england",Brighton:"england",Bournemouth:"england",Brentford:"england",Sunderland:"england",Ipswich:"england",Wolves:"england",Burnley:"england",Southampton:"england",Norwich:"england",Derby:"england",Middlesbrough:"england",WestBrom:"england",SheffUtd:"england",Blackburn:"england",Watford:"england",QPR:"england",Stoke:"england",Birmingham:"england",SheffWed:"england",Coventry:"england",HullCity:"england",Portsmouth:"england",Cardiff:"england",Swansea:"england",Wrexham:"england",RealMadrid:"spain",Barcelona:"spain",Atletico:"spain",Sevilla:"spain",Valencia:"spain",Athletic:"spain",Betis:"spain",RealSociedad:"spain",Juventus:"italy",AcMilan:"italy",InterMilan:"italy",Napoli:"italy",Roma:"italy",Lazio:"italy",Atalanta:"italy",Fiorentina:"italy",Torino:"italy",Parma:"italy",BayernMunich:"germany",Dortmund:"germany",Leverkusen:"germany",Leipzig:"germany",Schalke:"germany",Hamburg:"germany",Frankfurt:"germany",PSG:"france",Marseille:"france",Lyon:"france",Monaco:"france",SaintEtienne:"france",Benfica:"portugal",Porto:"portugal",Sporting:"portugal",Ajax:"netherlands",PSV:"netherlands",Feyenoord:"netherlands",Galatasaray:"turkiye",Fenerbahce:"turkiye",Besiktas:"turkiye",Trabzonspor:"turkiye",Celtic:"scotland",Rangers:"scotland",Anderlecht:"belgium",ClubBrugge:"belgium",DinamoZagreb:"croatia",Hajduk:"croatia",Flamengo:"brazil",Palmeiras:"brazil",Corinthians:"brazil",Santos:"brazil",SaoPaulo:"brazil",Gremio:"brazil",Internacional:"brazil",Cruzeiro:"brazil",Boca:"argentina",River:"argentina",RedStar:"other",Basel:"other"};Cc(Kd(Tn,nf));const Sh=Object.fromEntries(Object.values({england:["Arsenal","ManUtd","Liverpool","ManCity","Chelsea","Tottenham","Newcastle","Everton","Villa","WestHam","Forest","Leeds","Palace","Fulham","Brighton","Bournemouth","Brentford","Sunderland","Ipswich","Wolves","Burnley","Southampton","Leicester","Norwich","Derby","Stoke","Birmingham","SheffWed","Coventry","HullCity","Portsmouth","Cardiff","Swansea","Wrexham","Middlesbrough","WestBrom","SheffUtd","Blackburn","Watford","QPR"],spain:["RealMadrid","Barcelona","Atletico","Sevilla","Valencia","Athletic","Betis","RealSociedad"],italy:["Juventus","AcMilan","InterMilan","Napoli","Roma","Lazio","Atalanta","Fiorentina","Torino","Parma"],germany:["BayernMunich","Dortmund","Leverkusen","Leipzig","Frankfurt","Schalke","Hamburg"],france:["PSG","Marseille","Lyon","Monaco","SaintEtienne"],portugal:["Benfica","Porto","Sporting"],netherlands:["Ajax","PSV","Feyenoord"],turkiye:["Galatasaray","Fenerbahce","Besiktas","Trabzonspor"],scotland:["Celtic","Rangers"],belgium:["Anderlecht","ClubBrugge"],croatia:["DinamoZagreb","Hajduk"],brazil:["Flamengo","Palmeiras","Corinthians","Santos","SaoPaulo","Gremio","Internacional","Cruzeiro"],argentina:["Boca","River","Racing","Independiente","SanLorenzo"],mexico:["ClubAmerica","Guadalajara","CruzAzul"],other:["RedStar","Basel","Olympiacos","Panathinaikos"]}).flat().map((e,a)=>[e,a])),kh=[{key:"england",label:"England & Wales"},{key:"spain",label:"Spain"},{key:"italy",label:"Italy"},{key:"germany",label:"Germany"},{key:"france",label:"France"},{key:"portugal",label:"Portugal"},{key:"netherlands",label:"Netherlands"},{key:"turkiye",label:"Türkiye"},{key:"scotland",label:"Scotland"},{key:"belgium",label:"Belgium"},{key:"croatia",label:"Croatia"},{key:"brazil",label:"Brazil"},{key:"argentina",label:"Argentina"},{key:"mexico",label:"Mexico"},{key:"other",label:"More clubs"}];function _i(e){const a=String(e).trim().split(/\s+/);return(a.length===1?a[0].slice(0,3):a.map(n=>n[0]).join("")).slice(0,3).toUpperCase()}function _t(e,a){const n=String(e).replace("#",""),r=parseInt(n.slice(0,2),16),i=parseInt(n.slice(2,4),16),c=parseInt(n.slice(4,6),16);return`rgba(${r},${i},${c},${a})`}function Ka(e){const a=String(e).replace("#",""),n=parseInt(a.slice(0,2),16),r=parseInt(a.slice(2,4),16),i=parseInt(a.slice(4,6),16);return(.299*n+.587*r+.114*i)/255>.6?"var(--bg)":"#ffffff"}const Tr={CruzAzul:"CAZ",Guadalajara:"GDL",ClubAmerica:"AME",SanLorenzo:"SLO",Independiente:"IND",Racing:"RAC",Leipzig:"RBL",Atalanta:"ATA",Boca:"BOC",River:"RIV",Flamengo:"FLA",Palmeiras:"PAL",Corinthians:"COR",Santos:"SAN",RealSociedad:"RSO",SaoPaulo:"SAO",Gremio:"GRE",Internacional:"SCI",Cruzeiro:"CRU",Arsenal:"ARS",Liverpool:"LIV",ManUtd:"MUN",ManCity:"MCI",Chelsea:"CHE",Tottenham:"TOT",Newcastle:"NEW",Barcelona:"FCB",RealMadrid:"RMA",Atletico:"ATM",Juventus:"JUV",AcMilan:"ACM",InterMilan:"INT",BayernMunich:"BAY",Dortmund:"BVB",Frankfurt:"SGE",PSG:"PSG",Ajax:"AJA",Napoli:"NAP",Galatasaray:"GAL",Benfica:"SLB",Fenerba
140hce:"FEN",Porto:"POR",Roma:"ROM",Celtic:"CEL",Rangers:"RAN",Marseille:"OM",Feyenoord:"FEY",PSV:"PSV",Anderlecht:"RSCA",Besiktas:"BJK",Trabzonspor:"TS",ClubBrugge:"CLU",RedStar:"CZ",DinamoZagreb:"DIN",Hajduk:"HAJ",Basel:"BAS",Forest:"NFO",Villa:"AVL",Everton:"EVE",Leeds:"LEE",WestHam:"WHU",Leicester:"LEI",Olympiacos:"OLY",Panathinaikos:"PAO",Sunderland:"SUN",Ipswich:"IPS",Palace:"CRY",Fulham:"FUL",Brighton:"BHA",Middlesbrough:"MID",WestBrom:"WBA",SheffUtd:"SHU",Blackburn:"BLA",Watford:"WAT",QPR:"QPR",Bournemouth:"BOU",Brentford:"BRE",Burnley:"BUR",Wolves:"WOL",Coventry:"COV",HullCity:"HUL",Athletic:"ATH",Sevilla:"SEV",Betis:"BET",Schalke:"S04",Hamburg:"HSV",Fiorentina:"FIO",Lazio:"LAZ",Torino:"TOR",Sporting:"SCP",SaintEtienne:"ASSE",Valencia:"VAL",Leverkusen:"B04",Lyon:"OL",Parma:"PAR",Monaco:"ASM"},Mr={"cruz-azul":"CruzAzul",chivas:"Guadalajara","club-america":"ClubAmerica","san-lorenzo":"SanLorenzo",independiente:"Independiente","racing-club":"Racing","birmingham-city":"Birmingham","cardiff-city":"Cardiff","derby-county":"Derby","norwich-city":"Norwich",portsmouth:"Portsmouth",middlesbrough:"Middlesbrough","west-brom":"WestBrom","sheffield-united":"SheffUtd","blackburn-rovers":"Blackburn",watford:"Watford","queens-park-rangers":"QPR","eintracht-frankfurt":"Frankfurt","sheffield-wednesday":"SheffWed",southampton:"Southampton","stoke-city":"Stoke","swansea-city":"Swansea",wrexham:"Wrexham","rb-leipzig":"Leipzig",atalanta:"Atalanta","boca-juniors":"Boca","river-plate":"River",flamengo:"Flamengo",palmeiras:"Palmeiras",corinthians:"Corinthians",santos:"Santos","real-sociedad":"RealSociedad","sao-paulo":"SaoPaulo",gremio:"Gremio",internacional:"Internacional",cruzeiro:"Cruzeiro",arsenal:"Arsenal",liverpool:"Liverpool","manchester-united":"ManUtd","manchester-city":"ManCity",chelsea:"Chelsea",tottenham:"Tottenham",newcastle:"Newcastle",barcelona:"Barcelona","real-madrid":"RealMadrid","atletico-madrid":"Atletico","bayern-munich":"BayernMunich","borussia-dortmund":"Dortmund",psg:"PSG","inter-milan":"InterMilan",juventus:"Juventus","ac-milan":"AcMilan",ajax:"Ajax",napoli:"Napoli",galatasaray:"Galatasaray",benfica:"Benfica",fenerbahce:"Fenerbahce",porto:"Porto",roma:"Roma",celtic:"Celtic",rangers:"Rangers",marseille:"Marseille",feyenoord:"Feyenoord",psv:"PSV",anderlecht:"Anderlecht",besiktas:"Besiktas",trabzonspor:"Trabzonspor","club-brugge":"ClubBrugge","red-star-belgrade":"RedStar","dinamo-zagreb":"DinamoZagreb","hajduk-split":"Hajduk",basel:"Basel","nottingham-forest":"Forest","aston-villa":"Villa",everton:"Everton","leeds-united":"Leeds","west-ham":"WestHam","leicester-city":"Leicester",olympiacos:"Olympiacos",panathinaikos:"Panathinaikos",sunderland:"Sunderland",ipswich:"Ipswich","crystal-palace":"Palace",fulham:"Fulham",brighton:"Brighton",bournemouth:"Bournemouth",brentford:"Brentford",burnley:"Burnley",wolves:"Wolves",coventry:"Coventry","hull-city":"HullCity","athletic-bilbao":"Athletic",sevilla:"Sevilla","real-betis":"Betis","schalke-04":"Schalke","hamburger-sv":"Hamburg",fiorentina:"Fiorentina",lazio:"Lazio",torino:"Torino","sporting-cp":"Sporting","saint-etienne":"SaintEtienne",valencia:"Valencia","bayer-leverkusen":"Leverkusen",lyon:"Lyon",parma:"Parma",monaco:"Monaco"},Br={"premier-league":"PL","la-liga":"LaLiga","serie-a":"SerieA",bundesliga:"Bundesliga","ligue-1":"Ligue1","super-lig":"SuperLig","primeira-liga":"Primeira","champions-league":"UCL","world-cup":"WorldCup",euros:"Euros",legends:"Legends",managers:"Managers","football-records":"Records"},rf=Object.fromEntries(Object.entries(Mr).map(([e,a])=>[a,e])),of=Object.fromEntries(Object.entries(Br).map(([e,a])=>[a,e])),sf={"premier-league":"PL","la-liga":"LaLiga","serie-a":"SerieA",bundesliga:"Bundesliga","ligue-1":"Ligue1"},Ci=[{label:"Leagues",items:[{cat:"PL",name:"Premier League",abbr:"EPL",color:"#3D195B"},{cat:"LaLiga",name:"La Liga",abbr:"LAL",color:"#EE8707"},{cat:"SerieA",name:"Serie A",abbr:"SEA",color:"#0578D3"},{cat:"Bundesliga",name:"Bundesliga",abbr:"BUN",color:"#D20515"},{cat:"Ligue1",name:"Ligue 1",abbr:"L1",color:"#1B2447"},{cat:"SuperLig",name:"Süper Lig",abbr:"TSL",color:"#E30A17"},{cat:"Primeira",name:"Primeira Liga",abbr:"PRI",color:"#046A38"}]},{label:"Tournaments",items:[{cat:"UCL",name:"Champions League",abbr:"UCL",color:"#123A8F"},{cat:"WorldCup",name:"International",abbr:"INT",color:"#8A6D1B"},{cat:"Euros",name:"Euros",abbr:"EUR",color:"#1F6FB2"}]},{label:"Themes",items:[{cat:"Legends",name:"Legends",abbr:"LEG",color:"#B03A2E"},{cat:"Managers",name:"Managers",abbr:"MGR",color:"#37474F"},{cat:"Records",name:"Records",abbr:"REC",color:"#1B7F79"}]}],nt=Object.fromEntries(Ci.flatMap(e=>e.items.map(a=>[a.cat,a]))),Ke={CruzAzul:{name:"Cruz Azul",icon:"ðµ",color:"#212452",questions:[]},Guadalajara:{name:"Chivas",icon:"ð´",color:"#CD1731",questions:[]},ClubAmerica:{name:"Club América",icon:"ð¡",color:"#FFEB00",questions:[]},SanLorenzo:{name:"San Lorenzo",icon:"ðµ",color:"#3D63C9",questions:[]},Independiente:{name:"Independiente",icon:"ð´",color:"#DA291C",questions:[]},Racing:{name:"Racing Club",icon:"ðµ",color:"#6CAFE0",questions:[]},Leipzig:{name:"RB Leipzig",icon:"ð",color:"#DD0741",questions:[]},Atalanta:{name:"Atalanta",icon:"â«",color:"#1D71B8",questions:[]},Boca:{name:"Boca Juniors",icon:"ðµ",color:"#0A2B72",questions:[]},River:{name:"River Plate",icon:"âª",color:"#E1122E",questions:[]},Flamengo:{name:"Flamengo",icon:"ð´",color:"#C52613",questions:[]},SaoPaulo:{name:"São Paulo",icon:"ð´",color:"#FE0000",questions:[]},Gremio:{name:"Grêmio",icon:"ðµ",color:"#0D80BF",questions:[]},Internacional:{name:"Internacional",icon:"ð´",color:"#E5050F",questions:[]},Cruzeiro:{name:"Cruzeiro",icon:"ðµ",color:"#2F529E",questions:[]},Palmeiras:{name:"Palmeiras",icon:"ð¢",color:"#006437",questions:[]},Corinthians:{name:"Corinthians",icon:"â¬",color:"#111111",questions:[]},Santos:{name:"Santos",icon:"âª",color:"#0B0B0B",questions:[]},RealSociedad:{name:"Real Sociedad",icon:"ðµ",color:"#0067B1",questions:[]},Arsenal:{name:"Arsenal",icon:"ð´",color:"#EF0107",questions:[{q:"In which year did Arsenal move from Highbury to the Emirates Stadium?",o:["2004","2005","2006","2007"],a:2,diff:"easy"},{q:"Who scored Arsenal's famous last-minute title-winning goal against Liverpool in 1989?",o:["Alan Smith","Paul Merson","Michael Thomas","Steve Bould"],a:2,diff:"medium"},{q:"Which Arsenal player scored 30 goals in a single Premier League season in 2004-05?",o:["Bergkamp","Pires","Henry","Ljungberg"],a:2,diff:"easy"},{q:"Who was Arsenal's goalkeeper during the Invincibles season of 2003-04?",o:["David Seaman","Jens Lehmann","Stuart Taylor","Manuel Almunia"],a:1,diff:"medium"},{q:"How many league titles did Arsène Wenger win with Arsenal?",o:["1","2","3","4"],a:2,diff:"medium"},{q:"Which club did Arsenal sign Cesc Fà bregas from as a youth player?",o:["Real Madrid","Valencia","Villarreal","Barcelona"],a:3,diff:"hard"},{q:"What year did Arsenal last win the FA Cup before their 2014 victory?",o:["1993","2002","2003","2005"],a:3,diff:"hard"}
140,{q:"Which Arsenal legend scored a hat-trick in the 2003 FA Cup final?",o:["Bergkamp","Ljungberg","Henry","Pires"],a:2,diff:"hard"},{q:"Who is Arsenal's all-time leading scorer in the Premier League?",o:["Ian Wright","Dennis Bergkamp","Henry","Robin van Persie"],a:2,diff:"easy"},{q:"Which manager preceded Arsène Wenger at Arsenal?",o:["Terry Neill","Don Howe","George Graham","Bruce Rioch"],a:3,diff:"medium"}]},Liverpool:{name:"Liverpool",icon:"ð´",color:"#C8102E",questions:[{q:"How many times have Liverpool won the European Cup / Champions League?",o:["4","5","6","7"],a:2,diff:"easy"},{q:"Who scored Liverpool's famous solo goal against Manchester United in the 1996 FA Cup final?",o:["Collymore","McManaman","Barnes","Fowler"],a:1,diff:"hard"},{q:"In which year did Liverpool win their first ever Premier League title?",o:["2018","2019","2020","2021"],a:2,diff:"easy"},{q:"What is the name of Liverpool's famous home end?",o:["The Stretford End","The Kop","The Holte End","The Gwladys Street"],a:1,diff:"easy"},{q:"Which Liverpool player scored 32 Premier League goals in the 2013-14 season?",o:["Gerrard","Suárez","Sterling","Sturridge"],a:1,diff:"medium"},{q:"Who was Liverpool's top scorer in the 2019-20 title-winning season?",o:["Firmino","Mané","Salah","Henderson"],a:2,diff:"medium"},{q:"In which year did Liverpool win their first ever First Division title?",o:["1901","1906","1922","1947"],a:1,diff:"hard"},{q:"Which Liverpool manager won back-to-back league titles in 1976 and 1977?",o:["Bill Shankly","Bob Paisley","Joe Fagan","Kenny Dalglish"],a:1,diff:"medium"},{q:"Who scored the winning penalty for Liverpool in the 2022 FA Cup final shootout vs Chelsea?",o:["Salah","Van Dijk","Kelleher","Milner"],a:2,diff:"hard"}]},ManUtd:{name:"Man United",icon:"ð´",color:"#DA291C",questions:[{q:"How many Premier League titles did Sir Alex Ferguson win with Manchester United?",o:["10","11","12","13"],a:3,diff:"medium"},{q:"Who scored United's second injury-time goal in the 1999 Champions League final?",o:["Sheringham","Cole","Solskjær","Scholes"],a:2,diff:"medium"},{q:"Which player did Manchester United sell to Real Madrid in 2009?",o:["Rooney","Ronaldo","Tevez","Berbatov"],a:1,diff:"easy"},{q:"In which year did Manchester United complete their historic treble?",o:["1997","1998","1999","2000"],a:2,diff:"easy"},{q:"Who is Manchester United's all-time record goalscorer?",o:["Bobby Charlton","Denis Law","Rooney","Giggs"],a:2,diff:"easy"},{q:"Which manager took over from David Moyes at Manchester United in 2014?",o:["Louis van Gaal","José Mourinho","Giggs","Phil Neville"],a:0,diff:"medium"},{q:"What is the capacity of Old Trafford approximately?",o:["65,000","72,000","74,000","76,000"],a:2,diff:"medium"},{q:"Who scored a hat-trick for United vs Porto in the 2009 Champions League?",o:["Tevez","Ronaldo","Rooney","Berbatov"],a:1,diff:"hard"},{q:"Which year did Eric Cantona join Manchester United?",o:["1991","1992","1993","1994"],a:1,diff:"medium"},{q:"Who captained Manchester United to FA Cup glory in 2016?",o:["Rooney","Carrick","Smalling","Blind"],a:0,diff:"hard"}]},Barcelona:{name:"Barcelona",icon:"ðµ",color:"#A50044",questions:[{q:"How many trebles has Barcelona won in their history?",o:["1","2","3","4"],a:2,diff:"medium"},{q:"Which Barcelona player won the 2010 and 2014 World Cup?",o:["Xavi","Iniesta","Puyol","Busquets"],a:1,diff:"easy"},{q:"In which year did Barcelona complete the first of their three trebles under Pep Guardiola?",o:["2008","2009","2010","2011"],a:1,diff:"medium"},{q:"Who scored Barcelona's crucial away goal vs Chelsea in the 2012 UCL semi-final?",o:["Messi","Busquets","Puyol","Iniesta"],a:0,diff:"hard"},{q:"Which club did Neymar leave to join Barcelona in 2013?",o:["Flamengo","Santos","Corinthians","Grêmio"],a:1,diff:"easy"},{q:"Who is Barcelona's all-time top scorer?",o:["Ronaldo","Kubala","César","Messi"],a:3,diff:"easy"},{q:"In which year did Johan Cruyff join Barcelona as a player?",o:["1971","1973","1975","1977"],a:1,diff:"hard"},{q:"What is the name of Barcelona's stadium?",o:["Bernabéu","Wanda Metropolitano","Camp Nou","Spotify Camp Nou"],a:3,diff:"easy"},{q:"Who managed Barcelona immediately before Pep Guardiola in 2008?",o:["Rijkaard","Van Gaal","Tito Vilanova","Luis Enrique"],a:0,diff:"medium"}]},RealMadrid:{name:"Real Madrid",icon:"âª",color:"#FFFFFF",questions:[{q:"How many Champions League titles has Real Madrid won in total?",o:["13","14","15","16"],a:2,diff:"easy"},{q:"Who scored Real Madrid's winning goal in the 2014 Champions League final vs Atletico?",o:["Benzema","Bale","Ramos","Modric"],a:2,diff:"medium"},{q:"Which year did Ronaldo join Real Madrid from Manchester United?",o:["2007","2008","2009","2010"],a:2,diff:"easy"},{q:"Who managed Real Madrid to three consecutive Champions League titles?",o:["Ancelotti","Mourinho","Benitez","Zidane"],a:3,diff:"easy"},{q:"What is Real Madrid's home stadium now officially called after renovation?",o:["Bernabéu Arena","Santiago Bernabéu","Estadio Real","Florentino Pérez Arena"],a:1,diff:"easy"},{q:"Which player scored for Real Madrid in five consecutive Champions League finals?",o:["Benzema","Bale","Ronaldo","Modric"],a:2,diff:"hard"},{q:"Who was Real Madrid's first Galáctico signing in 2000?",o:["Figo","Zidane","Ronaldo","Beckham"],a:0,diff:"medium"},{q:"How many La Liga titles did Zidane win as Real Madrid manager?",o:["1","2","3","0"],a:0,diff:"medium"},{q:"Which Real Madrid player was known as 'El Halcón' (The Falcon)?",o:["Ronaldo","Raúl","Morientes","Hierro"],a:1,diff:"hard"}]},ManCity:{name:"Man City",icon:"ðµ",color:"#6CABDD",questions:[{q:"In which year did Man City win their first Premier League title?",o:["2010","2011","2012","2013"],a:2,diff:"easy"},{q:"Who scored the famous 93:20 goal to win the 2012 Premier League title?",o:["Tevez","Balotelli","Silva","Agüero"],a:3,diff:"easy"},{q:"Which manager led Man City to their first Champions League title in 2023?",o:["Mancini","Pellegrini","Guardiola","Hughes"],a:2,diff:"easy"},{q:"How many Premier League titles did Man City win between 2011 and 2024?",o:["5","6","7","8"],a:3,diff:"medium"},{q:"Which player left Man City to join Barcelona in 2025 after breaking all scoring records?",o:["De Bruyne","Foden","Haaland","B. Silva"],a:2,diff:"medium"},{q:"Man City's Etihad Stadium is in which area of Manchester?",o:["Salford","Stretford","Eastlands","Old Trafford"],a:2,diff:"medium"},{q:"Which Man City player won the PFA Players' Player of the Year four times?",o:["Silva","Agüero","De Bruyne","Kompany"],a:2,diff:"hard"},{q:"Who was Man City's top scorer in the 2022-23 Champions League winning campaign?",o:["Foden","GündoÄan","De Bruyne","Haaland"],a:3,diff:"hard"},{q:"Man City completed an unprecedented domestic treble in which season?",o:["2018-19","2020-21","2022-23","2023-24"],a:2,diff:"medium"},{q:"Which Abu Dhabi group took over Man City in 2008?",o:["ADNOC","Mubadala","Abu Dhabi United Group","UAE Investment Fund"],a:2,diff:"hard"}]},Chelsea:{name:"Chelsea",icon:"ðµ",color:"#034694",questions:[{q:"Which Russian billionaire bought Chelsea in 2003?",o:["Abramovich","Prokhorov","Deripaska","Potanin"],a:0,diff:"easy"},{q:"Chelsea won their first Champions League in 2012 â who scored the winning penalty in the shootout?",o:["Lampard","Drogba","Torres","Mata"],a:0,diff:"medium"},{q:"Which manager led Chelsea to their first Premier League title in 2004-05?",o:["Ranieri","Mourinho","Ancelotti","Hiddink"],a:1,diff:"easy"},{q:"Didier Drogba scored how many Premier League goals for Chelsea?",o:["100","104","108","115"],a:2,diff:"hard"},{q:"Chelsea won the Champions League for a second time in 2021 â who managed them?",o:["Lampard","Sarri","Tuchel","Ancelotti"],a:2,diff:"easy"},{q:"Which Chelsea player won the PFA Young Player of the Year in 2022?",o:["Mount","Pulisic","Reece James","Mason Mount"],a:2,diff:"medium"},{q:"Chelsea's Stamford Bridge is in which part of London?",o:["East London","South London","West London","North London"],a:2,diff:"easy"},{q:"Who scored a famous last-minute goal for Chelsea vs Arsenal in the 1998 League Cup final?",o:["Zola","Vialli","Di Matteo","Wise"],a:1,diff:"hard"},{q:"Chelsea set a then-record of how many points in the 2004-05 Premier League season?",o:["91","93","95","97"],a:2,diff:"hard"},{q:"Which consortium took over Chelsea from Abramovich in 2022?",o:["Qatar Sports Investments","INEOS","BlueCo","PCP Capital Partners"],a:2,diff:"medium"}]},BayernMunich:{name:"Bayern Munich",icon:"ð´",color:"#DC052D",questions:[{q:"How many Bundesliga titles have Bayern Munich won â the most in German football?",o:["28","30","32","34"],a:2,diff:"medium"},{q:"Bayern Munich won the Champions League in 2020 without losing a single game â who managed them?",o:["KovaÄ","Guardiola","Heynckes","Flick"],a:3,diff:"easy"},{q:"Which legendary striker scored 365 Bundesliga goals â an all-time record?",o:["Müller","Lewandowski","Rummenigge","Gerd Müller"],a:3,diff:"easy"},{q:"Bayern's famous treble season of 2012-13 was won under which manager?",o:["Guardiola","Flick","Heynckes","Ancelotti"],a:2,diff:"medium"},{q:"Bayern Munich's Allianz Arena opened in which year?",o:["2004","2005","2006","2007"],a:1,diff:"medium"},{q:"Who was Bayern Munich's captain when they won the 2013 Champions League final?",o:["Neuer","Lahm","Schweinsteiger","Robben"],a:1,diff:"medium"},{q:"Robert Lewandowski scored 41 Bundesliga goals in 2020-21 â whose record of 40 did he break?",o:["Rummenigge","Gerd Müller","Müller T","Klinsmann"],a:1,diff:"medium"},{q:"Bayern Munich were the first team in the 2019-20 UCL to beat Barcelona â what was the score?",o:["6-1","7-2","8-2","5-0"],a:2,diff:"easy"}
140,{q:"Which player has won the most Bundesliga titles as a Bayern player?",o:["Lahm","Müller T","Neuer","Kahn"],a:1,diff:"hard"}]},Juventus:{name:"Juventus",icon:"â«",color:"#000000",questions:[{q:"How many consecutive Serie A titles did Juventus win from 2012 to 2020?",o:["7","8","9","10"],a:2,diff:"easy"},{q:"Which player scored the decisive penalty for Juventus in the 1996 Champions League final?",o:["Del Piero","Baggio","Vialli","JugoviÄ"],a:3,diff:"hard"},{q:"Juventus's stadium is named after which sponsor?",o:["Pirelli","Allianz","Juventus Arena","Fiat"],a:1,diff:"easy"},{q:"Which manager won Juventus's historic nine consecutive Serie A titles?",o:["Lippi","Allegri then Conte","Conte then Allegri","Sarri"],a:2,diff:"medium"},{q:"Juventus's nickname 'La Vecchia Signora' means what?",o:["The Black and Whites","The Old Lady","The Turin Giants","The Zebras"],a:1,diff:"easy"},{q:"Alessandro Del Piero spent how many years at Juventus?",o:["17","18","19","20"],a:0,diff:"hard"},{q:"Juventus were stripped of two Serie A titles in 2006 due to which scandal?",o:["Doping","Calciopoli match-fixing","Financial irregularities","Fan violence"],a:1,diff:"medium"},{q:"Gianluigi Buffon made how many appearances for Juventus â a club record?",o:["576","626","676","726"],a:2,diff:"medium"},{q:"Juventus reached the Champions League final in 2015 and 2017 â who beat them both times?",o:["Real Madrid","Barcelona","Bayern Munich","Real Madrid in 2015, Madrid in 2017"],a:0,diff:"medium"}]},AcMilan:{name:"AC Milan",icon:"ð´",color:"#FB090B",questions:[{q:"AC Milan was founded in 1899 by businessmen from which English city?",o:["London","Liverpool","Manchester","Nottingham"],a:3,diff:"hard"},{q:"Which legendary sweeper was AC Milan's captain for most of the 1980s and 1990s?",o:["Maldini","Costacurta","Baresi","Albertini"],a:2,diff:"medium"},{q:"AC Milan won back-to-back European Cups in which years under Arrigo Sacchi?",o:["1988 and 1989","1989 and 1990","1990 and 1991","1991 and 1992"],a:1,diff:"medium"},{q:"Paolo Maldini holds the record for most AC Milan appearances â approximately how many?",o:["802","868","902","952"],a:1,diff:"hard"},{q:"AC Milan's famous red and black kit â what do the colours officially represent?",o:["Fire and night","Red hell and black fear of opponents","The city's colours","Historical tradition"],a:1,diff:"hard"},{q:"AC Milan won the Champions League in 2007 â who did they beat in the final?",o:["Arsenal","Barcelona","Man Utd","Liverpool"],a:3,diff:"medium"},{q:"What is the name of the stadium shared by AC Milan and Inter Milan?",o:["Olimpico","Meazza / San Siro","Delle Alpi","Tardini"],a:1,diff:"easy"},{q:"AC Milan won the Serie A title in 2021-22 â ending an 11-year drought. Who was their standout forward?",o:["IbrahimoviÄ","Giroud","Leão","RebiÄ"],a:2,diff:"medium"},{q:"Which two AC Milan managers each won two European Cups with the club â Nereo Rocco in the 1960s and which other legend decades later?",o:["Fabio Capello","Arrigo Sacchi","Carlo Ancelotti","Both Sacchi and Ancelotti"],a:3,cat:"UCL",diff:"hard",type:"mcq",hint:"Sacchi won in 1989 and 1990 with the Dutch trio; Ancelotti won in 2003 and 2007 with Kaká and Maldini.",v:1}]},Atletico:{name:"Atletico Madrid",icon:"ð´",color:"#CB3524",questions:[{q:"Who has managed Atletico Madrid since December 2011?",o:["Quique Flores","Rudi GarcÃa","Diego Simeone","Emery"],a:2,diff:"easy"},{q:"Atletico Madrid won La Liga in 2013-14 â their first title in how many years?",o:["14","16","18","20"],a:2,diff:"medium"},{q:"Atletico Madrid's red and white striped kit was inspired by which English club?",o:["Arsenal","Liverpool","Sunderland","Southampton"],a:2,diff:"medium"},{q:"Which Atletico Madrid striker scored 274 La Liga goals â a club record?",o:["Forlan","Griezmann","Torres","Luis GarcÃa"],a:1,diff:"hard"},{q:"Atletico Madrid reached the Champions League final in 2014 and 2016 â who beat them both times?",o:["Barcelona","Real Madrid","Bayern","PSG"],a:1,diff:"easy"},{q:"What is the name of Atletico Madrid's current stadium?",o:["Vicente Calderón","Bernabéu","CÃvitas Metropolitano","Riazor"],a:2,diff:"medium"},{q:"Atletico Madrid won the Europa League in 2012, 2018 and which other year?",o:["2010","2016","2022","2024"],a:1,diff:"medium"}
140,{q:"Fernando Torres left Atletico for Liverpool in 2007 â for a fee of how much?",o:["£20m","£25m","£30m","£35m"],a:1,diff:"hard"},{q:"Which Atletico player famously headed in a last-minute goal to take the 2014 UCL final to extra time?",o:["Diego Costa","Arda Turan","Godin","Filipe LuÃs"],a:2,diff:"medium"},{q:"Atletico's nickname is 'Los Colchoneros' â what does this mean in English?",o:["The Warriors","The Red and Whites","The Mattress Makers","The Defenders"],a:2,diff:"hard"}]},Frankfurt:{name:"Eintracht Frankfurt",icon:"ð¦
",color:"#E1000F",questions:[]},Dortmund:{name:"Borussia Dortmund",icon:"ð¡",color:"#FDE100",questions:[{q:"What are Borussia Dortmund's official club colours?",o:["Red and black","Yellow and black","Yellow and white","Black and white"],a:1,diff:"easy"},{q:"The famous Yellow Wall at Signal Iduna Park holds approximately how many standing fans?",o:["20,000","25,000","27,000","30,000"],a:2,diff:"medium"},{q:"Who managed Dortmund to back-to-back Bundesliga titles in 2011 and 2012?",o:["Favre","Tuchel","Klopp","Hitzfeld"],a:2,diff:"easy"},{q:"Dortmund reached the Champions League final in 2013 â who beat them in the all-German final?",o:["Schalke","Bayern Munich","Hamburg","Leverkusen"],a:1,diff:"easy"},{q:"Which player scored 23 Champions League goals for Dortmund before joining Man City in 2022?",o:["Reus","Götze","Lewandowski","Haaland"],a:3,diff:"easy"},{q:"Mario Götze left Dortmund for Bayern Munich in 2013 â how much did Bayern pay?",o:["£25m","£31m","£37m","£44m"],a:2,diff:"hard"},{q:"Dortmund's worst ever Bundesliga defeat was 0-12 â to which club in 1978?",o:["Bayern Munich","Hamburg","Schalke","Borussia Mönchengladbach"],a:3,diff:"hard"},{q:"Which Dortmund player scored the winning goal in the 2012 DFB-Pokal final vs Bayern?",o:["Reus","Lewandowski","Götze","GündoÄan"],a:2,diff:"hard"},{q:"Borussia Dortmund were founded in which year?",o:["1901","1905","1909","1912"],a:2,diff:"medium"},{q:"Dortmund reached the UCL final in 2024 â who beat them in Wembley?",o:["PSG","Man City","Bayern","Real Madrid"],a:3,diff:"easy"}]},PSG:{name:"Paris Saint-Germain",icon:"ðµ",color:"#003170",questions:[{q:"PSG were taken over by which country's investment group in 2011?",o:["UAE","Saudi Arabia","China","Qatar"],a:3,diff:"easy"},{q:"Which player became the world's most expensive transfer ever when PSG signed him in 2017?",o:["Neymar","Mbappé","Verratti","Cavani"],a:0,diff:"easy"},{q:"PSG won the 2024-25 Champions League â who did they beat in the final?",o:["Arsenal","Inter","Barcelona","Real Madrid"],a:1,diff:"easy"},{q:"Kylian Mbappé left PSG to join which club in 2024?",o:["Man City","Arsenal","Bayern Munich","Real Madrid"],a:3,diff:"easy"},{q:"PSG's Parc des Princes stadium is in which area of Paris?",o:["Montmartre","Marais","16th arrondissement","Boulogne"],a:2,diff:"medium"},{q:"Edinson Cavani scored how many goals for PSG â a club record?",o:["198","211","220","240"],a:2,diff:"hard"},{q:"PSG beat Barcelona 4-0 in the 2016-17 UCL group stage â who scored twice that night?",o:["Cavani","Di MarÃa","Verratti","Lucas Moura"],a:0,diff:"hard"},{q:"PSG won how many consecutive Ligue 1 titles between 2013 and 2023?",o:["7","8","9","10"],a:2,diff:"medium"},{q:"Who managed PSG when they won their first Champions League in 2024-25?",o:["Pochettino","Galtier","Enrique","Campos"],a:2,diff:"medium"}]},InterMilan:{name:"Inter Milan",icon:"â«",color:"#010E80",questions:[{q:"Inter Milan was founded in 1908 â why did they split from AC Milan?",o:["Financial reasons","They wanted more foreign players","A dispute over colours","The manager left"],a:1,diff:"medium"},{q:"Inter won the Champions League in 2010 as part of a treble â who managed them?",o:["Mancini","Lippi","Mourinho","Spalletti"],a:2,diff:"easy"},{q:"Which Inter player holds the record for most consecutive appearances in Serie A?",o:["Maldini","Zanetti","Facchetti","Baresi"],a:1,diff:"hard"},{q:"Inter's nickname 'La Beneamata' translates roughly to what?",o:["The Black and Blues","The Beloved One","The Great Inter","The Milan Giants"],a:1,diff:"medium"},{q:"Inter won the Serie A title in 2020-21 â ending Juventus's nine-year run. Who managed them?",o:["Mancini","Spalletti","Simone Inzaghi","Conte"],a:3,diff:"medium"},{q:"Inter reached the Champions League final in 2023 â who beat them?",o:["PSG","Bayern Munich","Real Madrid","Man City"],a:3,diff:"easy"},{q:"Which legendary player was Inter captain for nearly his entire career â 19 seasons?",o:["Facchetti","Mazzola","Zanetti","Cordoba"],a:2,diff:"hard"},{q:"Inter Milan and AC Milan share the San Siro stadium â what is its official name?",o:["Stadio Inter","Stadio Meazza","Stadio San Siro","Stadio di Milano"],a:1,diff:"medium"},{q:"Inter's 2023-24 Serie A title win â how many points did they finish with?",o:["86","89","92","94"],a:2,diff:"hard"},{q:"Which striker scored 30 Serie A goals for Inter in 2022-23?",o:["Džeko","L. MartÃnez","Lukaku","Sanchez"],a:1,diff:"medium"}]},Ajax:{name:"Ajax",icon:"ð´",color:"#CC0000",questions:[{q:"Ajax won the Champions League in 1995 with a famous young squad â who managed them?",o:["Cruyff","Michels","Van Gaal","Koeman"],a:2,diff:"medium"},{q:"Which Ajax player became the world's most expensive teenager when he joined Juventus in 2019?",o:["Frenkie de Jong","Matthijs de Ligt","Hakim Ziyech","Donny van de Beek"],a:1,diff:"easy"},{q:"Ajax's ground is called the Johan Cruyff Arena â what was it called before 2018?",o:["Ajax Arena","Olympic Stadium","Amsterdam Arena","De Kuip"],a:2,diff:"medium"},{q:"Ajax knocked out Real Madrid in the 2018-19 Champions League â what was the score in the Bernabéu?",o:["2-1","3-1","4-1","3-2"],a:2,diff:"hard"},{q:"Johan Cruyff â Ajax's greatest ever player â won the European Cup with Ajax how many times as a player?",o:["2","3","4","5"],a:1,diff:"medium"},{q:"Ajax have produced players for many top clubs â which country provides most of their academy players?",o:["Suriname","Morocco","Netherlands","Ghana"],a:2,diff:"medium"},{q:"Ajax won four consecutive Dutch league titles from 2019 to 2022 â true or false?",o:["True","False â they only w
140on three","False â they won two","False â another club won in 2021"],a:3,diff:"hard"},{q:"Which Ajax striker scored a hat-trick on his debut aged 17 in 2019?",o:["Brobbey","Bergwijn","Neres","Brian Brobbey"],a:3,diff:"hard"},{q:"Ajax's famous 3-4-3 system was developed by which legendary Dutch coach?",o:["Michels","Cruyff","Van Gaal","Kovacs"],a:0,diff:"medium"},{q:"How many times have Ajax won the European Cup or Champions League?",o:["3","4","5","6"],a:2,diff:"medium"}]},Tottenham:{name:"Tottenham",icon:"âª",color:"#132257",questions:[]},Newcastle:{name:"Newcastle",icon:"â«",color:"#241F20",questions:[]},Napoli:{name:"Napoli",icon:"ðµ",color:"#12A0D7",questions:[]},Galatasaray:{name:"Galatasaray",icon:"ð¡",color:"#A90432",questions:[]},Benfica:{name:"Benfica",icon:"ð´",color:"#E32221",questions:[]},Fenerbahce:{name:"Fenerbahçe",icon:"ð¡",color:"#163962",questions:[]},Porto:{name:"Porto",icon:"ðµ",color:"#00428C",questions:[]},Roma:{name:"Roma",icon:"ð´",color:"#8E1F2F",questions:[]},Celtic:{name:"Celtic",icon:"ð",color:"#018749",questions:[]},Rangers:{name:"Rangers",icon:"ðµ",color:"#1B458F",questions:[]},Marseille:{name:"Marseille",icon:"âª",color:"#2FAEE0",questions:[]},Feyenoord:{name:"Feyenoord",icon:"ð´",color:"#DA020E",questions:[]},PSV:{name:"PSV",icon:"ð´",color:"#ED1C24",questions:[]},Anderlecht:{name:"Anderlecht",icon:"ð£",color:"#52247F",questions:[]},Besiktas:{name:"BeÅiktaÅ",icon:"ð¦
",color:"#000000",questions:[]},Trabzonspor:{name:"Trabzonspor",icon:"ð",color:"#7B1E3C",questions:[]},ClubBrugge:{name:"Club Brugge",icon:"ðµ",color:"#0A4595",questions:[]},RedStar:{name:"Red Star Belgrade",icon:"â",color:"#E4002B",questions:[]},DinamoZagreb:{name:"Dinamo Zagreb",icon:"ðµ",color:"#1B458F",questions:[]},Hajduk:{name:"Hajduk Split",icon:"âª",color:"#0E4C92",questions:[]},Basel:{name:"Basel",icon:"ð´",color:"#002D62",questions:[]},Forest:{name:"Nottingham Forest",icon:"ð³",color:"#E53233",questions:[]},Villa:{name:"Aston Villa",icon:"ð¦",color:"#670E36",questions:[]},Everton:{name:"Everton",icon:"ðµ",color:"#003399",questions:[]},Leeds:{name:"Leeds United",icon:"âª",color:"#1D428A",questions:[]},Leicester:{name:"Leicester City",icon:"ð¦",color:"#003090",questions:[]},Olympiacos:{name:"Olympiacos",icon:"ð´",color:"#DA020E",questions:[]},Panathinaikos:{name:"Panathinaikos",icon:"ð",color:"#00614E",questions:[]},WestHam:{name:"West Ham",icon:"âï¸",color:"#7A263A",questions:[]},Sunderland:{name:"Sunderland",icon:"ð´",color:"#EB172B",questions:[]},Ipswich:{name:"Ipswich Town",icon:"ðµ",color:"#3A64A3",questions:[]},Palace:{name:"Crystal Palace",icon:"ð¦
",color:"#1B458F",questions:[]},Fulham:{name:"Fulham",icon:"âª",color:"#E6E6E6",questions:[]},Brighton:{name:"Brighton",icon:"ðµ",color:"#0057B8",questions:[]},Bournemouth:{name:"Bournemouth",icon:"ð",color:"#DA291C",questions:[]},Brentford:{name:"Brentford",icon:"ð",color:"#E30613",questions:[]},Burnley:{name:"Burnley",icon:"ð£",color:"#6C1D45",questions:[]},Wolves:{name:"Wolves",icon:"ðº",color:"#FDB913",questions:[]},Coventry:{name:"Coventry City",icon:"ð",color:"#059DD9",questions:[]},HullCity:{name:"Hull City",icon:"ð¯",color:"#F18A01",questions:[]},Athletic:{name:"Athletic Bilbao",icon:"ð¦",color:"#EE2523",questions:[]},Sevilla:{name:"Sevilla",icon:"ð´",color:"#CB0007",questions:[]},Betis:{name:"Real Betis",icon:"ð¢",color:"#00954C",questions:[]},Schalke:{name:"Schalke 04",icon:"ðµ",color:"#004E9E",questions:[]},Hamburg:{name:"Hamburger SV",icon:"⬦",color:"#0A3A7A",questions:[]},Fiorentina:{name:"Fiorentina",icon:"ð£",color:"#592C82",questions:[]},Lazio:{name:"Lazio",icon:"ð¦
",color:"#87D8F7",questions:[]},Torino:{name:"Torino",icon:"ð",color:"#8A1E12",questions:[]},Sporting:{name:"Sporting CP",icon:"ð¦",color:"#008056",questions:[]},SaintEtienne:{name:"Saint-Ãtienne",icon:"ð¢",color:"#009E60",questions:[]},Valencia:{name:"Valencia",icon:"ð¦",color:"#F18E00",questions:[]},Leverkusen:{name:"Bayer Leverkusen",icon:"ð´",color:"#E32221",questions:[]},Lyon:{name:"Olympique Lyonnais",icon:"ð¦",color:"#3D74C4",questions:[]},Parma:{name:"Parma",icon:"ð¡",color:"#F5D800",questions:[]},Monaco:{name:"AS Monaco",icon:"ðº",color:"#DA291C",questions:[]},Birmingham:{name:"Birmingham City",icon:"ðµ",color:"#253896",questions:[]},Cardiff:{name:"Cardiff City",icon:"ð¦",color:"#0070B5",questions:[]},Derby:{name:"Derby County",icon:"ð",color:"#1B1B1B",questions:[]},Norwich:{name:"Norwich City",icon:"ð¤",color:"#00A650",questions:[]},Middlesbrough:{name:"Middlesbrough",icon:"ð´",color:"#DC143C",questions:[]},WestBrom:{name:"West Brom",icon:"ðµ",color:"#122F67",questions:[]},SheffUtd:{name:"Sheffield United",icon:"âï¸",color:"#EE2737",questions:[]},Blackburn:{name:"Blackburn Rovers",icon:"ð·",color:"#009EE0",questions:[]},Watford:{name:"Watford",icon:"ð",color:"#F2E23A",questions:[]},QPR:{name:"Queens Park Rangers",icon:"â",color:"#1D5BA4",questions:[]},Portsmouth:{name:"Portsmouth",icon:"â",color:"#001489",questions:[]},SheffWed:{name:"Sheffield Wednesday",icon:"ð¦",color:"#0066B3",questions:[]},Southampton:{name:"Southampton",icon:"âµ",color:"#D71920",questions:[]},Stoke:{name:"Stoke City",icon:"ð´",color:"#E03A3E",questions:[]},Swansea:{name:"Swansea City",icon:"ð¦¢",color:"#121212",questions:[]},Wrexham:{name:"Wrexham",icon:"ð",color:"#DA291C",questions:[]}},It={mixed:{id:"mixed",label:"Mixed â all topics",icon:"ð²"},leagues:[{id:"cat:PL",label:"Premier League",icon:"ð´ó §ó ¢ó ¥ó ®ó §ó ¿"},{id:"cat:LaLiga",label:"La Liga",icon:"ðªð¸"},{id:"cat:SerieA",label:"Serie A",icon:"ð®ð¹"},{id:"cat:Bundesliga",label:"Bundesliga",icon:"ð©ðª"},{id:"cat:Ligue1",label:"Ligue 1",icon:"ð«ð·"},{id:"cat:SuperLig",label:"Süper Lig",icon:"ð¹ð·"},{id:"cat:Primeira",label:"Primeira Liga",icon:"ðµð¹"}],tournaments:[{id:"cat:UCL",label:"Champions League",icon:"â"},{id:"cat:WorldCup",label:"International",icon:"ð"},{id:"cat:Euros",label:"Euros",icon:"ð"}],clubs:Object.entries(Tn).map(([e,a])=>{const n=Ke[e]?.color||null;return{id:`club:${e}
140`,label:a,abbr:Tr[e]||_i(a),color:n,fg:n?Ka(n):null}}).sort((e,a)=>e.label.localeCompare(a.label))};function lf(e){if(!e||e==="mixed")return{label:It.mixed.label,icon:It.mixed.icon,sub:"Questions from every topic"};const a=[...It.leagues,...It.tournaments].find(r=>r.id===e);if(a)return{label:a.label,icon:a.icon,sub:"Competition pack"};const n=It.clubs.find(r=>r.id===e);return n?{label:n.label,abbr:n.abbr,color:n.color,fg:n.fg,sub:"Club deep-dive"}:{label:It.mixed.label,icon:It.mixed.icon,sub:"Questions from every topic"}}function _h({value:e,onDone:a,onClose:n}){const[r,i]=l.useState(e||"mixed"),[c,d]=l.useState(()=>String(e||"").startsWith("club:")?"clubs":It.tournaments.some(N=>N.id===e)?"tournaments":"leagues"),o=lf(r),u=r==="mixed"?"Done â Mixed, all topics":`Done â ${o.label}`,[m,p]=l.useState(""),g=It[c]||[],k=m.trim().toLowerCase(),b=k?g.filter(N=>N.label.toLowerCase().includes(k)||(N.abbr||"").toLowerCase().includes(k)):g;return t.jsxs("div",{style:{position:"fixed",inset:0,zIndex:999,background:"var(--bg)",display:"flex",flexDirection:"column"},children:[t.jsxs("div",{style:{padding:"calc(14px + env(safe-area-inset-top, 0px)) 20px 0",display:"flex",alignItems:"center",gap:12},children:[t.jsx("button",{onClick:n,"aria-label":"Back",style:{width:38,height:38,borderRadius:12,background:"var(--s1)",border:"1px solid var(--border)",color:"var(--t1)",fontSize:16,cursor:"pointer",fontFamily:"inherit"},children:"â"}),t.jsx("span",{style:{fontSize:24,fontWeight:800,letterSpacing:"-0.02em",color:"var(--t1)"},children:"Topics"})]}),t.jsxs("div",{style:{flex:1,overflowY:"auto",WebkitOverflowScrolling:"touch",padding:"0 20px 20px"},children:[t.jsxs("button",{onClick:()=>i("mixed"),style:{width:"100%",marginTop:14,borderRadius:999,boxShadow:"0 8px 22px -8px rgba(88,204,2,0.55)",textAlign:"left",cursor:"pointer",fontFamily:"inherit",display:"flex",alignItems:"center",gap:11,padding:"13px 15px",...r==="mixed"?{background:"rgba(88,204,2,0.1)",border:"1.5px solid rgba(88,204,2,0.55)"}:{background:"var(--s1)",border:"1px solid var(--border)"}},children:[t.jsx("span",{style:{fontSize:19},children:"ð²"}),t.jsx("span",{style:{fontSize:14.5,fontWeight:r==="mixed"?800:700,color:r==="mixed"?"var(--grn-soft)":"var(--t1)"},children:"Mixed â all topics"}),t.jsx("span",{style:{marginLeft:"auto",width:19,height:19,borderRadius:"50%",...r==="mixed"?{background:"var(--accent)",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:11,color:"var(--grn-ink)",fontWeight:900}:{border:"1.5px solid #3E4150"}},children:r==="mixed"?"â":""})]}),t.jsx("div",{style:{display:"flex",gap:6,marginTop:16,padding:4,borderRadius:14,background:"var(--s1)",border:"1px solid var(--border)"},children:[{id:"leagues",label:"Leagues"},{id:"clubs",label:"Clubs"},{id:"tournaments",label:"Tournaments"}].map(N=>t.jsx("button",{onClick:()=>{d(N.id),p("")},style:{flex:1,borderRadius:10,padding:9,textAlign:"center",fontSize:13,cursor:"pointer",fontFamily:"inherit",...c===N.id?{background:"var(--s2)",border:"1px solid #3E4150",fontWeight:800,color:"var(--t1)"}:{background:"transparent",border:"1px solid transparent",fontWeight:700,color:"var(--t2)"}},children:N.label},N.id))}),g.length>12&&t.jsxs("div",{style:{position:"relative",marginTop:12},children:[t.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:13,top:"50%",transform:"translateY(-50%)",fontSize:14,opacity:.65,pointerEvents:"none"},children:"ð"}),t.jsx("input",{value:m,onChange:N=>p(N.target.value),placeholder:`Search ${c}â¦`,"aria-label":`Search ${c}`,autoComplete:"off",spellCheck:!1,style:{width:"100%",boxSizing:"border-box",padding:"12px 38px",borderRadius:13,background:"var(--s1)",border:"1px solid var(--border)",color:"var(--t1)",fontSize:16,fontFamily:"inherit",outline:"none"}}),m&&t.jsx("button",{onClick:()=>p(""),"aria-label":"Clear search",style:{position:"absolute",right:6,top:"50%",transform:"translateY(-50%)",width:30,height:30,borderRadius:9,background:"transparent",border:"none",color:"var(--t2)",fontSize:15,cursor:"pointer",fontFamily:"inherit"},children:"â"})]}),k&&b.length===0&&t.jsxs("div",{style:{marginTop:18,textAlign:"center",color:"var(--t2)",fontSize:13.5},children:["No ",c," matching â",m.trim(),"â"]}
140),t.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:9,marginTop:14},children:b.map(N=>{const j=r===N.id;return t.jsxs("button",{onClick:()=>i(N.id),style:{borderRadius:16,padding:14,display:"flex",flexDirection:"column",gap:6,textAlign:"left",cursor:"pointer",fontFamily:"inherit",...j?{background:"rgba(88,204,2,0.1)",border:"1.5px solid rgba(88,204,2,0.55)"}:{background:"var(--s1)",border:"1px solid var(--border)"}},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:[N.abbr?t.jsx("span",{style:{width:34,height:34,borderRadius:10,background:N.color||(j?"rgba(88,204,2,0.14)":"var(--s2)"),display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:900,letterSpacing:"0.04em",color:N.fg||(j?"var(--grn-soft)":"var(--t1)"),boxShadow:N.color?`0 2px 8px ${N.color}55`:void 0},children:N.abbr}):t.jsx("span",{style:{fontSize:24},children:N.icon}),j&&t.jsx("span",{style:{width:19,height:19,borderRadius:"50%",background:"var(--accent)",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:11,color:"var(--grn-ink)",fontWeight:900},children:"â"})]}),t.jsx("span",{style:{fontSize:14.5,fontWeight:j?800:700,color:j?"var(--grn-soft)":"var(--t1)",marginTop:2},children:N.label})]},N.id)})})]}),t.jsx("div",{style:{borderTop:"1px solid var(--s1)",background:"#0C0E14",padding:"12px 20px calc(12px + env(safe-area-inset-bottom, 0px))"},children:t.jsx("button",{onClick:()=>a(r),style:{width:"100%",border:"none",borderRadius:999,background:"var(--accent)",boxShadow:"0 8px 22px -8px rgba(88,204,2,0.55)",padding:15,fontSize:15.5,fontWeight:800,color:"var(--grn-ink)",cursor:"pointer",fontFamily:"inherit"},children:u})})]})}const cf={Arsenal:`<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> 141 <path d="M12 10 L88 10 L88 55 Q88 88 50 96 Q12 88 12 55 Z" fill="#EF0107"/> 142 <rect x="24" y="48" width="42" height="8" rx="2" fill="#FFFFFF"/> 143 <polygon points="64,44 80,52 64,60" fill="#FFFFFF"/> 144 <circle cx="32" cy="66" r="9" fill="#FFFFFF"/> 145 <circle cx="32" cy="66" r="3" fill="#EF0107"/> 146 <line x1="32" y1="57" x2="32" y2="75" stroke="#EF0107" stroke-width="1.5"/> 147 <line x1="23" y1="66" x2="41" y2="66" stroke="#EF0107" stroke-width="1.5"/> 148 </svg>`,Liverpool:`<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> 149 <path d="M12 10 L88 10 L88 55 Q88 88 50 96 Q12 88 12 55 Z" fill="#C8102E"/> 150 <ellipse cx="50" cy="50" rx="10" ry="14" fill="#FFFFFF"/> 151 <circle cx="50" cy="32" r="6.5" fill="#FFFFFF"/> 152 <polygon points="56,30 64,28 57,36" fill="#F6EB61"/> 153 <path d="M40 46 Q30 44 32 56 Q39 54 42 52 Z" fill="#FFFFFF"/> 154 <path d="M60 46 Q70 44 68 56 Q61 54 58 52 Z" fill="#FFFFFF"/> 155 <path d="M40 70 Q44 62 46 70" stroke="#F6EB61" stroke-width="2.5" fill="none" stroke-linecap="round"/> 156 <path d="M54 70 Q58 62 60 70" stroke="#F6EB61" stroke-width="2.5" fill="none" stroke-linecap="round"/> 157 <path d="M47 74 Q50 66 53 74" stroke="#F6EB61" stroke-width="2.5" fill="none" stroke-linecap="round"/> 158 </svg>`,ManUtd:`<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> 159 <path d="M12 10 L88 10 L88 55 Q88 88 50 96 Q12 88 12 55 Z" fill="#DA291C"/> 160 <circle cx="44" cy="34" r="6" fill="#FFFFFF"/> 161 <polygon points="40,29 38,22 43,27" fill="#FFFFFF"/> 162 <polygon points="48,29 50,22 45,27" fill="#FFFFFF"/> 163 <path d="M37 42 L51 42 L51 66 Q44 70 37 66 Z" fill="#FFFFFF"/> 164 <path d="M51 55 Q58 56 58 66 Q54 70 52 64 Z" fill="#FFFFFF"/> 165 <rect x="63" y="34" width="3" height="36" fill="#FBE122"/> 166 <polygon points="58,34 64.5,24 71,34 68,34 68,40 61,40 61,34" fill="#FBE122"/> 167 </svg>`,Barcelona:`<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> 168 <defs><clipPath id="bcn_clip"><path d="M12 10 L88 10 L88 55 Q88 88 50 96 Q12 88 12 55 Z"/></clipPath></defs> 169 <g clip-path="url(#bcn_clip)"> 170 <rect x="12" y="10" width="15.2" height="90" fill="#A50044"/> 171 <rect x="27.2" y="10" width="15.2" height="90" fill="#004D98"/> 172 <rect x="42.4" y="10" width="15.2" height="90" fill="#A50044"/> 173 <rect x="57.6" y="10" width="15.2" height="90" fill="#004D98"/> 174 <rect x="72.8" y="10" width="15.2" height="90" fill="#A50044"/> 175 </g> 176 <path d="M12 10 L88 10 L88 55 Q88 88 50 96 Q12 88 12 55 Z" fill="none" stroke="#EDBB00" stroke-width="3"/> 177 </svg>`,RealMadrid:`<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> 178 <path d="M12 10 L88 10 L88 55 Q88 88 50 96 Q12 88 12 55 Z" fill="#FFFFFF"/> 179 <rect x="28" y="32" width="44" height="6" fill="#00529F"/> 180 <polygon points="28,32 33,20 38,32" fill="#00529F"/> 181 <polygon points="42,32 50,18 58,32" fill="#00529F"/> 182 <polygon points="62,32 67,20 72,32" fill="#00529F"/> 183 <circle cx="33" cy="22" r="2.4" fill="#FEBE10"/> 184 <circle cx="50" cy="20" r="3" fill="#FEBE10"/> 185 <circle cx="67" cy="22" r="2.4" fill="#FEBE10"/> 186 <text x="50" y="72" text-anchor="middle" font-family="Inter, -apple-system, sans-serif" font-weight="900" font-size="22" fill="#00529F">RM</text> 187 <path d="M12 10 L88 10 L88 55 Q88 88 50 96 Q12 88 12 55 Z" fill="none" stroke="#FEBE10" stroke-width="3"/> 188 </svg>`,ManCity:`<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> 189 <path d="M12 10 L88 10 L88 55 Q88 88 50 96 Q12 88 12 55 Z" fill="#6CABDD"/> 190 <ellipse cx="50" cy="54" rx="7" ry="14" fill="#FFFFFF"/> 191 <circle cx="50" cy="34" r="5.5" fill="#FFFFFF"/> 192 <polygon points="55,33 62,31 55,38" fill="#1C2C5B"/> 193 <path d="M43 44 Q26 42 24 60 Q33 58 43 54 Z" fill="#FFFFFF"/> 194 <path d="M57 44 Q74 42 76 60 Q67 58 57 54 Z" fill="#FFFFFF"/> 195 <path d="M32 48 L40 51 M30 54 L42 54" stroke="#1C2C5B" stroke-width="1"/> 196 <path d="M68 48 L60 51 M70 54 L58 54" stroke="#1C2C5B" stroke-width="1"/> 197 </svg>`,Chelsea:`<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> 198 <path d="M12 10 L88 10 L88 55 Q88 88 50 96 Q12 88 12 55 Z" fill="#034694"/> 199 <path d="M38 34 Q37 26 44 24 Q53 26 51 34 L54 52 L51 68 L47 77 L43 7
1997 L43 60 L38 52 Z" fill="#FFFFFF"/> 200 <circle cx="45" cy="30" r="6" fill="#FFFFFF"/> 201 <rect x="54" y="38" width="12" height="3" rx="1" fill="#FFFFFF" transform="rotate(-20 60 40)"/> 202 <rect x="66" y="18" width="2.5" height="52" fill="#FFFFFF"/> 203 <circle cx="67.3" cy="18" r="3" fill="#FFFFFF"/> 204 <path d="M38 62 Q30 66 32 74 Q34 78 37 74" stroke="#FFFFFF" stroke-width="2.5" fill="none" stroke-linecap="round"/> 205 </svg>`,BayernMunich:`<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> 206 <defs> 207 <pattern id="bayern_diamond" x="0" y="0" width="12" height="12" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"> 208 <rect width="12" height="12" fill="#FFFFFF"/> 209 <rect width="6" height="6" fill="#0066B2"/> 210 <rect x="6" y="6" width="6" height="6" fill="#0066B2"/> 211 </pattern> 212 </defs> 213 <path d="M12 10 L88 10 L88 55 Q88 88 50 96 Q12 88 12 55 Z" fill="#DC052D"/> 214 <circle cx="50" cy="52" r="22" fill="url(#bayern_diamond)" stroke="#FFFFFF" stroke-width="2"/> 215 </svg>`,Juventus:`<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> 216 <defs><clipPath id="juve_clip"><path d="M12 10 L88 10 L88 55 Q88 88 50 96 Q12 88 12 55 Z"/></clipPath></defs> 217 <g clip-path="url(#juve_clip)"> 218 <rect x="12" y="10" width="38" height="90" fill="#000000"/> 219 <rect x="50" y="10" width="38" height="90" fill="#FFFFFF"/> 220 </g> 221 <rect x="28" y="42" width="44" height="7" fill="#FFFFFF" stroke="#000000" stroke-width="1.2"/> 222 <polygon points="28,42 33,28 38,42" fill="#FFFFFF" stroke="#000000" stroke-width="1.2"/> 223 <polygon points="42,42 50,25 58,42" fill="#FFFFFF" stroke="#000000" stroke-width="1.2"/> 224 <polygon points="62,42 67,28 72,42" fill="#FFFFFF" stroke="#000000" stroke-width="1.2"/> 225 <path d="M12 10 L88 10 L88 55 Q88 88 50 96 Q12 88 12 55 Z" fill="none" stroke="#000000" stroke-width="2"/> 226 </svg>`,AcMilan:`<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> 227 <defs><clipPath id="acm_clip"><path d="M12 10 L88 10 L88 55 Q88 88 50 96 Q12 88 12 55 Z"/></clipPath></defs> 228 <g clip-path="url(#acm_clip)"> 229 <rect x="12" y="10" width="15.2" height="90" fill="#FB090B"/> 230 <rect x="27.2" y="10" width="15.2" height="90" fill="#000000"/> 231 <rect x="42.4" y="10" width="15.2" height="90" fill="#FB090B"/> 232 <rect x="57.6" y="10" width="15.2" height="90" fill="#000000"/> 233 <rect x="72.8" y="10" width="15.2" height="90" fill="#FB090B"/> 234 </g> 235 <path d="M12 10 L88 10 L88 55 Q88 88 50 96 Q12 88 12 55 Z" fill="none" stroke="#000000" stroke-width="2"/> 236 </svg>`,Atletico:`<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> 237 <defs><clipPath id="atl_clip"><path d="M12 10 L88 10 L88 55 Q88 88 50 96 Q12 88 12 55 Z"/></clipPath></defs> 238 <g clip-path="url(#atl_clip)"> 239 <rect x="12" y="10" width="15.2" height="90" fill="#FFFFFF"/> 240 <rect x="27.2" y="10" width="15.2" height="90" fill="#CB3524"/> 241 <rect x="42.4" y="10" width="15.2" height="90" fill="#FFFFFF"/> 242 <rect x="57.6" y="10" width="15.2" height="90" fill="#CB3524"/> 243 <rect x="72.8" y="10" width="15.2" height="90" fill="#FFFFFF"/> 244 </g> 245 <ellipse cx="40" cy="65" rx="8" ry="6" fill="#272727"/> 246 <circle cx="34" cy="57" r="5" fill="#272727"/> 247 <rect x="34" y="65" width="2.5" height="8" fill="#272727"/> 248 <rect x="42" y="65" width="2.5" height="8" fill="#272727"/> 249 <rect x="58" y="54" width="2.5" height="20" fill="#272727"/> 250 <ellipse cx="59.3" cy="51" rx="6" ry="8" fill="#272727"/> 251 <path d="M12 10 L88 10 L88 55 Q88 88 50 96 Q12 88 12 55 Z" fill="none" stroke="#272727" stroke-width="2"/> 252 </svg>`,Dortmund:`<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> 253 <path d="M12 10 L88 10 L88 55 Q88 88 50 96 Q12 88 12 55 Z" fill="#FDE100"/> 254 <text x="50" y="60" text-anchor="middle" font-family="Inter, -apple-system, sans-serif" font-weight="900" font-size="28" fill="#000000">BVB</text> 255 <text x="50" y="78" text-anchor="middle" font-family="Inter, -apple-system, sans-serif" font-weight="700" font-size="10" fill="#000000">09</text> 256 <path d="M12 10 L88 10 L88 55 Q88 88 50 96 Q12 88 12 55 Z" fill="none" stroke="#000000" stroke-width="2"/> 257 </svg>`,PSG:`<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> 258 <path d="M12 10 L88 10 L88 55 Q88 88 50 96 Q12 88 12 55 Z" fill="#003170"/> 259 <rect x="12" y="47" width="76" height="7" fill="#DA291C"/> 260 <polygon points="50,18 47,30 53,30" fill="#FFFFFF"/> 261 <polygon points="46,32 54,32 55,44 45,44" fill="#FFFFFF"/> 262 <polygon points="44,45 56,45 58,58 42,58" fill="#FFFFFF"/> 263 <polygon points="42,59 58,59 61,80 39,80" fill="#FFFFFF"/> 264 </svg>`,InterMilan:`<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> 265 <defs><clipPath id="int_clip"><path d="M12 10 L88 10 L88 55 Q88 88 50 96 Q12 88 12 55 Z"/></clipPath></defs> 266 <g clip-path="url(#int_clip)"> 267 <rect x="0" y="0" width="100" height="100" fill="#010E80"/> 268 <g transform="rotate(18 50 50)"> 269 <rect x="-40" y="-20" width="14" height="160" fill="#000000"/> 270 <rect x="-15" y="-20" width="14" height="160" fill="#000000"/> 271 <rect x="10" y="-20" width="14" height="160" fill="#000000"/> 272 <rect x="35" y="-20" width="14" height="160" fill="#000000"/> 273 <rect x="60" y="-20" width="14" height="160" fill="#000000"/> 274 <rect x="85" y="-20" width="14" height="160" fill="#000000"/> 275 </g> 276 </g> 277 <path d="M12 10 L88 10 L88 55 Q88 88 50 96 Q12 88 12 55 Z" fill="none" stroke="#000000" stroke-width="2"/> 278 </svg>`,Ajax:`<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> 279 <path d="M12 10 L88 10 L88 55 Q88 88 50 96 Q12 88 12 55 Z" fill="#FFFFFF"/> 280 <text x="50" y="75" text-anchor="middle" font-family="Inter, -apple-system, sans-serif" font-weight="900" font-size="60" fill="#CC0000">A</text> 281 <rect x="22" y="42" width="56" height="2.5" fill="#CC0000"/> 282 <rect x="22" y="52" width="56" height="2.5" fill="#CC0000"/> 283 <rect x="22" y="62" width="56" height="2.5" fill="#CC0000"/> 284 <path d="M12 10 L88 10 L88 55 Q88 88 50 96 Q12 88 12 55 Z" fill="none" stroke="#CC0000" stroke-width="2"/> 285 </svg>`,Tottenham:`<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> 286 <path d="M12 10 L88 10 L88 55 Q88 88 50 96 Q12 88 12 55 Z" fill="#132257"/> 287 <circle cx="50" cy="66" r="12" fill="#FFFFFF"/> 288 <ellipse cx="50" cy="42" rx="6" ry="9" fill="#FFFFFF"/> 289 <polygon points="55,36 64,34 56,43" fill="#FFFFFF"/> 290 <path d="M45 35 Q41 27 48 31" fill="none" stroke="#FFFFFF" stroke-width="2.5" stroke-linecap="round"/> 291 </svg>`,Newcastle:`<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> 292 <defs><clipPath id="nufc_clip"><path d="M12 10 L88 10 L88 55 Q88 88 50 96 Q12 88 12 55 Z"/></clipPath></defs> 293 <g clip-path="url(#nufc_clip)"> 294 <rect x="0" y="0" width="100" height="100" fill="#FFFFFF"/> 295 <rect x="14" y="0" width="13" height="100" fill="#241F20"/> 296 <rect x="40" y="0" width="13" height="100" fill="#241F20"/> 297 <rect x="66" y="0" width="13" height="100" fill="#241F20"/> 298 </g> 299 <path d="M12 10 L88 10 L88 55 Q88 88 50 96 Q12 88 12 55 Z" fill="none" stroke="#241F20" stroke-width="2"/> 300 </svg>`};me.memo(function({clubKey:a,size:n=48}){const r=cf[a];return r?t.jsx("div",{className:"club-crest","aria-hidden":"true",style:{width:n,height:n,display:"inline-block",flexShrink:0,filter:"drop-shadow(0 1px 2px rgba(0,0,0,0.25))"},dangerouslySetInnerHTML:{__html:r}}
300):t.jsx("div",{style:{width:n,height:n,display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:Math.round(n*.5)},children:"â½"})});let vn=null;function df(){try{if(vn)return vn;const e=typeof window<"u"&&(window.AudioContext||window.webkitAudioContext);return e?(vn=new e,vn):null}catch{return null}}function rt(e){try{let a=!1;try{const c=localStorage.getItem("biq_settings");c&&(a=JSON.parse(c)?.sound===!0)}catch{}if(!a)return;const n=df();if(!n)return;if(n.state==="suspended"&&typeof n.resume=="function")try{n.resume()}catch{}const r=n.currentTime,i=(c,d,o,u=.13,m="sine")=>{const p=n.createOscillator(),g=n.createGain();p.type=m,p.frequency.value=c;const k=r+d,b=k+.02,N=k+o;g.gain.setValueAtTime(1e-4,k),g.gain.exponentialRampToValueAtTime(u,b),g.gain.exponentialRampToValueAtTime(1e-4,N),p.connect(g).connect(n.destination),p.start(k),p.stop(N+.05)};if(e==="correct")i(523.25,0,.28,.15),i(783.99,.22,.38,.15);else if(e==="wrong"){const c=n.createOscillator(),d=n.createGain();c.type="sine",c.frequency.setValueAtTime(300,r),c.frequency.linearRampToValueAtTime(200,r+.4),d.gain.setValueAtTime(1e-4,r),d.gain.exponentialRampToValueAtTime(.09,r+.03),d.gain.exponentialRampToValueAtTime(1e-4,r+.4),c.connect(d).connect(n.destination),c.start(r),c.stop(r+.45)}else e==="streak"?(i(523.25,0,.22,.14),i(659.25,.12,.22,.14),i(783.99,.24,.3,.14)):e==="daily_complete"?(i(523.25,0,.8,.09),i(659.25,0,.8,.09),i(783.99,0,.8,.09)):e==="levelup"?[523.25,659.25,783.99,1046.5].forEach((c,d)=>{i(c,d*.12,.2,.13)}):e==="soft"&&i(700,0,.06,.08,"triangle")}catch{}}const He=typeof Ze<"u"&&Ze.isNativePlatform?.();function pr(e,a){if(Ai())return!1;try{const n=`biq_challenge_${e}_logged`,r=`${a.date}.${a.score}.${a.name||""}`;return localStorage.getItem(n)===r?!1:(localStorage.setItem(n,r),!0)}catch{return!0}}function ji(){try{const e=()=>{try{document.getElementById("preboot-onboard")?.remove()}catch{}};typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>requestAnimationFrame(e)):e(),setTimeout(e,1500)}catch{}}function uf(){try{let e=localStorage.getItem("biq_vid");return e||(e=crypto?.randomUUID?.()||String(Math.random()).slice(2),localStorage.setItem("biq_vid",e)),/^[0-9a-f-]{36}$/i.test(e)?e:null}catch{return null}}function Ai(){try{if(He)return!1;if(typeof navigator<"u"&&navigator.webdriver===!0)return!0;const e=typeof location<"u"?location.hostname:"";return e==="localhost"||e==="127.0.0.1"||e==="[::1]"||e.endsWith(".local")}catch{return!1}}function X(e,a){if(!Ai()){try{!He&&typeof window<"u"&&typeof window.clarity=="function"&&window.clarity("event",e)}catch{}try{const n=He===!0;$.rpc("record_funnel_event",{p_event:e,p_meta:n?{native:!0,anon:!0}:a?{...a,native:!1}:{native:!1},p_visitor:n?null:uf(),p_anon:n}).then(({error:r})=>{r&&ot({category:"funnel",message:`record_funnel_event failed: ${r.message}`,level:"warning"})})}catch{}}}if(He)try{document.documentElement.classList.add("native-app")}catch{}if(He)try{ri()}catch{}const kn=!He&&typeof navigator<"u"&&(/iPad|iPhone|iPod/.test(navigator.userAgent||"")||(navigator.userAgent||"").includes("Mac")&&navigator.maxTouchPoints>1),ff=!He&&typeof navigator<"u"&&/Android/i.test(navigator.userAgent||"")&&!/Windows Phone/i.test(navigator.userAgent||"");function hf({style:e}){return!kn&&!ff?null:t.jsx(Dl,{style:e,caption:"Streaks, daily reminders and every quiz in one app"})}function Ch(){try{return document.documentElement.classList.contains("biq-cb")}catch{return!1}}let As=0;function ve(e){try{if(e==="soft"||e==="select"){const n=Date.now();if(n-As<55)return;As=n}let a=!0;try{const n=localStorage.getItem("biq_settings");n&&(a=JSON.parse(n)?.haptics!==!1)}catch{}if(!a)return;if(He){e==="correct"?Ht.impact({style:ha.Medium}):e==="wrong"?Ht.notification({type:Ua.Error}):e==="soft"||e==="select"?Ht.impact({style:ha.Light}):e==="heavy"?Ht.impact({style:ha.Heavy}):e==="hardCorrect"?Ht.notification({type:Ua.Success}):e==="levelup"&&(Ht.notification({type:Ua.Success}),setTimeout(()=>{try{Ht.impact({style:ha.Heavy})}catch{}},220));return}if(typeof navigator>"u"||!navigator.vibrate)return;e==="correct"?navigator.vibrate(40):e==="wrong"?navigator.vibrate([30,20,30]):e==="soft"||e==="select"?navigator.vibrate(15):e==="heavy"?navigator.vibrate(100):e==="hardCorrect"?navigator.vibrate([30,40,30,40,60]):e==="levelup"&&navigator.vibrate([50,30,50,30,100])}catch{}}function yr(){return{hints:!0,timer:!0,sound:He===!0,haptics:!0,colorBlind:!1}}function mf({questions:e,onComplete:a,onBack:n,onHowToPlay:r,rulesOpen:i}
300){const[c,d]=l.useState(0),[o,u]=l.useState(0),[m,p]=l.useState(60),[g,k]=l.useState(null),[b,N]=l.useState(!1),j=l.useRef(null),_=l.useRef(null),w=e[c%e.length];l.useEffect(()=>()=>clearTimeout(_.current),[]),l.useEffect(()=>{if(!(i||b))return j.current=setInterval(()=>{p(B=>{if(B<=1)return clearInterval(j.current),N(!0),0;if(B===11)try{ve("select")}catch{}if(B===6)try{ve("wrong")}catch{}return B-1})},1e3),()=>clearInterval(j.current)},[i,b]),l.useEffect(()=>{b&&a({score:o,total:c,bestStreak:o})},[b]);const A=l.useCallback(()=>{clearTimeout(_.current),k(null),d(B=>B+1)},[]),q=B=>{if(b||g)return;const T=B===w.a;ve(T?"correct":"wrong"),rt(T?"correct":"wrong"),T&&u(ae=>ae+1),k({choice:B,correct:T});const K=!T&&w.hint?1800:400;_.current=setTimeout(A,K)};l.useEffect(()=>{if(!g||b)return;const B=T=>{T.key!=="Enter"&&T.key!==" "&&T.key!=="Spacebar"||(T.preventDefault(),A())};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[g,b,A]);const Z=B=>{!g||b||B.target.closest&&B.target.closest("button")||A()},W=m/60*100,Q=m>20?"var(--accent)":m>10?"var(--gold)":"var(--red)";return t.jsxs("div",{className:"quiz-wrap",onClick:Z,children:[t.jsx("div",{className:"sr-only",role:"timer","aria-live":"assertive","aria-atomic":"true",children:m===30?"30 seconds left":m===10?"10 seconds left":m===5?"5 seconds left":m===0?"Time's up":""}),t.jsxs("div",{className:"q-top",children:[t.jsx("button",{className:"back-btn",onClick:()=>{clearInterval(j.current),n()},"aria-label":"Go back",children:"â"}),t.jsx("div",{className:"prog-wrap",children:t.jsx("div",{className:"prog-bar",style:{width:`${W}%`,background:Q,transition:"width 1s linear"}})}),t.jsxs("span",{className:"q-ctr",style:{color:m<=10?"var(--red)":"var(--t2)",fontWeight:m<=10?800:500},children:[m,"s"]}),r&&t.jsx("button",{className:"icon-btn",onClick:r,"aria-label":"How to play",title:"How to play",children:"?"})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:12},children:[t.jsx("div",{style:{fontSize:12,color:"var(--t2)",fontFamily:"'Inter',sans-serif",letterSpacing:1},children:"â¡ð¥ Hot Streak"}),t.jsxs("div",{style:{fontFamily:"'JetBrains Mono','SF Mono',ui-monospace,monospace",fontVariantNumeric:"tabular-nums",fontSize:22,fontWeight:700,color:"var(--accent)"},children:[o," ",t.jsx("span",{style:{fontFamily:"'Inter',sans-serif",fontSize:13,color:"var(--t3)",fontWeight:500},children:"pts"})]})]}),t.jsxs("div",{className:"q-card",children:[t.jsx("div",{className:"q-tag",children:Rr[w.cat]||w.cat}),t.jsx("div",{className:"q-text",children:w.q})]}),t.jsx("div",{className:"opts",children:w.o.map((B,T)=>{let K="opt";g&&(T===g.choice?K+=g.correct?" correct":" wrong":!g.correct&&T===w.a&&(K+=" correct"));const ae=g?T===w.a?"â":T===g.choice?"â":["A","B","C","D"][T]:["A","B","C","D"][T];return t.jsxs("button",{className:K,onClick:()=>q(T),disabled:!!g,children:[t.jsx("span",{className:"opt-l",children:ae}),B]},T)})}),g&&!g.correct&&w.hint&&t.jsxs("div",{style:{marginTop:10,padding:"10px 14px",background:"var(--s1)",border:"1px solid var(--border)",borderRadius:10,fontSize:13,lineHeight:1.5,color:"var(--t2)",animation:"fadeIn 0.3s ease-out"},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:10,marginBottom:4},children:[t.jsxs("div",{style:{fontSize:10,fontWeight:700,color:"var(--t3)",letterSpacing:.2,fontFamily:"'Inter',sans-serif",display:"flex",alignItems:"center",gap:4},children:[t.jsx(qn,{size:11,strokeWidth:2.5,"aria-hidden":"true"})," Why?"]}),t.jsx("div",{style:{fontSize:10,fontWeight:600,color:"var(--t3)",fontFamily:"'Inter',sans-serif",whiteSpace:"nowrap",opacity:.75},children:"tap to skip â"})]}),t.jsx("div",{children:w.hint})]})]})}function gf({questions:e,onComplete:a,onBack:n,onHowToPlay:r}){const[i,c]=l.useState(0),[d,o]=l.useState(0),[u,m]=l.useState(null),[p,g]=l.useState(!1),k=e?.length||0,b=l.useRef(null),N=l.useRef(a);l.useEffect(()=>{N.current=a},[a]),l.useEffect(()=>()=>{b.current&&clearTimeout(b.current)},[]),l.useEffect(()=>{p&&N.current({score:d,total:k,bestStreak:d})},[p,d,k]);const j=l.useCallback(()=>{clearTimeout(b.current),m(null),i+1>=k?g(!0):c(W=>W+1)},[i,k]);l.useEffect(()=>{if(!u||p)return;const W=Q=>{Q.key!=="Enter"&&Q.key!==" "&&Q.key!=="Spacebar"||(Q.preventDefault(),j())};return window.addEventListener("keydown",W),()=>window.removeEventListener("keydown",W)},[u,p,j]);const _=W=>{!u||p||W.target.closest&&W.target.closest("button")||j()},w=W=>{if(u||!e||!e[i])return;const Q=e[i],B=Q?.a,K=W===(B===!0||B===1);ve(K?"correct":"wrong"),rt(K?"correct":"wrong"),K&&o(ue=>ue+1),m({val:W,correct:K}),b.current&&clearTimeout(b.current);const ae=!K&&Q?.hint?2400:900;b.current=setTimeout(j,ae)};if(p||!e||e.length===0)return null;const A=e[i];if(!A)return null;const q=A.a===!0||A.a===1,Z=W=>{const Q={padding:"22px",fontSize:18,fontWeight:800,borderRadius:16,fontFamily:"inherit",curs
300or:u?"default":"pointer",transition:"background 0.2s, color 0.2s, border-color 0.2s"};if(!u)return{...Q,background:"var(--s1)",border:"2px solid var(--border)",color:"var(--t1)"};const B=W===q,T=u.val===W;return B?{...Q,background:"var(--green)",border:"2px solid var(--green)",color:"#fff"}:T?{...Q,background:"var(--red)",border:"2px solid var(--red)",color:"#fff"}:{...Q,background:"var(--s2)",border:"2px solid var(--border)",color:"var(--t3)",opacity:.55}};return t.jsxs("div",{className:"quiz-wrap",onClick:_,children:[t.jsxs("div",{className:"q-top",children:[t.jsx("button",{className:"back-btn",onClick:n,"aria-label":"Go back",children:"â"}),t.jsx("div",{className:"prog-wrap",children:t.jsx("div",{className:"prog-bar",style:{width:`${(i+(u?1:0))/k*100}%`}})}),t.jsxs("span",{className:"q-ctr",children:[i+1,"/",k]}),r&&t.jsx("button",{className:"icon-btn",onClick:r,"aria-label":"How to play",title:"How to play",children:"?"})]}),t.jsx("div",{style:{textAlign:"center",padding:"8px 0 4px"},children:t.jsx("span",{style:{fontSize:10,fontFamily:"'Inter',sans-serif",color:"var(--accent)",letterSpacing:2},children:"â
True or False"})}),t.jsx("div",{className:"q-card",style:{minHeight:140,display:"flex",alignItems:"center",justifyContent:"center",textAlign:"center"},children:t.jsx("div",{className:"q-text",style:{fontSize:18,lineHeight:1.5},children:A?.s||A?.q})}),t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12,marginTop:16},children:[t.jsx("button",{onClick:()=>w(!0),disabled:!!u,style:Z(!0),children:"â TRUE"}),t.jsx("button",{onClick:()=>w(!1),disabled:!!u,style:Z(!1),children:"â FALSE"})]}),u&&t.jsx("div",{style:{textAlign:"center",marginTop:14,fontSize:16,fontWeight:700,color:u.correct?"var(--green)":"var(--red)"},children:u.correct?"â Correct!":"â Incorrect"}),u&&A.hint&&t.jsxs("div",{style:{marginTop:10,padding:"10px 14px",background:"var(--s1)",border:"1px solid var(--border)",borderRadius:10,fontSize:13,lineHeight:1.5,color:"var(--t2)",animation:"fadeIn 0.3s ease-out"},children:[t.jsxs("div",{style:{fontSize:10,fontWeight:700,color:"var(--t3)",letterSpacing:.2,fontFamily:"'Inter',sans-serif",marginBottom:4,display:"flex",alignItems:"center",gap:4},children:[t.jsx(qn,{size:11,strokeWidth:2.5,"aria-hidden":"true"})," Why?"]}),t.jsx("div",{children:A.hint})]})]})}const Pr="https://balliq.app",jh=(e,a)=>{const n=`${Pr}/join/${encodeURIComponent(e)}`,r=String(a||"").trim().slice(0,22);return r?`${n}?n=${encodeURIComponent(r)}`:n},Dr="biq_guest_name",Fs=["Turbo","Golden","Flying","Iron","Rapid","Mega","Prime","Epic","Wonder","Rocket"],Ns=["Striker","Keeper","Winger","Maestro","Poacher","Baller","Gaffer","Dribbler","Sweeper","Target"];function Ls(){try{const a=localStorage.getItem(Dr);if(a)return a}catch{}const e=`${Fs[Math.floor(Math.random()*Fs.length)]} ${Ns[Math.floor(Math.random()*Ns.length)]} ${Math.floor(Math.random()*90)+10}`;try{localStorage.setItem(Dr,e)}catch{}return e}function Ah(e){const a=String(e||"").trim().slice(0,20);if(a)try{localStorage.setItem(Dr,a)}catch{}}async function Fh(e=10,a="mixed",{escalate:n=!1}={}){const{QB:r}=await Ct();let i=r.filter(u=>u.type==="mcq"&&Array.isArray(u.o)&&u.o.length===4&&typeof u.a=="number"&&(!u.tag||!Cn.has(u.tag))),c="mixed";if(a&&a!=="mixed"){const u=String(a).indexOf(":"),m=String(a).slice(0,u),p=String(a).slice(u+1);let g=m==="cat"?i.filter(k=>k.cat===p):m==="club"?i.filter(k=>k.club===Tn[p]):i;if(m==="cat"||m==="club"){const k=g.filter(b=>b.diff!=="easy");k.length>=10&&(g=k)}g.length>=e?(i=g,c=a):g.length>=10&&(i=g,e=g.length,c=a)}else(!a||a==="mixed")&&(c="mixed");i=ba(i,e,ht);const o=i.slice().sort(()=>Math.random()-.5).slice(0,e);if(n){const u={easy:0,medium:1,hard:2};o.sort((m,p)=>(u[m.diff]??1)-(u[p.diff]??1))}return{effectivePack:c,questions:o.map(u=>{const m=[0,1,2,3].sort(()=>Math.random()-.5);return{id:u.id,prompt:u.q,options:m.map(p=>u.o[p]),correct:m.indexOf(u.a)}})}}const Nh=2e4;function pf(e,a){return Math.max(15,Math.round((a||0)/40)+(e?50:0))}const yf=390,bf=600;function Pa(e,a,n,r,i,c){const d=Math.min(c,r/2,i/2);e.beginPath(),e.moveTo(a+d,n),e.lineTo(a+r-d,n),e.quadraticCurveTo(a+r,n,a+r,n+d),e.lineTo(a+r,n+i-d),e.quadraticCurveTo(a+r,n+i,a+r-d,n+i),e.lineTo(a+d,n+i),e.quadraticCurveTo(a,n+i,a,n+i-d),e.lineTo(a,n+d),e.quadraticCurveTo(a,n,a+d,n),e.closePath()}function vf(e,a,n,r,i,c){const d=String(a).split(/\s+/);let o="",u=r;for(const m of d){const p=o?o+" "+m:m;e.measureText(p).width>i&&o?(e.fillText(o,n,u),o=m,u+=c):o=p}return o&&e.fillText(o,n,u),u}function wf(e,a,n,r,i){let c=n;for(const d of String(a))e.fillText(d,c,r),c+=e.measureText(d).width+i;return c-i-n}async function xf(e,a){const n=e==="iq",r=n?1080:yf,i=n?1440:bf,c=n?1:2,d=document.createElement("canvas");d.width=r*c,d.height=i*c;const o=d.getContext("2d");c!==1&&o.scale(c,c);try{document.fonts&&document.fonts.ready&&await Promise.race([document.fonts.ready,new Promise(g=>setTimeout(g,1e3))])}catch{}o.save(),Pa(o,0,0,r,i,n?0:20),o.clip(),o.fillStyle="#0B0C10",o.fillRect(0,0,r,i);const u=24,m=38;o.textBaseline="alphabetic",n||(o.fillStyle="#58CC02",o.fillRect(0,0,r,6),o.font='800 22px Inter, "Helvetica Neue", Arial, sans-serif',o.fillStyle="#FFFFFF",o.textAlign="left",o.fillText(`â½ ${Ce}`,u,m),o.font='500 12px Inter, "Helvetica Neue", Arial, sans-serif',o.fillStyle="#9BA0B8",o.textAlign="right",o.fillText("balliq.app",r-u,m),o.fillStyle="#2F3240",o.fillRect(u,56,r-u*2,1),o.font='500 13px Inter, "Helvetica Neue", Arial, sans-serif',o.fillStyle="#9BA0B8",o.textAlign="center",o.fillText("balliq.app",r/2,i-24)),o.textAlign="center";const p=r/2;if(e==="wordle"){const g=Array.isArray(a?.grades)?a.grades:[],k=a?.score??0;a?.total;const b=a?.dateLabel||"",N=a?.failed?"Didn't solve today":`Solved in ${k} ${k===1?"guess":"guesses"}`,j={green:"#58CC02",yellow:"#FFC107",grey:"#3A3F55"};o.font='700 13px Inter, "Helvetica Neue", Arial, sans-serif',o.fillStyle="#9BA0B8",o.fillText("TODAY'S PUZZLE",p,110),o.font='500 12px Inter, "Helvetica Neue", Arial, sans-serif',o.fillStyle="#9BA0B8",o.fillText(b,p,130),o.font='800 34px Inter, "Helvetica Neue", Arial, sans-serif',o.fillStyle="#58CC02",o.fillText(N,p,212);const _=36,w=4,A=4,q=g[0]?.length||5,Z=q*_+(q-1)*w,W=p-Z/2;let Q=250;for(const B of g){for(let T=0;T<B.length;
300T++){const K=j[B[T]]||"#3A3F55",ae=W+T*(_+w);o.fillStyle=K,Pa(o,ae,Q,_,_,4),o.fill()}Q+=_+A}o.font='700 15px Inter, "Helvetica Neue", Arial, sans-serif',o.fillStyle="#FFFFFF",o.fillText("Can you beat me? â½",p,Math.min(Q+28,i-60))}else if(e==="hotstreak"){const g=a?.score??0;o.font='700 13px Inter, "Helvetica Neue", Arial, sans-serif',o.fillStyle="#9BA0B8",o.fillText("HOT STREAK",p,130),o.font='900 88px "JetBrains Mono", "Courier New", monospace',o.fillStyle="#FF6A00",o.fillText(String(g),p,260),o.font='600 15px Inter, "Helvetica Neue", Arial, sans-serif',o.fillStyle="#FFFFFF",vf(o,"questions answered correctly in a row",p,308,280,22),o.font='700 15px Inter, "Helvetica Neue", Arial, sans-serif',o.fillStyle="#FFFFFF",o.fillText("Can you beat me? â½",p,520)}else if(e==="iq"){const g=a?.card,k=Zs(g?.tier),b=(a?.name||`${Ce} Player`).slice(0,14),N=String(k.bg).match(/#[0-9a-f]{6}/gi)||["#1B1E27","#080a0f"],j=2,_=se=>se*j,w=o.createLinearGradient(0,0,r*.42,i);w.addColorStop(0,N[0]),w.addColorStop(.58,N[1]||N[0]),w.addColorStop(1,"#090807"),o.fillStyle=w,o.fillRect(0,0,r,i);const A=o.createRadialGradient(r*.16,i*.06,0,r*.16,i*.06,r*.72);A.addColorStop(0,et(k.accent,.19)),A.addColorStop(1,et(k.accent,0)),o.fillStyle=A,o.fillRect(0,0,r,i);const q=o.createLinearGradient(r*.9,0,r*.1,i);q.addColorStop(.3,et(k.accent,0)),q.addColorStop(.47,et(k.accent,.12)),q.addColorStop(.62,et(k.accent,0)),o.fillStyle=q,o.fillRect(0,0,r,i),o.textAlign="left",o.textBaseline="alphabetic",o.font=`900 ${_(13)}px Inter, "Helvetica Neue", Arial, sans-serif`,o.fillStyle=et(k.text,.5),o.fillText("B A L L I Q",_(40),_(52)),o.font=`800 ${_(150)}px "JetBrains Mono", "Courier New", monospace`,o.fillStyle=k.accent;const Z=g?.rated!==!1;wf(o,Z?String(g?.overall??"â"):"â",_(30),_(205),_(-5)),o.font=`900 ${_(11)}px Inter, "Helvetica Neue", Arial, sans-serif`,o.fillStyle=et(k.text,.5),o.fillText("O V E R A L L",_(40),_(231)),o.font=`900 ${_(14)}px Inter, "Helvetica Neue", Arial, sans-serif`,o.fillStyle=et(k.accent,.92),o.fillText(Z?(k.label||"").split("").join(" "):`A N S W E R ${jt} T O G E T R A T E D`,_(40),_(261));const W=_(75),Q=r-_(38)-W,B=_(76)+W;o.save(),o.beginPath(),o.arc(Q,B,W,0,Math.PI*2),o.closePath(),o.clip(),a?.avatarImg?o.drawImage(a.avatarImg,Q-W,B-W,W*2,W*2):(o.fillStyle=a?.avatarBg||"#1F2430",o.fillRect(Q-W,B-W,W*2,W*2),o.textAlign="center",o.font=`900 ${_(68)}px Inter, "Helvetica Neue", Arial, sans-serif`,o.fillStyle="#FFFFFF",o.textBaseline="middle",o.fillText(a?.initial||"?",Q,B+_(3)),o.textBaseline="alphabetic",o.textAlign="left"),o.restore(),o.beginPath(),o.arc(Q,B,W,0,Math.PI*2),o.strokeStyle=et(k.accent,.85),o.lineWidth=_(4),o.stroke(),o.font=`900 ${_(42)}px Inter, "Helvetica Neue", Arial, sans-serif`,o.fillStyle="#FFFFFF",o.fillText(b,_(38),_(330)),a?.levelName&&(o.font=`700 ${_(13.5)}px Inter, "Helvetica Neue", Arial, sans-serif`,o.fillStyle=et(k.text,.5),o.fillText(`${a.levelName} · ${Number(a.xp||0).toLocaleString()} XP`,_(39),_(364)));const T=Array.isArray(g?.ratings)?g.ratings:[],K=T.filter(se=>se.answered>=jt),ae=K.length?K.reduce((se,M)=>M.rating>se.rating?M:se).abbr:null,ue=(r-_(76)-_(36))/2,ie=_(404),xe=_(64);T.forEach((se,M)=>{const Se=M%2,ge=Math.floor(M/2),ce=_(38)+Se*(ue+_(36)),je=ie+ge*xe;o.fillStyle="rgba(255,255,255,0.10)",o.fillRect(ce,je,ue,2),o.beginPath(),o.arc(ce+_(4.5),je+_(27),_(4.5),0,Math.PI*2),o.fillStyle=se.color||"#8A8A8A",o.fill(),o.font=`800 ${_(Sc(se.abbr,16).size)}px Inter, "Helvetica Neue", Arial, sans-serif`,o.fillStyle=et(k.text,.72),o.fillText(se.abbr,ce+_(22),je+_(34)),o.textAlign="right",o.font=`800 ${_(27)}px "JetBrains Mono", "Courier New", monospace`,o.fillStyle=se.abbr===ae?k.accent:et(k.text,.92),o.fillText(se.answered>=jt?String(se.rating):"â",ce+ue,je+_(36)),o.textAlign="left"}),o.fillStyle=et(k.accent,.2),o.fillRect(_(38),i-_(100),r-_(76),2),o.textAlign="center",o.font=`900 ${_(20)}px Inter, "Helvetica Neue", Arial, sans-serif`,o.fillStyle="#FFFFFF",o.fillText("Can you beat me?",r/2,i-_(58)),o.font=`700 ${_(13)}px Inter, "Helvetica Neue", Arial, sans-serif`,o.fillStyle=et(k.text,.45),o.fillText("balliq.app",r/2,i-_(30))}else{const g=(a?.modeLabel||"Quiz").toUpperCase(),k=a?.score??0,b=a?.total??0,N=b>0?Math.round(k/b*100):0,j=a?.streak;o.font='700 13px Inter, "Helvetica Neue", Arial, sans-serif',o.fillStyle="#9BA0B8",o.fillText(g,p,130),o.font='900 80px "JetBrains Mono", "Courier New", monospace',o.fillStyle="#58CC02",o.fillText(`${k}/${b}`,p,250),o.font='700 18px Inter, "Helvetica Neue", Arial, sans-serif',o.fillStyle="#FFFFFF",o.fillText(`${N}% accuracy`,p,292);const _=r-u*2-40,w=p-_/2,A=318,q=14;Pa(o,w,A,_,q,7),o.fillStyle="rgba(255,255,255,0.08)",o.fill();const Z=Math.max(q,Math.round(_*Math.min(100,Math.max(0,N))/100));Pa(o,w,A,Z,q,7),o.fillStyle="#58CC02",o.fill();const W=pi(N);o.font='800 24px Inter, "Helvetica Neue", Arial, sans-serif',o.fillStyle="#FFFFFF",o.fillText(W,p,382),j&&j>=3&&(o.font='700 15px Inter, "Helvetica Neue", Arial, sans-serif',o.fillStyle="#FF6A00",o.fillText(`ð¥ ${j} in a row`,p,416));const Q="Can you beat me? â½";o.font='800 16px Inter, "Helvetica Neue", Arial, sans-serif';const B=o.measureText(Q).width+46,T=42,K=470;o.fillStyle="#58CC02",Pa(o,p-B/2,K,B,T,21),o.fill(),o.textBaseline="middle",o.fillStyle="#06250F",o.fillText(Q,p,K+T/2+1),o.textBaseline="alphabetic"}
300return o.restore(),new Promise((g,k)=>{d.toBlob(b=>{b?g(b):k(new Error("toBlob returned null"))},"image/png")})}async function En(e,a,n={}){X("share-card-"+e);const{onToast:r=()=>{},textFallback:i=""}=n;let c;try{c=await xf(e,a)}catch{if(i)try{navigator.share?await navigator.share({text:i,url:"https://balliq.app"}):navigator.clipboard&&(await navigator.clipboard.writeText(i),r("Copied to clipboard ð"))}catch{}return}const d=(()=>{const m=`â½ https://balliq.app${a&&typeof a.deepLink=="string"&&a.deepLink.startsWith("/")?a.deepLink:"/play"}`;try{if(e==="wordle"){const p="â½ https://balliq.app/footle",g=a.num>0?` #${a.num}`:"";return a.failed?`Footle${g} got me â can you do better? ${p}`:a.score===1?`Got Footle${g} on my FIRST guess ð¯ ${p}`:`Got Footle${g} in ${a.score} guesses â can you beat me? ${p}`}if(e==="hotstreak")return`I hit a ${a.score}-streak in Hot Streak â beat that ${m}`;if(a?.modeLabel&&a?.score!=null&&a?.total!=null)return`I scored ${a.score}/${a.total} on ${a.modeLabel} â can you beat me? ${m}`}catch{}return`Can you beat it? ${m}`})();if(He){const u=`balliq-share-${Date.now()}.png`;let m=null;try{const p=await new Promise((g,k)=>{const b=new FileReader;b.onload=()=>g(String(b.result).split(",")[1]),b.onerror=()=>k(new Error("FileReader failed")),b.readAsDataURL(c)});await Ba.writeFile({path:u,data:p,directory:Gt.Cache}),m=(await Ba.getUri({path:u,directory:Gt.Cache})).uri}catch{m=null}if(m)try{await Uu.share({fileUrl:m,text:d}),Ba.deleteFile({path:u,directory:Gt.Cache}).catch(()=>{});return}catch{try{await Ir.share({files:[m]}),Ba.deleteFile({path:u,directory:Gt.Cache}).catch(()=>{});return}catch(g){if(Ba.deleteFile({path:u,directory:Gt.Cache}).catch(()=>{}),/cancel/i.test(g?.message||""))return}}}const o=new File([c],"balliq-result.png",{type:"image/png"});try{if(navigator.canShare&&navigator.canShare({files:[o]})&&navigator.share){await navigator.share({files:[o],text:d});return}}catch(u){if(u&&u.name==="AbortError")return}try{const u=URL.createObjectURL(c),m=document.createElement("a");m.href=u,m.download="balliq-result.png",document.body.appendChild(m),m.click(),document.body.removeChild(m),setTimeout(()=>URL.revokeObjectURL(u),1e3),r("Saved! Share from your photos ð¸");return}catch{}if(i)try{navigator.share?await navigator.share({text:i,url:"https://balliq.app"}):navigator.clipboard&&(await navigator.clipboard.writeText(i),r("Copied to clipboard ð"))}catch{}}function In(){const e=l.useRef(null);return l.useEffect(()=>{if(window.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return;const a=e.current;if(!a)return;const n=a.getContext("2d");a.width=window.visualViewport?.width??window.innerWidth,a.height=window.visualViewport?.height??window.innerHeight;const r=Array.from({length:80},()=>({x:Math.random()*a.width,y:Math.random()*a.height-a.height,w:Math.random()*10+5,h:Math.random()*6+3,r:Math.random()*Math.PI*2,dr:(Math.random()-.5)*.2,vy:Math.random()*3+2,vx:(Math.random()-.5)*2,color:["#58CC02","#FFC800","#FF4B4B","#1CB0F6","#CE82FF","#FF9600"][Math.floor(Math.random()*6)]}));let i=!0;const c=()=>{i&&(n.clearRect(0,0,a.width,a.height),r.forEach(d=>{d.y+=d.vy,d.x+=d.vx,d.r+=d.dr,n.save(),n.translate(d.x,d.y),n.rotate(d.r),n.fillStyle=d.color,n.globalAlpha=Math.max(0,1-d.y/a.height),n.fillRect(-d.w/2,-d.h/2,d.w,d.h),n.restore()}),r.some(d=>d.y<a.height)&&requestAnimationFrame(c))};return requestAnimationFrame(c),()=>{i=!1}},[]),t.jsx("canvas",{ref:e,"aria-hidden":"true",style:{position:"fixed",top:0,left:0,pointerEvents:"none",zIndex:500,width:"100%",height:"100%"}})}function Lh({a:e,index:a}){const{q:n,type:r,cat:i,options:c,userIdx:d,correctIdx:o,userText:u,correctText:m,isCorrect:p,timedOut:g}=e;return t.jsxs("div",{className:`dr-q ${p?"dr-q-right":"dr-q-wrong"}`,children:[t.jsxs("div",{className:"dr-q-head",children:[t.jsx("span",{className:"dr-q-mark",children:p?"â":"â"}),t.jsxs("span",{className:"dr-q-num",children:["Q",a+1]}),i&&t.jsx("span",{className:"dr-q-cat",children:i}),g&&t.jsx("span",{className:"dr-q-timeout",children:"timed out"})]}),t.jsx("div",{className:"dr-q-text",children:n}),(r==="mcq"||r==="tf")&&Array.isArray(c)?t.jsx("div",{className:"dr-opts",children:c.map((k,b)=>{let N="dr-opt";return b===o&&(N+=" dr-opt-correct"),b===d&&!p&&(N+=" dr-opt-user-wrong"),t.jsxs("div",{className:N,children:[t.jsx("span",{className:"dr-opt-text",children:k}),b===o&&t.jsx("span",{className:"dr-opt-tag",children:"correct"}),b===d&&!p&&t.jsx("span",{className:"dr-opt-tag dr-opt-tag-user",children:"your pick"})]},b)})}):r==="typed"?t.jsxs("div",{className:"dr-typed",children:[u&&t.jsxs("div",{className:p?"dr-typed-row dr-typed-correct":"dr-typed-row dr-typed-user-wrong",children:[t.jsx("span",{className:"dr-typed-mark",children:p?"â":"â"}),t.jsxs("span",{children:["You typed: ",t.jsx("strong",{children:u})]})]}),!p&&m&&t.jsxs("div",{className:"dr-typed-row dr-typed-correct",children:[t.jsx("span",{className:"dr-typed-mark",children:"â"}),t.jsxs("span",{children:["Correct: ",t.jsx("strong",{children:m})]})]})]}):null]})}const Eh={gunners:"Arsenal",reds:"Liverpool",toffees:"Everton",citizens:"Man City","red devils":"Man United",devils:"Man United",blues:"Chelsea",barca:"Barcelona",barça:"Barcelona",madrid:"Real Madrid",juve:"Juventus",nerazzurri:"Inter",rossoneri:"AC Milan",gers:"Rangers",hoops:"Celtic",magpies:"Newcastle",hammers:"West Ham",villans:"Aston Villa",bianconeri:"Juventus",merengues:"Real Madrid",cityzens:"Man City",lilywhites:"Tottenham",potters:"Stoke City",baggies:"West Brom"};function Sf({onStart:e,onBack:a,catStats:n,cardLeague:r}){return me.useEffect(()=>{ii()},[]),t.jsxs("div",{className:"screen",children:[t.jsxs("div",{className:"page-hdr",children:[t.jsx("button",{className:"back-btn",onClick:a,"aria-label":"Go back",children:"â"}),t.jsx("div",{className:"page-title",children:"League Quizzes"})]}),t.jsx("p",{style:{fontSize:13,color:"var(--t2)",lineHeight:1.7,marginBottom:20},children:"Pick a competition â every answer builds your Ball I
300Q card."}),Ci.map(i=>t.jsxs("div",{style:{marginBottom:16},children:[t.jsx("div",{style:{fontSize:12,fontWeight:800,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--t2)",margin:"0 0 8px 2px"},children:i.label}),t.jsx("div",{className:"mode-list",children:i.items.map(c=>{const d=Ka(c.color)==="#0B0C10",o=d?.2:.32,u=d?.05:.06;return t.jsxs("button",{type:"button",className:"mode-item",onClick:()=>{ve("select"),e(c.cat)},style:{background:`linear-gradient(90deg, ${_t(c.color,o)} 0%, ${_t(c.color,u)} 100%)`,borderColor:_t(c.color,d?.5:.4)},children:[t.jsx("div",{className:"mi-icon",style:{background:c.color,borderRadius:11,width:44,height:44,display:"flex",alignItems:"center",justifyContent:"center",padding:0,flexShrink:0,boxShadow:`0 2px 8px ${_t(c.color,.45)}`},children:t.jsx("span",{style:{fontWeight:900,fontSize:13,letterSpacing:.3,color:Ka(c.color)},children:c.abbr})}),t.jsxs("div",{className:"mi-body",children:[t.jsx("div",{className:"mi-name",children:c.name}),t.jsx("div",{className:"mi-desc",children:(()=>{const m=Ac(c.cat,n,r);return m?`Builds your ${m} rating`:"Counts toward your overall Ball IQ"})()})]}),t.jsx("div",{className:"mi-arrow",children:"â"})]},c.cat)})})]},i.label))]})}const Fi="biq_mp_history";function kf(){try{const e=JSON.parse(localStorage.getItem(Fi)||"[]");return Array.isArray(e)?e:[]}catch{return[]}}function Ih(e){try{if(!e||!e.roomId)return;const a=kf();if(a.some(n=>n.roomId===e.roomId))return;a.unshift(e),localStorage.setItem(Fi,JSON.stringify(a.slice(0,50)))}catch{}}function _f(){const{passwordRecovery:e,clearPasswordRecovery:a,updatePassword:n}=Rn(),[r,i]=l.useState(""),[c,d]=l.useState(""),[o,u]=l.useState(""),[m,p]=l.useState(!1),[g,k]=l.useState(!1);if(!e)return null;const b=async()=>{if(m)return;if(r.length<6){u("Password must be at least 6 characters");return}if(r!==c){u("Passwords don't match");return}p(!0),u("");const{error:N}=await n(r);if(p(!1),N){u(N.message||"Couldn't update the password â try again");return}k(!0),setTimeout(()=>a(),1800)};return t.jsx("div",{style:{position:"fixed",inset:0,zIndex:1200,background:"var(--bg)",display:"flex",alignItems:"center",justifyContent:"center",padding:20},children:t.jsxs("div",{style:{width:"100%",maxWidth:360,textAlign:"center"},children:[t.jsx("div",{style:{fontSize:40,marginBottom:10},children:g?"â
":"ð"}),t.jsx("div",{style:{fontSize:20,fontWeight:900,color:"var(--t1)",marginBottom:6},children:g?"Password updated":"Set a new password"}),g?t.jsx("div",{style:{fontSize:14,color:"var(--t2)"},children:"You're signed in â welcome back!"}):t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{fontSize:13,color:"var(--t2)",lineHeight:1.6,marginBottom:18},children:"You're signed in via the reset link â choose a new password to finish."}),t.jsx("input",{type:"password",value:r,onChange:N=>i(N.target.value),placeholder:"New password",autoComplete:"new-password",style:{width:"100%",padding:"14px 16px",marginBottom:10,borderRadius:12,border:"1px solid var(--border)",background:"var(--s1)",color:"var(--text)",fontSize:16,fontFamily:"inherit",outline:"none"}}),t.jsx("input",{type:"password",value:c,onChange:N=>d(N.target.value),placeholder:"Repeat new password",autoComplete:"new-password",onKeyDown:N=>{N.key==="Enter"&&b()},style:{width:"100%",padding:"14px 16px",marginBottom:14,borderRadius:12,border:"1px solid var(--border)",background:"var(--s1)",color:"var(--text)",fontSize:16,fontFamily:"inherit",outline:"none"}}),o&&t.jsx("div",{style:{color:"#FF6B6B",fontSize:13,marginBottom:12},children:o}),t.jsx("button",{onClick:b,disabled:m||!r||!c,style:{width:"100%",border:"none",borderRadius:999,background:"var(--accent)",boxShadow:"0 8px 22px -8px rgba(88,204,2,0.55)",padding:15,fontSize:15,fontWeight:800,color:"var(--grn-ink)",cursor:"pointer",fontFamily:"inherit",opacity:m||!r||!c?.6:1},children:m?"Savingâ¦":"Save new password"}),t.jsx("button",{onClick:a,style:{marginTop:10,background:"transparent",border:"none",color:"var(--t3)",fontSize:13,fontWeight:600,cursor:"pointer",fontFamily:"inherit"},children:"Cancel"})]})]})})}function Cf(){const{canPromptNative:e,platform:a,showBanner:n,promptInstall:r,dismiss:i}=Ml();return n?t.jsxs("div",{className:"install-banner",role:"region","aria-label":"Install Ball IQ",children:[t.jsx("span",{className:"install-banner-icon","aria-hidden":"true",children:"â½"}),t.jsxs("div",{className:"install-banner-body",children:[t.jsx("div",{className:"install-banner-title",children:"Never miss a day"}),t.jsx("div",{className:"install-banner-desc",children:e?"Install for a daily reminder when new puzzles drop.":a.isIOSSafari?"Tap Share â Add to Home Screen for daily reminders.":"Add to your home screen for daily reminders."})]}),t.jsxs("div",{className:"install-banner-actions",children:[e?t.jsx("button",{type:"button",className:"install-banner-btn",onClick:r,children:"Install"}):a.isIOSSafari?t.jsxs("span",{className:"install-banner-ios","aria-label":"iOS install steps",children:[t.jsx("span",{className:"install-banner-ios-step",children:"⤴ Share"}),t.jsx("span",{className:"install-banner-ios-step",children:"Add"})]}):null,t.jsx("button",{type:"button",className:"install-banner-dismiss",onClick:i,"aria-label":"Dismiss install prompt",children:"Ã"})]})]}):null}function jf({count:e,onClick:a,className:n,style:r}){return t.jsxs("button",{className:n||"icon-btn",onClick:a,"aria-label":e>0?`Notifications, ${e} new`:"Notifications",style:{position:"relative",...r},children:[t.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[t.jsx("path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"}),t.jsx("path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0"})]}),e>0&&t.jsx("span",{className:"notif-dot","aria-hidden":"true"})]})}function Af({open:e,requests:a,invites:n=[],onClose:r,onRespond:i,onJoinInvite:c,onDismissInvite:d,onOpenFriend:o}){const u=l.useRef(null);if(ft({isOpen:e,onClose:r,ref:u}),!e)return null;const m=a.length===0&&n.length===0;return t.jsx("div",{className:"notif-overlay",onClick:r,children:t.jsxs("div",{ref:u,tabIndex:-1,
300className:"notif-panel",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Notifications",children:[t.jsxs("div",{className:"notif-hdr",children:[t.jsx("span",{className:"notif-title",children:"Notifications"}),t.jsx("button",{className:"notif-close",onClick:r,"aria-label":"Close notifications",children:"â"})]}),m?t.jsxs("div",{className:"notif-empty",children:[t.jsx("div",{className:"notif-empty-ic","aria-hidden":"true",children:"ð"}),t.jsx("div",{className:"notif-empty-t",children:"You're all caught up"}),t.jsx("div",{className:"notif-empty-s",children:"Friend requests and invites show up here."})]}):t.jsxs("div",{className:"notif-list",children:[n.map(p=>t.jsxs("div",{className:"notif-item",children:[t.jsx("span",{className:"notif-ava",children:t.jsx(Fn,{value:p.actor_avatar,name:p.actor_name})}),t.jsxs("div",{className:"notif-body",children:[t.jsxs("div",{className:"notif-line",children:[t.jsx("strong",{children:p.actor_name||"A friend"})," invited you to play"]}),t.jsxs("div",{className:"notif-actions",children:[t.jsx("button",{className:"notif-btn notif-accept",onClick:()=>c?.(p),children:"Join"}),t.jsx("button",{className:"notif-btn notif-decline",onClick:()=>d?.(p),children:"Dismiss"})]})]})]},p.id)),a.map(p=>{const g=p.requester||{};return t.jsxs("div",{className:"notif-item",children:[t.jsx("button",{className:"notif-ava",onClick:()=>g.id&&o?.({id:g.id,username:g.username,avatar:g.avatar}),"aria-label":g.username?`View ${g.username}'s profile`:"View profile",children:t.jsx(Fn,{value:g.avatar,name:g.username})}),t.jsxs("div",{className:"notif-body",children:[t.jsxs("div",{className:"notif-line",children:[t.jsx("strong",{children:g.username||"Someone"})," wants to be friends"]}),t.jsxs("div",{className:"notif-actions",children:[t.jsx("button",{className:"notif-btn notif-accept",onClick:()=>i(p.id,!0),children:"Accept"}),t.jsx("button",{className:"notif-btn notif-decline",onClick:()=>i(p.id,!1),children:"Decline"})]})]})]},p.id)})]})]})})}const Ff=[{q:"How do I play with friends online?",a:'Tap "Multiplayer" on the home screen and choose Online Multiplayer. The host taps "Create Room" and gets a 6-character room code (like ABC123). Share the code with up to seven friends â they tap "Join with Code", enter it, and land in your lobby. Once at least one friend has joined, the host taps "Start Game" and you all play the same questions in real time. Want a quick local game instead? "Local Multiplayer" still works for pass-and-play on a single device.'}
300,{q:"How do I share a multiplayer invite?",a:`Easiest: read out the 6-character room code from your lobby â your friend types it into "Join with Code". You can also share an invite link: balliq.app/join/ABC123 (use your room's code). Anyone tapping the link will land directly in the join flow once they're signed in.`},{q:"What if my friend joins late or loses connection?",a:"Friends can join the lobby any time before the host starts. If someone loses connection during a game, their existing answers stay in the room and the game continues for everyone else. Reconnecting brings them back to the current question with their score intact."},{q:"What is Footle?",a:"Footle is our daily football word game â guess the name a footballer goes by in 6 attempts. Usually a surname, sometimes a one-name legend like Pelé or Xavi. The same player is shown to everyone each day and resets at midnight."},{q:"How do I delete my account?",a:"Go to Settings â Account â Delete Account. This will permanently remove all your data including your profile, scores, friends, and game history."},{q:"Does Ball IQ work offline?",a:"Most game modes work offline â your scores are saved locally and synced when you're back online."},{q:"Why can't I find my friend in friend search?",a:"Make sure they have signed up and set a username. Search is case-insensitive but the username must match exactly."},{q:"How do I report an issue?",a:"Email us at [email protected] â we read every message."}],Nf=me.memo(function({onClose:a}){return t.jsxs("div",{style:{position:"fixed",top:0,right:0,bottom:0,left:0,inset:0,background:"var(--bg)",color:"var(--text)",zIndex:1e3,overflowY:"auto",WebkitOverflowScrolling:"touch",fontFamily:"'Inter',-apple-system,BlinkMacSystemFont,sans-serif"},children:[t.jsxs("div",{style:{position:"sticky",top:0,background:"rgba(11,12,16,0.95)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",borderBottom:"1px solid var(--border2)",padding:"calc(14px + env(safe-area-inset-top, 0px)) 20px 14px",display:"flex",alignItems:"center",gap:12,zIndex:1},children:[t.jsx("button",{type:"button",onClick:a,"aria-label":"Close help",style:{width:36,height:36,borderRadius:10,background:"var(--s2)",border:"1px solid var(--border2)",color:"var(--text)",fontSize:18,lineHeight:1,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",WebkitTapHighlightColor:"transparent",outline:"none"},children:"â"}),t.jsx("div",{style:{fontSize:17,fontWeight:800,letterSpacing:"-0.3px"},children:"Help & FAQ"})]}),t.jsxs("div",{style:{maxWidth:680,margin:"0 auto",padding:"28px 20px 80px",lineHeight:1.7},children:[t.jsxs("div",{style:{fontSize:22,fontWeight:900,color:"var(--accent)",marginBottom:8},children:["â½ ",Ce]}),t.jsx("div",{style:{fontSize:13,color:"var(--t2)",marginBottom:28},children:"Quick answers to common questions."}),Ff.map((n,r)=>t.jsxs(me.Fragment,{children:[t.jsx("h2",{style:yi,children:n.q}),t.jsx("p",{style:Nn,children:n.a})]},r)),t.jsxs("p",{style:{...Nn,marginTop:32},children:["Still stuck? Reach us at ",t.jsx("a",{href:"mailto:[email protected]",style:{color:"var(--accent)",textDecoration:"none"},children:"[email protected]"}),"."]})]})]})}),Lf=[{q:"I had to sign in again after a week â is that normal?",a:"Yes. For security, sign-in sessions expire roughly every 7 days. This is intentional, not a bug. Sign back in with Apple, Google, or your email and you're back in seconds â your scores, streak, and history are tied to your account, not the device."},{q:"I installed Ball IQ on a second device and it asked me to onboard again",a:"If you're signed in to an account on both devices, onboarding only runs once and the choice syncs across devices. If you're using guest mode (no email), each new install is treated as a fresh visitor and replays the short intro. Sign up to skip this on future devices."},{q:"A question seems factually wrong",a:"Email [email protected] with the question text and what you think the correct answer is. We hand-review every report â most fixes ship within a few days. Football trivia changes (records broken, players retire, clubs relegated) so even careful research goes stale; reports are how we keep up."},{q:"My streak / progress didn't sync to my other device",a:"If you're signed in, everything except onboarding state (covered above) syncs through your profile. If you played as a guest first and signed in later, only future progress syncs â past guest sessions stay on the device they were played on. Sign up earlier on new devices to avoid this gap."}],Ef=me.memo(function({onClose:a}){return t.jsxs("div",{style:{position:"fixed",top:0,right:0,bottom:0,left:0,inset:0,background:"var(--bg)",color:"var(--text)",zIndex:1e3,overflowY:"auto",WebkitOverflowScrolling:"touch",fontFamily:"'Inter',-apple-system,BlinkMacSystemFont,sans-serif"},children:[t.jsxs("div",{style:{position:"sticky",top:0,background:"rgba(15,17,23,0.95)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",borderBottom:"1px solid var(--border2)",padding:"calc(14px + env(safe-area-inset-top, 0px)) 20px 14px",display:"flex",alignItems:"center",gap:12,zIndex:1},children:[t.jsx("button",{type:"button",onClick:a,"aria-label":"Close known issues",style:{width:36,height:36,borderRadius:10,background:"var(--s2)",border:"1px solid var(--border2)",color:"var(--text)",fontSize:18,lineHeight:1,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",WebkitTapHighlightColor:"transparent",outline:"none"},children:"â"}),t.jsx("div",{style:{fontSize:17,fontWeight:800,letterSpacing:"-0.3px"},children:"Known issues"})]}),t.jsxs("div",{style:{maxWidth:680,margin:"0 auto",padding:"28px 20px 80px",lineHeight:1.7},children:[t.jsx("div",{style:{fontSize:22,fontWeight:900,color:"var(--accent)",marginBottom:8},children:"â½ Known issues"}),t.jsx("div",{style:{fontSize:13,color:"var(--t2)",marginBottom:28},children:"We're a small team and we know about these. Honest about what's a bug, what's a deliberate trade-off, and what's just hard."}),Lf.map((n,r)=>t.jsxs(me.Fragment,{children:[t.jsx("h2",{style:yi,children:n.q}),t.jsx("p",{style:Nn,children:n.a})]},r)),t.jsxs("p",{style:{...Nn,marginTop:32},children:["Anything else feels off? Email ",t.jsx("a",{href:"mailto:[email protected]",style:{color:"var(--accent)",textDecoration:"none"},children:"[email protected]"}),"."]})]})]})});function qh(){const[e,a]=l.useState("");return l.useEffect(()=>{const n=()=>{const i=new Date,c=new Date(i);c.setDate(c.getDate()+1),c.setHours(0,0,0,0);const d=c-i,o=Math.floor(d/36e5),u=Math.floor(d%36e5/6e4);a(`${o}h ${u}m`)};n();const r=setInterval(n,3e4);return()=>clearInterval(r)},[]),e}function xt({label:e="Loading"}){return t.jsxs("div",{className:"screen",style:{minHeight:"60dvh",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:14},children:[t.jsx("div",{style:{width:38,height:38,borderRadius:"50%",border:"3px solid var(--line, var(--border2))",borderTopColor:"var(--accent)",animation:"biqSpin 0.9s linear infinite"}}),t.jsxs("div",{style:{fontSize:13.5,fontWeight:700,color:"var(--t2)",letterSpacing:"-0.2px"},children:[e,"â¦"]})]})}
300class ut extends me.Component{constructor(a){super(a),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(a,n){console.error(`[boundary:${this.props.name||"tab"}]`,a?.message||"Unknown error");try{$a()}catch{}ji();try{Le(a,{tags:{boundary:"tab",tab:this.props.name||"unknown"},contexts:{react:{componentStack:n?.componentStack}}})}catch{}}render(){return this.state.hasError?t.jsxs("div",{style:{minHeight:"60dvh",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"48px 24px",textAlign:"center"},children:[t.jsx("div",{style:{fontSize:40,marginBottom:14},children:"â½"}),t.jsx("div",{style:{fontSize:17,fontWeight:800,color:"var(--t1)",marginBottom:6,letterSpacing:"-0.3px"},children:this.props.onExit?"This screen hit a snag":"This tab hit a snag"}),t.jsx("div",{style:{fontSize:13.5,color:"var(--t2)",lineHeight:1.7,marginBottom:22,maxWidth:280},children:"The rest of the app is fine â tap to reload just this screen."}),t.jsx("button",{onClick:()=>this.setState({hasError:!1}),style:{padding:"11px 24px",background:"var(--accent)",border:"none",borderRadius:999,boxShadow:"0 8px 22px -8px rgba(88,204,2,0.55)",fontFamily:"Inter,sans-serif",fontSize:13.5,fontWeight:700,color:"var(--grn-ink)",cursor:"pointer"},children:"Try again"}),this.props.onExit&&t.jsx("button",{onClick:()=>{this.setState({hasError:!1});try{this.props.onExit()}catch{}},style:{marginTop:12,padding:"11px 24px",background:"transparent",border:"1px solid var(--line, var(--border2))",borderRadius:11,fontFamily:"Inter,sans-serif",fontSize:13.5,fontWeight:700,color:"var(--t2)",cursor:"pointer"},children:"Back to Home"})]}):this.props.children}}const wn={wordle:{title:"Footle",steps:["Guess the name today's footballer goes by â usually a surname, sometimes a one-name legend","Green = right letter, right spot","Yellow = right letter, wrong spot","Grey = not in the name at all","6 guesses, new player at midnight"]},hotstreak:{title:"Hot Streak",steps:["You have 60 seconds on the clock","Answer as many questions as you can","No penalty for wrong answers â just keep going!","Score is how many you get correct","Try to beat your personal best"]},truefalse:{title:"True or False",steps:["You get 20 football statements","Tap TRUE or FALSE for each one","There's no timer â take your time","Every correct answer earns XP","A perfect 20/20 earns a bonus!"]},survival:{title:"Survival",steps:["Answer questions one by one","One wrong answer and the game is over","No timer â accuracy is everything","See how far you can go","Your best streak
300is saved"]}},xn={display:"none"};function If(e){const a=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${a}-${n}-${r}`}function qf(){try{const e=localStorage.getItem("biq_seen_history_v2"),a=e?JSON.parse(e):{},n=a&&typeof a=="object"?Object.values(a).filter(c=>typeof c=="number"):[],r=[],i=new Date;for(let c=6;c>=0;c--){const d=new Date(i);d.setDate(i.getDate()-c),d.setHours(0,0,0,0);const o=d.getTime(),u=o+24*3600*1e3;let m=n.some(p=>p>=o&&p<u);m||localStorage.getItem(`biq_wordle_${If(d)}`)&&(m=!0),r.push(m)}return r}catch{return Array(7).fill(!1)}}const Rf={haptic:ve,playSound:rt,markBadReviewMoment:$a,shareCard:En,Confetti:In,InstallBanner:Cf,GetAppCTA:hf,isNative:He,onSync:(e,a)=>{$.rpc("upsert_wordle_state",{p_ymd:e,p_state:a}).then(({error:n})=>{n&&(console.warn("[wordle sync]",n.message),Le(n,{tags:{area:"wordle-sync"}}))}).catch(n=>{console.warn("[wordle sync]",n?.message||n),Le(n,{tags:{area:"wordle-sync"}})})}},Tf={haptic:ve,playSound:rt,Confetti:In};function Mf({onPick:e,onSkip:a,onCancel:n}){const r=l.useRef(null);ft({isOpen:!0,onClose:n,ref:r});const i=[["wrong-answer",oc,"The answer is wrong"],["unclear",rc,"Confusing or unclear"],["typo",fc,"Typo or bad grammar"],["too-easy",dc,"Too easy â gives itself away"],["too-hard",nc,"Too hard or unfair"]];return t.jsx("div",{className:"modal-overlay",role:"dialog","aria-modal":"true","aria-label":"What's wrong with this question?",onClick:n,children:t.jsxs("div",{ref:r,tabIndex:-1,className:"modal-box",onClick:c=>c.stopPropagation(),children:[t.jsx("div",{className:"modal-grab","aria-hidden":"true"}),t.jsxs("div",{className:"modal-head",children:[t.jsx("div",{className:"modal-title",children:"Whatâs wrong with it?"}),t.jsx("div",{className:"modal-body",children:"One tap â it tells us exactly what to fix."})]}),t.jsx("div",{className:"report-reasons",children:i.map(([c,d,o])=>t.jsxs("button",{type:"button",className:"report-reason",onClick:()=>e(c),children:[t.jsx("span",{className:"report-reason-well","aria-hidden":"true",children:t.jsx(d,{size:18,strokeWidth:2.2})}),t.jsx("span",{className:"report-reason-label",children:o})]},c))}),t.jsxs("div",{className:"modal-btns",children:[t.jsx("button",{type:"button",className:"modal-btn modal-quiet",onClick:a,children:"Just flag it"}),t.jsx("button",{type:"button",className:"modal-btn modal-quiet report-cancel",onClick:n,children:"Cancel"})]})]})})}const Bf=me.memo(function(){const[a,n]=l.useState(()=>{try{return navigator.onLine!==!1}catch{return!0}}),[r,i]=l.useState(!1),c=l.useRef(null),d=l.useCallback(async()=>{try{const o=new AbortController,u=setTimeout(()=>o.abort(),3e3),m=await fetch(`/version.json?_=${Date.now()}`,{method:"HEAD",cache:"no-store",signal:o.signal});return clearTimeout(u),m.ok||m.status>=200&&m.status<500}catch{return!1}},[]);return l.useEffect(()=>{const o=()=>{n(!0),i(!0),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>i(!1),2e3)},u=()=>{d().then(m=>{m||(n(!1),i(!1),c.current&&clearTimeout(c.current))})};return window.addEventListener("online",o),window.addEventListener("offline",u),navigator.onLine||d().then(m=>{m&&n(!0)}),()=>{window.removeEventListener("online",o),window.removeEventListener("offline",u),c.current&&clearTimeout(c.current)}},[d]),l.useEffect(()=>{if(a)return;const o=setInterval(()=>{d().then(u=>{u&&(n(!0),i(!0),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>i(!1),2e3))})},12e3);return()=>clearInterval(o)},[a,d]),a&&!r?null:t.jsx("div",{className:`offline-banner${a?" reconnected":""}`,role:"status","aria-live":"polite",children:a?"â Back online":"You're offline. Your progress will sync when you're back."})});function Es(e){if(!e)return null;const[a,n,...r]=String(e).split("."),i=r.join("."),c=parseInt(a,10);if(isNaN(c)||!/^\d{8}$/.test(n||""))return null;let d="";try{d=i?decodeURIComponent(i):""}catch{d=i||""}return{score:Math.max(0,Math.min(7,c)),date:n,name:d.slice(0,24)}}function Bt(e){const a=new Date;if(e===St(a).replace(/-/g,""))return 0;const n=new Date(a);return n.setDate(n.getDate()-1),e===St(n).replace(/-/g,"")?1:2}function Pf(){l.useEffect(()=>{ji()},[]);const{user:e,profile:a,isGuest:n,isAnonUser:r,signInAsGuest:i,exitGuestMode:c,openAuthPrompt:d}=Rn(),[o,u]=l.useState("home"),m=l.useRef(!1);l.useEffect(()=>{if(o!=="home"&&(m.current=!0),o==="results"||o==="home"&&m.current)try{window.__biqConsentMomentFired=!0,window.dispatchEvent(new Event("biq:consent-moment"))}catch{}},[o]);const p=l.useRef(null),{pendingJoinCode:g,setPendingJoinCode:k,clearPendingJoin:b,stage1RoomCode:N,setStage1RoomCode:j,joinGateRef:_}=su({user:e,isGuest:n,startModeRef:p});l.useEffect(()=>{try{window.scrollTo({top:0,left:0,behavior:"instant"})}catch{try{window.scrollTo(0,0)}catch{}}}
300,[o]);const[w,A]=l.useState(()=>{if(ks)return!1;try{const s=Hu;if(s==="/footle"||s==="/footle/"||/^\/c\/./.test(s))return!0;const f=s.match(/^\/join\/([A-Za-z0-9]+)/);if(f&&Ln(f[1]))return!0;const h=new URLSearchParams(mr);if(["footle","trail","daily","classic","survival","hotstreak","legends","chaos","stadiums","clubquiz","leaguequiz","online",...sr?["mystery"]:[]].includes(h.get("game"))||/^q_[a-z0-9]+$/.test((h.get("eq")||"").trim().toLowerCase())||Ln(h.get("join"))||/^q_[a-z0-9]+$/.test((h.get("stump")||"").trim().toLowerCase())||Mr[(h.get("club")||"").toLowerCase()]||Br[(h.get("quiz")||"").toLowerCase()]||h.get("c"))return!0}catch{}return!1});l.useEffect(()=>{if(w){if(o!=="home"){_s=!0;return}_s&&(ks=!0,A(!1))}},[o,w]);const[q,Z]=l.useState(!1);l.useEffect(()=>{if(!(!e||n||!a))try{localStorage.getItem("biq_needs_username")==="1"&&Z(!0)}catch{}},[e?.id,n,a]);const[W,Q]=l.useState(0);l.useEffect(()=>{try{Da("screen",o),ot({category:"nav",message:`screen â ${o}`,level:"info"})}catch{}},[o]);const[B,T]=l.useState(!1);l.useEffect(()=>{if(!g)return;let s=!0;return(async()=>{const f=await ls(g);if(s&&(f.found===!1||f.found&&!f.joinable)){X("join-token-dead",{state:f.state||"missing"}),k(null);try{localStorage.removeItem("biq_pending_join")}catch{}}})(),()=>{s=!1}},[g]);const[K,ae]=l.useState(!1),[ue,ie]=l.useState(""),xe=l.useCallback(async()=>{if(K)return;ae(!0),ie("");const{error:s}=await i();if(s){console.warn("[handleGuestJoin] signInAsGuest",s.message),ae(!1),ie("Guest entry isn't available right now â sign up free instead, it takes a minute.");return}},[K,i]),se=l.useRef(!1),[M,Se]=l.useState(()=>{try{const s=window.location.pathname.match(/^\/c\/([^/?#]+)/),f=(s?s[1]:null)||new URLSearchParams(window.location.search).get("c");if(f){let C=null;try{const F=new URLSearchParams(window.location.search).get("f");F&&/^[0-9a-f-]{36}$/i.test(F)&&(C=F)}catch{}try{const F=new URL(window.location.href);F.searchParams.delete("c"),F.searchParams.delete("f"),window.history.replaceState({},"",F.pathname+F.search+F.hash)}catch{}const y=Es(f);if(y){C&&(y.from=C),se.current=!0;try{localStorage.setItem("biq_pending_challenge",JSON.stringify(y))}catch{}return y}}const h=localStorage.getItem("biq_pending_challenge");if(h)return JSON.parse(h)}catch{}return null}),[ge,ce]=l.useState(()=>se.current),je=l.useCallback(()=>{Se(null),ce(!1);try{localStorage.removeItem("biq_pending_challenge")}catch{}},[]),[Fe,Me]=l.useState(null),[Ue,mt]=l.useState(!1);l.useEffect(()=>{if(!Ze.isNativePlatform?.())return;const s=h=>{if(h)try{const C=new URL(h);if(C.hostname!=="balliq.app")return;const y=C.pathname.match(/^\/join\/([A-Za-z0-9]+)/);if(y){const D=y[1].toUpperCase().replace(/[^A-HJ-NP-Z2-9]/g,"").slice(0,6);if(D){try{localStorage.setItem("biq_pending_join",JSON.stringify({c:D,at:Date.now()}))}catch{}k(D)}return}const F=C.pathname.match(/^\/c\/([^/?#]+)/);if(F){const D=Es(F[1]);if(D){const Y=C.searchParams.get("f");Y&&/^[0-9a-f-]{36}$/i.test(Y)&&(D.from=Y);try{localStorage.setItem("biq_pending_challenge",JSON.stringify(D))}catch{}Se(D),ce(!0)}}}catch{}};ua.getLaunchUrl().then(h=>s(h?.url)).catch(()=>{});let f=ua.addListener("appUrlOpen",h=>s(h?.url));return()=>{Promise.resolve(f).then(h=>h?.remove?.()).catch(()=>{})}},[]);const[it,R]=l.useState(()=>{try{return localStorage.getItem("biq_onboarded")==="1"}catch{return!0}}),[L,x]=l.useState("home");l.useEffect(()=>{L==="profile"&&ur("stats-view")},[L]);const[E,I]=l.useState(()=>{try{const s=localStorage.getItem("biq_profile");if(s){const f=JSON.parse(s);if(f&&typeof f=="object")return f}}catch{}return{name:"",avatar:"â½"}}),[v,G]=l.useState(null),[U,H]=l.useState("All"),ee={home:"Home",quiz:"Quiz",results:"Results",settings:"Settings",wordle:"Footle",trail:"Transfer Trail",mystery:"Mystery Player",stadiums:"Stadiums",review:"Question review","daily-review":"Daily review","puzzle-review":"Puzzle review","friend-profile":"Friend profile","blocked-users":"Blocked users","club-quiz":"Club quiz","league-quiz":"League quiz",stump:"Stump a mate","online-stage1":"Online multiplayer","online-stage1-lobby":"Lobby","local-setup":"Pass and play"},te={home:"Home",daily:"History",online:"Multiplayer",profile:"Profile"},be=l.useMemo(()=>o==="home"?te[L]||"Home":ee[o]||"",[o,L]),[de,we]=l.useState("");l.useEffect(()=>{if(!be)return;try{document.title=`${be} â ${Ce}`}catch{}const s=setTimeout(()=>we(be),120);return()=>clearTimeout(s)},[be]);const[ye,Be]=l.useState([]),[P,Je]=l.useState(!1),[Ie,vt]=l.useState(null),[lt,At]=l.useState([]),[Ft,Jt]=l.useState(null),[wt,Kt]=l.useState(null),[_a,Tt]=l.useState(null),[V,Pe]=l.useState(()=>{try{const s=localStorage.getItem("biq_stats");if(s){const f=JSON.parse(s);if(f&&typeof f=="object")return f}}catch{}return{gamesPlayed:0,bestScore:0,bestStreak:0}});l.useEffect(()=>{const s=zc();s.length&&Pe(f=>{const h={...f,catStats:lr(f.catStats||{},s,{c:f.totalCorrect||0,a:f.totalAnswered||0})};return Ne("biq_stats",JSON.stringify(h)),h})},[]);const Nt=l.useCallback(s=>{Pe(f=>{const h={...f};return s?h.cardLeague=s:delete h.cardLeague,Ne("biq_stats",JSON.stringify(h)),h})},[]),[at,kt]=l.useState(()=>{const s=yr();try{const f=localStorage.getItem("biq_settings");if(f){const h=JSON.parse(f);if(h&&typeof h=="object")return{...s,...h}}}catch{}return s});l.useEffect(()=>{try{document.documentElement.classList.toggle("biq-cb",at.colorBlind===!0)}catch{}},[at.colorBlind]);const[Re,S]=l.useState(()=>{try{const s=new Date,f=`${s.getFullYear()}
300-${String(s.getMonth()+1).padStart(2,"0")}-${String(s.getDate()).padStart(2,"0")}`;if(localStorage.getItem(`biq_daily_${f}`))return!0}catch{}return!1}),[z,ne]=l.useState(()=>{try{const s=new Date,f=`${s.getFullYear()}-${String(s.getMonth()+1).padStart(2,"0")}-${String(s.getDate()).padStart(2,"0")}`,h=localStorage.getItem(`biq_daily_${f}`);if(h){const C=JSON.parse(h);if(typeof C?.score=="number")return C.score}}catch{}return null}),[J,re]=l.useState(()=>{try{const s=localStorage.getItem("biq_hotstreak_best");if(s){const f=parseInt(s,10);if(!Number.isNaN(f))return f}}catch{}return 0}),[qe,ke]=l.useState(!1),[Oe,gt]=l.useState("ask"),[Ca,Kr]=l.useState(!1),[Ni,Yr]=l.useState(!1),[Li,Zr]=l.useState(!1),[Ei,Xr]=l.useState(!1),[Mn,Bn]=l.useState(!1),[Ge,ja]=l.useState(()=>{try{const s=localStorage.getItem("biq_xp");if(s){const f=parseInt(s,10);if(!Number.isNaN(f))return f}}catch{}return 0}),[Ya,Pn]=l.useState(null),Yt=l.useRef(null),[Zt,zt]=l.useState(null),[De,Xt]=l.useState(()=>{try{const s=localStorage.getItem("biq_login_streak");if(!s)return 0;const f=JSON.parse(s);let h=0,C=0;try{h=parseInt(localStorage.getItem("biq_xp")||"0",10)||0}catch{}try{C=(JSON.parse(localStorage.getItem("biq_stats")||"{}")||{}).shieldsUsed||0}catch{}return bs(f,Er(),ys(h,C))}catch{return 0}}),[Aa,Fa]=l.useState(()=>{try{const s=localStorage.getItem("biq_login_streak");if(s){const f=JSON.parse(s);if(f&&typeof f.best=="number")return f.best;if(f&&typeof f.streak=="number")return f.streak}}catch{}return 0}),[eo,to]=l.useState(null),ao=l.useRef(De),no=l.useRef(!1),[Ii,ro]=l.useState(!1);l.useEffect(()=>{if(!no.current&&De>ao.current&&De>0){no.current=!0,ro(!0);const s=setTimeout(()=>ro(!1),1500);return()=>clearTimeout(s)}},[De]);const Na=l.useRef(null),Qe=l.useRef([]),oo=l.useRef(o);oo.current=o;const Za=l.useCallback(()=>!$u.has(oo.current),[]);l.useEffect(()=>()=>{Yt.current&&clearTimeout(Yt.current),Na.current&&clearTimeout(Na.current),Qe.current.forEach(clearTimeout),Qe.current=[]},[]);const[so,io]=l.useState(null),Xa=l.useRef(null),O=l.useCallback((s,f=2800)=>{io(s),Xa.current&&clearTimeout(Xa.current),Xa.current=setTimeout(()=>{io(null),Xa.current=null},f)},[]),[Dn,ea]=l.useState(!1);l.useEffect(()=>{if(!Dn)return;const s=setTimeout(()=>ea(!1),5e3);return()=>clearTimeout(s)},[Dn]);const[zn,On]=l.useState(null),Wn=l.useCallback(()=>{try{const s=St(new Date),f=va(),h=f.kind==="won"||f.kind==="lost";let C=!1,y=!1;try{const D=JSON.parse(localStorage.getItem(`biq_trail_${s}`)||"null");C=D?.status==="won"||D?.status==="lost"}catch{}try{const D=JSON.parse(localStorage.getItem(`biq_mystery_${s}`)||"null");y=!!(D&&(D.won||D.gaveUp))}catch{}const F=(Re?1:0)+(h?1:0)+(C?1:0)+(y?1:0);Vd({date:s,done:F,total:4,streak:De||0})}catch{}},[Re,De]);l.useEffect(()=>{Wn()},[Wn]);const lo=l.useCallback(async()=>{const s=new Date,f=Math.floor((s.getTime()-s.getTimezoneOffset()*6e4)/864e5);let h;if(e?.id){const{data:y,error:F}=await $.rpc("tick_login_streak",{p_local_day:f});if(F){console.warn("[tick_login_streak]",F.message);return}h=y}else{const y=f;let F=null;try{const he=localStorage.getItem("biq_login_streak");he&&(F=JSON.parse(he))}catch{}const D=F?.streak??0,Y=F?.lastDay??0,pe=F?.best??F?.streak??0;let oe=0,fe=0;try{oe=parseInt(localStorage.getItem("biq_xp")||"0",10)||0}catch{}try{fe=JSON.parse(localStorage.getItem("biq_stats")||"{}").shieldsUsed||0}catch{}const Ee=Math.min(3,Math.max(0,Math.floor(oe/200)-fe));let Ve,Mt=!1;if(Y>y)h={lastDay:Y,streak:D,best:pe,ticked:!1,shieldSaved:!1};else{Y===y?Ve=D:Y===y-1?Ve=D+1:Y===y-2&&D>0&&Ee>0?(Ve=D+1,Mt=!0,ur("shield-saved")):Ve=1;const he=Ve===1&&Y!==y&&D>=2?{fell:D,fellDay:y}:null;h={lastDay:y,streak:Ve,best:Math.max(pe,Ve),ticked:Y!==y,shieldSaved:Mt,...he||{}}}}if(!h)return;let C=0;try{const y=localStorage.getItem("biq_login_streak");if(y){const F=JSON.parse(y);typeof F?.streak=="number"&&(C=F.streak)}}catch{}try{localStorage.setItem("biq_login_streak",JSON.stringify({lastDay:h.lastDay,streak:h.streak,best:h.best,...h.fell>0?{fell:h.fell,fellDay:h.fellDay}:{}}))}catch{}if(Xt(h.streak),Fa(h.best),On(h.fell>0&&h.fellDay===f?{fell:h.fell,fellDay:h.fellDay}:null),typeof h.shieldsUsed=="number"&&Pe(y=>({...y,shieldsUsed:h.shieldsUsed})),h.shieldSaved)e?.id||Pe(y=>{const F={...y,shieldsUsed:(y.shieldsUsed||0)+1};return Ne("biq_stats",JSON.stringify(F)),F}),O(`ð¡ï¸ Streak shield used â your ${h.streak}-day streak is safe!`),ve("heavy"),rt("streak");else if(h.ticked&&h.streak>1)Na.current&&clearTimeout(Na.current),to(h.streak),ve("heavy"),rt("streak"),Na.current=setTimeout(()=>to(null),Sa.STREAK_TOAST);else if(h.streak<C&&C>=3){let y=!1;try{y=localStorage.getItem("biq_streak_death_ack")===String(h.lastDay)}catch{}if(!y){try{localStorage.setItem("biq_streak_death_ack",String(h.lastDay))}catch{}const F=typeof h.best=="number"&&h.best>0?h.best:C;O(`ð Streak reset â day ${h.streak} of the rebuild. Your best: ${F} ð¥`,4200)}}if(h.ticked&&[7,30,100].includes(h.streak)){let y={};try{y=JSON.parse(localStorage.getItem("biq_stats")||"{}")||{}}catch{}const F=`streak${h.streak}Celebrated`;if(!y[F]){const D=h.streak===7?"ð¥ 7-day streak â you're building a habit":h.streak===30?"ð 30-day streak â incredible dedication":"ð 100-day streak â you are a legend";Qe.current.push(setTimeout(()=>{O(D),ve("heavy"),rt("streak"),ea(!0)},1200)),Pe(Y=>{const pe={...Y,[F]:!0};return Ne("biq_stats",JSON.stringify(pe)),pe})}}},[e?.id]);l.useEffect(()=>{e?.id&&(ca(e.id,"acct-session",X),Hd(e.id).then(({sent:s,dropped:f})=>{s&&X("score-outbox-flushed",{sent:s,dropped:f})}).catch(()=>{}))},[e?.id]);const[Un,ta]=l.useState({});l.useEffect(()=>{const s=()=>{const y=new Date;return`${y.getFullYear()}
300-${String(y.getMonth()+1).padStart(2,"0")}-${String(y.getDate()).padStart(2,"0")}`},f=()=>{try{const y={};for(let F=0;F<localStorage.length;F++){const D=localStorage.key(F),Y=D&&D.match(/^biq_daily_(\d{4}-\d{2}-\d{2})$/);if(Y)try{const pe=JSON.parse(localStorage.getItem(D));typeof pe?.score=="number"&&(y[Y[1]]=pe.score)}catch{}}ta(y)}catch{}};let h=s();const C=setInterval(()=>{const y=s();if(y!==h){h=y;try{const F=localStorage.getItem(`biq_daily_${y}`);if(F){const D=JSON.parse(F);S(!0),ne(typeof D?.score=="number"?D.score:null)}else S(!1),ne(null)}catch{S(!1),ne(null)}f();try{window.dispatchEvent(new CustomEvent("biq:day-rollover"))}catch{}}},6e4);return()=>{clearInterval(C)}},[]);const $n=l.useCallback(s=>{I(f=>{const h=typeof s=="function"?s(f):s;return Ne("biq_profile",JSON.stringify(h)),h})},[]),{shareScore:en,saveCardImage:qi,shareProfile:Ri,shareDaily:co,submitShareName:uo,askShareName:Ti,shareNameDraft:fo,setShareNameDraft:Mi,shareNameRef:Bi,cancelShareName:Pi}=ru({user:e,showToast:O,profile:E,setProfile:$n,authProfile:a,stats:V,xp:Ge,loginStreak:De,dailyScore:z}),ho=l.useMemo(()=>Ko(new Date),[]),[mo,Hn]=l.useState(null),[Te,La]=l.useState(null),[We,Ea]=l.useState(null),go=l.useCallback(async()=>{const s=new Date,f=Math.floor((s.getTime()-s.getTimezoneOffset()*6e4)/864e5),h=C=>{O(`ð¥ Streak repaired â ${C} days and counting`),ve("heavy"),rt("streak"),ea(!0)};if(e?.id){const{data:C,error:y}=await $.rpc("repair_login_streak",{p_local_day:f});if(y){console.warn("[repair_login_streak]",y.message);return}if(On(null),!C?.repaired)return;Xt(C.streak),Fa(C.best);try{localStorage.setItem("biq_login_streak",JSON.stringify({lastDay:C.lastDay,streak:C.streak,best:C.best}))}catch{}h(C.streak)}else try{const C=localStorage.getItem("biq_login_streak");if(!C)return;const y=JSON.parse(C);if(On(null),!(y?.fell>0)||y.fellDay!==f||y.lastDay!==f)return;const F=y.fell+y.streak,D=Math.max(y.best||0,F);localStorage.setItem("biq_login_streak",JSON.stringify({lastDay:y.lastDay,streak:F,best:D})),Xt(F),Fa(D),h(F)}catch{}},[e?.id,O]);l.useEffect(()=>{const s=f=>{if(!zn)return;const h=new Date;h.setDate(h.getDate()-1),f?.detail?.ymd===St(h)&&go()};return window.addEventListener("biq:archive-completed",s),()=>window.removeEventListener("biq:archive-completed",s)},[zn,go]);const{webPushOn:po,handleToggleWebPush:yo}=ou({user:e,showToast:O});l.useEffect(()=>{if(!M)return;X("challenge-arrived"),pr("open",M)&&$.rpc("record_challenge_event",{p_event:"open",p_date:M.date,p_score:M.score,p_name:M.name||null,p_sender:M.from||null}).then(({error:f})=>{f&&console.warn("[challenge open]",f.message)});const s=Bt(M.date);s>1?(O(`â° ${M.name||"Your friend"}'s challenge has expired â play today's Daily 7 and send one back!`),je()):Re&&(Me({mine:z,theirs:M.score,name:M.name,yesterday:s===1}),pr("played",M)&&$.rpc("record_challenge_event",{p_event:"played",p_date:M.date,p_score:M.score,p_name:M.name||null,p_my_score:z,p_sender:M.from||null}).then(({error:f})=>{f&&console.warn("[challenge played]",f.message)}),je())},[M,Re,z,O,je]);const[Gn,Qn]=l.useState(null),Ot=l.useRef(null),Ia=l.useCallback(s=>($a(),new Promise(f=>{if(Ot.current)try{Ot.current(!1)}catch{}Ot.current=f,Qn(s||{})})),[]),Di=l.useCallback(()=>{Qn(null);const s=Ot.current;if(Ot.current=null,s)try{s(!1)}catch{}},[]),bo=l.useCallback(async(s,f)=>{Qn(null),f==="too-easy"&&Tl();const h=Ot.current;Ot.current=null;const C=y=>{if(h)try{h(y)}catch{}return y};try{const{error:y}=await $.rpc("report_question",{p_question_id:s?.id!=null?String(s.id):null,p_question_text:s?.q||"(unknown)",p_picked:s?.picked??null,p_correct:s?.correct??null,p_mode:s?.mode??null,p_reason:f||null});return y?(console.warn("[report_question]",y.message),Le(y,{tags:{area:"question-report"}}),O("Couldn't send that report â we'll look into it"),C(!1)):(O("Thanks â we'll double-check this one â½"),C(!0))}catch(y){return console.warn("[report_question]",y?.message||y),O("Couldn't send that report â we'll look into it"),C(!1)}},[O]);l.useEffect(()=>{const s=()=>{O("â ï¸ Storage full â clear browser data to continue saving progress",5e3)};return window.addEventListener("biq:storage-quota-exceeded",s),()=>window.removeEventListener("biq:storage-quota-exceeded",s)},[O]),l.useEffect(()=>{const s=f=>{const h=f?.detail;if(h){if(typeof h=="string"){O(h);return}h.msg&&O(String(h.msg),h.duration)}};
300return window.addEventListener("biq:show-toast",s),()=>window.removeEventListener("biq:show-toast",s)},[O]);const[tn,zi]=l.useState(null),[Oi,Vn]=l.useState(null);l.useEffect(()=>{{const s=()=>{try{fd()}catch{}},f=()=>{try{ii()}catch{}},h=()=>{try{le(()=>import("./ProfileScreen-Bn6CWcdL.js"),__vite__mapDeps([32,12,4,13,14,15,16,17,18,28,1,19,20,21,22,23,24,25,26,27,29]))}catch{}try{le(()=>import("./OnlineMultiplayer-B80MS-91.js"),__vite__mapDeps([56,12,4,1,13,14,15,16,17,21,19,22,35,18,20,23,24,25,26,27,28,29]))}catch{}},C=(()=>{try{const D=new URLSearchParams(mr);return!!(D.get("game")||D.get("club")||D.get("quiz")||D.get("c"))||/^\/(footle|c)(\/|$)/.test(window.location.pathname)}catch{return!1}})(),y=(()=>{try{const D=navigator.connection;return!!(D&&(D.saveData||/(^|-)(2g|3g)$/.test(D.effectiveType||"")))}catch{return!1}})(),F=()=>{y||(typeof requestIdleCallback=="function"?(requestIdleCallback(s,{timeout:3e3}),requestIdleCallback(h,{timeout:4e3}),requestIdleCallback(()=>setTimeout(()=>requestIdleCallback(f,{timeout:8e3}),4e3),{timeout:3e3})):(setTimeout(s,1200),setTimeout(h,2500),setTimeout(f,6e3)))};C?setTimeout(F,2e4):typeof requestIdleCallback=="function"?F():(setTimeout(s,1200),setTimeout(h,1800),setTimeout(f,5200))}try{wi()}catch{}try{const s=localStorage.getItem("biq_stats");s!==null&&Pe(JSON.parse(s))}catch{}try{const s=localStorage.getItem(ho);if(s!==null){const f=JSON.parse(s);S(!0),ne(f.score)}}catch{}try{const s={};for(let f=0;f<localStorage.length;f++){const h=localStorage.key(f),C=h&&h.match(/^biq_daily_(\d{4}-\d{2}-\d{2})$/);if(C)try{const y=JSON.parse(localStorage.getItem(h));typeof y?.score=="number"&&(s[C[1]]=y.score)}catch{}}ta(s)}catch{}try{const s=localStorage.getItem("biq_profile");s!==null&&I(JSON.parse(s))}catch{}try{const s=localStorage.getItem("biq_xp");s!==null&&ja(parseInt(s)||0)}catch{}try{const s=localStorage.getItem("biq_hotstreak_best");s!==null&&re(parseInt(s)||0)}catch{}try{localStorage.getItem("biq_first_tip_shown")===null&&Kr(!0)}catch{}try{localStorage.getItem("biq_rate_shown")!==null&&Bn(!0)}catch{}try{const s=localStorage.getItem("biq_settings");if(s!==null){const f=JSON.parse(s);if(f&&typeof f=="object"){const h={...yr(),...f};kt(h),Object.keys(yr()).some(y=>!(y in f))&&Ne("biq_settings",JSON.stringify(h))}}}catch{}},[]),l.useEffect(()=>{if(!a||!e?.id)return;const s=(()=>{try{return localStorage.getItem("biq_onboarded")==="1"}catch{return!1}})(),f=!!a.onboarded_at;if(f&&!s){R(!0);try{localStorage.setItem("biq_onboarded","1")}catch{}}else s&&!f&&$.from("profiles").update({onboarded_at:new Date().toISOString()}).eq("id",e.id).then(({error:h})=>{h&&(console.warn("[onboarding] onboarded_at migration failed",h.message||h),Le(h,{tags:{area:"onboarding-flag",site:"local-to-profile"}}))}).catch(h=>Le(h,{tags:{area:"onboarding-flag",site:"local-to-profile"}}))},[a,e?.id]);const vo=l.useRef(!1),wo=l.useCallback(s=>{const f=s.bestStreak||0,h=v==="hotstreak"||v==="truefalse",C=!(v==="mystery"||v==="footle"||v==="trail"||String(v||"").startsWith("mp:")),y=new Date,F=new Date(y);F.setDate(y.getDate()-y.getDay()),F.setHours(0,0,0,0);const D=F.getTime();let Y=(V.gamesThisWeek||0)+1,pe=V.gamesLastWeek||0;V.weekEpoch&&V.weekEpoch<D&&(pe=V.gamesThisWeek||0,Y=1);const oe=lr(V.catStats||{},s.allAnswers||[],{c:V.totalCorrect||0,a:V.totalAnswered||0}),fe={...V,gamesPlayed:V.gamesPlayed+1,gamesThisWeek:Y,gamesLastWeek:pe,weekEpoch:D,catStats:oe,shieldsUsed:V.shieldsUsed||0,bestScore:h?V.bestScore||0:Math.max(V.bestScore||0,s.score),bestStreak:Math.max(V.bestStreak||0,f),totalCorrect:(V.totalCorrect||0)+(C?s.score:0),totalAnswered:(V.totalAnswered||0)+(C&&s.total||0),bestIQ:V.bestIQ||null,bestHotStreak:v==="hotstreak"?Math.max(V.bestHotStreak||0,s.score):V.bestHotStreak||0,bestTrueFalse:v==="truefalse"?Math.max(V.bestTrueFalse||0,s.score):V.bestTrueFalse||0};try{const Ee=Pc(V.catStats||{},oe,{c:V.totalCorrect||0,a:V.totalAnswered||0},{c:fe.totalCorrect||0,a:fe.totalAnswered||0},V.cardLeague);Tt(Ee),Dc(Ee)}catch{Tt(null)}Pe(fe),Ne("biq_stats",JSON.stringify(fe)),e?.id&&s.score!==void 0&&la(e?.id,{game_mode:Te?`club:${Te}`:We?`league:${We}`:v||"classic",score:s.score,correct_answers:s.score,total_questions:s.total||10}),e?.id&&(async()=>{let Ee=!1;try{const Ve=s.score||0;if(Ve>0){const{error:he}=await $.rpc("increment_score",{user_id:e.id,score_delta:Ve});he&&(console.error("[score sync]",he?.message||"Unknown error"),Le(he,{tags:{area:"score-sync"}}),Ee=!0)}const{error:Mt}=await $.from("profiles").update({games_played:fe.gamesPlayed,correct_answers:fe.totalCorrect,stats:{bestScore:fe.bestScore||0,bestStreak:fe.bestStreak||0,bestIQ:fe.bestIQ||0,bestHotStreak:fe.bestHotStreak||0,bestTrueFalse:fe.bestTrueFalse||0,totalAnswered:fe.totalAnswered||0,catStats:fe.catStats||{}}}).eq("id",e.id);Mt&&(console.error("[profile sync]",Mt?.message||"Unknown error"),Le(Mt,{tags:{area:"profile-sync"}}),Ee=!0)}catch(Ve){console.error("[profile sync]",Ve?.message||"Unknown error"),Le(Ve,{tags:{area:"profile-sync"}}),Ee=!0}Ee&&!vo.current&&(vo.current=!0,O("â ï¸ Score didn't sync â check your connection"))})()},[v,V,e,O,Te,We]);new Date().toLocaleDateString("en-GB",{weekday:"long",day:"numeric",month:"short"});const $e=l.useCallback(async s=>{try{if(ve("soft"),La(null),Ea(null),Ca&&(Kr(!1),Ne("biq_first_tip_shown","1")),s==="online"&&(!e||n)){d("online");return}if(G(s),s==="online"){u("online-stage1");return}if(s==="local"){u("local-setup");return}
300if(s==="clubquiz"){u("club-quiz");return}if(s==="leaguequiz"){u("league-quiz");return}if((s==="daily"||s==="survival"||s==="legends"||s==="hotstreak"||s==="truefalse"||s==="chaos")&&H("All"),s==="daily"&&Re){O(`ð
Already done today â ${z}/7, come back tomorrow`);return}Je(!0);let f=[];if(s==="daily")f=await Zu(),Hn(new Date);else if(s==="survival")f=await bn({cat:"All",diff:"hard",n:300,includeLegends:!0});else if(s==="legends")f=await bn({cat:"Legends",diff:"hard",n:10});else if(s==="hotstreak")f=(await bn({cat:"All",diff:"hard",n:999})||[]).filter(h=>h.type!=="tf");else if(s==="truefalse")f=await Xu();else if(!(fa&&s===fa.key))if(s==="chaos"){const{QB_CHAOS:h}=await Ct();if(h.length<5){O("Not enough questions available for this mode");return}const C=ba(h,10,ht);f=Ye([...C]).slice(0,10).map(y=>{if(!Array.isArray(y.o))return{...y,_histKey:ht(y)};const F=Ye([0,1,2,3].slice(0,y.o.length));return{...y,o:F.map(D=>y.o[D]),a:F.indexOf(y.a),_histKey:ht(y)}})}else f=await bn({cat:U,diff:"hard",n:10,ramp:!0});if(f=(f||[]).filter(h=>h&&typeof h=="object"&&(h.q||h.s)),f.length===0){O("No questions found â try a different category or difficulty");return}Be(f),u("quiz")}catch(f){console.error("[startMode]",f?.message||"Unknown error"),O("â ï¸ Couldn't start mode");try{Le(f,{tags:{area:"startMode",mode:s}})}catch{}}finally{Je(!1)}},[e,n,Ca,Re,z,U,O]);p.current=$e;const Jn=l.useCallback(async s=>{try{const f=Ke[s];if(!f)return;ve("soft");let h=null;const C=Tn[s];if(C)try{const{QB:y,conflictsWith:F}=await Ct(),D=y.filter(oe=>oe&&oe.club===C&&oe.type==="mcq"&&Array.isArray(oe.o)&&(!oe.tag||!Cn.has(oe.tag))),Y=D.filter(oe=>oe.diff!=="easy"),pe=Y.length>=16?Y:D;if(pe.length>=10){Ju(pe,ht)<10&&Ku(s)&&O(`You know the ${f.name} pack inside out â a few of these will come round again`);const oe=ba(pe,10,ht);h=Cr(Ye([...oe]),10,F).map(fe=>{const Ee=Ye([0,1,2,3].slice(0,fe.o.length));return{...fe,o:Ee.map(Ve=>fe.o[Ve]),a:Ee.indexOf(fe.a),realCat:fe.cat,cat:"ClubQuiz",type:"mcq",_histKey:ht(fe)}})}}catch{}if(h||(h=Ye(f.questions).slice(0,10).map(y=>({...y,realCat:y.cat,type:"mcq",cat:"ClubQuiz"}))),!h.length){O("No questions yet for this club");return}Ea(null),La(s),G("classic"),Be(h),u("quiz")}catch{O("â ï¸ Couldn't start club quiz")}},[O]),an=l.useCallback(async s=>{try{if(!nt[s])return;ve("soft");const{QB:h,conflictsWith:C}=await Ct(),y=h.filter(oe=>oe&&oe.cat===s&&oe.type==="mcq"&&Array.isArray(oe.o)&&(!oe.tag||!Cn.has(oe.tag))),F=y.filter(oe=>oe.diff!=="easy"),D=F.length>=10?F:y;
300if(D.length<10){O("No questions yet for this competition");return}const Y=ba(D,10,ht),pe=Cr(Ye([...Y]),10,C).map(oe=>{const fe=Ye([0,1,2,3].slice(0,oe.o.length));return{...oe,o:fe.map(Ee=>oe.o[Ee]),a:fe.indexOf(oe.a),_histKey:ht(oe)}});La(null),Ea(s),G("classic"),Be(pe),u("quiz")}catch{O("â ï¸ Couldn't start league quiz")}},[O]),[Kn,nn]=l.useState(null),xo=l.useRef(!1);l.useEffect(()=>{if(!xo.current){xo.current=!0;try{const s=(window.location.pathname||"").toLowerCase();if(s==="/footle"||s==="/footle/"){try{window.history.replaceState({},"","/play"+window.location.search+window.location.hash)}catch{}u("wordle");return}const f=new URLSearchParams(window.location.search),h=(f.get("club")||"").toLowerCase(),C=(f.get("quiz")||"").toLowerCase(),y=(f.get("game")||"").toLowerCase(),F=(f.get("stump")||"").trim().toLowerCase(),D=(f.get("tab")||"").toLowerCase();if(!h&&!C&&!y&&!F&&!D)return;try{const oe=new URL(window.location.href);oe.searchParams.delete("club"),oe.searchParams.delete("quiz"),oe.searchParams.delete("game"),oe.searchParams.delete("stump"),oe.searchParams.delete("tab"),window.history.replaceState({},"",oe.pathname+oe.search+oe.hash)}catch{}if(["home","daily","online","profile"].includes(D)){u("home"),x(D);return}if(y==="footle"){u("wordle");return}if(y==="daily"){$e("daily");return}if(y==="trail"){u("trail");return}if(["classic","survival","hotstreak","legends","chaos","clubquiz","leaguequiz"].includes(y)){$e(y);return}if(y==="stadiums"){u("stadiums");return}if(y==="online"){u("home"),x("online");return}if(y==="mystery"&&sr){u("mystery");return}if(F&&/^q_[a-z0-9]+$/.test(F)){Ct().then(({QB:oe})=>
300{const fe=oe.find(Ee=>Ee&&Ee.id===F&&Ee.type==="mcq"&&Array.isArray(Ee.o));fe&&(nn(fe),u("stump"))}).catch(()=>{});return}const Y=Mr[h],pe=Br[C];Y?Jn(Y):pe?an(pe):(h||C)&&(O("No dedicated pack for that one yet â here's a general quiz"),$e("classic"))}catch{}}},[]);const So=l.useCallback(s=>{La(null),Ea(null),zi(s),Vn(null),G("local"),u("local-game")},[]),Wi=l.useCallback(s=>{Vn(s),u("local-results")},[]),{notifEnabled:Ui,notifBlocked:$i,handleToggleNotif:Hi,resultsRemindState:ko,remindFromResults:_o,maybePromptNotif:Co}=iu({user:e,dailyDone:Re,loginStreak:De,showToast:O,initialStreakRef:ao,webPushOn:po,handleToggleWebPush:yo}),[Gi,Qi]=l.useState(!1),[Vi,Ji]=l.useState(()=>{try{return localStorage.getItem("biq_photo_nudge")==="1"}catch{return!1}}),jo=l.useCallback(()=>{Ji(!0);try{Ne("biq_photo_nudge","1")}catch{}},[]),Ki=l.useRef(null);ft({isOpen:Gi,onClose:()=>{X("notif-prompt-dismissed"),Qi(!1)},ref:Ki}),l.useEffect(()=>Pd(()=>{u("home"),x("home")}),[]),l.useEffect(()=>{Kc(s=>{s?.type==="play_invite"&&s?.code?(j(String(s.code)),u("online-stage1-lobby")):(u("home"),x("online"))})},[]),l.useEffect(()=>{e?.id&&oi(e.id,{requestPermission:!1})},[e?.id]);const qa=l.useMemo(()=>{const s=[];try{const f=va();(f.kind==="ready"||f.kind==="in-progress")&&s.push({key:"footle",name:f.kind==="in-progress"?"Continue today's Footle":"Today's Footle",icon:t.jsx("span",{className:"fh-tile fh-tile-green",style:{"--fh-tile":"22px",borderRadius:6},"aria-hidden":"true",children:"F"}),onTap:()=>u("wordle")})}catch{}Re||s.push({key:"daily7",name:"Today's Daily 7",icon:t.jsx(Rs,{size:18,strokeWidth:2.2}),onTap:()=>$e("daily")});try{vr()&&!["won","lost"].includes(Bs()?.status)&&s.push({key:"trail",name:"Today's Transfer Trail",icon:t.jsx(Ts,{size:18,strokeWidth:2.2}),onTap:()=>u("trail")})}catch{}try{if(sr){const f=JSON.parse(localStorage.getItem(`biq_mystery_${St(new Date)}`)||"null");f&&(f.won||f.gaveUp)||s.push({key:"mystery",name:"Today's Mystery Player",icon:t.jsx(Ms,{size:18,strokeWidth:2.2}),onTap:()=>u("mystery")})}}catch{}return{remind:{state:ko,onRemind:_o},streak:{count:De||0,label:"daily streak"},save:!e||n?{onSave:()=>{X("dd-save-tap"),d?.("save")},line:(V?.gamesPlayed||0)>=2||Ge>0?(()=>{const f=qt(Ge),h=f.nextLevel?Math.max(0,(f.nextLevel.xpNeeded||0)-Ge):0;return`${f.level.name} · ${Ge} XP${f.nextLevel&&h>0?` · ${h} to ${f.nextLevel.name}`:""}`})():null}:null,nextUp:s,track:(f,h)=>X(f,h)}},[ko,_o,De,e,n,Re,$e,o,V?.gamesPlayed,Ge]),Yi=l.useMemo(()=>({...Rf,dailyDone:qa}),[qa]),Ao=l.useMemo(()=>({...Tf,dailyDone:qa}),[qa]),Wt=l.useCallback(s=>{let f={};try{f=JSON.parse(localStorage.getItem("biq_stats")||"{}")||{}}catch{}const h=(f.gamesPlayed||0)+1,C=(f.totalCorrect||0)+(s?1:0),y=(f.totalAnswered||0)+1;Ne("biq_stats",JSON.stringify({...f,gamesPlayed:h,totalCorrect:C,totalAnswered:y})),Pe(F=>({...F,gamesPlayed:h,totalCorrect:C,totalAnswered:y})),e?.id&&(async()=>{try{const{error:F}=await $.from("profiles").update({games_played:h,correct_answers:C}).eq("id",e.id);F&&console.warn("[daily stats]",F.message||"Unknown error")}catch(F){console.warn("[daily stats]",F?.message||"Unknown error")}})()},[e?.id]),rn=l.useCallback(s=>{try{if(localStorage.getItem("biq_first_game_finished"))return;localStorage.setItem("biq_first_game_finished","1"),X("first-game-finished",s)}catch{}},[]),Lt=l.useCallback(s=>{!s||s<=0||(ja(f=>{const h=qt(f),C=f+s,y=qt(C);return Ne("biq_xp",String(C)),y.level.name!==h.level.name&&(Yt.current&&clearTimeout(Yt.current),Yt.current=setTimeout(()=>{Pn({name:y.level.name,Icon:y.level.Icon}),ve("levelup"),rt("levelup"),Yt.current=setTimeout(()=>Pn(null),Sa.STREAK_TOAST)},400)),C}),e?.id&&$.rpc("increment_xp",{user_id:e.id,xp_delta:s}).then(({error:f})=>{f&&(console.error("[xp sync]",f?.message||"Unknown error"),Le(f,{tags:{area:"xp-sync"}}))}))},[e?.id]);l.useEffect(()=>{const s=y=>{Dd(),rn({mode:y?.detail?.game||"daily",won:y?.detail?.won}),lo();const F=y?.detail?.game;(F==="footle"||F==="trail"||F==="mystery")&&y.detail.won===!0&&Qe.current.push(setTimeout(()=>{ve("heavy"),rt("daily_complete")},600));const D=y?.detail?.positive===!1?!1:Co();if(y?.detail?.game==="footle"&&y.detail.won===!0&&Promise.resolve(D).then(Y=>{Y||Yl()<1||(He?Qe.current.push(setTimeout(()=>{if(!Za()){X("rate-prompt-skipped",{reason:"screen-changed",engine:"native",trigger:"footle"});return}const pe=Go();if(pe){X("rate-prompt-skipped",{reason:pe,engine:"native",trigger:"footle"});return}X("rate-prompt-shown",{engine:"native",trigger:"footle"}),Qo()},3500)):Vo()&&!Mn&&(Bn(!0),Qe.current.push(setTimeout(()=>{if(!Za()){X("rate-prompt-skipped",{reason:"screen-changed",trigger:"footle"});return}Jo(),X("rate-prompt-shown",{engine:"web",trigger:"footle"}),gt("ask"),ke(!0)},3500))))}),y?.detail?.game==="footle"&&(Lt(ql(y.detail.won===!0,y.detail.guesses)),Wt(y.detail.won===!0),e?.id)){const Y=Math.min(y.detail.guesses||6,6);la(e?.id,{game_mode:"footle",score:y.detail.won===!0?Y:0,correct_answers:y.detail.won===!0?1:0,total_questions:1})}if(y?.detail?.game==="trail"&&(Lt(y.detail.won===!0?40:10),Wt(y.detail.won===!0),e?.id)){const Y=Math.min(y.detail.attempts||5,5);la(e?.id,{game_mode:"trail",score:y.detail.won===!0?Y:0,correct_answers:y.detail.won===!0?1:0,total_questions:1})}if(y?.detail?.game==="mystery"){const Y=Math.max(1,y.detail.attempts||1),pe=y.detail.won===!0;pe&&Lt(Y<=5?50:Y<=15?35:20),Wt(pe),e?.id&&la(e?.id,{game_mode:"mystery",score:pe?Y:0,correct_answers:pe?1:0,total_questions:1})}},f=y=>{const F=y?.detail||{},D=sf[F.league],Y=Math.max(0,F.total||0);if(D&&Y>0){const pe=Math.max(0,Math.min(Y,F.solved||0)),oe=Array.from({length:Y},(fe,Ee)=>({cat:D,diff:"unknown",isCorrect:Ee<pe}));Pe(fe=>{const Ee={...fe,catStats:lr(fe.catStats||{},oe,{c:fe.totalCorrect||0,a:fe.totalAnswered||0})};return Ne("biq_stats",JSON.stringify(Ee)),Ee})}if(!F.gaveUp){const pe=F.hints===0?80:F.hints<=3?60:F.hints<=10?40:25;Lt(pe)}Wt(!F.gaveUp&&(F.solved||0)>=(F.total||20)),e?.id&&la(e?.id,{game_mode:"stadiums",score:F.solved||0,correct_answers:F.solved||0,total_questions:F.total||20})};window.addEventListener("biq:stadiums-completed",f);const h=y=>{const F=y?.detail||{};X("stadiums-abandon",{league:F.league,solved:F.solved,total:F.total,hints:F.hints})};window.addEventListener("biq:stadiums-exit",h);const C=y=>{s(y),setTimeout(Wn,400)};return window.addEventListener("biq:daily-completed",C),()=>{window.removeEventListener("biq:stadiums-completed",f),window.removeEventListener("biq:stadiums-exit",h),window.removeEventListener("biq:daily-completed",C)}},[Co,Lt,e?.id,lo,Wt,rn]),l.useEffect(()=>{const s=f=>{const h=f?.detail||{};Lt(pf(h.won===!0,h.score)),Wt(null),e?.id&&la(e?.id,{game_mode:`mp:${h.mode||"race"}`,score:h.score||0,correct_answers:null,total_questions:Number.isInteger(h.total)?h.total:null})};return window.addEventListener("biq:mp-completed",s),()=>window.removeEventListener("biq:mp-completed",s)},[Lt,e?.id,Wt]);const Yn=l.useCallback(s=>
300{wo(s),ca(e?.id,"acct-first-finish",X,{mode:v,total:s.total}),rn({mode:v,total:s.total,score:s.score});const f=Array.isArray(s.allAnswers)?s.allAnswers:[];let h=0,C=0,y=0;for(const he of f){if(he?.isCorrect){h=0;continue}h+=1,h>C&&(C=h),he?.timedOut&&(y+=1)}const F=s.total>=5?s.score/s.total:null;if(v!=="survival"&&(C>=4||y>=3||F!==null&&F<=.3)){try{$a()}catch{}X("bad-moment",{source:"session",mode:v,worstMissRun:C,timeouts:y,score:s.score,total:s.total})}const Y=(V.gamesPlayed||0)+1;if(Y>(V.lastGamesMilestone||0)){let he=!0;Y===10?O("ð 10 games played, you're on a roll"):Y===50?O(`ð¥ 50 games â serious ${Ce} energy`):Y===100?O(`ð 100 games â you're a ${Ce} legend`):Y%25===0&&Y>10?O(`â¡ ${Y} games played, keep going`):he=!1,he&&Pe(dt=>{const na={...dt,lastGamesMilestone:Y};return Ne("biq_stats",JSON.stringify(na)),na})}De===7&&!V.streak7Celebrated?(Qe.current.push(setTimeout(()=>{O("ð¥ 7-day streak â you're building a habit"),ve("heavy"),rt("streak"),ea(!0)},1200)),Pe(he=>({...he,streak7Celebrated:!0}))):De===30&&!V.streak30Celebrated?(Qe.current.push(setTimeout(()=>{O("ð 30-day streak â incredible dedication"),ve("heavy"),rt("streak"),ea(!0)},1200)),Pe(he=>({...he,streak30Celebrated:!0}))):De===100&&!V.streak100Celebrated&&(Qe.current.push(setTimeout(()=>{O("ð 100-day streak â you are a legend"),ve("heavy"),rt("streak"),ea(!0)},1200)),Pe(he=>({...he,streak100Celebrated:!0}))),s.score===s.total&&s.total>=5&&v!=="survival"&&(Qe.current.push(setTimeout(()=>O("ð Perfect â every question right"),800)),ve("levelup"));const pe=s.score===s.total&&s.total>=5||s.total>=10&&s.score/s.total>=.9||[7,30,100].includes(De),oe=He&&v==="daily"&&localStorage.getItem("biq_notif_enabled")!=="1"&&parseInt(localStorage.getItem("biq_notif_asks_v2")||"0",10)<2,fe=v==="daily"&&!!M&&Bt(M.date)<=1,Ee=pe&&Y>=5&&(v!=="daily"||!n&&!oe&&!fe);if(Ee&&Qe.current.push(setTimeout(()=>{if(!Za()){X("rate-prompt-skipped",{reason:"screen-changed",engine:"native",trigger:"results"});return}const he=Go();if(he){X("rate-prompt-skipped",{reason:he,engine:"native",trigger:"results"});return}X("rate-prompt-shown",{engine:"native",trigger:"results"}),Qo()},3500)),v==="classic"&&s.score&&s.total===10&&s.score>(V.bestScore||0)){const he=!V.bestScore;Qe.current.push(setTimeout(()=>O(he?`ð¯ First score: ${s.score}/10!`:`ð¯ New personal best: ${s.score}/10!`),1400)),ve("hardCorrect")}if(v==="hotstreak"&&s.score>(V.bestHotStreak||0)&&s.score>=5){const he=!V.bestHotStreak;Qe.current.push(setTimeout(()=>O(he?`â¡ Hot Streak record: ${s.score}!`:`â¡ New Hot Streak best: ${s.score}!`),1400)),ve("hardCorrect")}v==="classic"&&s.wrongAnswers&&s.wrongAnswers.length===1&&s.score>=8&&Qe.current.push(setTimeout(()=>O("ð Great comeback â only missed one after a slow start"),1600)),v==="hotstreak"&&s.score>=10&&U&&U!=="All"&&Qe.current.push(setTimeout(()=>O(`ðï¸ ${U} mastery â ${s.score} in a row`),1600)),v==="survival"&&s.score&&s.score>(V.bestSurvival||0)&&s.score>=10&&(Qe.current.push(setTimeout(()=>O(`ðª New Survival record â ${s.score} questions`),1400)),Pe(he=>({...he,bestSurvival:s.score})));const Ve=!Mn&&V.gamesPlayed>=4&&s.score>=9&&v==="classic"&&!(He&&Ee)&&Vo();Ve&&(Bn(!0),Qe.current.push(setTimeout(()=>{if(!Za()){X("rate-prompt-skipped",{reason:"screen-changed",trigger:"classic"});return}Jo(),X("rate-prompt-shown",{engine:"web",trigger:"classic"}),gt("ask"),ke(!0)},1800)));try{const he=localStorage.getItem("biq_save_nudge_shown")==="1",dt=v==="classic"&&s.score>(V.bestScore||0)||v==="survival"&&s.score>(V.bestStreak||0),na=v==="daily"||dt,fn=He&&v==="daily"&&localStorage.getItem("biq_notif_enabled")!=="1"&&parseInt(localStorage.getItem("biq_notif_asks_v2")||"0",10)<2,_e=Ho(s.score,s.total,v),hn=_e>0&&qt(Ge).level.name!==qt(Ge+_e).level.name,Nl=v==="daily"&&!!M&&Bt(M.date)<=1;n&&!he&&na&&!Ve&&!fn&&!hn&&!Nl&&localStorage.setItem("biq_save_nudge_shown","1")}catch{}const Mt=Ho(s.score,s.total,v);if(Lt(Mt),v==="daily"){const he=mo||new Date,dt=St(he),na=Ko(he);Ne(na,JSON.stringify({score:s.score,wrongAnswers:s.wrongAnswers||[],allAnswers:s.allAnswers||[]})),e?.id&&($.rpc("upsert_daily_score",{p_ymd:dt,p_score:s.score}).then(({error:_e})=>{_e&&(console.warn("[daily sync]",_e.message),Le(_e,{tags:{area:"daily-sync"}}))}).catch(_e=>{console.warn("[daily sync]",_e?.message||_e),Le(_e,{tags:{area:"daily-sync"}})}),s.wrongAnswers&&s.wrongAnswers.length>0&&$.rpc("upsert_daily_wrong_answers",{p_ymd:dt,p_wrongs:s.wrongAnswers}).then(({error:_e})=>{_e&&(console.warn("[daily wa sync]",_e.message),Le(_e,{tags:{area:"daily-wa-sync"}}))}).catch(_e=>{console.warn("[daily wa sync]",_e?.message||_e),Le(_e,{tags:{area:"daily-wa-sync"}})}),s.allAnswers&&s.allAnswers.length>0&&$.rpc("upsert_daily_all_answers",{p_ymd:dt,p_answers:s.allAnswers}).then(({error:_e})=>{_e&&(console.warn("[daily aa sync]",_e.message),Le(_e,{tags:{area:"daily-aa-sync"}}))}).catch(_e=>{console.warn("[daily aa sync]",_e?.message||_e),Le(_e,{tags:{area:"daily-aa-sync"}})})),ta(_e=>({..._e,[dt]:s.score}));const fn=St(new Date);if(dt!==fn)try{window.dispatchEvent(new CustomEvent("biq:archive-completed",{detail:{game:"daily7",ymd:dt}}))}catch{}if(dt===fn){S(!0),ne(s.score);try{window.dispatchEvent(new CustomEvent("biq:daily-completed",{detail:{positive:!0}}))}catch{}if(M&&Bt(M.date)<=1){const _e={mine:s.score,theirs:M.score,name:M.name,yesterday:Bt(M.date)===1};pr("played",M)&&$.rpc("record_challenge_event",{p_event:"played",p_date:M.date,p_score:M.score,p_name:M.name||null,p_my_score:s.score,p_sender:M.from||null}).then(({error:hn})=>{hn&&console.warn("[challenge played]",hn.message)}),Qe.current.push(setTimeout(()=>Me(_e),1800)),je()}}Hn(null),ve("heavy"),rt("daily_complete")}v==="hotstreak"&&s.score>J&&(re(s.score),Ne("biq_hotstreak_best",String(s.score)));try{const he=typeof s.total=="number"?s.total:ye?.length||0,dt=(ye||[]).slice(0,Math.max(0,he));Si(dt)}catch{}vt(s),At(s.wrongAnswers||[]),u("results")},[v,V,De,U,Mn,ho,J,wo,O,mo,ye,M,je,Lt,n,d,Ge,rn]),Zi=l.useCallback(s=>{kt(f=>{const h={...f,...s};return Ne("biq_settings",JSON.stringify(h)),h})},[]),Xi=l.useCallback(()=>{Yu(),O("â Question history cleared")},[O]),el=l.useCallback(({error:s})=>{if(s){O("â ï¸ Couldn't delete account â please try again");return}Pe({gamesPlayed:0,bestScore:0,bestStreak:0}),S(!1),ne(null),ta({}),re(0),Xt(0),ja(0),I(null),O("Your account has been deleted")},[O]),tl=l.useCallback(async()=>
300{if(e?.id){const{error:f}=await $.rpc("reset_user_stats");if(f){console.warn("[reset_user_stats]",f.message),O("Couldn't reset stats â try again when online");return}}const s={gamesPlayed:0,bestScore:0,bestStreak:0};Pe(s),S(!1),ne(null),ta({}),ja(0),Xt(0),Fa(0),re(0);try{Ne("biq_stats",JSON.stringify(s));const f=["biq_xp","biq_login_streak","biq_iq_history","biq_hotstreak_best"];for(let h=0;h<localStorage.length;h++){const C=localStorage.key(h);C&&(/^biq_daily_\d{4}-\d{2}-\d{2}$/.test(C)||/^biq_wordle_/.test(C))&&f.push(C)}for(const h of f)try{localStorage.removeItem(h)}catch{}}catch{}O("â Stats cleared")},[O,e?.id]);l.useEffect(()=>{document.body.classList.remove("light"),document.documentElement.classList.remove("light");try{Ze.isNativePlatform?.()&&yu.setStyle({style:qr.Light}).catch(()=>{})}catch{}},[]);const Xe=["quiz","local-game","local-results"].includes(o),ct=Xe||["wordle","trail","mystery","stadiums"].includes(o),on=l.useRef(null),Fo=l.useRef(null),Zn=l.useRef(!1);l.useEffect(()=>{const s=()=>{Zn.current=!0};return window.addEventListener("biq:daily-completed",s),window.addEventListener("biq:stadiums-completed",s),()=>{window.removeEventListener("biq:daily-completed",s),window.removeEventListener("biq:stadiums-completed",s)}},[]),l.useEffect(()=>{!e?.id||o!=="home"||ca(e.id,"acct-home",X)},[e?.id,o]),l.useEffect(()=>{ct&&(le(()=>import("./ResultsScreen-DTl_HEaG.js"),__vite__mapDeps([40,12,4,38,14,16,17,41,42,27,15,13,43,18,1,19,20,21,22,23,24,25,26,28,29])).catch(()=>{}),le(()=>import("./ModeResults-BFApqkXw.js"),__vite__mapDeps([44,12,4,41,42,13,14,15,16,17,18,1,19,20,21,22,23,24,25,26,27,28,29])).catch(()=>{}))},[ct]),l.useEffect(()=>{if(!ct)return;let s;try{s=!!localStorage.getItem("biq_first_game_played")}catch{return}if(s&&!e?.id)return;const f=()=>{try{localStorage.getItem("biq_first_game_played")||(localStorage.setItem("biq_first_game_played","1"),X("first-game-played",{mode:v||o}))}catch{}ca(e?.id,"acct-game-played",X,{mode:v||o})},h={once:!0,capture:!0,passive:!0};return window.addEventListener("pointerdown",f,h),window.addEventListener("keydown",f,h),()=>{window.removeEventListener("pointerdown",f,!0),window.removeEventListener("keydown",f,!0)}},[ct,v,o,e?.id]),l.useEffect(()=>{if(ct)try{if(!localStorage.getItem("biq_first_game_started")){localStorage.setItem("biq_first_game_started","1");let s="app";try{const f=new URLSearchParams(mr);s=f.get("game")?"door":f.get("c")?"challenge":f.get("club")?"club-door":f.get("quiz")?"quiz-door":f.get("join")||/^\/join\//.test(window.location.pathname)?"invite":/^\/(footle|c)(\/|$)/.test(window.location.pathname)?"link":"app"}catch{}X("first-game-reached",{mode:v||o,entry:s})}ca(e?.id,"acct-game-reached",X,{mode:v})}catch{}if(ct)on.current=Date.now(),Fo.current=v||o,Zn.current=!1;else if(on.current){const s=Math.round((Date.now()-on.current)/1e3),f=o==="results"||Zn.current===!0;if(on.current=null,!f&&s>=3)try{X("game-abandon",{mode:Fo.current||"unknown",secs:s})}catch{}}try{ct?document.body.classList.add("in-focused-play"):document.body.classList.remove("in-focused-play")}catch{}return()=>{try{document.body.classList.remove("in-focused-play")}catch{}}},[Xe,o,ct]);const al=l.useMemo(()=>v==="truefalse"&&Array.isArray(ye)?ye.filter(s=>s&&s.cat!=="chaos"):ye,[v,ye]),nl=l.useMemo(()=>qt(Ge),[Ge]),rl=l.useMemo(()=>Il(V,Ge,Math.max(Aa||0,De||0)),[V,Ge,De,Aa]);l.useEffect(()=>{const s=f=>{const h=f?.detail;if(h){if(typeof h.xp=="number"&&ja(h.xp),h.stats&&typeof h.stats=="object"&&Pe(C=>({...C,...h.stats})),h.dailyScores&&typeof h.dailyScores=="object"){ta(h.dailyScores);const C=St(new Date);C in h.dailyScores&&(S(!0),ne(h.dailyScores[C]))}if(h.loginStreak&&typeof h.loginStreak=="object"){const C=h.loginStreak;let y=0,F=0;try{y=parseInt(localStorage.getItem("biq_xp")||"0",10)||0}catch{}try{F=(JSON.parse(localStorage.getItem("biq_stats")||"{}")||{}).shieldsUsed||0}catch{}const D=bs(C,Er(),ys(y,F));Xt(D),Fa(Y=>Math.max(Y||0,Number(C.best)||0,D));try{localStorage.setItem("biq_login_streak",JSON.stringify({streak:Number(C.streak)||0,lastDay:Number(C.lastDay)||0,best:Math.max(Number(C.best)||0,D)}))}catch{}}}};return window.addEventListener("biq:hydrated",s),()=>window.removeEventListener("biq:hydrated",s)},[]),l.useMemo(()=>qf(),[V.gamesPlayed,De]);const[Xn,No]=l.useState(null),ol=l.useCallback((s,f)=>{No(f),u(s)},[]),Ae=l.useCallback(()=>{No(null),u("home"),x("home"),G(null),Be([]),vt(null),At([]),Vn(null),La(null),Ea(null)},[o]),aa=(()=>{try{return!He&&!(window.matchMedia?.("(display-mode: standalone)")?.matches||window.navigator.standalone===!0)}catch{return!1}})(),sl=l.useCallback(async s=>{if(!e||n){const C=String(s||"").toUpperCase().replace(/[^A-HJ-NP-Z2-9]/g,"").slice(0,6);if(C.length<4)return d("online"),{ok:!1,error:""};const y=await ls(C);if(y.found===!1)return{ok:!1,error:"No room with that code â check with your friend"};if(y.found&&!y.joinable)return{ok:!1,error:y.state==="ended"?"That game has finished":"This room is full"};try{localStorage.setItem("biq_pending_join",JSON.stringify({c:C,at:Date.now()}))}catch{}return k(C),{ok:!1,error:""}}const f=String(s||"").trim().toUpperCase();if(f.length!==6)return{ok:!1,error:"Enter the 6-character room code"};const h=await sd({p_code:f,p_name:a?.username||E?.name||"Player",p_avatar:za(a,E)});return h.error?{ok:!1,error:h.code==="53300"?"This room is full":h.code==="P0002"?"No room with that code â check with your friend":h.code==="42P01"?"This room isn't accepting joins right now":h.error||"Couldn't join room"}:(j(h.code||f),u("online-stage1-lobby"),{ok:!0})},[e,n,a?.username,E?.name,d,k]),[er,Ra]=l.useState(null),tr=l.useCallback(async()=>
300{if(aa&&!(o==="online-stage1-lobby"&&N)){window.location.assign("/");return}if(o==="online-stage1-lobby"&&N){const s=N;Ra({onConfirm:async()=>{try{await id({p_code:s})}catch{}j(""),Ae()}});return}Ae()},[o,N,Ae]),[Lo,Ta]=l.useState(null),ar=l.useCallback(s=>{Ta(s?.id||null),T(!0),$e("online"),O(s?.username?`Room ready â inviting ${s.username}`:"Room ready â share the invite link")},[O,$e]),[Eo,Io]=l.useState(null),sn=l.useCallback(s=>{s?.id&&(Io(s.id),u("friend-profile"))},[]);l.useEffect(()=>{const s=()=>{u("home"),x("home")},f=C=>{u("home"),x(C?.detail?.tab||"home")},h=C=>{const y=C?.detail?.id;y&&sn({id:y})};return window.addEventListener("biq:go-home",s),window.addEventListener("biq:auth-dismissed",f),window.addEventListener("biq:open-friend",h),()=>{window.removeEventListener("biq:go-home",s),window.removeEventListener("biq:auth-dismissed",f),window.removeEventListener("biq:open-friend",h)}},[]);const nr=l.useCallback(()=>{u("home"),x("profile"),Io(null)},[]),{notifOpen:il,setNotifOpen:qo,notifRequests:ll,notifInvites:cl,notifCount:ln,respondFriendRequest:dl,joinInvite:ul,dismissInvite:fl,sendPlayInvite:Ro,openNotifs:cn}=au({user:e,isGuest:n,showToast:O,setPendingJoinCode:k}),hl=nu({screen:o,inGame:Xe}),ml=l.useCallback(()=>Yr(!0),[]),gl=l.useCallback(()=>Yr(!1),[]),pl=l.useCallback(()=>Zr(!0),[]),yl=l.useCallback(()=>Zr(!1),[]),bl=l.useCallback(()=>Xr(!0),[]),vl=l.useCallback(()=>Xr(!1),[]),Et=l.useCallback(()=>$e("daily"),[$e]);l.useCallback(s=>{$e(s)},[$e]);const To=l.useRef(!1),Ma=l.useRef(null);l.useEffect(()=>{if(To.current)return;let s=null,f=null;try{const h=new URLSearchParams(window.location.search);s=h.get("eq"),f=h.get("ea")}catch{}if(s){To.current=!0;try{const h=new URL(window.location.href);h.searchParams.delete("eq"),h.searchParams.delete("ea"),window.history.replaceState({},"",h.pathname+h.search+h.hash)}catch{}return(async()=>{try{const{QB:h}=await Ct(),C=h.find(pe=>pe.id===s);if(!C||!Array.isArray(C.o)){Et();return}const y=parseInt(f,10),D=Number.isInteger(y)&&y>=0&&y<C.o.length&&y===C.a,Y=C.o[C.a];O(D?`â ${Y} â correct. Here's today's Daily 7`:`â It was ${Y} â today's seven are waiting`,4200),Ma.current=setTimeout(()=>{Ma.current=null,Et()},2100)}catch{Et()}})(),()=>{Ma.current&&(clearTimeout(Ma.current),Ma.current=null)}}},[Et,O]);const wl=l.useMemo(()=>Math.min(3,Math.max(0,Math.floor(Ge/200)-(V.shieldsUsed||0))),[Ge,V.shieldsUsed]),[Mo,dn]=l.useState(!1),Bo=l.useRef(null),Po=l.useRef(null),Do=l.useRef(null),zo=l.useRef(null);ft({isOpen:Mo,onClose:()=>dn(!1),ref:Bo}),ft({isOpen:!!qe,onClose:()=>{X("rate-prompt-dismissed",{view:Oe,how:"escape"}),ke(!1)},ref:Po});const xl=l.useCallback(()=>zt(null),[]);ft({isOpen:!!Zt,onClose:xl,ref:zo}),ft({isOpen:!!(g&&(!e||n)&&!ct),onClose:b,ref:_}),ft({isOpen:!!er,onClose:()=>Ra(null),ref:Do});const Sl=l.useCallback(()=>zt("wordle"),[]),kl=l.useCallback(()=>zt("hotstreak"),[]),_l=l.useCallback(()=>zt("truefalse"),[]),Cl=l.useCallback(()=>zt(v),[v]),Oo=l.useRef(null);ft({isOpen:!!Fe,onClose:()=>Me(null),ref:Oo});const Wo=l.useRef(null),Uo=!!(ge&&M&&Bt(M.date)<=1&&!Re),un=l.useCallback(()=>ce(!1),[]);ft({isOpen:Uo,onClose:un,ref:Wo});const $o=l.useRef(null);l.useEffect(()=>{$o.current=()=>{if(!Fd()){if(o==="online-stage1-lobby"){tr();return}if(ct){let s=!1;try{s=!window.dispatchEvent(new CustomEvent("biq:hw-back",{cancelable:!0}))}catch{}s||Ae();return}if(o==="blocked-users"||o==="review"){u("settings");return}if(o==="daily-review"||o==="puzzle-review"){u("home");return}if(o==="friend-profile"){nr();return}if(o==="stump"){nn(null),Ae();return}if(o==="online-stage1"){b(),T(!1),Ta(null),Ae(),x("online");return}if(o!=="home"){Ae();return}if(L!=="home"){x("home");return}ua.minimizeApp().catch(()=>{})}}}),l.useEffect(()=>{if(!He)return;let s=ua.addListener("backButton",()=>{try{$o.current?.()}catch{}});return()=>{Promise.resolve(s).then(f=>f?.remove?.()).catch(()=>{})}},[]);const jl=l.useCallback(async s=>{let f;try{f=await ki(s)}catch(h){console.warn("[playDailyForDate]",h?.message||h),O("â ï¸ Couldn't load questions â check your connection");return}if(!f||f.length===0){O("No questions available for that day");return}ve("soft"),Hn(s),G("daily"),H("All"),Be(f),u("quiz")},[O]),Al=l.useCallback((s,f)=>{const h=St(s);let C=[],y=[];try{const F=localStorage.getItem(`biq_daily_${h}`);
300if(F){const D=JSON.parse(F);Array.isArray(D?.wrongAnswers)&&(C=D.wrongAnswers),Array.isArray(D?.allAnswers)&&(y=D.allAnswers)}}catch{}Jt({date:s,score:f,wrongAnswers:C,allAnswers:y}),u("daily-review")},[]),Fl=l.useCallback(s=>{if(s?.kind!=="won"&&s?.kind!=="lost")return;const f=new Date,h=St(f);let C=[],y=s.kind;try{const F=localStorage.getItem(`biq_wordle_${h}`);if(F){const D=JSON.parse(F);Array.isArray(D?.guesses)&&(C=D.guesses),typeof D?.status=="string"&&(y=D.status)}}catch{}Kt({date:f,guesses:C,status:y}),u("puzzle-review")},[]);return t.jsxs(t.Fragment,{children:[t.jsxs("main",{className:"app",children:[be&&t.jsx("h1",{className:"sr-only",children:be}),t.jsx("div",{className:"sr-only",role:"status","aria-live":"polite","aria-atomic":"true",children:de}),t.jsx("div",{className:"sbar"}),P&&t.jsx("div",{className:"starting-quiz",role:"status","aria-live":"polite",children:t.jsx(xt,{label:"Getting your questions"})}),!it&&!w&&t.jsx(Zd,{onDone:s=>{R(!0),s===!0&&setTimeout(()=>{try{u("wordle")}catch{}},0);try{const f=localStorage.getItem("biq_settings");if(f){const h=JSON.parse(f);kt(C=>({...C,...h}))}}catch{}}}),(it||w)&&t.jsxs(t.Fragment,{children:[q&&a&&t.jsx(fu,{user:e,authProfile:a,onEvent:X,onSaved:s=>{$n(f=>({...f||{},name:s}));try{localStorage.removeItem("biq_needs_username")}catch{}Z(!1),ca(e?.id,"acct-username",X)}}),aa&&!ct&&t.jsxs(t.Fragment,{children:[t.jsx(Hl,{signedIn:!!e&&!n,onProfile:()=>{u("home"),x("profile")}}),t.jsx(dd,{tab:L,active:ct||o==="results"?null:o==="settings"?"settings":L,setTab:x,setScreen:u,dailyDone:Re,notifCount:ln,onOpenNotifs:e?cn:void 0})]}),!aa&&t.jsx(ld,{onHomeClick:tr,tab:L,active:Xe||o==="results"?null:o==="settings"?"settings":L,setTab:x,setScreen:u,dailyDone:Re,showToast:O,notifCount:ln,onOpenNotifs:e?cn:void 0}),!aa&&!Xe&&!(o==="home"&&L==="home")&&t.jsxs("div",{className:"hdr",children:[!["settings","home","online-stage1","online-stage1-lobby","club-quiz","results","local-setup","local-results","wordle","trail","mystery","stadiums","league-quiz","stump","daily-review","puzzle-review","review","blocked-users","friend-profile"].includes(o)&&t.jsxs("button",{className:"logo",onClick:tr,style:{background:"none",border:"none",padding:0,font:"inherit",color:"inherit",cursor:"pointer"},"aria-label":"Home",children:["Ball ",t.jsx("em",{children:"IQ"})]}),o==="home"&&t.jsxs("div",{className:"hdr-actions",style:{marginLeft:"auto",display:"flex",gap:8},children:[e&&t.jsx(jf,{count:ln,onClick:cn,className:"icon-btn hdr-ic"}),t.jsx("button",{className:"icon-btn hdr-ic","aria-label":"Settings",onClick:()=>u("settings"),children:t.jsx(Wr,{size:18,strokeWidth:2.25,"aria-hidden":"true"})})]})]}),so&&t.jsx("div",{className:"toast",role:"status","aria-live":"polite",children:so}),Ti&&t.jsx("div",{style:{position:"fixed",top:0,right:0,bottom:0,left:0,inset:0,background:"rgba(0,0,0,0.75)",zIndex:998,display:"flex",alignItems:"flex-end",animation:"fadeIn 0.2s ease"},onClick:Pi,children:t.jsxs("div",{ref:Bi,tabIndex:-1,role:"dialog","aria-modal":"true","aria-label":"Add your name to the challenge",style:{width:"100%",maxHeight:"85vh",overflowY:"auto",WebkitOverflowScrolling:"touch",background:"var(--bg)",borderRadius:"20px 20px 0 0",padding:"28px 24px calc(40px + env(safe-area-inset-bottom, 34px))",textAlign:"center",animation:"slideUp 0.3s cubic-bezier(0.22,1,0.36,1)"},onClick:s=>s.stopPropagation(),children:[t.jsx("div",{style:{fontSize:44,marginBottom:10},children:"â½"}),t.jsx("div",{style:{fontSize:20,fontWeight:900,marginBottom:8,color:"var(--t1)"},children:"Who should we say it's from?"}),t.jsxs("div",{style:{fontSize:14,color:"var(--t2)",lineHeight:1.6,marginBottom:20},children:["Your friends see ",t.jsxs("b",{style:{color:"var(--t1)"},children:["âbeat my ",z||0,"/7â"]})," with your name on it."]}),t.jsxs("form",{onSubmit:s=>{s.preventDefault(),uo(fo)},children:[t.jsx("input",{autoFocus:!0,value:fo,onChange:s=>Mi(s.target.value),maxLength:22,placeholder:"First name","aria-label":"Your name",enterKeyHint:"send",autoComplete:"given-name",style:{width:"100%",padding:"14px 16px",fontSize:16,borderRadius:12,border:"1px solid var(--line)",background:"var(--c2)",color:"var(--t1)",fontFamily:"inherit",marginBottom:14,textAlign:"center"}}),t.jsx("button",{className:"btn btn-p",type:"submit",style:{marginBottom:10},children:"Share challenge"})]}),t.jsx("button",{className:"btn btn-s",type:"button",onClick:()=>uo(""),children:"Share without a name"})]})}),qe&&t.jsx("div",{style:{position:"fixed",top:0,right:0,bottom:0,left:0,inset:0,background:"rgba(0,0,0,0.75)",zIndex:998,display:"flex",alignItems:"flex-end",animation:"fadeIn 0.3s ease"},onClick:()=>{X("rate-prompt-dismissed",{view:Oe,how:"backdrop"}),ke(!1)},children:t.jsx("div",{ref:Po,tabIndex:-1,role:"dialog","aria-modal":"true","aria-label":"Rate Ball IQ",style:{width:"100%",maxHeight:"85vh",overflowY:"auto",WebkitOverflowScrolling:"touch",background:"var(--bg)",borderRadius:"20px 20px 0 0",padding:"28px 24px calc(48px + env(safe-area-inset-bottom, 34px))",textAlign:"center"},onClick:s=>s.stopPropagation(),children:Oe==="ask"?t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{fontSize:48,marginBottom:12},children:"â½"}),t.jsxs("div",{style:{fontSize:20,fontWeight:900,marginBottom:8,color:"var(--t1)"},children:["Enjoying ",Ce,"?"]}),t.jsx("div",{style:{fontSize:14,color:"var(--t2)",lineHeight:1.7,marginBottom:24},children:"We'd love to know how it's going for you."}),t.jsx("button",{className:"btn btn-p",style:{marginBottom:10},onClick:()=>{X("rate-prompt-loving"),gt("store")},children:"Loving it! ð"}),t.jsx("button",{className:"btn btn-s",onClick:()=>{X("rate-prompt-not-really"),ke(!1);try{window.location.href=`mailto:[email protected]?subject=${encodeURIComponent(Ce+" feedback")}&body=${encodeURIComponent(`What could be better? 301 302`)}`}catch{}O("Thanks â tell us what we can fix ð")},children:"Not really"})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{width:56,height:56,margin:"0 auto 12px",borderRadius:16,background:"rgba(255,193,7,0.14)",border:"1px solid rgba(255,193,7,0.3)",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--gold)"},children:t.jsx(gc,{size:26,strokeWidth:2.25,"aria-hidden":"true"})}),t.jsx("div",{style:{fontSize:20,fontWeight:900,marginBottom:8,color:"var(--t1)"},children:"Glad you're enjoying it!"}),t.jsx("div",{style:{fontSize:14,color:"var(--t2)",lineHeight:1.7,marginBottom:24},children:"A quick rating helps other football fans find the app â and takes just 5 seconds!"}),t.jsxs("button",{className:"btn btn-p",style:{marginBottom:10},onClick:()=>{ke(!1),Bl()?(X("rate-store-tap",{store:"apple"}),window.open(`${zr()}?action=write-review`,"_blank")):Pl()?(X("rate-store-tap",{store:"play"}),window.open(Or,"_blank")):(X("rate-store-unreachable",{store:"none"}),O(`â Search '${Ce}' on the App Store or Google Play`))},children:["Rate ",Ce," â"]}),t.jsx("button",{className:"btn btn-s",onClick:()=>{X("rate-prompt-dismissed",{view:"store",how:"maybe-later"}),ke(!1)},children:"Maybe later"})]})})}),Zt&&t.jsx("div",{style:{position:"fixed",top:0,right:0,bottom:0,left:0,inset:0,background:"rgba(0,0,0,0.75)",zIndex:998,display:"flex",alignItems:"flex-end",animation:"fadeIn 0.2s ease"},onClick:()=>zt(null),children:t.jsxs("div",{ref:zo,tabIndex:-1,role:"dialog","aria-modal":"true","aria-label":wn[Zt]?.title||"How to play",style:{width:"100%",maxHeight:"85vh",overflowY:"auto",WebkitOverflowScrolling:"touch",background:"var(--bg)",borderRadius:"20px 20px 0 0",padding:"24px 20px calc(40px + env(safe-area-inset-bottom, 34px))",animation:"slideUp 0.3s cubic-bezier(0.22,1,0.36,1)"},onClick:s=>s.stopPropagation(),children:[t.jsx("div",{style:{fontSize:18,fontWeight:800,marginBottom:16,color:"var(--t1)"},children:wn[Zt]?.title}),wn[Zt]?.steps.map((s,f)=>t.jsxs("div",{style:{display:"flex",gap:12,alignItems:"flex-start",marginBottom:12},children:[t.jsx("div",{style:{width:24,height:24,borderRadius:"50%",background:"var(--accent)",color:"#0a1a00",display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:800,flexShrink:0},children:f+1}),t.jsx("div",{style:{fontSize:14,color:"var(--t2)",lineHeight:1.5},children:s})]},f)),t.jsx("button",{onClick:()=>zt(null),style:{width:"100%",padding:"14px",background:"var(--s2)",border:"none",borderRadius:14,fontSize:15,fontWeight:700,color:"var(--t1)",marginTop:8,cursor:"pointer"},children:"Got it â"})]})}),er&&t.jsx("div",{style:{position:"fixed",top:0,right:0,bottom:0,left:0,inset:0,background:"rgba(0,0,0,0.78)",zIndex:1e3,display:"flex",alignItems:"flex-end",justifyContent:"center",animation:"fadeIn 0.2s ease"},onClick:()=>Ra(null),children:t.jsxs("div",{ref:Do,tabIndex:-1,role:"dialog","aria-modal":"true","aria-label":"Leave room confirmation",style:{width:"100%",maxWidth:480,maxHeight:"85vh",overflowY:"auto",WebkitOverflowScrolling:"touch",background:"var(--bg)",borderTop:"1px solid var(--border)",borderRadius:"22px 22px 0 0",padding:"22px 22px 28px",animation:"slideUp 0.3s cubic-bezier(0.22,1,0.36,1)"},onClick:s=>s.stopPropagation(),children:[t.jsx("div",{style:{fontSize:18,fontWeight:800,color:"var(--text)",marginBottom:8},children:"Leave the room?"}),t.jsx("div",{style:{fontSize:14,color:"var(--t2)",lineHeight:1.5,marginBottom:18},children:"You'll exit the multiplayer lobby and return to home. Other players will see you leave."}),t.jsx("button",{onClick:()=>{const s=er?.onConfirm;Ra(null),s?.()},style:{width:"100%",padding:14,background:"var(--red)",color:"#fff",border:"none",borderRadius:12,fontFamily:"inherit",fontSize:15,fontWeight:800,cursor:"pointer",marginBottom:8,WebkitTextFillColor:"#fff"},children:"Leave room"}),t.jsx("button",{onClick:()=>Ra(null),style:{width:"100%",padding:14,background:"var(--s2)",color:"var(--text)",border:"1px solid var(--border)",borderRadius:12,fontFamily:"inherit",fontSize:15,fontWeight:700,cursor:"pointer"},children:"Stay"})]})}),Uo&&t.jsx("div",{style:{position:"fixed",top:0,right:0,bottom:0,left:0,inset:0,background:"rgba(0,0,0,0.78)",zIndex:1e3,display:"flex",alignItems:"flex-end",justifyContent:"center",animation:"fadeIn 0.2s ease"},onClick:un,children:t.jsxs("div",{ref:Wo,tabIndex:-1,role:"dialog","aria-modal":"true","aria-label":"Daily 7 challenge",style:{width:"100%",maxWidth:480,maxHeight:"85vh",overflowY:"auto",WebkitOverflowScrolling:"touch",background:"var(--bg)",borderTop:"1px solid var(--border)",borderRadius:"22px 22px 0 0",padding:"22px 22px calc(28px + env(safe-area-inset-bottom, 0px))",textAlign:"center",animation:"slideUp 0.3s cubic-bezier(0.22,1,0.36,1)"},onClick:s=>s.stopPropagation(),children:[t.jsx("div",{"aria-hidden":"true",style:{width:56,height:56,borderRadius:16,margin:"0 auto 12px",display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(88,204,2,0.14)",border:"1px solid rgba(88,204,2,0.30)"},children:t.jsx(br,{size:26,strokeWidth:2.25,color:"#58CC02"})}),t.jsx("div",{style:{fontSize:20,fontWeight:900,color:"var(--t1)",marginBottom:6},children:M.name?`${M.name} scored ${M.score}/7`:`A friend scored ${M.score}/7`}),t.jsx("div",{style:{fontSize:14,color:"var(--t2)",lineHeight:1.5,marginBottom:20},children:Bt(M.date)===0?"Same day, same 7 questions. Beat that score and it's settled.":"That was yesterday's Daily 7 â play today's and settle it."}),t.jsx("button",{onClick:()=>{un(),Et()},style:{width:"100%",minHeight:50,padding:"14px",background:"var(--accent)",color:"var(--grn-ink)",border:"none",borderRadius:14,boxShadow:"0 10px 26px -8px rgba(88,204,2,0.55)",fontFamily:"inherit",fontSize:16,fontWeight:800,cursor:"pointer",WebkitTextFillColor:"#0a1a00"},children:"Play the Daily 7"}),t.jsx("button",{onClick:un,style:{marginTop:12,background:"none",border:"none",color:"var(--t3)",fontFamily:"inherit",fontSize:13.5,fontWeight:700,cursor:"pointer",padding:"8px"},children:"Not now"})]})}),Fe&&t.jsx("div",{style:{position:"fixed",top:0,right:0,bottom:0,left:0,inset:0,background:"rgba(0,0,0,0.78)",zIndex:1e3,display:"flex",alignItems:"flex-end",justifyContent:"center",animation:"fadeIn 0.2s ease"},onClick:()=>Me(null),children:t.jsxs("div",{ref:Oo,tabIndex:-1,role:"dialog","aria-modal":"true","aria-label":"Challenge result",style:{width:"100%",maxWidth:480,maxHeight:"85vh",overflowY:"auto",WebkitOverflowScrolling:"touch",background:"var(--bg)",borderTop:"1px solid var(--border)",borderRadius:"22px 22px 0 0",padding:"22px 22px calc(28px + env(safe-area-inset-bottom, 0px))",textAlign:"center",animation:"slideUp 0.3s cubic-bezier(0.22,1,0.36,1)"},onClick:s=>s.stopPropagation(),children:[t.jsx("div",{style:{fontSize:44,marginBottom:8},"aria-hidden":"true",children:Fe.mine>
302Fe.theirs?"ð":Fe.mine===Fe.theirs?"ð¤":"ð¤"}),t.jsx("div",{style:{fontSize:20,fontWeight:900,color:"var(--t1)",marginBottom:16},children:Fe.mine>Fe.theirs?`You beat ${Fe.name||"your friend"}!`:Fe.mine===Fe.theirs?`Level with ${Fe.name||"your friend"}`:`${Fe.name||"Your friend"} takes this one`}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,marginBottom:20},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px 14px",background:"var(--s2)",border:"1px solid var(--border)",borderRadius:12},children:[t.jsx("span",{style:{fontSize:14,fontWeight:700,color:"var(--t1)"},children:"You"}),t.jsxs("span",{style:{fontSize:16,fontWeight:900,color:"var(--t1)"},children:[Fe.mine,"/7"]})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px 14px",background:"var(--s2)",border:"1px solid var(--border)",borderRadius:12},children:[t.jsxs("span",{style:{fontSize:14,fontWeight:700,color:"var(--t2)"},children:[Fe.name||"Your friend",Fe.yesterday?" (yesterday's score)":""]}),t.jsxs("span",{style:{fontSize:16,fontWeight:900,color:"var(--t2)"},children:[Fe.theirs,"/7"]})]})]}),t.jsx("button",{onClick:()=>{Me(null),co()},style:{width:"100%",padding:14,background:"var(--accent)",color:"var(--grn-ink)",border:"none",borderRadius:999,boxShadow:"0 8px 22px -8px rgba(88,204,2,0.55)",fontFamily:"inherit",fontSize:15,fontWeight:800,cursor:"pointer",marginBottom:8,WebkitTextFillColor:"#0a1a00"},children:"Send it back ð"}),t.jsx("button",{onClick:()=>Me(null),style:{width:"100%",padding:14,background:"var(--s2)",color:"var(--text)",border:"1px solid var(--border)",borderRadius:12,fontFamily:"inherit",fontSize:15,fontWeight:700,cursor:"pointer"},children:"Done"})]})}),Dn&&t.jsx(In,{}),Ya&&t.jsxs("div",{style:{position:"fixed",top:0,right:0,bottom:0,left:0,inset:0,background:"rgba(0,0,0,0.85)",zIndex:999,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",animation:"fadeIn 0.3s ease"},children:[t.jsx(In,{}),t.jsxs("div",{style:{textAlign:"center",padding:"0 32px"},children:[t.jsx("div",{style:{marginBottom:16,animation:"iconPop 0.6s cubic-bezier(0.34,1.56,0.64,1)",display:"flex",justifyContent:"center"},children:Ya.Icon&&t.jsx(Ya.Icon,{size:80,strokeWidth:1.6,color:"var(--gold)"})}),t.jsx("div",{style:{fontSize:14,color:"var(--gold)",fontWeight:700,letterSpacing:.3,marginBottom:8},children:"Level Up!"}),t.jsx("div",{style:{fontSize:32,fontWeight:900,color:"#fff",letterSpacing:"-0.5px",marginBottom:12},children:Ya.name}),t.jsx("div",{style:{fontSize:14,color:"rgba(255,255,255,0.6)"},children:"Keep playing to reach the next level"})]}),t.jsx("button",{onClick:()=>Pn(null),style:{marginTop:40,padding:"12px 32px",background:"var(--accent)",color:"var(--grn-ink)",border:"none",borderRadius:999,boxShadow:"0 8px 22px -8px rgba(88,204,2,0.55)",fontSize:15,fontWeight:700,cursor:"pointer"},children:"Let's Go â½"})]}),eo&&t.jsxs("div",{className:"streak-toast",role:"status","aria-live":"polite",children:[t.jsx("span",{children:"ð¥"}),t.jsxs("span",{children:[t.jsxs("strong",{children:[eo," day streak!"]})," Keep it up"]})]}),Mo&&t.jsx("div",{className:"diff-overlay",onClick:()=>dn(!1),children:t.jsxs("div",{ref:Bo,tabIndex:-1,className:"diff-sheet",onClick:s=>s.stopPropagation(),role:"dialog","aria-modal":"true",children:[t.jsx("div",{className:"diff-sheet-title",children:"Multiplayer"}),t.jsx("div",{className:"diff-sheet-sub",children:"Who's joining?"}),t.jsxs("div",{className:"diff-options",children:[t.jsxs("button",{className:"diff-option",onClick:()=>{if(dn(!1),!e||n){d("online");return}u("online-stage1")},children:[t.jsx("span",{className:"diff-option-icon",children:"ð"}),t.jsxs("div",{className:"diff-option-body",children:[t.jsx("div",{className:"diff-option-name",children:"Online Multiplayer"}),t.jsx("div",{className:"diff-option-desc",children:"Real-time with up to 3 friends"})]})]}),t.jsxs("button",{className:"diff-option diff-option-local",onClick:()=>{dn(!1),$e("local")},children:[t.jsx("span",{className:"diff-option-icon",children:"ð¤"}),t.jsxs("div",{className:"diff-option-body",children:[t.jsx("div",{className:"diff-option-name",children:"Local Multiplayer"}),t.jsx("div",{className:"diff-option-desc",children:"Pass the phone, same room"})]})]})]})]})}),!Xe&&o==="home"&&t.jsx("div",{className:"tab-pane",style:L==="home"?void 0:xn,children:t.jsx(ut,{name:"home",children:t.jsx(pu,{showSettings:!aa,profile:E,loginStreak:De,streakPulsing:Ii,bestLoginStreak:Aa,stats:V,xp:Ge,dailyHistory:Un,dailyDone:Re,dailyScore:z,setTab:x,setNameEditNonce:Q,setScreen:u,showToast:O,viewPuzzleStatus:Fl,viewD
302ailyScore:Al,startMode:$e,shareCard:En,challenge:M&&Bt(M.date)<=1&&!Re?M:null,onPlayChallenge:Et,onDismissChallenge:je,setOnlineAutoCreate:T,notifCount:ln,onOpenNotifs:e?cn:void 0,clubPacks:Ke,clubAbbr:Tr,launchClubQuiz:Jn,firstSession:Ca})})}),!Xe&&o==="home"&&t.jsx("div",{className:"tab-pane",style:L==="daily"?void 0:xn,children:t.jsx(ut,{name:"daily",children:t.jsx(_u,{loginStreak:De,bestLoginStreak:Aa,streakRepair:zn,playArchive:ol,profile:E,xp:Ge,shieldCount:wl,dailyHistory:Un,startMode:$e,setScreen:u,dailyDone:Re,dailyScore:z,playDailyForDate:jl})})}),!Xe&&o==="home"&&t.jsx("div",{className:"tab-pane",style:L==="online"?void 0:xn,children:t.jsx(ut,{name:"online",children:t.jsx(ku,{needsAccount:!e||n,userId:e&&!n?e.id:null,startMode:$e,setOnlineAutoCreate:T,onChallenge:ar,onOpenFriend:sn,onJoinCode:sl,displayName:(()=>{const s=f=>!f||f==="Player"||/^player_/i.test(f);return a?.username&&!s(a.username)?a.username:E.name&&!s(E.name)?E.name:"You"})(),avatarUrl:a?.avatar_url,avatarId:za(a,E)})})}),!Xe&&o==="home"&&t.jsx("div",{className:"tab-pane",style:L==="profile"?void 0:xn,children:t.jsx(ut,{name:"profile",children:t.jsx(me.Suspense,{fallback:t.jsx(xt,{label:"Loading profile"}),children:t.jsx(vu,{profile:E,setProfile:$n,stats:V,xp:Ge,loginStreak:De,bestLoginStreak:Aa,level:nl.level,earnedBadges:rl,onShareProfile:Ri,onSaveCard:qi,onToast:O,onChallenge:ar,onOpenFriend:sn,onPlayLeague:an,onPlayDaily:Et,onSetCardLeague:Nt,nameEditNonce:W,isActiveTab:L==="profile"})})})}),!Xe&&o==="settings"&&t.jsx(Nu,{settings:at,onUpdate:Zi,onClearStats:tl,onClearSeen:Xi,onBack:Ae,onShowPrivacy:ml,onShowHelp:pl,onShowKnownIssues:bl,onAccountDeleted:el,onOpenReview:()=>u("review"),onShowBlocked:()=>u("blocked-users"),notifEnabled:Ui,onToggleNotif:Hi,notifSupported:pt(),notifBlocked:$i,webPushOn:po,onToggleWebPush:yo,webPushAvailable:Rt(),webPushBlocked:Wa()==="denied"}),!Xe&&o==="blocked-users"&&t.jsx(ut,{name:"blocked-users",onExit:()=>u("settings"),children:t.jsx(me.Suspense,{fallback:t.jsx(xt,{label:"Loading"}),children:t.jsx(xu,{onBack:()=>u("settings"),onToast:O})})}),!Xe&&o==="review"&&t.jsx(ut,{name:"review",onExit:()=>u("settings"),children:t.jsx(me.Suspense,{fallback:t.jsx(xt,{label:"Loading review"}),children:t.jsx(bu,{onBack:()=>u("settings")})})}),!Xe&&o==="daily-review"&&Ft&&t.jsx(Lu,{date:Ft.date,score:Ft.score,wrongAnswers:Ft.wrongAnswers,allAnswers:Ft.allAnswers,dailyHistory:Un,loginStreak:De,onBack:()=>u("home")}),!Xe&&o==="puzzle-review"&&wt&&t.jsx(Eu,{date:wt.date,guesses:wt.guesses,status:wt.status,onBack:()=>u("home")}),!Xe&&o==="friend-profile"&&Eo&&t.jsx(ut,{name:"friend-profile",onExit:nr,children:t.jsx(me.Suspense,{fallback:t.jsx(xt,{label:"Loading profile"}),children:t.jsx(wu,{friendId:Eo,onBack:nr,onChallenge:ar,onToast:O})})}),Gn&&t.jsx(Mf,{onPick:s=>bo(Gn,s),onSkip:()=>bo(Gn,null),onCancel:Di}),Ni&&t.jsx(qu,{onClose:gl}),Li&&t.jsx(Nf,{onClose:yl}),Ei&&t.jsx(Ef,{onClose:vl}),kn&&M&&!Ue&&t.jsxs("div",{style:{position:"fixed",top:0,left:0,right:0,zIndex:1090,display:"flex",alignItems:"center",gap:10,padding:"10px 14px",background:"var(--accent)",boxShadow:"0 2px 10px rgba(0,0,0,0.25)",animation:"fadeIn 0.2s ease"},children:[t.jsx("span",{style:{fontSize:20},"aria-hidden":"true",children:"ð¯"}),t.jsxs("div",{style:{flex:1,fontSize:13,fontWeight:700,color:"#0a1a00",lineHeight:1.3},children:[M.name?`${M.name} challenged you`:"You've got a Daily 7 challenge"," â open it in the app"]}),t.jsx("button",{onClick:()=>{try{const s=M,f=`${s.score}.${s.date}${s.name?"."+encodeURIComponent(s.name):""}`;window.location.href=`app.balliq://balliq.app/c/${f}`}catch{}},style:{flexShrink:0,padding:"7px 14px",background:"#0a1a00",color:"var(--accent)",border:"none",borderRadius:9,fontFamily:"inherit",fontSize:13,fontWeight:800,cursor:"pointer"},children:"Open"}),t.jsx("button",{onClick:()=>mt(!0),"aria-label":"Dismiss",style:{flexShrink:0,width:28,height:28,display:"flex",alignItems:"center",justifyContent:"center",background:"transparent",color:"#0a1a00",border:"none",fontSize:18,fontWeight:700,cursor:"pointer"},children:"Ã"})]}),g&&(!e||n)&&!ct&&t.jsx("div",{className:"modal-overlay",onClick:b,children:t.jsxs("div",{ref:_,tabIndex:-1,onClick:s=>s.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Join the game",className:"modal-box",children:[t.jsx("div",{className:"modal-grab","aria-hidden":"true"}),t.jsxs("div",{className:"modal-head",children:[t.jsx("div",{"aria-hidden":"true",style:{width:52,height:52,borderRadius:15,margin:"0 auto 4px",display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(88,204,2,0.14)",border:"1px solid rgba(88,204,2,0.30)"},children:t.jsx(ic,{size:24,strokeWidth:2.25,color:"#58CC02"})}),t.jsx("div",{className:"modal-title",children:"Join the game"}),t.jsxs("div",{className:"modal-body",children:["Your friendâs code ",t.jsx("strong",{style:{fontFamily:"'JetBrains Mono','SF Mono',ui-monospace,Menlo,monospace",color:"var(--accent)"},children:g})," is ready. Weâll drop you straight into the room."]}
302)]}),t.jsxs("div",{className:"modal-btns",children:[kn&&t.jsxs("button",{type:"button",className:"btn-3d modal-btn",onClick:()=>{try{window.location.href=`app.balliq://balliq.app/join/${g}`}catch{}},children:[t.jsx(mc,{size:16,strokeWidth:2.4,"aria-hidden":"true",style:{verticalAlign:"-3px",marginRight:6}}),"Got the app? Open it there"]}),t.jsx("button",{type:"button",className:kn?"btn-3d ghost modal-btn":"btn-3d modal-btn",onClick:xe,disabled:K,style:K?{opacity:.6}:void 0,children:K?"Joiningâ¦":t.jsxs(t.Fragment,{children:[t.jsx(bc,{size:16,strokeWidth:2.4,"aria-hidden":"true",style:{verticalAlign:"-3px",marginRight:6}}),"Play as guest"]})}),ue&&t.jsx("div",{role:"alert",style:{fontSize:12,color:"var(--red)",lineHeight:1.4,textAlign:"center",padding:"2px 8px"},children:ue}),t.jsx("button",{type:"button",className:"btn-3d ghost modal-btn",onClick:()=>{try{d?.("online")}catch{}},children:"Sign up or sign in"}),t.jsx("button",{type:"button",className:"modal-btn modal-quiet",onClick:b,children:"Not now"})]})]})}),o==="club-quiz"&&t.jsx(Iu,{onStart:Jn,onBack:Ae}),o==="league-quiz"&&t.jsx(Sf,{onStart:an,onBack:Ae,catStats:V?.catStats,cardLeague:V?.cardLeague}),o==="local-setup"&&t.jsx(Tu,{onStart:So,onBack:Ae}),o==="local-game"&&tn&&t.jsx(Mu,{config:tn,onComplete:Wi,onExit:Ae}),o==="online-stage1"&&t.jsx("div",{className:"mp-cap",children:t.jsx(ut,{name:"online-entry",onExit:()=>{b(),T(!1),Ta(null),Ae(),x("online")},children:t.jsx(me.Suspense,{fallback:t.jsx(xt,{label:"Loading multiplayer"}),children:t.jsx(Ou,{onBack:()=>{b(),T(!1),Ta(null),Ae(),x("online")},onLobbyEnter:async s=>{if(j(s),u("online-stage1-lobby"),Lo){const f=Lo;Ta(null);const h=await Ro(f,s);O(h?"Challenge sent â they've been notified":"Couldn't notify them â share the invite link instead")}},defaultName:r?Ls():a?.username||E?.name||"",defaultAvatar:za(a,E),autoJoinCode:g,onAutoJoinConsumed:b,autoCreate:B,onAutoCreateConsumed:()=>T(!1)})})})}),o==="online-stage1-lobby"&&N&&t.jsx("div",{className:"mp-cap",children:t.jsx(ut,{name:"mp-lobby",onExit:()=>{j(""),u("home"),x("online")},children:t.jsx(me.Suspense,{fallback:t.jsx(xt,{label:"Loading lobby"}),children:t.jsx(Wu,{onReport:Ia,code:N,onPlayDaily:Re?void 0:()=>{j(""),Et()},onExit:()=>{j(""),u("home"),x("online")},defaultName:r?Ls():a?.username||E?.name||"",defaultAvatar:za(a,E),onRematch:async(s,f)=>{j(s);const h=(f||[]).filter(Boolean);if(!h.length)return;const C=(await Promise.all(h.map(y=>Ro(y,s)))).filter(Boolean).length;O(C?C===1?"Rematch sent â they've been notified":`Rematch sent â ${C} players notified`:"Rematch room ready â share the link to bring them back")}},N)})})}),o==="wordle"&&t.jsx(Cu,{date:Xn||void 0,onBack:Ae,userId:e?.id,onHowToPlay:Sl,onReport:Ia,services:Yi}),o==="trail"&&(()=>{const s=Xn||new Date,f=vr(s);return f?t.jsx(ut,{name:"trail",onExit:Ae,children:t.jsx(me.Suspense,{fallback:t.jsx(xt,{label:"Loading Transfer Trail"}),children:t.jsx(Pu,{player:f,date:s,onBack:Ae,onReport:Ia,services:Ao})})}):(setTimeout(Ae,0),null)})(),o==="mystery"&&t.jsx(ut,{name:"mystery",onExit:Ae,children:t.jsx(me.Suspense,{fallback:t.jsx(xt,{label:"Loading Mystery Player"}),children:t.jsx(zu,{date:Xn||void 0,onExit:Ae,services:Ao})})}),o==="stadiums"&&t.jsx(ut,{name:"stadiums",onExit:Ae,children:t.jsx(me.Suspense,{fallback:t.jsx(xt,{label:"Loading Stadiums"}),children:t.jsx(Du,{onExit:Ae})})}),o==="stump"&&Kn&&t.jsx(Ru,{row:Kn,onPlayFull:()=>{const s=Kn?.cat;nn(null),u("home"),s&&an(s)},onHome:()=>{nn(null),Ae()}}),o==="quiz"&&v==="hotstreak"&&t.jsx(mf,{questions:ye,onComplete:Yn,onBack:Ae,onHowToPlay:kl,rulesOpen:Zt==="hotstreak"}),o==="quiz"&&v==="truefalse"&&t.jsx(gf,{questions:al,onComplete:Yn,onBack:Ae,onHowToPlay:_l}),o==="quiz"&&v!=="hotstreak"&&v!=="truefalse"&&t.jsxs("div",{className:"quiz-screen-wrap",children:[v==="legends"&&t.jsxs("div",{style:{marginTop:14,marginBottom:4,textAlign:"center",padding:"10px 0 6px",background:"linear-gradient(135deg,rgba(251,191,36,0.08),rgba(251,191,36,0.03))",borderRadius:12,border:"1px solid rgba(251,191,36,0.15)"},children:[t.jsx("div",{style:{fontSize:10,fontFamily:"'Inter',sans-serif",color:"var(--gold)",fontWeight:700,letterSpacing:.3,marginBottom:4},children:"ð Legends & History"}),t.jsx("div",{style:{fontSize:12,color:"var(--t3)",fontStyle:"italic"},children:"Take your time. These are the stories that made the game."})]}),v==="chaos"&&t.jsxs("div",{style:{marginTop:14,marginBottom:4,textAlign:"center",padding:"10px 0 6px",background:"linear-gradient(135deg,rgba(88,204,2,0.10),rgba(255,106,0,0.06))",borderRadius:12,border:"1px solid rgba(88,204,2,0.22)"},children:[t.jsx("div",{style:{fontSize:10,fontFamily:"'Inter',sans-serif",color:"var(--grn-soft)",fontWeight:700,letterSpacing:.3,marginBottom:4},children:"ð Chaos"}),t.jsx("div",{style:{fontSize:12,color:"var(--t3)",fontStyle:"italic"},children:"Quotes, moments & madness â take a beat and think."})]}),Te&&Ke[Te]&&t.jsxs("div",{style:{marginTop:14,marginBottom:6,display:"flex",alignItems:"center",gap:14,padding:"12px 14px",background:_t(Ke[Te].color,.14),border:`1px solid ${_t(Ke[Te].color,.4)}`,borderRadius:14},children:[t.jsx("div",{style:{width:46,height:46,borderRadius:12,flexShrink:0,background:Ke[Te].color,display:"flex",alignItems:"center",justifyContent:"center",boxShadow:`0 2px 8px ${_t(Ke[Te].color,.45)}`},children:t.jsx("span",{style:{fontWeight:900,fontSize:14,letterSpacing:.3,color:Ka(Ke[Te].color)},children:Tr[Te]||_i(Ke[Te].name)})}),t.jsxs("div",{style:{flex:1,minWidth:0},children:[t.jsx("div",{style:{fontSize:11,color:"var(--t3)",fontWeight:600,marginBottom:2},children:"Club Quiz"}),t.jsx("div",{style:{fontSize:17,fontWeight:800,color:"var(--t1)",letterSpacing:"-0.2px"},children:Ke[Te].name})]})]}),!Te&&We&&nt[We]&&t.jsxs("div",{style:{marginTop:14,marginBottom:6,display:"flex",alignItems:"center",gap:14,padding:"12px 14px",background:_t(nt[We].color,.14),border:`1px solid ${_t(nt[We].color,.4)}`,borderRadius:14},children:[t.jsx("div",{style:{width:46,height:46,borderRadius:12,flexShrink:0,background:nt[We].color,display:"flex",alignItems:"center",justifyContent:"center",boxShadow:`0 2px 8px ${_t(nt[We].color,.45)}`},children:t.jsx("span",{style:{fontWeight:900,fontSize:14,letterSpacing:.3,color:Ka(nt[We].color)},children:nt[We].abbr})}),t.jsxs("div",{style:{flex:1,minWidth:0},children:[t.jsx("div",{style:{fontSize:11,color:"var(--t3)",fontWeight:600,marginBottom:2},children:"League Quiz"}),t.jsx("div",{style:{fontSize:17,fontWeight:800,color:"var(--t1)",letterSpacing:"-0.2px"},children:nt[We].name})]})]}),t.jsx(tu,{questions:ye,mode:v,timerEnabled:at.timer!==!1,timerSecondsOverride:Te?15:void 0,soundEnabled:at.sound===!0,hintsEnabled:at.hints!==!1,onComplete:Yn,onReport:Ia,survivalBest:V.bestStreak,quizLabel:Te&&Ke[Te]?Ke[Te].name:We&&nt[We]?nt[We].name:void 0,onBack:()=>{v==="daily"?(u("home"),x("home")):Te?u("club-quiz"):We?u("league-quiz"):(u("home"),x("home"))},onHowToPlay:wn[v]?Cl:void 0},v)]}),o==="local-results"&&t.jsx(Bu,{result:Oi,onHome:Ae,onRetry:()=>{tn&&So(tn)},onShare:()=>en(0,0,"local")}),o==="results"&&Ie&&v==="hotstreak"&&t.jsx(Au,{result:Ie,prevBest:J,onRetry:()=>$e("hotstreak"),onShare:()=>en(Ie.score,Ie.total,"hotstreak"),onHome:Ae}),o==="results"&&Ie&&v==="truefalse"&&t.jsx(Fu,{result:Ie,onRetry:()=>$e("truefalse"),onShare:()=>en(Ie.score,Ie.total,"truefalse"),onHome:Ae}),o==="results"&&Ie&&v!=="hotstreak"&&v!=="truefalse"&&t.jsx(ju,{result:Ie,mode:v,cardDelta:_a,onHome:Ae,survivalBest:V.bestStreak,wrongAnswers:lt,onReport:Ia,askedQuestions:ye,dailyDone:qa,photoNudge:e?.id&&!a?.avatar_url&&!Vi?t.jsxs("div",{style:{marginTop:16,padding:"14px 14px 12px",borderRadius:16,background:"var(--s1)",border:"1px solid var(--border)",display:"flex",alignItems:"center",gap:12},children:[t.jsx("div",{style:{width:44,height:44,flexShrink:0},children:t.jsx(Fn,{value:a?.avatar_id,url:a?.avatar_url,name:a?.username})}),t.jsxs("div",{style:{flex:1,minWidth:0},children:[t.jsx("div",{style:{fontSize:14,fontWeight:800,color:"var(--t1)",letterSpacing:"-0.2px"},children:"Put a face to the name"}),t.jsx("div",{style:{fontSize:12.5,color:"var(--t2)",lineHeight:1.4,marginTop:2},children:"Your friends see this next to your score."})]}),t.jsx("button",{onClick:()=>{jo(),X("photo-nudge-tap"),x("profile"),u("home")},style:{flexShrink:0,padding:"9px 15px",borderRadius:999,background:"var(--accent)",border:"none",color:"var(--grn-ink)",WebkitTextFillColor:"var(--grn-ink)",fontFamily:"inherit",fontSize:13,fontWeight:800,cursor:"pointer"},children:"Add"}),t.jsx("button",{onClick:()=>{jo(),X("photo-nudge-dismiss")}
302,"aria-label":"Not now",style:{flexShrink:0,padding:"9px 6px",background:"none",border:"none",color:"var(--t3)",fontFamily:"inherit",fontSize:13,fontWeight:700,cursor:"pointer"},children:"Later"})]}):null,classicBest:V.bestScore||0,label:Te&&Ke[Te]?Ke[Te].name:We&&nt[We]?nt[We].name:null,onShare:()=>v==="daily"?co():en(Ie?.score,Ie?.total,v,{streak:Ie?.bestStreak,club:Te,league:We}),onRetry:()=>{ur("retry"),$e(v)},onPlayFootle:()=>u("wordle"),dailyOpen:!Re,onPlayDaily:Et}),!aa&&!Xe&&o==="home"&&t.jsxs("nav",{className:"tab-bar",ref:hl,children:[t.jsx("span",{className:"tab-pill","aria-hidden":"true",style:{transform:`translateX(${Math.max(0,["home","online","daily","profile"].indexOf(L))*100}%)`},children:t.jsx("i",{})}),[{id:"home",Icon:zs,label:"Home"},{id:"online",Icon:Ds,label:"Multiplayer"},{id:"daily",Icon:Ps,label:"History",badge:!1},{id:"profile",Icon:Os,label:"Profile"}].map(({id:s,Icon:f,label:h,badge:C})=>t.jsxs("button",{className:`tab-item${L===s?" active":""}`,"aria-current":L===s?"page":void 0,onClick:()=>x(s),children:[t.jsx("span",{className:"tab-svg",children:t.jsx(f,{size:22,strokeWidth:2.25,"aria-hidden":"true"})}),t.jsx("span",{className:"tab-label",children:h}),C&&t.jsx("span",{className:"tab-badge"})]},s))]})]})]}),t.jsx(Bf,{}),t.jsx(_f,{}),t.jsx(Af,{open:il,requests:ll,invites:cl,onClose:()=>qo(!1),onRespond:dl,onJoinInvite:ul,onDismissInvite:fl,onOpenFriend:s=>{qo(!1),sn(s)}})]})}function Df(){const{user:e,isGuest:a,loading:n,profile:r,authPromptOpen:i,authPromptReason:c,closeAuthPrompt:d}=Rn(),o=!!e&&!a&&!r,[u,m]=l.useState(!1);l.useEffect(()=>{if(!o){m(!1);return}const j=setTimeout(()=>m(!0),2e3);return()=>clearTimeout(j)},[o]);const p=n||o&&!u,g=l.useRef(!1);l.useEffect(()=>{},[]),l.useEffect(()=>{p||g.current||(g.current=!0,requestAnimationFrame(()=>{requestAnimationFrame(()=>{ac.hide({fadeOutDuration:220}).then(()=>void 0).catch(()=>{})})}))},[p]);const[k,b]=l.useState(!0);l.useEffect(()=>{if(p){b(!0);return}if(typeof window<"u"&&window.matchMedia?window.matchMedia("(prefers-reduced-motion: reduce)").matches:!1){b(!1);return}const _=setTimeout(()=>b(!1),240);return()=>clearTimeout(_)},[p]);const N=k?t.jsxs("div",{className:`biq-splash${p?"":" is-leaving"}`,"aria-label":`Loading ${Ce}`,children:[t.jsxs("div",{className:"biq-splash-mark",children:["Ball ",t.jsx("em",{children:"IQ"})]}),t.jsx("div",{className:"biq-splash-dot"})]}):null;return p?N:t.jsxs(t.Fragment,{children:[N,t.jsx(Pf,{}),i&&t.jsx(Su,{asOverlay:!0,promptReason:c,onClose:d})]})}function zf(){const e=Ze.isNativePlatform?.();return t.jsxs(t.Fragment,{children:[!e&&t.jsx(qd,{}),t.jsx(qs,{children:t.jsx(Df,{})}),!e&&t.jsx(Cd,{})]})}function Of(){return t.jsx(qs,{children:t.jsx(td,{children:t.jsx(zf,{})})})}const Rh=Object.freeze(Object.defineProperty({__proto__:null,default:Of},Symbol.toStringTag,{value:"Module"}));export{Cn as $,ua as A,Ke as B,Ha as C,qh as D,Tr as E,sc as F,Ds as G,lc as H,Cf as I,Ka as J,_i as K,pa as L,_t as M,kh as N,nf as O,Fn as P,Sh as Q,Lh as R,gc as S,Sa as T,yc as U,Eh as V,yi as W,Nn as X,wh as Y,bc as Z,Tn as _,ft as a,ba as a0,ht as a1,Ye as a2,bn as a3,Si as a4,Rr as a5,xc as a6,wc as a7,lf as a8,_h as a9,Pr as aA,af as aB,vh as aC,yh as aD,bh as aE,ha as aF,Ua as aG,Ss as aH,Rh as aI,pc as aa,rt as ab,nt as ac,qn as ad,dh as ae,uh as af,fh as ag,id as ah,hh as ai,mh as aj,Ih as ak,jh as al,Ir as am,Fh as an,oh as ao,pf as ap,xh as aq,Nh as ar,ph as as,gh as at,Ah as au,sd as av,sh as aw,lh as ax,ch as ay,ih as az,za as b,xa as c,fc as d,Dt as e,Sc as f,kf as g,ic as h,ni as i,ve as j,In as k,Ct as l,ur as m,X as n,pi as o,Hs as p,ss as q,Ga as r,$ as s,Zs as t,Rn as u,Ch as v,En as w,He as x,hf as y,ii as z};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.