@sensiblestats/widget-react 0.134.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 +22 -0
- package/dist/index.cjs +279 -242
- 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 +146 -109
- 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
|
|
@@ -120,6 +120,7 @@ var BUNDLED_EN_GB = {
|
|
|
120
120
|
"widget.fullTimeLabel": "Full time",
|
|
121
121
|
"widget.postponedLabel": "Postponed",
|
|
122
122
|
"widget.ownGoalLabel": "OG",
|
|
123
|
+
"widget.penaltyLabel": "pen",
|
|
123
124
|
"widget.inSlipLabel": "In slip",
|
|
124
125
|
"widget.oddsUnavailable": "Odds unavailable right now",
|
|
125
126
|
"widget.momentumLabel": "Momentum",
|
|
@@ -1336,7 +1337,7 @@ function parseOddsFormat(value) {
|
|
|
1336
1337
|
}
|
|
1337
1338
|
|
|
1338
1339
|
// src/version.generated.ts
|
|
1339
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1340
|
+
var WIDGET_REACT_VERSION = "0.136.0";
|
|
1340
1341
|
|
|
1341
1342
|
// src/config.ts
|
|
1342
1343
|
function hostTag(cfg) {
|
|
@@ -1584,6 +1585,7 @@ function normalizeUi(cfg, loaded) {
|
|
|
1584
1585
|
fullTimeLabel: strings.fullTimeLabel,
|
|
1585
1586
|
postponedLabel: strings.postponedLabel,
|
|
1586
1587
|
ownGoalLabel: strings.ownGoalLabel,
|
|
1588
|
+
penaltyLabel: strings.penaltyLabel,
|
|
1587
1589
|
inSlipLabel: strings.inSlipLabel,
|
|
1588
1590
|
oddsUnavailable: strings.oddsUnavailable,
|
|
1589
1591
|
momentumLabel: strings.momentumLabel,
|
|
@@ -2283,6 +2285,9 @@ function toNbaInsightVM(insight) {
|
|
|
2283
2285
|
competition: str(insight.competitionName),
|
|
2284
2286
|
kickoffUtc: str(insight.kickoffUtc),
|
|
2285
2287
|
kickoffLabel: str(insight.kickoffLabel),
|
|
2288
|
+
homeTeamImage: str(insight.homeTeamImagePath),
|
|
2289
|
+
awayTeamImage: str(insight.awayTeamImagePath),
|
|
2290
|
+
competitionImage: str(insight.competitionImagePath),
|
|
2286
2291
|
quotedAtUtc: insight.quotedAtUtc,
|
|
2287
2292
|
addToSlipEnabled: insight.addToSlipEnabled === true,
|
|
2288
2293
|
disclaimer: str(insight.disclaimer),
|
|
@@ -7799,7 +7804,7 @@ function ChatFab({ label, busy = false, greeting, popupText, logoUrl, onOpen, on
|
|
|
7799
7804
|
}
|
|
7800
7805
|
|
|
7801
7806
|
// src/components/ChatPanel.tsx
|
|
7802
|
-
var
|
|
7807
|
+
var import_react104 = require("react");
|
|
7803
7808
|
|
|
7804
7809
|
// src/components/ChatHeader.tsx
|
|
7805
7810
|
var import_react48 = require("react");
|
|
@@ -8366,10 +8371,17 @@ function NbaPrice({ vm, selectionKey, label, ui, slip }) {
|
|
|
8366
8371
|
function Head({ vm, chip, ui, monitor }) {
|
|
8367
8372
|
const fixture = vm.homeTeamName && vm.awayTeamName ? `${vm.homeTeamName} ${ui.venue.home} ${vm.awayTeamName}` : vm.competition;
|
|
8368
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;
|
|
8369
8381
|
const pinnable = monitor?.enabled === true && vm.evidence.kind !== "settle_recap";
|
|
8370
8382
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "ss-w-nba-head", children: [
|
|
8371
8383
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "ss-w-nba-head-l", children: [
|
|
8372
|
-
|
|
8384
|
+
metaNode,
|
|
8373
8385
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "ss-w-nba-title", children: vm.title })
|
|
8374
8386
|
] }),
|
|
8375
8387
|
chip || pinnable ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "ss-w-bi-meta-right", children: [
|
|
@@ -10800,7 +10812,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
10800
10812
|
}
|
|
10801
10813
|
|
|
10802
10814
|
// src/components/MonitorTabs.tsx
|
|
10803
|
-
var
|
|
10815
|
+
var import_react74 = require("react");
|
|
10804
10816
|
|
|
10805
10817
|
// src/components/MarketAccordion.tsx
|
|
10806
10818
|
var import_widget_sdk24 = require("@sensiblestats/widget-sdk");
|
|
@@ -10962,12 +10974,13 @@ function isPromoted(row, promotedPins) {
|
|
|
10962
10974
|
if (!chip) return false;
|
|
10963
10975
|
return promotedPins.some((pin) => pin.marketDeveloperName === chip.marketDeveloperName || chip.matchOddsId != null && pin.matchOddsId === chip.matchOddsId);
|
|
10964
10976
|
}
|
|
10965
|
-
function groupScorers(goals, ownGoalLabel) {
|
|
10977
|
+
function groupScorers(goals, ownGoalLabel, penaltyLabel) {
|
|
10966
10978
|
const order = [];
|
|
10967
10979
|
const minutesByPlayer = /* @__PURE__ */ new Map();
|
|
10968
10980
|
for (const g of goals) {
|
|
10969
10981
|
const name = g.player ?? "";
|
|
10970
|
-
const
|
|
10982
|
+
const marker = g.ownGoal ? ownGoalLabel : g.penalty ? penaltyLabel : null;
|
|
10983
|
+
const minute = marker ? `${g.minuteLabel} (${marker})` : g.minuteLabel;
|
|
10971
10984
|
if (!minutesByPlayer.has(name)) {
|
|
10972
10985
|
minutesByPlayer.set(name, []);
|
|
10973
10986
|
order.push(name);
|
|
@@ -10983,8 +10996,8 @@ function MonitorMatchCard({ match, promotedPins, monitor, ui, slip, onAsk }) {
|
|
|
10983
10996
|
const { oddsFormat } = useOddsSettings();
|
|
10984
10997
|
const live = match.phase === "live";
|
|
10985
10998
|
const goals = match.events.filter((e) => e.type === "goal");
|
|
10986
|
-
const homeScorers = groupScorers(goals.filter((e) => e.side === "home"), ui.ownGoalLabel);
|
|
10987
|
-
const awayScorers = groupScorers(goals.filter((e) => e.side === "away"), ui.ownGoalLabel);
|
|
10999
|
+
const homeScorers = groupScorers(goals.filter((e) => e.side === "home"), ui.ownGoalLabel, ui.penaltyLabel);
|
|
11000
|
+
const awayScorers = groupScorers(goals.filter((e) => e.side === "away"), ui.ownGoalLabel, ui.penaltyLabel);
|
|
10988
11001
|
const promotedRows = match.statRows.filter((row) => isPromoted(row, promotedPins));
|
|
10989
11002
|
const otherRows = match.statRows.filter((row) => !isPromoted(row, promotedPins));
|
|
10990
11003
|
const orderedRows = [...promotedRows, ...otherRows];
|
|
@@ -11103,6 +11116,9 @@ function MonitorSkeleton({ pin, monitor, ui }) {
|
|
|
11103
11116
|
] });
|
|
11104
11117
|
}
|
|
11105
11118
|
|
|
11119
|
+
// src/components/NbaMonitorCard.tsx
|
|
11120
|
+
var import_react68 = require("react");
|
|
11121
|
+
|
|
11106
11122
|
// src/sportLabel.ts
|
|
11107
11123
|
var CODE = { football: "football", basketball: "nba", nba: "nba", americanfootball: "nfl", nfl: "nfl", tennis: "tennis" };
|
|
11108
11124
|
var sportLabel = (ui, sport) => {
|
|
@@ -11413,6 +11429,7 @@ function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
|
|
|
11413
11429
|
}
|
|
11414
11430
|
function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
11415
11431
|
const [openId, setOpenId] = (0, import_react66.useState)(null);
|
|
11432
|
+
const [brokenShots, setBrokenShots] = (0, import_react66.useState)(/* @__PURE__ */ new Set());
|
|
11416
11433
|
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "ss-w-props-list", children: players.map((given) => {
|
|
11417
11434
|
const p = livePlayer(bundle, given);
|
|
11418
11435
|
const isOpen = openId === p.playerId;
|
|
@@ -11428,7 +11445,16 @@ function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
|
11428
11445
|
"aria-expanded": isOpen,
|
|
11429
11446
|
onClick: () => setOpenId(isOpen ? null : p.playerId),
|
|
11430
11447
|
children: [
|
|
11431
|
-
/* @__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 ?? "" }),
|
|
11432
11458
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("span", { className: "ss-w-props-pn", children: [
|
|
11433
11459
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "ss-w-props-name", children: p.name }),
|
|
11434
11460
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "ss-w-props-meta", children: meta })
|
|
@@ -11571,10 +11597,17 @@ function city(teamName, nickname) {
|
|
|
11571
11597
|
if (!name || !name.endsWith(nickname)) return null;
|
|
11572
11598
|
return name.slice(0, name.length - nickname.length).trim() || null;
|
|
11573
11599
|
}
|
|
11574
|
-
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 }) {
|
|
11575
11608
|
const cityName = city(teamName, nickname);
|
|
11576
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: [
|
|
11577
|
-
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
11610
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(BadgeCrest, { url: crestUrl, abbreviation }),
|
|
11578
11611
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("span", { className: "ss-w-nbamon-team", children: [
|
|
11579
11612
|
cityName && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "ss-w-nbamon-city", children: cityName }),
|
|
11580
11613
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "ss-w-nbamon-nick", children: nickname })
|
|
@@ -11644,13 +11677,13 @@ function NbaMonitorCard({ match, monitor, ui, slip }) {
|
|
|
11644
11677
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(PinToggle, { ui, monitor, pin: { kind: "match", matchId: match.matchId, sport: "basketball" } })
|
|
11645
11678
|
] }),
|
|
11646
11679
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "ss-w-nbamon-main", children: [
|
|
11647
|
-
/* @__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 }),
|
|
11648
11681
|
scored ? /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("span", { className: "ss-w-mon-score", children: [
|
|
11649
11682
|
match.awayScore ?? 0,
|
|
11650
11683
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("i", { children: "\u2013" }),
|
|
11651
11684
|
match.homeScore ?? 0
|
|
11652
11685
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "ss-w-mon-vs", children: ui.venue.away }),
|
|
11653
|
-
/* @__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 })
|
|
11654
11687
|
] }),
|
|
11655
11688
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(NbaFormStrip, { match, monitor, ui }),
|
|
11656
11689
|
scored && /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_jsx_runtime78.Fragment, { children: [
|
|
@@ -11683,7 +11716,7 @@ function NbaMonitorCard({ match, monitor, ui, slip }) {
|
|
|
11683
11716
|
}
|
|
11684
11717
|
|
|
11685
11718
|
// src/components/NflFormSection.tsx
|
|
11686
|
-
var
|
|
11719
|
+
var import_react69 = require("react");
|
|
11687
11720
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
11688
11721
|
var outcomeOf = (g) => g.teamScore > g.opponentScore ? "win" : g.teamScore < g.opponentScore ? "loss" : "tie";
|
|
11689
11722
|
var signedSpread2 = (v) => v > 0 ? `+${v}` : String(v);
|
|
@@ -11735,7 +11768,7 @@ function H2hRow({ game, home, ui }) {
|
|
|
11735
11768
|
] });
|
|
11736
11769
|
}
|
|
11737
11770
|
function NflFormSection({ match, monitor, ui }) {
|
|
11738
|
-
const [segment, setSegment] = (0,
|
|
11771
|
+
const [segment, setSegment] = (0, import_react69.useState)("away");
|
|
11739
11772
|
const { live, open } = usePropsOpen(match, monitor, { sport: "americanfootball" });
|
|
11740
11773
|
const bundle = monitor.playerProps?.[monitorMatchKey("americanfootball", match.matchId)]?.bundle;
|
|
11741
11774
|
const form = bundle?.form;
|
|
@@ -11768,7 +11801,7 @@ function NflFormSection({ match, monitor, ui }) {
|
|
|
11768
11801
|
}
|
|
11769
11802
|
|
|
11770
11803
|
// src/components/NflPropsSection.tsx
|
|
11771
|
-
var
|
|
11804
|
+
var import_react70 = require("react");
|
|
11772
11805
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
11773
11806
|
var TRENDS_SHOWN = 3;
|
|
11774
11807
|
var SCORERS_SHOWN = 8;
|
|
@@ -11841,7 +11874,7 @@ function ShowMore({ label, onClick }) {
|
|
|
11841
11874
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("button", { type: "button", className: "ss-w-props-more", onClick, children: label });
|
|
11842
11875
|
}
|
|
11843
11876
|
function Trends({ bundle, facts, descriptor, ui, slip }) {
|
|
11844
|
-
const [all, setAll] = (0,
|
|
11877
|
+
const [all, setAll] = (0, import_react70.useState)(false);
|
|
11845
11878
|
const shown2 = all ? facts : facts.slice(0, TRENDS_SHOWN);
|
|
11846
11879
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("section", { className: "ss-w-props ss-w-props-trends", lang: ui.locale, children: [
|
|
11847
11880
|
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "ss-w-props-head", children: ui.nfl.propsTrends }),
|
|
@@ -11874,7 +11907,7 @@ function Trends({ bundle, facts, descriptor, ui, slip }) {
|
|
|
11874
11907
|
] });
|
|
11875
11908
|
}
|
|
11876
11909
|
function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
11877
|
-
const [all, setAll] = (0,
|
|
11910
|
+
const [all, setAll] = (0, import_react70.useState)(false);
|
|
11878
11911
|
const shown2 = all ? scorers : scorers.slice(0, SCORERS_SHOWN);
|
|
11879
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" });
|
|
11880
11913
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "ss-w-props-scorers", children: [
|
|
@@ -11901,7 +11934,7 @@ function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
|
11901
11934
|
] });
|
|
11902
11935
|
}
|
|
11903
11936
|
function NflPropsSection({ match, monitor, ui, slip }) {
|
|
11904
|
-
const [tab, setTab] = (0,
|
|
11937
|
+
const [tab, setTab] = (0, import_react70.useState)(null);
|
|
11905
11938
|
const descriptor = nflDescriptor(ui);
|
|
11906
11939
|
const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
|
|
11907
11940
|
if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
|
|
@@ -12087,7 +12120,7 @@ function NflMonitorCard({ match, monitor, ui, slip }) {
|
|
|
12087
12120
|
}
|
|
12088
12121
|
|
|
12089
12122
|
// src/components/TennisMonitorCard.tsx
|
|
12090
|
-
var
|
|
12123
|
+
var import_react72 = require("react");
|
|
12091
12124
|
var import_widget_sdk27 = require("@sensiblestats/widget-sdk");
|
|
12092
12125
|
|
|
12093
12126
|
// src/components/TennisFixtureRow.tsx
|
|
@@ -12348,7 +12381,7 @@ function TennisLiveScoreboard({ t, score, live, ui }) {
|
|
|
12348
12381
|
}
|
|
12349
12382
|
|
|
12350
12383
|
// src/components/TennisStatsTables.tsx
|
|
12351
|
-
var
|
|
12384
|
+
var import_react71 = require("react");
|
|
12352
12385
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
12353
12386
|
function formatStat(row, value, locale) {
|
|
12354
12387
|
if (value == null) return "\u2013";
|
|
@@ -12386,8 +12419,8 @@ function Tables({ table, labels, names, locale }) {
|
|
|
12386
12419
|
] });
|
|
12387
12420
|
}
|
|
12388
12421
|
function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey }) {
|
|
12389
|
-
const [tab, setTab] = (0,
|
|
12390
|
-
(0,
|
|
12422
|
+
const [tab, setTab] = (0, import_react71.useState)("match");
|
|
12423
|
+
(0, import_react71.useEffect)(() => {
|
|
12391
12424
|
setTab("match");
|
|
12392
12425
|
}, [resetKey]);
|
|
12393
12426
|
const sets = serveReturn.sets.filter((s) => s.table.serve.length + s.table.return.length > 0);
|
|
@@ -12418,7 +12451,7 @@ function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey })
|
|
|
12418
12451
|
] }),
|
|
12419
12452
|
today.rows.map((r) => {
|
|
12420
12453
|
const f = (v) => formatStat({ kind: "pct" }, v, locale);
|
|
12421
|
-
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
12454
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_react71.Fragment, { children: [
|
|
12422
12455
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "ss-w-ts-l", children: r.label }),
|
|
12423
12456
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("span", { className: "ss-w-ts-today-v ss-w-ts-today-v--a", children: [
|
|
12424
12457
|
f(r.p1Today),
|
|
@@ -12553,7 +12586,7 @@ function HeadToHead({ t, ui }) {
|
|
|
12553
12586
|
] });
|
|
12554
12587
|
}
|
|
12555
12588
|
function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
12556
|
-
const lastTables = (0,
|
|
12589
|
+
const lastTables = (0, import_react72.useRef)(null);
|
|
12557
12590
|
const t = match.tennis;
|
|
12558
12591
|
if (!t) return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(UnavailableCard, { match, monitor, ui, sport: "tennis" });
|
|
12559
12592
|
const preMatch = match.phase === "preMatch";
|
|
@@ -12633,7 +12666,7 @@ function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
|
12633
12666
|
}
|
|
12634
12667
|
|
|
12635
12668
|
// src/components/ScoreboardStrip.tsx
|
|
12636
|
-
var
|
|
12669
|
+
var import_react73 = require("react");
|
|
12637
12670
|
var import_widget_sdk28 = require("@sensiblestats/widget-sdk");
|
|
12638
12671
|
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
12639
12672
|
function nbaStatus(m, ui) {
|
|
@@ -12728,8 +12761,8 @@ function rowsFor(m) {
|
|
|
12728
12761
|
];
|
|
12729
12762
|
}
|
|
12730
12763
|
function useStripScroll(selectedKey) {
|
|
12731
|
-
const stripRef = (0,
|
|
12732
|
-
(0,
|
|
12764
|
+
const stripRef = (0, import_react73.useRef)(null);
|
|
12765
|
+
(0, import_react73.useEffect)(() => {
|
|
12733
12766
|
const strip = stripRef.current;
|
|
12734
12767
|
const pressed = strip?.querySelector('[aria-pressed="true"]');
|
|
12735
12768
|
if (!strip || !pressed) return;
|
|
@@ -12903,7 +12936,7 @@ function OddsLiveStrip({ m, ui }) {
|
|
|
12903
12936
|
] });
|
|
12904
12937
|
}
|
|
12905
12938
|
function MatchesPanel({ monitor, ui, slip, onAsk, discovery }) {
|
|
12906
|
-
const seedIndex = (0,
|
|
12939
|
+
const seedIndex = (0, import_react74.useMemo)(() => buildSeedIndex(discovery?.groups ?? []), [discovery?.groups]);
|
|
12907
12940
|
const tiles = orderTiles(
|
|
12908
12941
|
monitor.pins,
|
|
12909
12942
|
monitor.snapshot,
|
|
@@ -12975,7 +13008,7 @@ function TrendsPanel({ monitor, ui, slip }) {
|
|
|
12975
13008
|
}
|
|
12976
13009
|
|
|
12977
13010
|
// src/components/LivePanel.tsx
|
|
12978
|
-
var
|
|
13011
|
+
var import_react77 = require("react");
|
|
12979
13012
|
var import_widget_sdk35 = require("@sensiblestats/widget-sdk");
|
|
12980
13013
|
|
|
12981
13014
|
// src/scheduleView.ts
|
|
@@ -13150,20 +13183,20 @@ function LeagueGroup({ view, open, onToggle, disambiguate, rowCap, onShowAll, on
|
|
|
13150
13183
|
}
|
|
13151
13184
|
|
|
13152
13185
|
// src/components/MatchSheet.tsx
|
|
13153
|
-
var
|
|
13186
|
+
var import_react76 = require("react");
|
|
13154
13187
|
var import_widget_sdk33 = require("@sensiblestats/widget-sdk");
|
|
13155
13188
|
|
|
13156
13189
|
// src/useModalDialog.ts
|
|
13157
|
-
var
|
|
13190
|
+
var import_react75 = require("react");
|
|
13158
13191
|
var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
13159
13192
|
function useModalDialog(onClose, opts = {}) {
|
|
13160
|
-
const dialogRef = (0,
|
|
13161
|
-
const onCloseRef = (0,
|
|
13193
|
+
const dialogRef = (0, import_react75.useRef)(null);
|
|
13194
|
+
const onCloseRef = (0, import_react75.useRef)(onClose);
|
|
13162
13195
|
onCloseRef.current = onClose;
|
|
13163
|
-
const openerRef = (0,
|
|
13196
|
+
const openerRef = (0, import_react75.useRef)(opts.opener);
|
|
13164
13197
|
openerRef.current = opts.opener;
|
|
13165
13198
|
const restore = opts.restoreFocus ?? true;
|
|
13166
|
-
(0,
|
|
13199
|
+
(0, import_react75.useEffect)(() => {
|
|
13167
13200
|
const dialog = dialogRef.current;
|
|
13168
13201
|
const root = dialog?.getRootNode();
|
|
13169
13202
|
const focusedAtMount = root?.activeElement ?? null;
|
|
@@ -13174,7 +13207,7 @@ function useModalDialog(onClose, opts = {}) {
|
|
|
13174
13207
|
if (target instanceof HTMLElement) target.focus({ preventScroll: true });
|
|
13175
13208
|
};
|
|
13176
13209
|
}, []);
|
|
13177
|
-
(0,
|
|
13210
|
+
(0, import_react75.useEffect)(() => {
|
|
13178
13211
|
const onKey = (e) => {
|
|
13179
13212
|
if (e.key !== "Escape") return;
|
|
13180
13213
|
e.stopPropagation();
|
|
@@ -13215,8 +13248,8 @@ function kickoffDate(kickoffUnix, lang, timeZone) {
|
|
|
13215
13248
|
function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose, opener }) {
|
|
13216
13249
|
const { dialogRef, onKeyDown } = useModalDialog(onClose, { opener });
|
|
13217
13250
|
const log = useEventLog();
|
|
13218
|
-
const titleId = (0,
|
|
13219
|
-
const [limitHit, setLimitHit] = (0,
|
|
13251
|
+
const titleId = (0, import_react76.useId)();
|
|
13252
|
+
const [limitHit, setLimitHit] = (0, import_react76.useState)(false);
|
|
13220
13253
|
const pinSport = (0, import_widget_sdk33.slipSportOf)(match.sport);
|
|
13221
13254
|
const tour = pinSport === "tennis" && isKnownTour(match.tour) ? match.tour : void 0;
|
|
13222
13255
|
const followable = pinSport !== "tennis" || tour !== void 0;
|
|
@@ -13317,10 +13350,10 @@ var OPEN_TOP_GROUPS = 2;
|
|
|
13317
13350
|
var QUIET_ROWS = 4;
|
|
13318
13351
|
function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, onLeague, onSeeAll, onAsk }) {
|
|
13319
13352
|
const { groups, states, stale } = discovery;
|
|
13320
|
-
const [mine, setMine] = (0,
|
|
13321
|
-
const [toggled, setToggled] = (0,
|
|
13322
|
-
const [sheet, setSheet] = (0,
|
|
13323
|
-
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)(
|
|
13324
13357
|
() => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk35.matchKey)(p.sport, p.matchId, p.tour))),
|
|
13325
13358
|
[monitor.pins]
|
|
13326
13359
|
);
|
|
@@ -13426,20 +13459,20 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
|
|
|
13426
13459
|
}
|
|
13427
13460
|
|
|
13428
13461
|
// src/components/ScheduleMatchesPanel.tsx
|
|
13429
|
-
var
|
|
13462
|
+
var import_react81 = require("react");
|
|
13430
13463
|
var import_widget_sdk37 = require("@sensiblestats/widget-sdk");
|
|
13431
13464
|
|
|
13432
13465
|
// src/useTennisRowPrices.ts
|
|
13433
|
-
var
|
|
13466
|
+
var import_react78 = require("react");
|
|
13434
13467
|
var import_widget_sdk36 = require("@sensiblestats/widget-sdk");
|
|
13435
13468
|
var TENNIS_PRICE_POLL_MS = 6e4;
|
|
13436
13469
|
function useTennisRowPrices(a) {
|
|
13437
|
-
const [state, setState] = (0,
|
|
13438
|
-
const getPricesRef = (0,
|
|
13470
|
+
const [state, setState] = (0, import_react78.useState)({ byId: null, stale: false });
|
|
13471
|
+
const getPricesRef = (0, import_react78.useRef)(a.getPrices);
|
|
13439
13472
|
getPricesRef.current = a.getPrices;
|
|
13440
|
-
const latest = (0,
|
|
13473
|
+
const latest = (0, import_react78.useRef)(0);
|
|
13441
13474
|
const idsKey = a.keys.filter((k) => isKnownTour(k.tour)).slice(0, MAX_TENNIS_KEYS).map((k) => `${k.tour}:${k.matchId}`).sort().join(",");
|
|
13442
|
-
(0,
|
|
13475
|
+
(0, import_react78.useEffect)(() => {
|
|
13443
13476
|
if (!a.enabled || idsKey === "") {
|
|
13444
13477
|
latest.current++;
|
|
13445
13478
|
setState((prev) => prev.byId === null && !prev.stale ? prev : { byId: null, stale: false });
|
|
@@ -13477,11 +13510,11 @@ function useTennisRowPrices(a) {
|
|
|
13477
13510
|
}
|
|
13478
13511
|
|
|
13479
13512
|
// src/components/DayStrip.tsx
|
|
13480
|
-
var
|
|
13513
|
+
var import_react79 = require("react");
|
|
13481
13514
|
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
13482
13515
|
function DayStrip({ chips, selected, onSelect, ui, locale }) {
|
|
13483
|
-
const listRef = (0,
|
|
13484
|
-
(0,
|
|
13516
|
+
const listRef = (0, import_react79.useRef)(null);
|
|
13517
|
+
(0, import_react79.useEffect)(() => {
|
|
13485
13518
|
const el = listRef.current?.querySelector('[aria-pressed="true"]');
|
|
13486
13519
|
if (!el || typeof el.scrollIntoView !== "function") return;
|
|
13487
13520
|
const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
@@ -13510,7 +13543,7 @@ function DayStrip({ chips, selected, onSelect, ui, locale }) {
|
|
|
13510
13543
|
}
|
|
13511
13544
|
|
|
13512
13545
|
// src/components/games/ui/SearchField.tsx
|
|
13513
|
-
var
|
|
13546
|
+
var import_react80 = require("react");
|
|
13514
13547
|
|
|
13515
13548
|
// src/components/games/ui/icons.tsx
|
|
13516
13549
|
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
@@ -13549,8 +13582,8 @@ var IconFlame = ({ size = 16 }) => svg(size, /* @__PURE__ */ (0, import_jsx_runt
|
|
|
13549
13582
|
// src/components/games/ui/SearchField.tsx
|
|
13550
13583
|
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
13551
13584
|
function SearchField({ id, label, labelHidden = false, placeholder, value, onChange, disabled, inputRef, onKeyDown, clearLabel }) {
|
|
13552
|
-
const localRef = (0,
|
|
13553
|
-
const setInputRef = (0,
|
|
13585
|
+
const localRef = (0, import_react80.useRef)(null);
|
|
13586
|
+
const setInputRef = (0, import_react80.useCallback)((node) => {
|
|
13554
13587
|
localRef.current = node;
|
|
13555
13588
|
if (typeof inputRef === "function") inputRef(node);
|
|
13556
13589
|
else if (inputRef) inputRef.current = node;
|
|
@@ -13596,18 +13629,18 @@ var TOP_ROW_CAP = 3;
|
|
|
13596
13629
|
var SKELETON_ROWS = 3;
|
|
13597
13630
|
function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport, day, onDay, loaded, onOpenLive, onAsk, locale, getTennisPrices, slip }) {
|
|
13598
13631
|
const { localDate: today, states, stale } = discovery;
|
|
13599
|
-
const searchId = (0,
|
|
13600
|
-
const [query, setQuery] = (0,
|
|
13601
|
-
const [toggled, setToggled] = (0,
|
|
13602
|
-
const [expanded, setExpanded] = (0,
|
|
13603
|
-
const listRef = (0,
|
|
13604
|
-
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);
|
|
13605
13638
|
const { chips, selected } = loaded;
|
|
13606
|
-
(0,
|
|
13639
|
+
(0, import_react81.useEffect)(() => {
|
|
13607
13640
|
if (selected !== day) onDay(selected);
|
|
13608
13641
|
}, [day, selected, onDay]);
|
|
13609
13642
|
const isToday = selected === today;
|
|
13610
|
-
const pinnedKeys = (0,
|
|
13643
|
+
const pinnedKeys = (0, import_react81.useMemo)(
|
|
13611
13644
|
() => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk37.matchKey)(p.sport, p.matchId, p.tour))),
|
|
13612
13645
|
[monitor.pins]
|
|
13613
13646
|
);
|
|
@@ -13745,7 +13778,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
13745
13778
|
}
|
|
13746
13779
|
|
|
13747
13780
|
// src/components/GamesPanel.tsx
|
|
13748
|
-
var
|
|
13781
|
+
var import_react96 = require("react");
|
|
13749
13782
|
|
|
13750
13783
|
// src/components/GamesLoginWall.tsx
|
|
13751
13784
|
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
@@ -13754,7 +13787,7 @@ function GamesLoginWall({ ui }) {
|
|
|
13754
13787
|
}
|
|
13755
13788
|
|
|
13756
13789
|
// src/components/GamesHub.tsx
|
|
13757
|
-
var
|
|
13790
|
+
var import_react82 = require("react");
|
|
13758
13791
|
|
|
13759
13792
|
// src/components/games/ui/gameMeta.ts
|
|
13760
13793
|
function prettifyGameId(gameId) {
|
|
@@ -13905,8 +13938,8 @@ function pickHeroGame(games) {
|
|
|
13905
13938
|
}
|
|
13906
13939
|
var tileKey = (g) => `${g.gameId}-${g.gameDay}-${g.fixtureId}`;
|
|
13907
13940
|
function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
13908
|
-
const [, setTick] = (0,
|
|
13909
|
-
(0,
|
|
13941
|
+
const [, setTick] = (0, import_react82.useState)(0);
|
|
13942
|
+
(0, import_react82.useEffect)(() => {
|
|
13910
13943
|
const id = setInterval(() => setTick((t) => t + 1), 6e4);
|
|
13911
13944
|
return () => clearInterval(id);
|
|
13912
13945
|
}, []);
|
|
@@ -13966,10 +13999,10 @@ function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
|
13966
13999
|
}
|
|
13967
14000
|
|
|
13968
14001
|
// src/components/GameScreenHost.tsx
|
|
13969
|
-
var
|
|
14002
|
+
var import_react94 = require("react");
|
|
13970
14003
|
|
|
13971
14004
|
// src/useGamePlay.ts
|
|
13972
|
-
var
|
|
14005
|
+
var import_react83 = require("react");
|
|
13973
14006
|
function toSubmitResult(payload) {
|
|
13974
14007
|
return {
|
|
13975
14008
|
// 'pending' means the play is recorded but awaiting resolution (fixture games)
|
|
@@ -13981,17 +14014,17 @@ function toSubmitResult(payload) {
|
|
|
13981
14014
|
};
|
|
13982
14015
|
}
|
|
13983
14016
|
function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh }) {
|
|
13984
|
-
const [result, setResult] = (0,
|
|
13985
|
-
const [submitting, setSubmitting] = (0,
|
|
13986
|
-
const [rawStatus, setRawStatus] = (0,
|
|
13987
|
-
const inFlightRef = (0,
|
|
13988
|
-
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);
|
|
13989
14022
|
convRef.current = conversation;
|
|
13990
|
-
const optsRef = (0,
|
|
14023
|
+
const optsRef = (0, import_react83.useRef)({ gameId, gameDay, fixtureId, locale, refresh });
|
|
13991
14024
|
optsRef.current = { gameId, gameDay, fixtureId, locale, refresh };
|
|
13992
|
-
const resultRef = (0,
|
|
14025
|
+
const resultRef = (0, import_react83.useRef)(null);
|
|
13993
14026
|
resultRef.current = result;
|
|
13994
|
-
const refetch = (0,
|
|
14027
|
+
const refetch = (0, import_react83.useCallback)(async () => {
|
|
13995
14028
|
const conv = convRef.current;
|
|
13996
14029
|
if (!conv) return;
|
|
13997
14030
|
const opts = optsRef.current;
|
|
@@ -14007,7 +14040,7 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
|
|
|
14007
14040
|
} catch {
|
|
14008
14041
|
}
|
|
14009
14042
|
}, []);
|
|
14010
|
-
const submit = (0,
|
|
14043
|
+
const submit = (0, import_react83.useCallback)(async (answerJson) => {
|
|
14011
14044
|
const conv = convRef.current;
|
|
14012
14045
|
if (!conv || inFlightRef.current) return;
|
|
14013
14046
|
inFlightRef.current = true;
|
|
@@ -14034,14 +14067,14 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
|
|
|
14034
14067
|
setSubmitting(false);
|
|
14035
14068
|
}
|
|
14036
14069
|
}, [refetch]);
|
|
14037
|
-
const hydrate = (0,
|
|
14070
|
+
const hydrate = (0, import_react83.useCallback)(() => {
|
|
14038
14071
|
void refetch();
|
|
14039
14072
|
}, [refetch]);
|
|
14040
14073
|
return { result, submitting, submit, hydrate, rawStatus };
|
|
14041
14074
|
}
|
|
14042
14075
|
|
|
14043
14076
|
// src/components/games/MysteryTigerGame.tsx
|
|
14044
|
-
var
|
|
14077
|
+
var import_react85 = require("react");
|
|
14045
14078
|
|
|
14046
14079
|
// src/components/games/nationFlags.ts
|
|
14047
14080
|
var FLAGS = {
|
|
@@ -14252,7 +14285,7 @@ function isNationCode(flag) {
|
|
|
14252
14285
|
}
|
|
14253
14286
|
|
|
14254
14287
|
// src/components/games/PlayerAvatar.tsx
|
|
14255
|
-
var
|
|
14288
|
+
var import_react84 = require("react");
|
|
14256
14289
|
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
14257
14290
|
function initialsOf(name) {
|
|
14258
14291
|
const parts2 = name.trim().split(/\s+/).filter(Boolean);
|
|
@@ -14270,7 +14303,7 @@ function PlayerAvatar({
|
|
|
14270
14303
|
imagePath,
|
|
14271
14304
|
className
|
|
14272
14305
|
}) {
|
|
14273
|
-
const [failed, setFailed] = (0,
|
|
14306
|
+
const [failed, setFailed] = (0, import_react84.useState)(false);
|
|
14274
14307
|
const showImage = Boolean(imagePath) && !isPlaceholderImage(imagePath) && !failed;
|
|
14275
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) }) });
|
|
14276
14309
|
}
|
|
@@ -14514,8 +14547,8 @@ function MysteryTigerGame({
|
|
|
14514
14547
|
onBack
|
|
14515
14548
|
}) {
|
|
14516
14549
|
const t = ui.games.mysteryTiger;
|
|
14517
|
-
const [query, setQuery] = (0,
|
|
14518
|
-
const inputId = (0,
|
|
14550
|
+
const [query, setQuery] = (0, import_react85.useState)("");
|
|
14551
|
+
const inputId = (0, import_react85.useId)();
|
|
14519
14552
|
const clientState = parseClientState(result?.clientStateJson);
|
|
14520
14553
|
const guessResults = clientState?.guessResults ?? [];
|
|
14521
14554
|
const alreadyGuessedIds = new Set(guessResults.map((g) => g.playerId));
|
|
@@ -14776,13 +14809,13 @@ function HigherOrLowerGame({
|
|
|
14776
14809
|
}
|
|
14777
14810
|
|
|
14778
14811
|
// src/components/games/CareerPathGame.tsx
|
|
14779
|
-
var
|
|
14812
|
+
var import_react87 = require("react");
|
|
14780
14813
|
|
|
14781
14814
|
// src/components/games/ui/CrestShield.tsx
|
|
14782
|
-
var
|
|
14815
|
+
var import_react86 = require("react");
|
|
14783
14816
|
var import_jsx_runtime118 = require("react/jsx-runtime");
|
|
14784
14817
|
function CrestShield({ src, name, size = 28 }) {
|
|
14785
|
-
const [failed, setFailed] = (0,
|
|
14818
|
+
const [failed, setFailed] = (0, import_react86.useState)(false);
|
|
14786
14819
|
if (src && !isPlaceholderImage(src) && !failed) {
|
|
14787
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) });
|
|
14788
14821
|
}
|
|
@@ -14814,8 +14847,8 @@ function CareerPathGame({
|
|
|
14814
14847
|
}) {
|
|
14815
14848
|
const s = ui.games.careerPath;
|
|
14816
14849
|
const title = gameTitle({ gameId: "career-path" }, ui.games.titles);
|
|
14817
|
-
const [query, setQuery] = (0,
|
|
14818
|
-
const inputId = (0,
|
|
14850
|
+
const [query, setQuery] = (0, import_react87.useState)("");
|
|
14851
|
+
const inputId = (0, import_react87.useId)();
|
|
14819
14852
|
const clientState = parseClientState3(result?.clientStateJson);
|
|
14820
14853
|
const alreadyGuessedIds = new Set(clientState?.guessResults.map((g) => g.playerId) ?? []);
|
|
14821
14854
|
const isOver = result?.alreadyPlayed === true || clientState?.solved === true || clientState?.failed === true;
|
|
@@ -14921,7 +14954,7 @@ function CareerPathGame({
|
|
|
14921
14954
|
}
|
|
14922
14955
|
|
|
14923
14956
|
// src/components/games/BeatTheGridGame.tsx
|
|
14924
|
-
var
|
|
14957
|
+
var import_react88 = __toESM(require("react"), 1);
|
|
14925
14958
|
|
|
14926
14959
|
// src/components/games/ui/OptionList.tsx
|
|
14927
14960
|
var import_jsx_runtime120 = require("react/jsx-runtime");
|
|
@@ -15010,10 +15043,10 @@ function SearchSheet({
|
|
|
15010
15043
|
ui
|
|
15011
15044
|
}) {
|
|
15012
15045
|
const s = ui.games.beatTheGrid;
|
|
15013
|
-
const [query, setQuery] = (0,
|
|
15014
|
-
const inputId = (0,
|
|
15015
|
-
const inputRef = (0,
|
|
15016
|
-
(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)(() => {
|
|
15017
15050
|
inputRef.current?.focus();
|
|
15018
15051
|
}, [row, col]);
|
|
15019
15052
|
const filtered = playerPool.filter(
|
|
@@ -15078,7 +15111,7 @@ function BeatTheGridGame({
|
|
|
15078
15111
|
}) {
|
|
15079
15112
|
const s = ui.games.beatTheGrid;
|
|
15080
15113
|
const title = gameTitle({ gameId: "beat-the-grid" }, ui.games.titles);
|
|
15081
|
-
const [activeCell, setActiveCell] = (0,
|
|
15114
|
+
const [activeCell, setActiveCell] = (0, import_react88.useState)(null);
|
|
15082
15115
|
const clientState = parseClientState4(result?.clientStateJson);
|
|
15083
15116
|
const filledCells = clientState?.cells ?? [];
|
|
15084
15117
|
const isLocked2 = result?.alreadyPlayed === true || clientState?.isComplete === true;
|
|
@@ -15152,7 +15185,7 @@ function BeatTheGridGame({
|
|
|
15152
15185
|
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { "aria-hidden": "true", children: abbr }),
|
|
15153
15186
|
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "ss-g-sr", children: rowLabel })
|
|
15154
15187
|
] });
|
|
15155
|
-
return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(
|
|
15188
|
+
return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(import_react88.default.Fragment, { children: [
|
|
15156
15189
|
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "ss-g-btg-rowhdr", "data-meta": rowMeta ? "true" : void 0, children: rowHeaderContent }),
|
|
15157
15190
|
cols.map((colLabel, colIdx) => {
|
|
15158
15191
|
const filled = findCellResult(filledCells, rowIdx, colIdx);
|
|
@@ -15233,7 +15266,7 @@ function BeatTheGridGame({
|
|
|
15233
15266
|
}
|
|
15234
15267
|
|
|
15235
15268
|
// src/components/games/GuessTheXiGame.tsx
|
|
15236
|
-
var
|
|
15269
|
+
var import_react89 = require("react");
|
|
15237
15270
|
|
|
15238
15271
|
// src/components/games/ui/PitchSvg.tsx
|
|
15239
15272
|
var import_jsx_runtime122 = require("react/jsx-runtime");
|
|
@@ -15322,8 +15355,8 @@ function GuessTheXiGame({
|
|
|
15322
15355
|
onBack
|
|
15323
15356
|
}) {
|
|
15324
15357
|
const t = ui.games.guessTheXi;
|
|
15325
|
-
const [query, setQuery] = (0,
|
|
15326
|
-
const inputId = (0,
|
|
15358
|
+
const [query, setQuery] = (0, import_react89.useState)("");
|
|
15359
|
+
const inputId = (0, import_react89.useId)();
|
|
15327
15360
|
const clientState = parseClientState5(result?.clientStateJson);
|
|
15328
15361
|
const isOver = result?.alreadyPlayed === true || clientState?.status === "solved" || clientState?.status === "failed";
|
|
15329
15362
|
const solved = clientState?.status === "solved";
|
|
@@ -15465,7 +15498,7 @@ function GuessTheXiGame({
|
|
|
15465
15498
|
}
|
|
15466
15499
|
|
|
15467
15500
|
// src/components/games/DailyQuizGame.tsx
|
|
15468
|
-
var
|
|
15501
|
+
var import_react90 = require("react");
|
|
15469
15502
|
var import_jsx_runtime124 = require("react/jsx-runtime");
|
|
15470
15503
|
function parseClientState6(json) {
|
|
15471
15504
|
if (!json) return null;
|
|
@@ -15506,8 +15539,8 @@ function DailyQuizGame({
|
|
|
15506
15539
|
}) {
|
|
15507
15540
|
const s = ui.games.dailyQuiz;
|
|
15508
15541
|
const title = gameTitle({ gameId: "daily-quiz" }, ui.games.titles);
|
|
15509
|
-
const [selections, setSelections] = (0,
|
|
15510
|
-
const [page, setPage] = (0,
|
|
15542
|
+
const [selections, setSelections] = (0, import_react90.useState)(/* @__PURE__ */ new Map());
|
|
15543
|
+
const [page, setPage] = (0, import_react90.useState)(0);
|
|
15511
15544
|
const clientState = parseClientState6(result?.clientStateJson);
|
|
15512
15545
|
const results2 = clientState?.results ?? [];
|
|
15513
15546
|
const isRevealed = results2.length > 0 || result?.alreadyPlayed === true;
|
|
@@ -15617,7 +15650,7 @@ function DailyQuizGame({
|
|
|
15617
15650
|
}
|
|
15618
15651
|
|
|
15619
15652
|
// src/components/games/MatchdayPredictorGame.tsx
|
|
15620
|
-
var
|
|
15653
|
+
var import_react91 = require("react");
|
|
15621
15654
|
var import_jsx_runtime125 = require("react/jsx-runtime");
|
|
15622
15655
|
var SCORER_SEARCH_THRESHOLD = 9;
|
|
15623
15656
|
function parseClientState7(json) {
|
|
@@ -15713,12 +15746,12 @@ function MatchdayPredictorGame({
|
|
|
15713
15746
|
onBack
|
|
15714
15747
|
}) {
|
|
15715
15748
|
const t = ui.games.predictor;
|
|
15716
|
-
const [homeScore, setHomeScore] = (0,
|
|
15717
|
-
const [awayScore, setAwayScore] = (0,
|
|
15718
|
-
const [firstScorerPlayerId, setFirstScorerPlayerId] = (0,
|
|
15719
|
-
const [lastEdited, setLastEdited] = (0,
|
|
15720
|
-
const [query, setQuery] = (0,
|
|
15721
|
-
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)();
|
|
15722
15755
|
const clientState = parseClientState7(result?.clientStateJson);
|
|
15723
15756
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
15724
15757
|
const header = /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
@@ -15885,7 +15918,7 @@ function MatchdayPredictorGame({
|
|
|
15885
15918
|
}
|
|
15886
15919
|
|
|
15887
15920
|
// src/components/games/StartingXiGame.tsx
|
|
15888
|
-
var
|
|
15921
|
+
var import_react92 = require("react");
|
|
15889
15922
|
var import_jsx_runtime126 = require("react/jsx-runtime");
|
|
15890
15923
|
var POINTS_PER_STARTER = 8;
|
|
15891
15924
|
var XI_SIZE = 11;
|
|
@@ -15929,10 +15962,10 @@ function StartingXiGame({
|
|
|
15929
15962
|
lockAtUtc
|
|
15930
15963
|
}) {
|
|
15931
15964
|
const t = ui.games.startingXi;
|
|
15932
|
-
const [slotPlayers, setSlotPlayers] = (0,
|
|
15933
|
-
const [active, setActive] = (0,
|
|
15934
|
-
const [query, setQuery] = (0,
|
|
15935
|
-
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)();
|
|
15936
15969
|
const clientState = parseClientState8(result?.clientStateJson);
|
|
15937
15970
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
15938
15971
|
const header = /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
|
|
@@ -16071,7 +16104,7 @@ function StartingXiGame({
|
|
|
16071
16104
|
}
|
|
16072
16105
|
|
|
16073
16106
|
// src/components/games/StatLadderGame.tsx
|
|
16074
|
-
var
|
|
16107
|
+
var import_react93 = require("react");
|
|
16075
16108
|
var import_jsx_runtime127 = require("react/jsx-runtime");
|
|
16076
16109
|
function ladderClue(ladder) {
|
|
16077
16110
|
const mystery = ladder.find((r) => r.rank === 2);
|
|
@@ -16108,9 +16141,9 @@ function StatLadderGame({
|
|
|
16108
16141
|
onBack
|
|
16109
16142
|
}) {
|
|
16110
16143
|
const t = ui.games.statLadder;
|
|
16111
|
-
const [query, setQuery] = (0,
|
|
16112
|
-
const [selectedId, setSelectedId] = (0,
|
|
16113
|
-
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)();
|
|
16114
16147
|
const clientState = parseClientState9(result?.clientStateJson);
|
|
16115
16148
|
const revealed = clientState != null;
|
|
16116
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 });
|
|
@@ -16316,8 +16349,8 @@ function GameScreenHost({
|
|
|
16316
16349
|
ui
|
|
16317
16350
|
}) {
|
|
16318
16351
|
const { gameId, fixtureId, gameDay = "", lockAtUtc = null } = selected;
|
|
16319
|
-
const [configJson, setConfigJson] = (0,
|
|
16320
|
-
(0,
|
|
16352
|
+
const [configJson, setConfigJson] = (0, import_react94.useState)(null);
|
|
16353
|
+
(0, import_react94.useEffect)(() => {
|
|
16321
16354
|
setConfigJson(null);
|
|
16322
16355
|
if (!conversation) return;
|
|
16323
16356
|
let cancelled = false;
|
|
@@ -16340,12 +16373,12 @@ function GameScreenHost({
|
|
|
16340
16373
|
fixtureId: fixtureId || void 0,
|
|
16341
16374
|
locale: ui.hostTag
|
|
16342
16375
|
});
|
|
16343
|
-
(0,
|
|
16376
|
+
(0, import_react94.useEffect)(() => {
|
|
16344
16377
|
if (conversation) hydrate();
|
|
16345
16378
|
}, [conversation, gameId]);
|
|
16346
|
-
const hydrateRef = (0,
|
|
16379
|
+
const hydrateRef = (0, import_react94.useRef)(hydrate);
|
|
16347
16380
|
hydrateRef.current = hydrate;
|
|
16348
|
-
(0,
|
|
16381
|
+
(0, import_react94.useEffect)(() => {
|
|
16349
16382
|
if (!FIXTURE_GAME_IDS.has(gameId)) return;
|
|
16350
16383
|
if (rawStatus !== "pending") return;
|
|
16351
16384
|
const timerId = setInterval(() => {
|
|
@@ -16458,7 +16491,7 @@ function GameScreenHost({
|
|
|
16458
16491
|
}
|
|
16459
16492
|
|
|
16460
16493
|
// src/components/Leaderboard.tsx
|
|
16461
|
-
var
|
|
16494
|
+
var import_react95 = require("react");
|
|
16462
16495
|
|
|
16463
16496
|
// src/components/LeaderboardRow.tsx
|
|
16464
16497
|
var import_jsx_runtime130 = require("react/jsx-runtime");
|
|
@@ -16545,7 +16578,7 @@ function Leaderboard({
|
|
|
16545
16578
|
ui,
|
|
16546
16579
|
onPlay
|
|
16547
16580
|
}) {
|
|
16548
|
-
const [segment, setSegment] = (0,
|
|
16581
|
+
const [segment, setSegment] = (0, import_react95.useState)("weekly");
|
|
16549
16582
|
const myRow = segment === "weekly" ? data.myWeeklyRow : data.myAllTimeRow;
|
|
16550
16583
|
const offBoard = myRow !== null && myRow !== void 0 && myRow.rank === -1;
|
|
16551
16584
|
const isEmpty = segment === "weekly" ? data.weeklyTop.length === 0 : data.allTimeTop.length === 0;
|
|
@@ -16650,9 +16683,9 @@ function GamesPanel({
|
|
|
16650
16683
|
leaderboardLoading,
|
|
16651
16684
|
refreshHub
|
|
16652
16685
|
}) {
|
|
16653
|
-
const [selected, setSelected] = (0,
|
|
16654
|
-
const [segment, setSegment] = (0,
|
|
16655
|
-
(0,
|
|
16686
|
+
const [selected, setSelected] = (0, import_react96.useState)(null);
|
|
16687
|
+
const [segment, setSegment] = (0, import_react96.useState)("play");
|
|
16688
|
+
(0, import_react96.useEffect)(() => {
|
|
16656
16689
|
ensureGamesFonts();
|
|
16657
16690
|
}, []);
|
|
16658
16691
|
if (!loggedIn) return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(GamesLoginWall, { ui });
|
|
@@ -16716,10 +16749,10 @@ function GamesPanel({
|
|
|
16716
16749
|
}
|
|
16717
16750
|
|
|
16718
16751
|
// src/components/FavouritesPanel.tsx
|
|
16719
|
-
var
|
|
16752
|
+
var import_react99 = require("react");
|
|
16720
16753
|
|
|
16721
16754
|
// src/components/FavouriteChips.tsx
|
|
16722
|
-
var
|
|
16755
|
+
var import_react97 = require("react");
|
|
16723
16756
|
var import_jsx_runtime135 = require("react/jsx-runtime");
|
|
16724
16757
|
async function toggleWithNotice(controller, kind, id, onNotice) {
|
|
16725
16758
|
const outcome = await controller.toggle(kind, id);
|
|
@@ -16766,12 +16799,12 @@ function Group({ title, entities, sport, ui, controller, onNotice }) {
|
|
|
16766
16799
|
] });
|
|
16767
16800
|
}
|
|
16768
16801
|
function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNotice }) {
|
|
16769
|
-
const [confirming, setConfirming] = (0,
|
|
16802
|
+
const [confirming, setConfirming] = (0, import_react97.useState)(false);
|
|
16770
16803
|
const data = controller.data;
|
|
16771
|
-
(0,
|
|
16804
|
+
(0, import_react97.useEffect)(() => {
|
|
16772
16805
|
setConfirming(false);
|
|
16773
16806
|
}, [sport]);
|
|
16774
|
-
(0,
|
|
16807
|
+
(0, import_react97.useEffect)(() => {
|
|
16775
16808
|
if (!confirming) return;
|
|
16776
16809
|
const onPointerDown = (e) => {
|
|
16777
16810
|
if (!(e.target instanceof Element) || !e.target.closest("[data-fav-confirm]")) setConfirming(false);
|
|
@@ -16825,21 +16858,21 @@ function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNoti
|
|
|
16825
16858
|
}
|
|
16826
16859
|
|
|
16827
16860
|
// src/components/FavouritesSearch.tsx
|
|
16828
|
-
var
|
|
16861
|
+
var import_react98 = require("react");
|
|
16829
16862
|
var import_jsx_runtime136 = require("react/jsx-runtime");
|
|
16830
16863
|
var MIN_LETTERS = 2;
|
|
16831
16864
|
var MAX_LENGTH = 64;
|
|
16832
16865
|
var DEBOUNCE_MS = 250;
|
|
16833
16866
|
function FavouritesSearch({ controller, ui, sport, onNotice }) {
|
|
16834
|
-
const [query, setQuery] = (0,
|
|
16835
|
-
const [answer, setAnswer] = (0,
|
|
16836
|
-
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);
|
|
16837
16870
|
controllerRef.current = controller;
|
|
16838
16871
|
const trimmed = query.trim();
|
|
16839
16872
|
const queryKey = `${sport}|${trimmed}`;
|
|
16840
16873
|
const results2 = answer?.key === queryKey ? answer.rows : [];
|
|
16841
16874
|
const settled = answer?.key === queryKey;
|
|
16842
|
-
(0,
|
|
16875
|
+
(0, import_react98.useEffect)(() => {
|
|
16843
16876
|
setAnswer(null);
|
|
16844
16877
|
if (trimmed.length < MIN_LETTERS) return;
|
|
16845
16878
|
let cancelled = false;
|
|
@@ -16902,13 +16935,13 @@ function FavouritesSearch({ controller, ui, sport, onNotice }) {
|
|
|
16902
16935
|
// src/components/FavouritesPanel.tsx
|
|
16903
16936
|
var import_jsx_runtime137 = require("react/jsx-runtime");
|
|
16904
16937
|
function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
|
|
16905
|
-
const [notice, setNotice] = (0,
|
|
16906
|
-
const refreshRef = (0,
|
|
16938
|
+
const [notice, setNotice] = (0, import_react99.useState)(null);
|
|
16939
|
+
const refreshRef = (0, import_react99.useRef)(controller.refresh);
|
|
16907
16940
|
refreshRef.current = controller.refresh;
|
|
16908
|
-
(0,
|
|
16941
|
+
(0, import_react99.useEffect)(() => {
|
|
16909
16942
|
void refreshRef.current();
|
|
16910
16943
|
}, []);
|
|
16911
|
-
(0,
|
|
16944
|
+
(0, import_react99.useEffect)(() => {
|
|
16912
16945
|
setNotice(null);
|
|
16913
16946
|
}, [sport]);
|
|
16914
16947
|
const sportLabel2 = sports.find((s) => s.sport === sport)?.label ?? sportLabel(ui, sport);
|
|
@@ -16934,7 +16967,7 @@ function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
|
|
|
16934
16967
|
}
|
|
16935
16968
|
|
|
16936
16969
|
// src/components/dashboard/v8/SentenceBuilder.tsx
|
|
16937
|
-
var
|
|
16970
|
+
var import_react100 = require("react");
|
|
16938
16971
|
var import_jsx_runtime138 = require("react/jsx-runtime");
|
|
16939
16972
|
var TOTALS = ["any", "3", "5", "10", "20", "50"];
|
|
16940
16973
|
var BASE_LEGS = [1, 2, 3, 4];
|
|
@@ -16960,8 +16993,8 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
16960
16993
|
const opening = openingGames(preset);
|
|
16961
16994
|
const gamesOptions = opening.options;
|
|
16962
16995
|
const marketOptions = usableMarkets(preset);
|
|
16963
|
-
const [fingerprint] = (0,
|
|
16964
|
-
const [saved] = (0,
|
|
16996
|
+
const [fingerprint] = (0, import_react100.useState)(() => JSON.stringify(preset));
|
|
16997
|
+
const [saved] = (0, import_react100.useState)(() => {
|
|
16965
16998
|
const kept = memory3?.savedView(sport);
|
|
16966
16999
|
return kept && kept.fingerprint === fingerprint ? kept : null;
|
|
16967
17000
|
});
|
|
@@ -16975,9 +17008,9 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
16975
17008
|
// The server never widens by itself: an all-games preset with no ids asks for it.
|
|
16976
17009
|
widen: opening.option ? opening.option.matchIds.length === 0 : preset.gamesScope === "all" && preset.matchIds.length === 0
|
|
16977
17010
|
};
|
|
16978
|
-
const [view, setView] = (0,
|
|
16979
|
-
const autoWidened = (0,
|
|
16980
|
-
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);
|
|
16981
17014
|
const requestFor = (v) => ({
|
|
16982
17015
|
sport,
|
|
16983
17016
|
...v.marketKey !== null ? { marketKey: v.marketKey } : {},
|
|
@@ -16989,10 +17022,10 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
16989
17022
|
...operatorUserId ? { operatorUserId } : {},
|
|
16990
17023
|
...anonymousUserId ? { anonymousUserId } : {}
|
|
16991
17024
|
});
|
|
16992
|
-
const [first] = (0,
|
|
17025
|
+
const [first] = (0, import_react100.useState)(() => requestFor(view));
|
|
16993
17026
|
const { grid, status: status2, confirmed, request } = useBuilderGrid({ conversation, locale: ui.hostTag, memory: memory3, initial: first });
|
|
16994
|
-
const lastRequest = (0,
|
|
16995
|
-
(0,
|
|
17027
|
+
const lastRequest = (0, import_react100.useRef)(first);
|
|
17028
|
+
(0, import_react100.useEffect)(() => {
|
|
16996
17029
|
void request(lastRequest.current);
|
|
16997
17030
|
}, [request]);
|
|
16998
17031
|
const send = (req) => {
|
|
@@ -17025,14 +17058,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
17025
17058
|
const rows = ready && grid.status === "ok" ? legsOf(grid, sport) : null;
|
|
17026
17059
|
const rowSlip = rows ? guardLegsPreMatch(slip, rows, ui) : slip;
|
|
17027
17060
|
useNextKickoffRender(rows ? rows.map((l) => l.kickoffUtc) : []);
|
|
17028
|
-
const [startedNote, setStartedNote] = (0,
|
|
17061
|
+
const [startedNote, setStartedNote] = (0, import_react100.useState)(false);
|
|
17029
17062
|
const anyStarted = rows !== null && rows.some((l) => !preMatchOpen(l.kickoffUtc, Date.now()));
|
|
17030
|
-
(0,
|
|
17063
|
+
(0, import_react100.useEffect)(() => {
|
|
17031
17064
|
if (startedNote && status2 === "ready" && !anyStarted) setStartedNote(false);
|
|
17032
17065
|
}, [startedNote, status2, anyStarted]);
|
|
17033
17066
|
const market = rows?.[0]?.market;
|
|
17034
|
-
const [seen2, setSeen] = (0,
|
|
17035
|
-
(0,
|
|
17067
|
+
const [seen2, setSeen] = (0, import_react100.useState)(null);
|
|
17068
|
+
(0, import_react100.useEffect)(() => {
|
|
17036
17069
|
if (market) setSeen(market);
|
|
17037
17070
|
}, [market]);
|
|
17038
17071
|
const marketName = view.marketKey === null ? null : marketOptions?.find((m) => m.key === view.marketKey)?.label ?? market ?? seen2;
|
|
@@ -17045,14 +17078,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
17045
17078
|
const quotedAt = rows ? oldestQuote(rows) : null;
|
|
17046
17079
|
const combo = ready && grid.total !== null ? { sport, totalChosen: view.total, totalActual: grid.total } : void 0;
|
|
17047
17080
|
const canWiden = gamesOptions === null || allGames !== null;
|
|
17048
|
-
(0,
|
|
17081
|
+
(0, import_react100.useEffect)(() => {
|
|
17049
17082
|
if (!empty2 || !singles || widened || !canWiden || autoWidened.current) return;
|
|
17050
17083
|
autoWidened.current = true;
|
|
17051
17084
|
const next = { ...view, widen: true, matchIds: [], gamesId: allGames ? allGames.id : view.gamesId };
|
|
17052
17085
|
commit(next, true);
|
|
17053
17086
|
send(requestFor(next));
|
|
17054
17087
|
}, [empty2, singles, widened, canWiden, view]);
|
|
17055
|
-
(0,
|
|
17088
|
+
(0, import_react100.useEffect)(() => {
|
|
17056
17089
|
if (coolOff) onCoolOff?.(sport);
|
|
17057
17090
|
}, [coolOff, onCoolOff, sport]);
|
|
17058
17091
|
if (coolOff) return null;
|
|
@@ -17455,10 +17488,10 @@ function Squad({ squad, loading, ui, view, onToggleView, stats, statsLoading, se
|
|
|
17455
17488
|
}
|
|
17456
17489
|
|
|
17457
17490
|
// src/components/PlayerPhoto.tsx
|
|
17458
|
-
var
|
|
17491
|
+
var import_react101 = require("react");
|
|
17459
17492
|
var import_jsx_runtime144 = require("react/jsx-runtime");
|
|
17460
17493
|
function PlayerPhoto({ photoUrl, jerseyNumber, size }) {
|
|
17461
|
-
const [failed, setFailed] = (0,
|
|
17494
|
+
const [failed, setFailed] = (0, import_react101.useState)(false);
|
|
17462
17495
|
const box = { width: size, height: size };
|
|
17463
17496
|
if (photoUrl && !failed) {
|
|
17464
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) });
|
|
@@ -17493,7 +17526,7 @@ function MiniPitch({ positionCode }) {
|
|
|
17493
17526
|
}
|
|
17494
17527
|
|
|
17495
17528
|
// src/components/PerformanceBars.tsx
|
|
17496
|
-
var
|
|
17529
|
+
var import_react102 = require("react");
|
|
17497
17530
|
var import_jsx_runtime146 = require("react/jsx-runtime");
|
|
17498
17531
|
var GROUPS = ["shooting", "passing", "possession", "defending"];
|
|
17499
17532
|
function finite4(v) {
|
|
@@ -17539,7 +17572,7 @@ function unrankedLine(ui, reason) {
|
|
|
17539
17572
|
}
|
|
17540
17573
|
}
|
|
17541
17574
|
function PerformanceBars({ performance, competitionName, strings }) {
|
|
17542
|
-
const [mode, setMode] = (0,
|
|
17575
|
+
const [mode, setMode] = (0, import_react102.useState)("total");
|
|
17543
17576
|
const labelled = performance.metrics.filter((m) => Object.prototype.hasOwnProperty.call(strings.perfMetric, m.key));
|
|
17544
17577
|
if (!labelled.some((m) => valueOf(m, "total") !== null || valueOf(m, "per90") !== null)) return null;
|
|
17545
17578
|
const subtitle = !performance.ranked ? unrankedLine(strings, performance.unrankedReason) : competitionName ? strings.perfRankedAgainst(competitionName, performance.positionGroup) : null;
|
|
@@ -17711,11 +17744,11 @@ function PlayerDetail({ detail, loading, ui, seasonName, onClose }) {
|
|
|
17711
17744
|
}
|
|
17712
17745
|
|
|
17713
17746
|
// src/components/PresetTools.tsx
|
|
17714
|
-
var
|
|
17747
|
+
var import_react103 = require("react");
|
|
17715
17748
|
var import_jsx_runtime148 = require("react/jsx-runtime");
|
|
17716
17749
|
function PresetToolModal({ title, closeLabel, onClose, children, footer, className }) {
|
|
17717
17750
|
const { dialogRef, onKeyDown } = useModalDialog(onClose, { restoreFocus: false });
|
|
17718
|
-
const titleId = (0,
|
|
17751
|
+
const titleId = (0, import_react103.useId)();
|
|
17719
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: [
|
|
17720
17753
|
/* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "ss-w-tool-head", children: [
|
|
17721
17754
|
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("h2", { id: titleId, className: "ss-w-tool-title", children: title }),
|
|
@@ -17765,9 +17798,9 @@ function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal,
|
|
|
17765
17798
|
const totalOptions = comboTotals(grid);
|
|
17766
17799
|
const totals = totalOptions.map((o) => o.value);
|
|
17767
17800
|
const legChoices = comboLegChoices(grid);
|
|
17768
|
-
const [total, setTotal] = (0,
|
|
17769
|
-
const [legs, setLegs] = (0,
|
|
17770
|
-
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)("");
|
|
17771
17804
|
const cell2 = findCombo(grid, total, legs);
|
|
17772
17805
|
const minLegs = legChoices[0] ?? legs;
|
|
17773
17806
|
const maxLegs = legChoices[legChoices.length - 1] ?? legs;
|
|
@@ -17837,8 +17870,8 @@ function SettingsSheet({ ui, onClose }) {
|
|
|
17837
17870
|
var import_jsx_runtime150 = require("react/jsx-runtime");
|
|
17838
17871
|
var FULLSCREEN_QUERY = "(max-width: 639px)";
|
|
17839
17872
|
function useIsModal() {
|
|
17840
|
-
const [modal, setModal] = (0,
|
|
17841
|
-
(0,
|
|
17873
|
+
const [modal, setModal] = (0, import_react104.useState)(false);
|
|
17874
|
+
(0, import_react104.useEffect)(() => {
|
|
17842
17875
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
17843
17876
|
const mql = window.matchMedia(FULLSCREEN_QUERY);
|
|
17844
17877
|
const sync = () => setModal(mql.matches);
|
|
@@ -17852,12 +17885,12 @@ var HIDDEN_LAYER_STYLE = { position: "absolute", inset: 0, visibility: "hidden",
|
|
|
17852
17885
|
var SQUAD_LAYER_STYLE = { display: "flex", flexDirection: "column", flex: 1, minHeight: 0 };
|
|
17853
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 }) {
|
|
17854
17887
|
const { state, close, stop, send, reset } = controller;
|
|
17855
|
-
const [squadView, setSquadView] = (0,
|
|
17856
|
-
const [selectedPlayerId, setSelectedPlayerId] = (0,
|
|
17888
|
+
const [squadView, setSquadView] = (0, import_react104.useState)("roster");
|
|
17889
|
+
const [selectedPlayerId, setSelectedPlayerId] = (0, import_react104.useState)(null);
|
|
17857
17890
|
const clearPlayerDetail = clubPlayerDetailResult?.clear;
|
|
17858
17891
|
const fetchPlayerDetail = clubPlayerDetailResult?.fetch;
|
|
17859
|
-
const squadLayerRef = (0,
|
|
17860
|
-
const squadScrollRef = (0,
|
|
17892
|
+
const squadLayerRef = (0, import_react104.useRef)(null);
|
|
17893
|
+
const squadScrollRef = (0, import_react104.useRef)(null);
|
|
17861
17894
|
const selectPlayer = (playerId) => {
|
|
17862
17895
|
squadScrollRef.current = squadLayerRef.current?.querySelector(".ss-w-mon-list")?.scrollTop ?? null;
|
|
17863
17896
|
setSelectedPlayerId(playerId);
|
|
@@ -17867,7 +17900,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17867
17900
|
setSelectedPlayerId(null);
|
|
17868
17901
|
clearPlayerDetail?.();
|
|
17869
17902
|
};
|
|
17870
|
-
(0,
|
|
17903
|
+
(0, import_react104.useLayoutEffect)(() => {
|
|
17871
17904
|
if (selectedPlayerId !== null || squadScrollRef.current === null) return;
|
|
17872
17905
|
const list = squadLayerRef.current?.querySelector(".ss-w-mon-list");
|
|
17873
17906
|
if (list) list.scrollTop = squadScrollRef.current;
|
|
@@ -17880,16 +17913,16 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17880
17913
|
const hasBuilder = !clubBrand && (builderOptions?.length ?? 0) > 0;
|
|
17881
17914
|
const tabs = monitor ?? (hasBuilder ? tabState : void 0);
|
|
17882
17915
|
const activeTab = tabs?.activeTab;
|
|
17883
|
-
(0,
|
|
17916
|
+
(0, import_react104.useEffect)(() => {
|
|
17884
17917
|
if (activeTab === "squad" || selectedPlayerId === null) return;
|
|
17885
17918
|
setSelectedPlayerId(null);
|
|
17886
17919
|
clearPlayerDetail?.();
|
|
17887
17920
|
}, [activeTab, selectedPlayerId, clearPlayerDetail]);
|
|
17888
|
-
(0,
|
|
17921
|
+
(0, import_react104.useEffect)(() => {
|
|
17889
17922
|
if (activeTab === "favourites" && !favouritesEnabled) setMonitorTab?.("chat");
|
|
17890
17923
|
}, [activeTab, favouritesEnabled, setMonitorTab]);
|
|
17891
17924
|
const storedTab = tabState?.activeTab;
|
|
17892
|
-
(0,
|
|
17925
|
+
(0, import_react104.useEffect)(() => {
|
|
17893
17926
|
const unreachable = storedTab === "builder" ? !hasBuilder : !monitor && storedTab !== void 0 && storedTab !== "chat";
|
|
17894
17927
|
if (unreachable) setMonitorTab?.("chat");
|
|
17895
17928
|
}, [storedTab, hasBuilder, monitor, setMonitorTab]);
|
|
@@ -17898,12 +17931,12 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17898
17931
|
const closeTab = tabs?.activeTab ?? "chat";
|
|
17899
17932
|
const lastMessage = state.messages[state.messages.length - 1];
|
|
17900
17933
|
const answering = state.isStreaming && !(lastMessage?.role === "assistant" && lastMessage.isGreeting);
|
|
17901
|
-
const closeWith = (0,
|
|
17934
|
+
const closeWith = (0, import_react104.useCallback)((method) => {
|
|
17902
17935
|
track({ name: "widget_close", method, tab: closeTab, answering });
|
|
17903
17936
|
if (onCloseRequested) onCloseRequested();
|
|
17904
17937
|
else close();
|
|
17905
17938
|
}, [track, closeTab, answering, close, onCloseRequested]);
|
|
17906
|
-
(0,
|
|
17939
|
+
(0, import_react104.useEffect)(() => {
|
|
17907
17940
|
const onKey = (e) => {
|
|
17908
17941
|
if (e.key === "Escape") closeWith("escape");
|
|
17909
17942
|
};
|
|
@@ -17919,69 +17952,69 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17919
17952
|
tabs?.setActiveTab("chat");
|
|
17920
17953
|
send(text2, { grounding, source });
|
|
17921
17954
|
};
|
|
17922
|
-
(0,
|
|
17955
|
+
(0, import_react104.useEffect)(() => {
|
|
17923
17956
|
if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
|
|
17924
17957
|
}, [monitor, state.isStreaming, state.messages.length]);
|
|
17925
17958
|
const onChatTab = !tabs || tabs.activeTab === "chat";
|
|
17926
|
-
const inputRef = (0,
|
|
17927
|
-
const limitRef = (0,
|
|
17928
|
-
const typedSendRef = (0,
|
|
17929
|
-
const focusAfterCloseRef = (0,
|
|
17930
|
-
const [tool, setTool] = (0,
|
|
17931
|
-
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);
|
|
17932
17965
|
const settings = useOddsSettings();
|
|
17933
|
-
const [settingsOpen, setSettingsOpen] = (0,
|
|
17966
|
+
const [settingsOpen, setSettingsOpen] = (0, import_react104.useState)(false);
|
|
17934
17967
|
const hasSettings = settings.oddsOffered || !settings.themeLocked;
|
|
17935
|
-
const openSettings = (0,
|
|
17968
|
+
const openSettings = (0, import_react104.useCallback)(() => {
|
|
17936
17969
|
setTool(null);
|
|
17937
17970
|
setSettingsOpen(true);
|
|
17938
17971
|
}, []);
|
|
17939
|
-
const closeSettings = (0,
|
|
17972
|
+
const closeSettings = (0, import_react104.useCallback)(() => {
|
|
17940
17973
|
setSettingsOpen(false);
|
|
17941
17974
|
panelRef.current?.querySelector(".ss-w-kebab")?.focus();
|
|
17942
17975
|
}, []);
|
|
17943
17976
|
const paused = isPaused(state.limit);
|
|
17944
|
-
(0,
|
|
17977
|
+
(0, import_react104.useEffect)(() => {
|
|
17945
17978
|
if (paused) setTool(null);
|
|
17946
17979
|
}, [paused]);
|
|
17947
|
-
(0,
|
|
17980
|
+
(0, import_react104.useEffect)(() => {
|
|
17948
17981
|
if (!paused) return;
|
|
17949
17982
|
if (typedSendRef.current) limitRef.current?.focus();
|
|
17950
17983
|
typedSendRef.current = false;
|
|
17951
17984
|
}, [paused]);
|
|
17952
|
-
const openTool = (0,
|
|
17985
|
+
const openTool = (0, import_react104.useCallback)((next) => {
|
|
17953
17986
|
setTool(next);
|
|
17954
17987
|
}, []);
|
|
17955
|
-
const toolsValue = (0,
|
|
17988
|
+
const toolsValue = (0, import_react104.useMemo)(
|
|
17956
17989
|
() => presetGrid && !paused ? { openBuilder: (total, legs) => openTool({ total, legs }), changeLabel: ui.presets.changeCombo } : null,
|
|
17957
17990
|
[presetGrid, paused, openTool, ui.presets.changeCombo]
|
|
17958
17991
|
);
|
|
17959
|
-
const closeTool = (0,
|
|
17992
|
+
const closeTool = (0, import_react104.useCallback)(() => {
|
|
17960
17993
|
focusAfterCloseRef.current = "composer";
|
|
17961
17994
|
setTool(null);
|
|
17962
17995
|
}, []);
|
|
17963
|
-
const sendAsk = (0,
|
|
17996
|
+
const sendAsk = (0, import_react104.useCallback)((ask) => {
|
|
17964
17997
|
focusAfterCloseRef.current = "composer";
|
|
17965
17998
|
setTool(null);
|
|
17966
17999
|
tabs?.setActiveTab("chat");
|
|
17967
18000
|
send(ask.message, { displayText: ask.displayText, preset: ask.preset, source: "preset" });
|
|
17968
18001
|
}, [tabs, send]);
|
|
17969
|
-
const formatKickoff = (0,
|
|
18002
|
+
const formatKickoff = (0, import_react104.useCallback)((kickoffUtc) => {
|
|
17970
18003
|
const k = ui.bettingKickoff(kickoffUtc);
|
|
17971
18004
|
return `${k.dayLabel} ${k.time}`;
|
|
17972
18005
|
}, [ui]);
|
|
17973
|
-
(0,
|
|
18006
|
+
(0, import_react104.useEffect)(() => {
|
|
17974
18007
|
if (tool) return;
|
|
17975
18008
|
const target = focusAfterCloseRef.current;
|
|
17976
18009
|
focusAfterCloseRef.current = null;
|
|
17977
18010
|
if (target === "composer") inputRef.current?.focus();
|
|
17978
18011
|
}, [tool]);
|
|
17979
|
-
(0,
|
|
18012
|
+
(0, import_react104.useEffect)(() => {
|
|
17980
18013
|
if (!tool || onChatTab && presetGrid) return;
|
|
17981
18014
|
focusAfterCloseRef.current = "composer";
|
|
17982
18015
|
setTool(null);
|
|
17983
18016
|
}, [tool, onChatTab, presetGrid]);
|
|
17984
|
-
const backRef = (0,
|
|
18017
|
+
const backRef = (0, import_react104.useRef)(() => false);
|
|
17985
18018
|
backRef.current = () => {
|
|
17986
18019
|
if (settingsOpen && hasSettings) {
|
|
17987
18020
|
closeSettings();
|
|
@@ -18001,7 +18034,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18001
18034
|
}
|
|
18002
18035
|
return false;
|
|
18003
18036
|
};
|
|
18004
|
-
(0,
|
|
18037
|
+
(0, import_react104.useEffect)(() => {
|
|
18005
18038
|
if (!onRegisterBack) return;
|
|
18006
18039
|
onRegisterBack(() => backRef.current());
|
|
18007
18040
|
return () => onRegisterBack(null);
|
|
@@ -18544,6 +18577,8 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
18544
18577
|
.ss-w-nba-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
|
|
18545
18578
|
.ss-w-nba-head-l { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
|
|
18546
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; }
|
|
18547
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; }
|
|
18548
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)}
|
|
18549
18584
|
.ss-w-nba-chip { flex: none; color: var(--ss-w-warn); border-color: var(--ss-w-warn); }
|
|
@@ -19914,6 +19949,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
19914
19949
|
.ss-w-nbamon-side { display: flex; align-items: center; gap: 8px; min-width: 0; }
|
|
19915
19950
|
.ss-w-nbamon-side--home { flex-direction: row-reverse; text-align: right; }
|
|
19916
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; }
|
|
19917
19953
|
.ss-w-nbamon-team { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
|
|
19918
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; }
|
|
19919
19955
|
.ss-w-nbamon-nick { font-size: 13px; font-weight: 800; color: var(--ss-w-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
@@ -20240,6 +20276,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
20240
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; }
|
|
20241
20277
|
.ss-w-props-jn--home { background: var(--ss-w-home); }
|
|
20242
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); }
|
|
20243
20280
|
.ss-w-props-pn { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
|
|
20244
20281
|
.ss-w-props-name { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
20245
20282
|
.ss-w-props-meta { font-size: 11px; color: var(--ss-w-faint); }
|
|
@@ -20969,12 +21006,12 @@ function injectStyles(root) {
|
|
|
20969
21006
|
function StatsWidget(props) {
|
|
20970
21007
|
const injectedClient = "client" in props ? props.client : void 0;
|
|
20971
21008
|
const cfg = props.config;
|
|
20972
|
-
const built = (0,
|
|
20973
|
-
const trackingRef = (0,
|
|
20974
|
-
const track = (0,
|
|
20975
|
-
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);
|
|
20976
21013
|
eventTextRef.current = cfg?.eventText === true;
|
|
20977
|
-
const logger = (0,
|
|
21014
|
+
const logger = (0, import_react105.useMemo)(() => {
|
|
20978
21015
|
if (!built) return null;
|
|
20979
21016
|
const raw = built.client.createEventLogger({
|
|
20980
21017
|
operatorUserId: cfg?.userContext?.operatorUserId,
|
|
@@ -20984,27 +21021,27 @@ function StatsWidget(props) {
|
|
|
20984
21021
|
}, [built?.client, track]);
|
|
20985
21022
|
const widgetStrings = useWidgetStrings(cfg, built?.conversation ?? null);
|
|
20986
21023
|
const stringsPending = widgetStrings.strings === void 0;
|
|
20987
|
-
const ui = (0,
|
|
21024
|
+
const ui = (0, import_react105.useMemo)(
|
|
20988
21025
|
() => normalizeUi(props.config ?? { operatorId: "", publicKey: "" }, widgetStrings.strings ?? BUNDLED),
|
|
20989
21026
|
[props.config, widgetStrings.strings]
|
|
20990
21027
|
);
|
|
20991
21028
|
const oddsSettings = useOddsSettingsState(ui, built?.conversation, cfg?.operatorId || "default");
|
|
20992
|
-
const rootRef = (0,
|
|
20993
|
-
const introDoneRef = (0,
|
|
20994
|
-
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)(() => {
|
|
20995
21032
|
introDoneRef.current = true;
|
|
20996
21033
|
}, []);
|
|
20997
21034
|
const language = injectedClient ? void 0 : hostTag(cfg);
|
|
20998
21035
|
const threadLanguage = familyOf(language);
|
|
20999
21036
|
const convStorageKey = `ss-w-conv:${cfg?.operatorId ?? ""}:${cfg?.userContext?.operatorUserId ?? "anon"}${threadLanguage ? `:lang=${threadLanguage}` : ""}`;
|
|
21000
|
-
const sportScope = (0,
|
|
21037
|
+
const sportScope = (0, import_react105.useMemo)(
|
|
21001
21038
|
() => ({ operatorId: cfg?.operatorId ?? "", operatorUserId: cfg?.userContext?.operatorUserId, anonymousUserId: cfg?.userContext?.anonymousUserId }),
|
|
21002
21039
|
[cfg?.operatorId, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId]
|
|
21003
21040
|
);
|
|
21004
|
-
const chatTracking = (0,
|
|
21041
|
+
const chatTracking = (0, import_react105.useMemo)(() => ({ track, eventText: () => eventTextRef.current }), [track]);
|
|
21005
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);
|
|
21006
21043
|
const panelOpen = controller.state.isOpen && !stringsPending;
|
|
21007
|
-
const liveCardWatches = (0,
|
|
21044
|
+
const liveCardWatches = (0, import_react105.useMemo)(() => {
|
|
21008
21045
|
const seen2 = /* @__PURE__ */ new Set();
|
|
21009
21046
|
const out = [];
|
|
21010
21047
|
for (const msg of controller.state.messages) {
|
|
@@ -21030,19 +21067,19 @@ function StatsWidget(props) {
|
|
|
21030
21067
|
});
|
|
21031
21068
|
const operatorUserId = cfg?.userContext?.operatorUserId;
|
|
21032
21069
|
const anonymousUserId = cfg?.userContext?.anonymousUserId;
|
|
21033
|
-
const getSchedule = (0,
|
|
21070
|
+
const getSchedule = (0, import_react105.useCallback)(
|
|
21034
21071
|
(localDate, utcOffsetMinutes) => built ? built.conversation.getSchedule(localDate, utcOffsetMinutes, operatorUserId, anonymousUserId) : Promise.resolve(null),
|
|
21035
21072
|
[built, operatorUserId, anonymousUserId]
|
|
21036
21073
|
);
|
|
21037
|
-
const getStates = (0,
|
|
21074
|
+
const getStates = (0, import_react105.useCallback)(
|
|
21038
21075
|
(matchIds, nbaGameIds, nflGameIds, tennisMatches) => built ? built.conversation.getStates(matchIds, nbaGameIds, nflGameIds, requestTag, tennisMatches) : Promise.resolve(null),
|
|
21039
21076
|
[built, requestTag]
|
|
21040
21077
|
);
|
|
21041
|
-
const getTennisPrices = (0,
|
|
21078
|
+
const getTennisPrices = (0, import_react105.useCallback)(
|
|
21042
21079
|
(keys) => built ? built.conversation.getStates([], [], [], requestTag, [], keys).then((p) => p?.tennisPrices ?? null) : Promise.resolve(null),
|
|
21043
21080
|
[built, requestTag]
|
|
21044
21081
|
);
|
|
21045
|
-
const pinnedMatchIds = (0,
|
|
21082
|
+
const pinnedMatchIds = (0, import_react105.useMemo)(
|
|
21046
21083
|
() => footballMatchPinIds(monitor.pins),
|
|
21047
21084
|
[monitor.pins]
|
|
21048
21085
|
);
|
|
@@ -21056,13 +21093,13 @@ function StatsWidget(props) {
|
|
|
21056
21093
|
pinnedMatchIds,
|
|
21057
21094
|
timeZone: ui.timeZone
|
|
21058
21095
|
});
|
|
21059
|
-
const offeredSports = (0,
|
|
21096
|
+
const offeredSports = (0, import_react105.useMemo)(() => {
|
|
21060
21097
|
const seen2 = new Set(discovery.matchDays.map((d) => d.sport));
|
|
21061
21098
|
for (const g of discovery.groups) seen2.add(g.sport ?? "football");
|
|
21062
21099
|
return [...seen2];
|
|
21063
21100
|
}, [discovery.matchDays, discovery.groups]);
|
|
21064
21101
|
const scheduleSport = useScheduleSport(offeredSports);
|
|
21065
|
-
const [liveLeague, setLiveLeague] = (0,
|
|
21102
|
+
const [liveLeague, setLiveLeague] = (0, import_react105.useState)(null);
|
|
21066
21103
|
const [matchesDay, setMatchesDay] = useMatchesDayPick(discovery.localDate);
|
|
21067
21104
|
const matchesLoaded = useMatchesDay({
|
|
21068
21105
|
discovery,
|
|
@@ -21072,8 +21109,8 @@ function StatsWidget(props) {
|
|
|
21072
21109
|
enabled: panelOpen && monitor.activeTab === "matches",
|
|
21073
21110
|
timeZone: ui.timeZone
|
|
21074
21111
|
});
|
|
21075
|
-
const prevLiveSnapshotRef = (0,
|
|
21076
|
-
(0,
|
|
21112
|
+
const prevLiveSnapshotRef = (0, import_react105.useRef)(monitor.snapshot);
|
|
21113
|
+
(0, import_react105.useEffect)(() => {
|
|
21077
21114
|
const snap = monitor.snapshot;
|
|
21078
21115
|
if (!snap || snap === prevLiveSnapshotRef.current) return;
|
|
21079
21116
|
prevLiveSnapshotRef.current = snap;
|
|
@@ -21113,14 +21150,14 @@ function StatsWidget(props) {
|
|
|
21113
21150
|
const clubSquadResult = useClubSquad(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
21114
21151
|
const clubSquadStatsResult = useClubSquadStats(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
21115
21152
|
const clubPlayerDetailResult = useClubPlayerDetail(built?.conversation ?? null);
|
|
21116
|
-
const [favSportPick, setFavSportPick] = (0,
|
|
21117
|
-
const latestGreeting = (0,
|
|
21153
|
+
const [favSportPick, setFavSportPick] = (0, import_react105.useState)(null);
|
|
21154
|
+
const latestGreeting = (0, import_react105.useMemo)(() => {
|
|
21118
21155
|
for (const m of [...controller.state.messages].reverse()) {
|
|
21119
21156
|
if (m.role === "assistant" && m.defaultSport !== void 0) return m;
|
|
21120
21157
|
}
|
|
21121
21158
|
return null;
|
|
21122
21159
|
}, [controller.state.messages]);
|
|
21123
|
-
const favSportOptions = (0,
|
|
21160
|
+
const favSportOptions = (0, import_react105.useMemo)(
|
|
21124
21161
|
() => (switchSets(latestGreeting?.greetingDashboards) ?? []).map((set) => ({ sport: set.sport, label: set.label })),
|
|
21125
21162
|
[latestGreeting]
|
|
21126
21163
|
);
|
|
@@ -21129,20 +21166,20 @@ function StatsWidget(props) {
|
|
|
21129
21166
|
const favSport = [favSportPick, rememberedSport, latestGreeting?.defaultSport].find(offered) ?? "football";
|
|
21130
21167
|
const favSports = favSportOptions.length > 0 ? favSportOptions : [{ sport: favSport, label: sportLabel(ui, favSport) }];
|
|
21131
21168
|
const hasFavouritesIdentity = !!(operatorUserId || anonymousUserId);
|
|
21132
|
-
const [builderSportPick, setBuilderSportPick] = (0,
|
|
21133
|
-
const builderGreeting = (0,
|
|
21169
|
+
const [builderSportPick, setBuilderSportPick] = (0, import_react105.useState)(null);
|
|
21170
|
+
const builderGreeting = (0, import_react105.useMemo)(
|
|
21134
21171
|
() => [...controller.state.messages].reverse().find((m) => m.role === "assistant" && (m.greetingDashboard !== void 0 || m.greetingDashboards !== void 0)) ?? null,
|
|
21135
21172
|
[controller.state.messages]
|
|
21136
21173
|
);
|
|
21137
|
-
const [coolOff, setCoolOff] = (0,
|
|
21138
|
-
const onBuilderCoolOff = (0,
|
|
21174
|
+
const [coolOff, setCoolOff] = (0, import_react105.useState)(null);
|
|
21175
|
+
const onBuilderCoolOff = (0, import_react105.useCallback)((sport) => {
|
|
21139
21176
|
if (!builderGreeting) return;
|
|
21140
21177
|
setCoolOff((prev) => {
|
|
21141
21178
|
const sports = prev?.greeting === builderGreeting ? prev.sports : [];
|
|
21142
21179
|
return sports.includes(sport) ? prev : { greeting: builderGreeting, sports: [...sports, sport] };
|
|
21143
21180
|
});
|
|
21144
21181
|
}, [builderGreeting]);
|
|
21145
|
-
const builderOptions = (0,
|
|
21182
|
+
const builderOptions = (0, import_react105.useMemo)(() => {
|
|
21146
21183
|
const greeting = builderGreeting;
|
|
21147
21184
|
if (!greeting) return [];
|
|
21148
21185
|
const cooled = coolOff?.greeting === greeting ? coolOff.sports : [];
|
|
@@ -21155,7 +21192,7 @@ function StatsWidget(props) {
|
|
|
21155
21192
|
return options.filter((o) => !cooled.includes(o.sport));
|
|
21156
21193
|
}, [builderGreeting, coolOff, ui]);
|
|
21157
21194
|
const builderSport = [builderSportPick, rememberedSport, latestGreeting?.defaultSport].find((s) => !!s && builderOptions.some((o) => o.sport === s)) ?? builderOptions[0]?.sport ?? "";
|
|
21158
|
-
const [panelEverOpened, setPanelEverOpened] = (0,
|
|
21195
|
+
const [panelEverOpened, setPanelEverOpened] = (0, import_react105.useState)(panelOpen);
|
|
21159
21196
|
if (panelOpen && !panelEverOpened) setPanelEverOpened(true);
|
|
21160
21197
|
const favourites = useFavourites({
|
|
21161
21198
|
conversation: built?.conversation ?? null,
|
|
@@ -21167,14 +21204,14 @@ function StatsWidget(props) {
|
|
|
21167
21204
|
onChanged: discovery.refreshSchedule
|
|
21168
21205
|
});
|
|
21169
21206
|
const favouritesEnabled = hasFavouritesIdentity && favourites.status !== "refused";
|
|
21170
|
-
const getPricePresets = (0,
|
|
21207
|
+
const getPricePresets = (0, import_react105.useCallback)(
|
|
21171
21208
|
(locale) => built ? built.conversation.getPricePresets(locale, { pool: "open" }) : Promise.resolve(null),
|
|
21172
21209
|
[built]
|
|
21173
21210
|
);
|
|
21174
21211
|
const presetGrid = usePresetGrid({ getPricePresets, isOpen: panelOpen, locale: ui.hostTag });
|
|
21175
21212
|
const markLiveActivity = monitor.markLiveActivity;
|
|
21176
|
-
const prevLiveCountRef = (0,
|
|
21177
|
-
(0,
|
|
21213
|
+
const prevLiveCountRef = (0, import_react105.useRef)(0);
|
|
21214
|
+
(0, import_react105.useEffect)(() => {
|
|
21178
21215
|
const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
|
|
21179
21216
|
prevLiveCountRef.current = discovery.liveCount;
|
|
21180
21217
|
if (rose) markLiveActivity();
|
|
@@ -21188,7 +21225,7 @@ function StatsWidget(props) {
|
|
|
21188
21225
|
closePanel: controller.close
|
|
21189
21226
|
});
|
|
21190
21227
|
const markAdded = hostEvents.markAdded;
|
|
21191
|
-
const slip = (0,
|
|
21228
|
+
const slip = (0, import_react105.useMemo)(
|
|
21192
21229
|
() => {
|
|
21193
21230
|
const handler = props.config?.onAddToSlip;
|
|
21194
21231
|
return {
|
|
@@ -21208,7 +21245,7 @@ function StatsWidget(props) {
|
|
|
21208
21245
|
},
|
|
21209
21246
|
[props.config?.onAddToSlip, props.config?.slipSports, controller.state.conversationId, markAdded]
|
|
21210
21247
|
);
|
|
21211
|
-
const onDashboardTap = (0,
|
|
21248
|
+
const onDashboardTap = (0, import_react105.useMemo)(
|
|
21212
21249
|
() => built ? createDashboardTapSignal((input) => built.conversation.sendSignal(input), logger) : void 0,
|
|
21213
21250
|
[built, logger]
|
|
21214
21251
|
);
|
|
@@ -21222,7 +21259,7 @@ function StatsWidget(props) {
|
|
|
21222
21259
|
log: logger
|
|
21223
21260
|
})
|
|
21224
21261
|
}));
|
|
21225
|
-
const dismissPopupRef = (0,
|
|
21262
|
+
const dismissPopupRef = (0, import_react105.useRef)(() => {
|
|
21226
21263
|
});
|
|
21227
21264
|
const mobile = useMobileBinding({
|
|
21228
21265
|
binding: props.mobile,
|
|
@@ -21236,10 +21273,10 @@ function StatsWidget(props) {
|
|
|
21236
21273
|
const dismissPopup = usePopupTelemetry(logger, panelOpen, controller.state.popupText, controller.dismissPopup, mobile.confirmedShown);
|
|
21237
21274
|
dismissPopupRef.current = dismissPopup;
|
|
21238
21275
|
useOpenTelemetry(logger, panelOpen);
|
|
21239
|
-
const onControlRef = (0,
|
|
21276
|
+
const onControlRef = (0, import_react105.useRef)(props.onControl);
|
|
21240
21277
|
onControlRef.current = props.onControl;
|
|
21241
21278
|
const { open: openPanel, close: closePanel } = controller;
|
|
21242
|
-
(0,
|
|
21279
|
+
(0, import_react105.useEffect)(() => {
|
|
21243
21280
|
onControlRef.current?.({ open: openPanel, close: closePanel });
|
|
21244
21281
|
return () => onControlRef.current?.(null);
|
|
21245
21282
|
}, [openPanel, closePanel]);
|
|
@@ -21256,11 +21293,11 @@ function StatsWidget(props) {
|
|
|
21256
21293
|
page: cfg?.page
|
|
21257
21294
|
}
|
|
21258
21295
|
};
|
|
21259
|
-
(0,
|
|
21296
|
+
(0, import_react105.useEffect)(() => {
|
|
21260
21297
|
if (!logger) return;
|
|
21261
21298
|
logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
|
|
21262
21299
|
}, [logger, operatorUserId, anonymousUserId, conversationId]);
|
|
21263
|
-
(0,
|
|
21300
|
+
(0, import_react105.useEffect)(() => {
|
|
21264
21301
|
if (!logger) return;
|
|
21265
21302
|
logger.resume();
|
|
21266
21303
|
const onHide = () => {
|
|
@@ -21278,15 +21315,15 @@ function StatsWidget(props) {
|
|
|
21278
21315
|
logger.dispose();
|
|
21279
21316
|
};
|
|
21280
21317
|
}, [logger]);
|
|
21281
|
-
(0,
|
|
21318
|
+
(0, import_react105.useEffect)(() => {
|
|
21282
21319
|
if (!built || !ui.injectStyles || widgetStrings.state === "unavailable") return;
|
|
21283
21320
|
const node = rootRef.current?.getRootNode();
|
|
21284
21321
|
if (node) injectStyles(node);
|
|
21285
21322
|
}, [built, ui.injectStyles, widgetStrings.state]);
|
|
21286
21323
|
const holds = useSessionHolds();
|
|
21287
21324
|
const builderConversation = built?.conversation ?? null;
|
|
21288
|
-
const builderMemory = (0,
|
|
21289
|
-
const personalGreeting = (0,
|
|
21325
|
+
const builderMemory = (0, import_react105.useMemo)(() => createBuilderMemory(), [builderConversation, controller.state.threadEpoch]);
|
|
21326
|
+
const personalGreeting = (0, import_react105.useMemo)(() => ({
|
|
21290
21327
|
favourites: favouritesEnabled && monitor.enabled ? favourites : null,
|
|
21291
21328
|
conversation: built?.conversation ?? null,
|
|
21292
21329
|
openFavourites: () => monitor.setActiveTab("favourites"),
|