@sensiblestats/widget-react 0.130.1 → 0.132.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/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/StatsWidget.tsx
2
- import { useCallback as useCallback27, useEffect as useEffect52, useMemo as useMemo13, useRef as useRef43, useState as useState79 } from "react";
2
+ import { useCallback as useCallback28, useEffect as useEffect54, useMemo as useMemo13, useRef as useRef46, useState as useState80 } from "react";
3
3
  import { StatsWidgetClient } from "@sensiblestats/widget-sdk";
4
4
 
5
5
  // src/strings/tag.ts
@@ -1285,7 +1285,7 @@ function parseOddsFormat(value) {
1285
1285
  }
1286
1286
 
1287
1287
  // src/version.generated.ts
1288
- var WIDGET_REACT_VERSION = "0.130.1";
1288
+ var WIDGET_REACT_VERSION = "0.132.0";
1289
1289
 
1290
1290
  // src/config.ts
1291
1291
  function hostTag(cfg) {
@@ -1650,8 +1650,9 @@ function normalizeUi(cfg, loaded) {
1650
1650
  };
1651
1651
  }
1652
1652
  function toClientOptions(cfg) {
1653
- const opts = { operatorId: cfg.operatorId, publicKey: cfg.publicKey, client: `widget-react/${WIDGET_REACT_VERSION}` };
1653
+ const opts = { operatorId: cfg.operatorId, publicKey: cfg.publicKey, client: `${cfg.transport?.client ?? "widget-react"}/${WIDGET_REACT_VERSION}` };
1654
1654
  if (cfg.baseUrl !== void 0) opts.baseUrl = cfg.baseUrl;
1655
+ if (cfg.transport?.fetch !== void 0) opts.fetch = cfg.transport.fetch;
1655
1656
  return opts;
1656
1657
  }
1657
1658
  function toUserContext(cfg) {
@@ -6002,7 +6003,7 @@ function useSlipAdd(slip, ui) {
6002
6003
  const handler = slip.onAddToSlip;
6003
6004
  const rawLabels = !!ui?.rawBettingLabels;
6004
6005
  const operatorFormat = ui?.oddsFormat ?? "decimal";
6005
- return useCallback14(async (selection, { marketDeveloperName, selectionLabel, line }) => {
6006
+ return useCallback14(async (selection, { marketDeveloperName, selectionLabel, line, fact }) => {
6006
6007
  if (!handler) return { kind: "failed" };
6007
6008
  const display = slipDisplay({ ...selection.display, market: marketDeveloperName, selection: selectionLabel, line });
6008
6009
  const out = toHostSelection(display ? { ...selection, display } : selection, operatorFormat);
@@ -6017,11 +6018,13 @@ function useSlipAdd(slip, ui) {
6017
6018
  matchId: out.matchId,
6018
6019
  odds: out.oddsDecimal,
6019
6020
  ...marketDeveloperName !== void 0 ? { market: marketDeveloperName } : {},
6020
- ...out.sport !== void 0 ? { sport: out.sport } : {}
6021
+ ...out.sport !== void 0 ? { sport: out.sport } : {},
6022
+ ...fact ? { factKey: fact.factKey } : {}
6021
6023
  };
6024
+ const factTag = fact ? { factId: String(fact.id), factKey: fact.factKey } : {};
6022
6025
  track({ name: "add_to_slip_click", ...clickFields });
6023
6026
  if (marketDeveloperName !== void 0) {
6024
- log?.log({ name: "slip_click", entityType: "market", marketDeveloperName, entityId: marketDeveloperName, ...pick, ...sportField });
6027
+ log?.log({ name: "slip_click", entityType: "market", marketDeveloperName, entityId: marketDeveloperName, ...pick, ...sportField, ...factTag });
6025
6028
  }
6026
6029
  try {
6027
6030
  const raw = await withTimeout(Promise.resolve(handler(out)));
@@ -6036,7 +6039,8 @@ function useSlipAdd(slip, ui) {
6036
6039
  entityId: marketDeveloperName,
6037
6040
  outcome: slipOutcome(result),
6038
6041
  ...pick,
6039
- ...sportField
6042
+ ...sportField,
6043
+ ...factTag
6040
6044
  });
6041
6045
  }
6042
6046
  if (slipState) {
@@ -6049,7 +6053,7 @@ function useSlipAdd(slip, ui) {
6049
6053
  } catch {
6050
6054
  track({ name: "add_to_slip_result", outcome: "timeout", ...clickFields });
6051
6055
  if (marketDeveloperName !== void 0) {
6052
- log?.log({ name: "slip_result", entityType: "market", marketDeveloperName, entityId: marketDeveloperName, outcome: "timeout", ...pick, ...sportField });
6056
+ log?.log({ name: "slip_result", entityType: "market", marketDeveloperName, entityId: marketDeveloperName, outcome: "timeout", ...pick, ...sportField, ...factTag });
6053
6057
  }
6054
6058
  return { kind: "failed" };
6055
6059
  }
@@ -6072,7 +6076,7 @@ function Toast({ toast, onDismiss }) {
6072
6076
 
6073
6077
  // src/components/AddToSlipButton.tsx
6074
6078
  import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
6075
- function SlipButton({ selection, marketDeveloperName, selectionLabel, line, slip, ui, price, ariaLabel, hold }) {
6079
+ function SlipButton({ selection, marketDeveloperName, selectionLabel, line, slip, ui, price, ariaLabel, hold, fact }) {
6076
6080
  const [pending, setPending] = useState18(false);
6077
6081
  const [settledLocal, setSettledLocal] = useState18(false);
6078
6082
  const [toast, setToast] = useState18(null);
@@ -6086,7 +6090,7 @@ function SlipButton({ selection, marketDeveloperName, selectionLabel, line, slip
6086
6090
  const onClick = async () => {
6087
6091
  setPending(true);
6088
6092
  try {
6089
- const outcome = await add(selection, { marketDeveloperName, selectionLabel, line });
6093
+ const outcome = await add(selection, { marketDeveloperName, selectionLabel, line, fact });
6090
6094
  if (outcome.kind === "failed") {
6091
6095
  setToast({ kind: "error", text: ui.slipFailed });
6092
6096
  return;
@@ -7085,11 +7089,11 @@ var ANY_TIER = ["guess", "ribbon", "since", "cards", "facts", "follow", "invite"
7085
7089
  var orderFor = (tier) => Object.prototype.hasOwnProperty.call(ORDER, tier) ? ORDER[tier] : ANY_TIER;
7086
7090
  var MAX_TEAM_CARDS = 3;
7087
7091
  function oneCardPerGame(cards) {
7088
- const seen = /* @__PURE__ */ new Set();
7092
+ const seen2 = /* @__PURE__ */ new Set();
7089
7093
  return cards.filter((c) => {
7090
7094
  if (!c.matchId) return true;
7091
- if (seen.has(c.matchId)) return false;
7092
- seen.add(c.matchId);
7095
+ if (seen2.has(c.matchId)) return false;
7096
+ seen2.add(c.matchId);
7093
7097
  return true;
7094
7098
  });
7095
7099
  }
@@ -7418,12 +7422,14 @@ var WIRE_TO_PUBLIC = {
7418
7422
  slip_remove: null,
7419
7423
  bet_placed: null,
7420
7424
  match_view: null,
7421
- popup_opened: null
7425
+ popup_opened: null,
7426
+ fact_view: null,
7427
+ fact_ask: null
7422
7428
  };
7423
7429
 
7424
7430
  // src/popupTelemetry.ts
7425
7431
  import { useCallback as useCallback22, useEffect as useEffect24, useRef as useRef19 } from "react";
7426
- function usePopupTelemetry(log, isOpen, popupText, dismissPopup) {
7432
+ function usePopupTelemetry(log, isOpen, popupText, dismissPopup, confirmedShown) {
7427
7433
  const shownRef = useRef19(/* @__PURE__ */ new Set());
7428
7434
  const closedTextRef = useRef19(null);
7429
7435
  useEffect24(() => {
@@ -7432,23 +7438,70 @@ function usePopupTelemetry(log, isOpen, popupText, dismissPopup) {
7432
7438
  closedTextRef.current = null;
7433
7439
  return;
7434
7440
  }
7435
- closedTextRef.current = popupText;
7436
- if (popupText && !shownRef.current.has(popupText)) {
7437
- shownRef.current.add(popupText);
7441
+ const text2 = confirmedShown === void 0 || confirmedShown === popupText ? popupText : null;
7442
+ closedTextRef.current = text2;
7443
+ if (text2 && !shownRef.current.has(text2)) {
7444
+ shownRef.current.add(text2);
7438
7445
  log?.log({ name: "popup_shown" });
7439
7446
  }
7440
- }, [log, isOpen, popupText]);
7447
+ }, [log, isOpen, popupText, confirmedShown]);
7441
7448
  return useCallback22(() => {
7442
7449
  log?.log({ name: "popup_dismissed" });
7443
7450
  dismissPopup();
7444
7451
  }, [log, dismissPopup]);
7445
7452
  }
7446
7453
 
7454
+ // src/mobileBinding.ts
7455
+ import { useCallback as useCallback23, useEffect as useEffect25, useRef as useRef20, useState as useState30 } from "react";
7456
+ var CLEARED = { text: null, asks: [] };
7457
+ function useMobileBinding(args) {
7458
+ const { binding, panelOpen, popupText, asks } = args;
7459
+ const latest = useRef20(args);
7460
+ latest.current = args;
7461
+ const bindingRef = useRef20(binding);
7462
+ bindingRef.current = binding;
7463
+ const backRef = useRef20(null);
7464
+ const [confirmedShown, setConfirmedShown] = useState30(null);
7465
+ const teaserKey = panelOpen || !popupText ? "" : JSON.stringify([popupText, asks.map((a) => a.label)]);
7466
+ const reported = useRef20({ binding: void 0, key: "" });
7467
+ useEffect25(() => {
7468
+ if (!binding) return;
7469
+ const prev = reported.current;
7470
+ if (prev.binding === binding && prev.key === teaserKey) return;
7471
+ reported.current = { binding, key: teaserKey };
7472
+ if (teaserKey === "" && prev.binding !== binding) return;
7473
+ binding.onTeaser(teaserKey === "" ? CLEARED : { text: popupText, asks: asks.map((a, index) => ({ index, label: a.label })) });
7474
+ }, [binding, teaserKey]);
7475
+ useEffect25(() => {
7476
+ if (!binding) return;
7477
+ binding.onHandle({
7478
+ open: () => latest.current.open(),
7479
+ close: () => latest.current.close(),
7480
+ tapAsk: (index) => {
7481
+ const { asks: current, open } = latest.current;
7482
+ if (!Number.isInteger(index) || index < 0 || index >= current.length) return;
7483
+ open();
7484
+ current[index].onTap();
7485
+ },
7486
+ dismissTeaser: () => latest.current.dismissPopup(),
7487
+ teaserShown: () => setConfirmedShown(latest.current.popupText),
7488
+ back: () => backRef.current?.() ?? false
7489
+ });
7490
+ return () => binding.onHandle(null);
7491
+ }, [binding]);
7492
+ const onCloseRequested = useCallback23(() => bindingRef.current?.onCloseRequested(), []);
7493
+ const onRegisterBack = useCallback23((fn) => {
7494
+ backRef.current = fn;
7495
+ }, []);
7496
+ if (!binding) return { confirmedShown: void 0, onCloseRequested: void 0, onRegisterBack: void 0 };
7497
+ return { confirmedShown, onCloseRequested, onRegisterBack };
7498
+ }
7499
+
7447
7500
  // src/openTelemetry.ts
7448
- import { useEffect as useEffect25, useRef as useRef20 } from "react";
7501
+ import { useEffect as useEffect26, useRef as useRef21 } from "react";
7449
7502
  function useOpenTelemetry(log, isOpen) {
7450
- const openLoggedRef = useRef20(false);
7451
- useEffect25(() => {
7503
+ const openLoggedRef = useRef21(false);
7504
+ useEffect26(() => {
7452
7505
  if (!isOpen) {
7453
7506
  openLoggedRef.current = false;
7454
7507
  return;
@@ -7460,13 +7513,13 @@ function useOpenTelemetry(log, isOpen) {
7460
7513
  }
7461
7514
 
7462
7515
  // src/components/ChatFab.tsx
7463
- import { useEffect as useEffect26, useRef as useRef21, useState as useState31 } from "react";
7516
+ import { useEffect as useEffect27, useRef as useRef22, useState as useState32 } from "react";
7464
7517
 
7465
7518
  // src/components/BrandMark.tsx
7466
- import { useState as useState30 } from "react";
7519
+ import { useState as useState31 } from "react";
7467
7520
  import { jsx as jsx27 } from "react/jsx-runtime";
7468
7521
  function BrandMark({ logoUrl, className }) {
7469
- const [failed, setFailed] = useState30(false);
7522
+ const [failed, setFailed] = useState31(false);
7470
7523
  if (!logoUrl || failed) return /* @__PURE__ */ jsx27(SsMark, { className });
7471
7524
  return /* @__PURE__ */ jsx27("img", { className, src: logoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
7472
7525
  }
@@ -7504,9 +7557,9 @@ function ChatFab({ label, busy = false, greeting, popupText, logoUrl, onOpen, on
7504
7557
  const bubble = popupText ?? greeting;
7505
7558
  const hidden = busy && !label;
7506
7559
  const track = useTrack();
7507
- const [intro, setIntro] = useState31(false);
7508
- const armedRef = useRef21(introAllowed);
7509
- useEffect26(() => {
7560
+ const [intro, setIntro] = useState32(false);
7561
+ const armedRef = useRef22(introAllowed);
7562
+ useEffect27(() => {
7510
7563
  if (armedRef.current && bubble) {
7511
7564
  armedRef.current = false;
7512
7565
  setIntro(true);
@@ -7526,10 +7579,10 @@ function ChatFab({ label, busy = false, greeting, popupText, logoUrl, onOpen, on
7526
7579
  }
7527
7580
 
7528
7581
  // src/components/ChatPanel.tsx
7529
- import { useCallback as useCallback26, useEffect as useEffect51, useLayoutEffect as useLayoutEffect2, useMemo as useMemo12, useRef as useRef42, useState as useState78 } from "react";
7582
+ import { useCallback as useCallback27, useEffect as useEffect53, useLayoutEffect as useLayoutEffect2, useMemo as useMemo12, useRef as useRef45, useState as useState79 } from "react";
7530
7583
 
7531
7584
  // src/components/ChatHeader.tsx
7532
- import { useEffect as useEffect27, useRef as useRef22, useState as useState32 } from "react";
7585
+ import { useEffect as useEffect28, useRef as useRef23, useState as useState33 } from "react";
7533
7586
  import { jsx as jsx30, jsxs as jsxs27 } from "react/jsx-runtime";
7534
7587
  function ChatHeader({
7535
7588
  onClose,
@@ -7543,20 +7596,20 @@ function ChatHeader({
7543
7596
  onOpenSettings,
7544
7597
  settingsLabel
7545
7598
  }) {
7546
- const [menuOpen, setMenuOpen] = useState32(false);
7547
- const wrapRef = useRef22(null);
7548
- const kebabRef = useRef22(null);
7549
- const firstItemRef = useRef22(null);
7599
+ const [menuOpen, setMenuOpen] = useState33(false);
7600
+ const wrapRef = useRef23(null);
7601
+ const kebabRef = useRef23(null);
7602
+ const firstItemRef = useRef23(null);
7550
7603
  const hasNew = !!(canReset && onNewConversation);
7551
7604
  const hasSettings = !!onOpenSettings;
7552
7605
  const hasMenu = hasNew || hasSettings;
7553
- useEffect27(() => {
7606
+ useEffect28(() => {
7554
7607
  if (menuOpen) firstItemRef.current?.focus();
7555
7608
  }, [menuOpen]);
7556
- useEffect27(() => {
7609
+ useEffect28(() => {
7557
7610
  if (!menuOpen) return;
7558
7611
  const onPointer = (e) => {
7559
- if (!wrapRef.current?.contains(e.target)) setMenuOpen(false);
7612
+ if (!(wrapRef.current && e.composedPath().includes(wrapRef.current))) setMenuOpen(false);
7560
7613
  };
7561
7614
  const onKey = (e) => {
7562
7615
  if (e.key === "Escape") {
@@ -7626,10 +7679,10 @@ function ChatHeader({
7626
7679
  }
7627
7680
 
7628
7681
  // src/components/MessageList.tsx
7629
- import { useEffect as useEffect31, useRef as useRef25 } from "react";
7682
+ import { useEffect as useEffect32, useRef as useRef26 } from "react";
7630
7683
 
7631
7684
  // src/components/ChatMessage.tsx
7632
- import { useState as useState42 } from "react";
7685
+ import { useState as useState43 } from "react";
7633
7686
 
7634
7687
  // src/components/Markdown.tsx
7635
7688
  import ReactMarkdown from "react-markdown";
@@ -7647,7 +7700,7 @@ function Markdown({ text: text2 }) {
7647
7700
  }
7648
7701
 
7649
7702
  // src/components/EntityCardList.tsx
7650
- import { useState as useState33 } from "react";
7703
+ import { useState as useState34 } from "react";
7651
7704
  import { jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
7652
7705
  var MAX_VISIBLE = 3;
7653
7706
  var RECORD_RE = /^(\d+)-(\d+)-(\d+)$/;
@@ -7731,7 +7784,7 @@ function ScopeTabs({ scopes, active, onSelect }) {
7731
7784
  )) });
7732
7785
  }
7733
7786
  function EntityCardItem({ c }) {
7734
- const [active, setActive] = useState33(0);
7787
+ const [active, setActive] = useState34(0);
7735
7788
  const hasBody = c.scopes.length > 0;
7736
7789
  if (!hasBody) {
7737
7790
  return /* @__PURE__ */ jsx32("div", { className: "ss-w-ecard ss-w-ecard-bare", "data-kind": c.kind, children: /* @__PURE__ */ jsx32(CardHeader, { c, showScopeCrest: false }) });
@@ -7745,7 +7798,7 @@ function EntityCardItem({ c }) {
7745
7798
  ] });
7746
7799
  }
7747
7800
  function EntityCardList({ cards, disabled, showLessLabel, showMoreLabel }) {
7748
- const [expanded, setExpanded] = useState33(false);
7801
+ const [expanded, setExpanded] = useState34(false);
7749
7802
  if (cards.length === 0) return null;
7750
7803
  const visible = expanded ? cards : cards.slice(0, MAX_VISIBLE);
7751
7804
  const overflow = cards.length - MAX_VISIBLE;
@@ -7846,17 +7899,17 @@ function BettingInsightList({ insights, ui, slip, monitor }) {
7846
7899
  }
7847
7900
 
7848
7901
  // src/components/AddAllToSlipButton.tsx
7849
- import { useCallback as useCallback23, useState as useState34 } from "react";
7902
+ import { useCallback as useCallback24, useState as useState35 } from "react";
7850
7903
  import { jsx as jsx34, jsxs as jsxs30 } from "react/jsx-runtime";
7851
7904
  function AddAllToSlipButton({ legs, slip, ui, labels, combo, chatCombo, sizeless, hold, onStartedGame }) {
7852
7905
  const add = useSlipAdd(slip, ui);
7853
7906
  const slipState = useSlipState();
7854
7907
  const log = useEventLog();
7855
7908
  const track = useTrack();
7856
- const [pending, setPending] = useState34(false);
7857
- const [settledLocal, setSettledLocal] = useState34({});
7858
- const [toast, setToast] = useState34(null);
7859
- const dismiss = useCallback23(() => setToast(null), []);
7909
+ const [pending, setPending] = useState35(false);
7910
+ const [settledLocal, setSettledLocal] = useState35({});
7911
+ const [toast, setToast] = useState35(null);
7912
+ const dismiss = useCallback24(() => setToast(null), []);
7860
7913
  if (!slip.onAddToSlip || legs.length < 2) return null;
7861
7914
  const settled = slipState ? slipState.settled : settledLocal;
7862
7915
  const open = legs.filter((leg) => !settled[slipKey(leg)]);
@@ -8915,15 +8968,15 @@ function pathRounds(e) {
8915
8968
  const base = h - pad.b;
8916
8969
  const plotH = h - pad.t - pad.b;
8917
8970
  const { lo, span } = roundSpan(e);
8918
- const seen = /* @__PURE__ */ new Map();
8971
+ const seen2 = /* @__PURE__ */ new Map();
8919
8972
  for (const ev of e.events) {
8920
8973
  if (ev.roundIndex < 0) continue;
8921
8974
  const idx = clampTo(ev.roundIndex, 0, ROUND_STEPS - 1);
8922
8975
  const short = typeof ev.roundShort === "string" ? ev.roundShort : "";
8923
- if (short !== "" && !seen.has(idx)) seen.set(idx, short);
8976
+ if (short !== "" && !seen2.has(idx)) seen2.set(idx, short);
8924
8977
  }
8925
8978
  const kept = [];
8926
- for (const [roundIndex, label] of [...seen.entries()].sort((a, b) => b[0] - a[0])) {
8979
+ for (const [roundIndex, label] of [...seen2.entries()].sort((a, b) => b[0] - a[0])) {
8927
8980
  const y = round22(base - (roundIndex - lo + 1) / span * plotH);
8928
8981
  const last = kept[kept.length - 1];
8929
8982
  if (last === void 0 || y - last.y >= ROUND_LABEL_MIN_GAP) kept.push({ roundIndex, label, y });
@@ -9166,7 +9219,7 @@ function TennisInsightList({ insights, ui }) {
9166
9219
  }
9167
9220
 
9168
9221
  // src/components/CompactOddsList.tsx
9169
- import { useEffect as useEffect28, useRef as useRef23, useState as useState35 } from "react";
9222
+ import { useEffect as useEffect29, useRef as useRef24, useState as useState36 } from "react";
9170
9223
  import { mayPinOrSlip as mayPinOrSlip5, slipSportOf as slipSportOf6, sportOf as sportOf10 } from "@sensiblestats/widget-sdk";
9171
9224
 
9172
9225
  // src/compactList.ts
@@ -9288,11 +9341,11 @@ function Row({ row, columns, ui, slip, monitor, rowRef }) {
9288
9341
  ] });
9289
9342
  }
9290
9343
  function CompactOddsList({ list, ui, slip, monitor }) {
9291
- const [shown2, setShown] = useState35(COMPACT_PAGE);
9344
+ const [shown2, setShown] = useState36(COMPACT_PAGE);
9292
9345
  const hidden = list.rowCount - shown2;
9293
- const [focusIndex, setFocusIndex] = useState35(null);
9294
- const focusRef = useRef23(null);
9295
- useEffect28(() => {
9346
+ const [focusIndex, setFocusIndex] = useState36(null);
9347
+ const focusRef = useRef24(null);
9348
+ useEffect29(() => {
9296
9349
  if (focusIndex !== null) focusRef.current?.focus();
9297
9350
  }, [focusIndex]);
9298
9351
  let left = shown2;
@@ -9527,7 +9580,7 @@ function FixtureCard({ card, ui }) {
9527
9580
  }
9528
9581
 
9529
9582
  // src/components/dashboard/CountdownCard.tsx
9530
- import { Fragment as Fragment11, useEffect as useEffect29, useState as useState36 } from "react";
9583
+ import { Fragment as Fragment11, useEffect as useEffect30, useState as useState37 } from "react";
9531
9584
  import { jsx as jsx43, jsxs as jsxs39 } from "react/jsx-runtime";
9532
9585
  var DAY_MS3 = 864e5;
9533
9586
  function remainingSegments(kickoffUnix, nowMs, withSeconds) {
@@ -9546,12 +9599,12 @@ function remainingSegments(kickoffUnix, nowMs, withSeconds) {
9546
9599
  function CountdownCard({ card, ui }) {
9547
9600
  const { data } = card;
9548
9601
  const unitLabel = { d: data.daysUnit, h: data.hoursUnit, m: data.minutesUnit, s: data.secondsUnit };
9549
- const [nowMs, setNowMs] = useState36(() => Date.now());
9550
- const [reduced] = useState36(
9602
+ const [nowMs, setNowMs] = useState37(() => Date.now());
9603
+ const [reduced] = useState37(
9551
9604
  () => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches
9552
9605
  );
9553
9606
  const withinDay = data.kickoffUnix * 1e3 - nowMs < DAY_MS3;
9554
- useEffect29(() => {
9607
+ useEffect30(() => {
9555
9608
  if (reduced) return;
9556
9609
  const id = window.setInterval(() => setNowMs(Date.now()), withinDay ? 1e3 : 6e4);
9557
9610
  return () => window.clearInterval(id);
@@ -9570,7 +9623,7 @@ function CountdownCard({ card, ui }) {
9570
9623
  }
9571
9624
 
9572
9625
  // src/components/dashboard/InjuriesCard.tsx
9573
- import { useState as useState37 } from "react";
9626
+ import { useState as useState38 } from "react";
9574
9627
  import { jsx as jsx44, jsxs as jsxs40 } from "react/jsx-runtime";
9575
9628
  var SHOWN = 3;
9576
9629
  function ColHead({ name, crestUrl }) {
@@ -9593,7 +9646,7 @@ function InjuryList({ rows, emptyLabel, limit }) {
9593
9646
  }
9594
9647
  function InjuriesCard({ card, ui }) {
9595
9648
  const { data } = card;
9596
- const [expanded, setExpanded] = useState37(false);
9649
+ const [expanded, setExpanded] = useState38(false);
9597
9650
  const hidden = Math.max(0, data.ours.length - SHOWN) + Math.max(0, data.theirs.length - SHOWN);
9598
9651
  const limit = expanded ? void 0 : SHOWN;
9599
9652
  const { showMore, showLess } = ui;
@@ -9698,7 +9751,7 @@ function LinksCard({ card }) {
9698
9751
  }
9699
9752
 
9700
9753
  // src/components/dashboard/PostMatchResultCard.tsx
9701
- import { useState as useState38 } from "react";
9754
+ import { useState as useState39 } from "react";
9702
9755
  import { jsx as jsx50, jsxs as jsxs46 } from "react/jsx-runtime";
9703
9756
  function initials3(name) {
9704
9757
  return name.trim().slice(0, 3).toUpperCase();
@@ -9708,7 +9761,7 @@ function PostMatchCrest({
9708
9761
  name,
9709
9762
  side
9710
9763
  }) {
9711
- const [failed, setFailed] = useState38(false);
9764
+ const [failed, setFailed] = useState39(false);
9712
9765
  const cls = `ss-w-fandash-postmatch-crest ss-w-fandash-postmatch-crest--${side}`;
9713
9766
  if (url && !failed) {
9714
9767
  return /* @__PURE__ */ jsx50("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
@@ -9907,10 +9960,10 @@ function RestingFormCard({ card }) {
9907
9960
  }
9908
9961
 
9909
9962
  // src/components/dashboard/LiveScoreCard.tsx
9910
- import { useRef as useRef24, useState as useState40 } from "react";
9963
+ import { useRef as useRef25, useState as useState41 } from "react";
9911
9964
 
9912
9965
  // src/useLiveClock.ts
9913
- import { useEffect as useEffect30, useState as useState39 } from "react";
9966
+ import { useEffect as useEffect31, useState as useState40 } from "react";
9914
9967
  var TICK_MS = 6e4;
9915
9968
  var MAX_LIVE_TICK_MINUTES = 15;
9916
9969
  function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
@@ -9919,10 +9972,10 @@ function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
9919
9972
  return minute + Math.min(Math.max(0, elapsedMinutes), MAX_LIVE_TICK_MINUTES);
9920
9973
  }
9921
9974
  function useLiveClock(minute, clockRunning, receivedAtMs) {
9922
- const [displayMinute, setDisplayMinute] = useState39(
9975
+ const [displayMinute, setDisplayMinute] = useState40(
9923
9976
  () => computeDisplayMinute(minute, clockRunning, receivedAtMs)
9924
9977
  );
9925
- useEffect30(() => {
9978
+ useEffect31(() => {
9926
9979
  setDisplayMinute(computeDisplayMinute(minute, clockRunning, receivedAtMs));
9927
9980
  if (!clockRunning) return;
9928
9981
  const id = window.setInterval(() => {
@@ -9939,7 +9992,7 @@ function initials5(name) {
9939
9992
  return name.trim().slice(0, 3).toUpperCase();
9940
9993
  }
9941
9994
  function LiveCrest({ url, name, side }) {
9942
- const [failed, setFailed] = useState40(false);
9995
+ const [failed, setFailed] = useState41(false);
9943
9996
  const cls = `ss-w-fandash-live-crest ss-w-fandash-live-crest--${side}`;
9944
9997
  if (url && !failed) {
9945
9998
  return /* @__PURE__ */ jsx59("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
@@ -9961,7 +10014,7 @@ function LiveScoreCard({
9961
10014
  }) {
9962
10015
  const { data } = card;
9963
10016
  const seedKey = `${data.minute}:${data.homeScore}:${data.awayScore}`;
9964
- const seedRef = useRef24(null);
10017
+ const seedRef = useRef25(null);
9965
10018
  if (!seedRef.current || seedRef.current.key !== seedKey) {
9966
10019
  seedRef.current = { key: seedKey, receivedAtMs: Date.now() };
9967
10020
  }
@@ -10007,7 +10060,7 @@ function LiveScoreCard({
10007
10060
  }
10008
10061
 
10009
10062
  // src/components/dashboard/LiveTimelineCard.tsx
10010
- import { useState as useState41 } from "react";
10063
+ import { useState as useState42 } from "react";
10011
10064
  import { jsx as jsx60, jsxs as jsxs56 } from "react/jsx-runtime";
10012
10065
  var SHOWN2 = 3;
10013
10066
  function EventIcon({ type }) {
@@ -10049,7 +10102,7 @@ function EventRow({ e }) {
10049
10102
  ] });
10050
10103
  }
10051
10104
  function LiveTimelineCard({ card, ui }) {
10052
- const [expanded, setExpanded] = useState41(false);
10105
+ const [expanded, setExpanded] = useState42(false);
10053
10106
  const events = card.data.events;
10054
10107
  if (!events || events.length === 0) return null;
10055
10108
  const sorted = [...events].sort((a, b) => b.minute - a.minute);
@@ -10248,7 +10301,7 @@ function FanDashboardCard({ card, onTap, ui, goalEvents }) {
10248
10301
  // src/components/ChatMessage.tsx
10249
10302
  import { jsx as jsx64, jsxs as jsxs60 } from "react/jsx-runtime";
10250
10303
  function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor, onGreetingSport }) {
10251
- const [sport, setSport] = useState42(null);
10304
+ const [sport, setSport] = useState43(null);
10252
10305
  if (message.role === "user") {
10253
10306
  return /* @__PURE__ */ jsx64("div", { className: "ss-w-msg ss-w-user", "data-msg-id": message.id, children: /* @__PURE__ */ jsx64("div", { className: "ss-w-bubble", children: message.text }) });
10254
10307
  }
@@ -10302,11 +10355,11 @@ function turnAnchor(messages) {
10302
10355
  function MessageList({ controller, ui, slip, onDashboardTap, monitor, onGreetingSport }) {
10303
10356
  const { state, send } = controller;
10304
10357
  const { oddsFormat } = useOddsSettings();
10305
- const listRef = useRef25(null);
10306
- const endRef = useRef25(null);
10307
- const pinnedRef = useRef25(true);
10308
- const anchoredTurnRef = useRef25(null);
10309
- useEffect31(() => {
10358
+ const listRef = useRef26(null);
10359
+ const endRef = useRef26(null);
10360
+ const pinnedRef = useRef26(true);
10361
+ const anchoredTurnRef = useRef26(null);
10362
+ useEffect32(() => {
10310
10363
  const anchor = turnAnchor(state.messages);
10311
10364
  const list = listRef.current;
10312
10365
  if (anchor && anchor.turnId !== anchoredTurnRef.current) {
@@ -10365,13 +10418,13 @@ function MessageList({ controller, ui, slip, onDashboardTap, monitor, onGreeting
10365
10418
  }
10366
10419
 
10367
10420
  // src/components/ChatInput.tsx
10368
- import { forwardRef, useEffect as useEffect32, useImperativeHandle, useRef as useRef26, useState as useState43 } from "react";
10421
+ import { forwardRef, useEffect as useEffect33, useImperativeHandle, useRef as useRef27, useState as useState44 } from "react";
10369
10422
  import { jsx as jsx67, jsxs as jsxs62 } from "react/jsx-runtime";
10370
10423
  var ChatInput = forwardRef(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel, sendLabel, disabled = false }, ref) {
10371
- const [value, setValue] = useState43("");
10372
- const textareaRef = useRef26(null);
10373
- const stopRef = useRef26(null);
10374
- const textBoxWantsFocusRef = useRef26(false);
10424
+ const [value, setValue] = useState44("");
10425
+ const textareaRef = useRef27(null);
10426
+ const stopRef = useRef27(null);
10427
+ const textBoxWantsFocusRef = useRef27(false);
10375
10428
  const submit = () => {
10376
10429
  if (disabled) return;
10377
10430
  const t = value.trim();
@@ -10397,7 +10450,7 @@ var ChatInput = forwardRef(function ChatInput2({ placeholder, streaming, onSend,
10397
10450
  stopRef.current?.focus();
10398
10451
  }
10399
10452
  }), []);
10400
- useEffect32(() => {
10453
+ useEffect33(() => {
10401
10454
  if (streaming || disabled || !textBoxWantsFocusRef.current) return;
10402
10455
  textBoxWantsFocusRef.current = false;
10403
10456
  const box = textareaRef.current;
@@ -10428,7 +10481,7 @@ var ChatInput = forwardRef(function ChatInput2({ placeholder, streaming, onSend,
10428
10481
  });
10429
10482
 
10430
10483
  // src/components/TabBar.tsx
10431
- import { useEffect as useEffect33, useLayoutEffect, useRef as useRef27 } from "react";
10484
+ import { useEffect as useEffect34, useLayoutEffect, useRef as useRef28 } from "react";
10432
10485
  import { Fragment as Fragment13, jsx as jsx68, jsxs as jsxs63 } from "react/jsx-runtime";
10433
10486
  var FIT_STEPS = [[0, false], [1, false], [1, true], [2, true], [3, true], [4, true], [5, true], [6, true]];
10434
10487
  function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule, hasBuilder = false, gamesEnabled, clubEnabled, favouritesEnabled }) {
@@ -10451,9 +10504,9 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
10451
10504
  ...favouritesEnabled && !clubEnabled ? [{ tab: "favourites", label: ui.tabFavourites, count: 0, dot: false }] : []
10452
10505
  ];
10453
10506
  const track = useTrack();
10454
- const listRef = useRef27(null);
10507
+ const listRef = useRef28(null);
10455
10508
  const activeTab = monitor.activeTab;
10456
- useEffect33(() => {
10509
+ useEffect34(() => {
10457
10510
  const el = listRef.current?.querySelector("[data-on]");
10458
10511
  if (!el || typeof el.scrollIntoView !== "function") return;
10459
10512
  const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
@@ -10576,16 +10629,66 @@ function MarketAccordion({ match, monitor, ui, slip }) {
10576
10629
  }
10577
10630
 
10578
10631
  // src/components/LiveFactBlock.tsx
10579
- import { useState as useState44 } from "react";
10632
+ import { useRef as useRef30, useState as useState45 } from "react";
10633
+
10634
+ // src/useFactView.ts
10635
+ import { useEffect as useEffect35, useRef as useRef29 } from "react";
10636
+ var DWELL_MS = 1e3;
10637
+ var seen = /* @__PURE__ */ new Set();
10638
+ function useFactView(ref, fact, entity2) {
10639
+ const log = useEventLog();
10640
+ const entityRef = useRef29(entity2);
10641
+ entityRef.current = entity2;
10642
+ const id = fact?.id;
10643
+ const factKey = fact?.factKey;
10644
+ useEffect35(() => {
10645
+ if (id === void 0 || factKey === void 0 || seen.has(id) || !log) return;
10646
+ const el = ref.current;
10647
+ if (!el) return;
10648
+ let timer;
10649
+ const fire = () => {
10650
+ if (seen.has(id)) return;
10651
+ seen.add(id);
10652
+ log.log({ name: "fact_view", ...entityRef.current, factId: String(id), factKey });
10653
+ };
10654
+ const clear = () => {
10655
+ if (timer !== void 0) {
10656
+ clearTimeout(timer);
10657
+ timer = void 0;
10658
+ }
10659
+ };
10660
+ if (typeof IntersectionObserver === "undefined") {
10661
+ timer = setTimeout(fire, DWELL_MS);
10662
+ return clear;
10663
+ }
10664
+ const io = new IntersectionObserver((entries) => {
10665
+ const visible = entries.some((e) => e.isIntersecting && e.intersectionRatio >= 0.5);
10666
+ if (visible) {
10667
+ if (timer === void 0) timer = setTimeout(fire, DWELL_MS);
10668
+ } else clear();
10669
+ }, { threshold: [0, 0.5] });
10670
+ io.observe(el);
10671
+ return () => {
10672
+ clear();
10673
+ io.disconnect();
10674
+ };
10675
+ }, [id, factKey, log, ref]);
10676
+ }
10677
+
10678
+ // src/components/LiveFactBlock.tsx
10580
10679
  import { jsx as jsx70, jsxs as jsxs65 } from "react/jsx-runtime";
10581
10680
  function LiveFactBlock({ facts, match, ui, slip, onAsk }) {
10582
- const [expanded, setExpanded] = useState44(false);
10681
+ const [expanded, setExpanded] = useState45(false);
10583
10682
  const { oddsFormat } = useOddsSettings();
10683
+ const log = useEventLog();
10684
+ const sectionRef = useRef30(null);
10584
10685
  const [current, ...earlier] = facts;
10686
+ const entity2 = current?.market ? { entityType: "market", entityId: current.market.marketDeveloperName } : { entityType: "match", entityId: String(match.matchId) };
10687
+ useFactView(sectionRef, current, entity2);
10585
10688
  if (!current) return null;
10586
10689
  const m = current.market;
10587
10690
  const chipPrice = m ? chipPriceText(m, oddsFormat) : void 0;
10588
- return /* @__PURE__ */ jsxs65("section", { className: "ss-w-fact", "aria-label": ui.liveFactLabel, children: [
10691
+ return /* @__PURE__ */ jsxs65("section", { ref: sectionRef, className: "ss-w-fact", "aria-label": ui.liveFactLabel, children: [
10589
10692
  /* @__PURE__ */ jsxs65("div", { className: "ss-w-fact-k", children: [
10590
10693
  /* @__PURE__ */ jsx70("span", { children: ui.liveFactLabel }),
10591
10694
  /* @__PURE__ */ jsxs65("span", { className: "ss-w-fact-min", children: [
@@ -10611,7 +10714,8 @@ function LiveFactBlock({ facts, match, ui, slip, onAsk }) {
10611
10714
  marketDeveloperName: m.marketDeveloperName,
10612
10715
  selectionLabel: m.selectionLabel,
10613
10716
  slip,
10614
- ui
10717
+ ui,
10718
+ fact: { id: current.id, factKey: current.factKey }
10615
10719
  }
10616
10720
  )
10617
10721
  ] })
@@ -10629,7 +10733,10 @@ function LiveFactBlock({ facts, match, ui, slip, onAsk }) {
10629
10733
  {
10630
10734
  type: "button",
10631
10735
  className: "ss-w-fact-link",
10632
- onClick: () => onAsk(current.text, { kind: "liveFact", matchId: match.matchId, subject: current.text.slice(0, 400) }),
10736
+ onClick: () => {
10737
+ log?.log({ name: "fact_ask", ...entity2, factId: String(current.id), factKey: current.factKey });
10738
+ onAsk(current.text, { kind: "liveFact", matchId: match.matchId, subject: current.text.slice(0, 400) });
10739
+ },
10633
10740
  children: ui.liveFactAsk
10634
10741
  }
10635
10742
  ),
@@ -10648,7 +10755,7 @@ function LiveFactBlock({ facts, match, ui, slip, onAsk }) {
10648
10755
  }
10649
10756
 
10650
10757
  // src/components/MonitorFormH2H.tsx
10651
- import { useState as useState45 } from "react";
10758
+ import { useState as useState46 } from "react";
10652
10759
  import { Fragment as Fragment14, jsx as jsx71, jsxs as jsxs66 } from "react/jsx-runtime";
10653
10760
  function resultClass2(result) {
10654
10761
  if (result === "W") return "ss-w-h2h-result--win";
@@ -10664,7 +10771,7 @@ function FormDots({ form, ui }) {
10664
10771
  return /* @__PURE__ */ jsx71("div", { className: "ss-w-h2h-dots", children: form.map((m, i) => /* @__PURE__ */ jsx71("span", { className: `ss-w-h2h-result ${resultClass2(m.result)}`, children: resultLabel(m.result, ui) }, i)) });
10665
10772
  }
10666
10773
  function MonitorFormH2H({ formAndH2H, homeTeamName, awayTeamName, ui }) {
10667
- const [expanded, setExpanded] = useState45(false);
10774
+ const [expanded, setExpanded] = useState46(false);
10668
10775
  const { homeForm, awayForm, h2h, homeShortCode, awayShortCode } = formAndH2H;
10669
10776
  if (homeForm.length === 0 && awayForm.length === 0 && !h2h) {
10670
10777
  return /* @__PURE__ */ jsx71(Fragment14, {});
@@ -10897,7 +11004,7 @@ var sportLabel = (ui, sport) => {
10897
11004
  };
10898
11005
 
10899
11006
  // src/components/NbaFormSection.tsx
10900
- import { useState as useState46 } from "react";
11007
+ import { useState as useState47 } from "react";
10901
11008
 
10902
11009
  // src/components/NbaFormRest.tsx
10903
11010
  import { jsx as jsx74, jsxs as jsxs69 } from "react/jsx-runtime";
@@ -10996,8 +11103,8 @@ function Row2({ game, abbr, tonight, ui }) {
10996
11103
  ] });
10997
11104
  }
10998
11105
  function NbaFormSection({ match, monitor, ui }) {
10999
- const [open, setOpen] = useState46(false);
11000
- const [side, setSide] = useState46("away");
11106
+ const [open, setOpen] = useState47(false);
11107
+ const [side, setSide] = useState47("away");
11001
11108
  const form = useNbaForm(match, monitor);
11002
11109
  const b = match.basketball;
11003
11110
  if (!form || !b || !form.home && !form.away) return null;
@@ -11039,10 +11146,10 @@ function NbaFormSection({ match, monitor, ui }) {
11039
11146
  }
11040
11147
 
11041
11148
  // src/components/NbaPropsSection.tsx
11042
- import { useEffect as useEffect35, useState as useState48 } from "react";
11149
+ import { useEffect as useEffect37, useState as useState49 } from "react";
11043
11150
 
11044
11151
  // src/components/PropsPieces.tsx
11045
- import { useEffect as useEffect34, useState as useState47 } from "react";
11152
+ import { useEffect as useEffect36, useState as useState48 } from "react";
11046
11153
  import { Fragment as Fragment15, jsx as jsx76, jsxs as jsxs71 } from "react/jsx-runtime";
11047
11154
  var livePlayer = (bundle, p) => bundle.live === true || !p.live && !p.nflLive ? p : { ...p, live: null, nflLive: null };
11048
11155
  var hasLiveLine = (p) => p.live != null || p.nflLive != null;
@@ -11055,9 +11162,9 @@ function preKickoff(match) {
11055
11162
  return Number.isFinite(kickoff) && Date.now() < kickoff;
11056
11163
  }
11057
11164
  function usePreKickoff(match) {
11058
- const [, setTick] = useState47(0);
11165
+ const [, setTick] = useState48(0);
11059
11166
  const pre = preKickoff(match);
11060
- useEffect34(() => {
11167
+ useEffect36(() => {
11061
11168
  if (!pre || !match.kickoffUtc) return;
11062
11169
  const wait = Math.min(Math.max(Date.parse(match.kickoffUtc) - Date.now(), 0), MAX_TIMER_MS);
11063
11170
  const id = setTimeout(() => setTick((t) => t + 1), wait);
@@ -11071,7 +11178,7 @@ function usePropsOpen(match, monitor, descriptor) {
11071
11178
  const pre = descriptor.sport === "basketball" ? match.phase === "preMatch" : beforeKickoff;
11072
11179
  const live = match.phase === "live";
11073
11180
  const open = pre || live;
11074
- useEffect34(() => {
11181
+ useEffect36(() => {
11075
11182
  if (!open) return;
11076
11183
  if (sport) monitor.loadPlayerProps?.(match.matchId, sport);
11077
11184
  else monitor.loadPlayerProps?.(match.matchId);
@@ -11149,7 +11256,7 @@ function PropBars({ bars, line, title, wide, ui, note }) {
11149
11256
  function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
11150
11257
  const player = livePlayer(bundle, given);
11151
11258
  const stats = descriptor.stats.map((k) => player.stats.find((s) => s.stat === k)).filter((s) => s != null);
11152
- const [picked, setPicked] = useState47(null);
11259
+ const [picked, setPicked] = useState48(null);
11153
11260
  const active = stats.find((s) => s.stat === picked) ?? stats[0];
11154
11261
  const sample = active?.games?.length ?? 0;
11155
11262
  const hitsOf = (price, text2) => descriptor.showHits && sample > 0 && price.hits != null ? text2(price.hits) : null;
@@ -11198,7 +11305,7 @@ function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
11198
11305
  ] });
11199
11306
  }
11200
11307
  function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
11201
- const [openId, setOpenId] = useState47(null);
11308
+ const [openId, setOpenId] = useState48(null);
11202
11309
  return /* @__PURE__ */ jsx76("div", { className: "ss-w-props-list", children: players.map((given) => {
11203
11310
  const p = livePlayer(bundle, given);
11204
11311
  const isOpen = openId === p.playerId;
@@ -11235,12 +11342,12 @@ function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
11235
11342
  }
11236
11343
  var BOX_QUIET_MS = 12e4;
11237
11344
  function StatsClock({ boxAsOfUtc, match, live, atBreak: atBreak2, ago, ui }) {
11238
- const [tick, setTick] = useState47(0);
11345
+ const [tick, setTick] = useState48(0);
11239
11346
  const time = clock2(boxAsOfUtc, ui);
11240
11347
  const at2 = time === "" ? Number.NaN : Date.parse(boxAsOfUtc);
11241
11348
  const valid = !Number.isNaN(at2);
11242
11349
  const onBreak = atBreak(match);
11243
- useEffect34(() => {
11350
+ useEffect36(() => {
11244
11351
  if (!valid || onBreak) return;
11245
11352
  const age2 = Date.now() - at2;
11246
11353
  const wait = age2 < BOX_QUIET_MS ? BOX_QUIET_MS - age2 : 6e4 - age2 % 6e4;
@@ -11301,12 +11408,12 @@ var nbaDescriptor = (ui, match) => ({
11301
11408
  tenGameBars: false
11302
11409
  });
11303
11410
  function StatsClock2({ bundle, match, ui }) {
11304
- const [tick, setTick] = useState48(0);
11411
+ const [tick, setTick] = useState49(0);
11305
11412
  const at2 = bundle.live === true && bundle.boxAsOfUtc ? Date.parse(bundle.boxAsOfUtc) : Number.NaN;
11306
11413
  const time = clock2(bundle.boxAsOfUtc, ui);
11307
11414
  const valid = !Number.isNaN(at2) && time !== "";
11308
11415
  const onBreak = atBreak(match);
11309
- useEffect35(() => {
11416
+ useEffect37(() => {
11310
11417
  if (!valid || onBreak) return;
11311
11418
  const age2 = Date.now() - at2;
11312
11419
  const wait = age2 < BOX_QUIET_MS2 ? BOX_QUIET_MS2 - age2 : 6e4 - age2 % 6e4;
@@ -11320,7 +11427,7 @@ function StatsClock2({ bundle, match, ui }) {
11320
11427
  return /* @__PURE__ */ jsx77("span", { className: "ss-w-props-asof ss-w-props-asof--live", children: ui.nba.propsStatsLive(time) });
11321
11428
  }
11322
11429
  function NbaPropsSection({ match, monitor, ui, slip }) {
11323
- const [side, setSide] = useState48("home");
11430
+ const [side, setSide] = useState49("home");
11324
11431
  const descriptor = nbaDescriptor(ui, match);
11325
11432
  const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
11326
11433
  if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
@@ -11469,7 +11576,7 @@ function NbaMonitorCard({ match, monitor, ui, slip }) {
11469
11576
  }
11470
11577
 
11471
11578
  // src/components/NflFormSection.tsx
11472
- import { useState as useState49 } from "react";
11579
+ import { useState as useState50 } from "react";
11473
11580
  import { Fragment as Fragment17, jsx as jsx79, jsxs as jsxs74 } from "react/jsx-runtime";
11474
11581
  var outcomeOf = (g) => g.teamScore > g.opponentScore ? "win" : g.teamScore < g.opponentScore ? "loss" : "tie";
11475
11582
  var signedSpread2 = (v) => v > 0 ? `+${v}` : String(v);
@@ -11521,7 +11628,7 @@ function H2hRow({ game, home, ui }) {
11521
11628
  ] });
11522
11629
  }
11523
11630
  function NflFormSection({ match, monitor, ui }) {
11524
- const [segment, setSegment] = useState49("away");
11631
+ const [segment, setSegment] = useState50("away");
11525
11632
  const { live, open } = usePropsOpen(match, monitor, { sport: "americanfootball" });
11526
11633
  const bundle = monitor.playerProps?.[monitorMatchKey("americanfootball", match.matchId)]?.bundle;
11527
11634
  const form = bundle?.form;
@@ -11554,7 +11661,7 @@ function NflFormSection({ match, monitor, ui }) {
11554
11661
  }
11555
11662
 
11556
11663
  // src/components/NflPropsSection.tsx
11557
- import { useState as useState50 } from "react";
11664
+ import { useState as useState51 } from "react";
11558
11665
  import { Fragment as Fragment18, jsx as jsx80, jsxs as jsxs75 } from "react/jsx-runtime";
11559
11666
  var TRENDS_SHOWN = 3;
11560
11667
  var SCORERS_SHOWN = 8;
@@ -11627,7 +11734,7 @@ function ShowMore({ label, onClick }) {
11627
11734
  return /* @__PURE__ */ jsx80("button", { type: "button", className: "ss-w-props-more", onClick, children: label });
11628
11735
  }
11629
11736
  function Trends({ bundle, facts, descriptor, ui, slip }) {
11630
- const [all, setAll] = useState50(false);
11737
+ const [all, setAll] = useState51(false);
11631
11738
  const shown2 = all ? facts : facts.slice(0, TRENDS_SHOWN);
11632
11739
  return /* @__PURE__ */ jsxs75("section", { className: "ss-w-props ss-w-props-trends", lang: ui.locale, children: [
11633
11740
  /* @__PURE__ */ jsx80("div", { className: "ss-w-props-head", children: ui.nfl.propsTrends }),
@@ -11660,7 +11767,7 @@ function Trends({ bundle, facts, descriptor, ui, slip }) {
11660
11767
  ] });
11661
11768
  }
11662
11769
  function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
11663
- const [all, setAll] = useState50(false);
11770
+ const [all, setAll] = useState51(false);
11664
11771
  const shown2 = all ? scorers : scorers.slice(0, SCORERS_SHOWN);
11665
11772
  const cell2 = (name, column, price, stat) => price && stat ? /* @__PURE__ */ jsx80(PropPrice, { price, label: "", ariaName: `${name}, ${column}`, player: name, stat, bundle, descriptor, ui, slip }) : /* @__PURE__ */ jsx80("span", { className: "ss-w-props-scorer-none", children: "\u2014" });
11666
11773
  return /* @__PURE__ */ jsxs75("div", { className: "ss-w-props-scorers", children: [
@@ -11687,7 +11794,7 @@ function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
11687
11794
  ] });
11688
11795
  }
11689
11796
  function NflPropsSection({ match, monitor, ui, slip }) {
11690
- const [tab, setTab] = useState50(null);
11797
+ const [tab, setTab] = useState51(null);
11691
11798
  const descriptor = nflDescriptor(ui);
11692
11799
  const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
11693
11800
  if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
@@ -11873,7 +11980,7 @@ function NflMonitorCard({ match, monitor, ui, slip }) {
11873
11980
  }
11874
11981
 
11875
11982
  // src/components/TennisMonitorCard.tsx
11876
- import { useRef as useRef28 } from "react";
11983
+ import { useRef as useRef31 } from "react";
11877
11984
  import { toWireSport as toWireSport5 } from "@sensiblestats/widget-sdk";
11878
11985
 
11879
11986
  // src/components/TennisFixtureRow.tsx
@@ -12134,7 +12241,7 @@ function TennisLiveScoreboard({ t, score, live, ui }) {
12134
12241
  }
12135
12242
 
12136
12243
  // src/components/TennisStatsTables.tsx
12137
- import { Fragment as Fragment22, useEffect as useEffect36, useState as useState51 } from "react";
12244
+ import { Fragment as Fragment22, useEffect as useEffect38, useState as useState52 } from "react";
12138
12245
  import { Fragment as Fragment23, jsx as jsx87, jsxs as jsxs82 } from "react/jsx-runtime";
12139
12246
  function formatStat(row, value, locale) {
12140
12247
  if (value == null) return "\u2013";
@@ -12172,8 +12279,8 @@ function Tables({ table, labels, names, locale }) {
12172
12279
  ] });
12173
12280
  }
12174
12281
  function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey }) {
12175
- const [tab, setTab] = useState51("match");
12176
- useEffect36(() => {
12282
+ const [tab, setTab] = useState52("match");
12283
+ useEffect38(() => {
12177
12284
  setTab("match");
12178
12285
  }, [resetKey]);
12179
12286
  const sets = serveReturn.sets.filter((s) => s.table.serve.length + s.table.return.length > 0);
@@ -12339,7 +12446,7 @@ function HeadToHead({ t, ui }) {
12339
12446
  ] });
12340
12447
  }
12341
12448
  function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
12342
- const lastTables = useRef28(null);
12449
+ const lastTables = useRef31(null);
12343
12450
  const t = match.tennis;
12344
12451
  if (!t) return /* @__PURE__ */ jsx88(UnavailableCard, { match, monitor, ui, sport: "tennis" });
12345
12452
  const preMatch = match.phase === "preMatch";
@@ -12419,7 +12526,7 @@ function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
12419
12526
  }
12420
12527
 
12421
12528
  // src/components/ScoreboardStrip.tsx
12422
- import { useEffect as useEffect37, useRef as useRef29 } from "react";
12529
+ import { useEffect as useEffect39, useRef as useRef32 } from "react";
12423
12530
  import { sportOf as sportOf11 } from "@sensiblestats/widget-sdk";
12424
12531
  import { jsx as jsx89, jsxs as jsxs84 } from "react/jsx-runtime";
12425
12532
  function nbaStatus(m, ui) {
@@ -12514,8 +12621,8 @@ function rowsFor(m) {
12514
12621
  ];
12515
12622
  }
12516
12623
  function useStripScroll(selectedKey) {
12517
- const stripRef = useRef29(null);
12518
- useEffect37(() => {
12624
+ const stripRef = useRef32(null);
12625
+ useEffect39(() => {
12519
12626
  const strip = stripRef.current;
12520
12627
  const pressed = strip?.querySelector('[aria-pressed="true"]');
12521
12628
  if (!strip || !pressed) return;
@@ -12761,7 +12868,7 @@ function TrendsPanel({ monitor, ui, slip }) {
12761
12868
  }
12762
12869
 
12763
12870
  // src/components/LivePanel.tsx
12764
- import { useMemo as useMemo10, useState as useState53 } from "react";
12871
+ import { useMemo as useMemo10, useState as useState54 } from "react";
12765
12872
  import { matchKey as matchKey8 } from "@sensiblestats/widget-sdk";
12766
12873
 
12767
12874
  // src/scheduleView.ts
@@ -12936,20 +13043,20 @@ function LeagueGroup({ view, open, onToggle, disambiguate, rowCap, onShowAll, on
12936
13043
  }
12937
13044
 
12938
13045
  // src/components/MatchSheet.tsx
12939
- import { useId as useId2, useState as useState52 } from "react";
13046
+ import { useId as useId2, useState as useState53 } from "react";
12940
13047
  import { localIdOf as localIdOf4, qualifiedId as qualifiedId2, slipSportOf as slipSportOf9, toWireSport as toWireSport6 } from "@sensiblestats/widget-sdk";
12941
13048
 
12942
13049
  // src/useModalDialog.ts
12943
- import { useEffect as useEffect38, useRef as useRef30 } from "react";
13050
+ import { useEffect as useEffect40, useRef as useRef33 } from "react";
12944
13051
  var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
12945
13052
  function useModalDialog(onClose, opts = {}) {
12946
- const dialogRef = useRef30(null);
12947
- const onCloseRef = useRef30(onClose);
13053
+ const dialogRef = useRef33(null);
13054
+ const onCloseRef = useRef33(onClose);
12948
13055
  onCloseRef.current = onClose;
12949
- const openerRef = useRef30(opts.opener);
13056
+ const openerRef = useRef33(opts.opener);
12950
13057
  openerRef.current = opts.opener;
12951
13058
  const restore = opts.restoreFocus ?? true;
12952
- useEffect38(() => {
13059
+ useEffect40(() => {
12953
13060
  const dialog = dialogRef.current;
12954
13061
  const root = dialog?.getRootNode();
12955
13062
  const focusedAtMount = root?.activeElement ?? null;
@@ -12960,7 +13067,7 @@ function useModalDialog(onClose, opts = {}) {
12960
13067
  if (target instanceof HTMLElement) target.focus({ preventScroll: true });
12961
13068
  };
12962
13069
  }, []);
12963
- useEffect38(() => {
13070
+ useEffect40(() => {
12964
13071
  const onKey = (e) => {
12965
13072
  if (e.key !== "Escape") return;
12966
13073
  e.stopPropagation();
@@ -13002,7 +13109,7 @@ function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose,
13002
13109
  const { dialogRef, onKeyDown } = useModalDialog(onClose, { opener });
13003
13110
  const log = useEventLog();
13004
13111
  const titleId = useId2();
13005
- const [limitHit, setLimitHit] = useState52(false);
13112
+ const [limitHit, setLimitHit] = useState53(false);
13006
13113
  const pinSport = slipSportOf9(match.sport);
13007
13114
  const tour = pinSport === "tennis" && isKnownTour(match.tour) ? match.tour : void 0;
13008
13115
  const followable = pinSport !== "tennis" || tour !== void 0;
@@ -13103,9 +13210,9 @@ var OPEN_TOP_GROUPS = 2;
13103
13210
  var QUIET_ROWS = 4;
13104
13211
  function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, onLeague, onSeeAll, onAsk }) {
13105
13212
  const { groups, states, stale } = discovery;
13106
- const [mine, setMine] = useState53(false);
13107
- const [toggled, setToggled] = useState53(/* @__PURE__ */ new Map());
13108
- const [sheet, setSheet] = useState53(null);
13213
+ const [mine, setMine] = useState54(false);
13214
+ const [toggled, setToggled] = useState54(/* @__PURE__ */ new Map());
13215
+ const [sheet, setSheet] = useState54(null);
13109
13216
  const pinnedKeys = useMemo10(
13110
13217
  () => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => matchKey8(p.sport, p.matchId, p.tour))),
13111
13218
  [monitor.pins]
@@ -13212,20 +13319,20 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
13212
13319
  }
13213
13320
 
13214
13321
  // src/components/ScheduleMatchesPanel.tsx
13215
- import { useEffect as useEffect41, useId as useId3, useMemo as useMemo11, useRef as useRef34, useState as useState55 } from "react";
13322
+ import { useEffect as useEffect43, useId as useId3, useMemo as useMemo11, useRef as useRef37, useState as useState56 } from "react";
13216
13323
  import { matchKey as matchKey10 } from "@sensiblestats/widget-sdk";
13217
13324
 
13218
13325
  // src/useTennisRowPrices.ts
13219
- import { useEffect as useEffect39, useRef as useRef31, useState as useState54 } from "react";
13326
+ import { useEffect as useEffect41, useRef as useRef34, useState as useState55 } from "react";
13220
13327
  import { matchKey as matchKey9 } from "@sensiblestats/widget-sdk";
13221
13328
  var TENNIS_PRICE_POLL_MS = 6e4;
13222
13329
  function useTennisRowPrices(a) {
13223
- const [state, setState] = useState54({ byId: null, stale: false });
13224
- const getPricesRef = useRef31(a.getPrices);
13330
+ const [state, setState] = useState55({ byId: null, stale: false });
13331
+ const getPricesRef = useRef34(a.getPrices);
13225
13332
  getPricesRef.current = a.getPrices;
13226
- const latest = useRef31(0);
13333
+ const latest = useRef34(0);
13227
13334
  const idsKey = a.keys.filter((k) => isKnownTour(k.tour)).slice(0, MAX_TENNIS_KEYS).map((k) => `${k.tour}:${k.matchId}`).sort().join(",");
13228
- useEffect39(() => {
13335
+ useEffect41(() => {
13229
13336
  if (!a.enabled || idsKey === "") {
13230
13337
  latest.current++;
13231
13338
  setState((prev) => prev.byId === null && !prev.stale ? prev : { byId: null, stale: false });
@@ -13263,11 +13370,11 @@ function useTennisRowPrices(a) {
13263
13370
  }
13264
13371
 
13265
13372
  // src/components/DayStrip.tsx
13266
- import { useEffect as useEffect40, useRef as useRef32 } from "react";
13373
+ import { useEffect as useEffect42, useRef as useRef35 } from "react";
13267
13374
  import { jsx as jsx98, jsxs as jsxs92 } from "react/jsx-runtime";
13268
13375
  function DayStrip({ chips, selected, onSelect, ui, locale }) {
13269
- const listRef = useRef32(null);
13270
- useEffect40(() => {
13376
+ const listRef = useRef35(null);
13377
+ useEffect42(() => {
13271
13378
  const el = listRef.current?.querySelector('[aria-pressed="true"]');
13272
13379
  if (!el || typeof el.scrollIntoView !== "function") return;
13273
13380
  const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
@@ -13296,7 +13403,7 @@ function DayStrip({ chips, selected, onSelect, ui, locale }) {
13296
13403
  }
13297
13404
 
13298
13405
  // src/components/games/ui/SearchField.tsx
13299
- import { useCallback as useCallback24, useRef as useRef33 } from "react";
13406
+ import { useCallback as useCallback25, useRef as useRef36 } from "react";
13300
13407
 
13301
13408
  // src/components/games/ui/icons.tsx
13302
13409
  import { jsx as jsx99 } from "react/jsx-runtime";
@@ -13335,8 +13442,8 @@ var IconFlame = ({ size = 16 }) => svg(size, /* @__PURE__ */ jsx99("path", { d:
13335
13442
  // src/components/games/ui/SearchField.tsx
13336
13443
  import { jsx as jsx100, jsxs as jsxs93 } from "react/jsx-runtime";
13337
13444
  function SearchField({ id, label, labelHidden = false, placeholder, value, onChange, disabled, inputRef, onKeyDown, clearLabel }) {
13338
- const localRef = useRef33(null);
13339
- const setInputRef = useCallback24((node) => {
13445
+ const localRef = useRef36(null);
13446
+ const setInputRef = useCallback25((node) => {
13340
13447
  localRef.current = node;
13341
13448
  if (typeof inputRef === "function") inputRef(node);
13342
13449
  else if (inputRef) inputRef.current = node;
@@ -13383,13 +13490,13 @@ var SKELETON_ROWS = 3;
13383
13490
  function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport, day, onDay, loaded, onOpenLive, onAsk, locale, getTennisPrices, slip }) {
13384
13491
  const { localDate: today, states, stale } = discovery;
13385
13492
  const searchId = useId3();
13386
- const [query, setQuery] = useState55("");
13387
- const [toggled, setToggled] = useState55(/* @__PURE__ */ new Map());
13388
- const [expanded, setExpanded] = useState55(/* @__PURE__ */ new Set());
13389
- const listRef = useRef34(null);
13390
- const [sheet, setSheet] = useState55(null);
13493
+ const [query, setQuery] = useState56("");
13494
+ const [toggled, setToggled] = useState56(/* @__PURE__ */ new Map());
13495
+ const [expanded, setExpanded] = useState56(/* @__PURE__ */ new Set());
13496
+ const listRef = useRef37(null);
13497
+ const [sheet, setSheet] = useState56(null);
13391
13498
  const { chips, selected } = loaded;
13392
- useEffect41(() => {
13499
+ useEffect43(() => {
13393
13500
  if (selected !== day) onDay(selected);
13394
13501
  }, [day, selected, onDay]);
13395
13502
  const isToday = selected === today;
@@ -13531,7 +13638,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
13531
13638
  }
13532
13639
 
13533
13640
  // src/components/GamesPanel.tsx
13534
- import { useEffect as useEffect45, useState as useState70 } from "react";
13641
+ import { useEffect as useEffect47, useState as useState71 } from "react";
13535
13642
 
13536
13643
  // src/components/GamesLoginWall.tsx
13537
13644
  import { jsx as jsx102 } from "react/jsx-runtime";
@@ -13540,7 +13647,7 @@ function GamesLoginWall({ ui }) {
13540
13647
  }
13541
13648
 
13542
13649
  // src/components/GamesHub.tsx
13543
- import { useEffect as useEffect42, useState as useState56 } from "react";
13650
+ import { useEffect as useEffect44, useState as useState57 } from "react";
13544
13651
 
13545
13652
  // src/components/games/ui/gameMeta.ts
13546
13653
  function prettifyGameId(gameId) {
@@ -13691,8 +13798,8 @@ function pickHeroGame(games) {
13691
13798
  }
13692
13799
  var tileKey = (g) => `${g.gameId}-${g.gameDay}-${g.fixtureId}`;
13693
13800
  function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
13694
- const [, setTick] = useState56(0);
13695
- useEffect42(() => {
13801
+ const [, setTick] = useState57(0);
13802
+ useEffect44(() => {
13696
13803
  const id = setInterval(() => setTick((t) => t + 1), 6e4);
13697
13804
  return () => clearInterval(id);
13698
13805
  }, []);
@@ -13752,10 +13859,10 @@ function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
13752
13859
  }
13753
13860
 
13754
13861
  // src/components/GameScreenHost.tsx
13755
- import { useEffect as useEffect44, useRef as useRef37, useState as useState68 } from "react";
13862
+ import { useEffect as useEffect46, useRef as useRef40, useState as useState69 } from "react";
13756
13863
 
13757
13864
  // src/useGamePlay.ts
13758
- import { useCallback as useCallback25, useRef as useRef35, useState as useState57 } from "react";
13865
+ import { useCallback as useCallback26, useRef as useRef38, useState as useState58 } from "react";
13759
13866
  function toSubmitResult(payload) {
13760
13867
  return {
13761
13868
  // 'pending' means the play is recorded but awaiting resolution (fixture games)
@@ -13767,17 +13874,17 @@ function toSubmitResult(payload) {
13767
13874
  };
13768
13875
  }
13769
13876
  function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh }) {
13770
- const [result, setResult] = useState57(null);
13771
- const [submitting, setSubmitting] = useState57(false);
13772
- const [rawStatus, setRawStatus] = useState57(null);
13773
- const inFlightRef = useRef35(false);
13774
- const convRef = useRef35(conversation);
13877
+ const [result, setResult] = useState58(null);
13878
+ const [submitting, setSubmitting] = useState58(false);
13879
+ const [rawStatus, setRawStatus] = useState58(null);
13880
+ const inFlightRef = useRef38(false);
13881
+ const convRef = useRef38(conversation);
13775
13882
  convRef.current = conversation;
13776
- const optsRef = useRef35({ gameId, gameDay, fixtureId, locale, refresh });
13883
+ const optsRef = useRef38({ gameId, gameDay, fixtureId, locale, refresh });
13777
13884
  optsRef.current = { gameId, gameDay, fixtureId, locale, refresh };
13778
- const resultRef = useRef35(null);
13885
+ const resultRef = useRef38(null);
13779
13886
  resultRef.current = result;
13780
- const refetch = useCallback25(async () => {
13887
+ const refetch = useCallback26(async () => {
13781
13888
  const conv = convRef.current;
13782
13889
  if (!conv) return;
13783
13890
  const opts = optsRef.current;
@@ -13793,7 +13900,7 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
13793
13900
  } catch {
13794
13901
  }
13795
13902
  }, []);
13796
- const submit = useCallback25(async (answerJson) => {
13903
+ const submit = useCallback26(async (answerJson) => {
13797
13904
  const conv = convRef.current;
13798
13905
  if (!conv || inFlightRef.current) return;
13799
13906
  inFlightRef.current = true;
@@ -13820,14 +13927,14 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
13820
13927
  setSubmitting(false);
13821
13928
  }
13822
13929
  }, [refetch]);
13823
- const hydrate = useCallback25(() => {
13930
+ const hydrate = useCallback26(() => {
13824
13931
  void refetch();
13825
13932
  }, [refetch]);
13826
13933
  return { result, submitting, submit, hydrate, rawStatus };
13827
13934
  }
13828
13935
 
13829
13936
  // src/components/games/MysteryTigerGame.tsx
13830
- import { useState as useState59, useId as useId4 } from "react";
13937
+ import { useState as useState60, useId as useId4 } from "react";
13831
13938
 
13832
13939
  // src/components/games/nationFlags.ts
13833
13940
  var FLAGS = {
@@ -14038,7 +14145,7 @@ function isNationCode(flag) {
14038
14145
  }
14039
14146
 
14040
14147
  // src/components/games/PlayerAvatar.tsx
14041
- import { useState as useState58 } from "react";
14148
+ import { useState as useState59 } from "react";
14042
14149
  import { jsx as jsx107 } from "react/jsx-runtime";
14043
14150
  function initialsOf(name) {
14044
14151
  const parts2 = name.trim().split(/\s+/).filter(Boolean);
@@ -14056,7 +14163,7 @@ function PlayerAvatar({
14056
14163
  imagePath,
14057
14164
  className
14058
14165
  }) {
14059
- const [failed, setFailed] = useState58(false);
14166
+ const [failed, setFailed] = useState59(false);
14060
14167
  const showImage = Boolean(imagePath) && !isPlaceholderImage(imagePath) && !failed;
14061
14168
  return /* @__PURE__ */ jsx107("div", { className, "aria-hidden": "true", children: showImage ? /* @__PURE__ */ jsx107("img", { src: imagePath, alt: "", loading: "lazy", onError: () => setFailed(true) }) : /* @__PURE__ */ jsx107("span", { className: "ss-w-av-initials", children: initialsOf(name) }) });
14062
14169
  }
@@ -14300,7 +14407,7 @@ function MysteryTigerGame({
14300
14407
  onBack
14301
14408
  }) {
14302
14409
  const t = ui.games.mysteryTiger;
14303
- const [query, setQuery] = useState59("");
14410
+ const [query, setQuery] = useState60("");
14304
14411
  const inputId = useId4();
14305
14412
  const clientState = parseClientState(result?.clientStateJson);
14306
14413
  const guessResults = clientState?.guessResults ?? [];
@@ -14562,13 +14669,13 @@ function HigherOrLowerGame({
14562
14669
  }
14563
14670
 
14564
14671
  // src/components/games/CareerPathGame.tsx
14565
- import { useState as useState61, useId as useId5 } from "react";
14672
+ import { useState as useState62, useId as useId5 } from "react";
14566
14673
 
14567
14674
  // src/components/games/ui/CrestShield.tsx
14568
- import { useState as useState60 } from "react";
14675
+ import { useState as useState61 } from "react";
14569
14676
  import { jsx as jsx118 } from "react/jsx-runtime";
14570
14677
  function CrestShield({ src, name, size = 28 }) {
14571
- const [failed, setFailed] = useState60(false);
14678
+ const [failed, setFailed] = useState61(false);
14572
14679
  if (src && !isPlaceholderImage(src) && !failed) {
14573
14680
  return /* @__PURE__ */ jsx118("img", { className: "ss-g-crest", src, alt: name, width: size, height: size, loading: "lazy", onError: () => setFailed(true) });
14574
14681
  }
@@ -14600,7 +14707,7 @@ function CareerPathGame({
14600
14707
  }) {
14601
14708
  const s = ui.games.careerPath;
14602
14709
  const title = gameTitle({ gameId: "career-path" }, ui.games.titles);
14603
- const [query, setQuery] = useState61("");
14710
+ const [query, setQuery] = useState62("");
14604
14711
  const inputId = useId5();
14605
14712
  const clientState = parseClientState3(result?.clientStateJson);
14606
14713
  const alreadyGuessedIds = new Set(clientState?.guessResults.map((g) => g.playerId) ?? []);
@@ -14707,7 +14814,7 @@ function CareerPathGame({
14707
14814
  }
14708
14815
 
14709
14816
  // src/components/games/BeatTheGridGame.tsx
14710
- import React, { useEffect as useEffect43, useId as useId6, useRef as useRef36, useState as useState62 } from "react";
14817
+ import React, { useEffect as useEffect45, useId as useId6, useRef as useRef39, useState as useState63 } from "react";
14711
14818
 
14712
14819
  // src/components/games/ui/OptionList.tsx
14713
14820
  import { jsx as jsx120 } from "react/jsx-runtime";
@@ -14796,10 +14903,10 @@ function SearchSheet({
14796
14903
  ui
14797
14904
  }) {
14798
14905
  const s = ui.games.beatTheGrid;
14799
- const [query, setQuery] = useState62("");
14906
+ const [query, setQuery] = useState63("");
14800
14907
  const inputId = useId6();
14801
- const inputRef = useRef36(null);
14802
- useEffect43(() => {
14908
+ const inputRef = useRef39(null);
14909
+ useEffect45(() => {
14803
14910
  inputRef.current?.focus();
14804
14911
  }, [row, col]);
14805
14912
  const filtered = playerPool.filter(
@@ -14864,7 +14971,7 @@ function BeatTheGridGame({
14864
14971
  }) {
14865
14972
  const s = ui.games.beatTheGrid;
14866
14973
  const title = gameTitle({ gameId: "beat-the-grid" }, ui.games.titles);
14867
- const [activeCell, setActiveCell] = useState62(null);
14974
+ const [activeCell, setActiveCell] = useState63(null);
14868
14975
  const clientState = parseClientState4(result?.clientStateJson);
14869
14976
  const filledCells = clientState?.cells ?? [];
14870
14977
  const isLocked2 = result?.alreadyPlayed === true || clientState?.isComplete === true;
@@ -15019,7 +15126,7 @@ function BeatTheGridGame({
15019
15126
  }
15020
15127
 
15021
15128
  // src/components/games/GuessTheXiGame.tsx
15022
- import { useState as useState63, useId as useId7 } from "react";
15129
+ import { useState as useState64, useId as useId7 } from "react";
15023
15130
 
15024
15131
  // src/components/games/ui/PitchSvg.tsx
15025
15132
  import { Fragment as Fragment36, jsx as jsx122, jsxs as jsxs109 } from "react/jsx-runtime";
@@ -15108,7 +15215,7 @@ function GuessTheXiGame({
15108
15215
  onBack
15109
15216
  }) {
15110
15217
  const t = ui.games.guessTheXi;
15111
- const [query, setQuery] = useState63("");
15218
+ const [query, setQuery] = useState64("");
15112
15219
  const inputId = useId7();
15113
15220
  const clientState = parseClientState5(result?.clientStateJson);
15114
15221
  const isOver = result?.alreadyPlayed === true || clientState?.status === "solved" || clientState?.status === "failed";
@@ -15251,7 +15358,7 @@ function GuessTheXiGame({
15251
15358
  }
15252
15359
 
15253
15360
  // src/components/games/DailyQuizGame.tsx
15254
- import { useState as useState64 } from "react";
15361
+ import { useState as useState65 } from "react";
15255
15362
  import { Fragment as Fragment38, jsx as jsx124, jsxs as jsxs111 } from "react/jsx-runtime";
15256
15363
  function parseClientState6(json) {
15257
15364
  if (!json) return null;
@@ -15292,8 +15399,8 @@ function DailyQuizGame({
15292
15399
  }) {
15293
15400
  const s = ui.games.dailyQuiz;
15294
15401
  const title = gameTitle({ gameId: "daily-quiz" }, ui.games.titles);
15295
- const [selections, setSelections] = useState64(/* @__PURE__ */ new Map());
15296
- const [page, setPage] = useState64(0);
15402
+ const [selections, setSelections] = useState65(/* @__PURE__ */ new Map());
15403
+ const [page, setPage] = useState65(0);
15297
15404
  const clientState = parseClientState6(result?.clientStateJson);
15298
15405
  const results2 = clientState?.results ?? [];
15299
15406
  const isRevealed = results2.length > 0 || result?.alreadyPlayed === true;
@@ -15403,7 +15510,7 @@ function DailyQuizGame({
15403
15510
  }
15404
15511
 
15405
15512
  // src/components/games/MatchdayPredictorGame.tsx
15406
- import { useId as useId8, useState as useState65 } from "react";
15513
+ import { useId as useId8, useState as useState66 } from "react";
15407
15514
  import { jsx as jsx125, jsxs as jsxs112 } from "react/jsx-runtime";
15408
15515
  var SCORER_SEARCH_THRESHOLD = 9;
15409
15516
  function parseClientState7(json) {
@@ -15499,11 +15606,11 @@ function MatchdayPredictorGame({
15499
15606
  onBack
15500
15607
  }) {
15501
15608
  const t = ui.games.predictor;
15502
- const [homeScore, setHomeScore] = useState65(0);
15503
- const [awayScore, setAwayScore] = useState65(0);
15504
- const [firstScorerPlayerId, setFirstScorerPlayerId] = useState65(null);
15505
- const [lastEdited, setLastEdited] = useState65("home");
15506
- const [query, setQuery] = useState65("");
15609
+ const [homeScore, setHomeScore] = useState66(0);
15610
+ const [awayScore, setAwayScore] = useState66(0);
15611
+ const [firstScorerPlayerId, setFirstScorerPlayerId] = useState66(null);
15612
+ const [lastEdited, setLastEdited] = useState66("home");
15613
+ const [query, setQuery] = useState66("");
15507
15614
  const searchId = useId8();
15508
15615
  const clientState = parseClientState7(result?.clientStateJson);
15509
15616
  const alreadyPlayed = result?.alreadyPlayed === true;
@@ -15671,7 +15778,7 @@ function MatchdayPredictorGame({
15671
15778
  }
15672
15779
 
15673
15780
  // src/components/games/StartingXiGame.tsx
15674
- import { useId as useId9, useState as useState66 } from "react";
15781
+ import { useId as useId9, useState as useState67 } from "react";
15675
15782
  import { Fragment as Fragment39, jsx as jsx126, jsxs as jsxs113 } from "react/jsx-runtime";
15676
15783
  var POINTS_PER_STARTER = 8;
15677
15784
  var XI_SIZE = 11;
@@ -15715,9 +15822,9 @@ function StartingXiGame({
15715
15822
  lockAtUtc
15716
15823
  }) {
15717
15824
  const t = ui.games.startingXi;
15718
- const [slotPlayers, setSlotPlayers] = useState66(() => Array(XI_SIZE).fill(null));
15719
- const [active, setActive] = useState66(0);
15720
- const [query, setQuery] = useState66("");
15825
+ const [slotPlayers, setSlotPlayers] = useState67(() => Array(XI_SIZE).fill(null));
15826
+ const [active, setActive] = useState67(0);
15827
+ const [query, setQuery] = useState67("");
15721
15828
  const searchId = useId9();
15722
15829
  const clientState = parseClientState8(result?.clientStateJson);
15723
15830
  const alreadyPlayed = result?.alreadyPlayed === true;
@@ -15857,7 +15964,7 @@ function StartingXiGame({
15857
15964
  }
15858
15965
 
15859
15966
  // src/components/games/StatLadderGame.tsx
15860
- import { useId as useId10, useState as useState67 } from "react";
15967
+ import { useId as useId10, useState as useState68 } from "react";
15861
15968
  import { jsx as jsx127, jsxs as jsxs114 } from "react/jsx-runtime";
15862
15969
  function ladderClue(ladder) {
15863
15970
  const mystery = ladder.find((r) => r.rank === 2);
@@ -15894,8 +16001,8 @@ function StatLadderGame({
15894
16001
  onBack
15895
16002
  }) {
15896
16003
  const t = ui.games.statLadder;
15897
- const [query, setQuery] = useState67("");
15898
- const [selectedId, setSelectedId] = useState67(null);
16004
+ const [query, setQuery] = useState68("");
16005
+ const [selectedId, setSelectedId] = useState68(null);
15899
16006
  const searchId = useId10();
15900
16007
  const clientState = parseClientState9(result?.clientStateJson);
15901
16008
  const revealed = clientState != null;
@@ -16102,8 +16209,8 @@ function GameScreenHost({
16102
16209
  ui
16103
16210
  }) {
16104
16211
  const { gameId, fixtureId, gameDay = "", lockAtUtc = null } = selected;
16105
- const [configJson, setConfigJson] = useState68(null);
16106
- useEffect44(() => {
16212
+ const [configJson, setConfigJson] = useState69(null);
16213
+ useEffect46(() => {
16107
16214
  setConfigJson(null);
16108
16215
  if (!conversation) return;
16109
16216
  let cancelled = false;
@@ -16126,12 +16233,12 @@ function GameScreenHost({
16126
16233
  fixtureId: fixtureId || void 0,
16127
16234
  locale: ui.hostTag
16128
16235
  });
16129
- useEffect44(() => {
16236
+ useEffect46(() => {
16130
16237
  if (conversation) hydrate();
16131
16238
  }, [conversation, gameId]);
16132
- const hydrateRef = useRef37(hydrate);
16239
+ const hydrateRef = useRef40(hydrate);
16133
16240
  hydrateRef.current = hydrate;
16134
- useEffect44(() => {
16241
+ useEffect46(() => {
16135
16242
  if (!FIXTURE_GAME_IDS.has(gameId)) return;
16136
16243
  if (rawStatus !== "pending") return;
16137
16244
  const timerId = setInterval(() => {
@@ -16244,7 +16351,7 @@ function GameScreenHost({
16244
16351
  }
16245
16352
 
16246
16353
  // src/components/Leaderboard.tsx
16247
- import { useState as useState69 } from "react";
16354
+ import { useState as useState70 } from "react";
16248
16355
 
16249
16356
  // src/components/LeaderboardRow.tsx
16250
16357
  import { jsx as jsx130, jsxs as jsxs116 } from "react/jsx-runtime";
@@ -16331,7 +16438,7 @@ function Leaderboard({
16331
16438
  ui,
16332
16439
  onPlay
16333
16440
  }) {
16334
- const [segment, setSegment] = useState69("weekly");
16441
+ const [segment, setSegment] = useState70("weekly");
16335
16442
  const myRow = segment === "weekly" ? data.myWeeklyRow : data.myAllTimeRow;
16336
16443
  const offBoard = myRow !== null && myRow !== void 0 && myRow.rank === -1;
16337
16444
  const isEmpty = segment === "weekly" ? data.weeklyTop.length === 0 : data.allTimeTop.length === 0;
@@ -16436,9 +16543,9 @@ function GamesPanel({
16436
16543
  leaderboardLoading,
16437
16544
  refreshHub
16438
16545
  }) {
16439
- const [selected, setSelected] = useState70(null);
16440
- const [segment, setSegment] = useState70("play");
16441
- useEffect45(() => {
16546
+ const [selected, setSelected] = useState71(null);
16547
+ const [segment, setSegment] = useState71("play");
16548
+ useEffect47(() => {
16442
16549
  ensureGamesFonts();
16443
16550
  }, []);
16444
16551
  if (!loggedIn) return /* @__PURE__ */ jsx134(GamesLoginWall, { ui });
@@ -16502,10 +16609,10 @@ function GamesPanel({
16502
16609
  }
16503
16610
 
16504
16611
  // src/components/FavouritesPanel.tsx
16505
- import { useEffect as useEffect48, useRef as useRef39, useState as useState73 } from "react";
16612
+ import { useEffect as useEffect50, useRef as useRef42, useState as useState74 } from "react";
16506
16613
 
16507
16614
  // src/components/FavouriteChips.tsx
16508
- import { useEffect as useEffect46, useState as useState71 } from "react";
16615
+ import { useEffect as useEffect48, useState as useState72 } from "react";
16509
16616
  import { Fragment as Fragment41, jsx as jsx135, jsxs as jsxs120 } from "react/jsx-runtime";
16510
16617
  async function toggleWithNotice(controller, kind, id, onNotice) {
16511
16618
  const outcome = await controller.toggle(kind, id);
@@ -16552,12 +16659,12 @@ function Group({ title, entities, sport, ui, controller, onNotice }) {
16552
16659
  ] });
16553
16660
  }
16554
16661
  function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNotice }) {
16555
- const [confirming, setConfirming] = useState71(false);
16662
+ const [confirming, setConfirming] = useState72(false);
16556
16663
  const data = controller.data;
16557
- useEffect46(() => {
16664
+ useEffect48(() => {
16558
16665
  setConfirming(false);
16559
16666
  }, [sport]);
16560
- useEffect46(() => {
16667
+ useEffect48(() => {
16561
16668
  if (!confirming) return;
16562
16669
  const onPointerDown = (e) => {
16563
16670
  if (!(e.target instanceof Element) || !e.target.closest("[data-fav-confirm]")) setConfirming(false);
@@ -16611,21 +16718,21 @@ function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNoti
16611
16718
  }
16612
16719
 
16613
16720
  // src/components/FavouritesSearch.tsx
16614
- import { useEffect as useEffect47, useRef as useRef38, useState as useState72 } from "react";
16721
+ import { useEffect as useEffect49, useRef as useRef41, useState as useState73 } from "react";
16615
16722
  import { jsx as jsx136, jsxs as jsxs121 } from "react/jsx-runtime";
16616
16723
  var MIN_LETTERS = 2;
16617
16724
  var MAX_LENGTH = 64;
16618
16725
  var DEBOUNCE_MS = 250;
16619
16726
  function FavouritesSearch({ controller, ui, sport, onNotice }) {
16620
- const [query, setQuery] = useState72("");
16621
- const [answer, setAnswer] = useState72(null);
16622
- const controllerRef = useRef38(controller);
16727
+ const [query, setQuery] = useState73("");
16728
+ const [answer, setAnswer] = useState73(null);
16729
+ const controllerRef = useRef41(controller);
16623
16730
  controllerRef.current = controller;
16624
16731
  const trimmed = query.trim();
16625
16732
  const queryKey = `${sport}|${trimmed}`;
16626
16733
  const results2 = answer?.key === queryKey ? answer.rows : [];
16627
16734
  const settled = answer?.key === queryKey;
16628
- useEffect47(() => {
16735
+ useEffect49(() => {
16629
16736
  setAnswer(null);
16630
16737
  if (trimmed.length < MIN_LETTERS) return;
16631
16738
  let cancelled = false;
@@ -16688,13 +16795,13 @@ function FavouritesSearch({ controller, ui, sport, onNotice }) {
16688
16795
  // src/components/FavouritesPanel.tsx
16689
16796
  import { jsx as jsx137, jsxs as jsxs122 } from "react/jsx-runtime";
16690
16797
  function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
16691
- const [notice, setNotice] = useState73(null);
16692
- const refreshRef = useRef39(controller.refresh);
16798
+ const [notice, setNotice] = useState74(null);
16799
+ const refreshRef = useRef42(controller.refresh);
16693
16800
  refreshRef.current = controller.refresh;
16694
- useEffect48(() => {
16801
+ useEffect50(() => {
16695
16802
  void refreshRef.current();
16696
16803
  }, []);
16697
- useEffect48(() => {
16804
+ useEffect50(() => {
16698
16805
  setNotice(null);
16699
16806
  }, [sport]);
16700
16807
  const sportLabel2 = sports.find((s) => s.sport === sport)?.label ?? sportLabel(ui, sport);
@@ -16720,7 +16827,7 @@ function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
16720
16827
  }
16721
16828
 
16722
16829
  // src/components/dashboard/v8/SentenceBuilder.tsx
16723
- import { useEffect as useEffect49, useRef as useRef40, useState as useState74 } from "react";
16830
+ import { useEffect as useEffect51, useRef as useRef43, useState as useState75 } from "react";
16724
16831
  import { Fragment as Fragment42, jsx as jsx138, jsxs as jsxs123 } from "react/jsx-runtime";
16725
16832
  var TOTALS = ["any", "3", "5", "10", "20", "50"];
16726
16833
  var BASE_LEGS = [1, 2, 3, 4];
@@ -16746,8 +16853,8 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
16746
16853
  const opening = openingGames(preset);
16747
16854
  const gamesOptions = opening.options;
16748
16855
  const marketOptions = usableMarkets(preset);
16749
- const [fingerprint] = useState74(() => JSON.stringify(preset));
16750
- const [saved] = useState74(() => {
16856
+ const [fingerprint] = useState75(() => JSON.stringify(preset));
16857
+ const [saved] = useState75(() => {
16751
16858
  const kept = memory3?.savedView(sport);
16752
16859
  return kept && kept.fingerprint === fingerprint ? kept : null;
16753
16860
  });
@@ -16761,9 +16868,9 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
16761
16868
  // The server never widens by itself: an all-games preset with no ids asks for it.
16762
16869
  widen: opening.option ? opening.option.matchIds.length === 0 : preset.gamesScope === "all" && preset.matchIds.length === 0
16763
16870
  };
16764
- const [view, setView] = useState74(() => saved?.view ?? openingView);
16765
- const autoWidened = useRef40(false);
16766
- const [widenedNote, setWidenedNote] = useState74(saved?.widenedNote ?? false);
16871
+ const [view, setView] = useState75(() => saved?.view ?? openingView);
16872
+ const autoWidened = useRef43(false);
16873
+ const [widenedNote, setWidenedNote] = useState75(saved?.widenedNote ?? false);
16767
16874
  const requestFor = (v) => ({
16768
16875
  sport,
16769
16876
  ...v.marketKey !== null ? { marketKey: v.marketKey } : {},
@@ -16775,10 +16882,10 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
16775
16882
  ...operatorUserId ? { operatorUserId } : {},
16776
16883
  ...anonymousUserId ? { anonymousUserId } : {}
16777
16884
  });
16778
- const [first] = useState74(() => requestFor(view));
16885
+ const [first] = useState75(() => requestFor(view));
16779
16886
  const { grid, status: status2, confirmed, request } = useBuilderGrid({ conversation, locale: ui.hostTag, memory: memory3, initial: first });
16780
- const lastRequest = useRef40(first);
16781
- useEffect49(() => {
16887
+ const lastRequest = useRef43(first);
16888
+ useEffect51(() => {
16782
16889
  void request(lastRequest.current);
16783
16890
  }, [request]);
16784
16891
  const send = (req) => {
@@ -16811,17 +16918,17 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
16811
16918
  const rows = ready && grid.status === "ok" ? legsOf(grid, sport) : null;
16812
16919
  const rowSlip = rows ? guardLegsPreMatch(slip, rows, ui) : slip;
16813
16920
  useNextKickoffRender(rows ? rows.map((l) => l.kickoffUtc) : []);
16814
- const [startedNote, setStartedNote] = useState74(false);
16921
+ const [startedNote, setStartedNote] = useState75(false);
16815
16922
  const anyStarted = rows !== null && rows.some((l) => !preMatchOpen(l.kickoffUtc, Date.now()));
16816
- useEffect49(() => {
16923
+ useEffect51(() => {
16817
16924
  if (startedNote && status2 === "ready" && !anyStarted) setStartedNote(false);
16818
16925
  }, [startedNote, status2, anyStarted]);
16819
16926
  const market = rows?.[0]?.market;
16820
- const [seen, setSeen] = useState74(null);
16821
- useEffect49(() => {
16927
+ const [seen2, setSeen] = useState75(null);
16928
+ useEffect51(() => {
16822
16929
  if (market) setSeen(market);
16823
16930
  }, [market]);
16824
- const marketName = view.marketKey === null ? null : marketOptions?.find((m) => m.key === view.marketKey)?.label ?? market ?? seen;
16931
+ const marketName = view.marketKey === null ? null : marketOptions?.find((m) => m.key === view.marketKey)?.label ?? market ?? seen2;
16825
16932
  const paused = ready && grid.status === "paused";
16826
16933
  const coolOff = status2 === "ready" && grid === null;
16827
16934
  const empty2 = ready && (grid.status === "miss" || grid.status === "ok" && (rows === null || rows.length === 0));
@@ -16831,14 +16938,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
16831
16938
  const quotedAt = rows ? oldestQuote(rows) : null;
16832
16939
  const combo = ready && grid.total !== null ? { sport, totalChosen: view.total, totalActual: grid.total } : void 0;
16833
16940
  const canWiden = gamesOptions === null || allGames !== null;
16834
- useEffect49(() => {
16941
+ useEffect51(() => {
16835
16942
  if (!empty2 || !singles || widened || !canWiden || autoWidened.current) return;
16836
16943
  autoWidened.current = true;
16837
16944
  const next = { ...view, widen: true, matchIds: [], gamesId: allGames ? allGames.id : view.gamesId };
16838
16945
  commit(next, true);
16839
16946
  send(requestFor(next));
16840
16947
  }, [empty2, singles, widened, canWiden, view]);
16841
- useEffect49(() => {
16948
+ useEffect51(() => {
16842
16949
  if (coolOff) onCoolOff?.(sport);
16843
16950
  }, [coolOff, onCoolOff, sport]);
16844
16951
  if (coolOff) return null;
@@ -17241,10 +17348,10 @@ function Squad({ squad, loading, ui, view, onToggleView, stats, statsLoading, se
17241
17348
  }
17242
17349
 
17243
17350
  // src/components/PlayerPhoto.tsx
17244
- import { useState as useState75 } from "react";
17351
+ import { useState as useState76 } from "react";
17245
17352
  import { jsx as jsx144 } from "react/jsx-runtime";
17246
17353
  function PlayerPhoto({ photoUrl, jerseyNumber, size }) {
17247
- const [failed, setFailed] = useState75(false);
17354
+ const [failed, setFailed] = useState76(false);
17248
17355
  const box = { width: size, height: size };
17249
17356
  if (photoUrl && !failed) {
17250
17357
  return /* @__PURE__ */ jsx144("img", { className: "ss-w-pd-photo", style: box, src: photoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
@@ -17279,7 +17386,7 @@ function MiniPitch({ positionCode }) {
17279
17386
  }
17280
17387
 
17281
17388
  // src/components/PerformanceBars.tsx
17282
- import { useState as useState76 } from "react";
17389
+ import { useState as useState77 } from "react";
17283
17390
  import { jsx as jsx146, jsxs as jsxs129 } from "react/jsx-runtime";
17284
17391
  var GROUPS = ["shooting", "passing", "possession", "defending"];
17285
17392
  function finite4(v) {
@@ -17325,7 +17432,7 @@ function unrankedLine(ui, reason) {
17325
17432
  }
17326
17433
  }
17327
17434
  function PerformanceBars({ performance, competitionName, strings }) {
17328
- const [mode, setMode] = useState76("total");
17435
+ const [mode, setMode] = useState77("total");
17329
17436
  const labelled = performance.metrics.filter((m) => Object.prototype.hasOwnProperty.call(strings.perfMetric, m.key));
17330
17437
  if (!labelled.some((m) => valueOf(m, "total") !== null || valueOf(m, "per90") !== null)) return null;
17331
17438
  const subtitle = !performance.ranked ? unrankedLine(strings, performance.unrankedReason) : competitionName ? strings.perfRankedAgainst(competitionName, performance.positionGroup) : null;
@@ -17497,7 +17604,7 @@ function PlayerDetail({ detail, loading, ui, seasonName, onClose }) {
17497
17604
  }
17498
17605
 
17499
17606
  // src/components/PresetTools.tsx
17500
- import { useId as useId11, useState as useState77 } from "react";
17607
+ import { useId as useId11, useState as useState78 } from "react";
17501
17608
  import { Fragment as Fragment45, jsx as jsx148, jsxs as jsxs131 } from "react/jsx-runtime";
17502
17609
  function PresetToolModal({ title, closeLabel, onClose, children, footer, className }) {
17503
17610
  const { dialogRef, onKeyDown } = useModalDialog(onClose, { restoreFocus: false });
@@ -17551,9 +17658,9 @@ function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal,
17551
17658
  const totalOptions = comboTotals(grid);
17552
17659
  const totals = totalOptions.map((o) => o.value);
17553
17660
  const legChoices = comboLegChoices(grid);
17554
- const [total, setTotal] = useState77(() => nearest(totals, initialTotal));
17555
- const [legs, setLegs] = useState77(() => legsForTotal(grid, nearest(totals, initialTotal), clampLegs(legChoices, initialLegs)));
17556
- const [announcement, setAnnouncement] = useState77("");
17661
+ const [total, setTotal] = useState78(() => nearest(totals, initialTotal));
17662
+ const [legs, setLegs] = useState78(() => legsForTotal(grid, nearest(totals, initialTotal), clampLegs(legChoices, initialLegs)));
17663
+ const [announcement, setAnnouncement] = useState78("");
17557
17664
  const cell2 = findCombo(grid, total, legs);
17558
17665
  const minLegs = legChoices[0] ?? legs;
17559
17666
  const maxLegs = legChoices[legChoices.length - 1] ?? legs;
@@ -17623,8 +17730,8 @@ function SettingsSheet({ ui, onClose }) {
17623
17730
  import { Fragment as Fragment46, jsx as jsx150, jsxs as jsxs133 } from "react/jsx-runtime";
17624
17731
  var FULLSCREEN_QUERY = "(max-width: 639px)";
17625
17732
  function useIsModal() {
17626
- const [modal, setModal] = useState78(false);
17627
- useEffect51(() => {
17733
+ const [modal, setModal] = useState79(false);
17734
+ useEffect53(() => {
17628
17735
  if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
17629
17736
  const mql = window.matchMedia(FULLSCREEN_QUERY);
17630
17737
  const sync = () => setModal(mql.matches);
@@ -17636,14 +17743,14 @@ function useIsModal() {
17636
17743
  }
17637
17744
  var HIDDEN_LAYER_STYLE = { position: "absolute", inset: 0, visibility: "hidden", display: "flex", flexDirection: "column" };
17638
17745
  var SQUAD_LAYER_STYLE = { display: "flex", flexDirection: "column", flex: 1, minHeight: 0 };
17639
- function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, schedule, gamesResult, leaderboardResult, clubFixturesResult, clubStandingsResult, clubSquadResult, clubSquadStatsResult, clubPlayerDetailResult, loggedIn, conversation, presetGrid, favouritesEnabled, favourites, builder }) {
17746
+ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, schedule, gamesResult, leaderboardResult, clubFixturesResult, clubStandingsResult, clubSquadResult, clubSquadStatsResult, clubPlayerDetailResult, loggedIn, conversation, presetGrid, favouritesEnabled, favourites, builder, onCloseRequested, onRegisterBack }) {
17640
17747
  const { state, close, stop, send, reset } = controller;
17641
- const [squadView, setSquadView] = useState78("roster");
17642
- const [selectedPlayerId, setSelectedPlayerId] = useState78(null);
17748
+ const [squadView, setSquadView] = useState79("roster");
17749
+ const [selectedPlayerId, setSelectedPlayerId] = useState79(null);
17643
17750
  const clearPlayerDetail = clubPlayerDetailResult?.clear;
17644
17751
  const fetchPlayerDetail = clubPlayerDetailResult?.fetch;
17645
- const squadLayerRef = useRef42(null);
17646
- const squadScrollRef = useRef42(null);
17752
+ const squadLayerRef = useRef45(null);
17753
+ const squadScrollRef = useRef45(null);
17647
17754
  const selectPlayer = (playerId) => {
17648
17755
  squadScrollRef.current = squadLayerRef.current?.querySelector(".ss-w-mon-list")?.scrollTop ?? null;
17649
17756
  setSelectedPlayerId(playerId);
@@ -17666,16 +17773,16 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
17666
17773
  const hasBuilder = !clubBrand && (builderOptions?.length ?? 0) > 0;
17667
17774
  const tabs = monitor ?? (hasBuilder ? tabState : void 0);
17668
17775
  const activeTab = tabs?.activeTab;
17669
- useEffect51(() => {
17776
+ useEffect53(() => {
17670
17777
  if (activeTab === "squad" || selectedPlayerId === null) return;
17671
17778
  setSelectedPlayerId(null);
17672
17779
  clearPlayerDetail?.();
17673
17780
  }, [activeTab, selectedPlayerId, clearPlayerDetail]);
17674
- useEffect51(() => {
17781
+ useEffect53(() => {
17675
17782
  if (activeTab === "favourites" && !favouritesEnabled) setMonitorTab?.("chat");
17676
17783
  }, [activeTab, favouritesEnabled, setMonitorTab]);
17677
17784
  const storedTab = tabState?.activeTab;
17678
- useEffect51(() => {
17785
+ useEffect53(() => {
17679
17786
  const unreachable = storedTab === "builder" ? !hasBuilder : !monitor && storedTab !== void 0 && storedTab !== "chat";
17680
17787
  if (unreachable) setMonitorTab?.("chat");
17681
17788
  }, [storedTab, hasBuilder, monitor, setMonitorTab]);
@@ -17684,11 +17791,12 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
17684
17791
  const closeTab = tabs?.activeTab ?? "chat";
17685
17792
  const lastMessage = state.messages[state.messages.length - 1];
17686
17793
  const answering = state.isStreaming && !(lastMessage?.role === "assistant" && lastMessage.isGreeting);
17687
- const closeWith = useCallback26((method) => {
17794
+ const closeWith = useCallback27((method) => {
17688
17795
  track({ name: "widget_close", method, tab: closeTab, answering });
17689
- close();
17690
- }, [track, closeTab, answering, close]);
17691
- useEffect51(() => {
17796
+ if (onCloseRequested) onCloseRequested();
17797
+ else close();
17798
+ }, [track, closeTab, answering, close, onCloseRequested]);
17799
+ useEffect53(() => {
17692
17800
  const onKey = (e) => {
17693
17801
  if (e.key === "Escape") closeWith("escape");
17694
17802
  };
@@ -17704,68 +17812,93 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
17704
17812
  tabs?.setActiveTab("chat");
17705
17813
  send(text2, { grounding, source });
17706
17814
  };
17707
- useEffect51(() => {
17815
+ useEffect53(() => {
17708
17816
  if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
17709
17817
  }, [monitor, state.isStreaming, state.messages.length]);
17710
17818
  const onChatTab = !tabs || tabs.activeTab === "chat";
17711
- const inputRef = useRef42(null);
17712
- const limitRef = useRef42(null);
17713
- const typedSendRef = useRef42(false);
17714
- const focusAfterCloseRef = useRef42(null);
17715
- const [tool, setTool] = useState78(null);
17716
- const panelRef = useRef42(null);
17819
+ const inputRef = useRef45(null);
17820
+ const limitRef = useRef45(null);
17821
+ const typedSendRef = useRef45(false);
17822
+ const focusAfterCloseRef = useRef45(null);
17823
+ const [tool, setTool] = useState79(null);
17824
+ const panelRef = useRef45(null);
17717
17825
  const settings = useOddsSettings();
17718
- const [settingsOpen, setSettingsOpen] = useState78(false);
17826
+ const [settingsOpen, setSettingsOpen] = useState79(false);
17719
17827
  const hasSettings = settings.oddsOffered || !settings.themeLocked;
17720
- const openSettings = useCallback26(() => {
17828
+ const openSettings = useCallback27(() => {
17721
17829
  setTool(null);
17722
17830
  setSettingsOpen(true);
17723
17831
  }, []);
17724
- const closeSettings = useCallback26(() => {
17832
+ const closeSettings = useCallback27(() => {
17725
17833
  setSettingsOpen(false);
17726
17834
  panelRef.current?.querySelector(".ss-w-kebab")?.focus();
17727
17835
  }, []);
17728
17836
  const paused = isPaused(state.limit);
17729
- useEffect51(() => {
17837
+ useEffect53(() => {
17730
17838
  if (paused) setTool(null);
17731
17839
  }, [paused]);
17732
- useEffect51(() => {
17840
+ useEffect53(() => {
17733
17841
  if (!paused) return;
17734
17842
  if (typedSendRef.current) limitRef.current?.focus();
17735
17843
  typedSendRef.current = false;
17736
17844
  }, [paused]);
17737
- const openTool = useCallback26((next) => {
17845
+ const openTool = useCallback27((next) => {
17738
17846
  setTool(next);
17739
17847
  }, []);
17740
17848
  const toolsValue = useMemo12(
17741
17849
  () => presetGrid && !paused ? { openBuilder: (total, legs) => openTool({ total, legs }), changeLabel: ui.presets.changeCombo } : null,
17742
17850
  [presetGrid, paused, openTool, ui.presets.changeCombo]
17743
17851
  );
17744
- const closeTool = useCallback26(() => {
17852
+ const closeTool = useCallback27(() => {
17745
17853
  focusAfterCloseRef.current = "composer";
17746
17854
  setTool(null);
17747
17855
  }, []);
17748
- const sendAsk = useCallback26((ask) => {
17856
+ const sendAsk = useCallback27((ask) => {
17749
17857
  focusAfterCloseRef.current = "composer";
17750
17858
  setTool(null);
17751
17859
  tabs?.setActiveTab("chat");
17752
17860
  send(ask.message, { displayText: ask.displayText, preset: ask.preset, source: "preset" });
17753
17861
  }, [tabs, send]);
17754
- const formatKickoff = useCallback26((kickoffUtc) => {
17862
+ const formatKickoff = useCallback27((kickoffUtc) => {
17755
17863
  const k = ui.bettingKickoff(kickoffUtc);
17756
17864
  return `${k.dayLabel} ${k.time}`;
17757
17865
  }, [ui]);
17758
- useEffect51(() => {
17866
+ useEffect53(() => {
17759
17867
  if (tool) return;
17760
17868
  const target = focusAfterCloseRef.current;
17761
17869
  focusAfterCloseRef.current = null;
17762
17870
  if (target === "composer") inputRef.current?.focus();
17763
17871
  }, [tool]);
17764
- useEffect51(() => {
17872
+ useEffect53(() => {
17765
17873
  if (!tool || onChatTab && presetGrid) return;
17766
17874
  focusAfterCloseRef.current = "composer";
17767
17875
  setTool(null);
17768
17876
  }, [tool, onChatTab, presetGrid]);
17877
+ const backRef = useRef45(() => false);
17878
+ backRef.current = () => {
17879
+ if (settingsOpen && hasSettings) {
17880
+ closeSettings();
17881
+ return true;
17882
+ }
17883
+ if (tool) {
17884
+ closeTool();
17885
+ return true;
17886
+ }
17887
+ if (selectedPlayerId !== null) {
17888
+ closePlayer();
17889
+ return true;
17890
+ }
17891
+ if (tabs && tabs.activeTab !== "chat") {
17892
+ tabs.setActiveTab("chat");
17893
+ return true;
17894
+ }
17895
+ return false;
17896
+ };
17897
+ useEffect53(() => {
17898
+ if (!onRegisterBack) return;
17899
+ onRegisterBack(() => backRef.current());
17900
+ return () => onRegisterBack(null);
17901
+ }, [onRegisterBack]);
17769
17902
  return /* @__PURE__ */ jsxs133("div", { ref: panelRef, className: "ss-w-panel", role: "dialog", "aria-modal": isModal, "aria-label": ui.chatDialogLabel, children: [
17770
17903
  /* @__PURE__ */ jsx150(
17771
17904
  ChatHeader,
@@ -18127,6 +18260,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
18127
18260
  .ss-w-root[data-ss-w-pos="right"] .ss-w-panel,
18128
18261
  .ss-w-root[data-ss-w-pos="left"] .ss-w-panel { inset: 0; width: auto; height: auto; border: none; border-radius: 0; }
18129
18262
  }
18263
+ .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); }
18130
18264
  .ss-w-header { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--ss-w-line); }
18131
18265
  .ss-w-header-mark { width: 18px; height: 18px; display: block; object-fit: contain; }
18132
18266
  .ss-w-header-title { font-weight: 660; flex: 1; }
@@ -20714,9 +20848,9 @@ function StatsWidget(props) {
20714
20848
  const injectedClient = "client" in props ? props.client : void 0;
20715
20849
  const cfg = props.config;
20716
20850
  const built = useMemo13(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
20717
- const trackingRef = useRef43({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
20851
+ const trackingRef = useRef46({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
20718
20852
  const track = useMemo13(() => createTracker(() => trackingRef.current), []);
20719
- const eventTextRef = useRef43(false);
20853
+ const eventTextRef = useRef46(false);
20720
20854
  eventTextRef.current = cfg?.eventText === true;
20721
20855
  const logger = useMemo13(() => {
20722
20856
  if (!built) return null;
@@ -20733,9 +20867,9 @@ function StatsWidget(props) {
20733
20867
  [props.config, widgetStrings.strings]
20734
20868
  );
20735
20869
  const oddsSettings = useOddsSettingsState(ui, built?.conversation, cfg?.operatorId || "default");
20736
- const rootRef = useRef43(null);
20737
- const introDoneRef = useRef43(false);
20738
- const markIntroDone = useCallback27(() => {
20870
+ const rootRef = useRef46(null);
20871
+ const introDoneRef = useRef46(false);
20872
+ const markIntroDone = useCallback28(() => {
20739
20873
  introDoneRef.current = true;
20740
20874
  }, []);
20741
20875
  const language = injectedClient ? void 0 : hostTag(cfg);
@@ -20749,13 +20883,13 @@ function StatsWidget(props) {
20749
20883
  const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey, cfg?.page, sportScope, language, chatTracking, injectedClient ? oddsSettings.userOddsFormat : oddsSettings.oddsFormat);
20750
20884
  const panelOpen = controller.state.isOpen && !stringsPending;
20751
20885
  const liveCardWatches = useMemo13(() => {
20752
- const seen = /* @__PURE__ */ new Set();
20886
+ const seen2 = /* @__PURE__ */ new Set();
20753
20887
  const out = [];
20754
20888
  for (const msg of controller.state.messages) {
20755
20889
  if (msg.role !== "assistant") continue;
20756
20890
  for (const vm of msg.marketOdds) {
20757
- if (vm.live == null || seen.has(vm.matchId)) continue;
20758
- seen.add(vm.matchId);
20891
+ if (vm.live == null || seen2.has(vm.matchId)) continue;
20892
+ seen2.add(vm.matchId);
20759
20893
  out.push({ key: `live:card:${vm.matchId}`, kind: "market", matchId: vm.matchId, marketDeveloperName: vm.marketDeveloperName ?? "FULLTIME_RESULT" });
20760
20894
  }
20761
20895
  }
@@ -20774,15 +20908,15 @@ function StatsWidget(props) {
20774
20908
  });
20775
20909
  const operatorUserId = cfg?.userContext?.operatorUserId;
20776
20910
  const anonymousUserId = cfg?.userContext?.anonymousUserId;
20777
- const getSchedule = useCallback27(
20911
+ const getSchedule = useCallback28(
20778
20912
  (localDate, utcOffsetMinutes) => built ? built.conversation.getSchedule(localDate, utcOffsetMinutes, operatorUserId, anonymousUserId) : Promise.resolve(null),
20779
20913
  [built, operatorUserId, anonymousUserId]
20780
20914
  );
20781
- const getStates = useCallback27(
20915
+ const getStates = useCallback28(
20782
20916
  (matchIds, nbaGameIds, nflGameIds, tennisMatches) => built ? built.conversation.getStates(matchIds, nbaGameIds, nflGameIds, requestTag, tennisMatches) : Promise.resolve(null),
20783
20917
  [built, requestTag]
20784
20918
  );
20785
- const getTennisPrices = useCallback27(
20919
+ const getTennisPrices = useCallback28(
20786
20920
  (keys) => built ? built.conversation.getStates([], [], [], requestTag, [], keys).then((p) => p?.tennisPrices ?? null) : Promise.resolve(null),
20787
20921
  [built, requestTag]
20788
20922
  );
@@ -20801,12 +20935,12 @@ function StatsWidget(props) {
20801
20935
  timeZone: ui.timeZone
20802
20936
  });
20803
20937
  const offeredSports = useMemo13(() => {
20804
- const seen = new Set(discovery.matchDays.map((d) => d.sport));
20805
- for (const g of discovery.groups) seen.add(g.sport ?? "football");
20806
- return [...seen];
20938
+ const seen2 = new Set(discovery.matchDays.map((d) => d.sport));
20939
+ for (const g of discovery.groups) seen2.add(g.sport ?? "football");
20940
+ return [...seen2];
20807
20941
  }, [discovery.matchDays, discovery.groups]);
20808
20942
  const scheduleSport = useScheduleSport(offeredSports);
20809
- const [liveLeague, setLiveLeague] = useState79(null);
20943
+ const [liveLeague, setLiveLeague] = useState80(null);
20810
20944
  const [matchesDay, setMatchesDay] = useMatchesDayPick(discovery.localDate);
20811
20945
  const matchesLoaded = useMatchesDay({
20812
20946
  discovery,
@@ -20816,8 +20950,8 @@ function StatsWidget(props) {
20816
20950
  enabled: panelOpen && monitor.activeTab === "matches",
20817
20951
  timeZone: ui.timeZone
20818
20952
  });
20819
- const prevLiveSnapshotRef = useRef43(monitor.snapshot);
20820
- useEffect52(() => {
20953
+ const prevLiveSnapshotRef = useRef46(monitor.snapshot);
20954
+ useEffect54(() => {
20821
20955
  const snap = monitor.snapshot;
20822
20956
  if (!snap || snap === prevLiveSnapshotRef.current) return;
20823
20957
  prevLiveSnapshotRef.current = snap;
@@ -20857,7 +20991,7 @@ function StatsWidget(props) {
20857
20991
  const clubSquadResult = useClubSquad(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
20858
20992
  const clubSquadStatsResult = useClubSquadStats(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
20859
20993
  const clubPlayerDetailResult = useClubPlayerDetail(built?.conversation ?? null);
20860
- const [favSportPick, setFavSportPick] = useState79(null);
20994
+ const [favSportPick, setFavSportPick] = useState80(null);
20861
20995
  const latestGreeting = useMemo13(() => {
20862
20996
  for (const m of [...controller.state.messages].reverse()) {
20863
20997
  if (m.role === "assistant" && m.defaultSport !== void 0) return m;
@@ -20873,13 +21007,13 @@ function StatsWidget(props) {
20873
21007
  const favSport = [favSportPick, rememberedSport, latestGreeting?.defaultSport].find(offered) ?? "football";
20874
21008
  const favSports = favSportOptions.length > 0 ? favSportOptions : [{ sport: favSport, label: sportLabel(ui, favSport) }];
20875
21009
  const hasFavouritesIdentity = !!(operatorUserId || anonymousUserId);
20876
- const [builderSportPick, setBuilderSportPick] = useState79(null);
21010
+ const [builderSportPick, setBuilderSportPick] = useState80(null);
20877
21011
  const builderGreeting = useMemo13(
20878
21012
  () => [...controller.state.messages].reverse().find((m) => m.role === "assistant" && (m.greetingDashboard !== void 0 || m.greetingDashboards !== void 0)) ?? null,
20879
21013
  [controller.state.messages]
20880
21014
  );
20881
- const [coolOff, setCoolOff] = useState79(null);
20882
- const onBuilderCoolOff = useCallback27((sport) => {
21015
+ const [coolOff, setCoolOff] = useState80(null);
21016
+ const onBuilderCoolOff = useCallback28((sport) => {
20883
21017
  if (!builderGreeting) return;
20884
21018
  setCoolOff((prev) => {
20885
21019
  const sports = prev?.greeting === builderGreeting ? prev.sports : [];
@@ -20899,7 +21033,7 @@ function StatsWidget(props) {
20899
21033
  return options.filter((o) => !cooled.includes(o.sport));
20900
21034
  }, [builderGreeting, coolOff, ui]);
20901
21035
  const builderSport = [builderSportPick, rememberedSport, latestGreeting?.defaultSport].find((s) => !!s && builderOptions.some((o) => o.sport === s)) ?? builderOptions[0]?.sport ?? "";
20902
- const [panelEverOpened, setPanelEverOpened] = useState79(panelOpen);
21036
+ const [panelEverOpened, setPanelEverOpened] = useState80(panelOpen);
20903
21037
  if (panelOpen && !panelEverOpened) setPanelEverOpened(true);
20904
21038
  const favourites = useFavourites({
20905
21039
  conversation: built?.conversation ?? null,
@@ -20911,14 +21045,14 @@ function StatsWidget(props) {
20911
21045
  onChanged: discovery.refreshSchedule
20912
21046
  });
20913
21047
  const favouritesEnabled = hasFavouritesIdentity && favourites.status !== "refused";
20914
- const getPricePresets = useCallback27(
21048
+ const getPricePresets = useCallback28(
20915
21049
  (locale) => built ? built.conversation.getPricePresets(locale, { pool: "open" }) : Promise.resolve(null),
20916
21050
  [built]
20917
21051
  );
20918
21052
  const presetGrid = usePresetGrid({ getPricePresets, isOpen: panelOpen, locale: ui.hostTag });
20919
21053
  const markLiveActivity = monitor.markLiveActivity;
20920
- const prevLiveCountRef = useRef43(0);
20921
- useEffect52(() => {
21054
+ const prevLiveCountRef = useRef46(0);
21055
+ useEffect54(() => {
20922
21056
  const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
20923
21057
  prevLiveCountRef.current = discovery.liveCount;
20924
21058
  if (rose) markLiveActivity();
@@ -20956,8 +21090,6 @@ function StatsWidget(props) {
20956
21090
  () => built ? createDashboardTapSignal((input) => built.conversation.sendSignal(input), logger) : void 0,
20957
21091
  [built, logger]
20958
21092
  );
20959
- const dismissPopup = usePopupTelemetry(logger, panelOpen, controller.state.popupText, controller.dismissPopup);
20960
- useOpenTelemetry(logger, panelOpen);
20961
21093
  const asks = bubbleAsks(controller.state.messages, ui.presets.standoutAsk, oddsSettings.oddsFormat).map((ask) => ({
20962
21094
  label: ask.label,
20963
21095
  onTap: () => runBubbleAsk(ask, {
@@ -20968,10 +21100,24 @@ function StatsWidget(props) {
20968
21100
  log: logger
20969
21101
  })
20970
21102
  }));
20971
- const onControlRef = useRef43(props.onControl);
21103
+ const dismissPopupRef = useRef46(() => {
21104
+ });
21105
+ const mobile = useMobileBinding({
21106
+ binding: props.mobile,
21107
+ panelOpen,
21108
+ popupText: controller.state.popupText,
21109
+ asks,
21110
+ open: controller.open,
21111
+ close: controller.close,
21112
+ dismissPopup: () => dismissPopupRef.current()
21113
+ });
21114
+ const dismissPopup = usePopupTelemetry(logger, panelOpen, controller.state.popupText, controller.dismissPopup, mobile.confirmedShown);
21115
+ dismissPopupRef.current = dismissPopup;
21116
+ useOpenTelemetry(logger, panelOpen);
21117
+ const onControlRef = useRef46(props.onControl);
20972
21118
  onControlRef.current = props.onControl;
20973
21119
  const { open: openPanel, close: closePanel } = controller;
20974
- useEffect52(() => {
21120
+ useEffect54(() => {
20975
21121
  onControlRef.current?.({ open: openPanel, close: closePanel });
20976
21122
  return () => onControlRef.current?.(null);
20977
21123
  }, [openPanel, closePanel]);
@@ -20988,11 +21134,11 @@ function StatsWidget(props) {
20988
21134
  page: cfg?.page
20989
21135
  }
20990
21136
  };
20991
- useEffect52(() => {
21137
+ useEffect54(() => {
20992
21138
  if (!logger) return;
20993
21139
  logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
20994
21140
  }, [logger, operatorUserId, anonymousUserId, conversationId]);
20995
- useEffect52(() => {
21141
+ useEffect54(() => {
20996
21142
  if (!logger) return;
20997
21143
  logger.resume();
20998
21144
  const onHide = () => {
@@ -21010,7 +21156,7 @@ function StatsWidget(props) {
21010
21156
  logger.dispose();
21011
21157
  };
21012
21158
  }, [logger]);
21013
- useEffect52(() => {
21159
+ useEffect54(() => {
21014
21160
  if (!built || !ui.injectStyles || widgetStrings.state === "unavailable") return;
21015
21161
  const node = rootRef.current?.getRootNode();
21016
21162
  if (node) injectStyles(node);
@@ -21031,7 +21177,7 @@ function StatsWidget(props) {
21031
21177
  }), [favouritesEnabled, monitor.enabled, clubFixturesResult.settled, clubFixturesResult.tabReady, clubFixturesResult.enabled, monitor.setActiveTab, favourites, built, holds, builderMemory]);
21032
21178
  if (!built || widgetStrings.state === "unavailable") return null;
21033
21179
  const attrs = themeAttrs(ui, oddsSettings.userTheme);
21034
- return /* @__PURE__ */ jsx152(EventLogContext.Provider, { value: logger, children: /* @__PURE__ */ jsx152(TrackingContext.Provider, { value: track, children: /* @__PURE__ */ jsx152(SportScopeContext.Provider, { value: sportScope, children: /* @__PURE__ */ jsx152(OddsSettingsContext.Provider, { value: oddsSettings, children: /* @__PURE__ */ jsx152(HostEventsProvider, { value: hostEvents, children: /* @__PURE__ */ jsx152("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__ */ jsx152(PersonalGreetingContext.Provider, { value: personalGreeting, children: /* @__PURE__ */ jsx152(
21180
+ return /* @__PURE__ */ jsx152(EventLogContext.Provider, { value: logger, children: /* @__PURE__ */ jsx152(TrackingContext.Provider, { value: track, children: /* @__PURE__ */ jsx152(SportScopeContext.Provider, { value: sportScope, children: /* @__PURE__ */ jsx152(OddsSettingsContext.Provider, { value: oddsSettings, children: /* @__PURE__ */ jsx152(HostEventsProvider, { value: hostEvents, children: /* @__PURE__ */ jsx152("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__ */ jsx152(PersonalGreetingContext.Provider, { value: personalGreeting, children: /* @__PURE__ */ jsx152(
21035
21181
  ChatPanel,
21036
21182
  {
21037
21183
  controller,
@@ -21063,9 +21209,11 @@ function StatsWidget(props) {
21063
21209
  presetGrid,
21064
21210
  favouritesEnabled: favouritesEnabled && clubFixturesResult.tabReady && !clubFixturesResult.enabled,
21065
21211
  favourites: { controller: favourites, sport: favSport, sports: favSports, onSportChange: setFavSportPick },
21066
- builder: { options: builderOptions, sport: builderSport, onSportChange: setBuilderSportPick, onCoolOff: onBuilderCoolOff, tabs: monitor }
21212
+ builder: { options: builderOptions, sport: builderSport, onSportChange: setBuilderSportPick, onCoolOff: onBuilderCoolOff, tabs: monitor },
21213
+ onCloseRequested: mobile.onCloseRequested,
21214
+ onRegisterBack: mobile.onRegisterBack
21067
21215
  }
21068
- ) }) : /* @__PURE__ */ jsx152(
21216
+ ) }) : props.mobile ? null : /* @__PURE__ */ jsx152(
21069
21217
  ChatFab,
21070
21218
  {
21071
21219
  label: stringsPending ? cfg?.launcherLabel : ui.launcherLabel,
@@ -21090,6 +21238,7 @@ function emptyConversation() {
21090
21238
  export {
21091
21239
  StatsWidget,
21092
21240
  WIDGET_CSS,
21241
+ WIDGET_REACT_VERSION,
21093
21242
  createWidgetHost
21094
21243
  };
21095
21244
  //# sourceMappingURL=index.js.map