@sensiblestats/widget-react 0.135.0 → 0.136.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/index.cjs +272 -238
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +139 -105
- package/dist/index.js.map +1 -1
- package/dist/styles.css +4 -0
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -38,7 +38,7 @@ __export(index_exports, {
|
|
|
38
38
|
module.exports = __toCommonJS(index_exports);
|
|
39
39
|
|
|
40
40
|
// src/StatsWidget.tsx
|
|
41
|
-
var
|
|
41
|
+
var import_react105 = require("react");
|
|
42
42
|
var import_widget_sdk38 = require("@sensiblestats/widget-sdk");
|
|
43
43
|
|
|
44
44
|
// src/strings/tag.ts
|
|
@@ -1337,7 +1337,7 @@ function parseOddsFormat(value) {
|
|
|
1337
1337
|
}
|
|
1338
1338
|
|
|
1339
1339
|
// src/version.generated.ts
|
|
1340
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1340
|
+
var WIDGET_REACT_VERSION = "0.136.0";
|
|
1341
1341
|
|
|
1342
1342
|
// src/config.ts
|
|
1343
1343
|
function hostTag(cfg) {
|
|
@@ -2285,6 +2285,9 @@ function toNbaInsightVM(insight) {
|
|
|
2285
2285
|
competition: str(insight.competitionName),
|
|
2286
2286
|
kickoffUtc: str(insight.kickoffUtc),
|
|
2287
2287
|
kickoffLabel: str(insight.kickoffLabel),
|
|
2288
|
+
homeTeamImage: str(insight.homeTeamImagePath),
|
|
2289
|
+
awayTeamImage: str(insight.awayTeamImagePath),
|
|
2290
|
+
competitionImage: str(insight.competitionImagePath),
|
|
2288
2291
|
quotedAtUtc: insight.quotedAtUtc,
|
|
2289
2292
|
addToSlipEnabled: insight.addToSlipEnabled === true,
|
|
2290
2293
|
disclaimer: str(insight.disclaimer),
|
|
@@ -7801,7 +7804,7 @@ function ChatFab({ label, busy = false, greeting, popupText, logoUrl, onOpen, on
|
|
|
7801
7804
|
}
|
|
7802
7805
|
|
|
7803
7806
|
// src/components/ChatPanel.tsx
|
|
7804
|
-
var
|
|
7807
|
+
var import_react104 = require("react");
|
|
7805
7808
|
|
|
7806
7809
|
// src/components/ChatHeader.tsx
|
|
7807
7810
|
var import_react48 = require("react");
|
|
@@ -8368,10 +8371,17 @@ function NbaPrice({ vm, selectionKey, label, ui, slip }) {
|
|
|
8368
8371
|
function Head({ vm, chip, ui, monitor }) {
|
|
8369
8372
|
const fixture = vm.homeTeamName && vm.awayTeamName ? `${vm.homeTeamName} ${ui.venue.home} ${vm.awayTeamName}` : vm.competition;
|
|
8370
8373
|
const meta = [fixture, vm.kickoffLabel].filter(Boolean).join(" \xB7 ");
|
|
8374
|
+
const crested = Boolean(vm.homeTeamImage && vm.awayTeamImage && vm.homeTeamName && vm.awayTeamName);
|
|
8375
|
+
const metaNode = crested ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("p", { className: "ss-w-nba-meta", children: [
|
|
8376
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Crest, { kind: "team", url: vm.homeTeamImage, name: vm.homeTeamName, abbr: "" }),
|
|
8377
|
+
` ${vm.homeTeamName} ${ui.venue.home} `,
|
|
8378
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Crest, { kind: "team", url: vm.awayTeamImage, name: vm.awayTeamName, abbr: "" }),
|
|
8379
|
+
` ${vm.awayTeamName}${vm.kickoffLabel ? ` \xB7 ${vm.kickoffLabel}` : ""}`
|
|
8380
|
+
] }) : meta ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "ss-w-nba-meta", children: meta }) : null;
|
|
8371
8381
|
const pinnable = monitor?.enabled === true && vm.evidence.kind !== "settle_recap";
|
|
8372
8382
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "ss-w-nba-head", children: [
|
|
8373
8383
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "ss-w-nba-head-l", children: [
|
|
8374
|
-
|
|
8384
|
+
metaNode,
|
|
8375
8385
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "ss-w-nba-title", children: vm.title })
|
|
8376
8386
|
] }),
|
|
8377
8387
|
chip || pinnable ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "ss-w-bi-meta-right", children: [
|
|
@@ -10802,7 +10812,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
10802
10812
|
}
|
|
10803
10813
|
|
|
10804
10814
|
// src/components/MonitorTabs.tsx
|
|
10805
|
-
var
|
|
10815
|
+
var import_react74 = require("react");
|
|
10806
10816
|
|
|
10807
10817
|
// src/components/MarketAccordion.tsx
|
|
10808
10818
|
var import_widget_sdk24 = require("@sensiblestats/widget-sdk");
|
|
@@ -11106,6 +11116,9 @@ function MonitorSkeleton({ pin, monitor, ui }) {
|
|
|
11106
11116
|
] });
|
|
11107
11117
|
}
|
|
11108
11118
|
|
|
11119
|
+
// src/components/NbaMonitorCard.tsx
|
|
11120
|
+
var import_react68 = require("react");
|
|
11121
|
+
|
|
11109
11122
|
// src/sportLabel.ts
|
|
11110
11123
|
var CODE = { football: "football", basketball: "nba", nba: "nba", americanfootball: "nfl", nfl: "nfl", tennis: "tennis" };
|
|
11111
11124
|
var sportLabel = (ui, sport) => {
|
|
@@ -11416,6 +11429,7 @@ function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
|
|
|
11416
11429
|
}
|
|
11417
11430
|
function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
11418
11431
|
const [openId, setOpenId] = (0, import_react66.useState)(null);
|
|
11432
|
+
const [brokenShots, setBrokenShots] = (0, import_react66.useState)(/* @__PURE__ */ new Set());
|
|
11419
11433
|
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "ss-w-props-list", children: players.map((given) => {
|
|
11420
11434
|
const p = livePlayer(bundle, given);
|
|
11421
11435
|
const isOpen = openId === p.playerId;
|
|
@@ -11431,7 +11445,16 @@ function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
|
11431
11445
|
"aria-expanded": isOpen,
|
|
11432
11446
|
onClick: () => setOpenId(isOpen ? null : p.playerId),
|
|
11433
11447
|
children: [
|
|
11434
|
-
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
11448
|
+
p.imagePath && !brokenShots.has(p.playerId) ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
11449
|
+
"img",
|
|
11450
|
+
{
|
|
11451
|
+
className: `ss-w-props-shot ss-w-props-shot--${side}`,
|
|
11452
|
+
src: p.imagePath,
|
|
11453
|
+
alt: "",
|
|
11454
|
+
"aria-hidden": "true",
|
|
11455
|
+
onError: () => setBrokenShots((set) => new Set(set).add(p.playerId))
|
|
11456
|
+
}
|
|
11457
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: `ss-w-props-jn ss-w-props-jn--${side}`, children: p.jerseyNumber ?? "" }),
|
|
11435
11458
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("span", { className: "ss-w-props-pn", children: [
|
|
11436
11459
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "ss-w-props-name", children: p.name }),
|
|
11437
11460
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "ss-w-props-meta", children: meta })
|
|
@@ -11574,10 +11597,17 @@ function city(teamName, nickname) {
|
|
|
11574
11597
|
if (!name || !name.endsWith(nickname)) return null;
|
|
11575
11598
|
return name.slice(0, name.length - nickname.length).trim() || null;
|
|
11576
11599
|
}
|
|
11577
|
-
function
|
|
11600
|
+
function BadgeCrest({ url, abbreviation }) {
|
|
11601
|
+
const [failed, setFailed] = (0, import_react68.useState)(false);
|
|
11602
|
+
if (url && !failed) {
|
|
11603
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("img", { className: "ss-w-nbamon-badge ss-w-nbamon-badge--img", src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
11604
|
+
}
|
|
11605
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "ss-w-nbamon-badge", children: abbreviation });
|
|
11606
|
+
}
|
|
11607
|
+
function Side({ abbreviation, nickname, teamName, away, crestUrl }) {
|
|
11578
11608
|
const cityName = city(teamName, nickname);
|
|
11579
11609
|
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("span", { className: away ? "ss-w-nbamon-side" : "ss-w-nbamon-side ss-w-nbamon-side--home", children: [
|
|
11580
|
-
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
11610
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(BadgeCrest, { url: crestUrl, abbreviation }),
|
|
11581
11611
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("span", { className: "ss-w-nbamon-team", children: [
|
|
11582
11612
|
cityName && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "ss-w-nbamon-city", children: cityName }),
|
|
11583
11613
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "ss-w-nbamon-nick", children: nickname })
|
|
@@ -11647,13 +11677,13 @@ function NbaMonitorCard({ match, monitor, ui, slip }) {
|
|
|
11647
11677
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(PinToggle, { ui, monitor, pin: { kind: "match", matchId: match.matchId, sport: "basketball" } })
|
|
11648
11678
|
] }),
|
|
11649
11679
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "ss-w-nbamon-main", children: [
|
|
11650
|
-
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Side, { abbreviation: b.awayAbbreviation, nickname: b.awayNickname, teamName: match.awayTeamName, away: true }),
|
|
11680
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Side, { abbreviation: b.awayAbbreviation, nickname: b.awayNickname, teamName: match.awayTeamName, crestUrl: match.awayCrestUrl, away: true }),
|
|
11651
11681
|
scored ? /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("span", { className: "ss-w-mon-score", children: [
|
|
11652
11682
|
match.awayScore ?? 0,
|
|
11653
11683
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("i", { children: "\u2013" }),
|
|
11654
11684
|
match.homeScore ?? 0
|
|
11655
11685
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "ss-w-mon-vs", children: ui.venue.away }),
|
|
11656
|
-
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Side, { abbreviation: b.homeAbbreviation, nickname: b.homeNickname, teamName: match.homeTeamName })
|
|
11686
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Side, { abbreviation: b.homeAbbreviation, nickname: b.homeNickname, teamName: match.homeTeamName, crestUrl: match.homeCrestUrl })
|
|
11657
11687
|
] }),
|
|
11658
11688
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(NbaFormStrip, { match, monitor, ui }),
|
|
11659
11689
|
scored && /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_jsx_runtime78.Fragment, { children: [
|
|
@@ -11686,7 +11716,7 @@ function NbaMonitorCard({ match, monitor, ui, slip }) {
|
|
|
11686
11716
|
}
|
|
11687
11717
|
|
|
11688
11718
|
// src/components/NflFormSection.tsx
|
|
11689
|
-
var
|
|
11719
|
+
var import_react69 = require("react");
|
|
11690
11720
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
11691
11721
|
var outcomeOf = (g) => g.teamScore > g.opponentScore ? "win" : g.teamScore < g.opponentScore ? "loss" : "tie";
|
|
11692
11722
|
var signedSpread2 = (v) => v > 0 ? `+${v}` : String(v);
|
|
@@ -11738,7 +11768,7 @@ function H2hRow({ game, home, ui }) {
|
|
|
11738
11768
|
] });
|
|
11739
11769
|
}
|
|
11740
11770
|
function NflFormSection({ match, monitor, ui }) {
|
|
11741
|
-
const [segment, setSegment] = (0,
|
|
11771
|
+
const [segment, setSegment] = (0, import_react69.useState)("away");
|
|
11742
11772
|
const { live, open } = usePropsOpen(match, monitor, { sport: "americanfootball" });
|
|
11743
11773
|
const bundle = monitor.playerProps?.[monitorMatchKey("americanfootball", match.matchId)]?.bundle;
|
|
11744
11774
|
const form = bundle?.form;
|
|
@@ -11771,7 +11801,7 @@ function NflFormSection({ match, monitor, ui }) {
|
|
|
11771
11801
|
}
|
|
11772
11802
|
|
|
11773
11803
|
// src/components/NflPropsSection.tsx
|
|
11774
|
-
var
|
|
11804
|
+
var import_react70 = require("react");
|
|
11775
11805
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
11776
11806
|
var TRENDS_SHOWN = 3;
|
|
11777
11807
|
var SCORERS_SHOWN = 8;
|
|
@@ -11844,7 +11874,7 @@ function ShowMore({ label, onClick }) {
|
|
|
11844
11874
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("button", { type: "button", className: "ss-w-props-more", onClick, children: label });
|
|
11845
11875
|
}
|
|
11846
11876
|
function Trends({ bundle, facts, descriptor, ui, slip }) {
|
|
11847
|
-
const [all, setAll] = (0,
|
|
11877
|
+
const [all, setAll] = (0, import_react70.useState)(false);
|
|
11848
11878
|
const shown2 = all ? facts : facts.slice(0, TRENDS_SHOWN);
|
|
11849
11879
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("section", { className: "ss-w-props ss-w-props-trends", lang: ui.locale, children: [
|
|
11850
11880
|
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "ss-w-props-head", children: ui.nfl.propsTrends }),
|
|
@@ -11877,7 +11907,7 @@ function Trends({ bundle, facts, descriptor, ui, slip }) {
|
|
|
11877
11907
|
] });
|
|
11878
11908
|
}
|
|
11879
11909
|
function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
11880
|
-
const [all, setAll] = (0,
|
|
11910
|
+
const [all, setAll] = (0, import_react70.useState)(false);
|
|
11881
11911
|
const shown2 = all ? scorers : scorers.slice(0, SCORERS_SHOWN);
|
|
11882
11912
|
const cell2 = (name, column, price, stat) => price && stat ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(PropPrice, { price, label: "", ariaName: `${name}, ${column}`, player: name, stat, bundle, descriptor, ui, slip }) : /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "ss-w-props-scorer-none", children: "\u2014" });
|
|
11883
11913
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "ss-w-props-scorers", children: [
|
|
@@ -11904,7 +11934,7 @@ function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
|
11904
11934
|
] });
|
|
11905
11935
|
}
|
|
11906
11936
|
function NflPropsSection({ match, monitor, ui, slip }) {
|
|
11907
|
-
const [tab, setTab] = (0,
|
|
11937
|
+
const [tab, setTab] = (0, import_react70.useState)(null);
|
|
11908
11938
|
const descriptor = nflDescriptor(ui);
|
|
11909
11939
|
const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
|
|
11910
11940
|
if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
|
|
@@ -12090,7 +12120,7 @@ function NflMonitorCard({ match, monitor, ui, slip }) {
|
|
|
12090
12120
|
}
|
|
12091
12121
|
|
|
12092
12122
|
// src/components/TennisMonitorCard.tsx
|
|
12093
|
-
var
|
|
12123
|
+
var import_react72 = require("react");
|
|
12094
12124
|
var import_widget_sdk27 = require("@sensiblestats/widget-sdk");
|
|
12095
12125
|
|
|
12096
12126
|
// src/components/TennisFixtureRow.tsx
|
|
@@ -12351,7 +12381,7 @@ function TennisLiveScoreboard({ t, score, live, ui }) {
|
|
|
12351
12381
|
}
|
|
12352
12382
|
|
|
12353
12383
|
// src/components/TennisStatsTables.tsx
|
|
12354
|
-
var
|
|
12384
|
+
var import_react71 = require("react");
|
|
12355
12385
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
12356
12386
|
function formatStat(row, value, locale) {
|
|
12357
12387
|
if (value == null) return "\u2013";
|
|
@@ -12389,8 +12419,8 @@ function Tables({ table, labels, names, locale }) {
|
|
|
12389
12419
|
] });
|
|
12390
12420
|
}
|
|
12391
12421
|
function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey }) {
|
|
12392
|
-
const [tab, setTab] = (0,
|
|
12393
|
-
(0,
|
|
12422
|
+
const [tab, setTab] = (0, import_react71.useState)("match");
|
|
12423
|
+
(0, import_react71.useEffect)(() => {
|
|
12394
12424
|
setTab("match");
|
|
12395
12425
|
}, [resetKey]);
|
|
12396
12426
|
const sets = serveReturn.sets.filter((s) => s.table.serve.length + s.table.return.length > 0);
|
|
@@ -12421,7 +12451,7 @@ function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey })
|
|
|
12421
12451
|
] }),
|
|
12422
12452
|
today.rows.map((r) => {
|
|
12423
12453
|
const f = (v) => formatStat({ kind: "pct" }, v, locale);
|
|
12424
|
-
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
12454
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_react71.Fragment, { children: [
|
|
12425
12455
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "ss-w-ts-l", children: r.label }),
|
|
12426
12456
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("span", { className: "ss-w-ts-today-v ss-w-ts-today-v--a", children: [
|
|
12427
12457
|
f(r.p1Today),
|
|
@@ -12556,7 +12586,7 @@ function HeadToHead({ t, ui }) {
|
|
|
12556
12586
|
] });
|
|
12557
12587
|
}
|
|
12558
12588
|
function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
12559
|
-
const lastTables = (0,
|
|
12589
|
+
const lastTables = (0, import_react72.useRef)(null);
|
|
12560
12590
|
const t = match.tennis;
|
|
12561
12591
|
if (!t) return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(UnavailableCard, { match, monitor, ui, sport: "tennis" });
|
|
12562
12592
|
const preMatch = match.phase === "preMatch";
|
|
@@ -12636,7 +12666,7 @@ function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
|
12636
12666
|
}
|
|
12637
12667
|
|
|
12638
12668
|
// src/components/ScoreboardStrip.tsx
|
|
12639
|
-
var
|
|
12669
|
+
var import_react73 = require("react");
|
|
12640
12670
|
var import_widget_sdk28 = require("@sensiblestats/widget-sdk");
|
|
12641
12671
|
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
12642
12672
|
function nbaStatus(m, ui) {
|
|
@@ -12731,8 +12761,8 @@ function rowsFor(m) {
|
|
|
12731
12761
|
];
|
|
12732
12762
|
}
|
|
12733
12763
|
function useStripScroll(selectedKey) {
|
|
12734
|
-
const stripRef = (0,
|
|
12735
|
-
(0,
|
|
12764
|
+
const stripRef = (0, import_react73.useRef)(null);
|
|
12765
|
+
(0, import_react73.useEffect)(() => {
|
|
12736
12766
|
const strip = stripRef.current;
|
|
12737
12767
|
const pressed = strip?.querySelector('[aria-pressed="true"]');
|
|
12738
12768
|
if (!strip || !pressed) return;
|
|
@@ -12906,7 +12936,7 @@ function OddsLiveStrip({ m, ui }) {
|
|
|
12906
12936
|
] });
|
|
12907
12937
|
}
|
|
12908
12938
|
function MatchesPanel({ monitor, ui, slip, onAsk, discovery }) {
|
|
12909
|
-
const seedIndex = (0,
|
|
12939
|
+
const seedIndex = (0, import_react74.useMemo)(() => buildSeedIndex(discovery?.groups ?? []), [discovery?.groups]);
|
|
12910
12940
|
const tiles = orderTiles(
|
|
12911
12941
|
monitor.pins,
|
|
12912
12942
|
monitor.snapshot,
|
|
@@ -12978,7 +13008,7 @@ function TrendsPanel({ monitor, ui, slip }) {
|
|
|
12978
13008
|
}
|
|
12979
13009
|
|
|
12980
13010
|
// src/components/LivePanel.tsx
|
|
12981
|
-
var
|
|
13011
|
+
var import_react77 = require("react");
|
|
12982
13012
|
var import_widget_sdk35 = require("@sensiblestats/widget-sdk");
|
|
12983
13013
|
|
|
12984
13014
|
// src/scheduleView.ts
|
|
@@ -13153,20 +13183,20 @@ function LeagueGroup({ view, open, onToggle, disambiguate, rowCap, onShowAll, on
|
|
|
13153
13183
|
}
|
|
13154
13184
|
|
|
13155
13185
|
// src/components/MatchSheet.tsx
|
|
13156
|
-
var
|
|
13186
|
+
var import_react76 = require("react");
|
|
13157
13187
|
var import_widget_sdk33 = require("@sensiblestats/widget-sdk");
|
|
13158
13188
|
|
|
13159
13189
|
// src/useModalDialog.ts
|
|
13160
|
-
var
|
|
13190
|
+
var import_react75 = require("react");
|
|
13161
13191
|
var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
13162
13192
|
function useModalDialog(onClose, opts = {}) {
|
|
13163
|
-
const dialogRef = (0,
|
|
13164
|
-
const onCloseRef = (0,
|
|
13193
|
+
const dialogRef = (0, import_react75.useRef)(null);
|
|
13194
|
+
const onCloseRef = (0, import_react75.useRef)(onClose);
|
|
13165
13195
|
onCloseRef.current = onClose;
|
|
13166
|
-
const openerRef = (0,
|
|
13196
|
+
const openerRef = (0, import_react75.useRef)(opts.opener);
|
|
13167
13197
|
openerRef.current = opts.opener;
|
|
13168
13198
|
const restore = opts.restoreFocus ?? true;
|
|
13169
|
-
(0,
|
|
13199
|
+
(0, import_react75.useEffect)(() => {
|
|
13170
13200
|
const dialog = dialogRef.current;
|
|
13171
13201
|
const root = dialog?.getRootNode();
|
|
13172
13202
|
const focusedAtMount = root?.activeElement ?? null;
|
|
@@ -13177,7 +13207,7 @@ function useModalDialog(onClose, opts = {}) {
|
|
|
13177
13207
|
if (target instanceof HTMLElement) target.focus({ preventScroll: true });
|
|
13178
13208
|
};
|
|
13179
13209
|
}, []);
|
|
13180
|
-
(0,
|
|
13210
|
+
(0, import_react75.useEffect)(() => {
|
|
13181
13211
|
const onKey = (e) => {
|
|
13182
13212
|
if (e.key !== "Escape") return;
|
|
13183
13213
|
e.stopPropagation();
|
|
@@ -13218,8 +13248,8 @@ function kickoffDate(kickoffUnix, lang, timeZone) {
|
|
|
13218
13248
|
function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose, opener }) {
|
|
13219
13249
|
const { dialogRef, onKeyDown } = useModalDialog(onClose, { opener });
|
|
13220
13250
|
const log = useEventLog();
|
|
13221
|
-
const titleId = (0,
|
|
13222
|
-
const [limitHit, setLimitHit] = (0,
|
|
13251
|
+
const titleId = (0, import_react76.useId)();
|
|
13252
|
+
const [limitHit, setLimitHit] = (0, import_react76.useState)(false);
|
|
13223
13253
|
const pinSport = (0, import_widget_sdk33.slipSportOf)(match.sport);
|
|
13224
13254
|
const tour = pinSport === "tennis" && isKnownTour(match.tour) ? match.tour : void 0;
|
|
13225
13255
|
const followable = pinSport !== "tennis" || tour !== void 0;
|
|
@@ -13320,10 +13350,10 @@ var OPEN_TOP_GROUPS = 2;
|
|
|
13320
13350
|
var QUIET_ROWS = 4;
|
|
13321
13351
|
function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, onLeague, onSeeAll, onAsk }) {
|
|
13322
13352
|
const { groups, states, stale } = discovery;
|
|
13323
|
-
const [mine, setMine] = (0,
|
|
13324
|
-
const [toggled, setToggled] = (0,
|
|
13325
|
-
const [sheet, setSheet] = (0,
|
|
13326
|
-
const pinnedKeys = (0,
|
|
13353
|
+
const [mine, setMine] = (0, import_react77.useState)(false);
|
|
13354
|
+
const [toggled, setToggled] = (0, import_react77.useState)(/* @__PURE__ */ new Map());
|
|
13355
|
+
const [sheet, setSheet] = (0, import_react77.useState)(null);
|
|
13356
|
+
const pinnedKeys = (0, import_react77.useMemo)(
|
|
13327
13357
|
() => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk35.matchKey)(p.sport, p.matchId, p.tour))),
|
|
13328
13358
|
[monitor.pins]
|
|
13329
13359
|
);
|
|
@@ -13429,20 +13459,20 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
|
|
|
13429
13459
|
}
|
|
13430
13460
|
|
|
13431
13461
|
// src/components/ScheduleMatchesPanel.tsx
|
|
13432
|
-
var
|
|
13462
|
+
var import_react81 = require("react");
|
|
13433
13463
|
var import_widget_sdk37 = require("@sensiblestats/widget-sdk");
|
|
13434
13464
|
|
|
13435
13465
|
// src/useTennisRowPrices.ts
|
|
13436
|
-
var
|
|
13466
|
+
var import_react78 = require("react");
|
|
13437
13467
|
var import_widget_sdk36 = require("@sensiblestats/widget-sdk");
|
|
13438
13468
|
var TENNIS_PRICE_POLL_MS = 6e4;
|
|
13439
13469
|
function useTennisRowPrices(a) {
|
|
13440
|
-
const [state, setState] = (0,
|
|
13441
|
-
const getPricesRef = (0,
|
|
13470
|
+
const [state, setState] = (0, import_react78.useState)({ byId: null, stale: false });
|
|
13471
|
+
const getPricesRef = (0, import_react78.useRef)(a.getPrices);
|
|
13442
13472
|
getPricesRef.current = a.getPrices;
|
|
13443
|
-
const latest = (0,
|
|
13473
|
+
const latest = (0, import_react78.useRef)(0);
|
|
13444
13474
|
const idsKey = a.keys.filter((k) => isKnownTour(k.tour)).slice(0, MAX_TENNIS_KEYS).map((k) => `${k.tour}:${k.matchId}`).sort().join(",");
|
|
13445
|
-
(0,
|
|
13475
|
+
(0, import_react78.useEffect)(() => {
|
|
13446
13476
|
if (!a.enabled || idsKey === "") {
|
|
13447
13477
|
latest.current++;
|
|
13448
13478
|
setState((prev) => prev.byId === null && !prev.stale ? prev : { byId: null, stale: false });
|
|
@@ -13480,11 +13510,11 @@ function useTennisRowPrices(a) {
|
|
|
13480
13510
|
}
|
|
13481
13511
|
|
|
13482
13512
|
// src/components/DayStrip.tsx
|
|
13483
|
-
var
|
|
13513
|
+
var import_react79 = require("react");
|
|
13484
13514
|
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
13485
13515
|
function DayStrip({ chips, selected, onSelect, ui, locale }) {
|
|
13486
|
-
const listRef = (0,
|
|
13487
|
-
(0,
|
|
13516
|
+
const listRef = (0, import_react79.useRef)(null);
|
|
13517
|
+
(0, import_react79.useEffect)(() => {
|
|
13488
13518
|
const el = listRef.current?.querySelector('[aria-pressed="true"]');
|
|
13489
13519
|
if (!el || typeof el.scrollIntoView !== "function") return;
|
|
13490
13520
|
const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
@@ -13513,7 +13543,7 @@ function DayStrip({ chips, selected, onSelect, ui, locale }) {
|
|
|
13513
13543
|
}
|
|
13514
13544
|
|
|
13515
13545
|
// src/components/games/ui/SearchField.tsx
|
|
13516
|
-
var
|
|
13546
|
+
var import_react80 = require("react");
|
|
13517
13547
|
|
|
13518
13548
|
// src/components/games/ui/icons.tsx
|
|
13519
13549
|
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
@@ -13552,8 +13582,8 @@ var IconFlame = ({ size = 16 }) => svg(size, /* @__PURE__ */ (0, import_jsx_runt
|
|
|
13552
13582
|
// src/components/games/ui/SearchField.tsx
|
|
13553
13583
|
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
13554
13584
|
function SearchField({ id, label, labelHidden = false, placeholder, value, onChange, disabled, inputRef, onKeyDown, clearLabel }) {
|
|
13555
|
-
const localRef = (0,
|
|
13556
|
-
const setInputRef = (0,
|
|
13585
|
+
const localRef = (0, import_react80.useRef)(null);
|
|
13586
|
+
const setInputRef = (0, import_react80.useCallback)((node) => {
|
|
13557
13587
|
localRef.current = node;
|
|
13558
13588
|
if (typeof inputRef === "function") inputRef(node);
|
|
13559
13589
|
else if (inputRef) inputRef.current = node;
|
|
@@ -13599,18 +13629,18 @@ var TOP_ROW_CAP = 3;
|
|
|
13599
13629
|
var SKELETON_ROWS = 3;
|
|
13600
13630
|
function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport, day, onDay, loaded, onOpenLive, onAsk, locale, getTennisPrices, slip }) {
|
|
13601
13631
|
const { localDate: today, states, stale } = discovery;
|
|
13602
|
-
const searchId = (0,
|
|
13603
|
-
const [query, setQuery] = (0,
|
|
13604
|
-
const [toggled, setToggled] = (0,
|
|
13605
|
-
const [expanded, setExpanded] = (0,
|
|
13606
|
-
const listRef = (0,
|
|
13607
|
-
const [sheet, setSheet] = (0,
|
|
13632
|
+
const searchId = (0, import_react81.useId)();
|
|
13633
|
+
const [query, setQuery] = (0, import_react81.useState)("");
|
|
13634
|
+
const [toggled, setToggled] = (0, import_react81.useState)(/* @__PURE__ */ new Map());
|
|
13635
|
+
const [expanded, setExpanded] = (0, import_react81.useState)(/* @__PURE__ */ new Set());
|
|
13636
|
+
const listRef = (0, import_react81.useRef)(null);
|
|
13637
|
+
const [sheet, setSheet] = (0, import_react81.useState)(null);
|
|
13608
13638
|
const { chips, selected } = loaded;
|
|
13609
|
-
(0,
|
|
13639
|
+
(0, import_react81.useEffect)(() => {
|
|
13610
13640
|
if (selected !== day) onDay(selected);
|
|
13611
13641
|
}, [day, selected, onDay]);
|
|
13612
13642
|
const isToday = selected === today;
|
|
13613
|
-
const pinnedKeys = (0,
|
|
13643
|
+
const pinnedKeys = (0, import_react81.useMemo)(
|
|
13614
13644
|
() => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk37.matchKey)(p.sport, p.matchId, p.tour))),
|
|
13615
13645
|
[monitor.pins]
|
|
13616
13646
|
);
|
|
@@ -13748,7 +13778,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
13748
13778
|
}
|
|
13749
13779
|
|
|
13750
13780
|
// src/components/GamesPanel.tsx
|
|
13751
|
-
var
|
|
13781
|
+
var import_react96 = require("react");
|
|
13752
13782
|
|
|
13753
13783
|
// src/components/GamesLoginWall.tsx
|
|
13754
13784
|
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
@@ -13757,7 +13787,7 @@ function GamesLoginWall({ ui }) {
|
|
|
13757
13787
|
}
|
|
13758
13788
|
|
|
13759
13789
|
// src/components/GamesHub.tsx
|
|
13760
|
-
var
|
|
13790
|
+
var import_react82 = require("react");
|
|
13761
13791
|
|
|
13762
13792
|
// src/components/games/ui/gameMeta.ts
|
|
13763
13793
|
function prettifyGameId(gameId) {
|
|
@@ -13908,8 +13938,8 @@ function pickHeroGame(games) {
|
|
|
13908
13938
|
}
|
|
13909
13939
|
var tileKey = (g) => `${g.gameId}-${g.gameDay}-${g.fixtureId}`;
|
|
13910
13940
|
function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
13911
|
-
const [, setTick] = (0,
|
|
13912
|
-
(0,
|
|
13941
|
+
const [, setTick] = (0, import_react82.useState)(0);
|
|
13942
|
+
(0, import_react82.useEffect)(() => {
|
|
13913
13943
|
const id = setInterval(() => setTick((t) => t + 1), 6e4);
|
|
13914
13944
|
return () => clearInterval(id);
|
|
13915
13945
|
}, []);
|
|
@@ -13969,10 +13999,10 @@ function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
|
13969
13999
|
}
|
|
13970
14000
|
|
|
13971
14001
|
// src/components/GameScreenHost.tsx
|
|
13972
|
-
var
|
|
14002
|
+
var import_react94 = require("react");
|
|
13973
14003
|
|
|
13974
14004
|
// src/useGamePlay.ts
|
|
13975
|
-
var
|
|
14005
|
+
var import_react83 = require("react");
|
|
13976
14006
|
function toSubmitResult(payload) {
|
|
13977
14007
|
return {
|
|
13978
14008
|
// 'pending' means the play is recorded but awaiting resolution (fixture games)
|
|
@@ -13984,17 +14014,17 @@ function toSubmitResult(payload) {
|
|
|
13984
14014
|
};
|
|
13985
14015
|
}
|
|
13986
14016
|
function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh }) {
|
|
13987
|
-
const [result, setResult] = (0,
|
|
13988
|
-
const [submitting, setSubmitting] = (0,
|
|
13989
|
-
const [rawStatus, setRawStatus] = (0,
|
|
13990
|
-
const inFlightRef = (0,
|
|
13991
|
-
const convRef = (0,
|
|
14017
|
+
const [result, setResult] = (0, import_react83.useState)(null);
|
|
14018
|
+
const [submitting, setSubmitting] = (0, import_react83.useState)(false);
|
|
14019
|
+
const [rawStatus, setRawStatus] = (0, import_react83.useState)(null);
|
|
14020
|
+
const inFlightRef = (0, import_react83.useRef)(false);
|
|
14021
|
+
const convRef = (0, import_react83.useRef)(conversation);
|
|
13992
14022
|
convRef.current = conversation;
|
|
13993
|
-
const optsRef = (0,
|
|
14023
|
+
const optsRef = (0, import_react83.useRef)({ gameId, gameDay, fixtureId, locale, refresh });
|
|
13994
14024
|
optsRef.current = { gameId, gameDay, fixtureId, locale, refresh };
|
|
13995
|
-
const resultRef = (0,
|
|
14025
|
+
const resultRef = (0, import_react83.useRef)(null);
|
|
13996
14026
|
resultRef.current = result;
|
|
13997
|
-
const refetch = (0,
|
|
14027
|
+
const refetch = (0, import_react83.useCallback)(async () => {
|
|
13998
14028
|
const conv = convRef.current;
|
|
13999
14029
|
if (!conv) return;
|
|
14000
14030
|
const opts = optsRef.current;
|
|
@@ -14010,7 +14040,7 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
|
|
|
14010
14040
|
} catch {
|
|
14011
14041
|
}
|
|
14012
14042
|
}, []);
|
|
14013
|
-
const submit = (0,
|
|
14043
|
+
const submit = (0, import_react83.useCallback)(async (answerJson) => {
|
|
14014
14044
|
const conv = convRef.current;
|
|
14015
14045
|
if (!conv || inFlightRef.current) return;
|
|
14016
14046
|
inFlightRef.current = true;
|
|
@@ -14037,14 +14067,14 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
|
|
|
14037
14067
|
setSubmitting(false);
|
|
14038
14068
|
}
|
|
14039
14069
|
}, [refetch]);
|
|
14040
|
-
const hydrate = (0,
|
|
14070
|
+
const hydrate = (0, import_react83.useCallback)(() => {
|
|
14041
14071
|
void refetch();
|
|
14042
14072
|
}, [refetch]);
|
|
14043
14073
|
return { result, submitting, submit, hydrate, rawStatus };
|
|
14044
14074
|
}
|
|
14045
14075
|
|
|
14046
14076
|
// src/components/games/MysteryTigerGame.tsx
|
|
14047
|
-
var
|
|
14077
|
+
var import_react85 = require("react");
|
|
14048
14078
|
|
|
14049
14079
|
// src/components/games/nationFlags.ts
|
|
14050
14080
|
var FLAGS = {
|
|
@@ -14255,7 +14285,7 @@ function isNationCode(flag) {
|
|
|
14255
14285
|
}
|
|
14256
14286
|
|
|
14257
14287
|
// src/components/games/PlayerAvatar.tsx
|
|
14258
|
-
var
|
|
14288
|
+
var import_react84 = require("react");
|
|
14259
14289
|
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
14260
14290
|
function initialsOf(name) {
|
|
14261
14291
|
const parts2 = name.trim().split(/\s+/).filter(Boolean);
|
|
@@ -14273,7 +14303,7 @@ function PlayerAvatar({
|
|
|
14273
14303
|
imagePath,
|
|
14274
14304
|
className
|
|
14275
14305
|
}) {
|
|
14276
|
-
const [failed, setFailed] = (0,
|
|
14306
|
+
const [failed, setFailed] = (0, import_react84.useState)(false);
|
|
14277
14307
|
const showImage = Boolean(imagePath) && !isPlaceholderImage(imagePath) && !failed;
|
|
14278
14308
|
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className, "aria-hidden": "true", children: showImage ? /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("img", { src: imagePath, alt: "", loading: "lazy", onError: () => setFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("span", { className: "ss-w-av-initials", children: initialsOf(name) }) });
|
|
14279
14309
|
}
|
|
@@ -14517,8 +14547,8 @@ function MysteryTigerGame({
|
|
|
14517
14547
|
onBack
|
|
14518
14548
|
}) {
|
|
14519
14549
|
const t = ui.games.mysteryTiger;
|
|
14520
|
-
const [query, setQuery] = (0,
|
|
14521
|
-
const inputId = (0,
|
|
14550
|
+
const [query, setQuery] = (0, import_react85.useState)("");
|
|
14551
|
+
const inputId = (0, import_react85.useId)();
|
|
14522
14552
|
const clientState = parseClientState(result?.clientStateJson);
|
|
14523
14553
|
const guessResults = clientState?.guessResults ?? [];
|
|
14524
14554
|
const alreadyGuessedIds = new Set(guessResults.map((g) => g.playerId));
|
|
@@ -14779,13 +14809,13 @@ function HigherOrLowerGame({
|
|
|
14779
14809
|
}
|
|
14780
14810
|
|
|
14781
14811
|
// src/components/games/CareerPathGame.tsx
|
|
14782
|
-
var
|
|
14812
|
+
var import_react87 = require("react");
|
|
14783
14813
|
|
|
14784
14814
|
// src/components/games/ui/CrestShield.tsx
|
|
14785
|
-
var
|
|
14815
|
+
var import_react86 = require("react");
|
|
14786
14816
|
var import_jsx_runtime118 = require("react/jsx-runtime");
|
|
14787
14817
|
function CrestShield({ src, name, size = 28 }) {
|
|
14788
|
-
const [failed, setFailed] = (0,
|
|
14818
|
+
const [failed, setFailed] = (0, import_react86.useState)(false);
|
|
14789
14819
|
if (src && !isPlaceholderImage(src) && !failed) {
|
|
14790
14820
|
return /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("img", { className: "ss-g-crest", src, alt: name, width: size, height: size, loading: "lazy", onError: () => setFailed(true) });
|
|
14791
14821
|
}
|
|
@@ -14817,8 +14847,8 @@ function CareerPathGame({
|
|
|
14817
14847
|
}) {
|
|
14818
14848
|
const s = ui.games.careerPath;
|
|
14819
14849
|
const title = gameTitle({ gameId: "career-path" }, ui.games.titles);
|
|
14820
|
-
const [query, setQuery] = (0,
|
|
14821
|
-
const inputId = (0,
|
|
14850
|
+
const [query, setQuery] = (0, import_react87.useState)("");
|
|
14851
|
+
const inputId = (0, import_react87.useId)();
|
|
14822
14852
|
const clientState = parseClientState3(result?.clientStateJson);
|
|
14823
14853
|
const alreadyGuessedIds = new Set(clientState?.guessResults.map((g) => g.playerId) ?? []);
|
|
14824
14854
|
const isOver = result?.alreadyPlayed === true || clientState?.solved === true || clientState?.failed === true;
|
|
@@ -14924,7 +14954,7 @@ function CareerPathGame({
|
|
|
14924
14954
|
}
|
|
14925
14955
|
|
|
14926
14956
|
// src/components/games/BeatTheGridGame.tsx
|
|
14927
|
-
var
|
|
14957
|
+
var import_react88 = __toESM(require("react"), 1);
|
|
14928
14958
|
|
|
14929
14959
|
// src/components/games/ui/OptionList.tsx
|
|
14930
14960
|
var import_jsx_runtime120 = require("react/jsx-runtime");
|
|
@@ -15013,10 +15043,10 @@ function SearchSheet({
|
|
|
15013
15043
|
ui
|
|
15014
15044
|
}) {
|
|
15015
15045
|
const s = ui.games.beatTheGrid;
|
|
15016
|
-
const [query, setQuery] = (0,
|
|
15017
|
-
const inputId = (0,
|
|
15018
|
-
const inputRef = (0,
|
|
15019
|
-
(0,
|
|
15046
|
+
const [query, setQuery] = (0, import_react88.useState)("");
|
|
15047
|
+
const inputId = (0, import_react88.useId)();
|
|
15048
|
+
const inputRef = (0, import_react88.useRef)(null);
|
|
15049
|
+
(0, import_react88.useEffect)(() => {
|
|
15020
15050
|
inputRef.current?.focus();
|
|
15021
15051
|
}, [row, col]);
|
|
15022
15052
|
const filtered = playerPool.filter(
|
|
@@ -15081,7 +15111,7 @@ function BeatTheGridGame({
|
|
|
15081
15111
|
}) {
|
|
15082
15112
|
const s = ui.games.beatTheGrid;
|
|
15083
15113
|
const title = gameTitle({ gameId: "beat-the-grid" }, ui.games.titles);
|
|
15084
|
-
const [activeCell, setActiveCell] = (0,
|
|
15114
|
+
const [activeCell, setActiveCell] = (0, import_react88.useState)(null);
|
|
15085
15115
|
const clientState = parseClientState4(result?.clientStateJson);
|
|
15086
15116
|
const filledCells = clientState?.cells ?? [];
|
|
15087
15117
|
const isLocked2 = result?.alreadyPlayed === true || clientState?.isComplete === true;
|
|
@@ -15155,7 +15185,7 @@ function BeatTheGridGame({
|
|
|
15155
15185
|
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { "aria-hidden": "true", children: abbr }),
|
|
15156
15186
|
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "ss-g-sr", children: rowLabel })
|
|
15157
15187
|
] });
|
|
15158
|
-
return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(
|
|
15188
|
+
return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(import_react88.default.Fragment, { children: [
|
|
15159
15189
|
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "ss-g-btg-rowhdr", "data-meta": rowMeta ? "true" : void 0, children: rowHeaderContent }),
|
|
15160
15190
|
cols.map((colLabel, colIdx) => {
|
|
15161
15191
|
const filled = findCellResult(filledCells, rowIdx, colIdx);
|
|
@@ -15236,7 +15266,7 @@ function BeatTheGridGame({
|
|
|
15236
15266
|
}
|
|
15237
15267
|
|
|
15238
15268
|
// src/components/games/GuessTheXiGame.tsx
|
|
15239
|
-
var
|
|
15269
|
+
var import_react89 = require("react");
|
|
15240
15270
|
|
|
15241
15271
|
// src/components/games/ui/PitchSvg.tsx
|
|
15242
15272
|
var import_jsx_runtime122 = require("react/jsx-runtime");
|
|
@@ -15325,8 +15355,8 @@ function GuessTheXiGame({
|
|
|
15325
15355
|
onBack
|
|
15326
15356
|
}) {
|
|
15327
15357
|
const t = ui.games.guessTheXi;
|
|
15328
|
-
const [query, setQuery] = (0,
|
|
15329
|
-
const inputId = (0,
|
|
15358
|
+
const [query, setQuery] = (0, import_react89.useState)("");
|
|
15359
|
+
const inputId = (0, import_react89.useId)();
|
|
15330
15360
|
const clientState = parseClientState5(result?.clientStateJson);
|
|
15331
15361
|
const isOver = result?.alreadyPlayed === true || clientState?.status === "solved" || clientState?.status === "failed";
|
|
15332
15362
|
const solved = clientState?.status === "solved";
|
|
@@ -15468,7 +15498,7 @@ function GuessTheXiGame({
|
|
|
15468
15498
|
}
|
|
15469
15499
|
|
|
15470
15500
|
// src/components/games/DailyQuizGame.tsx
|
|
15471
|
-
var
|
|
15501
|
+
var import_react90 = require("react");
|
|
15472
15502
|
var import_jsx_runtime124 = require("react/jsx-runtime");
|
|
15473
15503
|
function parseClientState6(json) {
|
|
15474
15504
|
if (!json) return null;
|
|
@@ -15509,8 +15539,8 @@ function DailyQuizGame({
|
|
|
15509
15539
|
}) {
|
|
15510
15540
|
const s = ui.games.dailyQuiz;
|
|
15511
15541
|
const title = gameTitle({ gameId: "daily-quiz" }, ui.games.titles);
|
|
15512
|
-
const [selections, setSelections] = (0,
|
|
15513
|
-
const [page, setPage] = (0,
|
|
15542
|
+
const [selections, setSelections] = (0, import_react90.useState)(/* @__PURE__ */ new Map());
|
|
15543
|
+
const [page, setPage] = (0, import_react90.useState)(0);
|
|
15514
15544
|
const clientState = parseClientState6(result?.clientStateJson);
|
|
15515
15545
|
const results2 = clientState?.results ?? [];
|
|
15516
15546
|
const isRevealed = results2.length > 0 || result?.alreadyPlayed === true;
|
|
@@ -15620,7 +15650,7 @@ function DailyQuizGame({
|
|
|
15620
15650
|
}
|
|
15621
15651
|
|
|
15622
15652
|
// src/components/games/MatchdayPredictorGame.tsx
|
|
15623
|
-
var
|
|
15653
|
+
var import_react91 = require("react");
|
|
15624
15654
|
var import_jsx_runtime125 = require("react/jsx-runtime");
|
|
15625
15655
|
var SCORER_SEARCH_THRESHOLD = 9;
|
|
15626
15656
|
function parseClientState7(json) {
|
|
@@ -15716,12 +15746,12 @@ function MatchdayPredictorGame({
|
|
|
15716
15746
|
onBack
|
|
15717
15747
|
}) {
|
|
15718
15748
|
const t = ui.games.predictor;
|
|
15719
|
-
const [homeScore, setHomeScore] = (0,
|
|
15720
|
-
const [awayScore, setAwayScore] = (0,
|
|
15721
|
-
const [firstScorerPlayerId, setFirstScorerPlayerId] = (0,
|
|
15722
|
-
const [lastEdited, setLastEdited] = (0,
|
|
15723
|
-
const [query, setQuery] = (0,
|
|
15724
|
-
const searchId = (0,
|
|
15749
|
+
const [homeScore, setHomeScore] = (0, import_react91.useState)(0);
|
|
15750
|
+
const [awayScore, setAwayScore] = (0, import_react91.useState)(0);
|
|
15751
|
+
const [firstScorerPlayerId, setFirstScorerPlayerId] = (0, import_react91.useState)(null);
|
|
15752
|
+
const [lastEdited, setLastEdited] = (0, import_react91.useState)("home");
|
|
15753
|
+
const [query, setQuery] = (0, import_react91.useState)("");
|
|
15754
|
+
const searchId = (0, import_react91.useId)();
|
|
15725
15755
|
const clientState = parseClientState7(result?.clientStateJson);
|
|
15726
15756
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
15727
15757
|
const header = /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
@@ -15888,7 +15918,7 @@ function MatchdayPredictorGame({
|
|
|
15888
15918
|
}
|
|
15889
15919
|
|
|
15890
15920
|
// src/components/games/StartingXiGame.tsx
|
|
15891
|
-
var
|
|
15921
|
+
var import_react92 = require("react");
|
|
15892
15922
|
var import_jsx_runtime126 = require("react/jsx-runtime");
|
|
15893
15923
|
var POINTS_PER_STARTER = 8;
|
|
15894
15924
|
var XI_SIZE = 11;
|
|
@@ -15932,10 +15962,10 @@ function StartingXiGame({
|
|
|
15932
15962
|
lockAtUtc
|
|
15933
15963
|
}) {
|
|
15934
15964
|
const t = ui.games.startingXi;
|
|
15935
|
-
const [slotPlayers, setSlotPlayers] = (0,
|
|
15936
|
-
const [active, setActive] = (0,
|
|
15937
|
-
const [query, setQuery] = (0,
|
|
15938
|
-
const searchId = (0,
|
|
15965
|
+
const [slotPlayers, setSlotPlayers] = (0, import_react92.useState)(() => Array(XI_SIZE).fill(null));
|
|
15966
|
+
const [active, setActive] = (0, import_react92.useState)(0);
|
|
15967
|
+
const [query, setQuery] = (0, import_react92.useState)("");
|
|
15968
|
+
const searchId = (0, import_react92.useId)();
|
|
15939
15969
|
const clientState = parseClientState8(result?.clientStateJson);
|
|
15940
15970
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
15941
15971
|
const header = /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
|
|
@@ -16074,7 +16104,7 @@ function StartingXiGame({
|
|
|
16074
16104
|
}
|
|
16075
16105
|
|
|
16076
16106
|
// src/components/games/StatLadderGame.tsx
|
|
16077
|
-
var
|
|
16107
|
+
var import_react93 = require("react");
|
|
16078
16108
|
var import_jsx_runtime127 = require("react/jsx-runtime");
|
|
16079
16109
|
function ladderClue(ladder) {
|
|
16080
16110
|
const mystery = ladder.find((r) => r.rank === 2);
|
|
@@ -16111,9 +16141,9 @@ function StatLadderGame({
|
|
|
16111
16141
|
onBack
|
|
16112
16142
|
}) {
|
|
16113
16143
|
const t = ui.games.statLadder;
|
|
16114
|
-
const [query, setQuery] = (0,
|
|
16115
|
-
const [selectedId, setSelectedId] = (0,
|
|
16116
|
-
const searchId = (0,
|
|
16144
|
+
const [query, setQuery] = (0, import_react93.useState)("");
|
|
16145
|
+
const [selectedId, setSelectedId] = (0, import_react93.useState)(null);
|
|
16146
|
+
const searchId = (0, import_react93.useId)();
|
|
16117
16147
|
const clientState = parseClientState9(result?.clientStateJson);
|
|
16118
16148
|
const revealed = clientState != null;
|
|
16119
16149
|
const header = /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(GameHeader, { title: gameTitle({ gameId: "stat-ladder" }, ui.games.titles), eyebrow: t.eyebrow, onBack, backLabel: ui.back });
|
|
@@ -16319,8 +16349,8 @@ function GameScreenHost({
|
|
|
16319
16349
|
ui
|
|
16320
16350
|
}) {
|
|
16321
16351
|
const { gameId, fixtureId, gameDay = "", lockAtUtc = null } = selected;
|
|
16322
|
-
const [configJson, setConfigJson] = (0,
|
|
16323
|
-
(0,
|
|
16352
|
+
const [configJson, setConfigJson] = (0, import_react94.useState)(null);
|
|
16353
|
+
(0, import_react94.useEffect)(() => {
|
|
16324
16354
|
setConfigJson(null);
|
|
16325
16355
|
if (!conversation) return;
|
|
16326
16356
|
let cancelled = false;
|
|
@@ -16343,12 +16373,12 @@ function GameScreenHost({
|
|
|
16343
16373
|
fixtureId: fixtureId || void 0,
|
|
16344
16374
|
locale: ui.hostTag
|
|
16345
16375
|
});
|
|
16346
|
-
(0,
|
|
16376
|
+
(0, import_react94.useEffect)(() => {
|
|
16347
16377
|
if (conversation) hydrate();
|
|
16348
16378
|
}, [conversation, gameId]);
|
|
16349
|
-
const hydrateRef = (0,
|
|
16379
|
+
const hydrateRef = (0, import_react94.useRef)(hydrate);
|
|
16350
16380
|
hydrateRef.current = hydrate;
|
|
16351
|
-
(0,
|
|
16381
|
+
(0, import_react94.useEffect)(() => {
|
|
16352
16382
|
if (!FIXTURE_GAME_IDS.has(gameId)) return;
|
|
16353
16383
|
if (rawStatus !== "pending") return;
|
|
16354
16384
|
const timerId = setInterval(() => {
|
|
@@ -16461,7 +16491,7 @@ function GameScreenHost({
|
|
|
16461
16491
|
}
|
|
16462
16492
|
|
|
16463
16493
|
// src/components/Leaderboard.tsx
|
|
16464
|
-
var
|
|
16494
|
+
var import_react95 = require("react");
|
|
16465
16495
|
|
|
16466
16496
|
// src/components/LeaderboardRow.tsx
|
|
16467
16497
|
var import_jsx_runtime130 = require("react/jsx-runtime");
|
|
@@ -16548,7 +16578,7 @@ function Leaderboard({
|
|
|
16548
16578
|
ui,
|
|
16549
16579
|
onPlay
|
|
16550
16580
|
}) {
|
|
16551
|
-
const [segment, setSegment] = (0,
|
|
16581
|
+
const [segment, setSegment] = (0, import_react95.useState)("weekly");
|
|
16552
16582
|
const myRow = segment === "weekly" ? data.myWeeklyRow : data.myAllTimeRow;
|
|
16553
16583
|
const offBoard = myRow !== null && myRow !== void 0 && myRow.rank === -1;
|
|
16554
16584
|
const isEmpty = segment === "weekly" ? data.weeklyTop.length === 0 : data.allTimeTop.length === 0;
|
|
@@ -16653,9 +16683,9 @@ function GamesPanel({
|
|
|
16653
16683
|
leaderboardLoading,
|
|
16654
16684
|
refreshHub
|
|
16655
16685
|
}) {
|
|
16656
|
-
const [selected, setSelected] = (0,
|
|
16657
|
-
const [segment, setSegment] = (0,
|
|
16658
|
-
(0,
|
|
16686
|
+
const [selected, setSelected] = (0, import_react96.useState)(null);
|
|
16687
|
+
const [segment, setSegment] = (0, import_react96.useState)("play");
|
|
16688
|
+
(0, import_react96.useEffect)(() => {
|
|
16659
16689
|
ensureGamesFonts();
|
|
16660
16690
|
}, []);
|
|
16661
16691
|
if (!loggedIn) return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(GamesLoginWall, { ui });
|
|
@@ -16719,10 +16749,10 @@ function GamesPanel({
|
|
|
16719
16749
|
}
|
|
16720
16750
|
|
|
16721
16751
|
// src/components/FavouritesPanel.tsx
|
|
16722
|
-
var
|
|
16752
|
+
var import_react99 = require("react");
|
|
16723
16753
|
|
|
16724
16754
|
// src/components/FavouriteChips.tsx
|
|
16725
|
-
var
|
|
16755
|
+
var import_react97 = require("react");
|
|
16726
16756
|
var import_jsx_runtime135 = require("react/jsx-runtime");
|
|
16727
16757
|
async function toggleWithNotice(controller, kind, id, onNotice) {
|
|
16728
16758
|
const outcome = await controller.toggle(kind, id);
|
|
@@ -16769,12 +16799,12 @@ function Group({ title, entities, sport, ui, controller, onNotice }) {
|
|
|
16769
16799
|
] });
|
|
16770
16800
|
}
|
|
16771
16801
|
function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNotice }) {
|
|
16772
|
-
const [confirming, setConfirming] = (0,
|
|
16802
|
+
const [confirming, setConfirming] = (0, import_react97.useState)(false);
|
|
16773
16803
|
const data = controller.data;
|
|
16774
|
-
(0,
|
|
16804
|
+
(0, import_react97.useEffect)(() => {
|
|
16775
16805
|
setConfirming(false);
|
|
16776
16806
|
}, [sport]);
|
|
16777
|
-
(0,
|
|
16807
|
+
(0, import_react97.useEffect)(() => {
|
|
16778
16808
|
if (!confirming) return;
|
|
16779
16809
|
const onPointerDown = (e) => {
|
|
16780
16810
|
if (!(e.target instanceof Element) || !e.target.closest("[data-fav-confirm]")) setConfirming(false);
|
|
@@ -16828,21 +16858,21 @@ function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNoti
|
|
|
16828
16858
|
}
|
|
16829
16859
|
|
|
16830
16860
|
// src/components/FavouritesSearch.tsx
|
|
16831
|
-
var
|
|
16861
|
+
var import_react98 = require("react");
|
|
16832
16862
|
var import_jsx_runtime136 = require("react/jsx-runtime");
|
|
16833
16863
|
var MIN_LETTERS = 2;
|
|
16834
16864
|
var MAX_LENGTH = 64;
|
|
16835
16865
|
var DEBOUNCE_MS = 250;
|
|
16836
16866
|
function FavouritesSearch({ controller, ui, sport, onNotice }) {
|
|
16837
|
-
const [query, setQuery] = (0,
|
|
16838
|
-
const [answer, setAnswer] = (0,
|
|
16839
|
-
const controllerRef = (0,
|
|
16867
|
+
const [query, setQuery] = (0, import_react98.useState)("");
|
|
16868
|
+
const [answer, setAnswer] = (0, import_react98.useState)(null);
|
|
16869
|
+
const controllerRef = (0, import_react98.useRef)(controller);
|
|
16840
16870
|
controllerRef.current = controller;
|
|
16841
16871
|
const trimmed = query.trim();
|
|
16842
16872
|
const queryKey = `${sport}|${trimmed}`;
|
|
16843
16873
|
const results2 = answer?.key === queryKey ? answer.rows : [];
|
|
16844
16874
|
const settled = answer?.key === queryKey;
|
|
16845
|
-
(0,
|
|
16875
|
+
(0, import_react98.useEffect)(() => {
|
|
16846
16876
|
setAnswer(null);
|
|
16847
16877
|
if (trimmed.length < MIN_LETTERS) return;
|
|
16848
16878
|
let cancelled = false;
|
|
@@ -16905,13 +16935,13 @@ function FavouritesSearch({ controller, ui, sport, onNotice }) {
|
|
|
16905
16935
|
// src/components/FavouritesPanel.tsx
|
|
16906
16936
|
var import_jsx_runtime137 = require("react/jsx-runtime");
|
|
16907
16937
|
function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
|
|
16908
|
-
const [notice, setNotice] = (0,
|
|
16909
|
-
const refreshRef = (0,
|
|
16938
|
+
const [notice, setNotice] = (0, import_react99.useState)(null);
|
|
16939
|
+
const refreshRef = (0, import_react99.useRef)(controller.refresh);
|
|
16910
16940
|
refreshRef.current = controller.refresh;
|
|
16911
|
-
(0,
|
|
16941
|
+
(0, import_react99.useEffect)(() => {
|
|
16912
16942
|
void refreshRef.current();
|
|
16913
16943
|
}, []);
|
|
16914
|
-
(0,
|
|
16944
|
+
(0, import_react99.useEffect)(() => {
|
|
16915
16945
|
setNotice(null);
|
|
16916
16946
|
}, [sport]);
|
|
16917
16947
|
const sportLabel2 = sports.find((s) => s.sport === sport)?.label ?? sportLabel(ui, sport);
|
|
@@ -16937,7 +16967,7 @@ function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
|
|
|
16937
16967
|
}
|
|
16938
16968
|
|
|
16939
16969
|
// src/components/dashboard/v8/SentenceBuilder.tsx
|
|
16940
|
-
var
|
|
16970
|
+
var import_react100 = require("react");
|
|
16941
16971
|
var import_jsx_runtime138 = require("react/jsx-runtime");
|
|
16942
16972
|
var TOTALS = ["any", "3", "5", "10", "20", "50"];
|
|
16943
16973
|
var BASE_LEGS = [1, 2, 3, 4];
|
|
@@ -16963,8 +16993,8 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
16963
16993
|
const opening = openingGames(preset);
|
|
16964
16994
|
const gamesOptions = opening.options;
|
|
16965
16995
|
const marketOptions = usableMarkets(preset);
|
|
16966
|
-
const [fingerprint] = (0,
|
|
16967
|
-
const [saved] = (0,
|
|
16996
|
+
const [fingerprint] = (0, import_react100.useState)(() => JSON.stringify(preset));
|
|
16997
|
+
const [saved] = (0, import_react100.useState)(() => {
|
|
16968
16998
|
const kept = memory3?.savedView(sport);
|
|
16969
16999
|
return kept && kept.fingerprint === fingerprint ? kept : null;
|
|
16970
17000
|
});
|
|
@@ -16978,9 +17008,9 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
16978
17008
|
// The server never widens by itself: an all-games preset with no ids asks for it.
|
|
16979
17009
|
widen: opening.option ? opening.option.matchIds.length === 0 : preset.gamesScope === "all" && preset.matchIds.length === 0
|
|
16980
17010
|
};
|
|
16981
|
-
const [view, setView] = (0,
|
|
16982
|
-
const autoWidened = (0,
|
|
16983
|
-
const [widenedNote, setWidenedNote] = (0,
|
|
17011
|
+
const [view, setView] = (0, import_react100.useState)(() => saved?.view ?? openingView);
|
|
17012
|
+
const autoWidened = (0, import_react100.useRef)(false);
|
|
17013
|
+
const [widenedNote, setWidenedNote] = (0, import_react100.useState)(saved?.widenedNote ?? false);
|
|
16984
17014
|
const requestFor = (v) => ({
|
|
16985
17015
|
sport,
|
|
16986
17016
|
...v.marketKey !== null ? { marketKey: v.marketKey } : {},
|
|
@@ -16992,10 +17022,10 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
16992
17022
|
...operatorUserId ? { operatorUserId } : {},
|
|
16993
17023
|
...anonymousUserId ? { anonymousUserId } : {}
|
|
16994
17024
|
});
|
|
16995
|
-
const [first] = (0,
|
|
17025
|
+
const [first] = (0, import_react100.useState)(() => requestFor(view));
|
|
16996
17026
|
const { grid, status: status2, confirmed, request } = useBuilderGrid({ conversation, locale: ui.hostTag, memory: memory3, initial: first });
|
|
16997
|
-
const lastRequest = (0,
|
|
16998
|
-
(0,
|
|
17027
|
+
const lastRequest = (0, import_react100.useRef)(first);
|
|
17028
|
+
(0, import_react100.useEffect)(() => {
|
|
16999
17029
|
void request(lastRequest.current);
|
|
17000
17030
|
}, [request]);
|
|
17001
17031
|
const send = (req) => {
|
|
@@ -17028,14 +17058,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
17028
17058
|
const rows = ready && grid.status === "ok" ? legsOf(grid, sport) : null;
|
|
17029
17059
|
const rowSlip = rows ? guardLegsPreMatch(slip, rows, ui) : slip;
|
|
17030
17060
|
useNextKickoffRender(rows ? rows.map((l) => l.kickoffUtc) : []);
|
|
17031
|
-
const [startedNote, setStartedNote] = (0,
|
|
17061
|
+
const [startedNote, setStartedNote] = (0, import_react100.useState)(false);
|
|
17032
17062
|
const anyStarted = rows !== null && rows.some((l) => !preMatchOpen(l.kickoffUtc, Date.now()));
|
|
17033
|
-
(0,
|
|
17063
|
+
(0, import_react100.useEffect)(() => {
|
|
17034
17064
|
if (startedNote && status2 === "ready" && !anyStarted) setStartedNote(false);
|
|
17035
17065
|
}, [startedNote, status2, anyStarted]);
|
|
17036
17066
|
const market = rows?.[0]?.market;
|
|
17037
|
-
const [seen2, setSeen] = (0,
|
|
17038
|
-
(0,
|
|
17067
|
+
const [seen2, setSeen] = (0, import_react100.useState)(null);
|
|
17068
|
+
(0, import_react100.useEffect)(() => {
|
|
17039
17069
|
if (market) setSeen(market);
|
|
17040
17070
|
}, [market]);
|
|
17041
17071
|
const marketName = view.marketKey === null ? null : marketOptions?.find((m) => m.key === view.marketKey)?.label ?? market ?? seen2;
|
|
@@ -17048,14 +17078,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
17048
17078
|
const quotedAt = rows ? oldestQuote(rows) : null;
|
|
17049
17079
|
const combo = ready && grid.total !== null ? { sport, totalChosen: view.total, totalActual: grid.total } : void 0;
|
|
17050
17080
|
const canWiden = gamesOptions === null || allGames !== null;
|
|
17051
|
-
(0,
|
|
17081
|
+
(0, import_react100.useEffect)(() => {
|
|
17052
17082
|
if (!empty2 || !singles || widened || !canWiden || autoWidened.current) return;
|
|
17053
17083
|
autoWidened.current = true;
|
|
17054
17084
|
const next = { ...view, widen: true, matchIds: [], gamesId: allGames ? allGames.id : view.gamesId };
|
|
17055
17085
|
commit(next, true);
|
|
17056
17086
|
send(requestFor(next));
|
|
17057
17087
|
}, [empty2, singles, widened, canWiden, view]);
|
|
17058
|
-
(0,
|
|
17088
|
+
(0, import_react100.useEffect)(() => {
|
|
17059
17089
|
if (coolOff) onCoolOff?.(sport);
|
|
17060
17090
|
}, [coolOff, onCoolOff, sport]);
|
|
17061
17091
|
if (coolOff) return null;
|
|
@@ -17458,10 +17488,10 @@ function Squad({ squad, loading, ui, view, onToggleView, stats, statsLoading, se
|
|
|
17458
17488
|
}
|
|
17459
17489
|
|
|
17460
17490
|
// src/components/PlayerPhoto.tsx
|
|
17461
|
-
var
|
|
17491
|
+
var import_react101 = require("react");
|
|
17462
17492
|
var import_jsx_runtime144 = require("react/jsx-runtime");
|
|
17463
17493
|
function PlayerPhoto({ photoUrl, jerseyNumber, size }) {
|
|
17464
|
-
const [failed, setFailed] = (0,
|
|
17494
|
+
const [failed, setFailed] = (0, import_react101.useState)(false);
|
|
17465
17495
|
const box = { width: size, height: size };
|
|
17466
17496
|
if (photoUrl && !failed) {
|
|
17467
17497
|
return /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("img", { className: "ss-w-pd-photo", style: box, src: photoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -17496,7 +17526,7 @@ function MiniPitch({ positionCode }) {
|
|
|
17496
17526
|
}
|
|
17497
17527
|
|
|
17498
17528
|
// src/components/PerformanceBars.tsx
|
|
17499
|
-
var
|
|
17529
|
+
var import_react102 = require("react");
|
|
17500
17530
|
var import_jsx_runtime146 = require("react/jsx-runtime");
|
|
17501
17531
|
var GROUPS = ["shooting", "passing", "possession", "defending"];
|
|
17502
17532
|
function finite4(v) {
|
|
@@ -17542,7 +17572,7 @@ function unrankedLine(ui, reason) {
|
|
|
17542
17572
|
}
|
|
17543
17573
|
}
|
|
17544
17574
|
function PerformanceBars({ performance, competitionName, strings }) {
|
|
17545
|
-
const [mode, setMode] = (0,
|
|
17575
|
+
const [mode, setMode] = (0, import_react102.useState)("total");
|
|
17546
17576
|
const labelled = performance.metrics.filter((m) => Object.prototype.hasOwnProperty.call(strings.perfMetric, m.key));
|
|
17547
17577
|
if (!labelled.some((m) => valueOf(m, "total") !== null || valueOf(m, "per90") !== null)) return null;
|
|
17548
17578
|
const subtitle = !performance.ranked ? unrankedLine(strings, performance.unrankedReason) : competitionName ? strings.perfRankedAgainst(competitionName, performance.positionGroup) : null;
|
|
@@ -17714,11 +17744,11 @@ function PlayerDetail({ detail, loading, ui, seasonName, onClose }) {
|
|
|
17714
17744
|
}
|
|
17715
17745
|
|
|
17716
17746
|
// src/components/PresetTools.tsx
|
|
17717
|
-
var
|
|
17747
|
+
var import_react103 = require("react");
|
|
17718
17748
|
var import_jsx_runtime148 = require("react/jsx-runtime");
|
|
17719
17749
|
function PresetToolModal({ title, closeLabel, onClose, children, footer, className }) {
|
|
17720
17750
|
const { dialogRef, onKeyDown } = useModalDialog(onClose, { restoreFocus: false });
|
|
17721
|
-
const titleId = (0,
|
|
17751
|
+
const titleId = (0, import_react103.useId)();
|
|
17722
17752
|
return /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: className ? `ss-w-tool-backdrop ${className}` : "ss-w-tool-backdrop", children: /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { ref: dialogRef, className: "ss-w-tool", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, tabIndex: -1, onKeyDown, children: [
|
|
17723
17753
|
/* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "ss-w-tool-head", children: [
|
|
17724
17754
|
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("h2", { id: titleId, className: "ss-w-tool-title", children: title }),
|
|
@@ -17768,9 +17798,9 @@ function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal,
|
|
|
17768
17798
|
const totalOptions = comboTotals(grid);
|
|
17769
17799
|
const totals = totalOptions.map((o) => o.value);
|
|
17770
17800
|
const legChoices = comboLegChoices(grid);
|
|
17771
|
-
const [total, setTotal] = (0,
|
|
17772
|
-
const [legs, setLegs] = (0,
|
|
17773
|
-
const [announcement, setAnnouncement] = (0,
|
|
17801
|
+
const [total, setTotal] = (0, import_react103.useState)(() => nearest(totals, initialTotal));
|
|
17802
|
+
const [legs, setLegs] = (0, import_react103.useState)(() => legsForTotal(grid, nearest(totals, initialTotal), clampLegs(legChoices, initialLegs)));
|
|
17803
|
+
const [announcement, setAnnouncement] = (0, import_react103.useState)("");
|
|
17774
17804
|
const cell2 = findCombo(grid, total, legs);
|
|
17775
17805
|
const minLegs = legChoices[0] ?? legs;
|
|
17776
17806
|
const maxLegs = legChoices[legChoices.length - 1] ?? legs;
|
|
@@ -17840,8 +17870,8 @@ function SettingsSheet({ ui, onClose }) {
|
|
|
17840
17870
|
var import_jsx_runtime150 = require("react/jsx-runtime");
|
|
17841
17871
|
var FULLSCREEN_QUERY = "(max-width: 639px)";
|
|
17842
17872
|
function useIsModal() {
|
|
17843
|
-
const [modal, setModal] = (0,
|
|
17844
|
-
(0,
|
|
17873
|
+
const [modal, setModal] = (0, import_react104.useState)(false);
|
|
17874
|
+
(0, import_react104.useEffect)(() => {
|
|
17845
17875
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
17846
17876
|
const mql = window.matchMedia(FULLSCREEN_QUERY);
|
|
17847
17877
|
const sync = () => setModal(mql.matches);
|
|
@@ -17855,12 +17885,12 @@ var HIDDEN_LAYER_STYLE = { position: "absolute", inset: 0, visibility: "hidden",
|
|
|
17855
17885
|
var SQUAD_LAYER_STYLE = { display: "flex", flexDirection: "column", flex: 1, minHeight: 0 };
|
|
17856
17886
|
function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, schedule, gamesResult, leaderboardResult, clubFixturesResult, clubStandingsResult, clubSquadResult, clubSquadStatsResult, clubPlayerDetailResult, loggedIn, conversation, presetGrid, favouritesEnabled, favourites, builder, onCloseRequested, onRegisterBack }) {
|
|
17857
17887
|
const { state, close, stop, send, reset } = controller;
|
|
17858
|
-
const [squadView, setSquadView] = (0,
|
|
17859
|
-
const [selectedPlayerId, setSelectedPlayerId] = (0,
|
|
17888
|
+
const [squadView, setSquadView] = (0, import_react104.useState)("roster");
|
|
17889
|
+
const [selectedPlayerId, setSelectedPlayerId] = (0, import_react104.useState)(null);
|
|
17860
17890
|
const clearPlayerDetail = clubPlayerDetailResult?.clear;
|
|
17861
17891
|
const fetchPlayerDetail = clubPlayerDetailResult?.fetch;
|
|
17862
|
-
const squadLayerRef = (0,
|
|
17863
|
-
const squadScrollRef = (0,
|
|
17892
|
+
const squadLayerRef = (0, import_react104.useRef)(null);
|
|
17893
|
+
const squadScrollRef = (0, import_react104.useRef)(null);
|
|
17864
17894
|
const selectPlayer = (playerId) => {
|
|
17865
17895
|
squadScrollRef.current = squadLayerRef.current?.querySelector(".ss-w-mon-list")?.scrollTop ?? null;
|
|
17866
17896
|
setSelectedPlayerId(playerId);
|
|
@@ -17870,7 +17900,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17870
17900
|
setSelectedPlayerId(null);
|
|
17871
17901
|
clearPlayerDetail?.();
|
|
17872
17902
|
};
|
|
17873
|
-
(0,
|
|
17903
|
+
(0, import_react104.useLayoutEffect)(() => {
|
|
17874
17904
|
if (selectedPlayerId !== null || squadScrollRef.current === null) return;
|
|
17875
17905
|
const list = squadLayerRef.current?.querySelector(".ss-w-mon-list");
|
|
17876
17906
|
if (list) list.scrollTop = squadScrollRef.current;
|
|
@@ -17883,16 +17913,16 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17883
17913
|
const hasBuilder = !clubBrand && (builderOptions?.length ?? 0) > 0;
|
|
17884
17914
|
const tabs = monitor ?? (hasBuilder ? tabState : void 0);
|
|
17885
17915
|
const activeTab = tabs?.activeTab;
|
|
17886
|
-
(0,
|
|
17916
|
+
(0, import_react104.useEffect)(() => {
|
|
17887
17917
|
if (activeTab === "squad" || selectedPlayerId === null) return;
|
|
17888
17918
|
setSelectedPlayerId(null);
|
|
17889
17919
|
clearPlayerDetail?.();
|
|
17890
17920
|
}, [activeTab, selectedPlayerId, clearPlayerDetail]);
|
|
17891
|
-
(0,
|
|
17921
|
+
(0, import_react104.useEffect)(() => {
|
|
17892
17922
|
if (activeTab === "favourites" && !favouritesEnabled) setMonitorTab?.("chat");
|
|
17893
17923
|
}, [activeTab, favouritesEnabled, setMonitorTab]);
|
|
17894
17924
|
const storedTab = tabState?.activeTab;
|
|
17895
|
-
(0,
|
|
17925
|
+
(0, import_react104.useEffect)(() => {
|
|
17896
17926
|
const unreachable = storedTab === "builder" ? !hasBuilder : !monitor && storedTab !== void 0 && storedTab !== "chat";
|
|
17897
17927
|
if (unreachable) setMonitorTab?.("chat");
|
|
17898
17928
|
}, [storedTab, hasBuilder, monitor, setMonitorTab]);
|
|
@@ -17901,12 +17931,12 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17901
17931
|
const closeTab = tabs?.activeTab ?? "chat";
|
|
17902
17932
|
const lastMessage = state.messages[state.messages.length - 1];
|
|
17903
17933
|
const answering = state.isStreaming && !(lastMessage?.role === "assistant" && lastMessage.isGreeting);
|
|
17904
|
-
const closeWith = (0,
|
|
17934
|
+
const closeWith = (0, import_react104.useCallback)((method) => {
|
|
17905
17935
|
track({ name: "widget_close", method, tab: closeTab, answering });
|
|
17906
17936
|
if (onCloseRequested) onCloseRequested();
|
|
17907
17937
|
else close();
|
|
17908
17938
|
}, [track, closeTab, answering, close, onCloseRequested]);
|
|
17909
|
-
(0,
|
|
17939
|
+
(0, import_react104.useEffect)(() => {
|
|
17910
17940
|
const onKey = (e) => {
|
|
17911
17941
|
if (e.key === "Escape") closeWith("escape");
|
|
17912
17942
|
};
|
|
@@ -17922,69 +17952,69 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17922
17952
|
tabs?.setActiveTab("chat");
|
|
17923
17953
|
send(text2, { grounding, source });
|
|
17924
17954
|
};
|
|
17925
|
-
(0,
|
|
17955
|
+
(0, import_react104.useEffect)(() => {
|
|
17926
17956
|
if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
|
|
17927
17957
|
}, [monitor, state.isStreaming, state.messages.length]);
|
|
17928
17958
|
const onChatTab = !tabs || tabs.activeTab === "chat";
|
|
17929
|
-
const inputRef = (0,
|
|
17930
|
-
const limitRef = (0,
|
|
17931
|
-
const typedSendRef = (0,
|
|
17932
|
-
const focusAfterCloseRef = (0,
|
|
17933
|
-
const [tool, setTool] = (0,
|
|
17934
|
-
const panelRef = (0,
|
|
17959
|
+
const inputRef = (0, import_react104.useRef)(null);
|
|
17960
|
+
const limitRef = (0, import_react104.useRef)(null);
|
|
17961
|
+
const typedSendRef = (0, import_react104.useRef)(false);
|
|
17962
|
+
const focusAfterCloseRef = (0, import_react104.useRef)(null);
|
|
17963
|
+
const [tool, setTool] = (0, import_react104.useState)(null);
|
|
17964
|
+
const panelRef = (0, import_react104.useRef)(null);
|
|
17935
17965
|
const settings = useOddsSettings();
|
|
17936
|
-
const [settingsOpen, setSettingsOpen] = (0,
|
|
17966
|
+
const [settingsOpen, setSettingsOpen] = (0, import_react104.useState)(false);
|
|
17937
17967
|
const hasSettings = settings.oddsOffered || !settings.themeLocked;
|
|
17938
|
-
const openSettings = (0,
|
|
17968
|
+
const openSettings = (0, import_react104.useCallback)(() => {
|
|
17939
17969
|
setTool(null);
|
|
17940
17970
|
setSettingsOpen(true);
|
|
17941
17971
|
}, []);
|
|
17942
|
-
const closeSettings = (0,
|
|
17972
|
+
const closeSettings = (0, import_react104.useCallback)(() => {
|
|
17943
17973
|
setSettingsOpen(false);
|
|
17944
17974
|
panelRef.current?.querySelector(".ss-w-kebab")?.focus();
|
|
17945
17975
|
}, []);
|
|
17946
17976
|
const paused = isPaused(state.limit);
|
|
17947
|
-
(0,
|
|
17977
|
+
(0, import_react104.useEffect)(() => {
|
|
17948
17978
|
if (paused) setTool(null);
|
|
17949
17979
|
}, [paused]);
|
|
17950
|
-
(0,
|
|
17980
|
+
(0, import_react104.useEffect)(() => {
|
|
17951
17981
|
if (!paused) return;
|
|
17952
17982
|
if (typedSendRef.current) limitRef.current?.focus();
|
|
17953
17983
|
typedSendRef.current = false;
|
|
17954
17984
|
}, [paused]);
|
|
17955
|
-
const openTool = (0,
|
|
17985
|
+
const openTool = (0, import_react104.useCallback)((next) => {
|
|
17956
17986
|
setTool(next);
|
|
17957
17987
|
}, []);
|
|
17958
|
-
const toolsValue = (0,
|
|
17988
|
+
const toolsValue = (0, import_react104.useMemo)(
|
|
17959
17989
|
() => presetGrid && !paused ? { openBuilder: (total, legs) => openTool({ total, legs }), changeLabel: ui.presets.changeCombo } : null,
|
|
17960
17990
|
[presetGrid, paused, openTool, ui.presets.changeCombo]
|
|
17961
17991
|
);
|
|
17962
|
-
const closeTool = (0,
|
|
17992
|
+
const closeTool = (0, import_react104.useCallback)(() => {
|
|
17963
17993
|
focusAfterCloseRef.current = "composer";
|
|
17964
17994
|
setTool(null);
|
|
17965
17995
|
}, []);
|
|
17966
|
-
const sendAsk = (0,
|
|
17996
|
+
const sendAsk = (0, import_react104.useCallback)((ask) => {
|
|
17967
17997
|
focusAfterCloseRef.current = "composer";
|
|
17968
17998
|
setTool(null);
|
|
17969
17999
|
tabs?.setActiveTab("chat");
|
|
17970
18000
|
send(ask.message, { displayText: ask.displayText, preset: ask.preset, source: "preset" });
|
|
17971
18001
|
}, [tabs, send]);
|
|
17972
|
-
const formatKickoff = (0,
|
|
18002
|
+
const formatKickoff = (0, import_react104.useCallback)((kickoffUtc) => {
|
|
17973
18003
|
const k = ui.bettingKickoff(kickoffUtc);
|
|
17974
18004
|
return `${k.dayLabel} ${k.time}`;
|
|
17975
18005
|
}, [ui]);
|
|
17976
|
-
(0,
|
|
18006
|
+
(0, import_react104.useEffect)(() => {
|
|
17977
18007
|
if (tool) return;
|
|
17978
18008
|
const target = focusAfterCloseRef.current;
|
|
17979
18009
|
focusAfterCloseRef.current = null;
|
|
17980
18010
|
if (target === "composer") inputRef.current?.focus();
|
|
17981
18011
|
}, [tool]);
|
|
17982
|
-
(0,
|
|
18012
|
+
(0, import_react104.useEffect)(() => {
|
|
17983
18013
|
if (!tool || onChatTab && presetGrid) return;
|
|
17984
18014
|
focusAfterCloseRef.current = "composer";
|
|
17985
18015
|
setTool(null);
|
|
17986
18016
|
}, [tool, onChatTab, presetGrid]);
|
|
17987
|
-
const backRef = (0,
|
|
18017
|
+
const backRef = (0, import_react104.useRef)(() => false);
|
|
17988
18018
|
backRef.current = () => {
|
|
17989
18019
|
if (settingsOpen && hasSettings) {
|
|
17990
18020
|
closeSettings();
|
|
@@ -18004,7 +18034,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18004
18034
|
}
|
|
18005
18035
|
return false;
|
|
18006
18036
|
};
|
|
18007
|
-
(0,
|
|
18037
|
+
(0, import_react104.useEffect)(() => {
|
|
18008
18038
|
if (!onRegisterBack) return;
|
|
18009
18039
|
onRegisterBack(() => backRef.current());
|
|
18010
18040
|
return () => onRegisterBack(null);
|
|
@@ -18547,6 +18577,8 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
18547
18577
|
.ss-w-nba-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
|
|
18548
18578
|
.ss-w-nba-head-l { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
|
|
18549
18579
|
.ss-w-nba-meta { margin: 0; font-size: 11px; color: var(--ss-w-faint); line-height: 1.3; }
|
|
18580
|
+
.ss-w-nba-meta .ss-w-bi-crest { display: inline-block; width: 14px; height: 14px; vertical-align: -3px; margin: 0 2px; }
|
|
18581
|
+
.ss-w-nba-meta .ss-w-bi-crest-mono { display: inline-grid; font-size: 7px; }
|
|
18550
18582
|
.ss-w-nba-title { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.3; color: var(--ss-w-ink); overflow-wrap: anywhere; }
|
|
18551
18583
|
.ss-w-nba-chip{font-size:11px;font-weight:600;white-space:nowrap;border-radius:999px;padding:3px 8px;border:1px solid var(--ss-w-line)}
|
|
18552
18584
|
.ss-w-nba-chip { flex: none; color: var(--ss-w-warn); border-color: var(--ss-w-warn); }
|
|
@@ -19917,6 +19949,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
19917
19949
|
.ss-w-nbamon-side { display: flex; align-items: center; gap: 8px; min-width: 0; }
|
|
19918
19950
|
.ss-w-nbamon-side--home { flex-direction: row-reverse; text-align: right; }
|
|
19919
19951
|
.ss-w-nbamon-badge { flex: none; display: grid; place-items: center; min-width: 34px; height: 26px; padding: 0 5px; border-radius: 7px; background: var(--ss-w-bubble); border: 1px solid var(--ss-w-line); font-size: 11px; font-weight: 800; letter-spacing: .03em; color: var(--ss-w-ink); }
|
|
19952
|
+
.ss-w-nbamon-badge--img { width: 26px; min-width: 0; padding: 2px; box-sizing: border-box; object-fit: contain; }
|
|
19920
19953
|
.ss-w-nbamon-team { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
|
|
19921
19954
|
.ss-w-nbamon-city { font-size: 10.5px; font-weight: 600; color: var(--ss-w-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
19922
19955
|
.ss-w-nbamon-nick { font-size: 13px; font-weight: 800; color: var(--ss-w-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
@@ -20243,6 +20276,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
20243
20276
|
.ss-w-props-jn { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }
|
|
20244
20277
|
.ss-w-props-jn--home { background: var(--ss-w-home); }
|
|
20245
20278
|
.ss-w-props-jn--away { background: var(--ss-w-away); }
|
|
20279
|
+
.ss-w-props-shot { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; object-position: top center; background: var(--ss-w-bubble); }
|
|
20246
20280
|
.ss-w-props-pn { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
|
|
20247
20281
|
.ss-w-props-name { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
20248
20282
|
.ss-w-props-meta { font-size: 11px; color: var(--ss-w-faint); }
|
|
@@ -20972,12 +21006,12 @@ function injectStyles(root) {
|
|
|
20972
21006
|
function StatsWidget(props) {
|
|
20973
21007
|
const injectedClient = "client" in props ? props.client : void 0;
|
|
20974
21008
|
const cfg = props.config;
|
|
20975
|
-
const built = (0,
|
|
20976
|
-
const trackingRef = (0,
|
|
20977
|
-
const track = (0,
|
|
20978
|
-
const eventTextRef = (0,
|
|
21009
|
+
const built = (0, import_react105.useMemo)(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
|
|
21010
|
+
const trackingRef = (0, import_react105.useRef)({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
|
|
21011
|
+
const track = (0, import_react105.useMemo)(() => createTracker(() => trackingRef.current), []);
|
|
21012
|
+
const eventTextRef = (0, import_react105.useRef)(false);
|
|
20979
21013
|
eventTextRef.current = cfg?.eventText === true;
|
|
20980
|
-
const logger = (0,
|
|
21014
|
+
const logger = (0, import_react105.useMemo)(() => {
|
|
20981
21015
|
if (!built) return null;
|
|
20982
21016
|
const raw = built.client.createEventLogger({
|
|
20983
21017
|
operatorUserId: cfg?.userContext?.operatorUserId,
|
|
@@ -20987,27 +21021,27 @@ function StatsWidget(props) {
|
|
|
20987
21021
|
}, [built?.client, track]);
|
|
20988
21022
|
const widgetStrings = useWidgetStrings(cfg, built?.conversation ?? null);
|
|
20989
21023
|
const stringsPending = widgetStrings.strings === void 0;
|
|
20990
|
-
const ui = (0,
|
|
21024
|
+
const ui = (0, import_react105.useMemo)(
|
|
20991
21025
|
() => normalizeUi(props.config ?? { operatorId: "", publicKey: "" }, widgetStrings.strings ?? BUNDLED),
|
|
20992
21026
|
[props.config, widgetStrings.strings]
|
|
20993
21027
|
);
|
|
20994
21028
|
const oddsSettings = useOddsSettingsState(ui, built?.conversation, cfg?.operatorId || "default");
|
|
20995
|
-
const rootRef = (0,
|
|
20996
|
-
const introDoneRef = (0,
|
|
20997
|
-
const markIntroDone = (0,
|
|
21029
|
+
const rootRef = (0, import_react105.useRef)(null);
|
|
21030
|
+
const introDoneRef = (0, import_react105.useRef)(false);
|
|
21031
|
+
const markIntroDone = (0, import_react105.useCallback)(() => {
|
|
20998
21032
|
introDoneRef.current = true;
|
|
20999
21033
|
}, []);
|
|
21000
21034
|
const language = injectedClient ? void 0 : hostTag(cfg);
|
|
21001
21035
|
const threadLanguage = familyOf(language);
|
|
21002
21036
|
const convStorageKey = `ss-w-conv:${cfg?.operatorId ?? ""}:${cfg?.userContext?.operatorUserId ?? "anon"}${threadLanguage ? `:lang=${threadLanguage}` : ""}`;
|
|
21003
|
-
const sportScope = (0,
|
|
21037
|
+
const sportScope = (0, import_react105.useMemo)(
|
|
21004
21038
|
() => ({ operatorId: cfg?.operatorId ?? "", operatorUserId: cfg?.userContext?.operatorUserId, anonymousUserId: cfg?.userContext?.anonymousUserId }),
|
|
21005
21039
|
[cfg?.operatorId, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId]
|
|
21006
21040
|
);
|
|
21007
|
-
const chatTracking = (0,
|
|
21041
|
+
const chatTracking = (0, import_react105.useMemo)(() => ({ track, eventText: () => eventTextRef.current }), [track]);
|
|
21008
21042
|
const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey, cfg?.page, sportScope, language, chatTracking, injectedClient ? oddsSettings.userOddsFormat : oddsSettings.oddsFormat);
|
|
21009
21043
|
const panelOpen = controller.state.isOpen && !stringsPending;
|
|
21010
|
-
const liveCardWatches = (0,
|
|
21044
|
+
const liveCardWatches = (0, import_react105.useMemo)(() => {
|
|
21011
21045
|
const seen2 = /* @__PURE__ */ new Set();
|
|
21012
21046
|
const out = [];
|
|
21013
21047
|
for (const msg of controller.state.messages) {
|
|
@@ -21033,19 +21067,19 @@ function StatsWidget(props) {
|
|
|
21033
21067
|
});
|
|
21034
21068
|
const operatorUserId = cfg?.userContext?.operatorUserId;
|
|
21035
21069
|
const anonymousUserId = cfg?.userContext?.anonymousUserId;
|
|
21036
|
-
const getSchedule = (0,
|
|
21070
|
+
const getSchedule = (0, import_react105.useCallback)(
|
|
21037
21071
|
(localDate, utcOffsetMinutes) => built ? built.conversation.getSchedule(localDate, utcOffsetMinutes, operatorUserId, anonymousUserId) : Promise.resolve(null),
|
|
21038
21072
|
[built, operatorUserId, anonymousUserId]
|
|
21039
21073
|
);
|
|
21040
|
-
const getStates = (0,
|
|
21074
|
+
const getStates = (0, import_react105.useCallback)(
|
|
21041
21075
|
(matchIds, nbaGameIds, nflGameIds, tennisMatches) => built ? built.conversation.getStates(matchIds, nbaGameIds, nflGameIds, requestTag, tennisMatches) : Promise.resolve(null),
|
|
21042
21076
|
[built, requestTag]
|
|
21043
21077
|
);
|
|
21044
|
-
const getTennisPrices = (0,
|
|
21078
|
+
const getTennisPrices = (0, import_react105.useCallback)(
|
|
21045
21079
|
(keys) => built ? built.conversation.getStates([], [], [], requestTag, [], keys).then((p) => p?.tennisPrices ?? null) : Promise.resolve(null),
|
|
21046
21080
|
[built, requestTag]
|
|
21047
21081
|
);
|
|
21048
|
-
const pinnedMatchIds = (0,
|
|
21082
|
+
const pinnedMatchIds = (0, import_react105.useMemo)(
|
|
21049
21083
|
() => footballMatchPinIds(monitor.pins),
|
|
21050
21084
|
[monitor.pins]
|
|
21051
21085
|
);
|
|
@@ -21059,13 +21093,13 @@ function StatsWidget(props) {
|
|
|
21059
21093
|
pinnedMatchIds,
|
|
21060
21094
|
timeZone: ui.timeZone
|
|
21061
21095
|
});
|
|
21062
|
-
const offeredSports = (0,
|
|
21096
|
+
const offeredSports = (0, import_react105.useMemo)(() => {
|
|
21063
21097
|
const seen2 = new Set(discovery.matchDays.map((d) => d.sport));
|
|
21064
21098
|
for (const g of discovery.groups) seen2.add(g.sport ?? "football");
|
|
21065
21099
|
return [...seen2];
|
|
21066
21100
|
}, [discovery.matchDays, discovery.groups]);
|
|
21067
21101
|
const scheduleSport = useScheduleSport(offeredSports);
|
|
21068
|
-
const [liveLeague, setLiveLeague] = (0,
|
|
21102
|
+
const [liveLeague, setLiveLeague] = (0, import_react105.useState)(null);
|
|
21069
21103
|
const [matchesDay, setMatchesDay] = useMatchesDayPick(discovery.localDate);
|
|
21070
21104
|
const matchesLoaded = useMatchesDay({
|
|
21071
21105
|
discovery,
|
|
@@ -21075,8 +21109,8 @@ function StatsWidget(props) {
|
|
|
21075
21109
|
enabled: panelOpen && monitor.activeTab === "matches",
|
|
21076
21110
|
timeZone: ui.timeZone
|
|
21077
21111
|
});
|
|
21078
|
-
const prevLiveSnapshotRef = (0,
|
|
21079
|
-
(0,
|
|
21112
|
+
const prevLiveSnapshotRef = (0, import_react105.useRef)(monitor.snapshot);
|
|
21113
|
+
(0, import_react105.useEffect)(() => {
|
|
21080
21114
|
const snap = monitor.snapshot;
|
|
21081
21115
|
if (!snap || snap === prevLiveSnapshotRef.current) return;
|
|
21082
21116
|
prevLiveSnapshotRef.current = snap;
|
|
@@ -21116,14 +21150,14 @@ function StatsWidget(props) {
|
|
|
21116
21150
|
const clubSquadResult = useClubSquad(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
21117
21151
|
const clubSquadStatsResult = useClubSquadStats(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
21118
21152
|
const clubPlayerDetailResult = useClubPlayerDetail(built?.conversation ?? null);
|
|
21119
|
-
const [favSportPick, setFavSportPick] = (0,
|
|
21120
|
-
const latestGreeting = (0,
|
|
21153
|
+
const [favSportPick, setFavSportPick] = (0, import_react105.useState)(null);
|
|
21154
|
+
const latestGreeting = (0, import_react105.useMemo)(() => {
|
|
21121
21155
|
for (const m of [...controller.state.messages].reverse()) {
|
|
21122
21156
|
if (m.role === "assistant" && m.defaultSport !== void 0) return m;
|
|
21123
21157
|
}
|
|
21124
21158
|
return null;
|
|
21125
21159
|
}, [controller.state.messages]);
|
|
21126
|
-
const favSportOptions = (0,
|
|
21160
|
+
const favSportOptions = (0, import_react105.useMemo)(
|
|
21127
21161
|
() => (switchSets(latestGreeting?.greetingDashboards) ?? []).map((set) => ({ sport: set.sport, label: set.label })),
|
|
21128
21162
|
[latestGreeting]
|
|
21129
21163
|
);
|
|
@@ -21132,20 +21166,20 @@ function StatsWidget(props) {
|
|
|
21132
21166
|
const favSport = [favSportPick, rememberedSport, latestGreeting?.defaultSport].find(offered) ?? "football";
|
|
21133
21167
|
const favSports = favSportOptions.length > 0 ? favSportOptions : [{ sport: favSport, label: sportLabel(ui, favSport) }];
|
|
21134
21168
|
const hasFavouritesIdentity = !!(operatorUserId || anonymousUserId);
|
|
21135
|
-
const [builderSportPick, setBuilderSportPick] = (0,
|
|
21136
|
-
const builderGreeting = (0,
|
|
21169
|
+
const [builderSportPick, setBuilderSportPick] = (0, import_react105.useState)(null);
|
|
21170
|
+
const builderGreeting = (0, import_react105.useMemo)(
|
|
21137
21171
|
() => [...controller.state.messages].reverse().find((m) => m.role === "assistant" && (m.greetingDashboard !== void 0 || m.greetingDashboards !== void 0)) ?? null,
|
|
21138
21172
|
[controller.state.messages]
|
|
21139
21173
|
);
|
|
21140
|
-
const [coolOff, setCoolOff] = (0,
|
|
21141
|
-
const onBuilderCoolOff = (0,
|
|
21174
|
+
const [coolOff, setCoolOff] = (0, import_react105.useState)(null);
|
|
21175
|
+
const onBuilderCoolOff = (0, import_react105.useCallback)((sport) => {
|
|
21142
21176
|
if (!builderGreeting) return;
|
|
21143
21177
|
setCoolOff((prev) => {
|
|
21144
21178
|
const sports = prev?.greeting === builderGreeting ? prev.sports : [];
|
|
21145
21179
|
return sports.includes(sport) ? prev : { greeting: builderGreeting, sports: [...sports, sport] };
|
|
21146
21180
|
});
|
|
21147
21181
|
}, [builderGreeting]);
|
|
21148
|
-
const builderOptions = (0,
|
|
21182
|
+
const builderOptions = (0, import_react105.useMemo)(() => {
|
|
21149
21183
|
const greeting = builderGreeting;
|
|
21150
21184
|
if (!greeting) return [];
|
|
21151
21185
|
const cooled = coolOff?.greeting === greeting ? coolOff.sports : [];
|
|
@@ -21158,7 +21192,7 @@ function StatsWidget(props) {
|
|
|
21158
21192
|
return options.filter((o) => !cooled.includes(o.sport));
|
|
21159
21193
|
}, [builderGreeting, coolOff, ui]);
|
|
21160
21194
|
const builderSport = [builderSportPick, rememberedSport, latestGreeting?.defaultSport].find((s) => !!s && builderOptions.some((o) => o.sport === s)) ?? builderOptions[0]?.sport ?? "";
|
|
21161
|
-
const [panelEverOpened, setPanelEverOpened] = (0,
|
|
21195
|
+
const [panelEverOpened, setPanelEverOpened] = (0, import_react105.useState)(panelOpen);
|
|
21162
21196
|
if (panelOpen && !panelEverOpened) setPanelEverOpened(true);
|
|
21163
21197
|
const favourites = useFavourites({
|
|
21164
21198
|
conversation: built?.conversation ?? null,
|
|
@@ -21170,14 +21204,14 @@ function StatsWidget(props) {
|
|
|
21170
21204
|
onChanged: discovery.refreshSchedule
|
|
21171
21205
|
});
|
|
21172
21206
|
const favouritesEnabled = hasFavouritesIdentity && favourites.status !== "refused";
|
|
21173
|
-
const getPricePresets = (0,
|
|
21207
|
+
const getPricePresets = (0, import_react105.useCallback)(
|
|
21174
21208
|
(locale) => built ? built.conversation.getPricePresets(locale, { pool: "open" }) : Promise.resolve(null),
|
|
21175
21209
|
[built]
|
|
21176
21210
|
);
|
|
21177
21211
|
const presetGrid = usePresetGrid({ getPricePresets, isOpen: panelOpen, locale: ui.hostTag });
|
|
21178
21212
|
const markLiveActivity = monitor.markLiveActivity;
|
|
21179
|
-
const prevLiveCountRef = (0,
|
|
21180
|
-
(0,
|
|
21213
|
+
const prevLiveCountRef = (0, import_react105.useRef)(0);
|
|
21214
|
+
(0, import_react105.useEffect)(() => {
|
|
21181
21215
|
const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
|
|
21182
21216
|
prevLiveCountRef.current = discovery.liveCount;
|
|
21183
21217
|
if (rose) markLiveActivity();
|
|
@@ -21191,7 +21225,7 @@ function StatsWidget(props) {
|
|
|
21191
21225
|
closePanel: controller.close
|
|
21192
21226
|
});
|
|
21193
21227
|
const markAdded = hostEvents.markAdded;
|
|
21194
|
-
const slip = (0,
|
|
21228
|
+
const slip = (0, import_react105.useMemo)(
|
|
21195
21229
|
() => {
|
|
21196
21230
|
const handler = props.config?.onAddToSlip;
|
|
21197
21231
|
return {
|
|
@@ -21211,7 +21245,7 @@ function StatsWidget(props) {
|
|
|
21211
21245
|
},
|
|
21212
21246
|
[props.config?.onAddToSlip, props.config?.slipSports, controller.state.conversationId, markAdded]
|
|
21213
21247
|
);
|
|
21214
|
-
const onDashboardTap = (0,
|
|
21248
|
+
const onDashboardTap = (0, import_react105.useMemo)(
|
|
21215
21249
|
() => built ? createDashboardTapSignal((input) => built.conversation.sendSignal(input), logger) : void 0,
|
|
21216
21250
|
[built, logger]
|
|
21217
21251
|
);
|
|
@@ -21225,7 +21259,7 @@ function StatsWidget(props) {
|
|
|
21225
21259
|
log: logger
|
|
21226
21260
|
})
|
|
21227
21261
|
}));
|
|
21228
|
-
const dismissPopupRef = (0,
|
|
21262
|
+
const dismissPopupRef = (0, import_react105.useRef)(() => {
|
|
21229
21263
|
});
|
|
21230
21264
|
const mobile = useMobileBinding({
|
|
21231
21265
|
binding: props.mobile,
|
|
@@ -21239,10 +21273,10 @@ function StatsWidget(props) {
|
|
|
21239
21273
|
const dismissPopup = usePopupTelemetry(logger, panelOpen, controller.state.popupText, controller.dismissPopup, mobile.confirmedShown);
|
|
21240
21274
|
dismissPopupRef.current = dismissPopup;
|
|
21241
21275
|
useOpenTelemetry(logger, panelOpen);
|
|
21242
|
-
const onControlRef = (0,
|
|
21276
|
+
const onControlRef = (0, import_react105.useRef)(props.onControl);
|
|
21243
21277
|
onControlRef.current = props.onControl;
|
|
21244
21278
|
const { open: openPanel, close: closePanel } = controller;
|
|
21245
|
-
(0,
|
|
21279
|
+
(0, import_react105.useEffect)(() => {
|
|
21246
21280
|
onControlRef.current?.({ open: openPanel, close: closePanel });
|
|
21247
21281
|
return () => onControlRef.current?.(null);
|
|
21248
21282
|
}, [openPanel, closePanel]);
|
|
@@ -21259,11 +21293,11 @@ function StatsWidget(props) {
|
|
|
21259
21293
|
page: cfg?.page
|
|
21260
21294
|
}
|
|
21261
21295
|
};
|
|
21262
|
-
(0,
|
|
21296
|
+
(0, import_react105.useEffect)(() => {
|
|
21263
21297
|
if (!logger) return;
|
|
21264
21298
|
logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
|
|
21265
21299
|
}, [logger, operatorUserId, anonymousUserId, conversationId]);
|
|
21266
|
-
(0,
|
|
21300
|
+
(0, import_react105.useEffect)(() => {
|
|
21267
21301
|
if (!logger) return;
|
|
21268
21302
|
logger.resume();
|
|
21269
21303
|
const onHide = () => {
|
|
@@ -21281,15 +21315,15 @@ function StatsWidget(props) {
|
|
|
21281
21315
|
logger.dispose();
|
|
21282
21316
|
};
|
|
21283
21317
|
}, [logger]);
|
|
21284
|
-
(0,
|
|
21318
|
+
(0, import_react105.useEffect)(() => {
|
|
21285
21319
|
if (!built || !ui.injectStyles || widgetStrings.state === "unavailable") return;
|
|
21286
21320
|
const node = rootRef.current?.getRootNode();
|
|
21287
21321
|
if (node) injectStyles(node);
|
|
21288
21322
|
}, [built, ui.injectStyles, widgetStrings.state]);
|
|
21289
21323
|
const holds = useSessionHolds();
|
|
21290
21324
|
const builderConversation = built?.conversation ?? null;
|
|
21291
|
-
const builderMemory = (0,
|
|
21292
|
-
const personalGreeting = (0,
|
|
21325
|
+
const builderMemory = (0, import_react105.useMemo)(() => createBuilderMemory(), [builderConversation, controller.state.threadEpoch]);
|
|
21326
|
+
const personalGreeting = (0, import_react105.useMemo)(() => ({
|
|
21293
21327
|
favourites: favouritesEnabled && monitor.enabled ? favourites : null,
|
|
21294
21328
|
conversation: built?.conversation ?? null,
|
|
21295
21329
|
openFavourites: () => monitor.setActiveTab("favourites"),
|