@sensiblestats/widget-react 0.138.1 → 0.138.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/index.cjs +327 -312
- 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 +163 -148
- package/dist/index.js.map +1 -1
- package/dist/styles.css +2 -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_react108 = require("react");
|
|
42
42
|
var import_widget_sdk38 = require("@sensiblestats/widget-sdk");
|
|
43
43
|
|
|
44
44
|
// src/strings/tag.ts
|
|
@@ -1337,7 +1337,7 @@ function parseOddsFormat(value) {
|
|
|
1337
1337
|
}
|
|
1338
1338
|
|
|
1339
1339
|
// src/version.generated.ts
|
|
1340
|
-
var WIDGET_REACT_VERSION = "0.138.
|
|
1340
|
+
var WIDGET_REACT_VERSION = "0.138.2";
|
|
1341
1341
|
|
|
1342
1342
|
// src/config.ts
|
|
1343
1343
|
function hostTag(cfg) {
|
|
@@ -2501,6 +2501,9 @@ function toNflInsightVM(card) {
|
|
|
2501
2501
|
competition: str(card.competitionName),
|
|
2502
2502
|
kickoffLabel: str(card.kickoffLabel),
|
|
2503
2503
|
kickoffUtc: str(card.kickoffUtc) ?? null,
|
|
2504
|
+
homeTeamImage: str(card.homeTeamImagePath),
|
|
2505
|
+
awayTeamImage: str(card.awayTeamImagePath),
|
|
2506
|
+
competitionImage: str(card.competitionImagePath),
|
|
2504
2507
|
addToSlipEnabled: card.addToSlipEnabled === true,
|
|
2505
2508
|
disclaimer: str(card.disclaimer),
|
|
2506
2509
|
selections,
|
|
@@ -7853,7 +7856,7 @@ function ChatFab({ label, busy = false, greeting, popupText, logoUrl, onOpen, on
|
|
|
7853
7856
|
}
|
|
7854
7857
|
|
|
7855
7858
|
// src/components/ChatPanel.tsx
|
|
7856
|
-
var
|
|
7859
|
+
var import_react107 = require("react");
|
|
7857
7860
|
|
|
7858
7861
|
// src/components/ChatHeader.tsx
|
|
7859
7862
|
var import_react49 = require("react");
|
|
@@ -7971,10 +7974,10 @@ function ChatHeader({
|
|
|
7971
7974
|
}
|
|
7972
7975
|
|
|
7973
7976
|
// src/components/MessageList.tsx
|
|
7974
|
-
var
|
|
7977
|
+
var import_react63 = require("react");
|
|
7975
7978
|
|
|
7976
7979
|
// src/components/ChatMessage.tsx
|
|
7977
|
-
var
|
|
7980
|
+
var import_react62 = require("react");
|
|
7978
7981
|
|
|
7979
7982
|
// src/components/Markdown.tsx
|
|
7980
7983
|
var import_react_markdown = __toESM(require("react-markdown"), 1);
|
|
@@ -8922,6 +8925,9 @@ function NbaInsightList({ insights, ui, slip, monitor }) {
|
|
|
8922
8925
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "ss-w-nba-cards", children: insights.map((vm, i) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(NbaCard, { vm, ui, slip, monitor }, `${vm.id}:${i}`)) });
|
|
8923
8926
|
}
|
|
8924
8927
|
|
|
8928
|
+
// src/components/NflInsightList.tsx
|
|
8929
|
+
var import_react53 = require("react");
|
|
8930
|
+
|
|
8925
8931
|
// src/strings/types.ts
|
|
8926
8932
|
var fillNfl = (template, values) => template.replace(/\{(\w+)\}/g, (whole, key) => key in values ? String(values[key]) : whole);
|
|
8927
8933
|
|
|
@@ -8930,7 +8936,11 @@ var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
|
8930
8936
|
var oneDecimal2 = (n, ui) => formatNumber(n, ui.locale, { minimumFractionDigits: 1, maximumFractionDigits: 1 });
|
|
8931
8937
|
var cap = (text2, ui) => text2 ? upperCase(text2.charAt(0), ui.locale) + text2.slice(1) : text2;
|
|
8932
8938
|
var lineNumber = (line) => Number(line.replace("\u2212", "-").replace(",", "."));
|
|
8933
|
-
function Badge({ abbr }) {
|
|
8939
|
+
function Badge({ abbr, url }) {
|
|
8940
|
+
const [failed, setFailed] = (0, import_react53.useState)(false);
|
|
8941
|
+
if (url && !failed) {
|
|
8942
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("img", { className: "ss-w-nfl-badge ss-w-nfl-badge--img", src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
8943
|
+
}
|
|
8934
8944
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "ss-w-nfl-badge", children: abbr });
|
|
8935
8945
|
}
|
|
8936
8946
|
function Price({ vm, selection, label, ui, slip, nowMs }) {
|
|
@@ -8971,12 +8981,12 @@ function Head2({ vm, ui, monitor }) {
|
|
|
8971
8981
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "ss-w-nfl-head-l", children: [
|
|
8972
8982
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("p", { className: "ss-w-nfl-meta", children: [
|
|
8973
8983
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "ss-w-nfl-side", children: [
|
|
8974
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Badge, { abbr: vm.homeAbbr }),
|
|
8984
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Badge, { abbr: vm.homeAbbr, url: vm.homeTeamImage }),
|
|
8975
8985
|
vm.homeTeamName ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: vm.homeTeamName }) : null
|
|
8976
8986
|
] }),
|
|
8977
8987
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "ss-w-nfl-sep", "aria-hidden": "true", children: "\xB7" }),
|
|
8978
8988
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "ss-w-nfl-side", children: [
|
|
8979
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Badge, { abbr: vm.awayAbbr }),
|
|
8989
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Badge, { abbr: vm.awayAbbr, url: vm.awayTeamImage }),
|
|
8980
8990
|
vm.awayTeamName ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: vm.awayTeamName }) : null
|
|
8981
8991
|
] }),
|
|
8982
8992
|
vm.kickoffLabel ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "ss-w-nfl-kick", children: vm.kickoffLabel }) : null
|
|
@@ -9050,8 +9060,8 @@ function LineMove2({ vm, lm, ui, slip, nowMs }) {
|
|
|
9050
9060
|
const nfl = ui.nfl;
|
|
9051
9061
|
const { oddsFormat } = useOddsSettings();
|
|
9052
9062
|
const who = (side) => {
|
|
9053
|
-
if (side === "home") return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Badge, { abbr: vm.homeAbbr });
|
|
9054
|
-
if (side === "away") return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Badge, { abbr: vm.awayAbbr });
|
|
9063
|
+
if (side === "home") return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Badge, { abbr: vm.homeAbbr, url: vm.homeTeamImage });
|
|
9064
|
+
if (side === "away") return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Badge, { abbr: vm.awayAbbr, url: vm.awayTeamImage });
|
|
9055
9065
|
return cap(side === "under" ? nfl.under : nfl.over, ui);
|
|
9056
9066
|
};
|
|
9057
9067
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "ss-w-nfl-lm", children: [
|
|
@@ -9538,7 +9548,7 @@ function TennisInsightList({ insights, ui }) {
|
|
|
9538
9548
|
}
|
|
9539
9549
|
|
|
9540
9550
|
// src/components/CompactOddsList.tsx
|
|
9541
|
-
var
|
|
9551
|
+
var import_react54 = require("react");
|
|
9542
9552
|
var import_widget_sdk23 = require("@sensiblestats/widget-sdk");
|
|
9543
9553
|
|
|
9544
9554
|
// src/compactList.ts
|
|
@@ -9660,11 +9670,11 @@ function Row({ row, columns, ui, slip, monitor, rowRef }) {
|
|
|
9660
9670
|
] });
|
|
9661
9671
|
}
|
|
9662
9672
|
function CompactOddsList({ list, ui, slip, monitor }) {
|
|
9663
|
-
const [shown2, setShown] = (0,
|
|
9673
|
+
const [shown2, setShown] = (0, import_react54.useState)(COMPACT_PAGE);
|
|
9664
9674
|
const hidden = list.rowCount - shown2;
|
|
9665
|
-
const [focusIndex, setFocusIndex] = (0,
|
|
9666
|
-
const focusRef = (0,
|
|
9667
|
-
(0,
|
|
9675
|
+
const [focusIndex, setFocusIndex] = (0, import_react54.useState)(null);
|
|
9676
|
+
const focusRef = (0, import_react54.useRef)(null);
|
|
9677
|
+
(0, import_react54.useEffect)(() => {
|
|
9668
9678
|
if (focusIndex !== null) focusRef.current?.focus();
|
|
9669
9679
|
}, [focusIndex]);
|
|
9670
9680
|
let left = shown2;
|
|
@@ -9899,7 +9909,7 @@ function FixtureCard({ card, ui }) {
|
|
|
9899
9909
|
}
|
|
9900
9910
|
|
|
9901
9911
|
// src/components/dashboard/CountdownCard.tsx
|
|
9902
|
-
var
|
|
9912
|
+
var import_react55 = require("react");
|
|
9903
9913
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
9904
9914
|
var DAY_MS3 = 864e5;
|
|
9905
9915
|
function remainingSegments(kickoffUnix, nowMs, withSeconds) {
|
|
@@ -9918,12 +9928,12 @@ function remainingSegments(kickoffUnix, nowMs, withSeconds) {
|
|
|
9918
9928
|
function CountdownCard({ card, ui }) {
|
|
9919
9929
|
const { data } = card;
|
|
9920
9930
|
const unitLabel = { d: data.daysUnit, h: data.hoursUnit, m: data.minutesUnit, s: data.secondsUnit };
|
|
9921
|
-
const [nowMs, setNowMs] = (0,
|
|
9922
|
-
const [reduced] = (0,
|
|
9931
|
+
const [nowMs, setNowMs] = (0, import_react55.useState)(() => Date.now());
|
|
9932
|
+
const [reduced] = (0, import_react55.useState)(
|
|
9923
9933
|
() => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
|
9924
9934
|
);
|
|
9925
9935
|
const withinDay = data.kickoffUnix * 1e3 - nowMs < DAY_MS3;
|
|
9926
|
-
(0,
|
|
9936
|
+
(0, import_react55.useEffect)(() => {
|
|
9927
9937
|
if (reduced) return;
|
|
9928
9938
|
const id = window.setInterval(() => setNowMs(Date.now()), withinDay ? 1e3 : 6e4);
|
|
9929
9939
|
return () => window.clearInterval(id);
|
|
@@ -9931,7 +9941,7 @@ function CountdownCard({ card, ui }) {
|
|
|
9931
9941
|
const segments = remainingSegments(data.kickoffUnix, nowMs, withinDay && !reduced);
|
|
9932
9942
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "ss-w-fandash-card ss-w-fandash-countdown", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "ss-w-fandash-countdown-top", children: [
|
|
9933
9943
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ss-w-fandash-eyebrow", children: card.title ?? ui.countdownTitle }),
|
|
9934
|
-
segments ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ss-w-fandash-countdown-clock", children: segments.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
9944
|
+
segments ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ss-w-fandash-countdown-clock", children: segments.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_react55.Fragment, { children: [
|
|
9935
9945
|
i > 0 ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ss-w-fandash-countdown-colon", children: ":" }) : null,
|
|
9936
9946
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { className: "ss-w-fandash-countdown-seg", children: [
|
|
9937
9947
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ss-w-fandash-countdown-value", children: s.value }),
|
|
@@ -9942,7 +9952,7 @@ function CountdownCard({ card, ui }) {
|
|
|
9942
9952
|
}
|
|
9943
9953
|
|
|
9944
9954
|
// src/components/dashboard/InjuriesCard.tsx
|
|
9945
|
-
var
|
|
9955
|
+
var import_react56 = require("react");
|
|
9946
9956
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
9947
9957
|
var SHOWN = 3;
|
|
9948
9958
|
function ColHead({ name, crestUrl }) {
|
|
@@ -9965,7 +9975,7 @@ function InjuryList({ rows, emptyLabel, limit }) {
|
|
|
9965
9975
|
}
|
|
9966
9976
|
function InjuriesCard({ card, ui }) {
|
|
9967
9977
|
const { data } = card;
|
|
9968
|
-
const [expanded, setExpanded] = (0,
|
|
9978
|
+
const [expanded, setExpanded] = (0, import_react56.useState)(false);
|
|
9969
9979
|
const hidden = Math.max(0, data.ours.length - SHOWN) + Math.max(0, data.theirs.length - SHOWN);
|
|
9970
9980
|
const limit = expanded ? void 0 : SHOWN;
|
|
9971
9981
|
const { showMore, showLess } = ui;
|
|
@@ -10070,7 +10080,7 @@ function LinksCard({ card }) {
|
|
|
10070
10080
|
}
|
|
10071
10081
|
|
|
10072
10082
|
// src/components/dashboard/PostMatchResultCard.tsx
|
|
10073
|
-
var
|
|
10083
|
+
var import_react57 = require("react");
|
|
10074
10084
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
10075
10085
|
function initials3(name) {
|
|
10076
10086
|
return name.trim().slice(0, 3).toUpperCase();
|
|
@@ -10080,7 +10090,7 @@ function PostMatchCrest({
|
|
|
10080
10090
|
name,
|
|
10081
10091
|
side
|
|
10082
10092
|
}) {
|
|
10083
|
-
const [failed, setFailed] = (0,
|
|
10093
|
+
const [failed, setFailed] = (0, import_react57.useState)(false);
|
|
10084
10094
|
const cls = `ss-w-fandash-postmatch-crest ss-w-fandash-postmatch-crest--${side}`;
|
|
10085
10095
|
if (url && !failed) {
|
|
10086
10096
|
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -10279,10 +10289,10 @@ function RestingFormCard({ card }) {
|
|
|
10279
10289
|
}
|
|
10280
10290
|
|
|
10281
10291
|
// src/components/dashboard/LiveScoreCard.tsx
|
|
10282
|
-
var
|
|
10292
|
+
var import_react59 = require("react");
|
|
10283
10293
|
|
|
10284
10294
|
// src/useLiveClock.ts
|
|
10285
|
-
var
|
|
10295
|
+
var import_react58 = require("react");
|
|
10286
10296
|
var TICK_MS = 6e4;
|
|
10287
10297
|
var MAX_LIVE_TICK_MINUTES = 15;
|
|
10288
10298
|
function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
|
|
@@ -10291,10 +10301,10 @@ function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
|
|
|
10291
10301
|
return minute + Math.min(Math.max(0, elapsedMinutes), MAX_LIVE_TICK_MINUTES);
|
|
10292
10302
|
}
|
|
10293
10303
|
function useLiveClock(minute, clockRunning, receivedAtMs) {
|
|
10294
|
-
const [displayMinute, setDisplayMinute] = (0,
|
|
10304
|
+
const [displayMinute, setDisplayMinute] = (0, import_react58.useState)(
|
|
10295
10305
|
() => computeDisplayMinute(minute, clockRunning, receivedAtMs)
|
|
10296
10306
|
);
|
|
10297
|
-
(0,
|
|
10307
|
+
(0, import_react58.useEffect)(() => {
|
|
10298
10308
|
setDisplayMinute(computeDisplayMinute(minute, clockRunning, receivedAtMs));
|
|
10299
10309
|
if (!clockRunning) return;
|
|
10300
10310
|
const id = window.setInterval(() => {
|
|
@@ -10311,7 +10321,7 @@ function initials5(name) {
|
|
|
10311
10321
|
return name.trim().slice(0, 3).toUpperCase();
|
|
10312
10322
|
}
|
|
10313
10323
|
function LiveCrest({ url, name, side }) {
|
|
10314
|
-
const [failed, setFailed] = (0,
|
|
10324
|
+
const [failed, setFailed] = (0, import_react59.useState)(false);
|
|
10315
10325
|
const cls = `ss-w-fandash-live-crest ss-w-fandash-live-crest--${side}`;
|
|
10316
10326
|
if (url && !failed) {
|
|
10317
10327
|
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -10333,7 +10343,7 @@ function LiveScoreCard({
|
|
|
10333
10343
|
}) {
|
|
10334
10344
|
const { data } = card;
|
|
10335
10345
|
const seedKey = `${data.minute}:${data.homeScore}:${data.awayScore}`;
|
|
10336
|
-
const seedRef = (0,
|
|
10346
|
+
const seedRef = (0, import_react59.useRef)(null);
|
|
10337
10347
|
if (!seedRef.current || seedRef.current.key !== seedKey) {
|
|
10338
10348
|
seedRef.current = { key: seedKey, receivedAtMs: Date.now() };
|
|
10339
10349
|
}
|
|
@@ -10379,7 +10389,7 @@ function LiveScoreCard({
|
|
|
10379
10389
|
}
|
|
10380
10390
|
|
|
10381
10391
|
// src/components/dashboard/LiveTimelineCard.tsx
|
|
10382
|
-
var
|
|
10392
|
+
var import_react60 = require("react");
|
|
10383
10393
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
10384
10394
|
var SHOWN2 = 3;
|
|
10385
10395
|
function EventIcon({ type }) {
|
|
@@ -10421,7 +10431,7 @@ function EventRow({ e }) {
|
|
|
10421
10431
|
] });
|
|
10422
10432
|
}
|
|
10423
10433
|
function LiveTimelineCard({ card, ui }) {
|
|
10424
|
-
const [expanded, setExpanded] = (0,
|
|
10434
|
+
const [expanded, setExpanded] = (0, import_react60.useState)(false);
|
|
10425
10435
|
const events = card.data.events;
|
|
10426
10436
|
if (!events || events.length === 0) return null;
|
|
10427
10437
|
const sorted = [...events].sort((a, b) => b.minute - a.minute);
|
|
@@ -10445,7 +10455,7 @@ function LiveTimelineCard({ card, ui }) {
|
|
|
10445
10455
|
}
|
|
10446
10456
|
|
|
10447
10457
|
// src/components/dashboard/MomentumWave.tsx
|
|
10448
|
-
var
|
|
10458
|
+
var import_react61 = require("react");
|
|
10449
10459
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
10450
10460
|
var WIDTH = 270;
|
|
10451
10461
|
var HEIGHT = 56;
|
|
@@ -10470,7 +10480,7 @@ function MomentumWave({
|
|
|
10470
10480
|
}) {
|
|
10471
10481
|
if (points.length === 0) return null;
|
|
10472
10482
|
const { area, line, lastLeftPct, lastTopPx } = buildPaths(points);
|
|
10473
|
-
const clipId = (0,
|
|
10483
|
+
const clipId = (0, import_react61.useId)();
|
|
10474
10484
|
const topClipId = `${clipId}-top`;
|
|
10475
10485
|
const bottomClipId = `${clipId}-bottom`;
|
|
10476
10486
|
const topClass = clubIsHome ? "ss-w-fandash-live-mom-home" : "ss-w-fandash-live-mom-away";
|
|
@@ -10620,7 +10630,7 @@ function FanDashboardCard({ card, onTap, ui, goalEvents }) {
|
|
|
10620
10630
|
// src/components/ChatMessage.tsx
|
|
10621
10631
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
10622
10632
|
function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor, onGreetingSport }) {
|
|
10623
|
-
const [sport, setSport] = (0,
|
|
10633
|
+
const [sport, setSport] = (0, import_react62.useState)(null);
|
|
10624
10634
|
if (message.role === "user") {
|
|
10625
10635
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "ss-w-msg ss-w-user", "data-msg-id": message.id, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "ss-w-bubble", children: message.text }) });
|
|
10626
10636
|
}
|
|
@@ -10674,11 +10684,11 @@ function turnAnchor(messages) {
|
|
|
10674
10684
|
function MessageList({ controller, ui, slip, onDashboardTap, monitor, onGreetingSport }) {
|
|
10675
10685
|
const { state, send } = controller;
|
|
10676
10686
|
const { oddsFormat } = useOddsSettings();
|
|
10677
|
-
const listRef = (0,
|
|
10678
|
-
const endRef = (0,
|
|
10679
|
-
const pinnedRef = (0,
|
|
10680
|
-
const anchoredTurnRef = (0,
|
|
10681
|
-
(0,
|
|
10687
|
+
const listRef = (0, import_react63.useRef)(null);
|
|
10688
|
+
const endRef = (0, import_react63.useRef)(null);
|
|
10689
|
+
const pinnedRef = (0, import_react63.useRef)(true);
|
|
10690
|
+
const anchoredTurnRef = (0, import_react63.useRef)(null);
|
|
10691
|
+
(0, import_react63.useEffect)(() => {
|
|
10682
10692
|
const anchor = turnAnchor(state.messages);
|
|
10683
10693
|
const list = listRef.current;
|
|
10684
10694
|
if (anchor && anchor.turnId !== anchoredTurnRef.current) {
|
|
@@ -10737,13 +10747,13 @@ function MessageList({ controller, ui, slip, onDashboardTap, monitor, onGreeting
|
|
|
10737
10747
|
}
|
|
10738
10748
|
|
|
10739
10749
|
// src/components/ChatInput.tsx
|
|
10740
|
-
var
|
|
10750
|
+
var import_react64 = require("react");
|
|
10741
10751
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
10742
|
-
var ChatInput = (0,
|
|
10743
|
-
const [value, setValue] = (0,
|
|
10744
|
-
const textareaRef = (0,
|
|
10745
|
-
const stopRef = (0,
|
|
10746
|
-
const textBoxWantsFocusRef = (0,
|
|
10752
|
+
var ChatInput = (0, import_react64.forwardRef)(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel, sendLabel, disabled = false }, ref) {
|
|
10753
|
+
const [value, setValue] = (0, import_react64.useState)("");
|
|
10754
|
+
const textareaRef = (0, import_react64.useRef)(null);
|
|
10755
|
+
const stopRef = (0, import_react64.useRef)(null);
|
|
10756
|
+
const textBoxWantsFocusRef = (0, import_react64.useRef)(false);
|
|
10747
10757
|
const submit = () => {
|
|
10748
10758
|
if (disabled) return;
|
|
10749
10759
|
const t = value.trim();
|
|
@@ -10757,7 +10767,7 @@ var ChatInput = (0, import_react63.forwardRef)(function ChatInput2({ placeholder
|
|
|
10757
10767
|
submit();
|
|
10758
10768
|
}
|
|
10759
10769
|
};
|
|
10760
|
-
(0,
|
|
10770
|
+
(0, import_react64.useImperativeHandle)(ref, () => ({
|
|
10761
10771
|
focus() {
|
|
10762
10772
|
const box = textareaRef.current;
|
|
10763
10773
|
if (box && !box.disabled) {
|
|
@@ -10769,7 +10779,7 @@ var ChatInput = (0, import_react63.forwardRef)(function ChatInput2({ placeholder
|
|
|
10769
10779
|
stopRef.current?.focus();
|
|
10770
10780
|
}
|
|
10771
10781
|
}), []);
|
|
10772
|
-
(0,
|
|
10782
|
+
(0, import_react64.useEffect)(() => {
|
|
10773
10783
|
if (streaming || disabled || !textBoxWantsFocusRef.current) return;
|
|
10774
10784
|
textBoxWantsFocusRef.current = false;
|
|
10775
10785
|
const box = textareaRef.current;
|
|
@@ -10800,7 +10810,7 @@ var ChatInput = (0, import_react63.forwardRef)(function ChatInput2({ placeholder
|
|
|
10800
10810
|
});
|
|
10801
10811
|
|
|
10802
10812
|
// src/components/TabBar.tsx
|
|
10803
|
-
var
|
|
10813
|
+
var import_react65 = require("react");
|
|
10804
10814
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
10805
10815
|
var TIGHT_LEVELS = [0, 1, 2, 3, 4, 5, 6];
|
|
10806
10816
|
function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule, hasBuilder = false, gamesEnabled, clubEnabled }) {
|
|
@@ -10822,16 +10832,16 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
10822
10832
|
...gamesEnabled ? [{ tab: "games", label: ui.tabGames, count: 0, dot: false }] : []
|
|
10823
10833
|
];
|
|
10824
10834
|
const track = useTrack();
|
|
10825
|
-
const listRef = (0,
|
|
10835
|
+
const listRef = (0, import_react65.useRef)(null);
|
|
10826
10836
|
const activeTab = monitor.activeTab;
|
|
10827
|
-
(0,
|
|
10837
|
+
(0, import_react65.useEffect)(() => {
|
|
10828
10838
|
const el = listRef.current?.querySelector("[data-on]");
|
|
10829
10839
|
if (!el || typeof el.scrollIntoView !== "function") return;
|
|
10830
10840
|
const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
10831
10841
|
el.scrollIntoView({ block: "nearest", inline: "nearest", behavior: reduce ? "auto" : "smooth" });
|
|
10832
10842
|
}, [activeTab]);
|
|
10833
10843
|
const labelSignature = tabs.map((t) => `${t.tab}:${t.label}:${t.count}`).join("|");
|
|
10834
|
-
(0,
|
|
10844
|
+
(0, import_react65.useLayoutEffect)(() => {
|
|
10835
10845
|
const strip = listRef.current;
|
|
10836
10846
|
if (!strip) return;
|
|
10837
10847
|
const measure = () => {
|
|
@@ -10879,7 +10889,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
10879
10889
|
}
|
|
10880
10890
|
|
|
10881
10891
|
// src/components/MonitorTabs.tsx
|
|
10882
|
-
var
|
|
10892
|
+
var import_react77 = require("react");
|
|
10883
10893
|
|
|
10884
10894
|
// src/components/MarketAccordion.tsx
|
|
10885
10895
|
var import_widget_sdk24 = require("@sensiblestats/widget-sdk");
|
|
@@ -10941,7 +10951,7 @@ function MarketAccordion({ match, monitor, ui, slip }) {
|
|
|
10941
10951
|
}
|
|
10942
10952
|
|
|
10943
10953
|
// src/components/MonitorFormH2H.tsx
|
|
10944
|
-
var
|
|
10954
|
+
var import_react66 = require("react");
|
|
10945
10955
|
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
10946
10956
|
function resultClass2(result) {
|
|
10947
10957
|
if (result === "W") return "ss-w-h2h-result--win";
|
|
@@ -10957,7 +10967,7 @@ function FormDots({ form, ui }) {
|
|
|
10957
10967
|
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "ss-w-h2h-dots", children: form.map((m, i) => /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: `ss-w-h2h-result ${resultClass2(m.result)}`, children: resultLabel(m.result, ui) }, i)) });
|
|
10958
10968
|
}
|
|
10959
10969
|
function MonitorFormH2H({ formAndH2H, homeTeamName, awayTeamName, ui }) {
|
|
10960
|
-
const [expanded, setExpanded] = (0,
|
|
10970
|
+
const [expanded, setExpanded] = (0, import_react66.useState)(false);
|
|
10961
10971
|
const { homeForm, awayForm, h2h, homeShortCode, awayShortCode } = formAndH2H;
|
|
10962
10972
|
if (homeForm.length === 0 && awayForm.length === 0 && !h2h) {
|
|
10963
10973
|
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_jsx_runtime72.Fragment, {});
|
|
@@ -11184,7 +11194,7 @@ function MonitorSkeleton({ pin, monitor, ui }) {
|
|
|
11184
11194
|
}
|
|
11185
11195
|
|
|
11186
11196
|
// src/components/NbaMonitorCard.tsx
|
|
11187
|
-
var
|
|
11197
|
+
var import_react70 = require("react");
|
|
11188
11198
|
|
|
11189
11199
|
// src/sportLabel.ts
|
|
11190
11200
|
var CODE = { football: "football", basketball: "nba", nba: "nba", americanfootball: "nfl", nfl: "nfl", tennis: "tennis" };
|
|
@@ -11194,7 +11204,7 @@ var sportLabel = (ui, sport) => {
|
|
|
11194
11204
|
};
|
|
11195
11205
|
|
|
11196
11206
|
// src/components/NbaFormSection.tsx
|
|
11197
|
-
var
|
|
11207
|
+
var import_react67 = require("react");
|
|
11198
11208
|
|
|
11199
11209
|
// src/components/NbaFormRest.tsx
|
|
11200
11210
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
@@ -11293,8 +11303,8 @@ function Row2({ game, abbr, tonight, ui }) {
|
|
|
11293
11303
|
] });
|
|
11294
11304
|
}
|
|
11295
11305
|
function NbaFormSection({ match, monitor, ui }) {
|
|
11296
|
-
const [open, setOpen] = (0,
|
|
11297
|
-
const [side, setSide] = (0,
|
|
11306
|
+
const [open, setOpen] = (0, import_react67.useState)(false);
|
|
11307
|
+
const [side, setSide] = (0, import_react67.useState)("away");
|
|
11298
11308
|
const form = useNbaForm(match, monitor);
|
|
11299
11309
|
const b = match.basketball;
|
|
11300
11310
|
if (!form || !b || !form.home && !form.away) return null;
|
|
@@ -11336,10 +11346,10 @@ function NbaFormSection({ match, monitor, ui }) {
|
|
|
11336
11346
|
}
|
|
11337
11347
|
|
|
11338
11348
|
// src/components/NbaPropsSection.tsx
|
|
11339
|
-
var
|
|
11349
|
+
var import_react69 = require("react");
|
|
11340
11350
|
|
|
11341
11351
|
// src/components/PropsPieces.tsx
|
|
11342
|
-
var
|
|
11352
|
+
var import_react68 = require("react");
|
|
11343
11353
|
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
11344
11354
|
var livePlayer = (bundle, p) => bundle.live === true || !p.live && !p.nflLive ? p : { ...p, live: null, nflLive: null };
|
|
11345
11355
|
var hasLiveLine = (p) => p.live != null || p.nflLive != null;
|
|
@@ -11352,9 +11362,9 @@ function preKickoff(match) {
|
|
|
11352
11362
|
return Number.isFinite(kickoff) && Date.now() < kickoff;
|
|
11353
11363
|
}
|
|
11354
11364
|
function usePreKickoff(match) {
|
|
11355
|
-
const [, setTick] = (0,
|
|
11365
|
+
const [, setTick] = (0, import_react68.useState)(0);
|
|
11356
11366
|
const pre = preKickoff(match);
|
|
11357
|
-
(0,
|
|
11367
|
+
(0, import_react68.useEffect)(() => {
|
|
11358
11368
|
if (!pre || !match.kickoffUtc) return;
|
|
11359
11369
|
const wait = Math.min(Math.max(Date.parse(match.kickoffUtc) - Date.now(), 0), MAX_TIMER_MS);
|
|
11360
11370
|
const id = setTimeout(() => setTick((t) => t + 1), wait);
|
|
@@ -11368,7 +11378,7 @@ function usePropsOpen(match, monitor, descriptor) {
|
|
|
11368
11378
|
const pre = descriptor.sport === "basketball" ? match.phase === "preMatch" : beforeKickoff;
|
|
11369
11379
|
const live = match.phase === "live";
|
|
11370
11380
|
const open = pre || live;
|
|
11371
|
-
(0,
|
|
11381
|
+
(0, import_react68.useEffect)(() => {
|
|
11372
11382
|
if (!open) return;
|
|
11373
11383
|
if (sport) monitor.loadPlayerProps?.(match.matchId, sport);
|
|
11374
11384
|
else monitor.loadPlayerProps?.(match.matchId);
|
|
@@ -11446,7 +11456,7 @@ function PropBars({ bars, line, title, wide, ui, note }) {
|
|
|
11446
11456
|
function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
|
|
11447
11457
|
const player = livePlayer(bundle, given);
|
|
11448
11458
|
const stats = descriptor.stats.map((k) => player.stats.find((s) => s.stat === k)).filter((s) => s != null);
|
|
11449
|
-
const [picked, setPicked] = (0,
|
|
11459
|
+
const [picked, setPicked] = (0, import_react68.useState)(null);
|
|
11450
11460
|
const active = stats.find((s) => s.stat === picked) ?? stats[0];
|
|
11451
11461
|
const sample = active?.games?.length ?? 0;
|
|
11452
11462
|
const hitsOf = (price, text2) => descriptor.showHits && sample > 0 && price.hits != null ? text2(price.hits) : null;
|
|
@@ -11495,8 +11505,8 @@ function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
|
|
|
11495
11505
|
] });
|
|
11496
11506
|
}
|
|
11497
11507
|
function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
11498
|
-
const [openId, setOpenId] = (0,
|
|
11499
|
-
const [brokenShots, setBrokenShots] = (0,
|
|
11508
|
+
const [openId, setOpenId] = (0, import_react68.useState)(null);
|
|
11509
|
+
const [brokenShots, setBrokenShots] = (0, import_react68.useState)(/* @__PURE__ */ new Set());
|
|
11500
11510
|
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "ss-w-props-list", children: players.map((given) => {
|
|
11501
11511
|
const p = livePlayer(bundle, given);
|
|
11502
11512
|
const isOpen = openId === p.playerId;
|
|
@@ -11542,12 +11552,12 @@ function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
|
11542
11552
|
}
|
|
11543
11553
|
var BOX_QUIET_MS = 12e4;
|
|
11544
11554
|
function StatsClock({ boxAsOfUtc, match, live, atBreak: atBreak2, ago, ui }) {
|
|
11545
|
-
const [tick, setTick] = (0,
|
|
11555
|
+
const [tick, setTick] = (0, import_react68.useState)(0);
|
|
11546
11556
|
const time = clock2(boxAsOfUtc, ui);
|
|
11547
11557
|
const at2 = time === "" ? Number.NaN : Date.parse(boxAsOfUtc);
|
|
11548
11558
|
const valid = !Number.isNaN(at2);
|
|
11549
11559
|
const onBreak = atBreak(match);
|
|
11550
|
-
(0,
|
|
11560
|
+
(0, import_react68.useEffect)(() => {
|
|
11551
11561
|
if (!valid || onBreak) return;
|
|
11552
11562
|
const age2 = Date.now() - at2;
|
|
11553
11563
|
const wait = age2 < BOX_QUIET_MS ? BOX_QUIET_MS - age2 : 6e4 - age2 % 6e4;
|
|
@@ -11608,12 +11618,12 @@ var nbaDescriptor = (ui, match) => ({
|
|
|
11608
11618
|
tenGameBars: false
|
|
11609
11619
|
});
|
|
11610
11620
|
function StatsClock2({ bundle, match, ui }) {
|
|
11611
|
-
const [tick, setTick] = (0,
|
|
11621
|
+
const [tick, setTick] = (0, import_react69.useState)(0);
|
|
11612
11622
|
const at2 = bundle.live === true && bundle.boxAsOfUtc ? Date.parse(bundle.boxAsOfUtc) : Number.NaN;
|
|
11613
11623
|
const time = clock2(bundle.boxAsOfUtc, ui);
|
|
11614
11624
|
const valid = !Number.isNaN(at2) && time !== "";
|
|
11615
11625
|
const onBreak = atBreak(match);
|
|
11616
|
-
(0,
|
|
11626
|
+
(0, import_react69.useEffect)(() => {
|
|
11617
11627
|
if (!valid || onBreak) return;
|
|
11618
11628
|
const age2 = Date.now() - at2;
|
|
11619
11629
|
const wait = age2 < BOX_QUIET_MS2 ? BOX_QUIET_MS2 - age2 : 6e4 - age2 % 6e4;
|
|
@@ -11627,7 +11637,7 @@ function StatsClock2({ bundle, match, ui }) {
|
|
|
11627
11637
|
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "ss-w-props-asof ss-w-props-asof--live", children: ui.nba.propsStatsLive(time) });
|
|
11628
11638
|
}
|
|
11629
11639
|
function NbaPropsSection({ match, monitor, ui, slip }) {
|
|
11630
|
-
const [side, setSide] = (0,
|
|
11640
|
+
const [side, setSide] = (0, import_react69.useState)("home");
|
|
11631
11641
|
const descriptor = nbaDescriptor(ui, match);
|
|
11632
11642
|
const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
|
|
11633
11643
|
if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
|
|
@@ -11665,7 +11675,7 @@ function city(teamName, nickname) {
|
|
|
11665
11675
|
return name.slice(0, name.length - nickname.length).trim() || null;
|
|
11666
11676
|
}
|
|
11667
11677
|
function BadgeCrest({ url, abbreviation }) {
|
|
11668
|
-
const [failed, setFailed] = (0,
|
|
11678
|
+
const [failed, setFailed] = (0, import_react70.useState)(false);
|
|
11669
11679
|
if (url && !failed) {
|
|
11670
11680
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("img", { className: "ss-w-nbamon-badge ss-w-nbamon-badge--img", src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
11671
11681
|
}
|
|
@@ -11783,7 +11793,7 @@ function NbaMonitorCard({ match, monitor, ui, slip }) {
|
|
|
11783
11793
|
}
|
|
11784
11794
|
|
|
11785
11795
|
// src/components/NflFormSection.tsx
|
|
11786
|
-
var
|
|
11796
|
+
var import_react71 = require("react");
|
|
11787
11797
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
11788
11798
|
var outcomeOf = (g) => g.teamScore > g.opponentScore ? "win" : g.teamScore < g.opponentScore ? "loss" : "tie";
|
|
11789
11799
|
var signedSpread2 = (v) => v > 0 ? `+${v}` : String(v);
|
|
@@ -11835,7 +11845,7 @@ function H2hRow({ game, home, ui }) {
|
|
|
11835
11845
|
] });
|
|
11836
11846
|
}
|
|
11837
11847
|
function NflFormSection({ match, monitor, ui }) {
|
|
11838
|
-
const [segment, setSegment] = (0,
|
|
11848
|
+
const [segment, setSegment] = (0, import_react71.useState)("away");
|
|
11839
11849
|
const { live, open } = usePropsOpen(match, monitor, { sport: "americanfootball" });
|
|
11840
11850
|
const bundle = monitor.playerProps?.[monitorMatchKey("americanfootball", match.matchId)]?.bundle;
|
|
11841
11851
|
const form = bundle?.form;
|
|
@@ -11868,7 +11878,7 @@ function NflFormSection({ match, monitor, ui }) {
|
|
|
11868
11878
|
}
|
|
11869
11879
|
|
|
11870
11880
|
// src/components/NflPropsSection.tsx
|
|
11871
|
-
var
|
|
11881
|
+
var import_react72 = require("react");
|
|
11872
11882
|
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
11873
11883
|
var TRENDS_SHOWN = 3;
|
|
11874
11884
|
var SCORERS_SHOWN = 8;
|
|
@@ -11941,7 +11951,7 @@ function ShowMore({ label, onClick }) {
|
|
|
11941
11951
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("button", { type: "button", className: "ss-w-props-more", onClick, children: label });
|
|
11942
11952
|
}
|
|
11943
11953
|
function Trends({ bundle, facts, descriptor, ui, slip }) {
|
|
11944
|
-
const [all, setAll] = (0,
|
|
11954
|
+
const [all, setAll] = (0, import_react72.useState)(false);
|
|
11945
11955
|
const shown2 = all ? facts : facts.slice(0, TRENDS_SHOWN);
|
|
11946
11956
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("section", { className: "ss-w-props ss-w-props-trends", lang: ui.locale, children: [
|
|
11947
11957
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "ss-w-props-head", children: ui.nfl.propsTrends }),
|
|
@@ -11974,7 +11984,7 @@ function Trends({ bundle, facts, descriptor, ui, slip }) {
|
|
|
11974
11984
|
] });
|
|
11975
11985
|
}
|
|
11976
11986
|
function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
11977
|
-
const [all, setAll] = (0,
|
|
11987
|
+
const [all, setAll] = (0, import_react72.useState)(false);
|
|
11978
11988
|
const shown2 = all ? scorers : scorers.slice(0, SCORERS_SHOWN);
|
|
11979
11989
|
const cell2 = (name, column, price, stat) => price && stat ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(PropPrice, { price, label: "", ariaName: `${name}, ${column}`, player: name, stat, bundle, descriptor, ui, slip }) : /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { className: "ss-w-props-scorer-none", children: "\u2014" });
|
|
11980
11990
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "ss-w-props-scorers", children: [
|
|
@@ -11988,9 +11998,12 @@ function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
|
11988
11998
|
const sample = s.anytimeStat.games?.length ?? 0;
|
|
11989
11999
|
const meta = sample > 0 && s.anytime.hits != null ? `${abbreviations[s.player.side]} \xB7 ${fillNfl(ui.nfl.propsScoredIn, { h: s.anytime.hits, n: sample })}` : abbreviations[s.player.side];
|
|
11990
12000
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "ss-w-props-scorer", children: [
|
|
11991
|
-
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("span", { className: "ss-w-props-
|
|
11992
|
-
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
11993
|
-
/* @__PURE__ */ (0, import_jsx_runtime81.
|
|
12001
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("span", { className: "ss-w-props-scorer-who", children: [
|
|
12002
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Pic, { src: s.player.imagePath, kind: "player" }),
|
|
12003
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("span", { className: "ss-w-props-pn", children: [
|
|
12004
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { className: "ss-w-props-scorer-name", children: s.player.name }),
|
|
12005
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { className: "ss-w-props-scorer-meta", children: meta })
|
|
12006
|
+
] })
|
|
11994
12007
|
] }),
|
|
11995
12008
|
cell2(s.player.name, ui.nfl.propsAnytime, s.anytime, s.anytimeStat),
|
|
11996
12009
|
cell2(s.player.name, "2+", s.two, s.anytimeStat),
|
|
@@ -12001,7 +12014,7 @@ function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
|
12001
12014
|
] });
|
|
12002
12015
|
}
|
|
12003
12016
|
function NflPropsSection({ match, monitor, ui, slip }) {
|
|
12004
|
-
const [tab, setTab] = (0,
|
|
12017
|
+
const [tab, setTab] = (0, import_react72.useState)(null);
|
|
12005
12018
|
const descriptor = nflDescriptor(ui);
|
|
12006
12019
|
const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
|
|
12007
12020
|
if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
|
|
@@ -12143,13 +12156,13 @@ function NflMonitorCard({ match, monitor, ui, slip }) {
|
|
|
12143
12156
|
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(PinToggle, { ui, monitor, pin: { kind: "match", matchId: match.matchId, sport: "americanfootball" } })
|
|
12144
12157
|
] }),
|
|
12145
12158
|
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "ss-w-nbamon-main", children: [
|
|
12146
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Side, { abbreviation: f.awayAbbreviation, nickname: f.awayNickname, teamName: match.awayTeamName, away: true }),
|
|
12159
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Side, { abbreviation: f.awayAbbreviation, nickname: f.awayNickname, teamName: match.awayTeamName, crestUrl: match.awayCrestUrl, away: true }),
|
|
12147
12160
|
scored ? /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("span", { className: "ss-w-mon-score", children: [
|
|
12148
12161
|
match.awayScore ?? 0,
|
|
12149
12162
|
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("i", { children: "\u2013" }),
|
|
12150
12163
|
match.homeScore ?? 0
|
|
12151
12164
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { className: "ss-w-mon-vs", children: ui.venue.away }),
|
|
12152
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Side, { abbreviation: f.homeAbbreviation, nickname: f.homeNickname, teamName: match.homeTeamName })
|
|
12165
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Side, { abbreviation: f.homeAbbreviation, nickname: f.homeNickname, teamName: match.homeTeamName, crestUrl: match.homeCrestUrl })
|
|
12153
12166
|
] }),
|
|
12154
12167
|
scored && /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("table", { className: "ss-w-nbamon-ls", children: [
|
|
12155
12168
|
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("tr", { children: [
|
|
@@ -12187,14 +12200,14 @@ function NflMonitorCard({ match, monitor, ui, slip }) {
|
|
|
12187
12200
|
}
|
|
12188
12201
|
|
|
12189
12202
|
// src/components/TennisMonitorCard.tsx
|
|
12190
|
-
var
|
|
12203
|
+
var import_react75 = require("react");
|
|
12191
12204
|
var import_widget_sdk27 = require("@sensiblestats/widget-sdk");
|
|
12192
12205
|
|
|
12193
12206
|
// src/components/TennisFixtureRow.tsx
|
|
12194
12207
|
var import_widget_sdk26 = require("@sensiblestats/widget-sdk");
|
|
12195
12208
|
|
|
12196
12209
|
// src/components/FixtureRow.tsx
|
|
12197
|
-
var
|
|
12210
|
+
var import_react73 = require("react");
|
|
12198
12211
|
var import_widget_sdk25 = require("@sensiblestats/widget-sdk");
|
|
12199
12212
|
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
12200
12213
|
function splitAtFirstSpace(label) {
|
|
@@ -12208,7 +12221,7 @@ function kickoffLabel(kickoffUnix, tag2, clock3, timeZone) {
|
|
|
12208
12221
|
return formatTime(kickoffUnix * 1e3, tag2, clock3, { timeZone });
|
|
12209
12222
|
}
|
|
12210
12223
|
function Side2({ name, crest, abbr, away = false }) {
|
|
12211
|
-
const [failed, setFailed] = (0,
|
|
12224
|
+
const [failed, setFailed] = (0, import_react73.useState)(false);
|
|
12212
12225
|
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("span", { className: away ? "ss-w-drow-side ss-w-drow-side--away" : "ss-w-drow-side", children: [
|
|
12213
12226
|
crest && !failed ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("img", { className: abbr ? "ss-w-drow-crest ss-w-drow-crest--wide" : "ss-w-drow-crest", src: crest, alt: "", onError: () => setFailed(true) }) : abbr ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "ss-w-drow-crest ss-w-drow-crest--abbr", children: abbr }) : null,
|
|
12214
12227
|
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "ss-w-drow-nm", children: name })
|
|
@@ -12450,7 +12463,7 @@ function TennisLiveScoreboard({ t, score, live, ui }) {
|
|
|
12450
12463
|
}
|
|
12451
12464
|
|
|
12452
12465
|
// src/components/TennisStatsTables.tsx
|
|
12453
|
-
var
|
|
12466
|
+
var import_react74 = require("react");
|
|
12454
12467
|
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
12455
12468
|
function formatStat(row, value, locale) {
|
|
12456
12469
|
if (value == null) return "\u2013";
|
|
@@ -12488,8 +12501,8 @@ function Tables({ table, labels, names, locale }) {
|
|
|
12488
12501
|
] });
|
|
12489
12502
|
}
|
|
12490
12503
|
function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey }) {
|
|
12491
|
-
const [tab, setTab] = (0,
|
|
12492
|
-
(0,
|
|
12504
|
+
const [tab, setTab] = (0, import_react74.useState)("match");
|
|
12505
|
+
(0, import_react74.useEffect)(() => {
|
|
12493
12506
|
setTab("match");
|
|
12494
12507
|
}, [resetKey]);
|
|
12495
12508
|
const sets = serveReturn.sets.filter((s) => s.table.serve.length + s.table.return.length > 0);
|
|
@@ -12520,7 +12533,7 @@ function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey })
|
|
|
12520
12533
|
] }),
|
|
12521
12534
|
today.rows.map((r) => {
|
|
12522
12535
|
const f = (v) => formatStat({ kind: "pct" }, v, locale);
|
|
12523
|
-
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
|
|
12536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_react74.Fragment, { children: [
|
|
12524
12537
|
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "ss-w-ts-l", children: r.label }),
|
|
12525
12538
|
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("span", { className: "ss-w-ts-today-v ss-w-ts-today-v--a", children: [
|
|
12526
12539
|
f(r.p1Today),
|
|
@@ -12655,7 +12668,7 @@ function HeadToHead({ t, ui }) {
|
|
|
12655
12668
|
] });
|
|
12656
12669
|
}
|
|
12657
12670
|
function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
12658
|
-
const lastTables = (0,
|
|
12671
|
+
const lastTables = (0, import_react75.useRef)(null);
|
|
12659
12672
|
const t = match.tennis;
|
|
12660
12673
|
if (!t) return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(UnavailableCard, { match, monitor, ui, sport: "tennis" });
|
|
12661
12674
|
const preMatch = match.phase === "preMatch";
|
|
@@ -12735,7 +12748,7 @@ function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
|
12735
12748
|
}
|
|
12736
12749
|
|
|
12737
12750
|
// src/components/ScoreboardStrip.tsx
|
|
12738
|
-
var
|
|
12751
|
+
var import_react76 = require("react");
|
|
12739
12752
|
var import_widget_sdk28 = require("@sensiblestats/widget-sdk");
|
|
12740
12753
|
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
12741
12754
|
function nbaStatus(m, ui) {
|
|
@@ -12830,8 +12843,8 @@ function rowsFor(m) {
|
|
|
12830
12843
|
];
|
|
12831
12844
|
}
|
|
12832
12845
|
function useStripScroll(selectedKey) {
|
|
12833
|
-
const stripRef = (0,
|
|
12834
|
-
(0,
|
|
12846
|
+
const stripRef = (0, import_react76.useRef)(null);
|
|
12847
|
+
(0, import_react76.useEffect)(() => {
|
|
12835
12848
|
const strip = stripRef.current;
|
|
12836
12849
|
const pressed = strip?.querySelector('[aria-pressed="true"]');
|
|
12837
12850
|
if (!strip || !pressed) return;
|
|
@@ -13005,7 +13018,7 @@ function OddsLiveStrip({ m, ui }) {
|
|
|
13005
13018
|
] });
|
|
13006
13019
|
}
|
|
13007
13020
|
function MatchesPanel({ monitor, ui, slip, onAsk, discovery }) {
|
|
13008
|
-
const seedIndex = (0,
|
|
13021
|
+
const seedIndex = (0, import_react77.useMemo)(() => buildSeedIndex(discovery?.groups ?? []), [discovery?.groups]);
|
|
13009
13022
|
const tiles = orderTiles(
|
|
13010
13023
|
monitor.pins,
|
|
13011
13024
|
monitor.snapshot,
|
|
@@ -13077,7 +13090,7 @@ function TrendsPanel({ monitor, ui, slip }) {
|
|
|
13077
13090
|
}
|
|
13078
13091
|
|
|
13079
13092
|
// src/components/LivePanel.tsx
|
|
13080
|
-
var
|
|
13093
|
+
var import_react80 = require("react");
|
|
13081
13094
|
var import_widget_sdk35 = require("@sensiblestats/widget-sdk");
|
|
13082
13095
|
|
|
13083
13096
|
// src/scheduleView.ts
|
|
@@ -13252,20 +13265,20 @@ function LeagueGroup({ view, open, onToggle, disambiguate, rowCap, onShowAll, on
|
|
|
13252
13265
|
}
|
|
13253
13266
|
|
|
13254
13267
|
// src/components/MatchSheet.tsx
|
|
13255
|
-
var
|
|
13268
|
+
var import_react79 = require("react");
|
|
13256
13269
|
var import_widget_sdk33 = require("@sensiblestats/widget-sdk");
|
|
13257
13270
|
|
|
13258
13271
|
// src/useModalDialog.ts
|
|
13259
|
-
var
|
|
13272
|
+
var import_react78 = require("react");
|
|
13260
13273
|
var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
13261
13274
|
function useModalDialog(onClose, opts = {}) {
|
|
13262
|
-
const dialogRef = (0,
|
|
13263
|
-
const onCloseRef = (0,
|
|
13275
|
+
const dialogRef = (0, import_react78.useRef)(null);
|
|
13276
|
+
const onCloseRef = (0, import_react78.useRef)(onClose);
|
|
13264
13277
|
onCloseRef.current = onClose;
|
|
13265
|
-
const openerRef = (0,
|
|
13278
|
+
const openerRef = (0, import_react78.useRef)(opts.opener);
|
|
13266
13279
|
openerRef.current = opts.opener;
|
|
13267
13280
|
const restore = opts.restoreFocus ?? true;
|
|
13268
|
-
(0,
|
|
13281
|
+
(0, import_react78.useEffect)(() => {
|
|
13269
13282
|
const dialog = dialogRef.current;
|
|
13270
13283
|
const root = dialog?.getRootNode();
|
|
13271
13284
|
const focusedAtMount = root?.activeElement ?? null;
|
|
@@ -13276,7 +13289,7 @@ function useModalDialog(onClose, opts = {}) {
|
|
|
13276
13289
|
if (target instanceof HTMLElement) target.focus({ preventScroll: true });
|
|
13277
13290
|
};
|
|
13278
13291
|
}, []);
|
|
13279
|
-
(0,
|
|
13292
|
+
(0, import_react78.useEffect)(() => {
|
|
13280
13293
|
const onKey = (e) => {
|
|
13281
13294
|
if (e.key !== "Escape") return;
|
|
13282
13295
|
e.stopPropagation();
|
|
@@ -13317,8 +13330,8 @@ function kickoffDate(kickoffUnix, lang, timeZone) {
|
|
|
13317
13330
|
function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose, opener }) {
|
|
13318
13331
|
const { dialogRef, onKeyDown } = useModalDialog(onClose, { opener });
|
|
13319
13332
|
const log = useEventLog();
|
|
13320
|
-
const titleId = (0,
|
|
13321
|
-
const [limitHit, setLimitHit] = (0,
|
|
13333
|
+
const titleId = (0, import_react79.useId)();
|
|
13334
|
+
const [limitHit, setLimitHit] = (0, import_react79.useState)(false);
|
|
13322
13335
|
const pinSport = (0, import_widget_sdk33.slipSportOf)(match.sport);
|
|
13323
13336
|
const tour = pinSport === "tennis" && isKnownTour(match.tour) ? match.tour : void 0;
|
|
13324
13337
|
const followable = pinSport !== "tennis" || tour !== void 0;
|
|
@@ -13419,10 +13432,10 @@ var OPEN_TOP_GROUPS = 2;
|
|
|
13419
13432
|
var QUIET_ROWS = 4;
|
|
13420
13433
|
function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, onLeague, onSeeAll, onAsk }) {
|
|
13421
13434
|
const { groups, states, stale } = discovery;
|
|
13422
|
-
const [mine, setMine] = (0,
|
|
13423
|
-
const [toggled, setToggled] = (0,
|
|
13424
|
-
const [sheet, setSheet] = (0,
|
|
13425
|
-
const pinnedKeys = (0,
|
|
13435
|
+
const [mine, setMine] = (0, import_react80.useState)(false);
|
|
13436
|
+
const [toggled, setToggled] = (0, import_react80.useState)(/* @__PURE__ */ new Map());
|
|
13437
|
+
const [sheet, setSheet] = (0, import_react80.useState)(null);
|
|
13438
|
+
const pinnedKeys = (0, import_react80.useMemo)(
|
|
13426
13439
|
() => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk35.matchKey)(p.sport, p.matchId, p.tour))),
|
|
13427
13440
|
[monitor.pins]
|
|
13428
13441
|
);
|
|
@@ -13528,20 +13541,20 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
|
|
|
13528
13541
|
}
|
|
13529
13542
|
|
|
13530
13543
|
// src/components/ScheduleMatchesPanel.tsx
|
|
13531
|
-
var
|
|
13544
|
+
var import_react84 = require("react");
|
|
13532
13545
|
var import_widget_sdk37 = require("@sensiblestats/widget-sdk");
|
|
13533
13546
|
|
|
13534
13547
|
// src/useTennisRowPrices.ts
|
|
13535
|
-
var
|
|
13548
|
+
var import_react81 = require("react");
|
|
13536
13549
|
var import_widget_sdk36 = require("@sensiblestats/widget-sdk");
|
|
13537
13550
|
var TENNIS_PRICE_POLL_MS = 6e4;
|
|
13538
13551
|
function useTennisRowPrices(a) {
|
|
13539
|
-
const [state, setState] = (0,
|
|
13540
|
-
const getPricesRef = (0,
|
|
13552
|
+
const [state, setState] = (0, import_react81.useState)({ byId: null, stale: false });
|
|
13553
|
+
const getPricesRef = (0, import_react81.useRef)(a.getPrices);
|
|
13541
13554
|
getPricesRef.current = a.getPrices;
|
|
13542
|
-
const latest = (0,
|
|
13555
|
+
const latest = (0, import_react81.useRef)(0);
|
|
13543
13556
|
const idsKey = a.keys.filter((k) => isKnownTour(k.tour)).slice(0, MAX_TENNIS_KEYS).map((k) => `${k.tour}:${k.matchId}`).sort().join(",");
|
|
13544
|
-
(0,
|
|
13557
|
+
(0, import_react81.useEffect)(() => {
|
|
13545
13558
|
if (!a.enabled || idsKey === "") {
|
|
13546
13559
|
latest.current++;
|
|
13547
13560
|
setState((prev) => prev.byId === null && !prev.stale ? prev : { byId: null, stale: false });
|
|
@@ -13579,11 +13592,11 @@ function useTennisRowPrices(a) {
|
|
|
13579
13592
|
}
|
|
13580
13593
|
|
|
13581
13594
|
// src/components/DayStrip.tsx
|
|
13582
|
-
var
|
|
13595
|
+
var import_react82 = require("react");
|
|
13583
13596
|
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
13584
13597
|
function DayStrip({ chips, selected, onSelect, ui, locale }) {
|
|
13585
|
-
const listRef = (0,
|
|
13586
|
-
(0,
|
|
13598
|
+
const listRef = (0, import_react82.useRef)(null);
|
|
13599
|
+
(0, import_react82.useEffect)(() => {
|
|
13587
13600
|
const el = listRef.current?.querySelector('[aria-pressed="true"]');
|
|
13588
13601
|
if (!el || typeof el.scrollIntoView !== "function") return;
|
|
13589
13602
|
const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
@@ -13612,7 +13625,7 @@ function DayStrip({ chips, selected, onSelect, ui, locale }) {
|
|
|
13612
13625
|
}
|
|
13613
13626
|
|
|
13614
13627
|
// src/components/games/ui/SearchField.tsx
|
|
13615
|
-
var
|
|
13628
|
+
var import_react83 = require("react");
|
|
13616
13629
|
|
|
13617
13630
|
// src/components/games/ui/icons.tsx
|
|
13618
13631
|
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
@@ -13651,8 +13664,8 @@ var IconFlame = ({ size = 16 }) => svg(size, /* @__PURE__ */ (0, import_jsx_runt
|
|
|
13651
13664
|
// src/components/games/ui/SearchField.tsx
|
|
13652
13665
|
var import_jsx_runtime101 = require("react/jsx-runtime");
|
|
13653
13666
|
function SearchField({ id, label, labelHidden = false, placeholder, value, onChange, disabled, inputRef, onKeyDown, clearLabel }) {
|
|
13654
|
-
const localRef = (0,
|
|
13655
|
-
const setInputRef = (0,
|
|
13667
|
+
const localRef = (0, import_react83.useRef)(null);
|
|
13668
|
+
const setInputRef = (0, import_react83.useCallback)((node) => {
|
|
13656
13669
|
localRef.current = node;
|
|
13657
13670
|
if (typeof inputRef === "function") inputRef(node);
|
|
13658
13671
|
else if (inputRef) inputRef.current = node;
|
|
@@ -13698,18 +13711,18 @@ var TOP_ROW_CAP = 3;
|
|
|
13698
13711
|
var SKELETON_ROWS = 3;
|
|
13699
13712
|
function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport, day, onDay, loaded, onOpenLive, onAsk, locale, getTennisPrices, slip }) {
|
|
13700
13713
|
const { localDate: today, states, stale } = discovery;
|
|
13701
|
-
const searchId = (0,
|
|
13702
|
-
const [query, setQuery] = (0,
|
|
13703
|
-
const [toggled, setToggled] = (0,
|
|
13704
|
-
const [expanded, setExpanded] = (0,
|
|
13705
|
-
const listRef = (0,
|
|
13706
|
-
const [sheet, setSheet] = (0,
|
|
13714
|
+
const searchId = (0, import_react84.useId)();
|
|
13715
|
+
const [query, setQuery] = (0, import_react84.useState)("");
|
|
13716
|
+
const [toggled, setToggled] = (0, import_react84.useState)(/* @__PURE__ */ new Map());
|
|
13717
|
+
const [expanded, setExpanded] = (0, import_react84.useState)(/* @__PURE__ */ new Set());
|
|
13718
|
+
const listRef = (0, import_react84.useRef)(null);
|
|
13719
|
+
const [sheet, setSheet] = (0, import_react84.useState)(null);
|
|
13707
13720
|
const { chips, selected } = loaded;
|
|
13708
|
-
(0,
|
|
13721
|
+
(0, import_react84.useEffect)(() => {
|
|
13709
13722
|
if (selected !== day) onDay(selected);
|
|
13710
13723
|
}, [day, selected, onDay]);
|
|
13711
13724
|
const isToday = selected === today;
|
|
13712
|
-
const pinnedKeys = (0,
|
|
13725
|
+
const pinnedKeys = (0, import_react84.useMemo)(
|
|
13713
13726
|
() => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk37.matchKey)(p.sport, p.matchId, p.tour))),
|
|
13714
13727
|
[monitor.pins]
|
|
13715
13728
|
);
|
|
@@ -13847,7 +13860,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
13847
13860
|
}
|
|
13848
13861
|
|
|
13849
13862
|
// src/components/GamesPanel.tsx
|
|
13850
|
-
var
|
|
13863
|
+
var import_react99 = require("react");
|
|
13851
13864
|
|
|
13852
13865
|
// src/components/GamesLoginWall.tsx
|
|
13853
13866
|
var import_jsx_runtime103 = require("react/jsx-runtime");
|
|
@@ -13856,7 +13869,7 @@ function GamesLoginWall({ ui }) {
|
|
|
13856
13869
|
}
|
|
13857
13870
|
|
|
13858
13871
|
// src/components/GamesHub.tsx
|
|
13859
|
-
var
|
|
13872
|
+
var import_react85 = require("react");
|
|
13860
13873
|
|
|
13861
13874
|
// src/components/games/ui/gameMeta.ts
|
|
13862
13875
|
function prettifyGameId(gameId) {
|
|
@@ -14007,8 +14020,8 @@ function pickHeroGame(games) {
|
|
|
14007
14020
|
}
|
|
14008
14021
|
var tileKey = (g) => `${g.gameId}-${g.gameDay}-${g.fixtureId}`;
|
|
14009
14022
|
function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
14010
|
-
const [, setTick] = (0,
|
|
14011
|
-
(0,
|
|
14023
|
+
const [, setTick] = (0, import_react85.useState)(0);
|
|
14024
|
+
(0, import_react85.useEffect)(() => {
|
|
14012
14025
|
const id = setInterval(() => setTick((t) => t + 1), 6e4);
|
|
14013
14026
|
return () => clearInterval(id);
|
|
14014
14027
|
}, []);
|
|
@@ -14068,10 +14081,10 @@ function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
|
14068
14081
|
}
|
|
14069
14082
|
|
|
14070
14083
|
// src/components/GameScreenHost.tsx
|
|
14071
|
-
var
|
|
14084
|
+
var import_react97 = require("react");
|
|
14072
14085
|
|
|
14073
14086
|
// src/useGamePlay.ts
|
|
14074
|
-
var
|
|
14087
|
+
var import_react86 = require("react");
|
|
14075
14088
|
function toSubmitResult(payload) {
|
|
14076
14089
|
return {
|
|
14077
14090
|
// 'pending' means the play is recorded but awaiting resolution (fixture games)
|
|
@@ -14083,17 +14096,17 @@ function toSubmitResult(payload) {
|
|
|
14083
14096
|
};
|
|
14084
14097
|
}
|
|
14085
14098
|
function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh }) {
|
|
14086
|
-
const [result, setResult] = (0,
|
|
14087
|
-
const [submitting, setSubmitting] = (0,
|
|
14088
|
-
const [rawStatus, setRawStatus] = (0,
|
|
14089
|
-
const inFlightRef = (0,
|
|
14090
|
-
const convRef = (0,
|
|
14099
|
+
const [result, setResult] = (0, import_react86.useState)(null);
|
|
14100
|
+
const [submitting, setSubmitting] = (0, import_react86.useState)(false);
|
|
14101
|
+
const [rawStatus, setRawStatus] = (0, import_react86.useState)(null);
|
|
14102
|
+
const inFlightRef = (0, import_react86.useRef)(false);
|
|
14103
|
+
const convRef = (0, import_react86.useRef)(conversation);
|
|
14091
14104
|
convRef.current = conversation;
|
|
14092
|
-
const optsRef = (0,
|
|
14105
|
+
const optsRef = (0, import_react86.useRef)({ gameId, gameDay, fixtureId, locale, refresh });
|
|
14093
14106
|
optsRef.current = { gameId, gameDay, fixtureId, locale, refresh };
|
|
14094
|
-
const resultRef = (0,
|
|
14107
|
+
const resultRef = (0, import_react86.useRef)(null);
|
|
14095
14108
|
resultRef.current = result;
|
|
14096
|
-
const refetch = (0,
|
|
14109
|
+
const refetch = (0, import_react86.useCallback)(async () => {
|
|
14097
14110
|
const conv = convRef.current;
|
|
14098
14111
|
if (!conv) return;
|
|
14099
14112
|
const opts = optsRef.current;
|
|
@@ -14109,7 +14122,7 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
|
|
|
14109
14122
|
} catch {
|
|
14110
14123
|
}
|
|
14111
14124
|
}, []);
|
|
14112
|
-
const submit = (0,
|
|
14125
|
+
const submit = (0, import_react86.useCallback)(async (answerJson) => {
|
|
14113
14126
|
const conv = convRef.current;
|
|
14114
14127
|
if (!conv || inFlightRef.current) return;
|
|
14115
14128
|
inFlightRef.current = true;
|
|
@@ -14136,14 +14149,14 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
|
|
|
14136
14149
|
setSubmitting(false);
|
|
14137
14150
|
}
|
|
14138
14151
|
}, [refetch]);
|
|
14139
|
-
const hydrate = (0,
|
|
14152
|
+
const hydrate = (0, import_react86.useCallback)(() => {
|
|
14140
14153
|
void refetch();
|
|
14141
14154
|
}, [refetch]);
|
|
14142
14155
|
return { result, submitting, submit, hydrate, rawStatus };
|
|
14143
14156
|
}
|
|
14144
14157
|
|
|
14145
14158
|
// src/components/games/MysteryTigerGame.tsx
|
|
14146
|
-
var
|
|
14159
|
+
var import_react88 = require("react");
|
|
14147
14160
|
|
|
14148
14161
|
// src/components/games/nationFlags.ts
|
|
14149
14162
|
var FLAGS = {
|
|
@@ -14354,7 +14367,7 @@ function isNationCode(flag) {
|
|
|
14354
14367
|
}
|
|
14355
14368
|
|
|
14356
14369
|
// src/components/games/PlayerAvatar.tsx
|
|
14357
|
-
var
|
|
14370
|
+
var import_react87 = require("react");
|
|
14358
14371
|
var import_jsx_runtime108 = require("react/jsx-runtime");
|
|
14359
14372
|
function initialsOf(name) {
|
|
14360
14373
|
const parts2 = name.trim().split(/\s+/).filter(Boolean);
|
|
@@ -14372,7 +14385,7 @@ function PlayerAvatar({
|
|
|
14372
14385
|
imagePath,
|
|
14373
14386
|
className
|
|
14374
14387
|
}) {
|
|
14375
|
-
const [failed, setFailed] = (0,
|
|
14388
|
+
const [failed, setFailed] = (0, import_react87.useState)(false);
|
|
14376
14389
|
const showImage = Boolean(imagePath) && !isPlaceholderImage(imagePath) && !failed;
|
|
14377
14390
|
return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("div", { className, "aria-hidden": "true", children: showImage ? /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("img", { src: imagePath, alt: "", loading: "lazy", onError: () => setFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("span", { className: "ss-w-av-initials", children: initialsOf(name) }) });
|
|
14378
14391
|
}
|
|
@@ -14616,8 +14629,8 @@ function MysteryTigerGame({
|
|
|
14616
14629
|
onBack
|
|
14617
14630
|
}) {
|
|
14618
14631
|
const t = ui.games.mysteryTiger;
|
|
14619
|
-
const [query, setQuery] = (0,
|
|
14620
|
-
const inputId = (0,
|
|
14632
|
+
const [query, setQuery] = (0, import_react88.useState)("");
|
|
14633
|
+
const inputId = (0, import_react88.useId)();
|
|
14621
14634
|
const clientState = parseClientState(result?.clientStateJson);
|
|
14622
14635
|
const guessResults = clientState?.guessResults ?? [];
|
|
14623
14636
|
const alreadyGuessedIds = new Set(guessResults.map((g) => g.playerId));
|
|
@@ -14878,13 +14891,13 @@ function HigherOrLowerGame({
|
|
|
14878
14891
|
}
|
|
14879
14892
|
|
|
14880
14893
|
// src/components/games/CareerPathGame.tsx
|
|
14881
|
-
var
|
|
14894
|
+
var import_react90 = require("react");
|
|
14882
14895
|
|
|
14883
14896
|
// src/components/games/ui/CrestShield.tsx
|
|
14884
|
-
var
|
|
14897
|
+
var import_react89 = require("react");
|
|
14885
14898
|
var import_jsx_runtime119 = require("react/jsx-runtime");
|
|
14886
14899
|
function CrestShield({ src, name, size = 28 }) {
|
|
14887
|
-
const [failed, setFailed] = (0,
|
|
14900
|
+
const [failed, setFailed] = (0, import_react89.useState)(false);
|
|
14888
14901
|
if (src && !isPlaceholderImage(src) && !failed) {
|
|
14889
14902
|
return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("img", { className: "ss-g-crest", src, alt: name, width: size, height: size, loading: "lazy", onError: () => setFailed(true) });
|
|
14890
14903
|
}
|
|
@@ -14916,8 +14929,8 @@ function CareerPathGame({
|
|
|
14916
14929
|
}) {
|
|
14917
14930
|
const s = ui.games.careerPath;
|
|
14918
14931
|
const title = gameTitle({ gameId: "career-path" }, ui.games.titles);
|
|
14919
|
-
const [query, setQuery] = (0,
|
|
14920
|
-
const inputId = (0,
|
|
14932
|
+
const [query, setQuery] = (0, import_react90.useState)("");
|
|
14933
|
+
const inputId = (0, import_react90.useId)();
|
|
14921
14934
|
const clientState = parseClientState3(result?.clientStateJson);
|
|
14922
14935
|
const alreadyGuessedIds = new Set(clientState?.guessResults.map((g) => g.playerId) ?? []);
|
|
14923
14936
|
const isOver = result?.alreadyPlayed === true || clientState?.solved === true || clientState?.failed === true;
|
|
@@ -15023,7 +15036,7 @@ function CareerPathGame({
|
|
|
15023
15036
|
}
|
|
15024
15037
|
|
|
15025
15038
|
// src/components/games/BeatTheGridGame.tsx
|
|
15026
|
-
var
|
|
15039
|
+
var import_react91 = __toESM(require("react"), 1);
|
|
15027
15040
|
|
|
15028
15041
|
// src/components/games/ui/OptionList.tsx
|
|
15029
15042
|
var import_jsx_runtime121 = require("react/jsx-runtime");
|
|
@@ -15112,10 +15125,10 @@ function SearchSheet({
|
|
|
15112
15125
|
ui
|
|
15113
15126
|
}) {
|
|
15114
15127
|
const s = ui.games.beatTheGrid;
|
|
15115
|
-
const [query, setQuery] = (0,
|
|
15116
|
-
const inputId = (0,
|
|
15117
|
-
const inputRef = (0,
|
|
15118
|
-
(0,
|
|
15128
|
+
const [query, setQuery] = (0, import_react91.useState)("");
|
|
15129
|
+
const inputId = (0, import_react91.useId)();
|
|
15130
|
+
const inputRef = (0, import_react91.useRef)(null);
|
|
15131
|
+
(0, import_react91.useEffect)(() => {
|
|
15119
15132
|
inputRef.current?.focus();
|
|
15120
15133
|
}, [row, col]);
|
|
15121
15134
|
const filtered = playerPool.filter(
|
|
@@ -15180,7 +15193,7 @@ function BeatTheGridGame({
|
|
|
15180
15193
|
}) {
|
|
15181
15194
|
const s = ui.games.beatTheGrid;
|
|
15182
15195
|
const title = gameTitle({ gameId: "beat-the-grid" }, ui.games.titles);
|
|
15183
|
-
const [activeCell, setActiveCell] = (0,
|
|
15196
|
+
const [activeCell, setActiveCell] = (0, import_react91.useState)(null);
|
|
15184
15197
|
const clientState = parseClientState4(result?.clientStateJson);
|
|
15185
15198
|
const filledCells = clientState?.cells ?? [];
|
|
15186
15199
|
const isLocked2 = result?.alreadyPlayed === true || clientState?.isComplete === true;
|
|
@@ -15254,7 +15267,7 @@ function BeatTheGridGame({
|
|
|
15254
15267
|
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("span", { "aria-hidden": "true", children: abbr }),
|
|
15255
15268
|
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("span", { className: "ss-g-sr", children: rowLabel })
|
|
15256
15269
|
] });
|
|
15257
|
-
return /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(
|
|
15270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(import_react91.default.Fragment, { children: [
|
|
15258
15271
|
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("div", { className: "ss-g-btg-rowhdr", "data-meta": rowMeta ? "true" : void 0, children: rowHeaderContent }),
|
|
15259
15272
|
cols.map((colLabel, colIdx) => {
|
|
15260
15273
|
const filled = findCellResult(filledCells, rowIdx, colIdx);
|
|
@@ -15335,7 +15348,7 @@ function BeatTheGridGame({
|
|
|
15335
15348
|
}
|
|
15336
15349
|
|
|
15337
15350
|
// src/components/games/GuessTheXiGame.tsx
|
|
15338
|
-
var
|
|
15351
|
+
var import_react92 = require("react");
|
|
15339
15352
|
|
|
15340
15353
|
// src/components/games/ui/PitchSvg.tsx
|
|
15341
15354
|
var import_jsx_runtime123 = require("react/jsx-runtime");
|
|
@@ -15424,8 +15437,8 @@ function GuessTheXiGame({
|
|
|
15424
15437
|
onBack
|
|
15425
15438
|
}) {
|
|
15426
15439
|
const t = ui.games.guessTheXi;
|
|
15427
|
-
const [query, setQuery] = (0,
|
|
15428
|
-
const inputId = (0,
|
|
15440
|
+
const [query, setQuery] = (0, import_react92.useState)("");
|
|
15441
|
+
const inputId = (0, import_react92.useId)();
|
|
15429
15442
|
const clientState = parseClientState5(result?.clientStateJson);
|
|
15430
15443
|
const isOver = result?.alreadyPlayed === true || clientState?.status === "solved" || clientState?.status === "failed";
|
|
15431
15444
|
const solved = clientState?.status === "solved";
|
|
@@ -15567,7 +15580,7 @@ function GuessTheXiGame({
|
|
|
15567
15580
|
}
|
|
15568
15581
|
|
|
15569
15582
|
// src/components/games/DailyQuizGame.tsx
|
|
15570
|
-
var
|
|
15583
|
+
var import_react93 = require("react");
|
|
15571
15584
|
var import_jsx_runtime125 = require("react/jsx-runtime");
|
|
15572
15585
|
function parseClientState6(json) {
|
|
15573
15586
|
if (!json) return null;
|
|
@@ -15608,8 +15621,8 @@ function DailyQuizGame({
|
|
|
15608
15621
|
}) {
|
|
15609
15622
|
const s = ui.games.dailyQuiz;
|
|
15610
15623
|
const title = gameTitle({ gameId: "daily-quiz" }, ui.games.titles);
|
|
15611
|
-
const [selections, setSelections] = (0,
|
|
15612
|
-
const [page, setPage] = (0,
|
|
15624
|
+
const [selections, setSelections] = (0, import_react93.useState)(/* @__PURE__ */ new Map());
|
|
15625
|
+
const [page, setPage] = (0, import_react93.useState)(0);
|
|
15613
15626
|
const clientState = parseClientState6(result?.clientStateJson);
|
|
15614
15627
|
const results2 = clientState?.results ?? [];
|
|
15615
15628
|
const isRevealed = results2.length > 0 || result?.alreadyPlayed === true;
|
|
@@ -15719,7 +15732,7 @@ function DailyQuizGame({
|
|
|
15719
15732
|
}
|
|
15720
15733
|
|
|
15721
15734
|
// src/components/games/MatchdayPredictorGame.tsx
|
|
15722
|
-
var
|
|
15735
|
+
var import_react94 = require("react");
|
|
15723
15736
|
var import_jsx_runtime126 = require("react/jsx-runtime");
|
|
15724
15737
|
var SCORER_SEARCH_THRESHOLD = 9;
|
|
15725
15738
|
function parseClientState7(json) {
|
|
@@ -15815,12 +15828,12 @@ function MatchdayPredictorGame({
|
|
|
15815
15828
|
onBack
|
|
15816
15829
|
}) {
|
|
15817
15830
|
const t = ui.games.predictor;
|
|
15818
|
-
const [homeScore, setHomeScore] = (0,
|
|
15819
|
-
const [awayScore, setAwayScore] = (0,
|
|
15820
|
-
const [firstScorerPlayerId, setFirstScorerPlayerId] = (0,
|
|
15821
|
-
const [lastEdited, setLastEdited] = (0,
|
|
15822
|
-
const [query, setQuery] = (0,
|
|
15823
|
-
const searchId = (0,
|
|
15831
|
+
const [homeScore, setHomeScore] = (0, import_react94.useState)(0);
|
|
15832
|
+
const [awayScore, setAwayScore] = (0, import_react94.useState)(0);
|
|
15833
|
+
const [firstScorerPlayerId, setFirstScorerPlayerId] = (0, import_react94.useState)(null);
|
|
15834
|
+
const [lastEdited, setLastEdited] = (0, import_react94.useState)("home");
|
|
15835
|
+
const [query, setQuery] = (0, import_react94.useState)("");
|
|
15836
|
+
const searchId = (0, import_react94.useId)();
|
|
15824
15837
|
const clientState = parseClientState7(result?.clientStateJson);
|
|
15825
15838
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
15826
15839
|
const header = /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
|
|
@@ -15987,7 +16000,7 @@ function MatchdayPredictorGame({
|
|
|
15987
16000
|
}
|
|
15988
16001
|
|
|
15989
16002
|
// src/components/games/StartingXiGame.tsx
|
|
15990
|
-
var
|
|
16003
|
+
var import_react95 = require("react");
|
|
15991
16004
|
var import_jsx_runtime127 = require("react/jsx-runtime");
|
|
15992
16005
|
var POINTS_PER_STARTER = 8;
|
|
15993
16006
|
var XI_SIZE = 11;
|
|
@@ -16031,10 +16044,10 @@ function StartingXiGame({
|
|
|
16031
16044
|
lockAtUtc
|
|
16032
16045
|
}) {
|
|
16033
16046
|
const t = ui.games.startingXi;
|
|
16034
|
-
const [slotPlayers, setSlotPlayers] = (0,
|
|
16035
|
-
const [active, setActive] = (0,
|
|
16036
|
-
const [query, setQuery] = (0,
|
|
16037
|
-
const searchId = (0,
|
|
16047
|
+
const [slotPlayers, setSlotPlayers] = (0, import_react95.useState)(() => Array(XI_SIZE).fill(null));
|
|
16048
|
+
const [active, setActive] = (0, import_react95.useState)(0);
|
|
16049
|
+
const [query, setQuery] = (0, import_react95.useState)("");
|
|
16050
|
+
const searchId = (0, import_react95.useId)();
|
|
16038
16051
|
const clientState = parseClientState8(result?.clientStateJson);
|
|
16039
16052
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
16040
16053
|
const header = /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
|
|
@@ -16173,7 +16186,7 @@ function StartingXiGame({
|
|
|
16173
16186
|
}
|
|
16174
16187
|
|
|
16175
16188
|
// src/components/games/StatLadderGame.tsx
|
|
16176
|
-
var
|
|
16189
|
+
var import_react96 = require("react");
|
|
16177
16190
|
var import_jsx_runtime128 = require("react/jsx-runtime");
|
|
16178
16191
|
function ladderClue(ladder) {
|
|
16179
16192
|
const mystery = ladder.find((r) => r.rank === 2);
|
|
@@ -16210,9 +16223,9 @@ function StatLadderGame({
|
|
|
16210
16223
|
onBack
|
|
16211
16224
|
}) {
|
|
16212
16225
|
const t = ui.games.statLadder;
|
|
16213
|
-
const [query, setQuery] = (0,
|
|
16214
|
-
const [selectedId, setSelectedId] = (0,
|
|
16215
|
-
const searchId = (0,
|
|
16226
|
+
const [query, setQuery] = (0, import_react96.useState)("");
|
|
16227
|
+
const [selectedId, setSelectedId] = (0, import_react96.useState)(null);
|
|
16228
|
+
const searchId = (0, import_react96.useId)();
|
|
16216
16229
|
const clientState = parseClientState9(result?.clientStateJson);
|
|
16217
16230
|
const revealed = clientState != null;
|
|
16218
16231
|
const header = /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(GameHeader, { title: gameTitle({ gameId: "stat-ladder" }, ui.games.titles), eyebrow: t.eyebrow, onBack, backLabel: ui.back });
|
|
@@ -16418,8 +16431,8 @@ function GameScreenHost({
|
|
|
16418
16431
|
ui
|
|
16419
16432
|
}) {
|
|
16420
16433
|
const { gameId, fixtureId, gameDay = "", lockAtUtc = null } = selected;
|
|
16421
|
-
const [configJson, setConfigJson] = (0,
|
|
16422
|
-
(0,
|
|
16434
|
+
const [configJson, setConfigJson] = (0, import_react97.useState)(null);
|
|
16435
|
+
(0, import_react97.useEffect)(() => {
|
|
16423
16436
|
setConfigJson(null);
|
|
16424
16437
|
if (!conversation) return;
|
|
16425
16438
|
let cancelled = false;
|
|
@@ -16442,12 +16455,12 @@ function GameScreenHost({
|
|
|
16442
16455
|
fixtureId: fixtureId || void 0,
|
|
16443
16456
|
locale: ui.hostTag
|
|
16444
16457
|
});
|
|
16445
|
-
(0,
|
|
16458
|
+
(0, import_react97.useEffect)(() => {
|
|
16446
16459
|
if (conversation) hydrate();
|
|
16447
16460
|
}, [conversation, gameId]);
|
|
16448
|
-
const hydrateRef = (0,
|
|
16461
|
+
const hydrateRef = (0, import_react97.useRef)(hydrate);
|
|
16449
16462
|
hydrateRef.current = hydrate;
|
|
16450
|
-
(0,
|
|
16463
|
+
(0, import_react97.useEffect)(() => {
|
|
16451
16464
|
if (!FIXTURE_GAME_IDS.has(gameId)) return;
|
|
16452
16465
|
if (rawStatus !== "pending") return;
|
|
16453
16466
|
const timerId = setInterval(() => {
|
|
@@ -16560,7 +16573,7 @@ function GameScreenHost({
|
|
|
16560
16573
|
}
|
|
16561
16574
|
|
|
16562
16575
|
// src/components/Leaderboard.tsx
|
|
16563
|
-
var
|
|
16576
|
+
var import_react98 = require("react");
|
|
16564
16577
|
|
|
16565
16578
|
// src/components/LeaderboardRow.tsx
|
|
16566
16579
|
var import_jsx_runtime131 = require("react/jsx-runtime");
|
|
@@ -16647,7 +16660,7 @@ function Leaderboard({
|
|
|
16647
16660
|
ui,
|
|
16648
16661
|
onPlay
|
|
16649
16662
|
}) {
|
|
16650
|
-
const [segment, setSegment] = (0,
|
|
16663
|
+
const [segment, setSegment] = (0, import_react98.useState)("weekly");
|
|
16651
16664
|
const myRow = segment === "weekly" ? data.myWeeklyRow : data.myAllTimeRow;
|
|
16652
16665
|
const offBoard = myRow !== null && myRow !== void 0 && myRow.rank === -1;
|
|
16653
16666
|
const isEmpty = segment === "weekly" ? data.weeklyTop.length === 0 : data.allTimeTop.length === 0;
|
|
@@ -16752,9 +16765,9 @@ function GamesPanel({
|
|
|
16752
16765
|
leaderboardLoading,
|
|
16753
16766
|
refreshHub
|
|
16754
16767
|
}) {
|
|
16755
|
-
const [selected, setSelected] = (0,
|
|
16756
|
-
const [segment, setSegment] = (0,
|
|
16757
|
-
(0,
|
|
16768
|
+
const [selected, setSelected] = (0, import_react99.useState)(null);
|
|
16769
|
+
const [segment, setSegment] = (0, import_react99.useState)("play");
|
|
16770
|
+
(0, import_react99.useEffect)(() => {
|
|
16758
16771
|
ensureGamesFonts();
|
|
16759
16772
|
}, []);
|
|
16760
16773
|
if (!loggedIn) return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(GamesLoginWall, { ui });
|
|
@@ -16818,10 +16831,10 @@ function GamesPanel({
|
|
|
16818
16831
|
}
|
|
16819
16832
|
|
|
16820
16833
|
// src/components/FavouritesPanel.tsx
|
|
16821
|
-
var
|
|
16834
|
+
var import_react102 = require("react");
|
|
16822
16835
|
|
|
16823
16836
|
// src/components/FavouriteChips.tsx
|
|
16824
|
-
var
|
|
16837
|
+
var import_react100 = require("react");
|
|
16825
16838
|
var import_jsx_runtime136 = require("react/jsx-runtime");
|
|
16826
16839
|
async function toggleWithNotice(controller, kind, id, onNotice) {
|
|
16827
16840
|
const outcome = await controller.toggle(kind, id);
|
|
@@ -16868,12 +16881,12 @@ function Group({ title, entities, sport, ui, controller, onNotice }) {
|
|
|
16868
16881
|
] });
|
|
16869
16882
|
}
|
|
16870
16883
|
function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNotice }) {
|
|
16871
|
-
const [confirming, setConfirming] = (0,
|
|
16884
|
+
const [confirming, setConfirming] = (0, import_react100.useState)(false);
|
|
16872
16885
|
const data = controller.data;
|
|
16873
|
-
(0,
|
|
16886
|
+
(0, import_react100.useEffect)(() => {
|
|
16874
16887
|
setConfirming(false);
|
|
16875
16888
|
}, [sport]);
|
|
16876
|
-
(0,
|
|
16889
|
+
(0, import_react100.useEffect)(() => {
|
|
16877
16890
|
if (!confirming) return;
|
|
16878
16891
|
const onPointerDown = (e) => {
|
|
16879
16892
|
if (!(e.target instanceof Element) || !e.target.closest("[data-fav-confirm]")) setConfirming(false);
|
|
@@ -16927,21 +16940,21 @@ function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNoti
|
|
|
16927
16940
|
}
|
|
16928
16941
|
|
|
16929
16942
|
// src/components/FavouritesSearch.tsx
|
|
16930
|
-
var
|
|
16943
|
+
var import_react101 = require("react");
|
|
16931
16944
|
var import_jsx_runtime137 = require("react/jsx-runtime");
|
|
16932
16945
|
var MIN_LETTERS = 2;
|
|
16933
16946
|
var MAX_LENGTH = 64;
|
|
16934
16947
|
var DEBOUNCE_MS = 250;
|
|
16935
16948
|
function FavouritesSearch({ controller, ui, sport, onNotice }) {
|
|
16936
|
-
const [query, setQuery] = (0,
|
|
16937
|
-
const [answer, setAnswer] = (0,
|
|
16938
|
-
const controllerRef = (0,
|
|
16949
|
+
const [query, setQuery] = (0, import_react101.useState)("");
|
|
16950
|
+
const [answer, setAnswer] = (0, import_react101.useState)(null);
|
|
16951
|
+
const controllerRef = (0, import_react101.useRef)(controller);
|
|
16939
16952
|
controllerRef.current = controller;
|
|
16940
16953
|
const trimmed = query.trim();
|
|
16941
16954
|
const queryKey = `${sport}|${trimmed}`;
|
|
16942
16955
|
const results2 = answer?.key === queryKey ? answer.rows : [];
|
|
16943
16956
|
const settled = answer?.key === queryKey;
|
|
16944
|
-
(0,
|
|
16957
|
+
(0, import_react101.useEffect)(() => {
|
|
16945
16958
|
setAnswer(null);
|
|
16946
16959
|
if (trimmed.length < MIN_LETTERS) return;
|
|
16947
16960
|
let cancelled = false;
|
|
@@ -17004,13 +17017,13 @@ function FavouritesSearch({ controller, ui, sport, onNotice }) {
|
|
|
17004
17017
|
// src/components/FavouritesPanel.tsx
|
|
17005
17018
|
var import_jsx_runtime138 = require("react/jsx-runtime");
|
|
17006
17019
|
function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
|
|
17007
|
-
const [notice, setNotice] = (0,
|
|
17008
|
-
const refreshRef = (0,
|
|
17020
|
+
const [notice, setNotice] = (0, import_react102.useState)(null);
|
|
17021
|
+
const refreshRef = (0, import_react102.useRef)(controller.refresh);
|
|
17009
17022
|
refreshRef.current = controller.refresh;
|
|
17010
|
-
(0,
|
|
17023
|
+
(0, import_react102.useEffect)(() => {
|
|
17011
17024
|
void refreshRef.current();
|
|
17012
17025
|
}, []);
|
|
17013
|
-
(0,
|
|
17026
|
+
(0, import_react102.useEffect)(() => {
|
|
17014
17027
|
setNotice(null);
|
|
17015
17028
|
}, [sport]);
|
|
17016
17029
|
const sportLabel2 = sports.find((s) => s.sport === sport)?.label ?? sportLabel(ui, sport);
|
|
@@ -17036,11 +17049,11 @@ function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
|
|
|
17036
17049
|
}
|
|
17037
17050
|
|
|
17038
17051
|
// src/components/PresetTools.tsx
|
|
17039
|
-
var
|
|
17052
|
+
var import_react103 = require("react");
|
|
17040
17053
|
var import_jsx_runtime139 = require("react/jsx-runtime");
|
|
17041
17054
|
function PresetToolModal({ title, closeLabel, onClose, children, footer, className }) {
|
|
17042
17055
|
const { dialogRef, onKeyDown } = useModalDialog(onClose, { restoreFocus: false });
|
|
17043
|
-
const titleId = (0,
|
|
17056
|
+
const titleId = (0, import_react103.useId)();
|
|
17044
17057
|
return /* @__PURE__ */ (0, import_jsx_runtime139.jsx)("div", { className: className ? `ss-w-tool-backdrop ${className}` : "ss-w-tool-backdrop", children: /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("div", { ref: dialogRef, className: "ss-w-tool", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, tabIndex: -1, onKeyDown, children: [
|
|
17045
17058
|
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("div", { className: "ss-w-tool-head", children: [
|
|
17046
17059
|
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("h2", { id: titleId, className: "ss-w-tool-title", children: title }),
|
|
@@ -17090,9 +17103,9 @@ function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal,
|
|
|
17090
17103
|
const totalOptions = comboTotals(grid);
|
|
17091
17104
|
const totals = totalOptions.map((o) => o.value);
|
|
17092
17105
|
const legChoices = comboLegChoices(grid);
|
|
17093
|
-
const [total, setTotal] = (0,
|
|
17094
|
-
const [legs, setLegs] = (0,
|
|
17095
|
-
const [announcement, setAnnouncement] = (0,
|
|
17106
|
+
const [total, setTotal] = (0, import_react103.useState)(() => nearest(totals, initialTotal));
|
|
17107
|
+
const [legs, setLegs] = (0, import_react103.useState)(() => legsForTotal(grid, nearest(totals, initialTotal), clampLegs(legChoices, initialLegs)));
|
|
17108
|
+
const [announcement, setAnnouncement] = (0, import_react103.useState)("");
|
|
17096
17109
|
const cell2 = findCombo(grid, total, legs);
|
|
17097
17110
|
const minLegs = legChoices[0] ?? legs;
|
|
17098
17111
|
const maxLegs = legChoices[legChoices.length - 1] ?? legs;
|
|
@@ -17131,7 +17144,7 @@ function FavouritesSheet({ ui, controller, sport, sports, onSportChange, onClose
|
|
|
17131
17144
|
}
|
|
17132
17145
|
|
|
17133
17146
|
// src/components/dashboard/v8/SentenceBuilder.tsx
|
|
17134
|
-
var
|
|
17147
|
+
var import_react104 = require("react");
|
|
17135
17148
|
var import_jsx_runtime141 = require("react/jsx-runtime");
|
|
17136
17149
|
var TOTALS = ["any", "3", "5", "10", "20", "50"];
|
|
17137
17150
|
var BASE_LEGS = [1, 2, 3, 4];
|
|
@@ -17157,8 +17170,8 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
17157
17170
|
const opening = openingGames(preset);
|
|
17158
17171
|
const gamesOptions = opening.options;
|
|
17159
17172
|
const marketOptions = usableMarkets(preset);
|
|
17160
|
-
const [fingerprint] = (0,
|
|
17161
|
-
const [saved] = (0,
|
|
17173
|
+
const [fingerprint] = (0, import_react104.useState)(() => JSON.stringify(preset));
|
|
17174
|
+
const [saved] = (0, import_react104.useState)(() => {
|
|
17162
17175
|
const kept = memory3?.savedView(sport);
|
|
17163
17176
|
return kept && kept.fingerprint === fingerprint ? kept : null;
|
|
17164
17177
|
});
|
|
@@ -17172,9 +17185,9 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
17172
17185
|
// The server never widens by itself: an all-games preset with no ids asks for it.
|
|
17173
17186
|
widen: opening.option ? opening.option.matchIds.length === 0 : preset.gamesScope === "all" && preset.matchIds.length === 0
|
|
17174
17187
|
};
|
|
17175
|
-
const [view, setView] = (0,
|
|
17176
|
-
const autoWidened = (0,
|
|
17177
|
-
const [widenedNote, setWidenedNote] = (0,
|
|
17188
|
+
const [view, setView] = (0, import_react104.useState)(() => saved?.view ?? openingView);
|
|
17189
|
+
const autoWidened = (0, import_react104.useRef)(false);
|
|
17190
|
+
const [widenedNote, setWidenedNote] = (0, import_react104.useState)(saved?.widenedNote ?? false);
|
|
17178
17191
|
const requestFor = (v) => ({
|
|
17179
17192
|
sport,
|
|
17180
17193
|
...v.marketKey !== null ? { marketKey: v.marketKey } : {},
|
|
@@ -17186,10 +17199,10 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
17186
17199
|
...operatorUserId ? { operatorUserId } : {},
|
|
17187
17200
|
...anonymousUserId ? { anonymousUserId } : {}
|
|
17188
17201
|
});
|
|
17189
|
-
const [first] = (0,
|
|
17202
|
+
const [first] = (0, import_react104.useState)(() => requestFor(view));
|
|
17190
17203
|
const { grid, status: status2, confirmed, request } = useBuilderGrid({ conversation, locale: ui.hostTag, memory: memory3, initial: first });
|
|
17191
|
-
const lastRequest = (0,
|
|
17192
|
-
(0,
|
|
17204
|
+
const lastRequest = (0, import_react104.useRef)(first);
|
|
17205
|
+
(0, import_react104.useEffect)(() => {
|
|
17193
17206
|
void request(lastRequest.current);
|
|
17194
17207
|
}, [request]);
|
|
17195
17208
|
const send = (req) => {
|
|
@@ -17222,14 +17235,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
17222
17235
|
const rows = ready && grid.status === "ok" ? legsOf(grid, sport) : null;
|
|
17223
17236
|
const rowSlip = rows ? guardLegsPreMatch(slip, rows, ui) : slip;
|
|
17224
17237
|
useNextKickoffRender(rows ? rows.map((l) => l.kickoffUtc) : []);
|
|
17225
|
-
const [startedNote, setStartedNote] = (0,
|
|
17238
|
+
const [startedNote, setStartedNote] = (0, import_react104.useState)(false);
|
|
17226
17239
|
const anyStarted = rows !== null && rows.some((l) => !preMatchOpen(l.kickoffUtc, Date.now()));
|
|
17227
|
-
(0,
|
|
17240
|
+
(0, import_react104.useEffect)(() => {
|
|
17228
17241
|
if (startedNote && status2 === "ready" && !anyStarted) setStartedNote(false);
|
|
17229
17242
|
}, [startedNote, status2, anyStarted]);
|
|
17230
17243
|
const market = rows?.[0]?.market;
|
|
17231
|
-
const [seen2, setSeen] = (0,
|
|
17232
|
-
(0,
|
|
17244
|
+
const [seen2, setSeen] = (0, import_react104.useState)(null);
|
|
17245
|
+
(0, import_react104.useEffect)(() => {
|
|
17233
17246
|
if (market) setSeen(market);
|
|
17234
17247
|
}, [market]);
|
|
17235
17248
|
const marketName = view.marketKey === null ? null : marketOptions?.find((m) => m.key === view.marketKey)?.label ?? market ?? seen2;
|
|
@@ -17242,14 +17255,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
17242
17255
|
const quotedAt = rows ? oldestQuote(rows) : null;
|
|
17243
17256
|
const combo = ready && grid.total !== null ? { sport, totalChosen: view.total, totalActual: grid.total } : void 0;
|
|
17244
17257
|
const canWiden = gamesOptions === null || allGames !== null;
|
|
17245
|
-
(0,
|
|
17258
|
+
(0, import_react104.useEffect)(() => {
|
|
17246
17259
|
if (!empty2 || !singles || widened || !canWiden || autoWidened.current) return;
|
|
17247
17260
|
autoWidened.current = true;
|
|
17248
17261
|
const next = { ...view, widen: true, matchIds: [], gamesId: allGames ? allGames.id : view.gamesId };
|
|
17249
17262
|
commit(next, true);
|
|
17250
17263
|
send(requestFor(next));
|
|
17251
17264
|
}, [empty2, singles, widened, canWiden, view]);
|
|
17252
|
-
(0,
|
|
17265
|
+
(0, import_react104.useEffect)(() => {
|
|
17253
17266
|
if (coolOff) onCoolOff?.(sport);
|
|
17254
17267
|
}, [coolOff, onCoolOff, sport]);
|
|
17255
17268
|
if (coolOff) return null;
|
|
@@ -17652,10 +17665,10 @@ function Squad({ squad, loading, ui, view, onToggleView, stats, statsLoading, se
|
|
|
17652
17665
|
}
|
|
17653
17666
|
|
|
17654
17667
|
// src/components/PlayerPhoto.tsx
|
|
17655
|
-
var
|
|
17668
|
+
var import_react105 = require("react");
|
|
17656
17669
|
var import_jsx_runtime147 = require("react/jsx-runtime");
|
|
17657
17670
|
function PlayerPhoto({ photoUrl, jerseyNumber, size }) {
|
|
17658
|
-
const [failed, setFailed] = (0,
|
|
17671
|
+
const [failed, setFailed] = (0, import_react105.useState)(false);
|
|
17659
17672
|
const box = { width: size, height: size };
|
|
17660
17673
|
if (photoUrl && !failed) {
|
|
17661
17674
|
return /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("img", { className: "ss-w-pd-photo", style: box, src: photoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -17690,7 +17703,7 @@ function MiniPitch({ positionCode }) {
|
|
|
17690
17703
|
}
|
|
17691
17704
|
|
|
17692
17705
|
// src/components/PerformanceBars.tsx
|
|
17693
|
-
var
|
|
17706
|
+
var import_react106 = require("react");
|
|
17694
17707
|
var import_jsx_runtime149 = require("react/jsx-runtime");
|
|
17695
17708
|
var GROUPS = ["shooting", "passing", "possession", "defending"];
|
|
17696
17709
|
function finite4(v) {
|
|
@@ -17736,7 +17749,7 @@ function unrankedLine(ui, reason) {
|
|
|
17736
17749
|
}
|
|
17737
17750
|
}
|
|
17738
17751
|
function PerformanceBars({ performance, competitionName, strings }) {
|
|
17739
|
-
const [mode, setMode] = (0,
|
|
17752
|
+
const [mode, setMode] = (0, import_react106.useState)("total");
|
|
17740
17753
|
const labelled = performance.metrics.filter((m) => Object.prototype.hasOwnProperty.call(strings.perfMetric, m.key));
|
|
17741
17754
|
if (!labelled.some((m) => valueOf(m, "total") !== null || valueOf(m, "per90") !== null)) return null;
|
|
17742
17755
|
const subtitle = !performance.ranked ? unrankedLine(strings, performance.unrankedReason) : competitionName ? strings.perfRankedAgainst(competitionName, performance.positionGroup) : null;
|
|
@@ -17945,8 +17958,8 @@ function SettingsSheet({ ui, onClose }) {
|
|
|
17945
17958
|
var import_jsx_runtime152 = require("react/jsx-runtime");
|
|
17946
17959
|
var FULLSCREEN_QUERY = "(max-width: 639px)";
|
|
17947
17960
|
function useIsModal() {
|
|
17948
|
-
const [modal, setModal] = (0,
|
|
17949
|
-
(0,
|
|
17961
|
+
const [modal, setModal] = (0, import_react107.useState)(false);
|
|
17962
|
+
(0, import_react107.useEffect)(() => {
|
|
17950
17963
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
17951
17964
|
const mql = window.matchMedia(FULLSCREEN_QUERY);
|
|
17952
17965
|
const sync = () => setModal(mql.matches);
|
|
@@ -17960,12 +17973,12 @@ var HIDDEN_LAYER_STYLE = { position: "absolute", inset: 0, visibility: "hidden",
|
|
|
17960
17973
|
var SQUAD_LAYER_STYLE = { display: "flex", flexDirection: "column", flex: 1, minHeight: 0 };
|
|
17961
17974
|
function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, schedule, gamesResult, leaderboardResult, clubFixturesResult, clubStandingsResult, clubSquadResult, clubSquadStatsResult, clubPlayerDetailResult, loggedIn, conversation, presetGrid, favouritesEnabled, favourites, builder, onCloseRequested, onRegisterBack }) {
|
|
17962
17975
|
const { state, close, stop, send, reset } = controller;
|
|
17963
|
-
const [squadView, setSquadView] = (0,
|
|
17964
|
-
const [selectedPlayerId, setSelectedPlayerId] = (0,
|
|
17976
|
+
const [squadView, setSquadView] = (0, import_react107.useState)("roster");
|
|
17977
|
+
const [selectedPlayerId, setSelectedPlayerId] = (0, import_react107.useState)(null);
|
|
17965
17978
|
const clearPlayerDetail = clubPlayerDetailResult?.clear;
|
|
17966
17979
|
const fetchPlayerDetail = clubPlayerDetailResult?.fetch;
|
|
17967
|
-
const squadLayerRef = (0,
|
|
17968
|
-
const squadScrollRef = (0,
|
|
17980
|
+
const squadLayerRef = (0, import_react107.useRef)(null);
|
|
17981
|
+
const squadScrollRef = (0, import_react107.useRef)(null);
|
|
17969
17982
|
const selectPlayer = (playerId) => {
|
|
17970
17983
|
squadScrollRef.current = squadLayerRef.current?.querySelector(".ss-w-mon-list")?.scrollTop ?? null;
|
|
17971
17984
|
setSelectedPlayerId(playerId);
|
|
@@ -17975,7 +17988,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17975
17988
|
setSelectedPlayerId(null);
|
|
17976
17989
|
clearPlayerDetail?.();
|
|
17977
17990
|
};
|
|
17978
|
-
(0,
|
|
17991
|
+
(0, import_react107.useLayoutEffect)(() => {
|
|
17979
17992
|
if (selectedPlayerId !== null || squadScrollRef.current === null) return;
|
|
17980
17993
|
const list = squadLayerRef.current?.querySelector(".ss-w-mon-list");
|
|
17981
17994
|
if (list) list.scrollTop = squadScrollRef.current;
|
|
@@ -17988,7 +18001,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17988
18001
|
const hasBuilder = !clubBrand && (builderOptions?.length ?? 0) > 0;
|
|
17989
18002
|
const tabs = monitor ?? (hasBuilder ? tabState : void 0);
|
|
17990
18003
|
const activeTab = tabs?.activeTab;
|
|
17991
|
-
(0,
|
|
18004
|
+
(0, import_react107.useEffect)(() => {
|
|
17992
18005
|
if (activeTab === "squad" || selectedPlayerId === null) return;
|
|
17993
18006
|
setSelectedPlayerId(null);
|
|
17994
18007
|
clearPlayerDetail?.();
|
|
@@ -17997,11 +18010,11 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17997
18010
|
const favouritesOpen = favouritesOffered && (favourites?.open ?? false);
|
|
17998
18011
|
const favouritesAskedOpen = favourites?.open ?? false;
|
|
17999
18012
|
const setFavouritesOpen = favourites?.onOpenChange;
|
|
18000
|
-
(0,
|
|
18013
|
+
(0, import_react107.useEffect)(() => {
|
|
18001
18014
|
if (favouritesAskedOpen && !favouritesOffered) setFavouritesOpen?.(false);
|
|
18002
18015
|
}, [favouritesAskedOpen, favouritesOffered, setFavouritesOpen]);
|
|
18003
18016
|
const storedTab = tabState?.activeTab;
|
|
18004
|
-
(0,
|
|
18017
|
+
(0, import_react107.useEffect)(() => {
|
|
18005
18018
|
const unreachable = storedTab === "builder" ? !hasBuilder : !monitor && storedTab !== void 0 && storedTab !== "chat";
|
|
18006
18019
|
if (unreachable) setMonitorTab?.("chat");
|
|
18007
18020
|
}, [storedTab, hasBuilder, monitor, setMonitorTab]);
|
|
@@ -18010,12 +18023,12 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18010
18023
|
const closeTab = tabs?.activeTab ?? "chat";
|
|
18011
18024
|
const lastMessage = state.messages[state.messages.length - 1];
|
|
18012
18025
|
const answering = state.isStreaming && !(lastMessage?.role === "assistant" && lastMessage.isGreeting);
|
|
18013
|
-
const closeWith = (0,
|
|
18026
|
+
const closeWith = (0, import_react107.useCallback)((method) => {
|
|
18014
18027
|
track({ name: "widget_close", method, tab: closeTab, answering });
|
|
18015
18028
|
if (onCloseRequested) onCloseRequested();
|
|
18016
18029
|
else close();
|
|
18017
18030
|
}, [track, closeTab, answering, close, onCloseRequested]);
|
|
18018
|
-
(0,
|
|
18031
|
+
(0, import_react107.useEffect)(() => {
|
|
18019
18032
|
const onKey = (e) => {
|
|
18020
18033
|
if (e.key === "Escape") closeWith("escape");
|
|
18021
18034
|
};
|
|
@@ -18031,80 +18044,80 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18031
18044
|
tabs?.setActiveTab("chat");
|
|
18032
18045
|
send(text2, { grounding, source });
|
|
18033
18046
|
};
|
|
18034
|
-
(0,
|
|
18047
|
+
(0, import_react107.useEffect)(() => {
|
|
18035
18048
|
if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
|
|
18036
18049
|
}, [monitor, state.isStreaming, state.messages.length]);
|
|
18037
18050
|
const onChatTab = !tabs || tabs.activeTab === "chat";
|
|
18038
|
-
const inputRef = (0,
|
|
18039
|
-
const limitRef = (0,
|
|
18040
|
-
const typedSendRef = (0,
|
|
18041
|
-
const focusAfterCloseRef = (0,
|
|
18042
|
-
const [tool, setTool] = (0,
|
|
18043
|
-
const panelRef = (0,
|
|
18051
|
+
const inputRef = (0, import_react107.useRef)(null);
|
|
18052
|
+
const limitRef = (0, import_react107.useRef)(null);
|
|
18053
|
+
const typedSendRef = (0, import_react107.useRef)(false);
|
|
18054
|
+
const focusAfterCloseRef = (0, import_react107.useRef)(null);
|
|
18055
|
+
const [tool, setTool] = (0, import_react107.useState)(null);
|
|
18056
|
+
const panelRef = (0, import_react107.useRef)(null);
|
|
18044
18057
|
const settings = useOddsSettings();
|
|
18045
|
-
const [settingsOpen, setSettingsOpen] = (0,
|
|
18058
|
+
const [settingsOpen, setSettingsOpen] = (0, import_react107.useState)(false);
|
|
18046
18059
|
const hasSettings = settings.oddsOffered || !settings.themeLocked;
|
|
18047
|
-
const openSettings = (0,
|
|
18060
|
+
const openSettings = (0, import_react107.useCallback)(() => {
|
|
18048
18061
|
setTool(null);
|
|
18049
18062
|
setFavouritesOpen?.(false);
|
|
18050
18063
|
setSettingsOpen(true);
|
|
18051
18064
|
}, [setFavouritesOpen]);
|
|
18052
|
-
const closeSettings = (0,
|
|
18065
|
+
const closeSettings = (0, import_react107.useCallback)(() => {
|
|
18053
18066
|
setSettingsOpen(false);
|
|
18054
18067
|
panelRef.current?.querySelector(".ss-w-kebab")?.focus();
|
|
18055
18068
|
}, []);
|
|
18056
|
-
const openFavourites = (0,
|
|
18057
|
-
const closeFavourites = (0,
|
|
18069
|
+
const openFavourites = (0, import_react107.useCallback)(() => setFavouritesOpen?.(true), [setFavouritesOpen]);
|
|
18070
|
+
const closeFavourites = (0, import_react107.useCallback)(() => {
|
|
18058
18071
|
setFavouritesOpen?.(false);
|
|
18059
18072
|
panelRef.current?.querySelector(".ss-w-kebab")?.focus();
|
|
18060
18073
|
}, [setFavouritesOpen]);
|
|
18061
|
-
(0,
|
|
18074
|
+
(0, import_react107.useEffect)(() => {
|
|
18062
18075
|
if (!favouritesOpen) return;
|
|
18063
18076
|
setTool(null);
|
|
18064
18077
|
setSettingsOpen(false);
|
|
18065
18078
|
}, [favouritesOpen]);
|
|
18066
18079
|
const paused = isPaused(state.limit);
|
|
18067
|
-
(0,
|
|
18080
|
+
(0, import_react107.useEffect)(() => {
|
|
18068
18081
|
if (paused) setTool(null);
|
|
18069
18082
|
}, [paused]);
|
|
18070
|
-
(0,
|
|
18083
|
+
(0, import_react107.useEffect)(() => {
|
|
18071
18084
|
if (!paused) return;
|
|
18072
18085
|
if (typedSendRef.current) limitRef.current?.focus();
|
|
18073
18086
|
typedSendRef.current = false;
|
|
18074
18087
|
}, [paused]);
|
|
18075
|
-
const openTool = (0,
|
|
18088
|
+
const openTool = (0, import_react107.useCallback)((next) => {
|
|
18076
18089
|
setTool(next);
|
|
18077
18090
|
}, []);
|
|
18078
|
-
const toolsValue = (0,
|
|
18091
|
+
const toolsValue = (0, import_react107.useMemo)(
|
|
18079
18092
|
() => presetGrid && !paused ? { openBuilder: (total, legs) => openTool({ total, legs }), changeLabel: ui.presets.changeCombo } : null,
|
|
18080
18093
|
[presetGrid, paused, openTool, ui.presets.changeCombo]
|
|
18081
18094
|
);
|
|
18082
|
-
const closeTool = (0,
|
|
18095
|
+
const closeTool = (0, import_react107.useCallback)(() => {
|
|
18083
18096
|
focusAfterCloseRef.current = "composer";
|
|
18084
18097
|
setTool(null);
|
|
18085
18098
|
}, []);
|
|
18086
|
-
const sendAsk = (0,
|
|
18099
|
+
const sendAsk = (0, import_react107.useCallback)((ask) => {
|
|
18087
18100
|
focusAfterCloseRef.current = "composer";
|
|
18088
18101
|
setTool(null);
|
|
18089
18102
|
tabs?.setActiveTab("chat");
|
|
18090
18103
|
send(ask.message, { displayText: ask.displayText, preset: ask.preset, source: "preset" });
|
|
18091
18104
|
}, [tabs, send]);
|
|
18092
|
-
const formatKickoff = (0,
|
|
18105
|
+
const formatKickoff = (0, import_react107.useCallback)((kickoffUtc) => {
|
|
18093
18106
|
const k = ui.bettingKickoff(kickoffUtc);
|
|
18094
18107
|
return `${k.dayLabel} ${k.time}`;
|
|
18095
18108
|
}, [ui]);
|
|
18096
|
-
(0,
|
|
18109
|
+
(0, import_react107.useEffect)(() => {
|
|
18097
18110
|
if (tool) return;
|
|
18098
18111
|
const target = focusAfterCloseRef.current;
|
|
18099
18112
|
focusAfterCloseRef.current = null;
|
|
18100
18113
|
if (target === "composer") inputRef.current?.focus();
|
|
18101
18114
|
}, [tool]);
|
|
18102
|
-
(0,
|
|
18115
|
+
(0, import_react107.useEffect)(() => {
|
|
18103
18116
|
if (!tool || onChatTab && presetGrid) return;
|
|
18104
18117
|
focusAfterCloseRef.current = "composer";
|
|
18105
18118
|
setTool(null);
|
|
18106
18119
|
}, [tool, onChatTab, presetGrid]);
|
|
18107
|
-
const backRef = (0,
|
|
18120
|
+
const backRef = (0, import_react107.useRef)(() => false);
|
|
18108
18121
|
backRef.current = () => {
|
|
18109
18122
|
if (favouritesOpen) {
|
|
18110
18123
|
closeFavourites();
|
|
@@ -18128,7 +18141,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18128
18141
|
}
|
|
18129
18142
|
return false;
|
|
18130
18143
|
};
|
|
18131
|
-
(0,
|
|
18144
|
+
(0, import_react107.useEffect)(() => {
|
|
18132
18145
|
if (!onRegisterBack) return;
|
|
18133
18146
|
onRegisterBack(() => backRef.current());
|
|
18134
18147
|
return () => onRegisterBack(null);
|
|
@@ -18787,6 +18800,8 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
18787
18800
|
.ss-w-nfl-kick { margin-left: auto; white-space: nowrap; }
|
|
18788
18801
|
.ss-w-nfl-title { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.3; color: var(--ss-w-ink); overflow-wrap: anywhere; }
|
|
18789
18802
|
.ss-w-nfl-badge { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 16px; padding: 0 3px; border-radius: 4px; font-size: 9px; font-weight: 800; letter-spacing: .02em; line-height: 1; color: var(--ss-w-ink); background: var(--ss-w-bubble); border: 1px solid var(--ss-w-line); box-sizing: border-box; }
|
|
18803
|
+
.ss-w-nfl-badge--img { min-width: 0; width: 16px; padding: 1px; object-fit: contain; }
|
|
18804
|
+
.ss-w-props-scorer-who { display: flex; align-items: center; min-width: 0; }
|
|
18790
18805
|
.ss-w-nfl-who { margin: 0; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-weight: 600; font-size: 13px; color: var(--ss-w-ink); overflow-wrap: anywhere; }
|
|
18791
18806
|
.ss-w-nfl-pos { font-size: 10px; font-weight: 600; color: var(--ss-w-faint); border: 1px solid var(--ss-w-line); border-radius: 999px; padding: 0 6px; }
|
|
18792
18807
|
.ss-w-nfl-n { font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ss-w-ink); text-align: right; white-space: nowrap; }
|
|
@@ -21109,12 +21124,12 @@ function injectStyles(root) {
|
|
|
21109
21124
|
function StatsWidget(props) {
|
|
21110
21125
|
const injectedClient = "client" in props ? props.client : void 0;
|
|
21111
21126
|
const cfg = props.config;
|
|
21112
|
-
const built = (0,
|
|
21113
|
-
const trackingRef = (0,
|
|
21114
|
-
const track = (0,
|
|
21115
|
-
const eventTextRef = (0,
|
|
21127
|
+
const built = (0, import_react108.useMemo)(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
|
|
21128
|
+
const trackingRef = (0, import_react108.useRef)({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
|
|
21129
|
+
const track = (0, import_react108.useMemo)(() => createTracker(() => trackingRef.current), []);
|
|
21130
|
+
const eventTextRef = (0, import_react108.useRef)(false);
|
|
21116
21131
|
eventTextRef.current = cfg?.eventText === true;
|
|
21117
|
-
const logger = (0,
|
|
21132
|
+
const logger = (0, import_react108.useMemo)(() => {
|
|
21118
21133
|
if (!built) return null;
|
|
21119
21134
|
const raw = built.client.createEventLogger({
|
|
21120
21135
|
operatorUserId: cfg?.userContext?.operatorUserId,
|
|
@@ -21124,27 +21139,27 @@ function StatsWidget(props) {
|
|
|
21124
21139
|
}, [built?.client, track]);
|
|
21125
21140
|
const widgetStrings = useWidgetStrings(cfg, built?.conversation ?? null);
|
|
21126
21141
|
const stringsPending = widgetStrings.strings === void 0;
|
|
21127
|
-
const ui = (0,
|
|
21142
|
+
const ui = (0, import_react108.useMemo)(
|
|
21128
21143
|
() => normalizeUi(props.config ?? { operatorId: "", publicKey: "" }, widgetStrings.strings ?? BUNDLED),
|
|
21129
21144
|
[props.config, widgetStrings.strings]
|
|
21130
21145
|
);
|
|
21131
21146
|
const oddsSettings = useOddsSettingsState(ui, built?.conversation, cfg?.operatorId || "default");
|
|
21132
|
-
const rootRef = (0,
|
|
21133
|
-
const introDoneRef = (0,
|
|
21134
|
-
const markIntroDone = (0,
|
|
21147
|
+
const rootRef = (0, import_react108.useRef)(null);
|
|
21148
|
+
const introDoneRef = (0, import_react108.useRef)(false);
|
|
21149
|
+
const markIntroDone = (0, import_react108.useCallback)(() => {
|
|
21135
21150
|
introDoneRef.current = true;
|
|
21136
21151
|
}, []);
|
|
21137
21152
|
const language = injectedClient ? void 0 : hostTag(cfg);
|
|
21138
21153
|
const threadLanguage = familyOf(language);
|
|
21139
21154
|
const convStorageKey = `ss-w-conv:${cfg?.operatorId ?? ""}:${cfg?.userContext?.operatorUserId ?? "anon"}${threadLanguage ? `:lang=${threadLanguage}` : ""}`;
|
|
21140
|
-
const sportScope = (0,
|
|
21155
|
+
const sportScope = (0, import_react108.useMemo)(
|
|
21141
21156
|
() => ({ operatorId: cfg?.operatorId ?? "", operatorUserId: cfg?.userContext?.operatorUserId, anonymousUserId: cfg?.userContext?.anonymousUserId }),
|
|
21142
21157
|
[cfg?.operatorId, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId]
|
|
21143
21158
|
);
|
|
21144
|
-
const chatTracking = (0,
|
|
21159
|
+
const chatTracking = (0, import_react108.useMemo)(() => ({ track, eventText: () => eventTextRef.current }), [track]);
|
|
21145
21160
|
const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey, cfg?.page, sportScope, language, chatTracking, injectedClient ? oddsSettings.userOddsFormat : oddsSettings.oddsFormat);
|
|
21146
21161
|
const panelOpen = controller.state.isOpen && !stringsPending;
|
|
21147
|
-
const liveCardWatches = (0,
|
|
21162
|
+
const liveCardWatches = (0, import_react108.useMemo)(() => {
|
|
21148
21163
|
const seen2 = /* @__PURE__ */ new Set();
|
|
21149
21164
|
const out = [];
|
|
21150
21165
|
for (const msg of controller.state.messages) {
|
|
@@ -21170,19 +21185,19 @@ function StatsWidget(props) {
|
|
|
21170
21185
|
});
|
|
21171
21186
|
const operatorUserId = cfg?.userContext?.operatorUserId;
|
|
21172
21187
|
const anonymousUserId = cfg?.userContext?.anonymousUserId;
|
|
21173
|
-
const getSchedule = (0,
|
|
21188
|
+
const getSchedule = (0, import_react108.useCallback)(
|
|
21174
21189
|
(localDate, utcOffsetMinutes) => built ? built.conversation.getSchedule(localDate, utcOffsetMinutes, operatorUserId, anonymousUserId) : Promise.resolve(null),
|
|
21175
21190
|
[built, operatorUserId, anonymousUserId]
|
|
21176
21191
|
);
|
|
21177
|
-
const getStates = (0,
|
|
21192
|
+
const getStates = (0, import_react108.useCallback)(
|
|
21178
21193
|
(matchIds, nbaGameIds, nflGameIds, tennisMatches) => built ? built.conversation.getStates(matchIds, nbaGameIds, nflGameIds, requestTag, tennisMatches) : Promise.resolve(null),
|
|
21179
21194
|
[built, requestTag]
|
|
21180
21195
|
);
|
|
21181
|
-
const getTennisPrices = (0,
|
|
21196
|
+
const getTennisPrices = (0, import_react108.useCallback)(
|
|
21182
21197
|
(keys) => built ? built.conversation.getStates([], [], [], requestTag, [], keys).then((p) => p?.tennisPrices ?? null) : Promise.resolve(null),
|
|
21183
21198
|
[built, requestTag]
|
|
21184
21199
|
);
|
|
21185
|
-
const pinnedMatchIds = (0,
|
|
21200
|
+
const pinnedMatchIds = (0, import_react108.useMemo)(
|
|
21186
21201
|
() => footballMatchPinIds(monitor.pins),
|
|
21187
21202
|
[monitor.pins]
|
|
21188
21203
|
);
|
|
@@ -21196,13 +21211,13 @@ function StatsWidget(props) {
|
|
|
21196
21211
|
pinnedMatchIds,
|
|
21197
21212
|
timeZone: ui.timeZone
|
|
21198
21213
|
});
|
|
21199
|
-
const offeredSports = (0,
|
|
21214
|
+
const offeredSports = (0, import_react108.useMemo)(() => {
|
|
21200
21215
|
const seen2 = new Set(discovery.matchDays.map((d) => d.sport));
|
|
21201
21216
|
for (const g of discovery.groups) seen2.add(g.sport ?? "football");
|
|
21202
21217
|
return [...seen2];
|
|
21203
21218
|
}, [discovery.matchDays, discovery.groups]);
|
|
21204
21219
|
const scheduleSport = useScheduleSport(offeredSports);
|
|
21205
|
-
const [liveLeague, setLiveLeague] = (0,
|
|
21220
|
+
const [liveLeague, setLiveLeague] = (0, import_react108.useState)(null);
|
|
21206
21221
|
const [matchesDay, setMatchesDay] = useMatchesDayPick(discovery.localDate);
|
|
21207
21222
|
const matchesLoaded = useMatchesDay({
|
|
21208
21223
|
discovery,
|
|
@@ -21212,8 +21227,8 @@ function StatsWidget(props) {
|
|
|
21212
21227
|
enabled: panelOpen && monitor.activeTab === "matches",
|
|
21213
21228
|
timeZone: ui.timeZone
|
|
21214
21229
|
});
|
|
21215
|
-
const prevLiveSnapshotRef = (0,
|
|
21216
|
-
(0,
|
|
21230
|
+
const prevLiveSnapshotRef = (0, import_react108.useRef)(monitor.snapshot);
|
|
21231
|
+
(0, import_react108.useEffect)(() => {
|
|
21217
21232
|
const snap = monitor.snapshot;
|
|
21218
21233
|
if (!snap || snap === prevLiveSnapshotRef.current) return;
|
|
21219
21234
|
prevLiveSnapshotRef.current = snap;
|
|
@@ -21253,14 +21268,14 @@ function StatsWidget(props) {
|
|
|
21253
21268
|
const clubSquadResult = useClubSquad(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
21254
21269
|
const clubSquadStatsResult = useClubSquadStats(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
21255
21270
|
const clubPlayerDetailResult = useClubPlayerDetail(built?.conversation ?? null);
|
|
21256
|
-
const [favSportPick, setFavSportPick] = (0,
|
|
21257
|
-
const latestGreeting = (0,
|
|
21271
|
+
const [favSportPick, setFavSportPick] = (0, import_react108.useState)(null);
|
|
21272
|
+
const latestGreeting = (0, import_react108.useMemo)(() => {
|
|
21258
21273
|
for (const m of [...controller.state.messages].reverse()) {
|
|
21259
21274
|
if (m.role === "assistant" && m.defaultSport !== void 0) return m;
|
|
21260
21275
|
}
|
|
21261
21276
|
return null;
|
|
21262
21277
|
}, [controller.state.messages]);
|
|
21263
|
-
const favSportOptions = (0,
|
|
21278
|
+
const favSportOptions = (0, import_react108.useMemo)(
|
|
21264
21279
|
() => (switchSets(latestGreeting?.greetingDashboards) ?? []).map((set) => ({ sport: set.sport, label: set.label })),
|
|
21265
21280
|
[latestGreeting]
|
|
21266
21281
|
);
|
|
@@ -21269,20 +21284,20 @@ function StatsWidget(props) {
|
|
|
21269
21284
|
const favSport = [favSportPick, rememberedSport, latestGreeting?.defaultSport].find(offered) ?? "football";
|
|
21270
21285
|
const favSports = favSportOptions.length > 0 ? favSportOptions : [{ sport: favSport, label: sportLabel(ui, favSport) }];
|
|
21271
21286
|
const hasFavouritesIdentity = !!(operatorUserId || anonymousUserId);
|
|
21272
|
-
const [builderSportPick, setBuilderSportPick] = (0,
|
|
21273
|
-
const builderGreeting = (0,
|
|
21287
|
+
const [builderSportPick, setBuilderSportPick] = (0, import_react108.useState)(null);
|
|
21288
|
+
const builderGreeting = (0, import_react108.useMemo)(
|
|
21274
21289
|
() => [...controller.state.messages].reverse().find((m) => m.role === "assistant" && (m.greetingDashboard !== void 0 || m.greetingDashboards !== void 0)) ?? null,
|
|
21275
21290
|
[controller.state.messages]
|
|
21276
21291
|
);
|
|
21277
|
-
const [coolOff, setCoolOff] = (0,
|
|
21278
|
-
const onBuilderCoolOff = (0,
|
|
21292
|
+
const [coolOff, setCoolOff] = (0, import_react108.useState)(null);
|
|
21293
|
+
const onBuilderCoolOff = (0, import_react108.useCallback)((sport) => {
|
|
21279
21294
|
if (!builderGreeting) return;
|
|
21280
21295
|
setCoolOff((prev) => {
|
|
21281
21296
|
const sports = prev?.greeting === builderGreeting ? prev.sports : [];
|
|
21282
21297
|
return sports.includes(sport) ? prev : { greeting: builderGreeting, sports: [...sports, sport] };
|
|
21283
21298
|
});
|
|
21284
21299
|
}, [builderGreeting]);
|
|
21285
|
-
const builderOptions = (0,
|
|
21300
|
+
const builderOptions = (0, import_react108.useMemo)(() => {
|
|
21286
21301
|
const greeting = builderGreeting;
|
|
21287
21302
|
if (!greeting) return [];
|
|
21288
21303
|
const cooled = coolOff?.greeting === greeting ? coolOff.sports : [];
|
|
@@ -21295,7 +21310,7 @@ function StatsWidget(props) {
|
|
|
21295
21310
|
return options.filter((o) => !cooled.includes(o.sport));
|
|
21296
21311
|
}, [builderGreeting, coolOff, ui]);
|
|
21297
21312
|
const builderSport = [builderSportPick, rememberedSport, latestGreeting?.defaultSport].find((s) => !!s && builderOptions.some((o) => o.sport === s)) ?? builderOptions[0]?.sport ?? "";
|
|
21298
|
-
const [panelEverOpened, setPanelEverOpened] = (0,
|
|
21313
|
+
const [panelEverOpened, setPanelEverOpened] = (0, import_react108.useState)(panelOpen);
|
|
21299
21314
|
if (panelOpen && !panelEverOpened) setPanelEverOpened(true);
|
|
21300
21315
|
const favourites = useFavourites({
|
|
21301
21316
|
conversation: built?.conversation ?? null,
|
|
@@ -21307,16 +21322,16 @@ function StatsWidget(props) {
|
|
|
21307
21322
|
onChanged: discovery.refreshSchedule
|
|
21308
21323
|
});
|
|
21309
21324
|
const favouritesEnabled = hasFavouritesIdentity && favourites.status !== "refused";
|
|
21310
|
-
const [favouritesOpen, setFavouritesOpen] = (0,
|
|
21325
|
+
const [favouritesOpen, setFavouritesOpen] = (0, import_react108.useState)(false);
|
|
21311
21326
|
if (!panelOpen && favouritesOpen) setFavouritesOpen(false);
|
|
21312
|
-
const getPricePresets = (0,
|
|
21327
|
+
const getPricePresets = (0, import_react108.useCallback)(
|
|
21313
21328
|
(locale) => built ? built.conversation.getPricePresets(locale, { pool: "open" }) : Promise.resolve(null),
|
|
21314
21329
|
[built]
|
|
21315
21330
|
);
|
|
21316
21331
|
const presetGrid = usePresetGrid({ getPricePresets, isOpen: panelOpen, locale: ui.hostTag });
|
|
21317
21332
|
const markLiveActivity = monitor.markLiveActivity;
|
|
21318
|
-
const prevLiveCountRef = (0,
|
|
21319
|
-
(0,
|
|
21333
|
+
const prevLiveCountRef = (0, import_react108.useRef)(0);
|
|
21334
|
+
(0, import_react108.useEffect)(() => {
|
|
21320
21335
|
const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
|
|
21321
21336
|
prevLiveCountRef.current = discovery.liveCount;
|
|
21322
21337
|
if (rose) markLiveActivity();
|
|
@@ -21330,7 +21345,7 @@ function StatsWidget(props) {
|
|
|
21330
21345
|
closePanel: controller.close
|
|
21331
21346
|
});
|
|
21332
21347
|
const markAdded = hostEvents.markAdded;
|
|
21333
|
-
const slip = (0,
|
|
21348
|
+
const slip = (0, import_react108.useMemo)(
|
|
21334
21349
|
() => {
|
|
21335
21350
|
const handler = props.config?.onAddToSlip;
|
|
21336
21351
|
return {
|
|
@@ -21350,7 +21365,7 @@ function StatsWidget(props) {
|
|
|
21350
21365
|
},
|
|
21351
21366
|
[props.config?.onAddToSlip, props.config?.slipSports, controller.state.conversationId, markAdded]
|
|
21352
21367
|
);
|
|
21353
|
-
const onDashboardTap = (0,
|
|
21368
|
+
const onDashboardTap = (0, import_react108.useMemo)(
|
|
21354
21369
|
() => built ? createDashboardTapSignal((input) => built.conversation.sendSignal(input), logger) : void 0,
|
|
21355
21370
|
[built, logger]
|
|
21356
21371
|
);
|
|
@@ -21364,7 +21379,7 @@ function StatsWidget(props) {
|
|
|
21364
21379
|
log: logger
|
|
21365
21380
|
})
|
|
21366
21381
|
}));
|
|
21367
|
-
const dismissPopupRef = (0,
|
|
21382
|
+
const dismissPopupRef = (0, import_react108.useRef)(() => {
|
|
21368
21383
|
});
|
|
21369
21384
|
const mobile = useMobileBinding({
|
|
21370
21385
|
binding: props.mobile,
|
|
@@ -21378,10 +21393,10 @@ function StatsWidget(props) {
|
|
|
21378
21393
|
const dismissPopup = usePopupTelemetry(logger, panelOpen, controller.state.popupText, controller.dismissPopup, mobile.confirmedShown);
|
|
21379
21394
|
dismissPopupRef.current = dismissPopup;
|
|
21380
21395
|
useOpenTelemetry(logger, panelOpen);
|
|
21381
|
-
const onControlRef = (0,
|
|
21396
|
+
const onControlRef = (0, import_react108.useRef)(props.onControl);
|
|
21382
21397
|
onControlRef.current = props.onControl;
|
|
21383
21398
|
const { open: openPanel, close: closePanel } = controller;
|
|
21384
|
-
(0,
|
|
21399
|
+
(0, import_react108.useEffect)(() => {
|
|
21385
21400
|
onControlRef.current?.({ open: openPanel, close: closePanel });
|
|
21386
21401
|
return () => onControlRef.current?.(null);
|
|
21387
21402
|
}, [openPanel, closePanel]);
|
|
@@ -21398,11 +21413,11 @@ function StatsWidget(props) {
|
|
|
21398
21413
|
page: cfg?.page
|
|
21399
21414
|
}
|
|
21400
21415
|
};
|
|
21401
|
-
(0,
|
|
21416
|
+
(0, import_react108.useEffect)(() => {
|
|
21402
21417
|
if (!logger) return;
|
|
21403
21418
|
logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
|
|
21404
21419
|
}, [logger, operatorUserId, anonymousUserId, conversationId]);
|
|
21405
|
-
(0,
|
|
21420
|
+
(0, import_react108.useEffect)(() => {
|
|
21406
21421
|
if (!logger) return;
|
|
21407
21422
|
logger.resume();
|
|
21408
21423
|
const onHide = () => {
|
|
@@ -21420,15 +21435,15 @@ function StatsWidget(props) {
|
|
|
21420
21435
|
logger.dispose();
|
|
21421
21436
|
};
|
|
21422
21437
|
}, [logger]);
|
|
21423
|
-
(0,
|
|
21438
|
+
(0, import_react108.useEffect)(() => {
|
|
21424
21439
|
if (!built || !ui.injectStyles || widgetStrings.state === "unavailable") return;
|
|
21425
21440
|
const node = rootRef.current?.getRootNode();
|
|
21426
21441
|
if (node) injectStyles(node);
|
|
21427
21442
|
}, [built, ui.injectStyles, widgetStrings.state]);
|
|
21428
21443
|
const holds = useSessionHolds();
|
|
21429
21444
|
const builderConversation = built?.conversation ?? null;
|
|
21430
|
-
const builderMemory = (0,
|
|
21431
|
-
const personalGreeting = (0,
|
|
21445
|
+
const builderMemory = (0, import_react108.useMemo)(() => createBuilderMemory(), [builderConversation, controller.state.threadEpoch]);
|
|
21446
|
+
const personalGreeting = (0, import_react108.useMemo)(() => ({
|
|
21432
21447
|
favourites: favouritesEnabled && monitor.enabled ? favourites : null,
|
|
21433
21448
|
conversation: built?.conversation ?? null,
|
|
21434
21449
|
openFavourites: () => setFavouritesOpen(true),
|