@sensiblestats/widget-react 0.131.0 → 0.133.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 +465 -351
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -4
- package/dist/index.d.ts +34 -4
- package/dist/index.js +420 -307
- package/dist/index.js.map +1 -1
- package/dist/styles.css +12 -5
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -32,12 +32,13 @@ var index_exports = {};
|
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
StatsWidget: () => StatsWidget,
|
|
34
34
|
WIDGET_CSS: () => WIDGET_CSS,
|
|
35
|
+
WIDGET_REACT_VERSION: () => WIDGET_REACT_VERSION,
|
|
35
36
|
createWidgetHost: () => createWidgetHost
|
|
36
37
|
});
|
|
37
38
|
module.exports = __toCommonJS(index_exports);
|
|
38
39
|
|
|
39
40
|
// src/StatsWidget.tsx
|
|
40
|
-
var
|
|
41
|
+
var import_react104 = require("react");
|
|
41
42
|
var import_widget_sdk38 = require("@sensiblestats/widget-sdk");
|
|
42
43
|
|
|
43
44
|
// src/strings/tag.ts
|
|
@@ -1323,7 +1324,7 @@ function parseOddsFormat(value) {
|
|
|
1323
1324
|
}
|
|
1324
1325
|
|
|
1325
1326
|
// src/version.generated.ts
|
|
1326
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1327
|
+
var WIDGET_REACT_VERSION = "0.133.0";
|
|
1327
1328
|
|
|
1328
1329
|
// src/config.ts
|
|
1329
1330
|
function hostTag(cfg) {
|
|
@@ -1688,8 +1689,9 @@ function normalizeUi(cfg, loaded) {
|
|
|
1688
1689
|
};
|
|
1689
1690
|
}
|
|
1690
1691
|
function toClientOptions(cfg) {
|
|
1691
|
-
const opts = { operatorId: cfg.operatorId, publicKey: cfg.publicKey, client:
|
|
1692
|
+
const opts = { operatorId: cfg.operatorId, publicKey: cfg.publicKey, client: `${cfg.transport?.client ?? "widget-react"}/${WIDGET_REACT_VERSION}` };
|
|
1692
1693
|
if (cfg.baseUrl !== void 0) opts.baseUrl = cfg.baseUrl;
|
|
1694
|
+
if (cfg.transport?.fetch !== void 0) opts.fetch = cfg.transport.fetch;
|
|
1693
1695
|
return opts;
|
|
1694
1696
|
}
|
|
1695
1697
|
function toUserContext(cfg) {
|
|
@@ -1885,7 +1887,9 @@ function readStatCells(raw) {
|
|
|
1885
1887
|
for (const entry of raw) {
|
|
1886
1888
|
const label = str(entry.label);
|
|
1887
1889
|
const value = num(entry.value) ?? str(entry.value);
|
|
1888
|
-
if (label
|
|
1890
|
+
if (label === void 0 || value === void 0) continue;
|
|
1891
|
+
const note = str(entry.note);
|
|
1892
|
+
cells.push({ label, value, ...note !== void 0 ? { note } : {}, ...entry.muted === true ? { muted: true } : {} });
|
|
1889
1893
|
}
|
|
1890
1894
|
return cells;
|
|
1891
1895
|
}
|
|
@@ -1899,6 +1903,7 @@ function toCardVM(card) {
|
|
|
1899
1903
|
competitionId: typeof s.competitionId === "number" ? s.competitionId : null,
|
|
1900
1904
|
label,
|
|
1901
1905
|
image: str(s.imagePath),
|
|
1906
|
+
period: str(s.period),
|
|
1902
1907
|
stats: readStatCells(s.stats)
|
|
1903
1908
|
};
|
|
1904
1909
|
}).filter((s) => s !== null) : [];
|
|
@@ -1909,6 +1914,7 @@ function toCardVM(card) {
|
|
|
1909
1914
|
image: str(card.imagePath) ?? str(card.imageUrl) ?? str(card.image_url) ?? str(card.logoUrl) ?? str(card.logo),
|
|
1910
1915
|
sub: str(card.subtitle) ?? str(card.teamName) ?? str(card.leagueName) ?? str(card.position),
|
|
1911
1916
|
season: str(card.seasonName),
|
|
1917
|
+
chip: str(card.chip),
|
|
1912
1918
|
scopes
|
|
1913
1919
|
};
|
|
1914
1920
|
}
|
|
@@ -7466,7 +7472,7 @@ var WIRE_TO_PUBLIC = {
|
|
|
7466
7472
|
|
|
7467
7473
|
// src/popupTelemetry.ts
|
|
7468
7474
|
var import_react41 = require("react");
|
|
7469
|
-
function usePopupTelemetry(log, isOpen, popupText, dismissPopup) {
|
|
7475
|
+
function usePopupTelemetry(log, isOpen, popupText, dismissPopup, confirmedShown) {
|
|
7470
7476
|
const shownRef = (0, import_react41.useRef)(/* @__PURE__ */ new Set());
|
|
7471
7477
|
const closedTextRef = (0, import_react41.useRef)(null);
|
|
7472
7478
|
(0, import_react41.useEffect)(() => {
|
|
@@ -7475,23 +7481,70 @@ function usePopupTelemetry(log, isOpen, popupText, dismissPopup) {
|
|
|
7475
7481
|
closedTextRef.current = null;
|
|
7476
7482
|
return;
|
|
7477
7483
|
}
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
|
|
7484
|
+
const text2 = confirmedShown === void 0 || confirmedShown === popupText ? popupText : null;
|
|
7485
|
+
closedTextRef.current = text2;
|
|
7486
|
+
if (text2 && !shownRef.current.has(text2)) {
|
|
7487
|
+
shownRef.current.add(text2);
|
|
7481
7488
|
log?.log({ name: "popup_shown" });
|
|
7482
7489
|
}
|
|
7483
|
-
}, [log, isOpen, popupText]);
|
|
7490
|
+
}, [log, isOpen, popupText, confirmedShown]);
|
|
7484
7491
|
return (0, import_react41.useCallback)(() => {
|
|
7485
7492
|
log?.log({ name: "popup_dismissed" });
|
|
7486
7493
|
dismissPopup();
|
|
7487
7494
|
}, [log, dismissPopup]);
|
|
7488
7495
|
}
|
|
7489
7496
|
|
|
7490
|
-
// src/
|
|
7497
|
+
// src/mobileBinding.ts
|
|
7491
7498
|
var import_react42 = require("react");
|
|
7492
|
-
|
|
7493
|
-
|
|
7499
|
+
var CLEARED = { text: null, asks: [] };
|
|
7500
|
+
function useMobileBinding(args) {
|
|
7501
|
+
const { binding, panelOpen, popupText, asks } = args;
|
|
7502
|
+
const latest = (0, import_react42.useRef)(args);
|
|
7503
|
+
latest.current = args;
|
|
7504
|
+
const bindingRef = (0, import_react42.useRef)(binding);
|
|
7505
|
+
bindingRef.current = binding;
|
|
7506
|
+
const backRef = (0, import_react42.useRef)(null);
|
|
7507
|
+
const [confirmedShown, setConfirmedShown] = (0, import_react42.useState)(null);
|
|
7508
|
+
const teaserKey = panelOpen || !popupText ? "" : JSON.stringify([popupText, asks.map((a) => a.label)]);
|
|
7509
|
+
const reported = (0, import_react42.useRef)({ binding: void 0, key: "" });
|
|
7510
|
+
(0, import_react42.useEffect)(() => {
|
|
7511
|
+
if (!binding) return;
|
|
7512
|
+
const prev = reported.current;
|
|
7513
|
+
if (prev.binding === binding && prev.key === teaserKey) return;
|
|
7514
|
+
reported.current = { binding, key: teaserKey };
|
|
7515
|
+
if (teaserKey === "" && prev.binding !== binding) return;
|
|
7516
|
+
binding.onTeaser(teaserKey === "" ? CLEARED : { text: popupText, asks: asks.map((a, index) => ({ index, label: a.label })) });
|
|
7517
|
+
}, [binding, teaserKey]);
|
|
7494
7518
|
(0, import_react42.useEffect)(() => {
|
|
7519
|
+
if (!binding) return;
|
|
7520
|
+
binding.onHandle({
|
|
7521
|
+
open: () => latest.current.open(),
|
|
7522
|
+
close: () => latest.current.close(),
|
|
7523
|
+
tapAsk: (index) => {
|
|
7524
|
+
const { asks: current, open } = latest.current;
|
|
7525
|
+
if (!Number.isInteger(index) || index < 0 || index >= current.length) return;
|
|
7526
|
+
open();
|
|
7527
|
+
current[index].onTap();
|
|
7528
|
+
},
|
|
7529
|
+
dismissTeaser: () => latest.current.dismissPopup(),
|
|
7530
|
+
teaserShown: () => setConfirmedShown(latest.current.popupText),
|
|
7531
|
+
back: () => backRef.current?.() ?? false
|
|
7532
|
+
});
|
|
7533
|
+
return () => binding.onHandle(null);
|
|
7534
|
+
}, [binding]);
|
|
7535
|
+
const onCloseRequested = (0, import_react42.useCallback)(() => bindingRef.current?.onCloseRequested(), []);
|
|
7536
|
+
const onRegisterBack = (0, import_react42.useCallback)((fn) => {
|
|
7537
|
+
backRef.current = fn;
|
|
7538
|
+
}, []);
|
|
7539
|
+
if (!binding) return { confirmedShown: void 0, onCloseRequested: void 0, onRegisterBack: void 0 };
|
|
7540
|
+
return { confirmedShown, onCloseRequested, onRegisterBack };
|
|
7541
|
+
}
|
|
7542
|
+
|
|
7543
|
+
// src/openTelemetry.ts
|
|
7544
|
+
var import_react43 = require("react");
|
|
7545
|
+
function useOpenTelemetry(log, isOpen) {
|
|
7546
|
+
const openLoggedRef = (0, import_react43.useRef)(false);
|
|
7547
|
+
(0, import_react43.useEffect)(() => {
|
|
7495
7548
|
if (!isOpen) {
|
|
7496
7549
|
openLoggedRef.current = false;
|
|
7497
7550
|
return;
|
|
@@ -7503,13 +7556,13 @@ function useOpenTelemetry(log, isOpen) {
|
|
|
7503
7556
|
}
|
|
7504
7557
|
|
|
7505
7558
|
// src/components/ChatFab.tsx
|
|
7506
|
-
var
|
|
7559
|
+
var import_react45 = require("react");
|
|
7507
7560
|
|
|
7508
7561
|
// src/components/BrandMark.tsx
|
|
7509
|
-
var
|
|
7562
|
+
var import_react44 = require("react");
|
|
7510
7563
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
7511
7564
|
function BrandMark({ logoUrl, className }) {
|
|
7512
|
-
const [failed, setFailed] = (0,
|
|
7565
|
+
const [failed, setFailed] = (0, import_react44.useState)(false);
|
|
7513
7566
|
if (!logoUrl || failed) return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(SsMark, { className });
|
|
7514
7567
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("img", { className, src: logoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
7515
7568
|
}
|
|
@@ -7547,9 +7600,9 @@ function ChatFab({ label, busy = false, greeting, popupText, logoUrl, onOpen, on
|
|
|
7547
7600
|
const bubble = popupText ?? greeting;
|
|
7548
7601
|
const hidden = busy && !label;
|
|
7549
7602
|
const track = useTrack();
|
|
7550
|
-
const [intro, setIntro] = (0,
|
|
7551
|
-
const armedRef = (0,
|
|
7552
|
-
(0,
|
|
7603
|
+
const [intro, setIntro] = (0, import_react45.useState)(false);
|
|
7604
|
+
const armedRef = (0, import_react45.useRef)(introAllowed);
|
|
7605
|
+
(0, import_react45.useEffect)(() => {
|
|
7553
7606
|
if (armedRef.current && bubble) {
|
|
7554
7607
|
armedRef.current = false;
|
|
7555
7608
|
setIntro(true);
|
|
@@ -7569,10 +7622,10 @@ function ChatFab({ label, busy = false, greeting, popupText, logoUrl, onOpen, on
|
|
|
7569
7622
|
}
|
|
7570
7623
|
|
|
7571
7624
|
// src/components/ChatPanel.tsx
|
|
7572
|
-
var
|
|
7625
|
+
var import_react103 = require("react");
|
|
7573
7626
|
|
|
7574
7627
|
// src/components/ChatHeader.tsx
|
|
7575
|
-
var
|
|
7628
|
+
var import_react46 = require("react");
|
|
7576
7629
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
7577
7630
|
function ChatHeader({
|
|
7578
7631
|
onClose,
|
|
@@ -7586,20 +7639,20 @@ function ChatHeader({
|
|
|
7586
7639
|
onOpenSettings,
|
|
7587
7640
|
settingsLabel
|
|
7588
7641
|
}) {
|
|
7589
|
-
const [menuOpen, setMenuOpen] = (0,
|
|
7590
|
-
const wrapRef = (0,
|
|
7591
|
-
const kebabRef = (0,
|
|
7592
|
-
const firstItemRef = (0,
|
|
7642
|
+
const [menuOpen, setMenuOpen] = (0, import_react46.useState)(false);
|
|
7643
|
+
const wrapRef = (0, import_react46.useRef)(null);
|
|
7644
|
+
const kebabRef = (0, import_react46.useRef)(null);
|
|
7645
|
+
const firstItemRef = (0, import_react46.useRef)(null);
|
|
7593
7646
|
const hasNew = !!(canReset && onNewConversation);
|
|
7594
7647
|
const hasSettings = !!onOpenSettings;
|
|
7595
7648
|
const hasMenu = hasNew || hasSettings;
|
|
7596
|
-
(0,
|
|
7649
|
+
(0, import_react46.useEffect)(() => {
|
|
7597
7650
|
if (menuOpen) firstItemRef.current?.focus();
|
|
7598
7651
|
}, [menuOpen]);
|
|
7599
|
-
(0,
|
|
7652
|
+
(0, import_react46.useEffect)(() => {
|
|
7600
7653
|
if (!menuOpen) return;
|
|
7601
7654
|
const onPointer = (e) => {
|
|
7602
|
-
if (!wrapRef.current
|
|
7655
|
+
if (!(wrapRef.current && e.composedPath().includes(wrapRef.current))) setMenuOpen(false);
|
|
7603
7656
|
};
|
|
7604
7657
|
const onKey = (e) => {
|
|
7605
7658
|
if (e.key === "Escape") {
|
|
@@ -7669,10 +7722,10 @@ function ChatHeader({
|
|
|
7669
7722
|
}
|
|
7670
7723
|
|
|
7671
7724
|
// src/components/MessageList.tsx
|
|
7672
|
-
var
|
|
7725
|
+
var import_react59 = require("react");
|
|
7673
7726
|
|
|
7674
7727
|
// src/components/ChatMessage.tsx
|
|
7675
|
-
var
|
|
7728
|
+
var import_react58 = require("react");
|
|
7676
7729
|
|
|
7677
7730
|
// src/components/Markdown.tsx
|
|
7678
7731
|
var import_react_markdown = __toESM(require("react-markdown"), 1);
|
|
@@ -7690,7 +7743,7 @@ function Markdown({ text: text2 }) {
|
|
|
7690
7743
|
}
|
|
7691
7744
|
|
|
7692
7745
|
// src/components/EntityCardList.tsx
|
|
7693
|
-
var
|
|
7746
|
+
var import_react47 = require("react");
|
|
7694
7747
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
7695
7748
|
var MAX_VISIBLE = 3;
|
|
7696
7749
|
var RECORD_RE = /^(\d+)-(\d+)-(\d+)$/;
|
|
@@ -7718,23 +7771,34 @@ function FormBar({ w, d, l }) {
|
|
|
7718
7771
|
l > 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "ss-w-form-l", style: { flexGrow: l } }) : null
|
|
7719
7772
|
] });
|
|
7720
7773
|
}
|
|
7774
|
+
function cellClass(s) {
|
|
7775
|
+
return s.muted ? "ss-w-ecard-cell ss-w-ecard-cell--muted" : "ss-w-ecard-cell";
|
|
7776
|
+
}
|
|
7721
7777
|
function StatCellView({ s }) {
|
|
7722
7778
|
const m = RECORD_RE.exec(s.value);
|
|
7723
7779
|
if (m) {
|
|
7724
|
-
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className:
|
|
7780
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: cellClass(s), children: [
|
|
7725
7781
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "ss-w-ecard-cval", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(FormBar, { w: Number(m[1]), d: Number(m[2]), l: Number(m[3]) }) }),
|
|
7726
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "ss-w-ecard-clabel", children: s.value })
|
|
7782
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "ss-w-ecard-clabel", children: s.value }),
|
|
7783
|
+
s.note ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "ss-w-ecard-note", children: s.note }) : null
|
|
7727
7784
|
] });
|
|
7728
7785
|
}
|
|
7729
|
-
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className:
|
|
7786
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: cellClass(s), children: [
|
|
7730
7787
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "ss-w-ecard-cval", children: s.value }),
|
|
7731
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "ss-w-ecard-clabel", children: s.label })
|
|
7788
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "ss-w-ecard-clabel", children: s.label }),
|
|
7789
|
+
s.note ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "ss-w-ecard-note", children: s.note }) : null
|
|
7732
7790
|
] });
|
|
7733
7791
|
}
|
|
7792
|
+
function stripClass(stats) {
|
|
7793
|
+
const noted = stats.some((s) => s.note);
|
|
7794
|
+
return ["ss-w-ecard-strip", noted ? "ss-w-ecard-strip--noted" : "", stats.length > 6 ? "ss-w-ecard-strip--more" : ""].filter(Boolean).join(" ");
|
|
7795
|
+
}
|
|
7734
7796
|
function StatStrip({ stats }) {
|
|
7735
7797
|
if (stats.length === 0) return null;
|
|
7736
|
-
|
|
7737
|
-
|
|
7798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: stripClass(stats), style: { gridTemplateColumns: "repeat(3, minmax(0, 1fr))" }, children: [
|
|
7799
|
+
stats.map((s) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(StatCellView, { s }, s.label + s.value)),
|
|
7800
|
+
Array.from({ length: (3 - stats.length % 3) % 3 }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "ss-w-ecard-cell", "aria-hidden": "true" }, `pad${i}`))
|
|
7801
|
+
] });
|
|
7738
7802
|
}
|
|
7739
7803
|
function CardHeader({ c, showScopeCrest }) {
|
|
7740
7804
|
const onlyScope = c.scopes.length === 1 ? c.scopes[0] : null;
|
|
@@ -7753,6 +7817,7 @@ function CardHeader({ c, showScopeCrest }) {
|
|
|
7753
7817
|
] }),
|
|
7754
7818
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "ss-w-ecard-meta", children: [
|
|
7755
7819
|
showScopeCrest && onlyScope?.image ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Crest2, { image: onlyScope.image, label: onlyScope.label }) : null,
|
|
7820
|
+
c.chip ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "ss-w-ecard-chip", children: c.chip }) : null,
|
|
7756
7821
|
c.season ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "ss-w-ecard-season", children: shortSeason(c.season) }) : null
|
|
7757
7822
|
] })
|
|
7758
7823
|
] });
|
|
@@ -7774,7 +7839,7 @@ function ScopeTabs({ scopes, active, onSelect }) {
|
|
|
7774
7839
|
)) });
|
|
7775
7840
|
}
|
|
7776
7841
|
function EntityCardItem({ c }) {
|
|
7777
|
-
const [active, setActive] = (0,
|
|
7842
|
+
const [active, setActive] = (0, import_react47.useState)(0);
|
|
7778
7843
|
const hasBody = c.scopes.length > 0;
|
|
7779
7844
|
if (!hasBody) {
|
|
7780
7845
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "ss-w-ecard ss-w-ecard-bare", "data-kind": c.kind, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CardHeader, { c, showScopeCrest: false }) });
|
|
@@ -7784,11 +7849,12 @@ function EntityCardItem({ c }) {
|
|
|
7784
7849
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "ss-w-ecard", "data-kind": c.kind, children: [
|
|
7785
7850
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CardHeader, { c, showScopeCrest: !multi }),
|
|
7786
7851
|
multi ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ScopeTabs, { scopes: c.scopes, active, onSelect: setActive }) : null,
|
|
7787
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(StatStrip, { stats: scope.stats })
|
|
7852
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(StatStrip, { stats: scope.stats }),
|
|
7853
|
+
scope.period ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "ss-w-ecard-period", children: scope.period }) : null
|
|
7788
7854
|
] });
|
|
7789
7855
|
}
|
|
7790
7856
|
function EntityCardList({ cards, disabled, showLessLabel, showMoreLabel }) {
|
|
7791
|
-
const [expanded, setExpanded] = (0,
|
|
7857
|
+
const [expanded, setExpanded] = (0, import_react47.useState)(false);
|
|
7792
7858
|
if (cards.length === 0) return null;
|
|
7793
7859
|
const visible = expanded ? cards : cards.slice(0, MAX_VISIBLE);
|
|
7794
7860
|
const overflow = cards.length - MAX_VISIBLE;
|
|
@@ -7889,17 +7955,17 @@ function BettingInsightList({ insights, ui, slip, monitor }) {
|
|
|
7889
7955
|
}
|
|
7890
7956
|
|
|
7891
7957
|
// src/components/AddAllToSlipButton.tsx
|
|
7892
|
-
var
|
|
7958
|
+
var import_react48 = require("react");
|
|
7893
7959
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
7894
7960
|
function AddAllToSlipButton({ legs, slip, ui, labels, combo, chatCombo, sizeless, hold, onStartedGame }) {
|
|
7895
7961
|
const add = useSlipAdd(slip, ui);
|
|
7896
7962
|
const slipState = useSlipState();
|
|
7897
7963
|
const log = useEventLog();
|
|
7898
7964
|
const track = useTrack();
|
|
7899
|
-
const [pending, setPending] = (0,
|
|
7900
|
-
const [settledLocal, setSettledLocal] = (0,
|
|
7901
|
-
const [toast, setToast] = (0,
|
|
7902
|
-
const dismiss = (0,
|
|
7965
|
+
const [pending, setPending] = (0, import_react48.useState)(false);
|
|
7966
|
+
const [settledLocal, setSettledLocal] = (0, import_react48.useState)({});
|
|
7967
|
+
const [toast, setToast] = (0, import_react48.useState)(null);
|
|
7968
|
+
const dismiss = (0, import_react48.useCallback)(() => setToast(null), []);
|
|
7903
7969
|
if (!slip.onAddToSlip || legs.length < 2) return null;
|
|
7904
7970
|
const settled = slipState ? slipState.settled : settledLocal;
|
|
7905
7971
|
const open = legs.filter((leg) => !settled[slipKey(leg)]);
|
|
@@ -7972,10 +8038,10 @@ function AddAllToSlipButton({ legs, slip, ui, labels, combo, chatCombo, sizeless
|
|
|
7972
8038
|
}
|
|
7973
8039
|
|
|
7974
8040
|
// src/presetToolsContext.ts
|
|
7975
|
-
var
|
|
7976
|
-
var PresetToolsContext = (0,
|
|
8041
|
+
var import_react49 = require("react");
|
|
8042
|
+
var PresetToolsContext = (0, import_react49.createContext)(null);
|
|
7977
8043
|
function usePresetTools() {
|
|
7978
|
-
return (0,
|
|
8044
|
+
return (0, import_react49.useContext)(PresetToolsContext);
|
|
7979
8045
|
}
|
|
7980
8046
|
|
|
7981
8047
|
// src/components/ComboCardList.tsx
|
|
@@ -9209,7 +9275,7 @@ function TennisInsightList({ insights, ui }) {
|
|
|
9209
9275
|
}
|
|
9210
9276
|
|
|
9211
9277
|
// src/components/CompactOddsList.tsx
|
|
9212
|
-
var
|
|
9278
|
+
var import_react50 = require("react");
|
|
9213
9279
|
var import_widget_sdk23 = require("@sensiblestats/widget-sdk");
|
|
9214
9280
|
|
|
9215
9281
|
// src/compactList.ts
|
|
@@ -9331,11 +9397,11 @@ function Row({ row, columns, ui, slip, monitor, rowRef }) {
|
|
|
9331
9397
|
] });
|
|
9332
9398
|
}
|
|
9333
9399
|
function CompactOddsList({ list, ui, slip, monitor }) {
|
|
9334
|
-
const [shown2, setShown] = (0,
|
|
9400
|
+
const [shown2, setShown] = (0, import_react50.useState)(COMPACT_PAGE);
|
|
9335
9401
|
const hidden = list.rowCount - shown2;
|
|
9336
|
-
const [focusIndex, setFocusIndex] = (0,
|
|
9337
|
-
const focusRef = (0,
|
|
9338
|
-
(0,
|
|
9402
|
+
const [focusIndex, setFocusIndex] = (0, import_react50.useState)(null);
|
|
9403
|
+
const focusRef = (0, import_react50.useRef)(null);
|
|
9404
|
+
(0, import_react50.useEffect)(() => {
|
|
9339
9405
|
if (focusIndex !== null) focusRef.current?.focus();
|
|
9340
9406
|
}, [focusIndex]);
|
|
9341
9407
|
let left = shown2;
|
|
@@ -9570,7 +9636,7 @@ function FixtureCard({ card, ui }) {
|
|
|
9570
9636
|
}
|
|
9571
9637
|
|
|
9572
9638
|
// src/components/dashboard/CountdownCard.tsx
|
|
9573
|
-
var
|
|
9639
|
+
var import_react51 = require("react");
|
|
9574
9640
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
9575
9641
|
var DAY_MS3 = 864e5;
|
|
9576
9642
|
function remainingSegments(kickoffUnix, nowMs, withSeconds) {
|
|
@@ -9589,12 +9655,12 @@ function remainingSegments(kickoffUnix, nowMs, withSeconds) {
|
|
|
9589
9655
|
function CountdownCard({ card, ui }) {
|
|
9590
9656
|
const { data } = card;
|
|
9591
9657
|
const unitLabel = { d: data.daysUnit, h: data.hoursUnit, m: data.minutesUnit, s: data.secondsUnit };
|
|
9592
|
-
const [nowMs, setNowMs] = (0,
|
|
9593
|
-
const [reduced] = (0,
|
|
9658
|
+
const [nowMs, setNowMs] = (0, import_react51.useState)(() => Date.now());
|
|
9659
|
+
const [reduced] = (0, import_react51.useState)(
|
|
9594
9660
|
() => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
|
9595
9661
|
);
|
|
9596
9662
|
const withinDay = data.kickoffUnix * 1e3 - nowMs < DAY_MS3;
|
|
9597
|
-
(0,
|
|
9663
|
+
(0, import_react51.useEffect)(() => {
|
|
9598
9664
|
if (reduced) return;
|
|
9599
9665
|
const id = window.setInterval(() => setNowMs(Date.now()), withinDay ? 1e3 : 6e4);
|
|
9600
9666
|
return () => window.clearInterval(id);
|
|
@@ -9602,7 +9668,7 @@ function CountdownCard({ card, ui }) {
|
|
|
9602
9668
|
const segments = remainingSegments(data.kickoffUnix, nowMs, withinDay && !reduced);
|
|
9603
9669
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "ss-w-fandash-card ss-w-fandash-countdown", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "ss-w-fandash-countdown-top", children: [
|
|
9604
9670
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "ss-w-fandash-eyebrow", children: card.title ?? ui.countdownTitle }),
|
|
9605
|
-
segments ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "ss-w-fandash-countdown-clock", children: segments.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
9671
|
+
segments ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "ss-w-fandash-countdown-clock", children: segments.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_react51.Fragment, { children: [
|
|
9606
9672
|
i > 0 ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "ss-w-fandash-countdown-colon", children: ":" }) : null,
|
|
9607
9673
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "ss-w-fandash-countdown-seg", children: [
|
|
9608
9674
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "ss-w-fandash-countdown-value", children: s.value }),
|
|
@@ -9613,7 +9679,7 @@ function CountdownCard({ card, ui }) {
|
|
|
9613
9679
|
}
|
|
9614
9680
|
|
|
9615
9681
|
// src/components/dashboard/InjuriesCard.tsx
|
|
9616
|
-
var
|
|
9682
|
+
var import_react52 = require("react");
|
|
9617
9683
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
9618
9684
|
var SHOWN = 3;
|
|
9619
9685
|
function ColHead({ name, crestUrl }) {
|
|
@@ -9636,7 +9702,7 @@ function InjuryList({ rows, emptyLabel, limit }) {
|
|
|
9636
9702
|
}
|
|
9637
9703
|
function InjuriesCard({ card, ui }) {
|
|
9638
9704
|
const { data } = card;
|
|
9639
|
-
const [expanded, setExpanded] = (0,
|
|
9705
|
+
const [expanded, setExpanded] = (0, import_react52.useState)(false);
|
|
9640
9706
|
const hidden = Math.max(0, data.ours.length - SHOWN) + Math.max(0, data.theirs.length - SHOWN);
|
|
9641
9707
|
const limit = expanded ? void 0 : SHOWN;
|
|
9642
9708
|
const { showMore, showLess } = ui;
|
|
@@ -9741,7 +9807,7 @@ function LinksCard({ card }) {
|
|
|
9741
9807
|
}
|
|
9742
9808
|
|
|
9743
9809
|
// src/components/dashboard/PostMatchResultCard.tsx
|
|
9744
|
-
var
|
|
9810
|
+
var import_react53 = require("react");
|
|
9745
9811
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
9746
9812
|
function initials3(name) {
|
|
9747
9813
|
return name.trim().slice(0, 3).toUpperCase();
|
|
@@ -9751,7 +9817,7 @@ function PostMatchCrest({
|
|
|
9751
9817
|
name,
|
|
9752
9818
|
side
|
|
9753
9819
|
}) {
|
|
9754
|
-
const [failed, setFailed] = (0,
|
|
9820
|
+
const [failed, setFailed] = (0, import_react53.useState)(false);
|
|
9755
9821
|
const cls = `ss-w-fandash-postmatch-crest ss-w-fandash-postmatch-crest--${side}`;
|
|
9756
9822
|
if (url && !failed) {
|
|
9757
9823
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -9950,10 +10016,10 @@ function RestingFormCard({ card }) {
|
|
|
9950
10016
|
}
|
|
9951
10017
|
|
|
9952
10018
|
// src/components/dashboard/LiveScoreCard.tsx
|
|
9953
|
-
var
|
|
10019
|
+
var import_react55 = require("react");
|
|
9954
10020
|
|
|
9955
10021
|
// src/useLiveClock.ts
|
|
9956
|
-
var
|
|
10022
|
+
var import_react54 = require("react");
|
|
9957
10023
|
var TICK_MS = 6e4;
|
|
9958
10024
|
var MAX_LIVE_TICK_MINUTES = 15;
|
|
9959
10025
|
function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
|
|
@@ -9962,10 +10028,10 @@ function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
|
|
|
9962
10028
|
return minute + Math.min(Math.max(0, elapsedMinutes), MAX_LIVE_TICK_MINUTES);
|
|
9963
10029
|
}
|
|
9964
10030
|
function useLiveClock(minute, clockRunning, receivedAtMs) {
|
|
9965
|
-
const [displayMinute, setDisplayMinute] = (0,
|
|
10031
|
+
const [displayMinute, setDisplayMinute] = (0, import_react54.useState)(
|
|
9966
10032
|
() => computeDisplayMinute(minute, clockRunning, receivedAtMs)
|
|
9967
10033
|
);
|
|
9968
|
-
(0,
|
|
10034
|
+
(0, import_react54.useEffect)(() => {
|
|
9969
10035
|
setDisplayMinute(computeDisplayMinute(minute, clockRunning, receivedAtMs));
|
|
9970
10036
|
if (!clockRunning) return;
|
|
9971
10037
|
const id = window.setInterval(() => {
|
|
@@ -9982,7 +10048,7 @@ function initials5(name) {
|
|
|
9982
10048
|
return name.trim().slice(0, 3).toUpperCase();
|
|
9983
10049
|
}
|
|
9984
10050
|
function LiveCrest({ url, name, side }) {
|
|
9985
|
-
const [failed, setFailed] = (0,
|
|
10051
|
+
const [failed, setFailed] = (0, import_react55.useState)(false);
|
|
9986
10052
|
const cls = `ss-w-fandash-live-crest ss-w-fandash-live-crest--${side}`;
|
|
9987
10053
|
if (url && !failed) {
|
|
9988
10054
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -10004,7 +10070,7 @@ function LiveScoreCard({
|
|
|
10004
10070
|
}) {
|
|
10005
10071
|
const { data } = card;
|
|
10006
10072
|
const seedKey = `${data.minute}:${data.homeScore}:${data.awayScore}`;
|
|
10007
|
-
const seedRef = (0,
|
|
10073
|
+
const seedRef = (0, import_react55.useRef)(null);
|
|
10008
10074
|
if (!seedRef.current || seedRef.current.key !== seedKey) {
|
|
10009
10075
|
seedRef.current = { key: seedKey, receivedAtMs: Date.now() };
|
|
10010
10076
|
}
|
|
@@ -10050,7 +10116,7 @@ function LiveScoreCard({
|
|
|
10050
10116
|
}
|
|
10051
10117
|
|
|
10052
10118
|
// src/components/dashboard/LiveTimelineCard.tsx
|
|
10053
|
-
var
|
|
10119
|
+
var import_react56 = require("react");
|
|
10054
10120
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
10055
10121
|
var SHOWN2 = 3;
|
|
10056
10122
|
function EventIcon({ type }) {
|
|
@@ -10092,7 +10158,7 @@ function EventRow({ e }) {
|
|
|
10092
10158
|
] });
|
|
10093
10159
|
}
|
|
10094
10160
|
function LiveTimelineCard({ card, ui }) {
|
|
10095
|
-
const [expanded, setExpanded] = (0,
|
|
10161
|
+
const [expanded, setExpanded] = (0, import_react56.useState)(false);
|
|
10096
10162
|
const events = card.data.events;
|
|
10097
10163
|
if (!events || events.length === 0) return null;
|
|
10098
10164
|
const sorted = [...events].sort((a, b) => b.minute - a.minute);
|
|
@@ -10116,7 +10182,7 @@ function LiveTimelineCard({ card, ui }) {
|
|
|
10116
10182
|
}
|
|
10117
10183
|
|
|
10118
10184
|
// src/components/dashboard/MomentumWave.tsx
|
|
10119
|
-
var
|
|
10185
|
+
var import_react57 = require("react");
|
|
10120
10186
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
10121
10187
|
var WIDTH = 270;
|
|
10122
10188
|
var HEIGHT = 56;
|
|
@@ -10141,7 +10207,7 @@ function MomentumWave({
|
|
|
10141
10207
|
}) {
|
|
10142
10208
|
if (points.length === 0) return null;
|
|
10143
10209
|
const { area, line, lastLeftPct, lastTopPx } = buildPaths(points);
|
|
10144
|
-
const clipId = (0,
|
|
10210
|
+
const clipId = (0, import_react57.useId)();
|
|
10145
10211
|
const topClipId = `${clipId}-top`;
|
|
10146
10212
|
const bottomClipId = `${clipId}-bottom`;
|
|
10147
10213
|
const topClass = clubIsHome ? "ss-w-fandash-live-mom-home" : "ss-w-fandash-live-mom-away";
|
|
@@ -10291,7 +10357,7 @@ function FanDashboardCard({ card, onTap, ui, goalEvents }) {
|
|
|
10291
10357
|
// src/components/ChatMessage.tsx
|
|
10292
10358
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
10293
10359
|
function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor, onGreetingSport }) {
|
|
10294
|
-
const [sport, setSport] = (0,
|
|
10360
|
+
const [sport, setSport] = (0, import_react58.useState)(null);
|
|
10295
10361
|
if (message.role === "user") {
|
|
10296
10362
|
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "ss-w-msg ss-w-user", "data-msg-id": message.id, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "ss-w-bubble", children: message.text }) });
|
|
10297
10363
|
}
|
|
@@ -10345,11 +10411,11 @@ function turnAnchor(messages) {
|
|
|
10345
10411
|
function MessageList({ controller, ui, slip, onDashboardTap, monitor, onGreetingSport }) {
|
|
10346
10412
|
const { state, send } = controller;
|
|
10347
10413
|
const { oddsFormat } = useOddsSettings();
|
|
10348
|
-
const listRef = (0,
|
|
10349
|
-
const endRef = (0,
|
|
10350
|
-
const pinnedRef = (0,
|
|
10351
|
-
const anchoredTurnRef = (0,
|
|
10352
|
-
(0,
|
|
10414
|
+
const listRef = (0, import_react59.useRef)(null);
|
|
10415
|
+
const endRef = (0, import_react59.useRef)(null);
|
|
10416
|
+
const pinnedRef = (0, import_react59.useRef)(true);
|
|
10417
|
+
const anchoredTurnRef = (0, import_react59.useRef)(null);
|
|
10418
|
+
(0, import_react59.useEffect)(() => {
|
|
10353
10419
|
const anchor = turnAnchor(state.messages);
|
|
10354
10420
|
const list = listRef.current;
|
|
10355
10421
|
if (anchor && anchor.turnId !== anchoredTurnRef.current) {
|
|
@@ -10408,13 +10474,13 @@ function MessageList({ controller, ui, slip, onDashboardTap, monitor, onGreeting
|
|
|
10408
10474
|
}
|
|
10409
10475
|
|
|
10410
10476
|
// src/components/ChatInput.tsx
|
|
10411
|
-
var
|
|
10477
|
+
var import_react60 = require("react");
|
|
10412
10478
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
10413
|
-
var ChatInput = (0,
|
|
10414
|
-
const [value, setValue] = (0,
|
|
10415
|
-
const textareaRef = (0,
|
|
10416
|
-
const stopRef = (0,
|
|
10417
|
-
const textBoxWantsFocusRef = (0,
|
|
10479
|
+
var ChatInput = (0, import_react60.forwardRef)(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel, sendLabel, disabled = false }, ref) {
|
|
10480
|
+
const [value, setValue] = (0, import_react60.useState)("");
|
|
10481
|
+
const textareaRef = (0, import_react60.useRef)(null);
|
|
10482
|
+
const stopRef = (0, import_react60.useRef)(null);
|
|
10483
|
+
const textBoxWantsFocusRef = (0, import_react60.useRef)(false);
|
|
10418
10484
|
const submit = () => {
|
|
10419
10485
|
if (disabled) return;
|
|
10420
10486
|
const t = value.trim();
|
|
@@ -10428,7 +10494,7 @@ var ChatInput = (0, import_react59.forwardRef)(function ChatInput2({ placeholder
|
|
|
10428
10494
|
submit();
|
|
10429
10495
|
}
|
|
10430
10496
|
};
|
|
10431
|
-
(0,
|
|
10497
|
+
(0, import_react60.useImperativeHandle)(ref, () => ({
|
|
10432
10498
|
focus() {
|
|
10433
10499
|
const box = textareaRef.current;
|
|
10434
10500
|
if (box && !box.disabled) {
|
|
@@ -10440,7 +10506,7 @@ var ChatInput = (0, import_react59.forwardRef)(function ChatInput2({ placeholder
|
|
|
10440
10506
|
stopRef.current?.focus();
|
|
10441
10507
|
}
|
|
10442
10508
|
}), []);
|
|
10443
|
-
(0,
|
|
10509
|
+
(0, import_react60.useEffect)(() => {
|
|
10444
10510
|
if (streaming || disabled || !textBoxWantsFocusRef.current) return;
|
|
10445
10511
|
textBoxWantsFocusRef.current = false;
|
|
10446
10512
|
const box = textareaRef.current;
|
|
@@ -10471,7 +10537,7 @@ var ChatInput = (0, import_react59.forwardRef)(function ChatInput2({ placeholder
|
|
|
10471
10537
|
});
|
|
10472
10538
|
|
|
10473
10539
|
// src/components/TabBar.tsx
|
|
10474
|
-
var
|
|
10540
|
+
var import_react61 = require("react");
|
|
10475
10541
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
10476
10542
|
var FIT_STEPS = [[0, false], [1, false], [1, true], [2, true], [3, true], [4, true], [5, true], [6, true]];
|
|
10477
10543
|
function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule, hasBuilder = false, gamesEnabled, clubEnabled, favouritesEnabled }) {
|
|
@@ -10494,16 +10560,16 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
10494
10560
|
...favouritesEnabled && !clubEnabled ? [{ tab: "favourites", label: ui.tabFavourites, count: 0, dot: false }] : []
|
|
10495
10561
|
];
|
|
10496
10562
|
const track = useTrack();
|
|
10497
|
-
const listRef = (0,
|
|
10563
|
+
const listRef = (0, import_react61.useRef)(null);
|
|
10498
10564
|
const activeTab = monitor.activeTab;
|
|
10499
|
-
(0,
|
|
10565
|
+
(0, import_react61.useEffect)(() => {
|
|
10500
10566
|
const el = listRef.current?.querySelector("[data-on]");
|
|
10501
10567
|
if (!el || typeof el.scrollIntoView !== "function") return;
|
|
10502
10568
|
const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
10503
10569
|
el.scrollIntoView({ block: "nearest", inline: "nearest", behavior: reduce ? "auto" : "smooth" });
|
|
10504
10570
|
}, [activeTab]);
|
|
10505
10571
|
const labelSignature = tabs.map((t) => `${t.tab}:${t.label}:${t.count}`).join("|");
|
|
10506
|
-
(0,
|
|
10572
|
+
(0, import_react61.useLayoutEffect)(() => {
|
|
10507
10573
|
const strip = listRef.current;
|
|
10508
10574
|
if (!strip) return;
|
|
10509
10575
|
const fav = strip.querySelector("[data-fav-tab]");
|
|
@@ -10557,7 +10623,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
10557
10623
|
}
|
|
10558
10624
|
|
|
10559
10625
|
// src/components/MonitorTabs.tsx
|
|
10560
|
-
var
|
|
10626
|
+
var import_react73 = require("react");
|
|
10561
10627
|
|
|
10562
10628
|
// src/components/MarketAccordion.tsx
|
|
10563
10629
|
var import_widget_sdk24 = require("@sensiblestats/widget-sdk");
|
|
@@ -10619,19 +10685,19 @@ function MarketAccordion({ match, monitor, ui, slip }) {
|
|
|
10619
10685
|
}
|
|
10620
10686
|
|
|
10621
10687
|
// src/components/LiveFactBlock.tsx
|
|
10622
|
-
var
|
|
10688
|
+
var import_react63 = require("react");
|
|
10623
10689
|
|
|
10624
10690
|
// src/useFactView.ts
|
|
10625
|
-
var
|
|
10691
|
+
var import_react62 = require("react");
|
|
10626
10692
|
var DWELL_MS = 1e3;
|
|
10627
10693
|
var seen = /* @__PURE__ */ new Set();
|
|
10628
10694
|
function useFactView(ref, fact, entity2) {
|
|
10629
10695
|
const log = useEventLog();
|
|
10630
|
-
const entityRef = (0,
|
|
10696
|
+
const entityRef = (0, import_react62.useRef)(entity2);
|
|
10631
10697
|
entityRef.current = entity2;
|
|
10632
10698
|
const id = fact?.id;
|
|
10633
10699
|
const factKey = fact?.factKey;
|
|
10634
|
-
(0,
|
|
10700
|
+
(0, import_react62.useEffect)(() => {
|
|
10635
10701
|
if (id === void 0 || factKey === void 0 || seen.has(id) || !log) return;
|
|
10636
10702
|
const el = ref.current;
|
|
10637
10703
|
if (!el) return;
|
|
@@ -10668,10 +10734,10 @@ function useFactView(ref, fact, entity2) {
|
|
|
10668
10734
|
// src/components/LiveFactBlock.tsx
|
|
10669
10735
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
10670
10736
|
function LiveFactBlock({ facts, match, ui, slip, onAsk }) {
|
|
10671
|
-
const [expanded, setExpanded] = (0,
|
|
10737
|
+
const [expanded, setExpanded] = (0, import_react63.useState)(false);
|
|
10672
10738
|
const { oddsFormat } = useOddsSettings();
|
|
10673
10739
|
const log = useEventLog();
|
|
10674
|
-
const sectionRef = (0,
|
|
10740
|
+
const sectionRef = (0, import_react63.useRef)(null);
|
|
10675
10741
|
const [current, ...earlier] = facts;
|
|
10676
10742
|
const entity2 = current?.market ? { entityType: "market", entityId: current.market.marketDeveloperName } : { entityType: "match", entityId: String(match.matchId) };
|
|
10677
10743
|
useFactView(sectionRef, current, entity2);
|
|
@@ -10745,7 +10811,7 @@ function LiveFactBlock({ facts, match, ui, slip, onAsk }) {
|
|
|
10745
10811
|
}
|
|
10746
10812
|
|
|
10747
10813
|
// src/components/MonitorFormH2H.tsx
|
|
10748
|
-
var
|
|
10814
|
+
var import_react64 = require("react");
|
|
10749
10815
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
10750
10816
|
function resultClass2(result) {
|
|
10751
10817
|
if (result === "W") return "ss-w-h2h-result--win";
|
|
@@ -10761,7 +10827,7 @@ function FormDots({ form, ui }) {
|
|
|
10761
10827
|
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "ss-w-h2h-dots", children: form.map((m, i) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: `ss-w-h2h-result ${resultClass2(m.result)}`, children: resultLabel(m.result, ui) }, i)) });
|
|
10762
10828
|
}
|
|
10763
10829
|
function MonitorFormH2H({ formAndH2H, homeTeamName, awayTeamName, ui }) {
|
|
10764
|
-
const [expanded, setExpanded] = (0,
|
|
10830
|
+
const [expanded, setExpanded] = (0, import_react64.useState)(false);
|
|
10765
10831
|
const { homeForm, awayForm, h2h, homeShortCode, awayShortCode } = formAndH2H;
|
|
10766
10832
|
if (homeForm.length === 0 && awayForm.length === 0 && !h2h) {
|
|
10767
10833
|
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_jsx_runtime71.Fragment, {});
|
|
@@ -10994,7 +11060,7 @@ var sportLabel = (ui, sport) => {
|
|
|
10994
11060
|
};
|
|
10995
11061
|
|
|
10996
11062
|
// src/components/NbaFormSection.tsx
|
|
10997
|
-
var
|
|
11063
|
+
var import_react65 = require("react");
|
|
10998
11064
|
|
|
10999
11065
|
// src/components/NbaFormRest.tsx
|
|
11000
11066
|
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
@@ -11093,8 +11159,8 @@ function Row2({ game, abbr, tonight, ui }) {
|
|
|
11093
11159
|
] });
|
|
11094
11160
|
}
|
|
11095
11161
|
function NbaFormSection({ match, monitor, ui }) {
|
|
11096
|
-
const [open, setOpen] = (0,
|
|
11097
|
-
const [side, setSide] = (0,
|
|
11162
|
+
const [open, setOpen] = (0, import_react65.useState)(false);
|
|
11163
|
+
const [side, setSide] = (0, import_react65.useState)("away");
|
|
11098
11164
|
const form = useNbaForm(match, monitor);
|
|
11099
11165
|
const b = match.basketball;
|
|
11100
11166
|
if (!form || !b || !form.home && !form.away) return null;
|
|
@@ -11136,10 +11202,10 @@ function NbaFormSection({ match, monitor, ui }) {
|
|
|
11136
11202
|
}
|
|
11137
11203
|
|
|
11138
11204
|
// src/components/NbaPropsSection.tsx
|
|
11139
|
-
var
|
|
11205
|
+
var import_react67 = require("react");
|
|
11140
11206
|
|
|
11141
11207
|
// src/components/PropsPieces.tsx
|
|
11142
|
-
var
|
|
11208
|
+
var import_react66 = require("react");
|
|
11143
11209
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
11144
11210
|
var livePlayer = (bundle, p) => bundle.live === true || !p.live && !p.nflLive ? p : { ...p, live: null, nflLive: null };
|
|
11145
11211
|
var hasLiveLine = (p) => p.live != null || p.nflLive != null;
|
|
@@ -11152,9 +11218,9 @@ function preKickoff(match) {
|
|
|
11152
11218
|
return Number.isFinite(kickoff) && Date.now() < kickoff;
|
|
11153
11219
|
}
|
|
11154
11220
|
function usePreKickoff(match) {
|
|
11155
|
-
const [, setTick] = (0,
|
|
11221
|
+
const [, setTick] = (0, import_react66.useState)(0);
|
|
11156
11222
|
const pre = preKickoff(match);
|
|
11157
|
-
(0,
|
|
11223
|
+
(0, import_react66.useEffect)(() => {
|
|
11158
11224
|
if (!pre || !match.kickoffUtc) return;
|
|
11159
11225
|
const wait = Math.min(Math.max(Date.parse(match.kickoffUtc) - Date.now(), 0), MAX_TIMER_MS);
|
|
11160
11226
|
const id = setTimeout(() => setTick((t) => t + 1), wait);
|
|
@@ -11168,7 +11234,7 @@ function usePropsOpen(match, monitor, descriptor) {
|
|
|
11168
11234
|
const pre = descriptor.sport === "basketball" ? match.phase === "preMatch" : beforeKickoff;
|
|
11169
11235
|
const live = match.phase === "live";
|
|
11170
11236
|
const open = pre || live;
|
|
11171
|
-
(0,
|
|
11237
|
+
(0, import_react66.useEffect)(() => {
|
|
11172
11238
|
if (!open) return;
|
|
11173
11239
|
if (sport) monitor.loadPlayerProps?.(match.matchId, sport);
|
|
11174
11240
|
else monitor.loadPlayerProps?.(match.matchId);
|
|
@@ -11246,7 +11312,7 @@ function PropBars({ bars, line, title, wide, ui, note }) {
|
|
|
11246
11312
|
function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
|
|
11247
11313
|
const player = livePlayer(bundle, given);
|
|
11248
11314
|
const stats = descriptor.stats.map((k) => player.stats.find((s) => s.stat === k)).filter((s) => s != null);
|
|
11249
|
-
const [picked, setPicked] = (0,
|
|
11315
|
+
const [picked, setPicked] = (0, import_react66.useState)(null);
|
|
11250
11316
|
const active = stats.find((s) => s.stat === picked) ?? stats[0];
|
|
11251
11317
|
const sample = active?.games?.length ?? 0;
|
|
11252
11318
|
const hitsOf = (price, text2) => descriptor.showHits && sample > 0 && price.hits != null ? text2(price.hits) : null;
|
|
@@ -11295,7 +11361,7 @@ function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
|
|
|
11295
11361
|
] });
|
|
11296
11362
|
}
|
|
11297
11363
|
function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
11298
|
-
const [openId, setOpenId] = (0,
|
|
11364
|
+
const [openId, setOpenId] = (0, import_react66.useState)(null);
|
|
11299
11365
|
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "ss-w-props-list", children: players.map((given) => {
|
|
11300
11366
|
const p = livePlayer(bundle, given);
|
|
11301
11367
|
const isOpen = openId === p.playerId;
|
|
@@ -11332,12 +11398,12 @@ function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
|
11332
11398
|
}
|
|
11333
11399
|
var BOX_QUIET_MS = 12e4;
|
|
11334
11400
|
function StatsClock({ boxAsOfUtc, match, live, atBreak: atBreak2, ago, ui }) {
|
|
11335
|
-
const [tick, setTick] = (0,
|
|
11401
|
+
const [tick, setTick] = (0, import_react66.useState)(0);
|
|
11336
11402
|
const time = clock2(boxAsOfUtc, ui);
|
|
11337
11403
|
const at2 = time === "" ? Number.NaN : Date.parse(boxAsOfUtc);
|
|
11338
11404
|
const valid = !Number.isNaN(at2);
|
|
11339
11405
|
const onBreak = atBreak(match);
|
|
11340
|
-
(0,
|
|
11406
|
+
(0, import_react66.useEffect)(() => {
|
|
11341
11407
|
if (!valid || onBreak) return;
|
|
11342
11408
|
const age2 = Date.now() - at2;
|
|
11343
11409
|
const wait = age2 < BOX_QUIET_MS ? BOX_QUIET_MS - age2 : 6e4 - age2 % 6e4;
|
|
@@ -11398,12 +11464,12 @@ var nbaDescriptor = (ui, match) => ({
|
|
|
11398
11464
|
tenGameBars: false
|
|
11399
11465
|
});
|
|
11400
11466
|
function StatsClock2({ bundle, match, ui }) {
|
|
11401
|
-
const [tick, setTick] = (0,
|
|
11467
|
+
const [tick, setTick] = (0, import_react67.useState)(0);
|
|
11402
11468
|
const at2 = bundle.live === true && bundle.boxAsOfUtc ? Date.parse(bundle.boxAsOfUtc) : Number.NaN;
|
|
11403
11469
|
const time = clock2(bundle.boxAsOfUtc, ui);
|
|
11404
11470
|
const valid = !Number.isNaN(at2) && time !== "";
|
|
11405
11471
|
const onBreak = atBreak(match);
|
|
11406
|
-
(0,
|
|
11472
|
+
(0, import_react67.useEffect)(() => {
|
|
11407
11473
|
if (!valid || onBreak) return;
|
|
11408
11474
|
const age2 = Date.now() - at2;
|
|
11409
11475
|
const wait = age2 < BOX_QUIET_MS2 ? BOX_QUIET_MS2 - age2 : 6e4 - age2 % 6e4;
|
|
@@ -11417,7 +11483,7 @@ function StatsClock2({ bundle, match, ui }) {
|
|
|
11417
11483
|
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "ss-w-props-asof ss-w-props-asof--live", children: ui.nba.propsStatsLive(time) });
|
|
11418
11484
|
}
|
|
11419
11485
|
function NbaPropsSection({ match, monitor, ui, slip }) {
|
|
11420
|
-
const [side, setSide] = (0,
|
|
11486
|
+
const [side, setSide] = (0, import_react67.useState)("home");
|
|
11421
11487
|
const descriptor = nbaDescriptor(ui, match);
|
|
11422
11488
|
const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
|
|
11423
11489
|
if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
|
|
@@ -11566,7 +11632,7 @@ function NbaMonitorCard({ match, monitor, ui, slip }) {
|
|
|
11566
11632
|
}
|
|
11567
11633
|
|
|
11568
11634
|
// src/components/NflFormSection.tsx
|
|
11569
|
-
var
|
|
11635
|
+
var import_react68 = require("react");
|
|
11570
11636
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
11571
11637
|
var outcomeOf = (g) => g.teamScore > g.opponentScore ? "win" : g.teamScore < g.opponentScore ? "loss" : "tie";
|
|
11572
11638
|
var signedSpread2 = (v) => v > 0 ? `+${v}` : String(v);
|
|
@@ -11618,7 +11684,7 @@ function H2hRow({ game, home, ui }) {
|
|
|
11618
11684
|
] });
|
|
11619
11685
|
}
|
|
11620
11686
|
function NflFormSection({ match, monitor, ui }) {
|
|
11621
|
-
const [segment, setSegment] = (0,
|
|
11687
|
+
const [segment, setSegment] = (0, import_react68.useState)("away");
|
|
11622
11688
|
const { live, open } = usePropsOpen(match, monitor, { sport: "americanfootball" });
|
|
11623
11689
|
const bundle = monitor.playerProps?.[monitorMatchKey("americanfootball", match.matchId)]?.bundle;
|
|
11624
11690
|
const form = bundle?.form;
|
|
@@ -11651,7 +11717,7 @@ function NflFormSection({ match, monitor, ui }) {
|
|
|
11651
11717
|
}
|
|
11652
11718
|
|
|
11653
11719
|
// src/components/NflPropsSection.tsx
|
|
11654
|
-
var
|
|
11720
|
+
var import_react69 = require("react");
|
|
11655
11721
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
11656
11722
|
var TRENDS_SHOWN = 3;
|
|
11657
11723
|
var SCORERS_SHOWN = 8;
|
|
@@ -11724,7 +11790,7 @@ function ShowMore({ label, onClick }) {
|
|
|
11724
11790
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("button", { type: "button", className: "ss-w-props-more", onClick, children: label });
|
|
11725
11791
|
}
|
|
11726
11792
|
function Trends({ bundle, facts, descriptor, ui, slip }) {
|
|
11727
|
-
const [all, setAll] = (0,
|
|
11793
|
+
const [all, setAll] = (0, import_react69.useState)(false);
|
|
11728
11794
|
const shown2 = all ? facts : facts.slice(0, TRENDS_SHOWN);
|
|
11729
11795
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("section", { className: "ss-w-props ss-w-props-trends", lang: ui.locale, children: [
|
|
11730
11796
|
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "ss-w-props-head", children: ui.nfl.propsTrends }),
|
|
@@ -11757,7 +11823,7 @@ function Trends({ bundle, facts, descriptor, ui, slip }) {
|
|
|
11757
11823
|
] });
|
|
11758
11824
|
}
|
|
11759
11825
|
function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
11760
|
-
const [all, setAll] = (0,
|
|
11826
|
+
const [all, setAll] = (0, import_react69.useState)(false);
|
|
11761
11827
|
const shown2 = all ? scorers : scorers.slice(0, SCORERS_SHOWN);
|
|
11762
11828
|
const cell2 = (name, column, price, stat) => price && stat ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(PropPrice, { price, label: "", ariaName: `${name}, ${column}`, player: name, stat, bundle, descriptor, ui, slip }) : /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "ss-w-props-scorer-none", children: "\u2014" });
|
|
11763
11829
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "ss-w-props-scorers", children: [
|
|
@@ -11784,7 +11850,7 @@ function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
|
11784
11850
|
] });
|
|
11785
11851
|
}
|
|
11786
11852
|
function NflPropsSection({ match, monitor, ui, slip }) {
|
|
11787
|
-
const [tab, setTab] = (0,
|
|
11853
|
+
const [tab, setTab] = (0, import_react69.useState)(null);
|
|
11788
11854
|
const descriptor = nflDescriptor(ui);
|
|
11789
11855
|
const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
|
|
11790
11856
|
if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
|
|
@@ -11970,7 +12036,7 @@ function NflMonitorCard({ match, monitor, ui, slip }) {
|
|
|
11970
12036
|
}
|
|
11971
12037
|
|
|
11972
12038
|
// src/components/TennisMonitorCard.tsx
|
|
11973
|
-
var
|
|
12039
|
+
var import_react71 = require("react");
|
|
11974
12040
|
var import_widget_sdk27 = require("@sensiblestats/widget-sdk");
|
|
11975
12041
|
|
|
11976
12042
|
// src/components/TennisFixtureRow.tsx
|
|
@@ -12231,7 +12297,7 @@ function TennisLiveScoreboard({ t, score, live, ui }) {
|
|
|
12231
12297
|
}
|
|
12232
12298
|
|
|
12233
12299
|
// src/components/TennisStatsTables.tsx
|
|
12234
|
-
var
|
|
12300
|
+
var import_react70 = require("react");
|
|
12235
12301
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
12236
12302
|
function formatStat(row, value, locale) {
|
|
12237
12303
|
if (value == null) return "\u2013";
|
|
@@ -12269,8 +12335,8 @@ function Tables({ table, labels, names, locale }) {
|
|
|
12269
12335
|
] });
|
|
12270
12336
|
}
|
|
12271
12337
|
function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey }) {
|
|
12272
|
-
const [tab, setTab] = (0,
|
|
12273
|
-
(0,
|
|
12338
|
+
const [tab, setTab] = (0, import_react70.useState)("match");
|
|
12339
|
+
(0, import_react70.useEffect)(() => {
|
|
12274
12340
|
setTab("match");
|
|
12275
12341
|
}, [resetKey]);
|
|
12276
12342
|
const sets = serveReturn.sets.filter((s) => s.table.serve.length + s.table.return.length > 0);
|
|
@@ -12301,7 +12367,7 @@ function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey })
|
|
|
12301
12367
|
] }),
|
|
12302
12368
|
today.rows.map((r) => {
|
|
12303
12369
|
const f = (v) => formatStat({ kind: "pct" }, v, locale);
|
|
12304
|
-
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
12370
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_react70.Fragment, { children: [
|
|
12305
12371
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "ss-w-ts-l", children: r.label }),
|
|
12306
12372
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("span", { className: "ss-w-ts-today-v ss-w-ts-today-v--a", children: [
|
|
12307
12373
|
f(r.p1Today),
|
|
@@ -12436,7 +12502,7 @@ function HeadToHead({ t, ui }) {
|
|
|
12436
12502
|
] });
|
|
12437
12503
|
}
|
|
12438
12504
|
function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
12439
|
-
const lastTables = (0,
|
|
12505
|
+
const lastTables = (0, import_react71.useRef)(null);
|
|
12440
12506
|
const t = match.tennis;
|
|
12441
12507
|
if (!t) return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(UnavailableCard, { match, monitor, ui, sport: "tennis" });
|
|
12442
12508
|
const preMatch = match.phase === "preMatch";
|
|
@@ -12516,7 +12582,7 @@ function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
|
12516
12582
|
}
|
|
12517
12583
|
|
|
12518
12584
|
// src/components/ScoreboardStrip.tsx
|
|
12519
|
-
var
|
|
12585
|
+
var import_react72 = require("react");
|
|
12520
12586
|
var import_widget_sdk28 = require("@sensiblestats/widget-sdk");
|
|
12521
12587
|
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
12522
12588
|
function nbaStatus(m, ui) {
|
|
@@ -12611,8 +12677,8 @@ function rowsFor(m) {
|
|
|
12611
12677
|
];
|
|
12612
12678
|
}
|
|
12613
12679
|
function useStripScroll(selectedKey) {
|
|
12614
|
-
const stripRef = (0,
|
|
12615
|
-
(0,
|
|
12680
|
+
const stripRef = (0, import_react72.useRef)(null);
|
|
12681
|
+
(0, import_react72.useEffect)(() => {
|
|
12616
12682
|
const strip = stripRef.current;
|
|
12617
12683
|
const pressed = strip?.querySelector('[aria-pressed="true"]');
|
|
12618
12684
|
if (!strip || !pressed) return;
|
|
@@ -12786,7 +12852,7 @@ function OddsLiveStrip({ m, ui }) {
|
|
|
12786
12852
|
] });
|
|
12787
12853
|
}
|
|
12788
12854
|
function MatchesPanel({ monitor, ui, slip, onAsk, discovery }) {
|
|
12789
|
-
const seedIndex = (0,
|
|
12855
|
+
const seedIndex = (0, import_react73.useMemo)(() => buildSeedIndex(discovery?.groups ?? []), [discovery?.groups]);
|
|
12790
12856
|
const tiles = orderTiles(
|
|
12791
12857
|
monitor.pins,
|
|
12792
12858
|
monitor.snapshot,
|
|
@@ -12858,7 +12924,7 @@ function TrendsPanel({ monitor, ui, slip }) {
|
|
|
12858
12924
|
}
|
|
12859
12925
|
|
|
12860
12926
|
// src/components/LivePanel.tsx
|
|
12861
|
-
var
|
|
12927
|
+
var import_react76 = require("react");
|
|
12862
12928
|
var import_widget_sdk35 = require("@sensiblestats/widget-sdk");
|
|
12863
12929
|
|
|
12864
12930
|
// src/scheduleView.ts
|
|
@@ -13033,20 +13099,20 @@ function LeagueGroup({ view, open, onToggle, disambiguate, rowCap, onShowAll, on
|
|
|
13033
13099
|
}
|
|
13034
13100
|
|
|
13035
13101
|
// src/components/MatchSheet.tsx
|
|
13036
|
-
var
|
|
13102
|
+
var import_react75 = require("react");
|
|
13037
13103
|
var import_widget_sdk33 = require("@sensiblestats/widget-sdk");
|
|
13038
13104
|
|
|
13039
13105
|
// src/useModalDialog.ts
|
|
13040
|
-
var
|
|
13106
|
+
var import_react74 = require("react");
|
|
13041
13107
|
var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
13042
13108
|
function useModalDialog(onClose, opts = {}) {
|
|
13043
|
-
const dialogRef = (0,
|
|
13044
|
-
const onCloseRef = (0,
|
|
13109
|
+
const dialogRef = (0, import_react74.useRef)(null);
|
|
13110
|
+
const onCloseRef = (0, import_react74.useRef)(onClose);
|
|
13045
13111
|
onCloseRef.current = onClose;
|
|
13046
|
-
const openerRef = (0,
|
|
13112
|
+
const openerRef = (0, import_react74.useRef)(opts.opener);
|
|
13047
13113
|
openerRef.current = opts.opener;
|
|
13048
13114
|
const restore = opts.restoreFocus ?? true;
|
|
13049
|
-
(0,
|
|
13115
|
+
(0, import_react74.useEffect)(() => {
|
|
13050
13116
|
const dialog = dialogRef.current;
|
|
13051
13117
|
const root = dialog?.getRootNode();
|
|
13052
13118
|
const focusedAtMount = root?.activeElement ?? null;
|
|
@@ -13057,7 +13123,7 @@ function useModalDialog(onClose, opts = {}) {
|
|
|
13057
13123
|
if (target instanceof HTMLElement) target.focus({ preventScroll: true });
|
|
13058
13124
|
};
|
|
13059
13125
|
}, []);
|
|
13060
|
-
(0,
|
|
13126
|
+
(0, import_react74.useEffect)(() => {
|
|
13061
13127
|
const onKey = (e) => {
|
|
13062
13128
|
if (e.key !== "Escape") return;
|
|
13063
13129
|
e.stopPropagation();
|
|
@@ -13098,8 +13164,8 @@ function kickoffDate(kickoffUnix, lang, timeZone) {
|
|
|
13098
13164
|
function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose, opener }) {
|
|
13099
13165
|
const { dialogRef, onKeyDown } = useModalDialog(onClose, { opener });
|
|
13100
13166
|
const log = useEventLog();
|
|
13101
|
-
const titleId = (0,
|
|
13102
|
-
const [limitHit, setLimitHit] = (0,
|
|
13167
|
+
const titleId = (0, import_react75.useId)();
|
|
13168
|
+
const [limitHit, setLimitHit] = (0, import_react75.useState)(false);
|
|
13103
13169
|
const pinSport = (0, import_widget_sdk33.slipSportOf)(match.sport);
|
|
13104
13170
|
const tour = pinSport === "tennis" && isKnownTour(match.tour) ? match.tour : void 0;
|
|
13105
13171
|
const followable = pinSport !== "tennis" || tour !== void 0;
|
|
@@ -13200,10 +13266,10 @@ var OPEN_TOP_GROUPS = 2;
|
|
|
13200
13266
|
var QUIET_ROWS = 4;
|
|
13201
13267
|
function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, onLeague, onSeeAll, onAsk }) {
|
|
13202
13268
|
const { groups, states, stale } = discovery;
|
|
13203
|
-
const [mine, setMine] = (0,
|
|
13204
|
-
const [toggled, setToggled] = (0,
|
|
13205
|
-
const [sheet, setSheet] = (0,
|
|
13206
|
-
const pinnedKeys = (0,
|
|
13269
|
+
const [mine, setMine] = (0, import_react76.useState)(false);
|
|
13270
|
+
const [toggled, setToggled] = (0, import_react76.useState)(/* @__PURE__ */ new Map());
|
|
13271
|
+
const [sheet, setSheet] = (0, import_react76.useState)(null);
|
|
13272
|
+
const pinnedKeys = (0, import_react76.useMemo)(
|
|
13207
13273
|
() => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk35.matchKey)(p.sport, p.matchId, p.tour))),
|
|
13208
13274
|
[monitor.pins]
|
|
13209
13275
|
);
|
|
@@ -13309,20 +13375,20 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
|
|
|
13309
13375
|
}
|
|
13310
13376
|
|
|
13311
13377
|
// src/components/ScheduleMatchesPanel.tsx
|
|
13312
|
-
var
|
|
13378
|
+
var import_react80 = require("react");
|
|
13313
13379
|
var import_widget_sdk37 = require("@sensiblestats/widget-sdk");
|
|
13314
13380
|
|
|
13315
13381
|
// src/useTennisRowPrices.ts
|
|
13316
|
-
var
|
|
13382
|
+
var import_react77 = require("react");
|
|
13317
13383
|
var import_widget_sdk36 = require("@sensiblestats/widget-sdk");
|
|
13318
13384
|
var TENNIS_PRICE_POLL_MS = 6e4;
|
|
13319
13385
|
function useTennisRowPrices(a) {
|
|
13320
|
-
const [state, setState] = (0,
|
|
13321
|
-
const getPricesRef = (0,
|
|
13386
|
+
const [state, setState] = (0, import_react77.useState)({ byId: null, stale: false });
|
|
13387
|
+
const getPricesRef = (0, import_react77.useRef)(a.getPrices);
|
|
13322
13388
|
getPricesRef.current = a.getPrices;
|
|
13323
|
-
const latest = (0,
|
|
13389
|
+
const latest = (0, import_react77.useRef)(0);
|
|
13324
13390
|
const idsKey = a.keys.filter((k) => isKnownTour(k.tour)).slice(0, MAX_TENNIS_KEYS).map((k) => `${k.tour}:${k.matchId}`).sort().join(",");
|
|
13325
|
-
(0,
|
|
13391
|
+
(0, import_react77.useEffect)(() => {
|
|
13326
13392
|
if (!a.enabled || idsKey === "") {
|
|
13327
13393
|
latest.current++;
|
|
13328
13394
|
setState((prev) => prev.byId === null && !prev.stale ? prev : { byId: null, stale: false });
|
|
@@ -13360,11 +13426,11 @@ function useTennisRowPrices(a) {
|
|
|
13360
13426
|
}
|
|
13361
13427
|
|
|
13362
13428
|
// src/components/DayStrip.tsx
|
|
13363
|
-
var
|
|
13429
|
+
var import_react78 = require("react");
|
|
13364
13430
|
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
13365
13431
|
function DayStrip({ chips, selected, onSelect, ui, locale }) {
|
|
13366
|
-
const listRef = (0,
|
|
13367
|
-
(0,
|
|
13432
|
+
const listRef = (0, import_react78.useRef)(null);
|
|
13433
|
+
(0, import_react78.useEffect)(() => {
|
|
13368
13434
|
const el = listRef.current?.querySelector('[aria-pressed="true"]');
|
|
13369
13435
|
if (!el || typeof el.scrollIntoView !== "function") return;
|
|
13370
13436
|
const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
@@ -13393,7 +13459,7 @@ function DayStrip({ chips, selected, onSelect, ui, locale }) {
|
|
|
13393
13459
|
}
|
|
13394
13460
|
|
|
13395
13461
|
// src/components/games/ui/SearchField.tsx
|
|
13396
|
-
var
|
|
13462
|
+
var import_react79 = require("react");
|
|
13397
13463
|
|
|
13398
13464
|
// src/components/games/ui/icons.tsx
|
|
13399
13465
|
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
@@ -13432,8 +13498,8 @@ var IconFlame = ({ size = 16 }) => svg(size, /* @__PURE__ */ (0, import_jsx_runt
|
|
|
13432
13498
|
// src/components/games/ui/SearchField.tsx
|
|
13433
13499
|
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
13434
13500
|
function SearchField({ id, label, labelHidden = false, placeholder, value, onChange, disabled, inputRef, onKeyDown, clearLabel }) {
|
|
13435
|
-
const localRef = (0,
|
|
13436
|
-
const setInputRef = (0,
|
|
13501
|
+
const localRef = (0, import_react79.useRef)(null);
|
|
13502
|
+
const setInputRef = (0, import_react79.useCallback)((node) => {
|
|
13437
13503
|
localRef.current = node;
|
|
13438
13504
|
if (typeof inputRef === "function") inputRef(node);
|
|
13439
13505
|
else if (inputRef) inputRef.current = node;
|
|
@@ -13479,18 +13545,18 @@ var TOP_ROW_CAP = 3;
|
|
|
13479
13545
|
var SKELETON_ROWS = 3;
|
|
13480
13546
|
function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport, day, onDay, loaded, onOpenLive, onAsk, locale, getTennisPrices, slip }) {
|
|
13481
13547
|
const { localDate: today, states, stale } = discovery;
|
|
13482
|
-
const searchId = (0,
|
|
13483
|
-
const [query, setQuery] = (0,
|
|
13484
|
-
const [toggled, setToggled] = (0,
|
|
13485
|
-
const [expanded, setExpanded] = (0,
|
|
13486
|
-
const listRef = (0,
|
|
13487
|
-
const [sheet, setSheet] = (0,
|
|
13548
|
+
const searchId = (0, import_react80.useId)();
|
|
13549
|
+
const [query, setQuery] = (0, import_react80.useState)("");
|
|
13550
|
+
const [toggled, setToggled] = (0, import_react80.useState)(/* @__PURE__ */ new Map());
|
|
13551
|
+
const [expanded, setExpanded] = (0, import_react80.useState)(/* @__PURE__ */ new Set());
|
|
13552
|
+
const listRef = (0, import_react80.useRef)(null);
|
|
13553
|
+
const [sheet, setSheet] = (0, import_react80.useState)(null);
|
|
13488
13554
|
const { chips, selected } = loaded;
|
|
13489
|
-
(0,
|
|
13555
|
+
(0, import_react80.useEffect)(() => {
|
|
13490
13556
|
if (selected !== day) onDay(selected);
|
|
13491
13557
|
}, [day, selected, onDay]);
|
|
13492
13558
|
const isToday = selected === today;
|
|
13493
|
-
const pinnedKeys = (0,
|
|
13559
|
+
const pinnedKeys = (0, import_react80.useMemo)(
|
|
13494
13560
|
() => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk37.matchKey)(p.sport, p.matchId, p.tour))),
|
|
13495
13561
|
[monitor.pins]
|
|
13496
13562
|
);
|
|
@@ -13628,7 +13694,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
13628
13694
|
}
|
|
13629
13695
|
|
|
13630
13696
|
// src/components/GamesPanel.tsx
|
|
13631
|
-
var
|
|
13697
|
+
var import_react95 = require("react");
|
|
13632
13698
|
|
|
13633
13699
|
// src/components/GamesLoginWall.tsx
|
|
13634
13700
|
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
@@ -13637,7 +13703,7 @@ function GamesLoginWall({ ui }) {
|
|
|
13637
13703
|
}
|
|
13638
13704
|
|
|
13639
13705
|
// src/components/GamesHub.tsx
|
|
13640
|
-
var
|
|
13706
|
+
var import_react81 = require("react");
|
|
13641
13707
|
|
|
13642
13708
|
// src/components/games/ui/gameMeta.ts
|
|
13643
13709
|
function prettifyGameId(gameId) {
|
|
@@ -13788,8 +13854,8 @@ function pickHeroGame(games) {
|
|
|
13788
13854
|
}
|
|
13789
13855
|
var tileKey = (g) => `${g.gameId}-${g.gameDay}-${g.fixtureId}`;
|
|
13790
13856
|
function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
13791
|
-
const [, setTick] = (0,
|
|
13792
|
-
(0,
|
|
13857
|
+
const [, setTick] = (0, import_react81.useState)(0);
|
|
13858
|
+
(0, import_react81.useEffect)(() => {
|
|
13793
13859
|
const id = setInterval(() => setTick((t) => t + 1), 6e4);
|
|
13794
13860
|
return () => clearInterval(id);
|
|
13795
13861
|
}, []);
|
|
@@ -13849,10 +13915,10 @@ function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
|
13849
13915
|
}
|
|
13850
13916
|
|
|
13851
13917
|
// src/components/GameScreenHost.tsx
|
|
13852
|
-
var
|
|
13918
|
+
var import_react93 = require("react");
|
|
13853
13919
|
|
|
13854
13920
|
// src/useGamePlay.ts
|
|
13855
|
-
var
|
|
13921
|
+
var import_react82 = require("react");
|
|
13856
13922
|
function toSubmitResult(payload) {
|
|
13857
13923
|
return {
|
|
13858
13924
|
// 'pending' means the play is recorded but awaiting resolution (fixture games)
|
|
@@ -13864,17 +13930,17 @@ function toSubmitResult(payload) {
|
|
|
13864
13930
|
};
|
|
13865
13931
|
}
|
|
13866
13932
|
function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh }) {
|
|
13867
|
-
const [result, setResult] = (0,
|
|
13868
|
-
const [submitting, setSubmitting] = (0,
|
|
13869
|
-
const [rawStatus, setRawStatus] = (0,
|
|
13870
|
-
const inFlightRef = (0,
|
|
13871
|
-
const convRef = (0,
|
|
13933
|
+
const [result, setResult] = (0, import_react82.useState)(null);
|
|
13934
|
+
const [submitting, setSubmitting] = (0, import_react82.useState)(false);
|
|
13935
|
+
const [rawStatus, setRawStatus] = (0, import_react82.useState)(null);
|
|
13936
|
+
const inFlightRef = (0, import_react82.useRef)(false);
|
|
13937
|
+
const convRef = (0, import_react82.useRef)(conversation);
|
|
13872
13938
|
convRef.current = conversation;
|
|
13873
|
-
const optsRef = (0,
|
|
13939
|
+
const optsRef = (0, import_react82.useRef)({ gameId, gameDay, fixtureId, locale, refresh });
|
|
13874
13940
|
optsRef.current = { gameId, gameDay, fixtureId, locale, refresh };
|
|
13875
|
-
const resultRef = (0,
|
|
13941
|
+
const resultRef = (0, import_react82.useRef)(null);
|
|
13876
13942
|
resultRef.current = result;
|
|
13877
|
-
const refetch = (0,
|
|
13943
|
+
const refetch = (0, import_react82.useCallback)(async () => {
|
|
13878
13944
|
const conv = convRef.current;
|
|
13879
13945
|
if (!conv) return;
|
|
13880
13946
|
const opts = optsRef.current;
|
|
@@ -13890,7 +13956,7 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
|
|
|
13890
13956
|
} catch {
|
|
13891
13957
|
}
|
|
13892
13958
|
}, []);
|
|
13893
|
-
const submit = (0,
|
|
13959
|
+
const submit = (0, import_react82.useCallback)(async (answerJson) => {
|
|
13894
13960
|
const conv = convRef.current;
|
|
13895
13961
|
if (!conv || inFlightRef.current) return;
|
|
13896
13962
|
inFlightRef.current = true;
|
|
@@ -13917,14 +13983,14 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
|
|
|
13917
13983
|
setSubmitting(false);
|
|
13918
13984
|
}
|
|
13919
13985
|
}, [refetch]);
|
|
13920
|
-
const hydrate = (0,
|
|
13986
|
+
const hydrate = (0, import_react82.useCallback)(() => {
|
|
13921
13987
|
void refetch();
|
|
13922
13988
|
}, [refetch]);
|
|
13923
13989
|
return { result, submitting, submit, hydrate, rawStatus };
|
|
13924
13990
|
}
|
|
13925
13991
|
|
|
13926
13992
|
// src/components/games/MysteryTigerGame.tsx
|
|
13927
|
-
var
|
|
13993
|
+
var import_react84 = require("react");
|
|
13928
13994
|
|
|
13929
13995
|
// src/components/games/nationFlags.ts
|
|
13930
13996
|
var FLAGS = {
|
|
@@ -14135,7 +14201,7 @@ function isNationCode(flag) {
|
|
|
14135
14201
|
}
|
|
14136
14202
|
|
|
14137
14203
|
// src/components/games/PlayerAvatar.tsx
|
|
14138
|
-
var
|
|
14204
|
+
var import_react83 = require("react");
|
|
14139
14205
|
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
14140
14206
|
function initialsOf(name) {
|
|
14141
14207
|
const parts2 = name.trim().split(/\s+/).filter(Boolean);
|
|
@@ -14153,7 +14219,7 @@ function PlayerAvatar({
|
|
|
14153
14219
|
imagePath,
|
|
14154
14220
|
className
|
|
14155
14221
|
}) {
|
|
14156
|
-
const [failed, setFailed] = (0,
|
|
14222
|
+
const [failed, setFailed] = (0, import_react83.useState)(false);
|
|
14157
14223
|
const showImage = Boolean(imagePath) && !isPlaceholderImage(imagePath) && !failed;
|
|
14158
14224
|
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className, "aria-hidden": "true", children: showImage ? /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("img", { src: imagePath, alt: "", loading: "lazy", onError: () => setFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("span", { className: "ss-w-av-initials", children: initialsOf(name) }) });
|
|
14159
14225
|
}
|
|
@@ -14397,8 +14463,8 @@ function MysteryTigerGame({
|
|
|
14397
14463
|
onBack
|
|
14398
14464
|
}) {
|
|
14399
14465
|
const t = ui.games.mysteryTiger;
|
|
14400
|
-
const [query, setQuery] = (0,
|
|
14401
|
-
const inputId = (0,
|
|
14466
|
+
const [query, setQuery] = (0, import_react84.useState)("");
|
|
14467
|
+
const inputId = (0, import_react84.useId)();
|
|
14402
14468
|
const clientState = parseClientState(result?.clientStateJson);
|
|
14403
14469
|
const guessResults = clientState?.guessResults ?? [];
|
|
14404
14470
|
const alreadyGuessedIds = new Set(guessResults.map((g) => g.playerId));
|
|
@@ -14659,13 +14725,13 @@ function HigherOrLowerGame({
|
|
|
14659
14725
|
}
|
|
14660
14726
|
|
|
14661
14727
|
// src/components/games/CareerPathGame.tsx
|
|
14662
|
-
var
|
|
14728
|
+
var import_react86 = require("react");
|
|
14663
14729
|
|
|
14664
14730
|
// src/components/games/ui/CrestShield.tsx
|
|
14665
|
-
var
|
|
14731
|
+
var import_react85 = require("react");
|
|
14666
14732
|
var import_jsx_runtime118 = require("react/jsx-runtime");
|
|
14667
14733
|
function CrestShield({ src, name, size = 28 }) {
|
|
14668
|
-
const [failed, setFailed] = (0,
|
|
14734
|
+
const [failed, setFailed] = (0, import_react85.useState)(false);
|
|
14669
14735
|
if (src && !isPlaceholderImage(src) && !failed) {
|
|
14670
14736
|
return /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("img", { className: "ss-g-crest", src, alt: name, width: size, height: size, loading: "lazy", onError: () => setFailed(true) });
|
|
14671
14737
|
}
|
|
@@ -14697,8 +14763,8 @@ function CareerPathGame({
|
|
|
14697
14763
|
}) {
|
|
14698
14764
|
const s = ui.games.careerPath;
|
|
14699
14765
|
const title = gameTitle({ gameId: "career-path" }, ui.games.titles);
|
|
14700
|
-
const [query, setQuery] = (0,
|
|
14701
|
-
const inputId = (0,
|
|
14766
|
+
const [query, setQuery] = (0, import_react86.useState)("");
|
|
14767
|
+
const inputId = (0, import_react86.useId)();
|
|
14702
14768
|
const clientState = parseClientState3(result?.clientStateJson);
|
|
14703
14769
|
const alreadyGuessedIds = new Set(clientState?.guessResults.map((g) => g.playerId) ?? []);
|
|
14704
14770
|
const isOver = result?.alreadyPlayed === true || clientState?.solved === true || clientState?.failed === true;
|
|
@@ -14804,7 +14870,7 @@ function CareerPathGame({
|
|
|
14804
14870
|
}
|
|
14805
14871
|
|
|
14806
14872
|
// src/components/games/BeatTheGridGame.tsx
|
|
14807
|
-
var
|
|
14873
|
+
var import_react87 = __toESM(require("react"), 1);
|
|
14808
14874
|
|
|
14809
14875
|
// src/components/games/ui/OptionList.tsx
|
|
14810
14876
|
var import_jsx_runtime120 = require("react/jsx-runtime");
|
|
@@ -14893,10 +14959,10 @@ function SearchSheet({
|
|
|
14893
14959
|
ui
|
|
14894
14960
|
}) {
|
|
14895
14961
|
const s = ui.games.beatTheGrid;
|
|
14896
|
-
const [query, setQuery] = (0,
|
|
14897
|
-
const inputId = (0,
|
|
14898
|
-
const inputRef = (0,
|
|
14899
|
-
(0,
|
|
14962
|
+
const [query, setQuery] = (0, import_react87.useState)("");
|
|
14963
|
+
const inputId = (0, import_react87.useId)();
|
|
14964
|
+
const inputRef = (0, import_react87.useRef)(null);
|
|
14965
|
+
(0, import_react87.useEffect)(() => {
|
|
14900
14966
|
inputRef.current?.focus();
|
|
14901
14967
|
}, [row, col]);
|
|
14902
14968
|
const filtered = playerPool.filter(
|
|
@@ -14961,7 +15027,7 @@ function BeatTheGridGame({
|
|
|
14961
15027
|
}) {
|
|
14962
15028
|
const s = ui.games.beatTheGrid;
|
|
14963
15029
|
const title = gameTitle({ gameId: "beat-the-grid" }, ui.games.titles);
|
|
14964
|
-
const [activeCell, setActiveCell] = (0,
|
|
15030
|
+
const [activeCell, setActiveCell] = (0, import_react87.useState)(null);
|
|
14965
15031
|
const clientState = parseClientState4(result?.clientStateJson);
|
|
14966
15032
|
const filledCells = clientState?.cells ?? [];
|
|
14967
15033
|
const isLocked2 = result?.alreadyPlayed === true || clientState?.isComplete === true;
|
|
@@ -15035,7 +15101,7 @@ function BeatTheGridGame({
|
|
|
15035
15101
|
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { "aria-hidden": "true", children: abbr }),
|
|
15036
15102
|
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "ss-g-sr", children: rowLabel })
|
|
15037
15103
|
] });
|
|
15038
|
-
return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(
|
|
15104
|
+
return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(import_react87.default.Fragment, { children: [
|
|
15039
15105
|
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "ss-g-btg-rowhdr", "data-meta": rowMeta ? "true" : void 0, children: rowHeaderContent }),
|
|
15040
15106
|
cols.map((colLabel, colIdx) => {
|
|
15041
15107
|
const filled = findCellResult(filledCells, rowIdx, colIdx);
|
|
@@ -15116,7 +15182,7 @@ function BeatTheGridGame({
|
|
|
15116
15182
|
}
|
|
15117
15183
|
|
|
15118
15184
|
// src/components/games/GuessTheXiGame.tsx
|
|
15119
|
-
var
|
|
15185
|
+
var import_react88 = require("react");
|
|
15120
15186
|
|
|
15121
15187
|
// src/components/games/ui/PitchSvg.tsx
|
|
15122
15188
|
var import_jsx_runtime122 = require("react/jsx-runtime");
|
|
@@ -15205,8 +15271,8 @@ function GuessTheXiGame({
|
|
|
15205
15271
|
onBack
|
|
15206
15272
|
}) {
|
|
15207
15273
|
const t = ui.games.guessTheXi;
|
|
15208
|
-
const [query, setQuery] = (0,
|
|
15209
|
-
const inputId = (0,
|
|
15274
|
+
const [query, setQuery] = (0, import_react88.useState)("");
|
|
15275
|
+
const inputId = (0, import_react88.useId)();
|
|
15210
15276
|
const clientState = parseClientState5(result?.clientStateJson);
|
|
15211
15277
|
const isOver = result?.alreadyPlayed === true || clientState?.status === "solved" || clientState?.status === "failed";
|
|
15212
15278
|
const solved = clientState?.status === "solved";
|
|
@@ -15348,7 +15414,7 @@ function GuessTheXiGame({
|
|
|
15348
15414
|
}
|
|
15349
15415
|
|
|
15350
15416
|
// src/components/games/DailyQuizGame.tsx
|
|
15351
|
-
var
|
|
15417
|
+
var import_react89 = require("react");
|
|
15352
15418
|
var import_jsx_runtime124 = require("react/jsx-runtime");
|
|
15353
15419
|
function parseClientState6(json) {
|
|
15354
15420
|
if (!json) return null;
|
|
@@ -15389,8 +15455,8 @@ function DailyQuizGame({
|
|
|
15389
15455
|
}) {
|
|
15390
15456
|
const s = ui.games.dailyQuiz;
|
|
15391
15457
|
const title = gameTitle({ gameId: "daily-quiz" }, ui.games.titles);
|
|
15392
|
-
const [selections, setSelections] = (0,
|
|
15393
|
-
const [page, setPage] = (0,
|
|
15458
|
+
const [selections, setSelections] = (0, import_react89.useState)(/* @__PURE__ */ new Map());
|
|
15459
|
+
const [page, setPage] = (0, import_react89.useState)(0);
|
|
15394
15460
|
const clientState = parseClientState6(result?.clientStateJson);
|
|
15395
15461
|
const results2 = clientState?.results ?? [];
|
|
15396
15462
|
const isRevealed = results2.length > 0 || result?.alreadyPlayed === true;
|
|
@@ -15500,7 +15566,7 @@ function DailyQuizGame({
|
|
|
15500
15566
|
}
|
|
15501
15567
|
|
|
15502
15568
|
// src/components/games/MatchdayPredictorGame.tsx
|
|
15503
|
-
var
|
|
15569
|
+
var import_react90 = require("react");
|
|
15504
15570
|
var import_jsx_runtime125 = require("react/jsx-runtime");
|
|
15505
15571
|
var SCORER_SEARCH_THRESHOLD = 9;
|
|
15506
15572
|
function parseClientState7(json) {
|
|
@@ -15596,12 +15662,12 @@ function MatchdayPredictorGame({
|
|
|
15596
15662
|
onBack
|
|
15597
15663
|
}) {
|
|
15598
15664
|
const t = ui.games.predictor;
|
|
15599
|
-
const [homeScore, setHomeScore] = (0,
|
|
15600
|
-
const [awayScore, setAwayScore] = (0,
|
|
15601
|
-
const [firstScorerPlayerId, setFirstScorerPlayerId] = (0,
|
|
15602
|
-
const [lastEdited, setLastEdited] = (0,
|
|
15603
|
-
const [query, setQuery] = (0,
|
|
15604
|
-
const searchId = (0,
|
|
15665
|
+
const [homeScore, setHomeScore] = (0, import_react90.useState)(0);
|
|
15666
|
+
const [awayScore, setAwayScore] = (0, import_react90.useState)(0);
|
|
15667
|
+
const [firstScorerPlayerId, setFirstScorerPlayerId] = (0, import_react90.useState)(null);
|
|
15668
|
+
const [lastEdited, setLastEdited] = (0, import_react90.useState)("home");
|
|
15669
|
+
const [query, setQuery] = (0, import_react90.useState)("");
|
|
15670
|
+
const searchId = (0, import_react90.useId)();
|
|
15605
15671
|
const clientState = parseClientState7(result?.clientStateJson);
|
|
15606
15672
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
15607
15673
|
const header = /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
@@ -15768,7 +15834,7 @@ function MatchdayPredictorGame({
|
|
|
15768
15834
|
}
|
|
15769
15835
|
|
|
15770
15836
|
// src/components/games/StartingXiGame.tsx
|
|
15771
|
-
var
|
|
15837
|
+
var import_react91 = require("react");
|
|
15772
15838
|
var import_jsx_runtime126 = require("react/jsx-runtime");
|
|
15773
15839
|
var POINTS_PER_STARTER = 8;
|
|
15774
15840
|
var XI_SIZE = 11;
|
|
@@ -15812,10 +15878,10 @@ function StartingXiGame({
|
|
|
15812
15878
|
lockAtUtc
|
|
15813
15879
|
}) {
|
|
15814
15880
|
const t = ui.games.startingXi;
|
|
15815
|
-
const [slotPlayers, setSlotPlayers] = (0,
|
|
15816
|
-
const [active, setActive] = (0,
|
|
15817
|
-
const [query, setQuery] = (0,
|
|
15818
|
-
const searchId = (0,
|
|
15881
|
+
const [slotPlayers, setSlotPlayers] = (0, import_react91.useState)(() => Array(XI_SIZE).fill(null));
|
|
15882
|
+
const [active, setActive] = (0, import_react91.useState)(0);
|
|
15883
|
+
const [query, setQuery] = (0, import_react91.useState)("");
|
|
15884
|
+
const searchId = (0, import_react91.useId)();
|
|
15819
15885
|
const clientState = parseClientState8(result?.clientStateJson);
|
|
15820
15886
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
15821
15887
|
const header = /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
|
|
@@ -15954,7 +16020,7 @@ function StartingXiGame({
|
|
|
15954
16020
|
}
|
|
15955
16021
|
|
|
15956
16022
|
// src/components/games/StatLadderGame.tsx
|
|
15957
|
-
var
|
|
16023
|
+
var import_react92 = require("react");
|
|
15958
16024
|
var import_jsx_runtime127 = require("react/jsx-runtime");
|
|
15959
16025
|
function ladderClue(ladder) {
|
|
15960
16026
|
const mystery = ladder.find((r) => r.rank === 2);
|
|
@@ -15991,9 +16057,9 @@ function StatLadderGame({
|
|
|
15991
16057
|
onBack
|
|
15992
16058
|
}) {
|
|
15993
16059
|
const t = ui.games.statLadder;
|
|
15994
|
-
const [query, setQuery] = (0,
|
|
15995
|
-
const [selectedId, setSelectedId] = (0,
|
|
15996
|
-
const searchId = (0,
|
|
16060
|
+
const [query, setQuery] = (0, import_react92.useState)("");
|
|
16061
|
+
const [selectedId, setSelectedId] = (0, import_react92.useState)(null);
|
|
16062
|
+
const searchId = (0, import_react92.useId)();
|
|
15997
16063
|
const clientState = parseClientState9(result?.clientStateJson);
|
|
15998
16064
|
const revealed = clientState != null;
|
|
15999
16065
|
const header = /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(GameHeader, { title: gameTitle({ gameId: "stat-ladder" }, ui.games.titles), eyebrow: t.eyebrow, onBack, backLabel: ui.back });
|
|
@@ -16199,8 +16265,8 @@ function GameScreenHost({
|
|
|
16199
16265
|
ui
|
|
16200
16266
|
}) {
|
|
16201
16267
|
const { gameId, fixtureId, gameDay = "", lockAtUtc = null } = selected;
|
|
16202
|
-
const [configJson, setConfigJson] = (0,
|
|
16203
|
-
(0,
|
|
16268
|
+
const [configJson, setConfigJson] = (0, import_react93.useState)(null);
|
|
16269
|
+
(0, import_react93.useEffect)(() => {
|
|
16204
16270
|
setConfigJson(null);
|
|
16205
16271
|
if (!conversation) return;
|
|
16206
16272
|
let cancelled = false;
|
|
@@ -16223,12 +16289,12 @@ function GameScreenHost({
|
|
|
16223
16289
|
fixtureId: fixtureId || void 0,
|
|
16224
16290
|
locale: ui.hostTag
|
|
16225
16291
|
});
|
|
16226
|
-
(0,
|
|
16292
|
+
(0, import_react93.useEffect)(() => {
|
|
16227
16293
|
if (conversation) hydrate();
|
|
16228
16294
|
}, [conversation, gameId]);
|
|
16229
|
-
const hydrateRef = (0,
|
|
16295
|
+
const hydrateRef = (0, import_react93.useRef)(hydrate);
|
|
16230
16296
|
hydrateRef.current = hydrate;
|
|
16231
|
-
(0,
|
|
16297
|
+
(0, import_react93.useEffect)(() => {
|
|
16232
16298
|
if (!FIXTURE_GAME_IDS.has(gameId)) return;
|
|
16233
16299
|
if (rawStatus !== "pending") return;
|
|
16234
16300
|
const timerId = setInterval(() => {
|
|
@@ -16341,7 +16407,7 @@ function GameScreenHost({
|
|
|
16341
16407
|
}
|
|
16342
16408
|
|
|
16343
16409
|
// src/components/Leaderboard.tsx
|
|
16344
|
-
var
|
|
16410
|
+
var import_react94 = require("react");
|
|
16345
16411
|
|
|
16346
16412
|
// src/components/LeaderboardRow.tsx
|
|
16347
16413
|
var import_jsx_runtime130 = require("react/jsx-runtime");
|
|
@@ -16428,7 +16494,7 @@ function Leaderboard({
|
|
|
16428
16494
|
ui,
|
|
16429
16495
|
onPlay
|
|
16430
16496
|
}) {
|
|
16431
|
-
const [segment, setSegment] = (0,
|
|
16497
|
+
const [segment, setSegment] = (0, import_react94.useState)("weekly");
|
|
16432
16498
|
const myRow = segment === "weekly" ? data.myWeeklyRow : data.myAllTimeRow;
|
|
16433
16499
|
const offBoard = myRow !== null && myRow !== void 0 && myRow.rank === -1;
|
|
16434
16500
|
const isEmpty = segment === "weekly" ? data.weeklyTop.length === 0 : data.allTimeTop.length === 0;
|
|
@@ -16533,9 +16599,9 @@ function GamesPanel({
|
|
|
16533
16599
|
leaderboardLoading,
|
|
16534
16600
|
refreshHub
|
|
16535
16601
|
}) {
|
|
16536
|
-
const [selected, setSelected] = (0,
|
|
16537
|
-
const [segment, setSegment] = (0,
|
|
16538
|
-
(0,
|
|
16602
|
+
const [selected, setSelected] = (0, import_react95.useState)(null);
|
|
16603
|
+
const [segment, setSegment] = (0, import_react95.useState)("play");
|
|
16604
|
+
(0, import_react95.useEffect)(() => {
|
|
16539
16605
|
ensureGamesFonts();
|
|
16540
16606
|
}, []);
|
|
16541
16607
|
if (!loggedIn) return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(GamesLoginWall, { ui });
|
|
@@ -16599,10 +16665,10 @@ function GamesPanel({
|
|
|
16599
16665
|
}
|
|
16600
16666
|
|
|
16601
16667
|
// src/components/FavouritesPanel.tsx
|
|
16602
|
-
var
|
|
16668
|
+
var import_react98 = require("react");
|
|
16603
16669
|
|
|
16604
16670
|
// src/components/FavouriteChips.tsx
|
|
16605
|
-
var
|
|
16671
|
+
var import_react96 = require("react");
|
|
16606
16672
|
var import_jsx_runtime135 = require("react/jsx-runtime");
|
|
16607
16673
|
async function toggleWithNotice(controller, kind, id, onNotice) {
|
|
16608
16674
|
const outcome = await controller.toggle(kind, id);
|
|
@@ -16649,12 +16715,12 @@ function Group({ title, entities, sport, ui, controller, onNotice }) {
|
|
|
16649
16715
|
] });
|
|
16650
16716
|
}
|
|
16651
16717
|
function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNotice }) {
|
|
16652
|
-
const [confirming, setConfirming] = (0,
|
|
16718
|
+
const [confirming, setConfirming] = (0, import_react96.useState)(false);
|
|
16653
16719
|
const data = controller.data;
|
|
16654
|
-
(0,
|
|
16720
|
+
(0, import_react96.useEffect)(() => {
|
|
16655
16721
|
setConfirming(false);
|
|
16656
16722
|
}, [sport]);
|
|
16657
|
-
(0,
|
|
16723
|
+
(0, import_react96.useEffect)(() => {
|
|
16658
16724
|
if (!confirming) return;
|
|
16659
16725
|
const onPointerDown = (e) => {
|
|
16660
16726
|
if (!(e.target instanceof Element) || !e.target.closest("[data-fav-confirm]")) setConfirming(false);
|
|
@@ -16708,21 +16774,21 @@ function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNoti
|
|
|
16708
16774
|
}
|
|
16709
16775
|
|
|
16710
16776
|
// src/components/FavouritesSearch.tsx
|
|
16711
|
-
var
|
|
16777
|
+
var import_react97 = require("react");
|
|
16712
16778
|
var import_jsx_runtime136 = require("react/jsx-runtime");
|
|
16713
16779
|
var MIN_LETTERS = 2;
|
|
16714
16780
|
var MAX_LENGTH = 64;
|
|
16715
16781
|
var DEBOUNCE_MS = 250;
|
|
16716
16782
|
function FavouritesSearch({ controller, ui, sport, onNotice }) {
|
|
16717
|
-
const [query, setQuery] = (0,
|
|
16718
|
-
const [answer, setAnswer] = (0,
|
|
16719
|
-
const controllerRef = (0,
|
|
16783
|
+
const [query, setQuery] = (0, import_react97.useState)("");
|
|
16784
|
+
const [answer, setAnswer] = (0, import_react97.useState)(null);
|
|
16785
|
+
const controllerRef = (0, import_react97.useRef)(controller);
|
|
16720
16786
|
controllerRef.current = controller;
|
|
16721
16787
|
const trimmed = query.trim();
|
|
16722
16788
|
const queryKey = `${sport}|${trimmed}`;
|
|
16723
16789
|
const results2 = answer?.key === queryKey ? answer.rows : [];
|
|
16724
16790
|
const settled = answer?.key === queryKey;
|
|
16725
|
-
(0,
|
|
16791
|
+
(0, import_react97.useEffect)(() => {
|
|
16726
16792
|
setAnswer(null);
|
|
16727
16793
|
if (trimmed.length < MIN_LETTERS) return;
|
|
16728
16794
|
let cancelled = false;
|
|
@@ -16785,13 +16851,13 @@ function FavouritesSearch({ controller, ui, sport, onNotice }) {
|
|
|
16785
16851
|
// src/components/FavouritesPanel.tsx
|
|
16786
16852
|
var import_jsx_runtime137 = require("react/jsx-runtime");
|
|
16787
16853
|
function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
|
|
16788
|
-
const [notice, setNotice] = (0,
|
|
16789
|
-
const refreshRef = (0,
|
|
16854
|
+
const [notice, setNotice] = (0, import_react98.useState)(null);
|
|
16855
|
+
const refreshRef = (0, import_react98.useRef)(controller.refresh);
|
|
16790
16856
|
refreshRef.current = controller.refresh;
|
|
16791
|
-
(0,
|
|
16857
|
+
(0, import_react98.useEffect)(() => {
|
|
16792
16858
|
void refreshRef.current();
|
|
16793
16859
|
}, []);
|
|
16794
|
-
(0,
|
|
16860
|
+
(0, import_react98.useEffect)(() => {
|
|
16795
16861
|
setNotice(null);
|
|
16796
16862
|
}, [sport]);
|
|
16797
16863
|
const sportLabel2 = sports.find((s) => s.sport === sport)?.label ?? sportLabel(ui, sport);
|
|
@@ -16817,7 +16883,7 @@ function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
|
|
|
16817
16883
|
}
|
|
16818
16884
|
|
|
16819
16885
|
// src/components/dashboard/v8/SentenceBuilder.tsx
|
|
16820
|
-
var
|
|
16886
|
+
var import_react99 = require("react");
|
|
16821
16887
|
var import_jsx_runtime138 = require("react/jsx-runtime");
|
|
16822
16888
|
var TOTALS = ["any", "3", "5", "10", "20", "50"];
|
|
16823
16889
|
var BASE_LEGS = [1, 2, 3, 4];
|
|
@@ -16843,8 +16909,8 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
16843
16909
|
const opening = openingGames(preset);
|
|
16844
16910
|
const gamesOptions = opening.options;
|
|
16845
16911
|
const marketOptions = usableMarkets(preset);
|
|
16846
|
-
const [fingerprint] = (0,
|
|
16847
|
-
const [saved] = (0,
|
|
16912
|
+
const [fingerprint] = (0, import_react99.useState)(() => JSON.stringify(preset));
|
|
16913
|
+
const [saved] = (0, import_react99.useState)(() => {
|
|
16848
16914
|
const kept = memory3?.savedView(sport);
|
|
16849
16915
|
return kept && kept.fingerprint === fingerprint ? kept : null;
|
|
16850
16916
|
});
|
|
@@ -16858,9 +16924,9 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
16858
16924
|
// The server never widens by itself: an all-games preset with no ids asks for it.
|
|
16859
16925
|
widen: opening.option ? opening.option.matchIds.length === 0 : preset.gamesScope === "all" && preset.matchIds.length === 0
|
|
16860
16926
|
};
|
|
16861
|
-
const [view, setView] = (0,
|
|
16862
|
-
const autoWidened = (0,
|
|
16863
|
-
const [widenedNote, setWidenedNote] = (0,
|
|
16927
|
+
const [view, setView] = (0, import_react99.useState)(() => saved?.view ?? openingView);
|
|
16928
|
+
const autoWidened = (0, import_react99.useRef)(false);
|
|
16929
|
+
const [widenedNote, setWidenedNote] = (0, import_react99.useState)(saved?.widenedNote ?? false);
|
|
16864
16930
|
const requestFor = (v) => ({
|
|
16865
16931
|
sport,
|
|
16866
16932
|
...v.marketKey !== null ? { marketKey: v.marketKey } : {},
|
|
@@ -16872,10 +16938,10 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
16872
16938
|
...operatorUserId ? { operatorUserId } : {},
|
|
16873
16939
|
...anonymousUserId ? { anonymousUserId } : {}
|
|
16874
16940
|
});
|
|
16875
|
-
const [first] = (0,
|
|
16941
|
+
const [first] = (0, import_react99.useState)(() => requestFor(view));
|
|
16876
16942
|
const { grid, status: status2, confirmed, request } = useBuilderGrid({ conversation, locale: ui.hostTag, memory: memory3, initial: first });
|
|
16877
|
-
const lastRequest = (0,
|
|
16878
|
-
(0,
|
|
16943
|
+
const lastRequest = (0, import_react99.useRef)(first);
|
|
16944
|
+
(0, import_react99.useEffect)(() => {
|
|
16879
16945
|
void request(lastRequest.current);
|
|
16880
16946
|
}, [request]);
|
|
16881
16947
|
const send = (req) => {
|
|
@@ -16908,14 +16974,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
16908
16974
|
const rows = ready && grid.status === "ok" ? legsOf(grid, sport) : null;
|
|
16909
16975
|
const rowSlip = rows ? guardLegsPreMatch(slip, rows, ui) : slip;
|
|
16910
16976
|
useNextKickoffRender(rows ? rows.map((l) => l.kickoffUtc) : []);
|
|
16911
|
-
const [startedNote, setStartedNote] = (0,
|
|
16977
|
+
const [startedNote, setStartedNote] = (0, import_react99.useState)(false);
|
|
16912
16978
|
const anyStarted = rows !== null && rows.some((l) => !preMatchOpen(l.kickoffUtc, Date.now()));
|
|
16913
|
-
(0,
|
|
16979
|
+
(0, import_react99.useEffect)(() => {
|
|
16914
16980
|
if (startedNote && status2 === "ready" && !anyStarted) setStartedNote(false);
|
|
16915
16981
|
}, [startedNote, status2, anyStarted]);
|
|
16916
16982
|
const market = rows?.[0]?.market;
|
|
16917
|
-
const [seen2, setSeen] = (0,
|
|
16918
|
-
(0,
|
|
16983
|
+
const [seen2, setSeen] = (0, import_react99.useState)(null);
|
|
16984
|
+
(0, import_react99.useEffect)(() => {
|
|
16919
16985
|
if (market) setSeen(market);
|
|
16920
16986
|
}, [market]);
|
|
16921
16987
|
const marketName = view.marketKey === null ? null : marketOptions?.find((m) => m.key === view.marketKey)?.label ?? market ?? seen2;
|
|
@@ -16928,14 +16994,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
16928
16994
|
const quotedAt = rows ? oldestQuote(rows) : null;
|
|
16929
16995
|
const combo = ready && grid.total !== null ? { sport, totalChosen: view.total, totalActual: grid.total } : void 0;
|
|
16930
16996
|
const canWiden = gamesOptions === null || allGames !== null;
|
|
16931
|
-
(0,
|
|
16997
|
+
(0, import_react99.useEffect)(() => {
|
|
16932
16998
|
if (!empty2 || !singles || widened || !canWiden || autoWidened.current) return;
|
|
16933
16999
|
autoWidened.current = true;
|
|
16934
17000
|
const next = { ...view, widen: true, matchIds: [], gamesId: allGames ? allGames.id : view.gamesId };
|
|
16935
17001
|
commit(next, true);
|
|
16936
17002
|
send(requestFor(next));
|
|
16937
17003
|
}, [empty2, singles, widened, canWiden, view]);
|
|
16938
|
-
(0,
|
|
17004
|
+
(0, import_react99.useEffect)(() => {
|
|
16939
17005
|
if (coolOff) onCoolOff?.(sport);
|
|
16940
17006
|
}, [coolOff, onCoolOff, sport]);
|
|
16941
17007
|
if (coolOff) return null;
|
|
@@ -17338,10 +17404,10 @@ function Squad({ squad, loading, ui, view, onToggleView, stats, statsLoading, se
|
|
|
17338
17404
|
}
|
|
17339
17405
|
|
|
17340
17406
|
// src/components/PlayerPhoto.tsx
|
|
17341
|
-
var
|
|
17407
|
+
var import_react100 = require("react");
|
|
17342
17408
|
var import_jsx_runtime144 = require("react/jsx-runtime");
|
|
17343
17409
|
function PlayerPhoto({ photoUrl, jerseyNumber, size }) {
|
|
17344
|
-
const [failed, setFailed] = (0,
|
|
17410
|
+
const [failed, setFailed] = (0, import_react100.useState)(false);
|
|
17345
17411
|
const box = { width: size, height: size };
|
|
17346
17412
|
if (photoUrl && !failed) {
|
|
17347
17413
|
return /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("img", { className: "ss-w-pd-photo", style: box, src: photoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -17376,7 +17442,7 @@ function MiniPitch({ positionCode }) {
|
|
|
17376
17442
|
}
|
|
17377
17443
|
|
|
17378
17444
|
// src/components/PerformanceBars.tsx
|
|
17379
|
-
var
|
|
17445
|
+
var import_react101 = require("react");
|
|
17380
17446
|
var import_jsx_runtime146 = require("react/jsx-runtime");
|
|
17381
17447
|
var GROUPS = ["shooting", "passing", "possession", "defending"];
|
|
17382
17448
|
function finite4(v) {
|
|
@@ -17422,7 +17488,7 @@ function unrankedLine(ui, reason) {
|
|
|
17422
17488
|
}
|
|
17423
17489
|
}
|
|
17424
17490
|
function PerformanceBars({ performance, competitionName, strings }) {
|
|
17425
|
-
const [mode, setMode] = (0,
|
|
17491
|
+
const [mode, setMode] = (0, import_react101.useState)("total");
|
|
17426
17492
|
const labelled = performance.metrics.filter((m) => Object.prototype.hasOwnProperty.call(strings.perfMetric, m.key));
|
|
17427
17493
|
if (!labelled.some((m) => valueOf(m, "total") !== null || valueOf(m, "per90") !== null)) return null;
|
|
17428
17494
|
const subtitle = !performance.ranked ? unrankedLine(strings, performance.unrankedReason) : competitionName ? strings.perfRankedAgainst(competitionName, performance.positionGroup) : null;
|
|
@@ -17594,11 +17660,11 @@ function PlayerDetail({ detail, loading, ui, seasonName, onClose }) {
|
|
|
17594
17660
|
}
|
|
17595
17661
|
|
|
17596
17662
|
// src/components/PresetTools.tsx
|
|
17597
|
-
var
|
|
17663
|
+
var import_react102 = require("react");
|
|
17598
17664
|
var import_jsx_runtime148 = require("react/jsx-runtime");
|
|
17599
17665
|
function PresetToolModal({ title, closeLabel, onClose, children, footer, className }) {
|
|
17600
17666
|
const { dialogRef, onKeyDown } = useModalDialog(onClose, { restoreFocus: false });
|
|
17601
|
-
const titleId = (0,
|
|
17667
|
+
const titleId = (0, import_react102.useId)();
|
|
17602
17668
|
return /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: className ? `ss-w-tool-backdrop ${className}` : "ss-w-tool-backdrop", children: /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { ref: dialogRef, className: "ss-w-tool", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, tabIndex: -1, onKeyDown, children: [
|
|
17603
17669
|
/* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "ss-w-tool-head", children: [
|
|
17604
17670
|
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("h2", { id: titleId, className: "ss-w-tool-title", children: title }),
|
|
@@ -17648,9 +17714,9 @@ function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal,
|
|
|
17648
17714
|
const totalOptions = comboTotals(grid);
|
|
17649
17715
|
const totals = totalOptions.map((o) => o.value);
|
|
17650
17716
|
const legChoices = comboLegChoices(grid);
|
|
17651
|
-
const [total, setTotal] = (0,
|
|
17652
|
-
const [legs, setLegs] = (0,
|
|
17653
|
-
const [announcement, setAnnouncement] = (0,
|
|
17717
|
+
const [total, setTotal] = (0, import_react102.useState)(() => nearest(totals, initialTotal));
|
|
17718
|
+
const [legs, setLegs] = (0, import_react102.useState)(() => legsForTotal(grid, nearest(totals, initialTotal), clampLegs(legChoices, initialLegs)));
|
|
17719
|
+
const [announcement, setAnnouncement] = (0, import_react102.useState)("");
|
|
17654
17720
|
const cell2 = findCombo(grid, total, legs);
|
|
17655
17721
|
const minLegs = legChoices[0] ?? legs;
|
|
17656
17722
|
const maxLegs = legChoices[legChoices.length - 1] ?? legs;
|
|
@@ -17720,8 +17786,8 @@ function SettingsSheet({ ui, onClose }) {
|
|
|
17720
17786
|
var import_jsx_runtime150 = require("react/jsx-runtime");
|
|
17721
17787
|
var FULLSCREEN_QUERY = "(max-width: 639px)";
|
|
17722
17788
|
function useIsModal() {
|
|
17723
|
-
const [modal, setModal] = (0,
|
|
17724
|
-
(0,
|
|
17789
|
+
const [modal, setModal] = (0, import_react103.useState)(false);
|
|
17790
|
+
(0, import_react103.useEffect)(() => {
|
|
17725
17791
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
17726
17792
|
const mql = window.matchMedia(FULLSCREEN_QUERY);
|
|
17727
17793
|
const sync = () => setModal(mql.matches);
|
|
@@ -17733,14 +17799,14 @@ function useIsModal() {
|
|
|
17733
17799
|
}
|
|
17734
17800
|
var HIDDEN_LAYER_STYLE = { position: "absolute", inset: 0, visibility: "hidden", display: "flex", flexDirection: "column" };
|
|
17735
17801
|
var SQUAD_LAYER_STYLE = { display: "flex", flexDirection: "column", flex: 1, minHeight: 0 };
|
|
17736
|
-
function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, schedule, gamesResult, leaderboardResult, clubFixturesResult, clubStandingsResult, clubSquadResult, clubSquadStatsResult, clubPlayerDetailResult, loggedIn, conversation, presetGrid, favouritesEnabled, favourites, builder }) {
|
|
17802
|
+
function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, schedule, gamesResult, leaderboardResult, clubFixturesResult, clubStandingsResult, clubSquadResult, clubSquadStatsResult, clubPlayerDetailResult, loggedIn, conversation, presetGrid, favouritesEnabled, favourites, builder, onCloseRequested, onRegisterBack }) {
|
|
17737
17803
|
const { state, close, stop, send, reset } = controller;
|
|
17738
|
-
const [squadView, setSquadView] = (0,
|
|
17739
|
-
const [selectedPlayerId, setSelectedPlayerId] = (0,
|
|
17804
|
+
const [squadView, setSquadView] = (0, import_react103.useState)("roster");
|
|
17805
|
+
const [selectedPlayerId, setSelectedPlayerId] = (0, import_react103.useState)(null);
|
|
17740
17806
|
const clearPlayerDetail = clubPlayerDetailResult?.clear;
|
|
17741
17807
|
const fetchPlayerDetail = clubPlayerDetailResult?.fetch;
|
|
17742
|
-
const squadLayerRef = (0,
|
|
17743
|
-
const squadScrollRef = (0,
|
|
17808
|
+
const squadLayerRef = (0, import_react103.useRef)(null);
|
|
17809
|
+
const squadScrollRef = (0, import_react103.useRef)(null);
|
|
17744
17810
|
const selectPlayer = (playerId) => {
|
|
17745
17811
|
squadScrollRef.current = squadLayerRef.current?.querySelector(".ss-w-mon-list")?.scrollTop ?? null;
|
|
17746
17812
|
setSelectedPlayerId(playerId);
|
|
@@ -17750,7 +17816,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17750
17816
|
setSelectedPlayerId(null);
|
|
17751
17817
|
clearPlayerDetail?.();
|
|
17752
17818
|
};
|
|
17753
|
-
(0,
|
|
17819
|
+
(0, import_react103.useLayoutEffect)(() => {
|
|
17754
17820
|
if (selectedPlayerId !== null || squadScrollRef.current === null) return;
|
|
17755
17821
|
const list = squadLayerRef.current?.querySelector(".ss-w-mon-list");
|
|
17756
17822
|
if (list) list.scrollTop = squadScrollRef.current;
|
|
@@ -17763,16 +17829,16 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17763
17829
|
const hasBuilder = !clubBrand && (builderOptions?.length ?? 0) > 0;
|
|
17764
17830
|
const tabs = monitor ?? (hasBuilder ? tabState : void 0);
|
|
17765
17831
|
const activeTab = tabs?.activeTab;
|
|
17766
|
-
(0,
|
|
17832
|
+
(0, import_react103.useEffect)(() => {
|
|
17767
17833
|
if (activeTab === "squad" || selectedPlayerId === null) return;
|
|
17768
17834
|
setSelectedPlayerId(null);
|
|
17769
17835
|
clearPlayerDetail?.();
|
|
17770
17836
|
}, [activeTab, selectedPlayerId, clearPlayerDetail]);
|
|
17771
|
-
(0,
|
|
17837
|
+
(0, import_react103.useEffect)(() => {
|
|
17772
17838
|
if (activeTab === "favourites" && !favouritesEnabled) setMonitorTab?.("chat");
|
|
17773
17839
|
}, [activeTab, favouritesEnabled, setMonitorTab]);
|
|
17774
17840
|
const storedTab = tabState?.activeTab;
|
|
17775
|
-
(0,
|
|
17841
|
+
(0, import_react103.useEffect)(() => {
|
|
17776
17842
|
const unreachable = storedTab === "builder" ? !hasBuilder : !monitor && storedTab !== void 0 && storedTab !== "chat";
|
|
17777
17843
|
if (unreachable) setMonitorTab?.("chat");
|
|
17778
17844
|
}, [storedTab, hasBuilder, monitor, setMonitorTab]);
|
|
@@ -17781,11 +17847,12 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17781
17847
|
const closeTab = tabs?.activeTab ?? "chat";
|
|
17782
17848
|
const lastMessage = state.messages[state.messages.length - 1];
|
|
17783
17849
|
const answering = state.isStreaming && !(lastMessage?.role === "assistant" && lastMessage.isGreeting);
|
|
17784
|
-
const closeWith = (0,
|
|
17850
|
+
const closeWith = (0, import_react103.useCallback)((method) => {
|
|
17785
17851
|
track({ name: "widget_close", method, tab: closeTab, answering });
|
|
17786
|
-
|
|
17787
|
-
|
|
17788
|
-
|
|
17852
|
+
if (onCloseRequested) onCloseRequested();
|
|
17853
|
+
else close();
|
|
17854
|
+
}, [track, closeTab, answering, close, onCloseRequested]);
|
|
17855
|
+
(0, import_react103.useEffect)(() => {
|
|
17789
17856
|
const onKey = (e) => {
|
|
17790
17857
|
if (e.key === "Escape") closeWith("escape");
|
|
17791
17858
|
};
|
|
@@ -17801,68 +17868,93 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17801
17868
|
tabs?.setActiveTab("chat");
|
|
17802
17869
|
send(text2, { grounding, source });
|
|
17803
17870
|
};
|
|
17804
|
-
(0,
|
|
17871
|
+
(0, import_react103.useEffect)(() => {
|
|
17805
17872
|
if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
|
|
17806
17873
|
}, [monitor, state.isStreaming, state.messages.length]);
|
|
17807
17874
|
const onChatTab = !tabs || tabs.activeTab === "chat";
|
|
17808
|
-
const inputRef = (0,
|
|
17809
|
-
const limitRef = (0,
|
|
17810
|
-
const typedSendRef = (0,
|
|
17811
|
-
const focusAfterCloseRef = (0,
|
|
17812
|
-
const [tool, setTool] = (0,
|
|
17813
|
-
const panelRef = (0,
|
|
17875
|
+
const inputRef = (0, import_react103.useRef)(null);
|
|
17876
|
+
const limitRef = (0, import_react103.useRef)(null);
|
|
17877
|
+
const typedSendRef = (0, import_react103.useRef)(false);
|
|
17878
|
+
const focusAfterCloseRef = (0, import_react103.useRef)(null);
|
|
17879
|
+
const [tool, setTool] = (0, import_react103.useState)(null);
|
|
17880
|
+
const panelRef = (0, import_react103.useRef)(null);
|
|
17814
17881
|
const settings = useOddsSettings();
|
|
17815
|
-
const [settingsOpen, setSettingsOpen] = (0,
|
|
17882
|
+
const [settingsOpen, setSettingsOpen] = (0, import_react103.useState)(false);
|
|
17816
17883
|
const hasSettings = settings.oddsOffered || !settings.themeLocked;
|
|
17817
|
-
const openSettings = (0,
|
|
17884
|
+
const openSettings = (0, import_react103.useCallback)(() => {
|
|
17818
17885
|
setTool(null);
|
|
17819
17886
|
setSettingsOpen(true);
|
|
17820
17887
|
}, []);
|
|
17821
|
-
const closeSettings = (0,
|
|
17888
|
+
const closeSettings = (0, import_react103.useCallback)(() => {
|
|
17822
17889
|
setSettingsOpen(false);
|
|
17823
17890
|
panelRef.current?.querySelector(".ss-w-kebab")?.focus();
|
|
17824
17891
|
}, []);
|
|
17825
17892
|
const paused = isPaused(state.limit);
|
|
17826
|
-
(0,
|
|
17893
|
+
(0, import_react103.useEffect)(() => {
|
|
17827
17894
|
if (paused) setTool(null);
|
|
17828
17895
|
}, [paused]);
|
|
17829
|
-
(0,
|
|
17896
|
+
(0, import_react103.useEffect)(() => {
|
|
17830
17897
|
if (!paused) return;
|
|
17831
17898
|
if (typedSendRef.current) limitRef.current?.focus();
|
|
17832
17899
|
typedSendRef.current = false;
|
|
17833
17900
|
}, [paused]);
|
|
17834
|
-
const openTool = (0,
|
|
17901
|
+
const openTool = (0, import_react103.useCallback)((next) => {
|
|
17835
17902
|
setTool(next);
|
|
17836
17903
|
}, []);
|
|
17837
|
-
const toolsValue = (0,
|
|
17904
|
+
const toolsValue = (0, import_react103.useMemo)(
|
|
17838
17905
|
() => presetGrid && !paused ? { openBuilder: (total, legs) => openTool({ total, legs }), changeLabel: ui.presets.changeCombo } : null,
|
|
17839
17906
|
[presetGrid, paused, openTool, ui.presets.changeCombo]
|
|
17840
17907
|
);
|
|
17841
|
-
const closeTool = (0,
|
|
17908
|
+
const closeTool = (0, import_react103.useCallback)(() => {
|
|
17842
17909
|
focusAfterCloseRef.current = "composer";
|
|
17843
17910
|
setTool(null);
|
|
17844
17911
|
}, []);
|
|
17845
|
-
const sendAsk = (0,
|
|
17912
|
+
const sendAsk = (0, import_react103.useCallback)((ask) => {
|
|
17846
17913
|
focusAfterCloseRef.current = "composer";
|
|
17847
17914
|
setTool(null);
|
|
17848
17915
|
tabs?.setActiveTab("chat");
|
|
17849
17916
|
send(ask.message, { displayText: ask.displayText, preset: ask.preset, source: "preset" });
|
|
17850
17917
|
}, [tabs, send]);
|
|
17851
|
-
const formatKickoff = (0,
|
|
17918
|
+
const formatKickoff = (0, import_react103.useCallback)((kickoffUtc) => {
|
|
17852
17919
|
const k = ui.bettingKickoff(kickoffUtc);
|
|
17853
17920
|
return `${k.dayLabel} ${k.time}`;
|
|
17854
17921
|
}, [ui]);
|
|
17855
|
-
(0,
|
|
17922
|
+
(0, import_react103.useEffect)(() => {
|
|
17856
17923
|
if (tool) return;
|
|
17857
17924
|
const target = focusAfterCloseRef.current;
|
|
17858
17925
|
focusAfterCloseRef.current = null;
|
|
17859
17926
|
if (target === "composer") inputRef.current?.focus();
|
|
17860
17927
|
}, [tool]);
|
|
17861
|
-
(0,
|
|
17928
|
+
(0, import_react103.useEffect)(() => {
|
|
17862
17929
|
if (!tool || onChatTab && presetGrid) return;
|
|
17863
17930
|
focusAfterCloseRef.current = "composer";
|
|
17864
17931
|
setTool(null);
|
|
17865
17932
|
}, [tool, onChatTab, presetGrid]);
|
|
17933
|
+
const backRef = (0, import_react103.useRef)(() => false);
|
|
17934
|
+
backRef.current = () => {
|
|
17935
|
+
if (settingsOpen && hasSettings) {
|
|
17936
|
+
closeSettings();
|
|
17937
|
+
return true;
|
|
17938
|
+
}
|
|
17939
|
+
if (tool) {
|
|
17940
|
+
closeTool();
|
|
17941
|
+
return true;
|
|
17942
|
+
}
|
|
17943
|
+
if (selectedPlayerId !== null) {
|
|
17944
|
+
closePlayer();
|
|
17945
|
+
return true;
|
|
17946
|
+
}
|
|
17947
|
+
if (tabs && tabs.activeTab !== "chat") {
|
|
17948
|
+
tabs.setActiveTab("chat");
|
|
17949
|
+
return true;
|
|
17950
|
+
}
|
|
17951
|
+
return false;
|
|
17952
|
+
};
|
|
17953
|
+
(0, import_react103.useEffect)(() => {
|
|
17954
|
+
if (!onRegisterBack) return;
|
|
17955
|
+
onRegisterBack(() => backRef.current());
|
|
17956
|
+
return () => onRegisterBack(null);
|
|
17957
|
+
}, [onRegisterBack]);
|
|
17866
17958
|
return /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { ref: panelRef, className: "ss-w-panel", role: "dialog", "aria-modal": isModal, "aria-label": ui.chatDialogLabel, children: [
|
|
17867
17959
|
/* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
|
|
17868
17960
|
ChatHeader,
|
|
@@ -18224,6 +18316,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
18224
18316
|
.ss-w-root[data-ss-w-pos="right"] .ss-w-panel,
|
|
18225
18317
|
.ss-w-root[data-ss-w-pos="left"] .ss-w-panel { inset: 0; width: auto; height: auto; border: none; border-radius: 0; }
|
|
18226
18318
|
}
|
|
18319
|
+
.ss-w-root[data-ss-w-mobile] .ss-w-panel { inset: 0; width: 100%; height: 100%; max-width: none; border: 0; border-radius: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
|
|
18227
18320
|
.ss-w-header { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--ss-w-line); }
|
|
18228
18321
|
.ss-w-header-mark { width: 18px; height: 18px; display: block; object-fit: contain; }
|
|
18229
18322
|
.ss-w-header-title { font-weight: 660; flex: 1; }
|
|
@@ -18284,7 +18377,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
18284
18377
|
/* Entity card: identity header row over a horizontal stat strip */
|
|
18285
18378
|
.ss-w-ecard { display: flex; flex-direction: column; width: 100%; background: var(--ss-w-panel); border: 1px solid var(--ss-w-line); border-radius: 12px; overflow: hidden; text-align: left; }
|
|
18286
18379
|
|
|
18287
|
-
.ss-w-ecard-idtext { display: flex; flex-direction: column; gap: 1px; min-width:
|
|
18380
|
+
.ss-w-ecard-idtext { display: flex; flex-direction: column; gap: 1px; min-width: 45%; max-width: 100%; flex: 1 1 0; }
|
|
18288
18381
|
.ss-w-thumb { width: 54px; height: 54px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 16px; font-weight: 700; color: #fff; background-color: var(--ss-w-nav); background-size: cover; background-position: center; box-shadow: 0 1px 3px rgba(0,0,0,.14); }
|
|
18289
18382
|
.ss-w-thumb.ss-w-team { border-radius: 12px; }
|
|
18290
18383
|
.ss-w-ecard[data-kind="player"] .ss-w-thumb { background-color: var(--ss-w-accent); }
|
|
@@ -18295,10 +18388,10 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
18295
18388
|
.ss-w-ecard-bare { display: flex; align-items: center; }
|
|
18296
18389
|
.ss-w-ecard-bare .ss-w-ecard-hd { padding: 10px 12px; }
|
|
18297
18390
|
|
|
18298
|
-
.ss-w-ecard-hd { display: flex; align-items: center; gap: 11px; padding: 11px 13px; }
|
|
18391
|
+
.ss-w-ecard-hd { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 11px; padding: 11px 13px; }
|
|
18299
18392
|
.ss-w-ecard-hd .ss-w-thumb { width: 40px; height: 40px; font-size: 13px; box-shadow: none; }
|
|
18300
18393
|
.ss-w-ecard-hd .ss-w-thumb.ss-w-team { border-radius: 10px; }
|
|
18301
|
-
.ss-w-ecard-meta { display: inline-flex; align-items: center; gap: 7px; flex:
|
|
18394
|
+
.ss-w-ecard-meta { display: inline-flex; align-items: center; gap: 7px; flex: 0 1 auto; min-width: 0; align-self: flex-start; margin-left: auto; }
|
|
18302
18395
|
.ss-w-ecard-meta .ss-w-ecard-season { margin: 0; }
|
|
18303
18396
|
|
|
18304
18397
|
/* scope tabs: reuse the underline pattern, relocated above the strip */
|
|
@@ -18312,11 +18405,17 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
18312
18405
|
.ss-w-ecard-season { flex: none; margin-left: auto; align-self: center; margin-bottom: 5px; font-size: 10.5px; font-weight: 700; color: var(--ss-w-accent); background: color-mix(in srgb, var(--ss-w-accent) 13%, var(--ss-w-panel)); border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
|
|
18313
18406
|
|
|
18314
18407
|
/* stat strip: 1px gap over a line-colored ground paints hairlines between cells, wrap-safe */
|
|
18315
|
-
.ss-w-ecard-strip { display: grid; gap: 1px; background: var(--ss-w-line); border-top: 1px solid var(--ss-w-line); }
|
|
18408
|
+
.ss-w-ecard-strip { display: grid; gap: 1px; background: var(--ss-w-line); border-top: 1px solid var(--ss-w-line); max-height: calc(2 * 68px + 1px); overflow-y: auto; overscroll-behavior: contain; }
|
|
18409
|
+
.ss-w-ecard-strip--noted { max-height: calc(2 * 86px + 1px); }
|
|
18410
|
+
.ss-w-ecard-strip--more { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 14px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 14px), transparent); }
|
|
18316
18411
|
.ss-w-ecard-cell { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px; padding: 10px 4px 11px; background: var(--ss-w-panel); }
|
|
18317
18412
|
.ss-w-ecard-cval { height: 20px; display: flex; align-items: center; font-size: 17px; font-weight: 720; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
|
|
18318
18413
|
.ss-w-ecard-cval .ss-w-form { width: 42px; }
|
|
18319
|
-
.ss-w-ecard-clabel { font-size: 9px; text-transform: uppercase; letter-spacing: .05em; color: var(--ss-w-faint); font-weight: 600; font-variant-numeric: tabular-nums; }
|
|
18414
|
+
.ss-w-ecard-clabel { font-size: 9px; text-transform: uppercase; letter-spacing: .05em; color: var(--ss-w-faint); font-weight: 600; font-variant-numeric: tabular-nums; text-align: center; line-height: 1.3; min-height: 2.6em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
|
|
18415
|
+
.ss-w-ecard-cell--muted > * { opacity: .55; }
|
|
18416
|
+
.ss-w-ecard-note { font-size: 9.5px; color: var(--ss-w-faint); font-style: italic; }
|
|
18417
|
+
.ss-w-ecard-period { font-size: 10.5px; color: var(--ss-w-faint); padding: 6px 13px 8px; border-top: 1px solid var(--ss-w-line); }
|
|
18418
|
+
.ss-w-ecard-chip { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 10.5px; font-weight: 650; color: var(--ss-w-ink); border: 1px solid var(--ss-w-line); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
|
|
18320
18419
|
|
|
18321
18420
|
.ss-w-form { justify-self: end; display: flex; height: 6px; width: 48px; border-radius: 4px; overflow: hidden; gap: 2px; }
|
|
18322
18421
|
.ss-w-form span { display: block; border-radius: 2px; }
|
|
@@ -20810,12 +20909,12 @@ function injectStyles(root) {
|
|
|
20810
20909
|
function StatsWidget(props) {
|
|
20811
20910
|
const injectedClient = "client" in props ? props.client : void 0;
|
|
20812
20911
|
const cfg = props.config;
|
|
20813
|
-
const built = (0,
|
|
20814
|
-
const trackingRef = (0,
|
|
20815
|
-
const track = (0,
|
|
20816
|
-
const eventTextRef = (0,
|
|
20912
|
+
const built = (0, import_react104.useMemo)(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
|
|
20913
|
+
const trackingRef = (0, import_react104.useRef)({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
|
|
20914
|
+
const track = (0, import_react104.useMemo)(() => createTracker(() => trackingRef.current), []);
|
|
20915
|
+
const eventTextRef = (0, import_react104.useRef)(false);
|
|
20817
20916
|
eventTextRef.current = cfg?.eventText === true;
|
|
20818
|
-
const logger = (0,
|
|
20917
|
+
const logger = (0, import_react104.useMemo)(() => {
|
|
20819
20918
|
if (!built) return null;
|
|
20820
20919
|
const raw = built.client.createEventLogger({
|
|
20821
20920
|
operatorUserId: cfg?.userContext?.operatorUserId,
|
|
@@ -20825,27 +20924,27 @@ function StatsWidget(props) {
|
|
|
20825
20924
|
}, [built?.client, track]);
|
|
20826
20925
|
const widgetStrings = useWidgetStrings(cfg, built?.conversation ?? null);
|
|
20827
20926
|
const stringsPending = widgetStrings.strings === void 0;
|
|
20828
|
-
const ui = (0,
|
|
20927
|
+
const ui = (0, import_react104.useMemo)(
|
|
20829
20928
|
() => normalizeUi(props.config ?? { operatorId: "", publicKey: "" }, widgetStrings.strings ?? BUNDLED),
|
|
20830
20929
|
[props.config, widgetStrings.strings]
|
|
20831
20930
|
);
|
|
20832
20931
|
const oddsSettings = useOddsSettingsState(ui, built?.conversation, cfg?.operatorId || "default");
|
|
20833
|
-
const rootRef = (0,
|
|
20834
|
-
const introDoneRef = (0,
|
|
20835
|
-
const markIntroDone = (0,
|
|
20932
|
+
const rootRef = (0, import_react104.useRef)(null);
|
|
20933
|
+
const introDoneRef = (0, import_react104.useRef)(false);
|
|
20934
|
+
const markIntroDone = (0, import_react104.useCallback)(() => {
|
|
20836
20935
|
introDoneRef.current = true;
|
|
20837
20936
|
}, []);
|
|
20838
20937
|
const language = injectedClient ? void 0 : hostTag(cfg);
|
|
20839
20938
|
const threadLanguage = familyOf(language);
|
|
20840
20939
|
const convStorageKey = `ss-w-conv:${cfg?.operatorId ?? ""}:${cfg?.userContext?.operatorUserId ?? "anon"}${threadLanguage ? `:lang=${threadLanguage}` : ""}`;
|
|
20841
|
-
const sportScope = (0,
|
|
20940
|
+
const sportScope = (0, import_react104.useMemo)(
|
|
20842
20941
|
() => ({ operatorId: cfg?.operatorId ?? "", operatorUserId: cfg?.userContext?.operatorUserId, anonymousUserId: cfg?.userContext?.anonymousUserId }),
|
|
20843
20942
|
[cfg?.operatorId, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId]
|
|
20844
20943
|
);
|
|
20845
|
-
const chatTracking = (0,
|
|
20944
|
+
const chatTracking = (0, import_react104.useMemo)(() => ({ track, eventText: () => eventTextRef.current }), [track]);
|
|
20846
20945
|
const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey, cfg?.page, sportScope, language, chatTracking, injectedClient ? oddsSettings.userOddsFormat : oddsSettings.oddsFormat);
|
|
20847
20946
|
const panelOpen = controller.state.isOpen && !stringsPending;
|
|
20848
|
-
const liveCardWatches = (0,
|
|
20947
|
+
const liveCardWatches = (0, import_react104.useMemo)(() => {
|
|
20849
20948
|
const seen2 = /* @__PURE__ */ new Set();
|
|
20850
20949
|
const out = [];
|
|
20851
20950
|
for (const msg of controller.state.messages) {
|
|
@@ -20871,19 +20970,19 @@ function StatsWidget(props) {
|
|
|
20871
20970
|
});
|
|
20872
20971
|
const operatorUserId = cfg?.userContext?.operatorUserId;
|
|
20873
20972
|
const anonymousUserId = cfg?.userContext?.anonymousUserId;
|
|
20874
|
-
const getSchedule = (0,
|
|
20973
|
+
const getSchedule = (0, import_react104.useCallback)(
|
|
20875
20974
|
(localDate, utcOffsetMinutes) => built ? built.conversation.getSchedule(localDate, utcOffsetMinutes, operatorUserId, anonymousUserId) : Promise.resolve(null),
|
|
20876
20975
|
[built, operatorUserId, anonymousUserId]
|
|
20877
20976
|
);
|
|
20878
|
-
const getStates = (0,
|
|
20977
|
+
const getStates = (0, import_react104.useCallback)(
|
|
20879
20978
|
(matchIds, nbaGameIds, nflGameIds, tennisMatches) => built ? built.conversation.getStates(matchIds, nbaGameIds, nflGameIds, requestTag, tennisMatches) : Promise.resolve(null),
|
|
20880
20979
|
[built, requestTag]
|
|
20881
20980
|
);
|
|
20882
|
-
const getTennisPrices = (0,
|
|
20981
|
+
const getTennisPrices = (0, import_react104.useCallback)(
|
|
20883
20982
|
(keys) => built ? built.conversation.getStates([], [], [], requestTag, [], keys).then((p) => p?.tennisPrices ?? null) : Promise.resolve(null),
|
|
20884
20983
|
[built, requestTag]
|
|
20885
20984
|
);
|
|
20886
|
-
const pinnedMatchIds = (0,
|
|
20985
|
+
const pinnedMatchIds = (0, import_react104.useMemo)(
|
|
20887
20986
|
() => footballMatchPinIds(monitor.pins),
|
|
20888
20987
|
[monitor.pins]
|
|
20889
20988
|
);
|
|
@@ -20897,13 +20996,13 @@ function StatsWidget(props) {
|
|
|
20897
20996
|
pinnedMatchIds,
|
|
20898
20997
|
timeZone: ui.timeZone
|
|
20899
20998
|
});
|
|
20900
|
-
const offeredSports = (0,
|
|
20999
|
+
const offeredSports = (0, import_react104.useMemo)(() => {
|
|
20901
21000
|
const seen2 = new Set(discovery.matchDays.map((d) => d.sport));
|
|
20902
21001
|
for (const g of discovery.groups) seen2.add(g.sport ?? "football");
|
|
20903
21002
|
return [...seen2];
|
|
20904
21003
|
}, [discovery.matchDays, discovery.groups]);
|
|
20905
21004
|
const scheduleSport = useScheduleSport(offeredSports);
|
|
20906
|
-
const [liveLeague, setLiveLeague] = (0,
|
|
21005
|
+
const [liveLeague, setLiveLeague] = (0, import_react104.useState)(null);
|
|
20907
21006
|
const [matchesDay, setMatchesDay] = useMatchesDayPick(discovery.localDate);
|
|
20908
21007
|
const matchesLoaded = useMatchesDay({
|
|
20909
21008
|
discovery,
|
|
@@ -20913,8 +21012,8 @@ function StatsWidget(props) {
|
|
|
20913
21012
|
enabled: panelOpen && monitor.activeTab === "matches",
|
|
20914
21013
|
timeZone: ui.timeZone
|
|
20915
21014
|
});
|
|
20916
|
-
const prevLiveSnapshotRef = (0,
|
|
20917
|
-
(0,
|
|
21015
|
+
const prevLiveSnapshotRef = (0, import_react104.useRef)(monitor.snapshot);
|
|
21016
|
+
(0, import_react104.useEffect)(() => {
|
|
20918
21017
|
const snap = monitor.snapshot;
|
|
20919
21018
|
if (!snap || snap === prevLiveSnapshotRef.current) return;
|
|
20920
21019
|
prevLiveSnapshotRef.current = snap;
|
|
@@ -20954,14 +21053,14 @@ function StatsWidget(props) {
|
|
|
20954
21053
|
const clubSquadResult = useClubSquad(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
20955
21054
|
const clubSquadStatsResult = useClubSquadStats(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
20956
21055
|
const clubPlayerDetailResult = useClubPlayerDetail(built?.conversation ?? null);
|
|
20957
|
-
const [favSportPick, setFavSportPick] = (0,
|
|
20958
|
-
const latestGreeting = (0,
|
|
21056
|
+
const [favSportPick, setFavSportPick] = (0, import_react104.useState)(null);
|
|
21057
|
+
const latestGreeting = (0, import_react104.useMemo)(() => {
|
|
20959
21058
|
for (const m of [...controller.state.messages].reverse()) {
|
|
20960
21059
|
if (m.role === "assistant" && m.defaultSport !== void 0) return m;
|
|
20961
21060
|
}
|
|
20962
21061
|
return null;
|
|
20963
21062
|
}, [controller.state.messages]);
|
|
20964
|
-
const favSportOptions = (0,
|
|
21063
|
+
const favSportOptions = (0, import_react104.useMemo)(
|
|
20965
21064
|
() => (switchSets(latestGreeting?.greetingDashboards) ?? []).map((set) => ({ sport: set.sport, label: set.label })),
|
|
20966
21065
|
[latestGreeting]
|
|
20967
21066
|
);
|
|
@@ -20970,20 +21069,20 @@ function StatsWidget(props) {
|
|
|
20970
21069
|
const favSport = [favSportPick, rememberedSport, latestGreeting?.defaultSport].find(offered) ?? "football";
|
|
20971
21070
|
const favSports = favSportOptions.length > 0 ? favSportOptions : [{ sport: favSport, label: sportLabel(ui, favSport) }];
|
|
20972
21071
|
const hasFavouritesIdentity = !!(operatorUserId || anonymousUserId);
|
|
20973
|
-
const [builderSportPick, setBuilderSportPick] = (0,
|
|
20974
|
-
const builderGreeting = (0,
|
|
21072
|
+
const [builderSportPick, setBuilderSportPick] = (0, import_react104.useState)(null);
|
|
21073
|
+
const builderGreeting = (0, import_react104.useMemo)(
|
|
20975
21074
|
() => [...controller.state.messages].reverse().find((m) => m.role === "assistant" && (m.greetingDashboard !== void 0 || m.greetingDashboards !== void 0)) ?? null,
|
|
20976
21075
|
[controller.state.messages]
|
|
20977
21076
|
);
|
|
20978
|
-
const [coolOff, setCoolOff] = (0,
|
|
20979
|
-
const onBuilderCoolOff = (0,
|
|
21077
|
+
const [coolOff, setCoolOff] = (0, import_react104.useState)(null);
|
|
21078
|
+
const onBuilderCoolOff = (0, import_react104.useCallback)((sport) => {
|
|
20980
21079
|
if (!builderGreeting) return;
|
|
20981
21080
|
setCoolOff((prev) => {
|
|
20982
21081
|
const sports = prev?.greeting === builderGreeting ? prev.sports : [];
|
|
20983
21082
|
return sports.includes(sport) ? prev : { greeting: builderGreeting, sports: [...sports, sport] };
|
|
20984
21083
|
});
|
|
20985
21084
|
}, [builderGreeting]);
|
|
20986
|
-
const builderOptions = (0,
|
|
21085
|
+
const builderOptions = (0, import_react104.useMemo)(() => {
|
|
20987
21086
|
const greeting = builderGreeting;
|
|
20988
21087
|
if (!greeting) return [];
|
|
20989
21088
|
const cooled = coolOff?.greeting === greeting ? coolOff.sports : [];
|
|
@@ -20996,7 +21095,7 @@ function StatsWidget(props) {
|
|
|
20996
21095
|
return options.filter((o) => !cooled.includes(o.sport));
|
|
20997
21096
|
}, [builderGreeting, coolOff, ui]);
|
|
20998
21097
|
const builderSport = [builderSportPick, rememberedSport, latestGreeting?.defaultSport].find((s) => !!s && builderOptions.some((o) => o.sport === s)) ?? builderOptions[0]?.sport ?? "";
|
|
20999
|
-
const [panelEverOpened, setPanelEverOpened] = (0,
|
|
21098
|
+
const [panelEverOpened, setPanelEverOpened] = (0, import_react104.useState)(panelOpen);
|
|
21000
21099
|
if (panelOpen && !panelEverOpened) setPanelEverOpened(true);
|
|
21001
21100
|
const favourites = useFavourites({
|
|
21002
21101
|
conversation: built?.conversation ?? null,
|
|
@@ -21008,14 +21107,14 @@ function StatsWidget(props) {
|
|
|
21008
21107
|
onChanged: discovery.refreshSchedule
|
|
21009
21108
|
});
|
|
21010
21109
|
const favouritesEnabled = hasFavouritesIdentity && favourites.status !== "refused";
|
|
21011
|
-
const getPricePresets = (0,
|
|
21110
|
+
const getPricePresets = (0, import_react104.useCallback)(
|
|
21012
21111
|
(locale) => built ? built.conversation.getPricePresets(locale, { pool: "open" }) : Promise.resolve(null),
|
|
21013
21112
|
[built]
|
|
21014
21113
|
);
|
|
21015
21114
|
const presetGrid = usePresetGrid({ getPricePresets, isOpen: panelOpen, locale: ui.hostTag });
|
|
21016
21115
|
const markLiveActivity = monitor.markLiveActivity;
|
|
21017
|
-
const prevLiveCountRef = (0,
|
|
21018
|
-
(0,
|
|
21116
|
+
const prevLiveCountRef = (0, import_react104.useRef)(0);
|
|
21117
|
+
(0, import_react104.useEffect)(() => {
|
|
21019
21118
|
const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
|
|
21020
21119
|
prevLiveCountRef.current = discovery.liveCount;
|
|
21021
21120
|
if (rose) markLiveActivity();
|
|
@@ -21029,7 +21128,7 @@ function StatsWidget(props) {
|
|
|
21029
21128
|
closePanel: controller.close
|
|
21030
21129
|
});
|
|
21031
21130
|
const markAdded = hostEvents.markAdded;
|
|
21032
|
-
const slip = (0,
|
|
21131
|
+
const slip = (0, import_react104.useMemo)(
|
|
21033
21132
|
() => {
|
|
21034
21133
|
const handler = props.config?.onAddToSlip;
|
|
21035
21134
|
return {
|
|
@@ -21049,12 +21148,10 @@ function StatsWidget(props) {
|
|
|
21049
21148
|
},
|
|
21050
21149
|
[props.config?.onAddToSlip, props.config?.slipSports, controller.state.conversationId, markAdded]
|
|
21051
21150
|
);
|
|
21052
|
-
const onDashboardTap = (0,
|
|
21151
|
+
const onDashboardTap = (0, import_react104.useMemo)(
|
|
21053
21152
|
() => built ? createDashboardTapSignal((input) => built.conversation.sendSignal(input), logger) : void 0,
|
|
21054
21153
|
[built, logger]
|
|
21055
21154
|
);
|
|
21056
|
-
const dismissPopup = usePopupTelemetry(logger, panelOpen, controller.state.popupText, controller.dismissPopup);
|
|
21057
|
-
useOpenTelemetry(logger, panelOpen);
|
|
21058
21155
|
const asks = bubbleAsks(controller.state.messages, ui.presets.standoutAsk, oddsSettings.oddsFormat).map((ask) => ({
|
|
21059
21156
|
label: ask.label,
|
|
21060
21157
|
onTap: () => runBubbleAsk(ask, {
|
|
@@ -21065,10 +21162,24 @@ function StatsWidget(props) {
|
|
|
21065
21162
|
log: logger
|
|
21066
21163
|
})
|
|
21067
21164
|
}));
|
|
21068
|
-
const
|
|
21165
|
+
const dismissPopupRef = (0, import_react104.useRef)(() => {
|
|
21166
|
+
});
|
|
21167
|
+
const mobile = useMobileBinding({
|
|
21168
|
+
binding: props.mobile,
|
|
21169
|
+
panelOpen,
|
|
21170
|
+
popupText: controller.state.popupText,
|
|
21171
|
+
asks,
|
|
21172
|
+
open: controller.open,
|
|
21173
|
+
close: controller.close,
|
|
21174
|
+
dismissPopup: () => dismissPopupRef.current()
|
|
21175
|
+
});
|
|
21176
|
+
const dismissPopup = usePopupTelemetry(logger, panelOpen, controller.state.popupText, controller.dismissPopup, mobile.confirmedShown);
|
|
21177
|
+
dismissPopupRef.current = dismissPopup;
|
|
21178
|
+
useOpenTelemetry(logger, panelOpen);
|
|
21179
|
+
const onControlRef = (0, import_react104.useRef)(props.onControl);
|
|
21069
21180
|
onControlRef.current = props.onControl;
|
|
21070
21181
|
const { open: openPanel, close: closePanel } = controller;
|
|
21071
|
-
(0,
|
|
21182
|
+
(0, import_react104.useEffect)(() => {
|
|
21072
21183
|
onControlRef.current?.({ open: openPanel, close: closePanel });
|
|
21073
21184
|
return () => onControlRef.current?.(null);
|
|
21074
21185
|
}, [openPanel, closePanel]);
|
|
@@ -21085,11 +21196,11 @@ function StatsWidget(props) {
|
|
|
21085
21196
|
page: cfg?.page
|
|
21086
21197
|
}
|
|
21087
21198
|
};
|
|
21088
|
-
(0,
|
|
21199
|
+
(0, import_react104.useEffect)(() => {
|
|
21089
21200
|
if (!logger) return;
|
|
21090
21201
|
logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
|
|
21091
21202
|
}, [logger, operatorUserId, anonymousUserId, conversationId]);
|
|
21092
|
-
(0,
|
|
21203
|
+
(0, import_react104.useEffect)(() => {
|
|
21093
21204
|
if (!logger) return;
|
|
21094
21205
|
logger.resume();
|
|
21095
21206
|
const onHide = () => {
|
|
@@ -21107,15 +21218,15 @@ function StatsWidget(props) {
|
|
|
21107
21218
|
logger.dispose();
|
|
21108
21219
|
};
|
|
21109
21220
|
}, [logger]);
|
|
21110
|
-
(0,
|
|
21221
|
+
(0, import_react104.useEffect)(() => {
|
|
21111
21222
|
if (!built || !ui.injectStyles || widgetStrings.state === "unavailable") return;
|
|
21112
21223
|
const node = rootRef.current?.getRootNode();
|
|
21113
21224
|
if (node) injectStyles(node);
|
|
21114
21225
|
}, [built, ui.injectStyles, widgetStrings.state]);
|
|
21115
21226
|
const holds = useSessionHolds();
|
|
21116
21227
|
const builderConversation = built?.conversation ?? null;
|
|
21117
|
-
const builderMemory = (0,
|
|
21118
|
-
const personalGreeting = (0,
|
|
21228
|
+
const builderMemory = (0, import_react104.useMemo)(() => createBuilderMemory(), [builderConversation, controller.state.threadEpoch]);
|
|
21229
|
+
const personalGreeting = (0, import_react104.useMemo)(() => ({
|
|
21119
21230
|
favourites: favouritesEnabled && monitor.enabled ? favourites : null,
|
|
21120
21231
|
conversation: built?.conversation ?? null,
|
|
21121
21232
|
openFavourites: () => monitor.setActiveTab("favourites"),
|
|
@@ -21128,7 +21239,7 @@ function StatsWidget(props) {
|
|
|
21128
21239
|
}), [favouritesEnabled, monitor.enabled, clubFixturesResult.settled, clubFixturesResult.tabReady, clubFixturesResult.enabled, monitor.setActiveTab, favourites, built, holds, builderMemory]);
|
|
21129
21240
|
if (!built || widgetStrings.state === "unavailable") return null;
|
|
21130
21241
|
const attrs = themeAttrs(ui, oddsSettings.userTheme);
|
|
21131
|
-
return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(EventLogContext.Provider, { value: logger, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(TrackingContext.Provider, { value: track, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(SportScopeContext.Provider, { value: sportScope, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(OddsSettingsContext.Provider, { value: oddsSettings, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(HostEventsProvider, { value: hostEvents, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("div", { ref: rootRef, className: "ss-w-root", "data-ss-w-theme": attrs["data-ss-w-theme"], "data-ss-w-pos": attrs["data-ss-w-pos"], style: attrs.style, children: panelOpen ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(PersonalGreetingContext.Provider, { value: personalGreeting, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
21242
|
+
return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(EventLogContext.Provider, { value: logger, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(TrackingContext.Provider, { value: track, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(SportScopeContext.Provider, { value: sportScope, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(OddsSettingsContext.Provider, { value: oddsSettings, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(HostEventsProvider, { value: hostEvents, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("div", { ref: rootRef, className: "ss-w-root", "data-ss-w-theme": attrs["data-ss-w-theme"], "data-ss-w-pos": attrs["data-ss-w-pos"], "data-ss-w-mobile": props.mobile ? "" : void 0, style: attrs.style, children: panelOpen ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(PersonalGreetingContext.Provider, { value: personalGreeting, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
21132
21243
|
ChatPanel,
|
|
21133
21244
|
{
|
|
21134
21245
|
controller,
|
|
@@ -21160,9 +21271,11 @@ function StatsWidget(props) {
|
|
|
21160
21271
|
presetGrid,
|
|
21161
21272
|
favouritesEnabled: favouritesEnabled && clubFixturesResult.tabReady && !clubFixturesResult.enabled,
|
|
21162
21273
|
favourites: { controller: favourites, sport: favSport, sports: favSports, onSportChange: setFavSportPick },
|
|
21163
|
-
builder: { options: builderOptions, sport: builderSport, onSportChange: setBuilderSportPick, onCoolOff: onBuilderCoolOff, tabs: monitor }
|
|
21274
|
+
builder: { options: builderOptions, sport: builderSport, onSportChange: setBuilderSportPick, onCoolOff: onBuilderCoolOff, tabs: monitor },
|
|
21275
|
+
onCloseRequested: mobile.onCloseRequested,
|
|
21276
|
+
onRegisterBack: mobile.onRegisterBack
|
|
21164
21277
|
}
|
|
21165
|
-
) }) : /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
21278
|
+
) }) : props.mobile ? null : /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
21166
21279
|
ChatFab,
|
|
21167
21280
|
{
|
|
21168
21281
|
label: stringsPending ? cfg?.launcherLabel : ui.launcherLabel,
|
|
@@ -21188,6 +21301,7 @@ function emptyConversation() {
|
|
|
21188
21301
|
0 && (module.exports = {
|
|
21189
21302
|
StatsWidget,
|
|
21190
21303
|
WIDGET_CSS,
|
|
21304
|
+
WIDGET_REACT_VERSION,
|
|
21191
21305
|
createWidgetHost
|
|
21192
21306
|
});
|
|
21193
21307
|
//# sourceMappingURL=index.cjs.map
|