@sensiblestats/widget-react 0.156.0 → 0.158.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/index.cjs +402 -367
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -3
- package/dist/index.d.ts +11 -3
- package/dist/index.js +38 -3
- package/dist/index.js.map +1 -1
- 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_react124 = require("react");
|
|
42
42
|
var import_widget_sdk39 = require("@sensiblestats/widget-sdk");
|
|
43
43
|
|
|
44
44
|
// src/strings/tag.ts
|
|
@@ -1422,7 +1422,7 @@ function parseCustomTotal(text2, format2) {
|
|
|
1422
1422
|
}
|
|
1423
1423
|
|
|
1424
1424
|
// src/version.generated.ts
|
|
1425
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1425
|
+
var WIDGET_REACT_VERSION = "0.158.0";
|
|
1426
1426
|
|
|
1427
1427
|
// src/config.ts
|
|
1428
1428
|
var COLOR_KEYS = ["accent", "cta", "surface", "ink"];
|
|
@@ -1832,6 +1832,8 @@ function toClientOptions(cfg) {
|
|
|
1832
1832
|
const opts = { operatorId: cfg.operatorId, publicKey: cfg.publicKey, client: `${cfg.transport?.client ?? "widget-react"}/${WIDGET_REACT_VERSION}` };
|
|
1833
1833
|
if (cfg.baseUrl !== void 0) opts.baseUrl = cfg.baseUrl;
|
|
1834
1834
|
if (cfg.transport?.fetch !== void 0) opts.fetch = cfg.transport.fetch;
|
|
1835
|
+
const timeZone = validZone(cfg.timeZone);
|
|
1836
|
+
if (timeZone !== void 0) opts.timeZone = timeZone;
|
|
1835
1837
|
return opts;
|
|
1836
1838
|
}
|
|
1837
1839
|
function toUserContext(cfg) {
|
|
@@ -8457,6 +8459,14 @@ function useMobileBinding(args) {
|
|
|
8457
8459
|
});
|
|
8458
8460
|
return () => binding.onHandle(null);
|
|
8459
8461
|
}, [binding]);
|
|
8462
|
+
const { labels, theme } = args;
|
|
8463
|
+
const labelsKey = labels ? JSON.stringify([labels.launcher, labels.dismiss]) : "";
|
|
8464
|
+
(0, import_react56.useEffect)(() => {
|
|
8465
|
+
if (labels) binding?.onLabels?.(labels);
|
|
8466
|
+
}, [binding, labelsKey]);
|
|
8467
|
+
(0, import_react56.useEffect)(() => {
|
|
8468
|
+
if (theme) binding?.onTheme?.(theme);
|
|
8469
|
+
}, [binding, theme]);
|
|
8460
8470
|
const onCloseRequested = (0, import_react56.useCallback)(() => bindingRef.current?.onCloseRequested(), []);
|
|
8461
8471
|
const onRegisterBack = (0, import_react56.useCallback)((fn) => {
|
|
8462
8472
|
backRef.current = fn;
|
|
@@ -8532,11 +8542,33 @@ function webTeaserBinding(host, deliver, drawsLauncher) {
|
|
|
8532
8542
|
};
|
|
8533
8543
|
}
|
|
8534
8544
|
|
|
8535
|
-
// src/
|
|
8545
|
+
// src/resolvedTheme.ts
|
|
8536
8546
|
var import_react57 = require("react");
|
|
8547
|
+
var QUERY = "(prefers-color-scheme: dark)";
|
|
8548
|
+
function systemDark() {
|
|
8549
|
+
try {
|
|
8550
|
+
return typeof window.matchMedia === "function" && window.matchMedia(QUERY).matches;
|
|
8551
|
+
} catch {
|
|
8552
|
+
return false;
|
|
8553
|
+
}
|
|
8554
|
+
}
|
|
8555
|
+
function subscribe(onChange) {
|
|
8556
|
+
if (typeof window.matchMedia !== "function") return () => {
|
|
8557
|
+
};
|
|
8558
|
+
const query = window.matchMedia(QUERY);
|
|
8559
|
+
query.addEventListener("change", onChange);
|
|
8560
|
+
return () => query.removeEventListener("change", onChange);
|
|
8561
|
+
}
|
|
8562
|
+
function useResolvedTheme(choice) {
|
|
8563
|
+
const dark = (0, import_react57.useSyncExternalStore)(subscribe, systemDark, () => false);
|
|
8564
|
+
return choice === "auto" ? dark ? "dark" : "light" : choice;
|
|
8565
|
+
}
|
|
8566
|
+
|
|
8567
|
+
// src/openTelemetry.ts
|
|
8568
|
+
var import_react58 = require("react");
|
|
8537
8569
|
function useOpenTelemetry(log, isOpen) {
|
|
8538
|
-
const openLoggedRef = (0,
|
|
8539
|
-
(0,
|
|
8570
|
+
const openLoggedRef = (0, import_react58.useRef)(false);
|
|
8571
|
+
(0, import_react58.useEffect)(() => {
|
|
8540
8572
|
if (!isOpen) {
|
|
8541
8573
|
openLoggedRef.current = false;
|
|
8542
8574
|
return;
|
|
@@ -8548,13 +8580,13 @@ function useOpenTelemetry(log, isOpen) {
|
|
|
8548
8580
|
}
|
|
8549
8581
|
|
|
8550
8582
|
// src/components/ChatFab.tsx
|
|
8551
|
-
var
|
|
8583
|
+
var import_react60 = require("react");
|
|
8552
8584
|
|
|
8553
8585
|
// src/components/BrandMark.tsx
|
|
8554
|
-
var
|
|
8586
|
+
var import_react59 = require("react");
|
|
8555
8587
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
8556
8588
|
function BrandMark({ logoUrl, className }) {
|
|
8557
|
-
const [failed, setFailed] = (0,
|
|
8589
|
+
const [failed, setFailed] = (0, import_react59.useState)(false);
|
|
8558
8590
|
if (!logoUrl || failed) return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SsMark, { className });
|
|
8559
8591
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("img", { className, src: logoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
8560
8592
|
}
|
|
@@ -8598,9 +8630,9 @@ function ChatFab({ label, busy = false, greeting, popupText, logoUrl, onOpen, on
|
|
|
8598
8630
|
const bubble = popupText ?? greeting;
|
|
8599
8631
|
const hidden = busy && !label;
|
|
8600
8632
|
const track = useTrack();
|
|
8601
|
-
const [intro, setIntro] = (0,
|
|
8602
|
-
const armedRef = (0,
|
|
8603
|
-
(0,
|
|
8633
|
+
const [intro, setIntro] = (0, import_react60.useState)(false);
|
|
8634
|
+
const armedRef = (0, import_react60.useRef)(introAllowed);
|
|
8635
|
+
(0, import_react60.useEffect)(() => {
|
|
8604
8636
|
if (armedRef.current && bubble) {
|
|
8605
8637
|
armedRef.current = false;
|
|
8606
8638
|
setIntro(true);
|
|
@@ -8621,23 +8653,23 @@ function ChatFab({ label, busy = false, greeting, popupText, logoUrl, onOpen, on
|
|
|
8621
8653
|
}
|
|
8622
8654
|
|
|
8623
8655
|
// src/components/BubblePrice.tsx
|
|
8624
|
-
var
|
|
8656
|
+
var import_react61 = require("react");
|
|
8625
8657
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
8626
8658
|
function BubblePrice({ matchId, price, conversation, slip, ui, hook, sport }) {
|
|
8627
|
-
const selections = (0,
|
|
8659
|
+
const selections = (0, import_react61.useMemo)(() => [price.selection], [price.selection]);
|
|
8628
8660
|
const add = useRepriceAdd({ conversation, locale: ui.hostTag, slip, ui, sport });
|
|
8629
8661
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "ss-w-greeting-pick", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(PriceButtons, { selections, ui, rowLabel: price.label || price.selection.label, sport, onAdd: add ? (s) => add(matchId, price.market, s, hook) : void 0 }) });
|
|
8630
8662
|
}
|
|
8631
8663
|
|
|
8632
8664
|
// src/components/MobileBubblePrice.tsx
|
|
8633
|
-
var
|
|
8665
|
+
var import_react62 = require("react");
|
|
8634
8666
|
function MobileBubblePrice(props) {
|
|
8635
8667
|
const add = useRepriceAdd({ conversation: props.conversation, locale: props.ui.hostTag, slip: props.slip, ui: props.ui, sport: props.sport });
|
|
8636
8668
|
const marks = useSettledMarks();
|
|
8637
|
-
const latest = (0,
|
|
8669
|
+
const latest = (0, import_react62.useRef)({ props, add, marks });
|
|
8638
8670
|
latest.current = { props, add, marks };
|
|
8639
8671
|
const { onRegister, inFlight: inFlight2 } = props;
|
|
8640
|
-
(0,
|
|
8672
|
+
(0, import_react62.useEffect)(() => {
|
|
8641
8673
|
onRegister(() => {
|
|
8642
8674
|
const { props: p, add: run, marks: m } = latest.current;
|
|
8643
8675
|
const id = p.price.selection.matchOddsId;
|
|
@@ -8673,10 +8705,10 @@ function MobileBubblePrice(props) {
|
|
|
8673
8705
|
}
|
|
8674
8706
|
|
|
8675
8707
|
// src/components/ChatPanel.tsx
|
|
8676
|
-
var
|
|
8708
|
+
var import_react123 = require("react");
|
|
8677
8709
|
|
|
8678
8710
|
// src/components/ChatHeader.tsx
|
|
8679
|
-
var
|
|
8711
|
+
var import_react63 = require("react");
|
|
8680
8712
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
8681
8713
|
function ChatHeader({
|
|
8682
8714
|
onClose,
|
|
@@ -8692,18 +8724,18 @@ function ChatHeader({
|
|
|
8692
8724
|
onOpenFavourites,
|
|
8693
8725
|
favouritesLabel
|
|
8694
8726
|
}) {
|
|
8695
|
-
const [menuOpen, setMenuOpen] = (0,
|
|
8696
|
-
const wrapRef = (0,
|
|
8697
|
-
const kebabRef = (0,
|
|
8698
|
-
const firstItemRef = (0,
|
|
8727
|
+
const [menuOpen, setMenuOpen] = (0, import_react63.useState)(false);
|
|
8728
|
+
const wrapRef = (0, import_react63.useRef)(null);
|
|
8729
|
+
const kebabRef = (0, import_react63.useRef)(null);
|
|
8730
|
+
const firstItemRef = (0, import_react63.useRef)(null);
|
|
8699
8731
|
const hasNew = !!(canReset && onNewConversation);
|
|
8700
8732
|
const hasSettings = !!onOpenSettings;
|
|
8701
8733
|
const hasFavourites = !!onOpenFavourites;
|
|
8702
8734
|
const hasMenu = hasFavourites || hasNew || hasSettings;
|
|
8703
|
-
(0,
|
|
8735
|
+
(0, import_react63.useEffect)(() => {
|
|
8704
8736
|
if (menuOpen) firstItemRef.current?.focus();
|
|
8705
8737
|
}, [menuOpen]);
|
|
8706
|
-
(0,
|
|
8738
|
+
(0, import_react63.useEffect)(() => {
|
|
8707
8739
|
if (!menuOpen) return;
|
|
8708
8740
|
const onPointer = (e) => {
|
|
8709
8741
|
if (!(wrapRef.current && e.composedPath().includes(wrapRef.current))) setMenuOpen(false);
|
|
@@ -8791,10 +8823,10 @@ function ChatHeader({
|
|
|
8791
8823
|
}
|
|
8792
8824
|
|
|
8793
8825
|
// src/components/MessageList.tsx
|
|
8794
|
-
var
|
|
8826
|
+
var import_react78 = require("react");
|
|
8795
8827
|
|
|
8796
8828
|
// src/components/ChatMessage.tsx
|
|
8797
|
-
var
|
|
8829
|
+
var import_react77 = require("react");
|
|
8798
8830
|
|
|
8799
8831
|
// src/components/Markdown.tsx
|
|
8800
8832
|
var import_react_markdown = __toESM(require("react-markdown"), 1);
|
|
@@ -8812,7 +8844,7 @@ function Markdown({ text: text2 }) {
|
|
|
8812
8844
|
}
|
|
8813
8845
|
|
|
8814
8846
|
// src/components/EntityCardList.tsx
|
|
8815
|
-
var
|
|
8847
|
+
var import_react64 = require("react");
|
|
8816
8848
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
8817
8849
|
var MAX_VISIBLE = 3;
|
|
8818
8850
|
var RECORD_RE = /^(\d+)-(\d+)-(\d+)$/;
|
|
@@ -8915,7 +8947,7 @@ function ScopeTabs({ scopes, active, onSelect }) {
|
|
|
8915
8947
|
)) });
|
|
8916
8948
|
}
|
|
8917
8949
|
function EntityCardItem({ c }) {
|
|
8918
|
-
const [active, setActive] = (0,
|
|
8950
|
+
const [active, setActive] = (0, import_react64.useState)(0);
|
|
8919
8951
|
const hasBody = c.scopes.length > 0;
|
|
8920
8952
|
if (!hasBody) {
|
|
8921
8953
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "ss-w-ecard ss-w-ecard-bare", "data-kind": c.kind, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CardHeader, { c, showScopeCrest: false }) });
|
|
@@ -8930,7 +8962,7 @@ function EntityCardItem({ c }) {
|
|
|
8930
8962
|
] });
|
|
8931
8963
|
}
|
|
8932
8964
|
function EntityCardList({ cards, disabled, showLessLabel, showMoreLabel }) {
|
|
8933
|
-
const [expanded, setExpanded] = (0,
|
|
8965
|
+
const [expanded, setExpanded] = (0, import_react64.useState)(false);
|
|
8934
8966
|
if (cards.length === 0) return null;
|
|
8935
8967
|
const visible = expanded ? cards : cards.slice(0, MAX_VISIBLE);
|
|
8936
8968
|
const overflow = cards.length - MAX_VISIBLE;
|
|
@@ -9079,20 +9111,20 @@ function BettingInsightList({ insights, ui, slip, monitor }) {
|
|
|
9079
9111
|
}
|
|
9080
9112
|
|
|
9081
9113
|
// src/components/ComboCardList.tsx
|
|
9082
|
-
var
|
|
9114
|
+
var import_react67 = require("react");
|
|
9083
9115
|
|
|
9084
9116
|
// src/components/AddAllToSlipButton.tsx
|
|
9085
|
-
var
|
|
9117
|
+
var import_react65 = require("react");
|
|
9086
9118
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
9087
9119
|
function AddAllToSlipButton({ legs, slip, ui, labels, combo, chatCombo, sizeless, hold, onStartedGame }) {
|
|
9088
9120
|
const add = useSlipAdd(slip, ui);
|
|
9089
9121
|
const slipState = useSlipState();
|
|
9090
9122
|
const log = useEventLog();
|
|
9091
9123
|
const track = useTrack();
|
|
9092
|
-
const [pending, setPending] = (0,
|
|
9093
|
-
const [settledLocal, setSettledLocal] = (0,
|
|
9094
|
-
const [toast, setToast] = (0,
|
|
9095
|
-
const dismiss = (0,
|
|
9124
|
+
const [pending, setPending] = (0, import_react65.useState)(false);
|
|
9125
|
+
const [settledLocal, setSettledLocal] = (0, import_react65.useState)({});
|
|
9126
|
+
const [toast, setToast] = (0, import_react65.useState)(null);
|
|
9127
|
+
const dismiss = (0, import_react65.useCallback)(() => setToast(null), []);
|
|
9096
9128
|
if (!slip.onAddToSlip || legs.length < 2) return null;
|
|
9097
9129
|
const settled = slipState ? slipState.settled : settledLocal;
|
|
9098
9130
|
const open = legs.filter((leg) => !settled[slipKey(leg)]);
|
|
@@ -9165,10 +9197,10 @@ function AddAllToSlipButton({ legs, slip, ui, labels, combo, chatCombo, sizeless
|
|
|
9165
9197
|
}
|
|
9166
9198
|
|
|
9167
9199
|
// src/presetToolsContext.ts
|
|
9168
|
-
var
|
|
9169
|
-
var PresetToolsContext = (0,
|
|
9200
|
+
var import_react66 = require("react");
|
|
9201
|
+
var PresetToolsContext = (0, import_react66.createContext)(null);
|
|
9170
9202
|
function usePresetTools() {
|
|
9171
|
-
return (0,
|
|
9203
|
+
return (0, import_react66.useContext)(PresetToolsContext);
|
|
9172
9204
|
}
|
|
9173
9205
|
|
|
9174
9206
|
// src/components/ComboCardList.tsx
|
|
@@ -9182,7 +9214,7 @@ function ComboLegRow({ leg, addToSlipEnabled, ui, slip, monitor, hold, closed, s
|
|
|
9182
9214
|
const showPin = !!monitor && leg.pinEnabled;
|
|
9183
9215
|
const factText = leg.fact ? (leg.fact.direction === "over" ? ui.presets.legFactOver : ui.presets.legFactUnder)(leg.fact.hits, leg.fact.games) : void 0;
|
|
9184
9216
|
const line = leg.statText ?? factText;
|
|
9185
|
-
const noteId = (0,
|
|
9217
|
+
const noteId = (0, import_react67.useId)();
|
|
9186
9218
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("li", { className: "ss-w-combo-leg", children: [
|
|
9187
9219
|
leg.competition || kickoff || showPin ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "ss-w-combo-leg-meta", children: [
|
|
9188
9220
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "ss-w-bi-comp", children: leg.competition ?? "" }),
|
|
@@ -9806,7 +9838,7 @@ function NbaInsightList({ insights, ui, slip, monitor }) {
|
|
|
9806
9838
|
}
|
|
9807
9839
|
|
|
9808
9840
|
// src/components/NflInsightList.tsx
|
|
9809
|
-
var
|
|
9841
|
+
var import_react68 = require("react");
|
|
9810
9842
|
|
|
9811
9843
|
// src/strings/types.ts
|
|
9812
9844
|
var fillNfl = (template, values) => template.replace(/\{(\w+)\}/g, (whole, key) => key in values ? String(values[key]) : whole);
|
|
@@ -9823,7 +9855,7 @@ function teamImage(vm, abbr) {
|
|
|
9823
9855
|
return void 0;
|
|
9824
9856
|
}
|
|
9825
9857
|
function Badge({ abbr, url }) {
|
|
9826
|
-
const [failed, setFailed] = (0,
|
|
9858
|
+
const [failed, setFailed] = (0, import_react68.useState)(false);
|
|
9827
9859
|
if (url && !failed) {
|
|
9828
9860
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("img", { className: "ss-w-nfl-badge ss-w-nfl-badge--img", src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
9829
9861
|
}
|
|
@@ -10434,7 +10466,7 @@ function TennisInsightList({ insights, ui }) {
|
|
|
10434
10466
|
}
|
|
10435
10467
|
|
|
10436
10468
|
// src/components/CompactOddsList.tsx
|
|
10437
|
-
var
|
|
10469
|
+
var import_react69 = require("react");
|
|
10438
10470
|
var import_widget_sdk23 = require("@sensiblestats/widget-sdk");
|
|
10439
10471
|
|
|
10440
10472
|
// src/compactList.ts
|
|
@@ -10556,11 +10588,11 @@ function Row2({ row, columns, ui, slip, monitor, rowRef }) {
|
|
|
10556
10588
|
] });
|
|
10557
10589
|
}
|
|
10558
10590
|
function CompactOddsList({ list, ui, slip, monitor }) {
|
|
10559
|
-
const [shown2, setShown] = (0,
|
|
10591
|
+
const [shown2, setShown] = (0, import_react69.useState)(COMPACT_PAGE);
|
|
10560
10592
|
const hidden = list.rowCount - shown2;
|
|
10561
|
-
const [focusIndex, setFocusIndex] = (0,
|
|
10562
|
-
const focusRef = (0,
|
|
10563
|
-
(0,
|
|
10593
|
+
const [focusIndex, setFocusIndex] = (0, import_react69.useState)(null);
|
|
10594
|
+
const focusRef = (0, import_react69.useRef)(null);
|
|
10595
|
+
(0, import_react69.useEffect)(() => {
|
|
10564
10596
|
if (focusIndex !== null) focusRef.current?.focus();
|
|
10565
10597
|
}, [focusIndex]);
|
|
10566
10598
|
let left = shown2;
|
|
@@ -10832,7 +10864,7 @@ function FixtureCard({ card, ui }) {
|
|
|
10832
10864
|
}
|
|
10833
10865
|
|
|
10834
10866
|
// src/components/dashboard/CountdownCard.tsx
|
|
10835
|
-
var
|
|
10867
|
+
var import_react70 = require("react");
|
|
10836
10868
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
10837
10869
|
var DAY_MS3 = 864e5;
|
|
10838
10870
|
function remainingSegments(kickoffUnix, nowMs, withSeconds) {
|
|
@@ -10851,12 +10883,12 @@ function remainingSegments(kickoffUnix, nowMs, withSeconds) {
|
|
|
10851
10883
|
function CountdownCard({ card, ui }) {
|
|
10852
10884
|
const { data } = card;
|
|
10853
10885
|
const unitLabel = { d: data.daysUnit, h: data.hoursUnit, m: data.minutesUnit, s: data.secondsUnit };
|
|
10854
|
-
const [nowMs, setNowMs] = (0,
|
|
10855
|
-
const [reduced] = (0,
|
|
10886
|
+
const [nowMs, setNowMs] = (0, import_react70.useState)(() => Date.now());
|
|
10887
|
+
const [reduced] = (0, import_react70.useState)(
|
|
10856
10888
|
() => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
|
10857
10889
|
);
|
|
10858
10890
|
const withinDay = data.kickoffUnix * 1e3 - nowMs < DAY_MS3;
|
|
10859
|
-
(0,
|
|
10891
|
+
(0, import_react70.useEffect)(() => {
|
|
10860
10892
|
if (reduced) return;
|
|
10861
10893
|
const id = window.setInterval(() => setNowMs(Date.now()), withinDay ? 1e3 : 6e4);
|
|
10862
10894
|
return () => window.clearInterval(id);
|
|
@@ -10864,7 +10896,7 @@ function CountdownCard({ card, ui }) {
|
|
|
10864
10896
|
const segments = remainingSegments(data.kickoffUnix, nowMs, withinDay && !reduced);
|
|
10865
10897
|
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "ss-w-fandash-card ss-w-fandash-countdown", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "ss-w-fandash-countdown-top", children: [
|
|
10866
10898
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "ss-w-fandash-eyebrow", children: card.title ?? ui.countdownTitle }),
|
|
10867
|
-
segments ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "ss-w-fandash-countdown-clock", children: segments.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
10899
|
+
segments ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "ss-w-fandash-countdown-clock", children: segments.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_react70.Fragment, { children: [
|
|
10868
10900
|
i > 0 ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "ss-w-fandash-countdown-colon", children: ":" }) : null,
|
|
10869
10901
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "ss-w-fandash-countdown-seg", children: [
|
|
10870
10902
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "ss-w-fandash-countdown-value", children: s.value }),
|
|
@@ -10875,7 +10907,7 @@ function CountdownCard({ card, ui }) {
|
|
|
10875
10907
|
}
|
|
10876
10908
|
|
|
10877
10909
|
// src/components/dashboard/InjuriesCard.tsx
|
|
10878
|
-
var
|
|
10910
|
+
var import_react71 = require("react");
|
|
10879
10911
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
10880
10912
|
var SHOWN = 3;
|
|
10881
10913
|
function ColHead({ name, crestUrl }) {
|
|
@@ -10898,7 +10930,7 @@ function InjuryList({ rows, emptyLabel, limit }) {
|
|
|
10898
10930
|
}
|
|
10899
10931
|
function InjuriesCard({ card, ui }) {
|
|
10900
10932
|
const { data } = card;
|
|
10901
|
-
const [expanded, setExpanded] = (0,
|
|
10933
|
+
const [expanded, setExpanded] = (0, import_react71.useState)(false);
|
|
10902
10934
|
const hidden = Math.max(0, data.ours.length - SHOWN) + Math.max(0, data.theirs.length - SHOWN);
|
|
10903
10935
|
const limit = expanded ? void 0 : SHOWN;
|
|
10904
10936
|
const { showMore, showLess } = ui;
|
|
@@ -11003,7 +11035,7 @@ function LinksCard({ card }) {
|
|
|
11003
11035
|
}
|
|
11004
11036
|
|
|
11005
11037
|
// src/components/dashboard/PostMatchResultCard.tsx
|
|
11006
|
-
var
|
|
11038
|
+
var import_react72 = require("react");
|
|
11007
11039
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
11008
11040
|
function initials3(name) {
|
|
11009
11041
|
return name.trim().slice(0, 3).toUpperCase();
|
|
@@ -11013,7 +11045,7 @@ function PostMatchCrest({
|
|
|
11013
11045
|
name,
|
|
11014
11046
|
side
|
|
11015
11047
|
}) {
|
|
11016
|
-
const [failed, setFailed] = (0,
|
|
11048
|
+
const [failed, setFailed] = (0, import_react72.useState)(false);
|
|
11017
11049
|
const cls = `ss-w-fandash-postmatch-crest ss-w-fandash-postmatch-crest--${side}`;
|
|
11018
11050
|
if (url && !failed) {
|
|
11019
11051
|
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -11212,10 +11244,10 @@ function RestingFormCard({ card }) {
|
|
|
11212
11244
|
}
|
|
11213
11245
|
|
|
11214
11246
|
// src/components/dashboard/LiveScoreCard.tsx
|
|
11215
|
-
var
|
|
11247
|
+
var import_react74 = require("react");
|
|
11216
11248
|
|
|
11217
11249
|
// src/useLiveClock.ts
|
|
11218
|
-
var
|
|
11250
|
+
var import_react73 = require("react");
|
|
11219
11251
|
var TICK_MS = 6e4;
|
|
11220
11252
|
var MAX_LIVE_TICK_MINUTES = 15;
|
|
11221
11253
|
function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
|
|
@@ -11224,10 +11256,10 @@ function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
|
|
|
11224
11256
|
return minute + Math.min(Math.max(0, elapsedMinutes), MAX_LIVE_TICK_MINUTES);
|
|
11225
11257
|
}
|
|
11226
11258
|
function useLiveClock(minute, clockRunning, receivedAtMs) {
|
|
11227
|
-
const [displayMinute, setDisplayMinute] = (0,
|
|
11259
|
+
const [displayMinute, setDisplayMinute] = (0, import_react73.useState)(
|
|
11228
11260
|
() => computeDisplayMinute(minute, clockRunning, receivedAtMs)
|
|
11229
11261
|
);
|
|
11230
|
-
(0,
|
|
11262
|
+
(0, import_react73.useEffect)(() => {
|
|
11231
11263
|
setDisplayMinute(computeDisplayMinute(minute, clockRunning, receivedAtMs));
|
|
11232
11264
|
if (!clockRunning) return;
|
|
11233
11265
|
const id = window.setInterval(() => {
|
|
@@ -11244,7 +11276,7 @@ function initials5(name) {
|
|
|
11244
11276
|
return name.trim().slice(0, 3).toUpperCase();
|
|
11245
11277
|
}
|
|
11246
11278
|
function LiveCrest({ url, name, side }) {
|
|
11247
|
-
const [failed, setFailed] = (0,
|
|
11279
|
+
const [failed, setFailed] = (0, import_react74.useState)(false);
|
|
11248
11280
|
const cls = `ss-w-fandash-live-crest ss-w-fandash-live-crest--${side}`;
|
|
11249
11281
|
if (url && !failed) {
|
|
11250
11282
|
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -11266,7 +11298,7 @@ function LiveScoreCard({
|
|
|
11266
11298
|
}) {
|
|
11267
11299
|
const { data } = card;
|
|
11268
11300
|
const seedKey = `${data.minute}:${data.homeScore}:${data.awayScore}`;
|
|
11269
|
-
const seedRef = (0,
|
|
11301
|
+
const seedRef = (0, import_react74.useRef)(null);
|
|
11270
11302
|
if (!seedRef.current || seedRef.current.key !== seedKey) {
|
|
11271
11303
|
seedRef.current = { key: seedKey, receivedAtMs: Date.now() };
|
|
11272
11304
|
}
|
|
@@ -11312,7 +11344,7 @@ function LiveScoreCard({
|
|
|
11312
11344
|
}
|
|
11313
11345
|
|
|
11314
11346
|
// src/components/dashboard/LiveTimelineCard.tsx
|
|
11315
|
-
var
|
|
11347
|
+
var import_react75 = require("react");
|
|
11316
11348
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
11317
11349
|
var SHOWN2 = 3;
|
|
11318
11350
|
function EventIcon({ type }) {
|
|
@@ -11354,7 +11386,7 @@ function EventRow({ e }) {
|
|
|
11354
11386
|
] });
|
|
11355
11387
|
}
|
|
11356
11388
|
function LiveTimelineCard({ card, ui }) {
|
|
11357
|
-
const [expanded, setExpanded] = (0,
|
|
11389
|
+
const [expanded, setExpanded] = (0, import_react75.useState)(false);
|
|
11358
11390
|
const events = card.data.events;
|
|
11359
11391
|
if (!events || events.length === 0) return null;
|
|
11360
11392
|
const sorted2 = [...events].sort((a, b) => b.minute - a.minute);
|
|
@@ -11378,7 +11410,7 @@ function LiveTimelineCard({ card, ui }) {
|
|
|
11378
11410
|
}
|
|
11379
11411
|
|
|
11380
11412
|
// src/components/dashboard/MomentumWave.tsx
|
|
11381
|
-
var
|
|
11413
|
+
var import_react76 = require("react");
|
|
11382
11414
|
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
11383
11415
|
var WIDTH = 270;
|
|
11384
11416
|
var HEIGHT = 56;
|
|
@@ -11403,7 +11435,7 @@ function MomentumWave({
|
|
|
11403
11435
|
}) {
|
|
11404
11436
|
if (points.length === 0) return null;
|
|
11405
11437
|
const { area, line, lastLeftPct, lastTopPx } = buildPaths(points);
|
|
11406
|
-
const clipId = (0,
|
|
11438
|
+
const clipId = (0, import_react76.useId)();
|
|
11407
11439
|
const topClipId = `${clipId}-top`;
|
|
11408
11440
|
const bottomClipId = `${clipId}-bottom`;
|
|
11409
11441
|
const topClass = clubIsHome ? "ss-w-fandash-live-mom-home" : "ss-w-fandash-live-mom-away";
|
|
@@ -11553,7 +11585,7 @@ function FanDashboardCard({ card, onTap, ui, goalEvents }) {
|
|
|
11553
11585
|
// src/components/ChatMessage.tsx
|
|
11554
11586
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
11555
11587
|
function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor, onGreetingSport }) {
|
|
11556
|
-
const [sport, setSport] = (0,
|
|
11588
|
+
const [sport, setSport] = (0, import_react77.useState)(null);
|
|
11557
11589
|
if (message.role === "user") {
|
|
11558
11590
|
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "ss-w-msg ss-w-user", "data-msg-id": message.id, children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "ss-w-bubble", children: message.text }) });
|
|
11559
11591
|
}
|
|
@@ -11612,11 +11644,11 @@ function turnAnchor(messages) {
|
|
|
11612
11644
|
function MessageList({ controller, ui, slip, onDashboardTap, monitor, onGreetingSport }) {
|
|
11613
11645
|
const { state, send } = controller;
|
|
11614
11646
|
const { oddsFormat } = useOddsSettings();
|
|
11615
|
-
const listRef = (0,
|
|
11616
|
-
const endRef = (0,
|
|
11617
|
-
const pinnedRef = (0,
|
|
11618
|
-
const anchoredTurnRef = (0,
|
|
11619
|
-
(0,
|
|
11647
|
+
const listRef = (0, import_react78.useRef)(null);
|
|
11648
|
+
const endRef = (0, import_react78.useRef)(null);
|
|
11649
|
+
const pinnedRef = (0, import_react78.useRef)(true);
|
|
11650
|
+
const anchoredTurnRef = (0, import_react78.useRef)(null);
|
|
11651
|
+
(0, import_react78.useEffect)(() => {
|
|
11620
11652
|
const anchor = turnAnchor(state.messages);
|
|
11621
11653
|
const list = listRef.current;
|
|
11622
11654
|
if (anchor && anchor.turnId !== anchoredTurnRef.current) {
|
|
@@ -11675,13 +11707,13 @@ function MessageList({ controller, ui, slip, onDashboardTap, monitor, onGreeting
|
|
|
11675
11707
|
}
|
|
11676
11708
|
|
|
11677
11709
|
// src/components/ChatInput.tsx
|
|
11678
|
-
var
|
|
11710
|
+
var import_react79 = require("react");
|
|
11679
11711
|
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
11680
|
-
var ChatInput = (0,
|
|
11681
|
-
const [value, setValue] = (0,
|
|
11682
|
-
const textareaRef = (0,
|
|
11683
|
-
const stopRef = (0,
|
|
11684
|
-
const textBoxWantsFocusRef = (0,
|
|
11712
|
+
var ChatInput = (0, import_react79.forwardRef)(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel, sendLabel, disabled = false }, ref) {
|
|
11713
|
+
const [value, setValue] = (0, import_react79.useState)("");
|
|
11714
|
+
const textareaRef = (0, import_react79.useRef)(null);
|
|
11715
|
+
const stopRef = (0, import_react79.useRef)(null);
|
|
11716
|
+
const textBoxWantsFocusRef = (0, import_react79.useRef)(false);
|
|
11685
11717
|
const submit = () => {
|
|
11686
11718
|
if (disabled) return;
|
|
11687
11719
|
const t = value.trim();
|
|
@@ -11695,7 +11727,7 @@ var ChatInput = (0, import_react78.forwardRef)(function ChatInput2({ placeholder
|
|
|
11695
11727
|
submit();
|
|
11696
11728
|
}
|
|
11697
11729
|
};
|
|
11698
|
-
(0,
|
|
11730
|
+
(0, import_react79.useImperativeHandle)(ref, () => ({
|
|
11699
11731
|
focus() {
|
|
11700
11732
|
const box = textareaRef.current;
|
|
11701
11733
|
if (box && !box.disabled) {
|
|
@@ -11707,7 +11739,7 @@ var ChatInput = (0, import_react78.forwardRef)(function ChatInput2({ placeholder
|
|
|
11707
11739
|
stopRef.current?.focus();
|
|
11708
11740
|
}
|
|
11709
11741
|
}), []);
|
|
11710
|
-
(0,
|
|
11742
|
+
(0, import_react79.useEffect)(() => {
|
|
11711
11743
|
if (streaming || disabled || !textBoxWantsFocusRef.current) return;
|
|
11712
11744
|
textBoxWantsFocusRef.current = false;
|
|
11713
11745
|
const box = textareaRef.current;
|
|
@@ -11738,7 +11770,7 @@ var ChatInput = (0, import_react78.forwardRef)(function ChatInput2({ placeholder
|
|
|
11738
11770
|
});
|
|
11739
11771
|
|
|
11740
11772
|
// src/components/TabBar.tsx
|
|
11741
|
-
var
|
|
11773
|
+
var import_react80 = require("react");
|
|
11742
11774
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
11743
11775
|
var TIGHT_LEVELS = [0, 1, 2, 3, 4, 5, 6, 7];
|
|
11744
11776
|
var FOCUS_EDGE = 24;
|
|
@@ -11761,16 +11793,16 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
11761
11793
|
...gamesEnabled ? [{ tab: "games", label: ui.tabGames, count: 0, dot: false }] : []
|
|
11762
11794
|
];
|
|
11763
11795
|
const track = useTrack();
|
|
11764
|
-
const listRef = (0,
|
|
11796
|
+
const listRef = (0, import_react80.useRef)(null);
|
|
11765
11797
|
const activeTab = monitor.activeTab;
|
|
11766
|
-
(0,
|
|
11798
|
+
(0, import_react80.useEffect)(() => {
|
|
11767
11799
|
const el = listRef.current?.querySelector("[data-on]");
|
|
11768
11800
|
if (!el || typeof el.scrollIntoView !== "function") return;
|
|
11769
11801
|
const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
11770
11802
|
el.scrollIntoView({ block: "nearest", inline: "nearest", behavior: reduce ? "auto" : "smooth" });
|
|
11771
11803
|
}, [activeTab]);
|
|
11772
11804
|
const labelSignature = tabs.map((t) => `${t.tab}:${t.label}:${t.count}`).join("|");
|
|
11773
|
-
(0,
|
|
11805
|
+
(0, import_react80.useLayoutEffect)(() => {
|
|
11774
11806
|
const strip = listRef.current;
|
|
11775
11807
|
if (!strip) return;
|
|
11776
11808
|
const measure = () => {
|
|
@@ -11794,7 +11826,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
11794
11826
|
fonts?.removeEventListener?.("loadingdone", measure);
|
|
11795
11827
|
};
|
|
11796
11828
|
}, [labelSignature]);
|
|
11797
|
-
const pointerDown = (0,
|
|
11829
|
+
const pointerDown = (0, import_react80.useRef)(false);
|
|
11798
11830
|
const keepFocusedTabInView = (e) => {
|
|
11799
11831
|
const strip = e.currentTarget;
|
|
11800
11832
|
const tab = e.target;
|
|
@@ -11854,7 +11886,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
11854
11886
|
}
|
|
11855
11887
|
|
|
11856
11888
|
// src/components/MonitorTabs.tsx
|
|
11857
|
-
var
|
|
11889
|
+
var import_react93 = require("react");
|
|
11858
11890
|
|
|
11859
11891
|
// src/components/MarketAccordion.tsx
|
|
11860
11892
|
var import_widget_sdk24 = require("@sensiblestats/widget-sdk");
|
|
@@ -11916,7 +11948,7 @@ function MarketAccordion({ match, monitor, ui, slip }) {
|
|
|
11916
11948
|
}
|
|
11917
11949
|
|
|
11918
11950
|
// src/components/MonitorFormH2H.tsx
|
|
11919
|
-
var
|
|
11951
|
+
var import_react81 = require("react");
|
|
11920
11952
|
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
11921
11953
|
function resultClass2(result) {
|
|
11922
11954
|
if (result === "W") return "ss-w-h2h-result--win";
|
|
@@ -11932,7 +11964,7 @@ function FormDots({ form, ui }) {
|
|
|
11932
11964
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "ss-w-h2h-dots", children: form.map((m, i) => /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { className: `ss-w-h2h-result ${resultClass2(m.result)}`, children: resultLabel(m.result, ui) }, i)) });
|
|
11933
11965
|
}
|
|
11934
11966
|
function MonitorFormH2H({ formAndH2H, homeTeamName, awayTeamName, ui }) {
|
|
11935
|
-
const [expanded, setExpanded] = (0,
|
|
11967
|
+
const [expanded, setExpanded] = (0, import_react81.useState)(false);
|
|
11936
11968
|
const { homeForm, awayForm, h2h, homeShortCode, awayShortCode } = formAndH2H;
|
|
11937
11969
|
if (homeForm.length === 0 && awayForm.length === 0 && !h2h) {
|
|
11938
11970
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_jsx_runtime81.Fragment, {});
|
|
@@ -12010,10 +12042,10 @@ function MonitorFormH2H({ formAndH2H, homeTeamName, awayTeamName, ui }) {
|
|
|
12010
12042
|
}
|
|
12011
12043
|
|
|
12012
12044
|
// src/components/CompLogo.tsx
|
|
12013
|
-
var
|
|
12045
|
+
var import_react82 = require("react");
|
|
12014
12046
|
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
12015
12047
|
function CompLogo({ url }) {
|
|
12016
|
-
const [failed, setFailed] = (0,
|
|
12048
|
+
const [failed, setFailed] = (0, import_react82.useState)(null);
|
|
12017
12049
|
if (!url || failed === url) return null;
|
|
12018
12050
|
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("img", { className: "ss-w-mon-comp-logo", src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(url) });
|
|
12019
12051
|
}
|
|
@@ -12171,7 +12203,7 @@ function MonitorSkeleton({ pin, monitor, ui }) {
|
|
|
12171
12203
|
}
|
|
12172
12204
|
|
|
12173
12205
|
// src/components/NbaMonitorCard.tsx
|
|
12174
|
-
var
|
|
12206
|
+
var import_react86 = require("react");
|
|
12175
12207
|
|
|
12176
12208
|
// src/sportLabel.ts
|
|
12177
12209
|
var CODE = { football: "football", basketball: "nba", nba: "nba", americanfootball: "nfl", nfl: "nfl", tennis: "tennis" };
|
|
@@ -12181,7 +12213,7 @@ var sportLabel = (ui, sport) => {
|
|
|
12181
12213
|
};
|
|
12182
12214
|
|
|
12183
12215
|
// src/components/NbaFormSection.tsx
|
|
12184
|
-
var
|
|
12216
|
+
var import_react83 = require("react");
|
|
12185
12217
|
|
|
12186
12218
|
// src/components/NbaFormRest.tsx
|
|
12187
12219
|
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
@@ -12281,8 +12313,8 @@ function Row3({ game, abbr, tonight, ui }) {
|
|
|
12281
12313
|
] });
|
|
12282
12314
|
}
|
|
12283
12315
|
function NbaFormSection({ match, monitor, ui }) {
|
|
12284
|
-
const [open, setOpen] = (0,
|
|
12285
|
-
const [side, setSide] = (0,
|
|
12316
|
+
const [open, setOpen] = (0, import_react83.useState)(false);
|
|
12317
|
+
const [side, setSide] = (0, import_react83.useState)("away");
|
|
12286
12318
|
const form = useNbaForm(match, monitor);
|
|
12287
12319
|
const b = match.basketball;
|
|
12288
12320
|
if (!form || !b || !form.home && !form.away) return null;
|
|
@@ -12327,10 +12359,10 @@ function NbaFormSection({ match, monitor, ui }) {
|
|
|
12327
12359
|
}
|
|
12328
12360
|
|
|
12329
12361
|
// src/components/NbaPropsSection.tsx
|
|
12330
|
-
var
|
|
12362
|
+
var import_react85 = require("react");
|
|
12331
12363
|
|
|
12332
12364
|
// src/components/PropsPieces.tsx
|
|
12333
|
-
var
|
|
12365
|
+
var import_react84 = require("react");
|
|
12334
12366
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
12335
12367
|
var livePlayer = (bundle, p) => bundle.live === true || !p.live && !p.nflLive ? p : { ...p, live: null, nflLive: null };
|
|
12336
12368
|
var hasLiveLine = (p) => p.live != null || p.nflLive != null;
|
|
@@ -12343,9 +12375,9 @@ function preKickoff(match) {
|
|
|
12343
12375
|
return Number.isFinite(kickoff) && Date.now() < kickoff;
|
|
12344
12376
|
}
|
|
12345
12377
|
function usePreKickoff(match) {
|
|
12346
|
-
const [, setTick] = (0,
|
|
12378
|
+
const [, setTick] = (0, import_react84.useState)(0);
|
|
12347
12379
|
const pre = preKickoff(match);
|
|
12348
|
-
(0,
|
|
12380
|
+
(0, import_react84.useEffect)(() => {
|
|
12349
12381
|
if (!pre || !match.kickoffUtc) return;
|
|
12350
12382
|
const wait = Math.min(Math.max(Date.parse(match.kickoffUtc) - Date.now(), 0), MAX_TIMER_MS);
|
|
12351
12383
|
const id = setTimeout(() => setTick((t) => t + 1), wait);
|
|
@@ -12359,7 +12391,7 @@ function usePropsOpen(match, monitor, descriptor) {
|
|
|
12359
12391
|
const pre = descriptor.sport === "basketball" ? match.phase === "preMatch" : beforeKickoff;
|
|
12360
12392
|
const live = match.phase === "live";
|
|
12361
12393
|
const open = pre || live;
|
|
12362
|
-
(0,
|
|
12394
|
+
(0, import_react84.useEffect)(() => {
|
|
12363
12395
|
if (!open) return;
|
|
12364
12396
|
if (sport) monitor.loadPlayerProps?.(match.matchId, sport);
|
|
12365
12397
|
else monitor.loadPlayerProps?.(match.matchId);
|
|
@@ -12437,7 +12469,7 @@ function PropBars({ bars, line, title, wide, ui, note }) {
|
|
|
12437
12469
|
function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
|
|
12438
12470
|
const player = livePlayer(bundle, given);
|
|
12439
12471
|
const stats = descriptor.stats.map((k) => player.stats.find((s) => s.stat === k)).filter((s) => s != null);
|
|
12440
|
-
const [picked, setPicked] = (0,
|
|
12472
|
+
const [picked, setPicked] = (0, import_react84.useState)(null);
|
|
12441
12473
|
const active = stats.find((s) => s.stat === picked) ?? stats[0];
|
|
12442
12474
|
const sample = active?.games?.length ?? 0;
|
|
12443
12475
|
const hitsOf = (price, text2) => descriptor.showHits && sample > 0 && price.hits != null ? text2(price.hits) : null;
|
|
@@ -12486,8 +12518,8 @@ function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
|
|
|
12486
12518
|
] });
|
|
12487
12519
|
}
|
|
12488
12520
|
function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
12489
|
-
const [openId, setOpenId] = (0,
|
|
12490
|
-
const [brokenShots, setBrokenShots] = (0,
|
|
12521
|
+
const [openId, setOpenId] = (0, import_react84.useState)(null);
|
|
12522
|
+
const [brokenShots, setBrokenShots] = (0, import_react84.useState)(/* @__PURE__ */ new Set());
|
|
12491
12523
|
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "ss-w-props-list", children: players.map((given) => {
|
|
12492
12524
|
const p = livePlayer(bundle, given);
|
|
12493
12525
|
const isOpen = openId === p.playerId;
|
|
@@ -12533,12 +12565,12 @@ function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
|
12533
12565
|
}
|
|
12534
12566
|
var BOX_QUIET_MS = 12e4;
|
|
12535
12567
|
function StatsClock({ boxAsOfUtc, match, live, atBreak: atBreak2, ago, ui }) {
|
|
12536
|
-
const [tick, setTick] = (0,
|
|
12568
|
+
const [tick, setTick] = (0, import_react84.useState)(0);
|
|
12537
12569
|
const time = clock2(boxAsOfUtc, ui);
|
|
12538
12570
|
const at2 = time === "" ? Number.NaN : Date.parse(boxAsOfUtc);
|
|
12539
12571
|
const valid = !Number.isNaN(at2);
|
|
12540
12572
|
const onBreak = atBreak(match);
|
|
12541
|
-
(0,
|
|
12573
|
+
(0, import_react84.useEffect)(() => {
|
|
12542
12574
|
if (!valid || onBreak) return;
|
|
12543
12575
|
const age2 = Date.now() - at2;
|
|
12544
12576
|
const wait = age2 < BOX_QUIET_MS ? BOX_QUIET_MS - age2 : 6e4 - age2 % 6e4;
|
|
@@ -12599,12 +12631,12 @@ var nbaDescriptor = (ui, match) => ({
|
|
|
12599
12631
|
tenGameBars: false
|
|
12600
12632
|
});
|
|
12601
12633
|
function StatsClock2({ bundle, match, ui }) {
|
|
12602
|
-
const [tick, setTick] = (0,
|
|
12634
|
+
const [tick, setTick] = (0, import_react85.useState)(0);
|
|
12603
12635
|
const at2 = bundle.live === true && bundle.boxAsOfUtc ? Date.parse(bundle.boxAsOfUtc) : Number.NaN;
|
|
12604
12636
|
const time = clock2(bundle.boxAsOfUtc, ui);
|
|
12605
12637
|
const valid = !Number.isNaN(at2) && time !== "";
|
|
12606
12638
|
const onBreak = atBreak(match);
|
|
12607
|
-
(0,
|
|
12639
|
+
(0, import_react85.useEffect)(() => {
|
|
12608
12640
|
if (!valid || onBreak) return;
|
|
12609
12641
|
const age2 = Date.now() - at2;
|
|
12610
12642
|
const wait = age2 < BOX_QUIET_MS2 ? BOX_QUIET_MS2 - age2 : 6e4 - age2 % 6e4;
|
|
@@ -12618,7 +12650,7 @@ function StatsClock2({ bundle, match, ui }) {
|
|
|
12618
12650
|
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "ss-w-props-asof ss-w-props-asof--live", children: ui.nba.propsStatsLive(time) });
|
|
12619
12651
|
}
|
|
12620
12652
|
function NbaPropsSection({ match, monitor, ui, slip }) {
|
|
12621
|
-
const [side, setSide] = (0,
|
|
12653
|
+
const [side, setSide] = (0, import_react85.useState)("home");
|
|
12622
12654
|
const descriptor = nbaDescriptor(ui, match);
|
|
12623
12655
|
const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
|
|
12624
12656
|
if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
|
|
@@ -12656,7 +12688,7 @@ function city(teamName, nickname) {
|
|
|
12656
12688
|
return name.slice(0, name.length - nickname.length).trim() || null;
|
|
12657
12689
|
}
|
|
12658
12690
|
function BadgeCrest({ url, abbreviation }) {
|
|
12659
|
-
const [failed, setFailed] = (0,
|
|
12691
|
+
const [failed, setFailed] = (0, import_react86.useState)(false);
|
|
12660
12692
|
if (url && !failed) {
|
|
12661
12693
|
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("img", { className: "ss-w-nbamon-badge ss-w-nbamon-badge--img", src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
12662
12694
|
}
|
|
@@ -12791,7 +12823,7 @@ function NbaMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
|
12791
12823
|
}
|
|
12792
12824
|
|
|
12793
12825
|
// src/components/NflFormSection.tsx
|
|
12794
|
-
var
|
|
12826
|
+
var import_react87 = require("react");
|
|
12795
12827
|
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
12796
12828
|
var outcomeOf = (g) => g.teamScore > g.opponentScore ? "win" : g.teamScore < g.opponentScore ? "loss" : "tie";
|
|
12797
12829
|
var signedSpread2 = (v) => v > 0 ? `+${v}` : String(v);
|
|
@@ -12844,7 +12876,7 @@ function H2hRow({ game, home, ui }) {
|
|
|
12844
12876
|
] });
|
|
12845
12877
|
}
|
|
12846
12878
|
function NflFormSection({ match, monitor, ui }) {
|
|
12847
|
-
const [segment, setSegment] = (0,
|
|
12879
|
+
const [segment, setSegment] = (0, import_react87.useState)("away");
|
|
12848
12880
|
const { live, open } = usePropsOpen(match, monitor, { sport: "americanfootball" });
|
|
12849
12881
|
const bundle = monitor.playerProps?.[monitorMatchKey("americanfootball", match.matchId)]?.bundle;
|
|
12850
12882
|
const form = bundle?.form;
|
|
@@ -12877,7 +12909,7 @@ function NflFormSection({ match, monitor, ui }) {
|
|
|
12877
12909
|
}
|
|
12878
12910
|
|
|
12879
12911
|
// src/components/NflPropsSection.tsx
|
|
12880
|
-
var
|
|
12912
|
+
var import_react88 = require("react");
|
|
12881
12913
|
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
12882
12914
|
var TRENDS_SHOWN = 3;
|
|
12883
12915
|
var SCORERS_SHOWN = 8;
|
|
@@ -12950,7 +12982,7 @@ function ShowMore({ label, onClick }) {
|
|
|
12950
12982
|
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("button", { type: "button", className: "ss-w-props-more", onClick, children: label });
|
|
12951
12983
|
}
|
|
12952
12984
|
function Trends({ bundle, facts, descriptor, ui, slip }) {
|
|
12953
|
-
const [all, setAll] = (0,
|
|
12985
|
+
const [all, setAll] = (0, import_react88.useState)(false);
|
|
12954
12986
|
const shown2 = all ? facts : facts.slice(0, TRENDS_SHOWN);
|
|
12955
12987
|
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("section", { className: "ss-w-props ss-w-props-trends", lang: ui.locale, children: [
|
|
12956
12988
|
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "ss-w-props-head", children: ui.nfl.propsTrends }),
|
|
@@ -12983,7 +13015,7 @@ function Trends({ bundle, facts, descriptor, ui, slip }) {
|
|
|
12983
13015
|
] });
|
|
12984
13016
|
}
|
|
12985
13017
|
function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
12986
|
-
const [all, setAll] = (0,
|
|
13018
|
+
const [all, setAll] = (0, import_react88.useState)(false);
|
|
12987
13019
|
const shown2 = all ? scorers : scorers.slice(0, SCORERS_SHOWN);
|
|
12988
13020
|
const cell2 = (name, column, price, stat) => price && stat ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(PropPrice, { price, label: "", ariaName: `${name}, ${column}`, player: name, stat, bundle, descriptor, ui, slip }) : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "ss-w-props-scorer-none", children: "\u2014" });
|
|
12989
13021
|
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "ss-w-props-scorers", children: [
|
|
@@ -13013,7 +13045,7 @@ function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
|
13013
13045
|
] });
|
|
13014
13046
|
}
|
|
13015
13047
|
function NflPropsSection({ match, monitor, ui, slip }) {
|
|
13016
|
-
const [tab, setTab] = (0,
|
|
13048
|
+
const [tab, setTab] = (0, import_react88.useState)(null);
|
|
13017
13049
|
const descriptor = nflDescriptor(ui);
|
|
13018
13050
|
const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
|
|
13019
13051
|
if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
|
|
@@ -13213,14 +13245,14 @@ function NflMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
|
13213
13245
|
}
|
|
13214
13246
|
|
|
13215
13247
|
// src/components/TennisMonitorCard.tsx
|
|
13216
|
-
var
|
|
13248
|
+
var import_react91 = require("react");
|
|
13217
13249
|
var import_widget_sdk27 = require("@sensiblestats/widget-sdk");
|
|
13218
13250
|
|
|
13219
13251
|
// src/components/TennisFixtureRow.tsx
|
|
13220
13252
|
var import_widget_sdk26 = require("@sensiblestats/widget-sdk");
|
|
13221
13253
|
|
|
13222
13254
|
// src/components/FixtureRow.tsx
|
|
13223
|
-
var
|
|
13255
|
+
var import_react89 = require("react");
|
|
13224
13256
|
var import_widget_sdk25 = require("@sensiblestats/widget-sdk");
|
|
13225
13257
|
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
13226
13258
|
function splitAtFirstSpace(label) {
|
|
@@ -13234,7 +13266,7 @@ function kickoffLabel(kickoffUnix, tag2, clock3, timeZone) {
|
|
|
13234
13266
|
return formatTime(kickoffUnix * 1e3, tag2, clock3, { timeZone });
|
|
13235
13267
|
}
|
|
13236
13268
|
function Side2({ name, crest, abbr, away = false }) {
|
|
13237
|
-
const [failed, setFailed] = (0,
|
|
13269
|
+
const [failed, setFailed] = (0, import_react89.useState)(false);
|
|
13238
13270
|
return /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("span", { className: away ? "ss-w-drow-side ss-w-drow-side--away" : "ss-w-drow-side", children: [
|
|
13239
13271
|
crest && !failed ? /* @__PURE__ */ (0, import_jsx_runtime95.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_runtime95.jsx)("span", { className: "ss-w-drow-crest ss-w-drow-crest--abbr", children: abbr }) : null,
|
|
13240
13272
|
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: "ss-w-drow-nm", children: name })
|
|
@@ -13476,7 +13508,7 @@ function TennisLiveScoreboard({ t, score, live, ui }) {
|
|
|
13476
13508
|
}
|
|
13477
13509
|
|
|
13478
13510
|
// src/components/TennisStatsTables.tsx
|
|
13479
|
-
var
|
|
13511
|
+
var import_react90 = require("react");
|
|
13480
13512
|
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
13481
13513
|
function formatStat(row, value, locale) {
|
|
13482
13514
|
if (value == null) return "\u2013";
|
|
@@ -13514,8 +13546,8 @@ function Tables({ table, labels, names, locale }) {
|
|
|
13514
13546
|
] });
|
|
13515
13547
|
}
|
|
13516
13548
|
function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey }) {
|
|
13517
|
-
const [tab, setTab] = (0,
|
|
13518
|
-
(0,
|
|
13549
|
+
const [tab, setTab] = (0, import_react90.useState)("match");
|
|
13550
|
+
(0, import_react90.useEffect)(() => {
|
|
13519
13551
|
setTab("match");
|
|
13520
13552
|
}, [resetKey]);
|
|
13521
13553
|
const sets = serveReturn.sets.filter((s) => s.table.serve.length + s.table.return.length > 0);
|
|
@@ -13546,7 +13578,7 @@ function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey })
|
|
|
13546
13578
|
] }),
|
|
13547
13579
|
today.rows.map((r) => {
|
|
13548
13580
|
const f = (v) => formatStat({ kind: "pct" }, v, locale);
|
|
13549
|
-
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(
|
|
13581
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(import_react90.Fragment, { children: [
|
|
13550
13582
|
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { className: "ss-w-ts-l", children: r.label }),
|
|
13551
13583
|
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("span", { className: "ss-w-ts-today-v ss-w-ts-today-v--a", children: [
|
|
13552
13584
|
f(r.p1Today),
|
|
@@ -13681,7 +13713,7 @@ function HeadToHead({ t, ui }) {
|
|
|
13681
13713
|
] });
|
|
13682
13714
|
}
|
|
13683
13715
|
function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
13684
|
-
const lastTables = (0,
|
|
13716
|
+
const lastTables = (0, import_react91.useRef)(null);
|
|
13685
13717
|
const t = match.tennis;
|
|
13686
13718
|
if (!t) return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(UnavailableCard, { match, monitor, ui, sport: "tennis" });
|
|
13687
13719
|
const preMatch = match.phase === "preMatch";
|
|
@@ -13761,7 +13793,7 @@ function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
|
13761
13793
|
}
|
|
13762
13794
|
|
|
13763
13795
|
// src/components/ScoreboardStrip.tsx
|
|
13764
|
-
var
|
|
13796
|
+
var import_react92 = require("react");
|
|
13765
13797
|
var import_widget_sdk28 = require("@sensiblestats/widget-sdk");
|
|
13766
13798
|
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
13767
13799
|
function nbaStatus(m, ui) {
|
|
@@ -13856,8 +13888,8 @@ function rowsFor(m) {
|
|
|
13856
13888
|
];
|
|
13857
13889
|
}
|
|
13858
13890
|
function useStripScroll(selectedKey) {
|
|
13859
|
-
const stripRef = (0,
|
|
13860
|
-
(0,
|
|
13891
|
+
const stripRef = (0, import_react92.useRef)(null);
|
|
13892
|
+
(0, import_react92.useEffect)(() => {
|
|
13861
13893
|
const strip = stripRef.current;
|
|
13862
13894
|
const pressed = strip?.querySelector('[aria-pressed="true"]');
|
|
13863
13895
|
if (!strip || !pressed) return;
|
|
@@ -14031,7 +14063,7 @@ function OddsLiveStrip({ m, ui }) {
|
|
|
14031
14063
|
] });
|
|
14032
14064
|
}
|
|
14033
14065
|
function MatchesPanel({ monitor, ui, slip, onAsk, discovery }) {
|
|
14034
|
-
const seedIndex = (0,
|
|
14066
|
+
const seedIndex = (0, import_react93.useMemo)(() => buildSeedIndex(discovery?.groups ?? []), [discovery?.groups]);
|
|
14035
14067
|
const tiles = orderTiles(
|
|
14036
14068
|
monitor.pins,
|
|
14037
14069
|
monitor.snapshot,
|
|
@@ -14103,7 +14135,7 @@ function TrendsPanel({ monitor, ui, slip }) {
|
|
|
14103
14135
|
}
|
|
14104
14136
|
|
|
14105
14137
|
// src/components/LivePanel.tsx
|
|
14106
|
-
var
|
|
14138
|
+
var import_react96 = require("react");
|
|
14107
14139
|
var import_widget_sdk35 = require("@sensiblestats/widget-sdk");
|
|
14108
14140
|
|
|
14109
14141
|
// src/scheduleView.ts
|
|
@@ -14278,20 +14310,20 @@ function LeagueGroup({ view, open, onToggle, disambiguate, rowCap, onShowAll, on
|
|
|
14278
14310
|
}
|
|
14279
14311
|
|
|
14280
14312
|
// src/components/MatchSheet.tsx
|
|
14281
|
-
var
|
|
14313
|
+
var import_react95 = require("react");
|
|
14282
14314
|
var import_widget_sdk33 = require("@sensiblestats/widget-sdk");
|
|
14283
14315
|
|
|
14284
14316
|
// src/useModalDialog.ts
|
|
14285
|
-
var
|
|
14317
|
+
var import_react94 = require("react");
|
|
14286
14318
|
var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
14287
14319
|
function useModalDialog(onClose, opts = {}) {
|
|
14288
|
-
const dialogRef = (0,
|
|
14289
|
-
const onCloseRef = (0,
|
|
14320
|
+
const dialogRef = (0, import_react94.useRef)(null);
|
|
14321
|
+
const onCloseRef = (0, import_react94.useRef)(onClose);
|
|
14290
14322
|
onCloseRef.current = onClose;
|
|
14291
|
-
const openerRef = (0,
|
|
14323
|
+
const openerRef = (0, import_react94.useRef)(opts.opener);
|
|
14292
14324
|
openerRef.current = opts.opener;
|
|
14293
14325
|
const restore = opts.restoreFocus ?? true;
|
|
14294
|
-
(0,
|
|
14326
|
+
(0, import_react94.useEffect)(() => {
|
|
14295
14327
|
const dialog = dialogRef.current;
|
|
14296
14328
|
const root = dialog?.getRootNode();
|
|
14297
14329
|
const focusedAtMount = root?.activeElement ?? null;
|
|
@@ -14302,7 +14334,7 @@ function useModalDialog(onClose, opts = {}) {
|
|
|
14302
14334
|
if (target instanceof HTMLElement) target.focus({ preventScroll: true });
|
|
14303
14335
|
};
|
|
14304
14336
|
}, []);
|
|
14305
|
-
(0,
|
|
14337
|
+
(0, import_react94.useEffect)(() => {
|
|
14306
14338
|
const onKey = (e) => {
|
|
14307
14339
|
if (e.key !== "Escape") return;
|
|
14308
14340
|
e.stopPropagation();
|
|
@@ -14343,8 +14375,8 @@ function kickoffDate(kickoffUnix, lang, timeZone) {
|
|
|
14343
14375
|
function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose, opener }) {
|
|
14344
14376
|
const { dialogRef, onKeyDown } = useModalDialog(onClose, { opener });
|
|
14345
14377
|
const log = useEventLog();
|
|
14346
|
-
const titleId = (0,
|
|
14347
|
-
const [limitHit, setLimitHit] = (0,
|
|
14378
|
+
const titleId = (0, import_react95.useId)();
|
|
14379
|
+
const [limitHit, setLimitHit] = (0, import_react95.useState)(false);
|
|
14348
14380
|
const pinSport = (0, import_widget_sdk33.slipSportOf)(match.sport);
|
|
14349
14381
|
const tour = pinSport === "tennis" && isKnownTour(match.tour) ? match.tour : void 0;
|
|
14350
14382
|
const followable = pinSport !== "tennis" || tour !== void 0;
|
|
@@ -14445,10 +14477,10 @@ var OPEN_TOP_GROUPS = 2;
|
|
|
14445
14477
|
var QUIET_ROWS = 4;
|
|
14446
14478
|
function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, onLeague, onSeeAll, onAsk }) {
|
|
14447
14479
|
const { groups, states, stale } = discovery;
|
|
14448
|
-
const [mine, setMine] = (0,
|
|
14449
|
-
const [toggled, setToggled] = (0,
|
|
14450
|
-
const [sheet, setSheet] = (0,
|
|
14451
|
-
const pinnedKeys = (0,
|
|
14480
|
+
const [mine, setMine] = (0, import_react96.useState)(false);
|
|
14481
|
+
const [toggled, setToggled] = (0, import_react96.useState)(/* @__PURE__ */ new Map());
|
|
14482
|
+
const [sheet, setSheet] = (0, import_react96.useState)(null);
|
|
14483
|
+
const pinnedKeys = (0, import_react96.useMemo)(
|
|
14452
14484
|
() => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk35.matchKey)(p.sport, p.matchId, p.tour))),
|
|
14453
14485
|
[monitor.pins]
|
|
14454
14486
|
);
|
|
@@ -14554,20 +14586,20 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
|
|
|
14554
14586
|
}
|
|
14555
14587
|
|
|
14556
14588
|
// src/components/ScheduleMatchesPanel.tsx
|
|
14557
|
-
var
|
|
14589
|
+
var import_react100 = require("react");
|
|
14558
14590
|
var import_widget_sdk37 = require("@sensiblestats/widget-sdk");
|
|
14559
14591
|
|
|
14560
14592
|
// src/useTennisRowPrices.ts
|
|
14561
|
-
var
|
|
14593
|
+
var import_react97 = require("react");
|
|
14562
14594
|
var import_widget_sdk36 = require("@sensiblestats/widget-sdk");
|
|
14563
14595
|
var TENNIS_PRICE_POLL_MS = 6e4;
|
|
14564
14596
|
function useTennisRowPrices(a) {
|
|
14565
|
-
const [state, setState] = (0,
|
|
14566
|
-
const getPricesRef = (0,
|
|
14597
|
+
const [state, setState] = (0, import_react97.useState)({ byId: null, stale: false });
|
|
14598
|
+
const getPricesRef = (0, import_react97.useRef)(a.getPrices);
|
|
14567
14599
|
getPricesRef.current = a.getPrices;
|
|
14568
|
-
const latest = (0,
|
|
14600
|
+
const latest = (0, import_react97.useRef)(0);
|
|
14569
14601
|
const idsKey = a.keys.filter((k) => isKnownTour(k.tour)).slice(0, MAX_TENNIS_KEYS).map((k) => `${k.tour}:${k.matchId}`).sort().join(",");
|
|
14570
|
-
(0,
|
|
14602
|
+
(0, import_react97.useEffect)(() => {
|
|
14571
14603
|
if (!a.enabled || idsKey === "") {
|
|
14572
14604
|
latest.current++;
|
|
14573
14605
|
setState((prev) => prev.byId === null && !prev.stale ? prev : { byId: null, stale: false });
|
|
@@ -14605,11 +14637,11 @@ function useTennisRowPrices(a) {
|
|
|
14605
14637
|
}
|
|
14606
14638
|
|
|
14607
14639
|
// src/components/DayStrip.tsx
|
|
14608
|
-
var
|
|
14640
|
+
var import_react98 = require("react");
|
|
14609
14641
|
var import_jsx_runtime109 = require("react/jsx-runtime");
|
|
14610
14642
|
function DayStrip({ chips, selected, onSelect, ui, locale }) {
|
|
14611
|
-
const listRef = (0,
|
|
14612
|
-
(0,
|
|
14643
|
+
const listRef = (0, import_react98.useRef)(null);
|
|
14644
|
+
(0, import_react98.useEffect)(() => {
|
|
14613
14645
|
const el = listRef.current?.querySelector('[aria-pressed="true"]');
|
|
14614
14646
|
if (!el || typeof el.scrollIntoView !== "function") return;
|
|
14615
14647
|
const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
@@ -14638,7 +14670,7 @@ function DayStrip({ chips, selected, onSelect, ui, locale }) {
|
|
|
14638
14670
|
}
|
|
14639
14671
|
|
|
14640
14672
|
// src/components/games/ui/SearchField.tsx
|
|
14641
|
-
var
|
|
14673
|
+
var import_react99 = require("react");
|
|
14642
14674
|
|
|
14643
14675
|
// src/components/games/ui/icons.tsx
|
|
14644
14676
|
var import_jsx_runtime110 = require("react/jsx-runtime");
|
|
@@ -14677,8 +14709,8 @@ var IconFlame = ({ size = 16 }) => svg(size, /* @__PURE__ */ (0, import_jsx_runt
|
|
|
14677
14709
|
// src/components/games/ui/SearchField.tsx
|
|
14678
14710
|
var import_jsx_runtime111 = require("react/jsx-runtime");
|
|
14679
14711
|
function SearchField({ id, label, labelHidden = false, placeholder, value, onChange, disabled, inputRef, onKeyDown, clearLabel }) {
|
|
14680
|
-
const localRef = (0,
|
|
14681
|
-
const setInputRef = (0,
|
|
14712
|
+
const localRef = (0, import_react99.useRef)(null);
|
|
14713
|
+
const setInputRef = (0, import_react99.useCallback)((node) => {
|
|
14682
14714
|
localRef.current = node;
|
|
14683
14715
|
if (typeof inputRef === "function") inputRef(node);
|
|
14684
14716
|
else if (inputRef) inputRef.current = node;
|
|
@@ -14724,18 +14756,18 @@ var TOP_ROW_CAP = 3;
|
|
|
14724
14756
|
var SKELETON_ROWS = 3;
|
|
14725
14757
|
function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport, day, onDay, loaded, onOpenLive, onAsk, locale, getTennisPrices, slip }) {
|
|
14726
14758
|
const { localDate: today, states, stale } = discovery;
|
|
14727
|
-
const searchId = (0,
|
|
14728
|
-
const [query, setQuery] = (0,
|
|
14729
|
-
const [toggled, setToggled] = (0,
|
|
14730
|
-
const [expanded, setExpanded] = (0,
|
|
14731
|
-
const listRef = (0,
|
|
14732
|
-
const [sheet, setSheet] = (0,
|
|
14759
|
+
const searchId = (0, import_react100.useId)();
|
|
14760
|
+
const [query, setQuery] = (0, import_react100.useState)("");
|
|
14761
|
+
const [toggled, setToggled] = (0, import_react100.useState)(/* @__PURE__ */ new Map());
|
|
14762
|
+
const [expanded, setExpanded] = (0, import_react100.useState)(/* @__PURE__ */ new Set());
|
|
14763
|
+
const listRef = (0, import_react100.useRef)(null);
|
|
14764
|
+
const [sheet, setSheet] = (0, import_react100.useState)(null);
|
|
14733
14765
|
const { chips, selected } = loaded;
|
|
14734
|
-
(0,
|
|
14766
|
+
(0, import_react100.useEffect)(() => {
|
|
14735
14767
|
if (selected !== day) onDay(selected);
|
|
14736
14768
|
}, [day, selected, onDay]);
|
|
14737
14769
|
const isToday = selected === today;
|
|
14738
|
-
const pinnedKeys = (0,
|
|
14770
|
+
const pinnedKeys = (0, import_react100.useMemo)(
|
|
14739
14771
|
() => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk37.matchKey)(p.sport, p.matchId, p.tour))),
|
|
14740
14772
|
[monitor.pins]
|
|
14741
14773
|
);
|
|
@@ -14873,7 +14905,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
14873
14905
|
}
|
|
14874
14906
|
|
|
14875
14907
|
// src/components/GamesPanel.tsx
|
|
14876
|
-
var
|
|
14908
|
+
var import_react115 = require("react");
|
|
14877
14909
|
|
|
14878
14910
|
// src/components/GamesLoginWall.tsx
|
|
14879
14911
|
var import_jsx_runtime113 = require("react/jsx-runtime");
|
|
@@ -14882,7 +14914,7 @@ function GamesLoginWall({ ui }) {
|
|
|
14882
14914
|
}
|
|
14883
14915
|
|
|
14884
14916
|
// src/components/GamesHub.tsx
|
|
14885
|
-
var
|
|
14917
|
+
var import_react101 = require("react");
|
|
14886
14918
|
|
|
14887
14919
|
// src/components/games/ui/gameMeta.ts
|
|
14888
14920
|
function prettifyGameId(gameId) {
|
|
@@ -15033,8 +15065,8 @@ function pickHeroGame(games) {
|
|
|
15033
15065
|
}
|
|
15034
15066
|
var tileKey = (g) => `${g.gameId}-${g.gameDay}-${g.fixtureId}`;
|
|
15035
15067
|
function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
15036
|
-
const [, setTick] = (0,
|
|
15037
|
-
(0,
|
|
15068
|
+
const [, setTick] = (0, import_react101.useState)(0);
|
|
15069
|
+
(0, import_react101.useEffect)(() => {
|
|
15038
15070
|
const id = setInterval(() => setTick((t) => t + 1), 6e4);
|
|
15039
15071
|
return () => clearInterval(id);
|
|
15040
15072
|
}, []);
|
|
@@ -15094,10 +15126,10 @@ function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
|
15094
15126
|
}
|
|
15095
15127
|
|
|
15096
15128
|
// src/components/GameScreenHost.tsx
|
|
15097
|
-
var
|
|
15129
|
+
var import_react113 = require("react");
|
|
15098
15130
|
|
|
15099
15131
|
// src/useGamePlay.ts
|
|
15100
|
-
var
|
|
15132
|
+
var import_react102 = require("react");
|
|
15101
15133
|
function toSubmitResult(payload) {
|
|
15102
15134
|
return {
|
|
15103
15135
|
// 'pending' means the play is recorded but awaiting resolution (fixture games)
|
|
@@ -15109,17 +15141,17 @@ function toSubmitResult(payload) {
|
|
|
15109
15141
|
};
|
|
15110
15142
|
}
|
|
15111
15143
|
function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh }) {
|
|
15112
|
-
const [result, setResult] = (0,
|
|
15113
|
-
const [submitting, setSubmitting] = (0,
|
|
15114
|
-
const [rawStatus, setRawStatus] = (0,
|
|
15115
|
-
const inFlightRef = (0,
|
|
15116
|
-
const convRef = (0,
|
|
15144
|
+
const [result, setResult] = (0, import_react102.useState)(null);
|
|
15145
|
+
const [submitting, setSubmitting] = (0, import_react102.useState)(false);
|
|
15146
|
+
const [rawStatus, setRawStatus] = (0, import_react102.useState)(null);
|
|
15147
|
+
const inFlightRef = (0, import_react102.useRef)(false);
|
|
15148
|
+
const convRef = (0, import_react102.useRef)(conversation);
|
|
15117
15149
|
convRef.current = conversation;
|
|
15118
|
-
const optsRef = (0,
|
|
15150
|
+
const optsRef = (0, import_react102.useRef)({ gameId, gameDay, fixtureId, locale, refresh });
|
|
15119
15151
|
optsRef.current = { gameId, gameDay, fixtureId, locale, refresh };
|
|
15120
|
-
const resultRef = (0,
|
|
15152
|
+
const resultRef = (0, import_react102.useRef)(null);
|
|
15121
15153
|
resultRef.current = result;
|
|
15122
|
-
const refetch = (0,
|
|
15154
|
+
const refetch = (0, import_react102.useCallback)(async () => {
|
|
15123
15155
|
const conv = convRef.current;
|
|
15124
15156
|
if (!conv) return;
|
|
15125
15157
|
const opts = optsRef.current;
|
|
@@ -15135,7 +15167,7 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
|
|
|
15135
15167
|
} catch {
|
|
15136
15168
|
}
|
|
15137
15169
|
}, []);
|
|
15138
|
-
const submit = (0,
|
|
15170
|
+
const submit = (0, import_react102.useCallback)(async (answerJson) => {
|
|
15139
15171
|
const conv = convRef.current;
|
|
15140
15172
|
if (!conv || inFlightRef.current) return;
|
|
15141
15173
|
inFlightRef.current = true;
|
|
@@ -15162,14 +15194,14 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
|
|
|
15162
15194
|
setSubmitting(false);
|
|
15163
15195
|
}
|
|
15164
15196
|
}, [refetch]);
|
|
15165
|
-
const hydrate = (0,
|
|
15197
|
+
const hydrate = (0, import_react102.useCallback)(() => {
|
|
15166
15198
|
void refetch();
|
|
15167
15199
|
}, [refetch]);
|
|
15168
15200
|
return { result, submitting, submit, hydrate, rawStatus };
|
|
15169
15201
|
}
|
|
15170
15202
|
|
|
15171
15203
|
// src/components/games/MysteryTigerGame.tsx
|
|
15172
|
-
var
|
|
15204
|
+
var import_react104 = require("react");
|
|
15173
15205
|
|
|
15174
15206
|
// src/components/games/nationFlags.ts
|
|
15175
15207
|
var FLAGS = {
|
|
@@ -15380,7 +15412,7 @@ function isNationCode(flag) {
|
|
|
15380
15412
|
}
|
|
15381
15413
|
|
|
15382
15414
|
// src/components/games/PlayerAvatar.tsx
|
|
15383
|
-
var
|
|
15415
|
+
var import_react103 = require("react");
|
|
15384
15416
|
var import_jsx_runtime118 = require("react/jsx-runtime");
|
|
15385
15417
|
function initialsOf(name) {
|
|
15386
15418
|
const parts2 = name.trim().split(/\s+/).filter(Boolean);
|
|
@@ -15398,7 +15430,7 @@ function PlayerAvatar({
|
|
|
15398
15430
|
imagePath,
|
|
15399
15431
|
className
|
|
15400
15432
|
}) {
|
|
15401
|
-
const [failed, setFailed] = (0,
|
|
15433
|
+
const [failed, setFailed] = (0, import_react103.useState)(false);
|
|
15402
15434
|
const showImage = Boolean(imagePath) && !isPlaceholderImage(imagePath) && !failed;
|
|
15403
15435
|
return /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("div", { className, "aria-hidden": "true", children: showImage ? /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("img", { src: imagePath, alt: "", loading: "lazy", onError: () => setFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("span", { className: "ss-w-av-initials", children: initialsOf(name) }) });
|
|
15404
15436
|
}
|
|
@@ -15642,8 +15674,8 @@ function MysteryTigerGame({
|
|
|
15642
15674
|
onBack
|
|
15643
15675
|
}) {
|
|
15644
15676
|
const t = ui.games.mysteryTiger;
|
|
15645
|
-
const [query, setQuery] = (0,
|
|
15646
|
-
const inputId = (0,
|
|
15677
|
+
const [query, setQuery] = (0, import_react104.useState)("");
|
|
15678
|
+
const inputId = (0, import_react104.useId)();
|
|
15647
15679
|
const clientState = parseClientState(result?.clientStateJson);
|
|
15648
15680
|
const guessResults = clientState?.guessResults ?? [];
|
|
15649
15681
|
const alreadyGuessedIds = new Set(guessResults.map((g) => g.playerId));
|
|
@@ -15904,13 +15936,13 @@ function HigherOrLowerGame({
|
|
|
15904
15936
|
}
|
|
15905
15937
|
|
|
15906
15938
|
// src/components/games/CareerPathGame.tsx
|
|
15907
|
-
var
|
|
15939
|
+
var import_react106 = require("react");
|
|
15908
15940
|
|
|
15909
15941
|
// src/components/games/ui/CrestShield.tsx
|
|
15910
|
-
var
|
|
15942
|
+
var import_react105 = require("react");
|
|
15911
15943
|
var import_jsx_runtime129 = require("react/jsx-runtime");
|
|
15912
15944
|
function CrestShield({ src, name, size = 28 }) {
|
|
15913
|
-
const [failed, setFailed] = (0,
|
|
15945
|
+
const [failed, setFailed] = (0, import_react105.useState)(false);
|
|
15914
15946
|
if (src && !isPlaceholderImage(src) && !failed) {
|
|
15915
15947
|
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("img", { className: "ss-g-crest", src, alt: name, width: size, height: size, loading: "lazy", onError: () => setFailed(true) });
|
|
15916
15948
|
}
|
|
@@ -15942,8 +15974,8 @@ function CareerPathGame({
|
|
|
15942
15974
|
}) {
|
|
15943
15975
|
const s = ui.games.careerPath;
|
|
15944
15976
|
const title = gameTitle({ gameId: "career-path" }, ui.games.titles);
|
|
15945
|
-
const [query, setQuery] = (0,
|
|
15946
|
-
const inputId = (0,
|
|
15977
|
+
const [query, setQuery] = (0, import_react106.useState)("");
|
|
15978
|
+
const inputId = (0, import_react106.useId)();
|
|
15947
15979
|
const clientState = parseClientState3(result?.clientStateJson);
|
|
15948
15980
|
const alreadyGuessedIds = new Set(clientState?.guessResults.map((g) => g.playerId) ?? []);
|
|
15949
15981
|
const isOver = result?.alreadyPlayed === true || clientState?.solved === true || clientState?.failed === true;
|
|
@@ -16049,7 +16081,7 @@ function CareerPathGame({
|
|
|
16049
16081
|
}
|
|
16050
16082
|
|
|
16051
16083
|
// src/components/games/BeatTheGridGame.tsx
|
|
16052
|
-
var
|
|
16084
|
+
var import_react107 = __toESM(require("react"), 1);
|
|
16053
16085
|
|
|
16054
16086
|
// src/components/games/ui/OptionList.tsx
|
|
16055
16087
|
var import_jsx_runtime131 = require("react/jsx-runtime");
|
|
@@ -16138,10 +16170,10 @@ function SearchSheet({
|
|
|
16138
16170
|
ui
|
|
16139
16171
|
}) {
|
|
16140
16172
|
const s = ui.games.beatTheGrid;
|
|
16141
|
-
const [query, setQuery] = (0,
|
|
16142
|
-
const inputId = (0,
|
|
16143
|
-
const inputRef = (0,
|
|
16144
|
-
(0,
|
|
16173
|
+
const [query, setQuery] = (0, import_react107.useState)("");
|
|
16174
|
+
const inputId = (0, import_react107.useId)();
|
|
16175
|
+
const inputRef = (0, import_react107.useRef)(null);
|
|
16176
|
+
(0, import_react107.useEffect)(() => {
|
|
16145
16177
|
inputRef.current?.focus();
|
|
16146
16178
|
}, [row, col]);
|
|
16147
16179
|
const filtered = playerPool.filter(
|
|
@@ -16206,7 +16238,7 @@ function BeatTheGridGame({
|
|
|
16206
16238
|
}) {
|
|
16207
16239
|
const s = ui.games.beatTheGrid;
|
|
16208
16240
|
const title = gameTitle({ gameId: "beat-the-grid" }, ui.games.titles);
|
|
16209
|
-
const [activeCell, setActiveCell] = (0,
|
|
16241
|
+
const [activeCell, setActiveCell] = (0, import_react107.useState)(null);
|
|
16210
16242
|
const clientState = parseClientState4(result?.clientStateJson);
|
|
16211
16243
|
const filledCells = clientState?.cells ?? [];
|
|
16212
16244
|
const isLocked2 = result?.alreadyPlayed === true || clientState?.isComplete === true;
|
|
@@ -16280,7 +16312,7 @@ function BeatTheGridGame({
|
|
|
16280
16312
|
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { "aria-hidden": "true", children: abbr }),
|
|
16281
16313
|
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { className: "ss-g-sr", children: rowLabel })
|
|
16282
16314
|
] });
|
|
16283
|
-
return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(
|
|
16315
|
+
return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(import_react107.default.Fragment, { children: [
|
|
16284
16316
|
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)("div", { className: "ss-g-btg-rowhdr", "data-meta": rowMeta ? "true" : void 0, children: rowHeaderContent }),
|
|
16285
16317
|
cols.map((colLabel, colIdx) => {
|
|
16286
16318
|
const filled = findCellResult(filledCells, rowIdx, colIdx);
|
|
@@ -16361,7 +16393,7 @@ function BeatTheGridGame({
|
|
|
16361
16393
|
}
|
|
16362
16394
|
|
|
16363
16395
|
// src/components/games/GuessTheXiGame.tsx
|
|
16364
|
-
var
|
|
16396
|
+
var import_react108 = require("react");
|
|
16365
16397
|
|
|
16366
16398
|
// src/components/games/ui/PitchSvg.tsx
|
|
16367
16399
|
var import_jsx_runtime133 = require("react/jsx-runtime");
|
|
@@ -16450,8 +16482,8 @@ function GuessTheXiGame({
|
|
|
16450
16482
|
onBack
|
|
16451
16483
|
}) {
|
|
16452
16484
|
const t = ui.games.guessTheXi;
|
|
16453
|
-
const [query, setQuery] = (0,
|
|
16454
|
-
const inputId = (0,
|
|
16485
|
+
const [query, setQuery] = (0, import_react108.useState)("");
|
|
16486
|
+
const inputId = (0, import_react108.useId)();
|
|
16455
16487
|
const clientState = parseClientState5(result?.clientStateJson);
|
|
16456
16488
|
const isOver = result?.alreadyPlayed === true || clientState?.status === "solved" || clientState?.status === "failed";
|
|
16457
16489
|
const solved = clientState?.status === "solved";
|
|
@@ -16593,7 +16625,7 @@ function GuessTheXiGame({
|
|
|
16593
16625
|
}
|
|
16594
16626
|
|
|
16595
16627
|
// src/components/games/DailyQuizGame.tsx
|
|
16596
|
-
var
|
|
16628
|
+
var import_react109 = require("react");
|
|
16597
16629
|
var import_jsx_runtime135 = require("react/jsx-runtime");
|
|
16598
16630
|
function parseClientState6(json) {
|
|
16599
16631
|
if (!json) return null;
|
|
@@ -16634,8 +16666,8 @@ function DailyQuizGame({
|
|
|
16634
16666
|
}) {
|
|
16635
16667
|
const s = ui.games.dailyQuiz;
|
|
16636
16668
|
const title = gameTitle({ gameId: "daily-quiz" }, ui.games.titles);
|
|
16637
|
-
const [selections, setSelections] = (0,
|
|
16638
|
-
const [page, setPage] = (0,
|
|
16669
|
+
const [selections, setSelections] = (0, import_react109.useState)(/* @__PURE__ */ new Map());
|
|
16670
|
+
const [page, setPage] = (0, import_react109.useState)(0);
|
|
16639
16671
|
const clientState = parseClientState6(result?.clientStateJson);
|
|
16640
16672
|
const results2 = clientState?.results ?? [];
|
|
16641
16673
|
const isRevealed = results2.length > 0 || result?.alreadyPlayed === true;
|
|
@@ -16745,7 +16777,7 @@ function DailyQuizGame({
|
|
|
16745
16777
|
}
|
|
16746
16778
|
|
|
16747
16779
|
// src/components/games/MatchdayPredictorGame.tsx
|
|
16748
|
-
var
|
|
16780
|
+
var import_react110 = require("react");
|
|
16749
16781
|
var import_jsx_runtime136 = require("react/jsx-runtime");
|
|
16750
16782
|
var SCORER_SEARCH_THRESHOLD = 9;
|
|
16751
16783
|
function parseClientState7(json) {
|
|
@@ -16841,12 +16873,12 @@ function MatchdayPredictorGame({
|
|
|
16841
16873
|
onBack
|
|
16842
16874
|
}) {
|
|
16843
16875
|
const t = ui.games.predictor;
|
|
16844
|
-
const [homeScore, setHomeScore] = (0,
|
|
16845
|
-
const [awayScore, setAwayScore] = (0,
|
|
16846
|
-
const [firstScorerPlayerId, setFirstScorerPlayerId] = (0,
|
|
16847
|
-
const [lastEdited, setLastEdited] = (0,
|
|
16848
|
-
const [query, setQuery] = (0,
|
|
16849
|
-
const searchId = (0,
|
|
16876
|
+
const [homeScore, setHomeScore] = (0, import_react110.useState)(0);
|
|
16877
|
+
const [awayScore, setAwayScore] = (0, import_react110.useState)(0);
|
|
16878
|
+
const [firstScorerPlayerId, setFirstScorerPlayerId] = (0, import_react110.useState)(null);
|
|
16879
|
+
const [lastEdited, setLastEdited] = (0, import_react110.useState)("home");
|
|
16880
|
+
const [query, setQuery] = (0, import_react110.useState)("");
|
|
16881
|
+
const searchId = (0, import_react110.useId)();
|
|
16850
16882
|
const clientState = parseClientState7(result?.clientStateJson);
|
|
16851
16883
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
16852
16884
|
const header = /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
|
|
@@ -17013,7 +17045,7 @@ function MatchdayPredictorGame({
|
|
|
17013
17045
|
}
|
|
17014
17046
|
|
|
17015
17047
|
// src/components/games/StartingXiGame.tsx
|
|
17016
|
-
var
|
|
17048
|
+
var import_react111 = require("react");
|
|
17017
17049
|
var import_jsx_runtime137 = require("react/jsx-runtime");
|
|
17018
17050
|
var POINTS_PER_STARTER = 8;
|
|
17019
17051
|
var XI_SIZE = 11;
|
|
@@ -17057,10 +17089,10 @@ function StartingXiGame({
|
|
|
17057
17089
|
lockAtUtc
|
|
17058
17090
|
}) {
|
|
17059
17091
|
const t = ui.games.startingXi;
|
|
17060
|
-
const [slotPlayers, setSlotPlayers] = (0,
|
|
17061
|
-
const [active, setActive] = (0,
|
|
17062
|
-
const [query, setQuery] = (0,
|
|
17063
|
-
const searchId = (0,
|
|
17092
|
+
const [slotPlayers, setSlotPlayers] = (0, import_react111.useState)(() => Array(XI_SIZE).fill(null));
|
|
17093
|
+
const [active, setActive] = (0, import_react111.useState)(0);
|
|
17094
|
+
const [query, setQuery] = (0, import_react111.useState)("");
|
|
17095
|
+
const searchId = (0, import_react111.useId)();
|
|
17064
17096
|
const clientState = parseClientState8(result?.clientStateJson);
|
|
17065
17097
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
17066
17098
|
const header = /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
|
|
@@ -17199,7 +17231,7 @@ function StartingXiGame({
|
|
|
17199
17231
|
}
|
|
17200
17232
|
|
|
17201
17233
|
// src/components/games/StatLadderGame.tsx
|
|
17202
|
-
var
|
|
17234
|
+
var import_react112 = require("react");
|
|
17203
17235
|
var import_jsx_runtime138 = require("react/jsx-runtime");
|
|
17204
17236
|
function ladderClue(ladder) {
|
|
17205
17237
|
const mystery = ladder.find((r) => r.rank === 2);
|
|
@@ -17236,9 +17268,9 @@ function StatLadderGame({
|
|
|
17236
17268
|
onBack
|
|
17237
17269
|
}) {
|
|
17238
17270
|
const t = ui.games.statLadder;
|
|
17239
|
-
const [query, setQuery] = (0,
|
|
17240
|
-
const [selectedId, setSelectedId] = (0,
|
|
17241
|
-
const searchId = (0,
|
|
17271
|
+
const [query, setQuery] = (0, import_react112.useState)("");
|
|
17272
|
+
const [selectedId, setSelectedId] = (0, import_react112.useState)(null);
|
|
17273
|
+
const searchId = (0, import_react112.useId)();
|
|
17242
17274
|
const clientState = parseClientState9(result?.clientStateJson);
|
|
17243
17275
|
const revealed = clientState != null;
|
|
17244
17276
|
const header = /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(GameHeader, { title: gameTitle({ gameId: "stat-ladder" }, ui.games.titles), eyebrow: t.eyebrow, onBack, backLabel: ui.back });
|
|
@@ -17444,8 +17476,8 @@ function GameScreenHost({
|
|
|
17444
17476
|
ui
|
|
17445
17477
|
}) {
|
|
17446
17478
|
const { gameId, fixtureId, gameDay = "", lockAtUtc = null } = selected;
|
|
17447
|
-
const [configJson, setConfigJson] = (0,
|
|
17448
|
-
(0,
|
|
17479
|
+
const [configJson, setConfigJson] = (0, import_react113.useState)(null);
|
|
17480
|
+
(0, import_react113.useEffect)(() => {
|
|
17449
17481
|
setConfigJson(null);
|
|
17450
17482
|
if (!conversation) return;
|
|
17451
17483
|
let cancelled = false;
|
|
@@ -17468,12 +17500,12 @@ function GameScreenHost({
|
|
|
17468
17500
|
fixtureId: fixtureId || void 0,
|
|
17469
17501
|
locale: ui.hostTag
|
|
17470
17502
|
});
|
|
17471
|
-
(0,
|
|
17503
|
+
(0, import_react113.useEffect)(() => {
|
|
17472
17504
|
if (conversation) hydrate();
|
|
17473
17505
|
}, [conversation, gameId]);
|
|
17474
|
-
const hydrateRef = (0,
|
|
17506
|
+
const hydrateRef = (0, import_react113.useRef)(hydrate);
|
|
17475
17507
|
hydrateRef.current = hydrate;
|
|
17476
|
-
(0,
|
|
17508
|
+
(0, import_react113.useEffect)(() => {
|
|
17477
17509
|
if (!FIXTURE_GAME_IDS.has(gameId)) return;
|
|
17478
17510
|
if (rawStatus !== "pending") return;
|
|
17479
17511
|
const timerId = setInterval(() => {
|
|
@@ -17586,7 +17618,7 @@ function GameScreenHost({
|
|
|
17586
17618
|
}
|
|
17587
17619
|
|
|
17588
17620
|
// src/components/Leaderboard.tsx
|
|
17589
|
-
var
|
|
17621
|
+
var import_react114 = require("react");
|
|
17590
17622
|
|
|
17591
17623
|
// src/components/LeaderboardRow.tsx
|
|
17592
17624
|
var import_jsx_runtime141 = require("react/jsx-runtime");
|
|
@@ -17673,7 +17705,7 @@ function Leaderboard({
|
|
|
17673
17705
|
ui,
|
|
17674
17706
|
onPlay
|
|
17675
17707
|
}) {
|
|
17676
|
-
const [segment, setSegment] = (0,
|
|
17708
|
+
const [segment, setSegment] = (0, import_react114.useState)("weekly");
|
|
17677
17709
|
const myRow = segment === "weekly" ? data.myWeeklyRow : data.myAllTimeRow;
|
|
17678
17710
|
const offBoard = myRow !== null && myRow !== void 0 && myRow.rank === -1;
|
|
17679
17711
|
const isEmpty = segment === "weekly" ? data.weeklyTop.length === 0 : data.allTimeTop.length === 0;
|
|
@@ -17778,9 +17810,9 @@ function GamesPanel({
|
|
|
17778
17810
|
leaderboardLoading,
|
|
17779
17811
|
refreshHub
|
|
17780
17812
|
}) {
|
|
17781
|
-
const [selected, setSelected] = (0,
|
|
17782
|
-
const [segment, setSegment] = (0,
|
|
17783
|
-
(0,
|
|
17813
|
+
const [selected, setSelected] = (0, import_react115.useState)(null);
|
|
17814
|
+
const [segment, setSegment] = (0, import_react115.useState)("play");
|
|
17815
|
+
(0, import_react115.useEffect)(() => {
|
|
17784
17816
|
ensureGamesFonts();
|
|
17785
17817
|
}, []);
|
|
17786
17818
|
if (!loggedIn) return /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(GamesLoginWall, { ui });
|
|
@@ -17844,10 +17876,10 @@ function GamesPanel({
|
|
|
17844
17876
|
}
|
|
17845
17877
|
|
|
17846
17878
|
// src/components/FavouritesPanel.tsx
|
|
17847
|
-
var
|
|
17879
|
+
var import_react118 = require("react");
|
|
17848
17880
|
|
|
17849
17881
|
// src/components/FavouriteChips.tsx
|
|
17850
|
-
var
|
|
17882
|
+
var import_react116 = require("react");
|
|
17851
17883
|
var import_jsx_runtime146 = require("react/jsx-runtime");
|
|
17852
17884
|
async function toggleWithNotice(controller, kind, id, onNotice) {
|
|
17853
17885
|
const outcome = await controller.toggle(kind, id);
|
|
@@ -17893,12 +17925,12 @@ function Group({ title, entities, sport, ui, controller, onNotice }) {
|
|
|
17893
17925
|
] });
|
|
17894
17926
|
}
|
|
17895
17927
|
function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNotice }) {
|
|
17896
|
-
const [confirming, setConfirming] = (0,
|
|
17928
|
+
const [confirming, setConfirming] = (0, import_react116.useState)(false);
|
|
17897
17929
|
const data = controller.data;
|
|
17898
|
-
(0,
|
|
17930
|
+
(0, import_react116.useEffect)(() => {
|
|
17899
17931
|
setConfirming(false);
|
|
17900
17932
|
}, [sport]);
|
|
17901
|
-
(0,
|
|
17933
|
+
(0, import_react116.useEffect)(() => {
|
|
17902
17934
|
if (!confirming) return;
|
|
17903
17935
|
const onPointerDown = (e) => {
|
|
17904
17936
|
if (!(e.target instanceof Element) || !e.target.closest("[data-fav-confirm]")) setConfirming(false);
|
|
@@ -17952,21 +17984,21 @@ function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNoti
|
|
|
17952
17984
|
}
|
|
17953
17985
|
|
|
17954
17986
|
// src/components/FavouritesSearch.tsx
|
|
17955
|
-
var
|
|
17987
|
+
var import_react117 = require("react");
|
|
17956
17988
|
var import_jsx_runtime147 = require("react/jsx-runtime");
|
|
17957
17989
|
var MIN_LETTERS = 2;
|
|
17958
17990
|
var MAX_LENGTH = 64;
|
|
17959
17991
|
var DEBOUNCE_MS = 250;
|
|
17960
17992
|
function FavouritesSearch({ controller, ui, sport, onNotice }) {
|
|
17961
|
-
const [query, setQuery] = (0,
|
|
17962
|
-
const [answer, setAnswer] = (0,
|
|
17963
|
-
const controllerRef = (0,
|
|
17993
|
+
const [query, setQuery] = (0, import_react117.useState)("");
|
|
17994
|
+
const [answer, setAnswer] = (0, import_react117.useState)(null);
|
|
17995
|
+
const controllerRef = (0, import_react117.useRef)(controller);
|
|
17964
17996
|
controllerRef.current = controller;
|
|
17965
17997
|
const trimmed = query.trim();
|
|
17966
17998
|
const queryKey = `${sport}|${trimmed}`;
|
|
17967
17999
|
const results2 = answer?.key === queryKey ? answer.rows : [];
|
|
17968
18000
|
const settled = answer?.key === queryKey;
|
|
17969
|
-
(0,
|
|
18001
|
+
(0, import_react117.useEffect)(() => {
|
|
17970
18002
|
setAnswer(null);
|
|
17971
18003
|
if (trimmed.length < MIN_LETTERS) return;
|
|
17972
18004
|
let cancelled = false;
|
|
@@ -18029,13 +18061,13 @@ function FavouritesSearch({ controller, ui, sport, onNotice }) {
|
|
|
18029
18061
|
// src/components/FavouritesPanel.tsx
|
|
18030
18062
|
var import_jsx_runtime148 = require("react/jsx-runtime");
|
|
18031
18063
|
function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
|
|
18032
|
-
const [notice, setNotice] = (0,
|
|
18033
|
-
const refreshRef = (0,
|
|
18064
|
+
const [notice, setNotice] = (0, import_react118.useState)(null);
|
|
18065
|
+
const refreshRef = (0, import_react118.useRef)(controller.refresh);
|
|
18034
18066
|
refreshRef.current = controller.refresh;
|
|
18035
|
-
(0,
|
|
18067
|
+
(0, import_react118.useEffect)(() => {
|
|
18036
18068
|
void refreshRef.current();
|
|
18037
18069
|
}, []);
|
|
18038
|
-
(0,
|
|
18070
|
+
(0, import_react118.useEffect)(() => {
|
|
18039
18071
|
setNotice(null);
|
|
18040
18072
|
}, [sport]);
|
|
18041
18073
|
const sportLabel2 = sports.find((s) => s.sport === sport)?.label ?? sportLabel(ui, sport);
|
|
@@ -18061,11 +18093,11 @@ function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
|
|
|
18061
18093
|
}
|
|
18062
18094
|
|
|
18063
18095
|
// src/components/PresetTools.tsx
|
|
18064
|
-
var
|
|
18096
|
+
var import_react119 = require("react");
|
|
18065
18097
|
var import_jsx_runtime149 = require("react/jsx-runtime");
|
|
18066
18098
|
function PresetToolModal({ title, closeLabel, onClose, children, footer, className }) {
|
|
18067
18099
|
const { dialogRef, onKeyDown } = useModalDialog(onClose, { restoreFocus: false });
|
|
18068
|
-
const titleId = (0,
|
|
18100
|
+
const titleId = (0, import_react119.useId)();
|
|
18069
18101
|
return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: className ? `ss-w-tool-backdrop ${className}` : "ss-w-tool-backdrop", children: /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { ref: dialogRef, className: "ss-w-tool", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, tabIndex: -1, onKeyDown, children: [
|
|
18070
18102
|
/* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "ss-w-tool-head", children: [
|
|
18071
18103
|
/* @__PURE__ */ (0, import_jsx_runtime149.jsx)("h2", { id: titleId, className: "ss-w-tool-title", children: title }),
|
|
@@ -18115,9 +18147,9 @@ function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal,
|
|
|
18115
18147
|
const totalOptions = comboTotals(grid);
|
|
18116
18148
|
const totals = totalOptions.map((o) => o.value);
|
|
18117
18149
|
const legChoices = comboLegChoices(grid);
|
|
18118
|
-
const [total, setTotal] = (0,
|
|
18119
|
-
const [legs, setLegs] = (0,
|
|
18120
|
-
const [announcement, setAnnouncement] = (0,
|
|
18150
|
+
const [total, setTotal] = (0, import_react119.useState)(() => nearest(totals, initialTotal));
|
|
18151
|
+
const [legs, setLegs] = (0, import_react119.useState)(() => legsForTotal(grid, nearest(totals, initialTotal), clampLegs(legChoices, initialLegs)));
|
|
18152
|
+
const [announcement, setAnnouncement] = (0, import_react119.useState)("");
|
|
18121
18153
|
const cell2 = findCombo(grid, total, legs);
|
|
18122
18154
|
const minLegs = legChoices[0] ?? legs;
|
|
18123
18155
|
const maxLegs = legChoices[legChoices.length - 1] ?? legs;
|
|
@@ -18156,7 +18188,7 @@ function FavouritesSheet({ ui, controller, sport, sports, onSportChange, onClose
|
|
|
18156
18188
|
}
|
|
18157
18189
|
|
|
18158
18190
|
// src/components/dashboard/v8/SentenceBuilder.tsx
|
|
18159
|
-
var
|
|
18191
|
+
var import_react120 = require("react");
|
|
18160
18192
|
var import_widget_sdk38 = require("@sensiblestats/widget-sdk");
|
|
18161
18193
|
var import_jsx_runtime151 = require("react/jsx-runtime");
|
|
18162
18194
|
var TOTALS = ["any", "3", "5", "10", "20", "50"];
|
|
@@ -18197,8 +18229,8 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
18197
18229
|
const opening = openingGames(preset);
|
|
18198
18230
|
const gamesOptions = opening.options;
|
|
18199
18231
|
const marketOptions = usableMarkets(preset);
|
|
18200
|
-
const [fingerprint] = (0,
|
|
18201
|
-
const [saved] = (0,
|
|
18232
|
+
const [fingerprint] = (0, import_react120.useState)(() => JSON.stringify(preset));
|
|
18233
|
+
const [saved] = (0, import_react120.useState)(() => {
|
|
18202
18234
|
const kept = memory3?.savedView(sport);
|
|
18203
18235
|
return kept && kept.fingerprint === fingerprint ? kept : null;
|
|
18204
18236
|
});
|
|
@@ -18213,9 +18245,9 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
18213
18245
|
// The server never widens by itself: an all-games preset with no ids asks for it.
|
|
18214
18246
|
widen: opening.option ? opening.option.matchIds.length === 0 : preset.gamesScope === "all" && preset.matchIds.length === 0
|
|
18215
18247
|
};
|
|
18216
|
-
const [view, setView] = (0,
|
|
18217
|
-
const autoWidened = (0,
|
|
18218
|
-
const [widenedNote, setWidenedNote] = (0,
|
|
18248
|
+
const [view, setView] = (0, import_react120.useState)(() => saved?.view ?? openingView);
|
|
18249
|
+
const autoWidened = (0, import_react120.useRef)(false);
|
|
18250
|
+
const [widenedNote, setWidenedNote] = (0, import_react120.useState)(saved?.widenedNote ?? false);
|
|
18219
18251
|
const track = useTrack();
|
|
18220
18252
|
const requestFor = (v, extra) => ({
|
|
18221
18253
|
sport,
|
|
@@ -18231,18 +18263,18 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
18231
18263
|
...operatorUserId ? { operatorUserId } : {},
|
|
18232
18264
|
...anonymousUserId ? { anonymousUserId } : {}
|
|
18233
18265
|
});
|
|
18234
|
-
const [editing, setEditing] = (0,
|
|
18235
|
-
const [draft, setDraft] = (0,
|
|
18236
|
-
const [invalid, setInvalid] = (0,
|
|
18237
|
-
const inputRef = (0,
|
|
18238
|
-
const pencilRef = (0,
|
|
18239
|
-
const noteId = (0,
|
|
18240
|
-
const customId = (0,
|
|
18241
|
-
(0,
|
|
18266
|
+
const [editing, setEditing] = (0, import_react120.useState)(false);
|
|
18267
|
+
const [draft, setDraft] = (0, import_react120.useState)("");
|
|
18268
|
+
const [invalid, setInvalid] = (0, import_react120.useState)(null);
|
|
18269
|
+
const inputRef = (0, import_react120.useRef)(null);
|
|
18270
|
+
const pencilRef = (0, import_react120.useRef)(null);
|
|
18271
|
+
const noteId = (0, import_react120.useId)();
|
|
18272
|
+
const customId = (0, import_react120.useId)();
|
|
18273
|
+
(0, import_react120.useEffect)(() => {
|
|
18242
18274
|
if (editing) inputRef.current?.focus();
|
|
18243
18275
|
}, [editing]);
|
|
18244
18276
|
const customLabel = (c) => c.format === oddsFormat ? c.text : c.decimal;
|
|
18245
|
-
(0,
|
|
18277
|
+
(0, import_react120.useEffect)(() => {
|
|
18246
18278
|
if (view.legs === 1) {
|
|
18247
18279
|
setEditing(false);
|
|
18248
18280
|
setDraft("");
|
|
@@ -18258,16 +18290,16 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
18258
18290
|
setEditing(false);
|
|
18259
18291
|
pencilRef.current?.focus();
|
|
18260
18292
|
};
|
|
18261
|
-
const [first] = (0,
|
|
18293
|
+
const [first] = (0, import_react120.useState)(() => requestFor(view));
|
|
18262
18294
|
const { grid, answeredFor, status: status2, confirmed, request } = useBuilderGrid({ conversation, locale: ui.hostTag, memory: memory3, initial: first });
|
|
18263
|
-
const [shown2, setShown] = (0,
|
|
18295
|
+
const [shown2, setShown] = (0, import_react120.useState)(null);
|
|
18264
18296
|
if (grid === null) {
|
|
18265
18297
|
if (shown2 !== null && status2 === "ready") setShown(null);
|
|
18266
18298
|
} else if (answeredFor && (shown2?.seen !== grid || shown2.seenReq !== answeredFor)) {
|
|
18267
18299
|
setShown(shownAfter(shown2, grid, answeredFor));
|
|
18268
18300
|
}
|
|
18269
|
-
const lastRequest = (0,
|
|
18270
|
-
(0,
|
|
18301
|
+
const lastRequest = (0, import_react120.useRef)(first);
|
|
18302
|
+
(0, import_react120.useEffect)(() => {
|
|
18271
18303
|
void request(lastRequest.current);
|
|
18272
18304
|
}, [request]);
|
|
18273
18305
|
const send = (req) => {
|
|
@@ -18305,7 +18337,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
18305
18337
|
};
|
|
18306
18338
|
const canNarrow = preset.matchIds.length > 0;
|
|
18307
18339
|
const ready = status2 === "ready" && grid !== null;
|
|
18308
|
-
const [tapped, setTapped] = (0,
|
|
18340
|
+
const [tapped, setTapped] = (0, import_react120.useState)(null);
|
|
18309
18341
|
const busy = tapped !== null && status2 === "loading" && shown2 !== null;
|
|
18310
18342
|
const g = ready ? shown2?.grid ?? grid : busy ? shown2.grid : null;
|
|
18311
18343
|
const suggested = g?.status === "miss" || g?.nearest === true ? g.legCountThatLands : null;
|
|
@@ -18314,8 +18346,8 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
18314
18346
|
...[preset.legs, suggested].filter((n) => n !== null && n > 4)
|
|
18315
18347
|
])).sort((a, b) => a - b);
|
|
18316
18348
|
const rows = g && g.status === "ok" ? legsOf(g, sport) : null;
|
|
18317
|
-
const sectionRef = (0,
|
|
18318
|
-
(0,
|
|
18349
|
+
const sectionRef = (0, import_react120.useRef)(null);
|
|
18350
|
+
(0, import_react120.useEffect)(() => {
|
|
18319
18351
|
if (tapped === null || status2 !== "ready") return;
|
|
18320
18352
|
setTapped(null);
|
|
18321
18353
|
const root = sectionRef.current;
|
|
@@ -18332,14 +18364,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
18332
18364
|
}, [tapped, status2]);
|
|
18333
18365
|
const rowSlip = rows ? guardLegsPreMatch(slip, rows, ui) : slip;
|
|
18334
18366
|
useNextKickoffRender(rows ? rows.map((l) => l.kickoffUtc) : []);
|
|
18335
|
-
const [startedNote, setStartedNote] = (0,
|
|
18367
|
+
const [startedNote, setStartedNote] = (0, import_react120.useState)(false);
|
|
18336
18368
|
const anyStarted = rows !== null && rows.some((l) => !preMatchOpen(l.kickoffUtc, Date.now()));
|
|
18337
|
-
(0,
|
|
18369
|
+
(0, import_react120.useEffect)(() => {
|
|
18338
18370
|
if (startedNote && status2 === "ready" && !anyStarted) setStartedNote(false);
|
|
18339
18371
|
}, [startedNote, status2, anyStarted]);
|
|
18340
18372
|
const market = rows?.[0]?.market;
|
|
18341
|
-
const [seen2, setSeen] = (0,
|
|
18342
|
-
(0,
|
|
18373
|
+
const [seen2, setSeen] = (0, import_react120.useState)(null);
|
|
18374
|
+
(0, import_react120.useEffect)(() => {
|
|
18343
18375
|
if (market) setSeen(market);
|
|
18344
18376
|
}, [market]);
|
|
18345
18377
|
const marketName = view.marketKey === null ? null : marketOptions?.find((m) => m.key === view.marketKey)?.label ?? market ?? seen2;
|
|
@@ -18383,14 +18415,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
18383
18415
|
};
|
|
18384
18416
|
};
|
|
18385
18417
|
const canWiden = gamesOptions === null || allGames !== null;
|
|
18386
|
-
(0,
|
|
18418
|
+
(0, import_react120.useEffect)(() => {
|
|
18387
18419
|
if (!empty2 || !singles || widened || !canWiden || autoWidened.current) return;
|
|
18388
18420
|
autoWidened.current = true;
|
|
18389
18421
|
const next = { ...view, widen: true, matchIds: [], gamesId: allGames ? allGames.id : view.gamesId };
|
|
18390
18422
|
commit(next, true);
|
|
18391
18423
|
send(requestFor(next));
|
|
18392
18424
|
}, [empty2, singles, widened, canWiden, view]);
|
|
18393
|
-
(0,
|
|
18425
|
+
(0, import_react120.useEffect)(() => {
|
|
18394
18426
|
if (coolOff) onCoolOff?.(sport);
|
|
18395
18427
|
}, [coolOff, onCoolOff, sport]);
|
|
18396
18428
|
if (coolOff) return null;
|
|
@@ -18857,10 +18889,10 @@ function Squad({ squad, loading, ui, view, onToggleView, stats, statsLoading, se
|
|
|
18857
18889
|
}
|
|
18858
18890
|
|
|
18859
18891
|
// src/components/PlayerPhoto.tsx
|
|
18860
|
-
var
|
|
18892
|
+
var import_react121 = require("react");
|
|
18861
18893
|
var import_jsx_runtime157 = require("react/jsx-runtime");
|
|
18862
18894
|
function PlayerPhoto({ photoUrl, jerseyNumber, size }) {
|
|
18863
|
-
const [failed, setFailed] = (0,
|
|
18895
|
+
const [failed, setFailed] = (0, import_react121.useState)(false);
|
|
18864
18896
|
const box = { width: size, height: size };
|
|
18865
18897
|
if (photoUrl && !failed) {
|
|
18866
18898
|
return /* @__PURE__ */ (0, import_jsx_runtime157.jsx)("img", { className: "ss-w-pd-photo", style: box, src: photoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -18895,7 +18927,7 @@ function MiniPitch({ positionCode }) {
|
|
|
18895
18927
|
}
|
|
18896
18928
|
|
|
18897
18929
|
// src/components/PerformanceBars.tsx
|
|
18898
|
-
var
|
|
18930
|
+
var import_react122 = require("react");
|
|
18899
18931
|
var import_jsx_runtime159 = require("react/jsx-runtime");
|
|
18900
18932
|
var GROUPS = ["shooting", "passing", "possession", "defending"];
|
|
18901
18933
|
function finite4(v) {
|
|
@@ -18941,7 +18973,7 @@ function unrankedLine(ui, reason) {
|
|
|
18941
18973
|
}
|
|
18942
18974
|
}
|
|
18943
18975
|
function PerformanceBars({ performance, competitionName, strings }) {
|
|
18944
|
-
const [mode, setMode] = (0,
|
|
18976
|
+
const [mode, setMode] = (0, import_react122.useState)("total");
|
|
18945
18977
|
const labelled = performance.metrics.filter((m) => Object.prototype.hasOwnProperty.call(strings.perfMetric, m.key));
|
|
18946
18978
|
if (!labelled.some((m) => valueOf(m, "total") !== null || valueOf(m, "per90") !== null)) return null;
|
|
18947
18979
|
const subtitle = !performance.ranked ? unrankedLine(strings, performance.unrankedReason) : competitionName ? strings.perfRankedAgainst(competitionName, performance.positionGroup) : null;
|
|
@@ -19150,8 +19182,8 @@ function SettingsSheet({ ui, onClose }) {
|
|
|
19150
19182
|
var import_jsx_runtime162 = require("react/jsx-runtime");
|
|
19151
19183
|
var FULLSCREEN_QUERY = "(max-width: 639px)";
|
|
19152
19184
|
function useIsModal() {
|
|
19153
|
-
const [modal, setModal] = (0,
|
|
19154
|
-
(0,
|
|
19185
|
+
const [modal, setModal] = (0, import_react123.useState)(false);
|
|
19186
|
+
(0, import_react123.useEffect)(() => {
|
|
19155
19187
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
19156
19188
|
const mql = window.matchMedia(FULLSCREEN_QUERY);
|
|
19157
19189
|
const sync = () => setModal(mql.matches);
|
|
@@ -19165,12 +19197,12 @@ var HIDDEN_LAYER_STYLE = { position: "absolute", inset: 0, visibility: "hidden",
|
|
|
19165
19197
|
var SQUAD_LAYER_STYLE = { display: "flex", flexDirection: "column", flex: 1, minHeight: 0 };
|
|
19166
19198
|
function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, schedule, gamesResult, leaderboardResult, clubFixturesResult, clubStandingsResult, clubSquadResult, clubSquadStatsResult, clubPlayerDetailResult, loggedIn, conversation, presetGrid, favouritesEnabled, favourites, builder, onCloseRequested, onRegisterBack }) {
|
|
19167
19199
|
const { state, close, stop, send, reset } = controller;
|
|
19168
|
-
const [squadView, setSquadView] = (0,
|
|
19169
|
-
const [selectedPlayerId, setSelectedPlayerId] = (0,
|
|
19200
|
+
const [squadView, setSquadView] = (0, import_react123.useState)("roster");
|
|
19201
|
+
const [selectedPlayerId, setSelectedPlayerId] = (0, import_react123.useState)(null);
|
|
19170
19202
|
const clearPlayerDetail = clubPlayerDetailResult?.clear;
|
|
19171
19203
|
const fetchPlayerDetail = clubPlayerDetailResult?.fetch;
|
|
19172
|
-
const squadLayerRef = (0,
|
|
19173
|
-
const squadScrollRef = (0,
|
|
19204
|
+
const squadLayerRef = (0, import_react123.useRef)(null);
|
|
19205
|
+
const squadScrollRef = (0, import_react123.useRef)(null);
|
|
19174
19206
|
const selectPlayer = (playerId) => {
|
|
19175
19207
|
squadScrollRef.current = squadLayerRef.current?.querySelector(".ss-w-mon-list")?.scrollTop ?? null;
|
|
19176
19208
|
setSelectedPlayerId(playerId);
|
|
@@ -19180,7 +19212,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
19180
19212
|
setSelectedPlayerId(null);
|
|
19181
19213
|
clearPlayerDetail?.();
|
|
19182
19214
|
};
|
|
19183
|
-
(0,
|
|
19215
|
+
(0, import_react123.useLayoutEffect)(() => {
|
|
19184
19216
|
if (selectedPlayerId !== null || squadScrollRef.current === null) return;
|
|
19185
19217
|
const list = squadLayerRef.current?.querySelector(".ss-w-mon-list");
|
|
19186
19218
|
if (list) list.scrollTop = squadScrollRef.current;
|
|
@@ -19193,7 +19225,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
19193
19225
|
const hasBuilder = !clubBrand && (builderOptions?.length ?? 0) > 0;
|
|
19194
19226
|
const tabs = monitor ?? (hasBuilder ? tabState : void 0);
|
|
19195
19227
|
const activeTab = tabs?.activeTab;
|
|
19196
|
-
(0,
|
|
19228
|
+
(0, import_react123.useEffect)(() => {
|
|
19197
19229
|
if (activeTab === "squad" || selectedPlayerId === null) return;
|
|
19198
19230
|
setSelectedPlayerId(null);
|
|
19199
19231
|
clearPlayerDetail?.();
|
|
@@ -19202,11 +19234,11 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
19202
19234
|
const favouritesOpen = favouritesOffered && (favourites?.open ?? false);
|
|
19203
19235
|
const favouritesAskedOpen = favourites?.open ?? false;
|
|
19204
19236
|
const setFavouritesOpen = favourites?.onOpenChange;
|
|
19205
|
-
(0,
|
|
19237
|
+
(0, import_react123.useEffect)(() => {
|
|
19206
19238
|
if (favouritesAskedOpen && !favouritesOffered) setFavouritesOpen?.(false);
|
|
19207
19239
|
}, [favouritesAskedOpen, favouritesOffered, setFavouritesOpen]);
|
|
19208
19240
|
const storedTab = tabState?.activeTab;
|
|
19209
|
-
(0,
|
|
19241
|
+
(0, import_react123.useEffect)(() => {
|
|
19210
19242
|
const unreachable = storedTab === "builder" ? !hasBuilder : !monitor && storedTab !== void 0 && storedTab !== "chat";
|
|
19211
19243
|
if (unreachable) setMonitorTab?.("chat");
|
|
19212
19244
|
}, [storedTab, hasBuilder, monitor, setMonitorTab]);
|
|
@@ -19215,12 +19247,12 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
19215
19247
|
const closeTab = tabs?.activeTab ?? "chat";
|
|
19216
19248
|
const lastMessage = state.messages[state.messages.length - 1];
|
|
19217
19249
|
const answering = state.isStreaming && !(lastMessage?.role === "assistant" && lastMessage.isGreeting);
|
|
19218
|
-
const closeWith = (0,
|
|
19250
|
+
const closeWith = (0, import_react123.useCallback)((method) => {
|
|
19219
19251
|
track({ name: "widget_close", method, tab: closeTab, answering });
|
|
19220
19252
|
if (onCloseRequested) onCloseRequested();
|
|
19221
19253
|
else close();
|
|
19222
19254
|
}, [track, closeTab, answering, close, onCloseRequested]);
|
|
19223
|
-
(0,
|
|
19255
|
+
(0, import_react123.useEffect)(() => {
|
|
19224
19256
|
const onKey = (e) => {
|
|
19225
19257
|
if (e.key === "Escape") closeWith("escape");
|
|
19226
19258
|
};
|
|
@@ -19236,78 +19268,78 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
19236
19268
|
tabs?.setActiveTab("chat");
|
|
19237
19269
|
send(text2, { grounding, source });
|
|
19238
19270
|
};
|
|
19239
|
-
(0,
|
|
19271
|
+
(0, import_react123.useEffect)(() => {
|
|
19240
19272
|
if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
|
|
19241
19273
|
}, [monitor, state.isStreaming, state.messages.length]);
|
|
19242
19274
|
const onChatTab = !tabs || tabs.activeTab === "chat";
|
|
19243
|
-
const inputRef = (0,
|
|
19244
|
-
const limitRef = (0,
|
|
19245
|
-
const typedSendRef = (0,
|
|
19246
|
-
const focusAfterCloseRef = (0,
|
|
19247
|
-
const [tool, setTool] = (0,
|
|
19248
|
-
const panelRef = (0,
|
|
19249
|
-
const [settingsOpen, setSettingsOpen] = (0,
|
|
19250
|
-
const openSettings = (0,
|
|
19275
|
+
const inputRef = (0, import_react123.useRef)(null);
|
|
19276
|
+
const limitRef = (0, import_react123.useRef)(null);
|
|
19277
|
+
const typedSendRef = (0, import_react123.useRef)(false);
|
|
19278
|
+
const focusAfterCloseRef = (0, import_react123.useRef)(null);
|
|
19279
|
+
const [tool, setTool] = (0, import_react123.useState)(null);
|
|
19280
|
+
const panelRef = (0, import_react123.useRef)(null);
|
|
19281
|
+
const [settingsOpen, setSettingsOpen] = (0, import_react123.useState)(false);
|
|
19282
|
+
const openSettings = (0, import_react123.useCallback)(() => {
|
|
19251
19283
|
setTool(null);
|
|
19252
19284
|
setFavouritesOpen?.(false);
|
|
19253
19285
|
setSettingsOpen(true);
|
|
19254
19286
|
}, [setFavouritesOpen]);
|
|
19255
|
-
const closeSettings = (0,
|
|
19287
|
+
const closeSettings = (0, import_react123.useCallback)(() => {
|
|
19256
19288
|
setSettingsOpen(false);
|
|
19257
19289
|
panelRef.current?.querySelector(".ss-w-kebab")?.focus();
|
|
19258
19290
|
}, []);
|
|
19259
|
-
const openFavourites = (0,
|
|
19260
|
-
const closeFavourites = (0,
|
|
19291
|
+
const openFavourites = (0, import_react123.useCallback)(() => setFavouritesOpen?.(true), [setFavouritesOpen]);
|
|
19292
|
+
const closeFavourites = (0, import_react123.useCallback)(() => {
|
|
19261
19293
|
setFavouritesOpen?.(false);
|
|
19262
19294
|
panelRef.current?.querySelector(".ss-w-kebab")?.focus();
|
|
19263
19295
|
}, [setFavouritesOpen]);
|
|
19264
|
-
(0,
|
|
19296
|
+
(0, import_react123.useEffect)(() => {
|
|
19265
19297
|
if (!favouritesOpen) return;
|
|
19266
19298
|
setTool(null);
|
|
19267
19299
|
setSettingsOpen(false);
|
|
19268
19300
|
}, [favouritesOpen]);
|
|
19269
19301
|
const paused = isPaused(state.limit);
|
|
19270
|
-
(0,
|
|
19302
|
+
(0, import_react123.useEffect)(() => {
|
|
19271
19303
|
if (paused) setTool(null);
|
|
19272
19304
|
}, [paused]);
|
|
19273
|
-
(0,
|
|
19305
|
+
(0, import_react123.useEffect)(() => {
|
|
19274
19306
|
if (!paused) return;
|
|
19275
19307
|
if (typedSendRef.current) limitRef.current?.focus();
|
|
19276
19308
|
typedSendRef.current = false;
|
|
19277
19309
|
}, [paused]);
|
|
19278
|
-
const openTool = (0,
|
|
19310
|
+
const openTool = (0, import_react123.useCallback)((next) => {
|
|
19279
19311
|
setTool(next);
|
|
19280
19312
|
}, []);
|
|
19281
|
-
const toolsValue = (0,
|
|
19313
|
+
const toolsValue = (0, import_react123.useMemo)(
|
|
19282
19314
|
() => presetGrid && !paused ? { openBuilder: (total, legs) => openTool({ total, legs }), changeLabel: ui.presets.changeCombo } : null,
|
|
19283
19315
|
[presetGrid, paused, openTool, ui.presets.changeCombo]
|
|
19284
19316
|
);
|
|
19285
|
-
const closeTool = (0,
|
|
19317
|
+
const closeTool = (0, import_react123.useCallback)(() => {
|
|
19286
19318
|
focusAfterCloseRef.current = "composer";
|
|
19287
19319
|
setTool(null);
|
|
19288
19320
|
}, []);
|
|
19289
|
-
const sendAsk = (0,
|
|
19321
|
+
const sendAsk = (0, import_react123.useCallback)((ask) => {
|
|
19290
19322
|
focusAfterCloseRef.current = "composer";
|
|
19291
19323
|
setTool(null);
|
|
19292
19324
|
tabs?.setActiveTab("chat");
|
|
19293
19325
|
send(ask.message, { displayText: ask.displayText, preset: ask.preset, source: "preset" });
|
|
19294
19326
|
}, [tabs, send]);
|
|
19295
|
-
const formatKickoff = (0,
|
|
19327
|
+
const formatKickoff = (0, import_react123.useCallback)((kickoffUtc) => {
|
|
19296
19328
|
const k = ui.bettingKickoff(kickoffUtc);
|
|
19297
19329
|
return `${k.dayLabel} ${k.time}`;
|
|
19298
19330
|
}, [ui]);
|
|
19299
|
-
(0,
|
|
19331
|
+
(0, import_react123.useEffect)(() => {
|
|
19300
19332
|
if (tool) return;
|
|
19301
19333
|
const target = focusAfterCloseRef.current;
|
|
19302
19334
|
focusAfterCloseRef.current = null;
|
|
19303
19335
|
if (target === "composer") inputRef.current?.focus();
|
|
19304
19336
|
}, [tool]);
|
|
19305
|
-
(0,
|
|
19337
|
+
(0, import_react123.useEffect)(() => {
|
|
19306
19338
|
if (!tool || onChatTab && presetGrid) return;
|
|
19307
19339
|
focusAfterCloseRef.current = "composer";
|
|
19308
19340
|
setTool(null);
|
|
19309
19341
|
}, [tool, onChatTab, presetGrid]);
|
|
19310
|
-
const backRef = (0,
|
|
19342
|
+
const backRef = (0, import_react123.useRef)(() => false);
|
|
19311
19343
|
backRef.current = () => {
|
|
19312
19344
|
if (favouritesOpen) {
|
|
19313
19345
|
closeFavourites();
|
|
@@ -19331,7 +19363,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
19331
19363
|
}
|
|
19332
19364
|
return false;
|
|
19333
19365
|
};
|
|
19334
|
-
(0,
|
|
19366
|
+
(0, import_react123.useEffect)(() => {
|
|
19335
19367
|
if (!onRegisterBack) return;
|
|
19336
19368
|
onRegisterBack(() => backRef.current());
|
|
19337
19369
|
return () => onRegisterBack(null);
|
|
@@ -22436,19 +22468,19 @@ function injectStyles(root) {
|
|
|
22436
22468
|
function StatsWidget(props) {
|
|
22437
22469
|
const injectedClient = "client" in props ? props.client : void 0;
|
|
22438
22470
|
const cfg = props.config;
|
|
22439
|
-
const onUnavailableRef = (0,
|
|
22471
|
+
const onUnavailableRef = (0, import_react124.useRef)(cfg?.onUnavailable);
|
|
22440
22472
|
onUnavailableRef.current = cfg?.onUnavailable;
|
|
22441
|
-
const built = (0,
|
|
22473
|
+
const built = (0, import_react124.useMemo)(() => buildClient(props, (reason) => {
|
|
22442
22474
|
try {
|
|
22443
22475
|
onUnavailableRef.current?.(reason);
|
|
22444
22476
|
} catch {
|
|
22445
22477
|
}
|
|
22446
|
-
}), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId]);
|
|
22447
|
-
const trackingRef = (0,
|
|
22448
|
-
const track = (0,
|
|
22449
|
-
const eventTextRef = (0,
|
|
22478
|
+
}), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId, cfg?.timeZone]);
|
|
22479
|
+
const trackingRef = (0, import_react124.useRef)({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
|
|
22480
|
+
const track = (0, import_react124.useMemo)(() => createTracker(() => trackingRef.current), []);
|
|
22481
|
+
const eventTextRef = (0, import_react124.useRef)(false);
|
|
22450
22482
|
eventTextRef.current = cfg?.eventText === true;
|
|
22451
|
-
const logger = (0,
|
|
22483
|
+
const logger = (0, import_react124.useMemo)(() => {
|
|
22452
22484
|
if (!built) return null;
|
|
22453
22485
|
const raw = built.client.createEventLogger({
|
|
22454
22486
|
operatorUserId: cfg?.userContext?.operatorUserId,
|
|
@@ -22458,27 +22490,27 @@ function StatsWidget(props) {
|
|
|
22458
22490
|
}, [built?.client, track]);
|
|
22459
22491
|
const widgetStrings = useWidgetStrings(cfg, built?.conversation ?? null);
|
|
22460
22492
|
const stringsPending = widgetStrings.strings === void 0;
|
|
22461
|
-
const ui = (0,
|
|
22493
|
+
const ui = (0, import_react124.useMemo)(
|
|
22462
22494
|
() => normalizeUi(props.config ?? { operatorId: "", publicKey: "" }, widgetStrings.strings ?? BUNDLED),
|
|
22463
22495
|
[props.config, widgetStrings.strings]
|
|
22464
22496
|
);
|
|
22465
22497
|
const oddsSettings = useOddsSettingsState(ui, built?.conversation, cfg?.operatorId || "default");
|
|
22466
|
-
const rootRef = (0,
|
|
22467
|
-
const introDoneRef = (0,
|
|
22468
|
-
const markIntroDone = (0,
|
|
22498
|
+
const rootRef = (0, import_react124.useRef)(null);
|
|
22499
|
+
const introDoneRef = (0, import_react124.useRef)(false);
|
|
22500
|
+
const markIntroDone = (0, import_react124.useCallback)(() => {
|
|
22469
22501
|
introDoneRef.current = true;
|
|
22470
22502
|
}, []);
|
|
22471
22503
|
const language = injectedClient ? void 0 : hostTag(cfg);
|
|
22472
22504
|
const threadLanguage = familyOf(language);
|
|
22473
22505
|
const convStorageKey = `ss-w-conv:${cfg?.operatorId ?? ""}:${cfg?.userContext?.operatorUserId ?? "anon"}${cfg?.userContext?.anonymousUserId ? `:a=${cfg.userContext.anonymousUserId}` : ""}${threadLanguage ? `:lang=${threadLanguage}` : ""}`;
|
|
22474
|
-
const sportScope = (0,
|
|
22506
|
+
const sportScope = (0, import_react124.useMemo)(
|
|
22475
22507
|
() => ({ operatorId: cfg?.operatorId ?? "", operatorUserId: cfg?.userContext?.operatorUserId, anonymousUserId: cfg?.userContext?.anonymousUserId }),
|
|
22476
22508
|
[cfg?.operatorId, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId]
|
|
22477
22509
|
);
|
|
22478
|
-
const chatTracking = (0,
|
|
22510
|
+
const chatTracking = (0, import_react124.useMemo)(() => ({ track, eventText: () => eventTextRef.current }), [track]);
|
|
22479
22511
|
const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey, cfg?.page, sportScope, language, chatTracking, injectedClient ? oddsSettings.userOddsFormat : oddsSettings.oddsFormat);
|
|
22480
22512
|
const panelOpen = controller.state.isOpen && !stringsPending;
|
|
22481
|
-
const liveCardWatches = (0,
|
|
22513
|
+
const liveCardWatches = (0, import_react124.useMemo)(() => {
|
|
22482
22514
|
const seen2 = /* @__PURE__ */ new Set();
|
|
22483
22515
|
const out = [];
|
|
22484
22516
|
for (const msg of controller.state.messages) {
|
|
@@ -22504,19 +22536,19 @@ function StatsWidget(props) {
|
|
|
22504
22536
|
});
|
|
22505
22537
|
const operatorUserId = cfg?.userContext?.operatorUserId;
|
|
22506
22538
|
const anonymousUserId = cfg?.userContext?.anonymousUserId;
|
|
22507
|
-
const getSchedule = (0,
|
|
22539
|
+
const getSchedule = (0, import_react124.useCallback)(
|
|
22508
22540
|
(localDate, utcOffsetMinutes) => built ? built.conversation.getSchedule(localDate, utcOffsetMinutes, operatorUserId, anonymousUserId) : Promise.resolve(null),
|
|
22509
22541
|
[built, operatorUserId, anonymousUserId]
|
|
22510
22542
|
);
|
|
22511
|
-
const getStates = (0,
|
|
22543
|
+
const getStates = (0, import_react124.useCallback)(
|
|
22512
22544
|
(matchIds, nbaGameIds, nflGameIds, tennisMatches) => built ? built.conversation.getStates(matchIds, nbaGameIds, nflGameIds, requestTag, tennisMatches) : Promise.resolve(null),
|
|
22513
22545
|
[built, requestTag]
|
|
22514
22546
|
);
|
|
22515
|
-
const getTennisPrices = (0,
|
|
22547
|
+
const getTennisPrices = (0, import_react124.useCallback)(
|
|
22516
22548
|
(keys) => built ? built.conversation.getStates([], [], [], requestTag, [], keys).then((p) => p?.tennisPrices ?? null) : Promise.resolve(null),
|
|
22517
22549
|
[built, requestTag]
|
|
22518
22550
|
);
|
|
22519
|
-
const pinnedMatchIds = (0,
|
|
22551
|
+
const pinnedMatchIds = (0, import_react124.useMemo)(
|
|
22520
22552
|
() => footballMatchPinIds(monitor.pins),
|
|
22521
22553
|
[monitor.pins]
|
|
22522
22554
|
);
|
|
@@ -22530,13 +22562,13 @@ function StatsWidget(props) {
|
|
|
22530
22562
|
pinnedMatchIds,
|
|
22531
22563
|
timeZone: ui.timeZone
|
|
22532
22564
|
});
|
|
22533
|
-
const offeredSports = (0,
|
|
22565
|
+
const offeredSports = (0, import_react124.useMemo)(() => {
|
|
22534
22566
|
const seen2 = new Set(discovery.matchDays.map((d) => d.sport));
|
|
22535
22567
|
for (const g of discovery.groups) seen2.add(g.sport ?? "football");
|
|
22536
22568
|
return [...seen2];
|
|
22537
22569
|
}, [discovery.matchDays, discovery.groups]);
|
|
22538
22570
|
const scheduleSport = useScheduleSport(offeredSports);
|
|
22539
|
-
const [liveLeague, setLiveLeague] = (0,
|
|
22571
|
+
const [liveLeague, setLiveLeague] = (0, import_react124.useState)(null);
|
|
22540
22572
|
const [matchesDay, setMatchesDay] = useMatchesDayPick(discovery.localDate);
|
|
22541
22573
|
const matchesLoaded = useMatchesDay({
|
|
22542
22574
|
discovery,
|
|
@@ -22546,8 +22578,8 @@ function StatsWidget(props) {
|
|
|
22546
22578
|
enabled: panelOpen && monitor.activeTab === "matches",
|
|
22547
22579
|
timeZone: ui.timeZone
|
|
22548
22580
|
});
|
|
22549
|
-
const prevLiveSnapshotRef = (0,
|
|
22550
|
-
(0,
|
|
22581
|
+
const prevLiveSnapshotRef = (0, import_react124.useRef)(monitor.snapshot);
|
|
22582
|
+
(0, import_react124.useEffect)(() => {
|
|
22551
22583
|
const snap = monitor.snapshot;
|
|
22552
22584
|
if (!snap || snap === prevLiveSnapshotRef.current) return;
|
|
22553
22585
|
prevLiveSnapshotRef.current = snap;
|
|
@@ -22587,14 +22619,14 @@ function StatsWidget(props) {
|
|
|
22587
22619
|
const clubSquadResult = useClubSquad(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
22588
22620
|
const clubSquadStatsResult = useClubSquadStats(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
22589
22621
|
const clubPlayerDetailResult = useClubPlayerDetail(built?.conversation ?? null);
|
|
22590
|
-
const [favSportPick, setFavSportPick] = (0,
|
|
22591
|
-
const latestGreeting = (0,
|
|
22622
|
+
const [favSportPick, setFavSportPick] = (0, import_react124.useState)(null);
|
|
22623
|
+
const latestGreeting = (0, import_react124.useMemo)(() => {
|
|
22592
22624
|
for (const m of [...controller.state.messages].reverse()) {
|
|
22593
22625
|
if (m.role === "assistant" && m.defaultSport !== void 0) return m;
|
|
22594
22626
|
}
|
|
22595
22627
|
return null;
|
|
22596
22628
|
}, [controller.state.messages]);
|
|
22597
|
-
const favSportOptions = (0,
|
|
22629
|
+
const favSportOptions = (0, import_react124.useMemo)(
|
|
22598
22630
|
() => (switchSets(latestGreeting?.greetingDashboards) ?? []).map((set) => ({ sport: set.sport, label: set.label })),
|
|
22599
22631
|
[latestGreeting]
|
|
22600
22632
|
);
|
|
@@ -22603,20 +22635,20 @@ function StatsWidget(props) {
|
|
|
22603
22635
|
const favSport = [favSportPick, rememberedSport, latestGreeting?.defaultSport].find(offered) ?? "football";
|
|
22604
22636
|
const favSports = favSportOptions.length > 0 ? favSportOptions : [{ sport: favSport, label: sportLabel(ui, favSport) }];
|
|
22605
22637
|
const hasFavouritesIdentity = !!(operatorUserId || anonymousUserId);
|
|
22606
|
-
const [builderSportPick, setBuilderSportPick] = (0,
|
|
22607
|
-
const builderGreeting = (0,
|
|
22638
|
+
const [builderSportPick, setBuilderSportPick] = (0, import_react124.useState)(null);
|
|
22639
|
+
const builderGreeting = (0, import_react124.useMemo)(
|
|
22608
22640
|
() => [...controller.state.messages].reverse().find((m) => m.role === "assistant" && (m.greetingDashboard !== void 0 || m.greetingDashboards !== void 0)) ?? null,
|
|
22609
22641
|
[controller.state.messages]
|
|
22610
22642
|
);
|
|
22611
|
-
const [coolOff, setCoolOff] = (0,
|
|
22612
|
-
const onBuilderCoolOff = (0,
|
|
22643
|
+
const [coolOff, setCoolOff] = (0, import_react124.useState)(null);
|
|
22644
|
+
const onBuilderCoolOff = (0, import_react124.useCallback)((sport) => {
|
|
22613
22645
|
if (!builderGreeting) return;
|
|
22614
22646
|
setCoolOff((prev) => {
|
|
22615
22647
|
const sports = prev?.greeting === builderGreeting ? prev.sports : [];
|
|
22616
22648
|
return sports.includes(sport) ? prev : { greeting: builderGreeting, sports: [...sports, sport] };
|
|
22617
22649
|
});
|
|
22618
22650
|
}, [builderGreeting]);
|
|
22619
|
-
const builderOptions = (0,
|
|
22651
|
+
const builderOptions = (0, import_react124.useMemo)(() => {
|
|
22620
22652
|
const greeting = builderGreeting;
|
|
22621
22653
|
if (!greeting) return [];
|
|
22622
22654
|
const cooled = coolOff?.greeting === greeting ? coolOff.sports : [];
|
|
@@ -22633,7 +22665,7 @@ function StatsWidget(props) {
|
|
|
22633
22665
|
return options.filter((o) => !cooled.includes(o.sport));
|
|
22634
22666
|
}, [builderGreeting, coolOff, ui]);
|
|
22635
22667
|
const builderSport = [builderSportPick, rememberedSport, latestGreeting?.defaultSport].find((s) => !!s && builderOptions.some((o) => o.sport === s)) ?? builderOptions[0]?.sport ?? "";
|
|
22636
|
-
const [panelEverOpened, setPanelEverOpened] = (0,
|
|
22668
|
+
const [panelEverOpened, setPanelEverOpened] = (0, import_react124.useState)(panelOpen);
|
|
22637
22669
|
if (panelOpen && !panelEverOpened) setPanelEverOpened(true);
|
|
22638
22670
|
const favourites = useFavourites({
|
|
22639
22671
|
conversation: built?.conversation ?? null,
|
|
@@ -22645,16 +22677,16 @@ function StatsWidget(props) {
|
|
|
22645
22677
|
onChanged: discovery.refreshSchedule
|
|
22646
22678
|
});
|
|
22647
22679
|
const favouritesEnabled = hasFavouritesIdentity && favourites.status !== "refused";
|
|
22648
|
-
const [favouritesOpen, setFavouritesOpen] = (0,
|
|
22680
|
+
const [favouritesOpen, setFavouritesOpen] = (0, import_react124.useState)(false);
|
|
22649
22681
|
if (!panelOpen && favouritesOpen) setFavouritesOpen(false);
|
|
22650
|
-
const getPricePresets = (0,
|
|
22682
|
+
const getPricePresets = (0, import_react124.useCallback)(
|
|
22651
22683
|
(locale) => built ? built.conversation.getPricePresets(locale, { pool: "open" }) : Promise.resolve(null),
|
|
22652
22684
|
[built]
|
|
22653
22685
|
);
|
|
22654
22686
|
const presetGrid = usePresetGrid({ getPricePresets, isOpen: panelOpen, locale: ui.hostTag });
|
|
22655
22687
|
const markLiveActivity = monitor.markLiveActivity;
|
|
22656
|
-
const prevLiveCountRef = (0,
|
|
22657
|
-
(0,
|
|
22688
|
+
const prevLiveCountRef = (0, import_react124.useRef)(0);
|
|
22689
|
+
(0, import_react124.useEffect)(() => {
|
|
22658
22690
|
const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
|
|
22659
22691
|
prevLiveCountRef.current = discovery.liveCount;
|
|
22660
22692
|
if (rose) markLiveActivity();
|
|
@@ -22668,7 +22700,7 @@ function StatsWidget(props) {
|
|
|
22668
22700
|
closePanel: controller.close
|
|
22669
22701
|
});
|
|
22670
22702
|
const markAdded = hostEvents.markAdded;
|
|
22671
|
-
const slip = (0,
|
|
22703
|
+
const slip = (0, import_react124.useMemo)(
|
|
22672
22704
|
() => {
|
|
22673
22705
|
const handler = props.config?.onAddToSlip;
|
|
22674
22706
|
return {
|
|
@@ -22688,7 +22720,7 @@ function StatsWidget(props) {
|
|
|
22688
22720
|
},
|
|
22689
22721
|
[props.config?.onAddToSlip, props.config?.slipSports, controller.state.conversationId, markAdded]
|
|
22690
22722
|
);
|
|
22691
|
-
const onDashboardTap = (0,
|
|
22723
|
+
const onDashboardTap = (0, import_react124.useMemo)(
|
|
22692
22724
|
() => built ? createDashboardTapSignal((input) => built.conversation.sendSignal(input), logger) : void 0,
|
|
22693
22725
|
[built, logger]
|
|
22694
22726
|
);
|
|
@@ -22702,21 +22734,22 @@ function StatsWidget(props) {
|
|
|
22702
22734
|
log: logger
|
|
22703
22735
|
})
|
|
22704
22736
|
}));
|
|
22705
|
-
const dismissPopupRef = (0,
|
|
22737
|
+
const dismissPopupRef = (0, import_react124.useRef)(() => {
|
|
22706
22738
|
});
|
|
22707
|
-
const onCtaRef = (0,
|
|
22739
|
+
const onCtaRef = (0, import_react124.useRef)(() => {
|
|
22708
22740
|
});
|
|
22709
|
-
const onTeaserTapRef = (0,
|
|
22741
|
+
const onTeaserTapRef = (0, import_react124.useRef)(() => {
|
|
22710
22742
|
});
|
|
22711
22743
|
const bubble = controller.state.greetingBubble;
|
|
22712
22744
|
const bubblePrice = !stringsPending && controller.state.popupText && bubble?.price && bubble.matchId ? { matchId: bubble.matchId, price: bubble.price, sport: bubble.sport } : null;
|
|
22713
22745
|
const bubbleGame = !stringsPending && controller.state.popupText && bubble?.game ? instantMs(bubble.startsAtUtc) === null ? bubble.game : ui.v2GameLine(bubble.game, bubble.startsAtUtc) : void 0;
|
|
22714
22746
|
const bubbleCta = controller.state.popupText ? controller.state.greetingBubble?.cta ?? null : null;
|
|
22715
|
-
const onTeaserRef = (0,
|
|
22747
|
+
const onTeaserRef = (0, import_react124.useRef)(cfg?.onTeaser);
|
|
22716
22748
|
onTeaserRef.current = cfg?.onTeaser;
|
|
22717
22749
|
const wantsTeaser = cfg?.launcher === false || cfg?.onTeaser !== void 0;
|
|
22718
|
-
const webBinding = (0,
|
|
22750
|
+
const webBinding = (0, import_react124.useMemo)(() => wantsTeaser ? webTeaserBinding(props.host, (teaser2) => onTeaserRef.current?.(teaser2), cfg?.launcher === false) : void 0, [wantsTeaser, props.host, cfg?.launcher]);
|
|
22719
22751
|
const hostDrawsLauncher = props.mobile !== void 0 || cfg?.launcher === false;
|
|
22752
|
+
const resolvedTheme = useResolvedTheme(oddsSettings.userTheme ?? ui.theme);
|
|
22720
22753
|
const mobile = useMobileBinding({
|
|
22721
22754
|
binding: props.mobile ?? webBinding,
|
|
22722
22755
|
panelOpen,
|
|
@@ -22733,21 +22766,23 @@ function StatsWidget(props) {
|
|
|
22733
22766
|
asks,
|
|
22734
22767
|
open: controller.open,
|
|
22735
22768
|
close: controller.close,
|
|
22736
|
-
dismissPopup: () => dismissPopupRef.current()
|
|
22769
|
+
dismissPopup: () => dismissPopupRef.current(),
|
|
22770
|
+
labels: stringsPending ? null : { launcher: ui.launcherLabel, dismiss: ui.dismissGreeting },
|
|
22771
|
+
theme: resolvedTheme
|
|
22737
22772
|
});
|
|
22738
22773
|
const dismissPopup = usePopupTelemetry(logger, panelOpen, controller.state.popupText, controller.dismissPopup, hostDrawsLauncher ? mobile.confirmedShown : void 0);
|
|
22739
22774
|
dismissPopupRef.current = dismissPopup;
|
|
22740
22775
|
const greetingMeta = latestGreetingMeta(controller.state.messages);
|
|
22741
22776
|
useBubbleGreetingShown(logger, logger ?? NO_OWNER, controller.state.popupText, greetingMeta, hostDrawsLauncher ? mobile.confirmedShown : void 0);
|
|
22742
|
-
const [highlight, setHighlight] = (0,
|
|
22743
|
-
const clearHighlight = (0,
|
|
22744
|
-
(0,
|
|
22777
|
+
const [highlight, setHighlight] = (0, import_react124.useState)(null);
|
|
22778
|
+
const clearHighlight = (0, import_react124.useCallback)(() => setHighlight(null), []);
|
|
22779
|
+
(0, import_react124.useEffect)(() => {
|
|
22745
22780
|
if (!panelOpen) setHighlight(null);
|
|
22746
22781
|
}, [panelOpen]);
|
|
22747
|
-
const highlightRequest = (0,
|
|
22782
|
+
const highlightRequest = (0, import_react124.useMemo)(() => highlight ? { ...highlight, clear: clearHighlight } : null, [highlight, clearHighlight]);
|
|
22748
22783
|
const { open: openFromCta, state: { greetingBubble } } = controller;
|
|
22749
22784
|
const setTab = monitor.setActiveTab;
|
|
22750
|
-
const logCtaClick = (0,
|
|
22785
|
+
const logCtaClick = (0, import_react124.useCallback)(() => {
|
|
22751
22786
|
if (!logger || !greetingMeta) return;
|
|
22752
22787
|
logger.log({ name: "greeting_cta_click", greeting: { greetingId: greetingMeta.greetingId, case: greetingMeta.case, sport: greetingMeta.sport, market: greetingMeta.market ?? null } });
|
|
22753
22788
|
}, [logger, greetingMeta]);
|
|
@@ -22764,12 +22799,12 @@ function StatsWidget(props) {
|
|
|
22764
22799
|
if (!bubbleCta) logCtaClick();
|
|
22765
22800
|
openFromCta();
|
|
22766
22801
|
};
|
|
22767
|
-
const onCta = (0,
|
|
22802
|
+
const onCta = (0, import_react124.useCallback)(() => onCtaRef.current(), []);
|
|
22768
22803
|
useOpenTelemetry(logger, panelOpen);
|
|
22769
|
-
const onControlRef = (0,
|
|
22804
|
+
const onControlRef = (0, import_react124.useRef)(props.onControl);
|
|
22770
22805
|
onControlRef.current = props.onControl;
|
|
22771
22806
|
const { open: openPanel, close: closePanel } = controller;
|
|
22772
|
-
(0,
|
|
22807
|
+
(0, import_react124.useEffect)(() => {
|
|
22773
22808
|
onControlRef.current?.({ open: openPanel, close: closePanel });
|
|
22774
22809
|
return () => onControlRef.current?.(null);
|
|
22775
22810
|
}, [openPanel, closePanel]);
|
|
@@ -22786,11 +22821,11 @@ function StatsWidget(props) {
|
|
|
22786
22821
|
page: cfg?.page
|
|
22787
22822
|
}
|
|
22788
22823
|
};
|
|
22789
|
-
(0,
|
|
22824
|
+
(0, import_react124.useEffect)(() => {
|
|
22790
22825
|
if (!logger) return;
|
|
22791
22826
|
logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
|
|
22792
22827
|
}, [logger, operatorUserId, anonymousUserId, conversationId]);
|
|
22793
|
-
(0,
|
|
22828
|
+
(0, import_react124.useEffect)(() => {
|
|
22794
22829
|
if (!logger) return;
|
|
22795
22830
|
logger.resume();
|
|
22796
22831
|
const onHide = () => {
|
|
@@ -22808,15 +22843,15 @@ function StatsWidget(props) {
|
|
|
22808
22843
|
logger.dispose();
|
|
22809
22844
|
};
|
|
22810
22845
|
}, [logger]);
|
|
22811
|
-
(0,
|
|
22846
|
+
(0, import_react124.useEffect)(() => {
|
|
22812
22847
|
if (!built || !ui.injectStyles || widgetStrings.state === "unavailable") return;
|
|
22813
22848
|
const node = rootRef.current?.getRootNode();
|
|
22814
22849
|
if (node) injectStyles(node);
|
|
22815
22850
|
}, [built, ui.injectStyles, widgetStrings.state]);
|
|
22816
22851
|
const holds = useSessionHolds();
|
|
22817
22852
|
const builderConversation = built?.conversation ?? null;
|
|
22818
|
-
const builderMemory = (0,
|
|
22819
|
-
const personalGreeting = (0,
|
|
22853
|
+
const builderMemory = (0, import_react124.useMemo)(() => createBuilderMemory(), [builderConversation, controller.state.threadEpoch]);
|
|
22854
|
+
const personalGreeting = (0, import_react124.useMemo)(() => ({
|
|
22820
22855
|
favourites: favouritesEnabled && monitor.enabled ? favourites : null,
|
|
22821
22856
|
conversation: built?.conversation ?? null,
|
|
22822
22857
|
openFavourites: () => setFavouritesOpen(true),
|