@sensiblestats/widget-react 0.131.0 → 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 useEffect53, useMemo as useMemo13, useRef as useRef45, 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.131.0";
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) {
@@ -7428,7 +7429,7 @@ var WIRE_TO_PUBLIC = {
7428
7429
 
7429
7430
  // src/popupTelemetry.ts
7430
7431
  import { useCallback as useCallback22, useEffect as useEffect24, useRef as useRef19 } from "react";
7431
- function usePopupTelemetry(log, isOpen, popupText, dismissPopup) {
7432
+ function usePopupTelemetry(log, isOpen, popupText, dismissPopup, confirmedShown) {
7432
7433
  const shownRef = useRef19(/* @__PURE__ */ new Set());
7433
7434
  const closedTextRef = useRef19(null);
7434
7435
  useEffect24(() => {
@@ -7437,23 +7438,70 @@ function usePopupTelemetry(log, isOpen, popupText, dismissPopup) {
7437
7438
  closedTextRef.current = null;
7438
7439
  return;
7439
7440
  }
7440
- closedTextRef.current = popupText;
7441
- if (popupText && !shownRef.current.has(popupText)) {
7442
- 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);
7443
7445
  log?.log({ name: "popup_shown" });
7444
7446
  }
7445
- }, [log, isOpen, popupText]);
7447
+ }, [log, isOpen, popupText, confirmedShown]);
7446
7448
  return useCallback22(() => {
7447
7449
  log?.log({ name: "popup_dismissed" });
7448
7450
  dismissPopup();
7449
7451
  }, [log, dismissPopup]);
7450
7452
  }
7451
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
+
7452
7500
  // src/openTelemetry.ts
7453
- import { useEffect as useEffect25, useRef as useRef20 } from "react";
7501
+ import { useEffect as useEffect26, useRef as useRef21 } from "react";
7454
7502
  function useOpenTelemetry(log, isOpen) {
7455
- const openLoggedRef = useRef20(false);
7456
- useEffect25(() => {
7503
+ const openLoggedRef = useRef21(false);
7504
+ useEffect26(() => {
7457
7505
  if (!isOpen) {
7458
7506
  openLoggedRef.current = false;
7459
7507
  return;
@@ -7465,13 +7513,13 @@ function useOpenTelemetry(log, isOpen) {
7465
7513
  }
7466
7514
 
7467
7515
  // src/components/ChatFab.tsx
7468
- 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";
7469
7517
 
7470
7518
  // src/components/BrandMark.tsx
7471
- import { useState as useState30 } from "react";
7519
+ import { useState as useState31 } from "react";
7472
7520
  import { jsx as jsx27 } from "react/jsx-runtime";
7473
7521
  function BrandMark({ logoUrl, className }) {
7474
- const [failed, setFailed] = useState30(false);
7522
+ const [failed, setFailed] = useState31(false);
7475
7523
  if (!logoUrl || failed) return /* @__PURE__ */ jsx27(SsMark, { className });
7476
7524
  return /* @__PURE__ */ jsx27("img", { className, src: logoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
7477
7525
  }
@@ -7509,9 +7557,9 @@ function ChatFab({ label, busy = false, greeting, popupText, logoUrl, onOpen, on
7509
7557
  const bubble = popupText ?? greeting;
7510
7558
  const hidden = busy && !label;
7511
7559
  const track = useTrack();
7512
- const [intro, setIntro] = useState31(false);
7513
- const armedRef = useRef21(introAllowed);
7514
- useEffect26(() => {
7560
+ const [intro, setIntro] = useState32(false);
7561
+ const armedRef = useRef22(introAllowed);
7562
+ useEffect27(() => {
7515
7563
  if (armedRef.current && bubble) {
7516
7564
  armedRef.current = false;
7517
7565
  setIntro(true);
@@ -7531,10 +7579,10 @@ function ChatFab({ label, busy = false, greeting, popupText, logoUrl, onOpen, on
7531
7579
  }
7532
7580
 
7533
7581
  // src/components/ChatPanel.tsx
7534
- import { useCallback as useCallback26, useEffect as useEffect52, useLayoutEffect as useLayoutEffect2, useMemo as useMemo12, useRef as useRef44, 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";
7535
7583
 
7536
7584
  // src/components/ChatHeader.tsx
7537
- 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";
7538
7586
  import { jsx as jsx30, jsxs as jsxs27 } from "react/jsx-runtime";
7539
7587
  function ChatHeader({
7540
7588
  onClose,
@@ -7548,20 +7596,20 @@ function ChatHeader({
7548
7596
  onOpenSettings,
7549
7597
  settingsLabel
7550
7598
  }) {
7551
- const [menuOpen, setMenuOpen] = useState32(false);
7552
- const wrapRef = useRef22(null);
7553
- const kebabRef = useRef22(null);
7554
- 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);
7555
7603
  const hasNew = !!(canReset && onNewConversation);
7556
7604
  const hasSettings = !!onOpenSettings;
7557
7605
  const hasMenu = hasNew || hasSettings;
7558
- useEffect27(() => {
7606
+ useEffect28(() => {
7559
7607
  if (menuOpen) firstItemRef.current?.focus();
7560
7608
  }, [menuOpen]);
7561
- useEffect27(() => {
7609
+ useEffect28(() => {
7562
7610
  if (!menuOpen) return;
7563
7611
  const onPointer = (e) => {
7564
- if (!wrapRef.current?.contains(e.target)) setMenuOpen(false);
7612
+ if (!(wrapRef.current && e.composedPath().includes(wrapRef.current))) setMenuOpen(false);
7565
7613
  };
7566
7614
  const onKey = (e) => {
7567
7615
  if (e.key === "Escape") {
@@ -7631,10 +7679,10 @@ function ChatHeader({
7631
7679
  }
7632
7680
 
7633
7681
  // src/components/MessageList.tsx
7634
- import { useEffect as useEffect31, useRef as useRef25 } from "react";
7682
+ import { useEffect as useEffect32, useRef as useRef26 } from "react";
7635
7683
 
7636
7684
  // src/components/ChatMessage.tsx
7637
- import { useState as useState42 } from "react";
7685
+ import { useState as useState43 } from "react";
7638
7686
 
7639
7687
  // src/components/Markdown.tsx
7640
7688
  import ReactMarkdown from "react-markdown";
@@ -7652,7 +7700,7 @@ function Markdown({ text: text2 }) {
7652
7700
  }
7653
7701
 
7654
7702
  // src/components/EntityCardList.tsx
7655
- import { useState as useState33 } from "react";
7703
+ import { useState as useState34 } from "react";
7656
7704
  import { jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
7657
7705
  var MAX_VISIBLE = 3;
7658
7706
  var RECORD_RE = /^(\d+)-(\d+)-(\d+)$/;
@@ -7736,7 +7784,7 @@ function ScopeTabs({ scopes, active, onSelect }) {
7736
7784
  )) });
7737
7785
  }
7738
7786
  function EntityCardItem({ c }) {
7739
- const [active, setActive] = useState33(0);
7787
+ const [active, setActive] = useState34(0);
7740
7788
  const hasBody = c.scopes.length > 0;
7741
7789
  if (!hasBody) {
7742
7790
  return /* @__PURE__ */ jsx32("div", { className: "ss-w-ecard ss-w-ecard-bare", "data-kind": c.kind, children: /* @__PURE__ */ jsx32(CardHeader, { c, showScopeCrest: false }) });
@@ -7750,7 +7798,7 @@ function EntityCardItem({ c }) {
7750
7798
  ] });
7751
7799
  }
7752
7800
  function EntityCardList({ cards, disabled, showLessLabel, showMoreLabel }) {
7753
- const [expanded, setExpanded] = useState33(false);
7801
+ const [expanded, setExpanded] = useState34(false);
7754
7802
  if (cards.length === 0) return null;
7755
7803
  const visible = expanded ? cards : cards.slice(0, MAX_VISIBLE);
7756
7804
  const overflow = cards.length - MAX_VISIBLE;
@@ -7851,17 +7899,17 @@ function BettingInsightList({ insights, ui, slip, monitor }) {
7851
7899
  }
7852
7900
 
7853
7901
  // src/components/AddAllToSlipButton.tsx
7854
- import { useCallback as useCallback23, useState as useState34 } from "react";
7902
+ import { useCallback as useCallback24, useState as useState35 } from "react";
7855
7903
  import { jsx as jsx34, jsxs as jsxs30 } from "react/jsx-runtime";
7856
7904
  function AddAllToSlipButton({ legs, slip, ui, labels, combo, chatCombo, sizeless, hold, onStartedGame }) {
7857
7905
  const add = useSlipAdd(slip, ui);
7858
7906
  const slipState = useSlipState();
7859
7907
  const log = useEventLog();
7860
7908
  const track = useTrack();
7861
- const [pending, setPending] = useState34(false);
7862
- const [settledLocal, setSettledLocal] = useState34({});
7863
- const [toast, setToast] = useState34(null);
7864
- 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), []);
7865
7913
  if (!slip.onAddToSlip || legs.length < 2) return null;
7866
7914
  const settled = slipState ? slipState.settled : settledLocal;
7867
7915
  const open = legs.filter((leg) => !settled[slipKey(leg)]);
@@ -9171,7 +9219,7 @@ function TennisInsightList({ insights, ui }) {
9171
9219
  }
9172
9220
 
9173
9221
  // src/components/CompactOddsList.tsx
9174
- 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";
9175
9223
  import { mayPinOrSlip as mayPinOrSlip5, slipSportOf as slipSportOf6, sportOf as sportOf10 } from "@sensiblestats/widget-sdk";
9176
9224
 
9177
9225
  // src/compactList.ts
@@ -9293,11 +9341,11 @@ function Row({ row, columns, ui, slip, monitor, rowRef }) {
9293
9341
  ] });
9294
9342
  }
9295
9343
  function CompactOddsList({ list, ui, slip, monitor }) {
9296
- const [shown2, setShown] = useState35(COMPACT_PAGE);
9344
+ const [shown2, setShown] = useState36(COMPACT_PAGE);
9297
9345
  const hidden = list.rowCount - shown2;
9298
- const [focusIndex, setFocusIndex] = useState35(null);
9299
- const focusRef = useRef23(null);
9300
- useEffect28(() => {
9346
+ const [focusIndex, setFocusIndex] = useState36(null);
9347
+ const focusRef = useRef24(null);
9348
+ useEffect29(() => {
9301
9349
  if (focusIndex !== null) focusRef.current?.focus();
9302
9350
  }, [focusIndex]);
9303
9351
  let left = shown2;
@@ -9532,7 +9580,7 @@ function FixtureCard({ card, ui }) {
9532
9580
  }
9533
9581
 
9534
9582
  // src/components/dashboard/CountdownCard.tsx
9535
- 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";
9536
9584
  import { jsx as jsx43, jsxs as jsxs39 } from "react/jsx-runtime";
9537
9585
  var DAY_MS3 = 864e5;
9538
9586
  function remainingSegments(kickoffUnix, nowMs, withSeconds) {
@@ -9551,12 +9599,12 @@ function remainingSegments(kickoffUnix, nowMs, withSeconds) {
9551
9599
  function CountdownCard({ card, ui }) {
9552
9600
  const { data } = card;
9553
9601
  const unitLabel = { d: data.daysUnit, h: data.hoursUnit, m: data.minutesUnit, s: data.secondsUnit };
9554
- const [nowMs, setNowMs] = useState36(() => Date.now());
9555
- const [reduced] = useState36(
9602
+ const [nowMs, setNowMs] = useState37(() => Date.now());
9603
+ const [reduced] = useState37(
9556
9604
  () => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches
9557
9605
  );
9558
9606
  const withinDay = data.kickoffUnix * 1e3 - nowMs < DAY_MS3;
9559
- useEffect29(() => {
9607
+ useEffect30(() => {
9560
9608
  if (reduced) return;
9561
9609
  const id = window.setInterval(() => setNowMs(Date.now()), withinDay ? 1e3 : 6e4);
9562
9610
  return () => window.clearInterval(id);
@@ -9575,7 +9623,7 @@ function CountdownCard({ card, ui }) {
9575
9623
  }
9576
9624
 
9577
9625
  // src/components/dashboard/InjuriesCard.tsx
9578
- import { useState as useState37 } from "react";
9626
+ import { useState as useState38 } from "react";
9579
9627
  import { jsx as jsx44, jsxs as jsxs40 } from "react/jsx-runtime";
9580
9628
  var SHOWN = 3;
9581
9629
  function ColHead({ name, crestUrl }) {
@@ -9598,7 +9646,7 @@ function InjuryList({ rows, emptyLabel, limit }) {
9598
9646
  }
9599
9647
  function InjuriesCard({ card, ui }) {
9600
9648
  const { data } = card;
9601
- const [expanded, setExpanded] = useState37(false);
9649
+ const [expanded, setExpanded] = useState38(false);
9602
9650
  const hidden = Math.max(0, data.ours.length - SHOWN) + Math.max(0, data.theirs.length - SHOWN);
9603
9651
  const limit = expanded ? void 0 : SHOWN;
9604
9652
  const { showMore, showLess } = ui;
@@ -9703,7 +9751,7 @@ function LinksCard({ card }) {
9703
9751
  }
9704
9752
 
9705
9753
  // src/components/dashboard/PostMatchResultCard.tsx
9706
- import { useState as useState38 } from "react";
9754
+ import { useState as useState39 } from "react";
9707
9755
  import { jsx as jsx50, jsxs as jsxs46 } from "react/jsx-runtime";
9708
9756
  function initials3(name) {
9709
9757
  return name.trim().slice(0, 3).toUpperCase();
@@ -9713,7 +9761,7 @@ function PostMatchCrest({
9713
9761
  name,
9714
9762
  side
9715
9763
  }) {
9716
- const [failed, setFailed] = useState38(false);
9764
+ const [failed, setFailed] = useState39(false);
9717
9765
  const cls = `ss-w-fandash-postmatch-crest ss-w-fandash-postmatch-crest--${side}`;
9718
9766
  if (url && !failed) {
9719
9767
  return /* @__PURE__ */ jsx50("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
@@ -9912,10 +9960,10 @@ function RestingFormCard({ card }) {
9912
9960
  }
9913
9961
 
9914
9962
  // src/components/dashboard/LiveScoreCard.tsx
9915
- import { useRef as useRef24, useState as useState40 } from "react";
9963
+ import { useRef as useRef25, useState as useState41 } from "react";
9916
9964
 
9917
9965
  // src/useLiveClock.ts
9918
- import { useEffect as useEffect30, useState as useState39 } from "react";
9966
+ import { useEffect as useEffect31, useState as useState40 } from "react";
9919
9967
  var TICK_MS = 6e4;
9920
9968
  var MAX_LIVE_TICK_MINUTES = 15;
9921
9969
  function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
@@ -9924,10 +9972,10 @@ function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
9924
9972
  return minute + Math.min(Math.max(0, elapsedMinutes), MAX_LIVE_TICK_MINUTES);
9925
9973
  }
9926
9974
  function useLiveClock(minute, clockRunning, receivedAtMs) {
9927
- const [displayMinute, setDisplayMinute] = useState39(
9975
+ const [displayMinute, setDisplayMinute] = useState40(
9928
9976
  () => computeDisplayMinute(minute, clockRunning, receivedAtMs)
9929
9977
  );
9930
- useEffect30(() => {
9978
+ useEffect31(() => {
9931
9979
  setDisplayMinute(computeDisplayMinute(minute, clockRunning, receivedAtMs));
9932
9980
  if (!clockRunning) return;
9933
9981
  const id = window.setInterval(() => {
@@ -9944,7 +9992,7 @@ function initials5(name) {
9944
9992
  return name.trim().slice(0, 3).toUpperCase();
9945
9993
  }
9946
9994
  function LiveCrest({ url, name, side }) {
9947
- const [failed, setFailed] = useState40(false);
9995
+ const [failed, setFailed] = useState41(false);
9948
9996
  const cls = `ss-w-fandash-live-crest ss-w-fandash-live-crest--${side}`;
9949
9997
  if (url && !failed) {
9950
9998
  return /* @__PURE__ */ jsx59("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
@@ -9966,7 +10014,7 @@ function LiveScoreCard({
9966
10014
  }) {
9967
10015
  const { data } = card;
9968
10016
  const seedKey = `${data.minute}:${data.homeScore}:${data.awayScore}`;
9969
- const seedRef = useRef24(null);
10017
+ const seedRef = useRef25(null);
9970
10018
  if (!seedRef.current || seedRef.current.key !== seedKey) {
9971
10019
  seedRef.current = { key: seedKey, receivedAtMs: Date.now() };
9972
10020
  }
@@ -10012,7 +10060,7 @@ function LiveScoreCard({
10012
10060
  }
10013
10061
 
10014
10062
  // src/components/dashboard/LiveTimelineCard.tsx
10015
- import { useState as useState41 } from "react";
10063
+ import { useState as useState42 } from "react";
10016
10064
  import { jsx as jsx60, jsxs as jsxs56 } from "react/jsx-runtime";
10017
10065
  var SHOWN2 = 3;
10018
10066
  function EventIcon({ type }) {
@@ -10054,7 +10102,7 @@ function EventRow({ e }) {
10054
10102
  ] });
10055
10103
  }
10056
10104
  function LiveTimelineCard({ card, ui }) {
10057
- const [expanded, setExpanded] = useState41(false);
10105
+ const [expanded, setExpanded] = useState42(false);
10058
10106
  const events = card.data.events;
10059
10107
  if (!events || events.length === 0) return null;
10060
10108
  const sorted = [...events].sort((a, b) => b.minute - a.minute);
@@ -10253,7 +10301,7 @@ function FanDashboardCard({ card, onTap, ui, goalEvents }) {
10253
10301
  // src/components/ChatMessage.tsx
10254
10302
  import { jsx as jsx64, jsxs as jsxs60 } from "react/jsx-runtime";
10255
10303
  function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor, onGreetingSport }) {
10256
- const [sport, setSport] = useState42(null);
10304
+ const [sport, setSport] = useState43(null);
10257
10305
  if (message.role === "user") {
10258
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 }) });
10259
10307
  }
@@ -10307,11 +10355,11 @@ function turnAnchor(messages) {
10307
10355
  function MessageList({ controller, ui, slip, onDashboardTap, monitor, onGreetingSport }) {
10308
10356
  const { state, send } = controller;
10309
10357
  const { oddsFormat } = useOddsSettings();
10310
- const listRef = useRef25(null);
10311
- const endRef = useRef25(null);
10312
- const pinnedRef = useRef25(true);
10313
- const anchoredTurnRef = useRef25(null);
10314
- useEffect31(() => {
10358
+ const listRef = useRef26(null);
10359
+ const endRef = useRef26(null);
10360
+ const pinnedRef = useRef26(true);
10361
+ const anchoredTurnRef = useRef26(null);
10362
+ useEffect32(() => {
10315
10363
  const anchor = turnAnchor(state.messages);
10316
10364
  const list = listRef.current;
10317
10365
  if (anchor && anchor.turnId !== anchoredTurnRef.current) {
@@ -10370,13 +10418,13 @@ function MessageList({ controller, ui, slip, onDashboardTap, monitor, onGreeting
10370
10418
  }
10371
10419
 
10372
10420
  // src/components/ChatInput.tsx
10373
- 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";
10374
10422
  import { jsx as jsx67, jsxs as jsxs62 } from "react/jsx-runtime";
10375
10423
  var ChatInput = forwardRef(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel, sendLabel, disabled = false }, ref) {
10376
- const [value, setValue] = useState43("");
10377
- const textareaRef = useRef26(null);
10378
- const stopRef = useRef26(null);
10379
- const textBoxWantsFocusRef = useRef26(false);
10424
+ const [value, setValue] = useState44("");
10425
+ const textareaRef = useRef27(null);
10426
+ const stopRef = useRef27(null);
10427
+ const textBoxWantsFocusRef = useRef27(false);
10380
10428
  const submit = () => {
10381
10429
  if (disabled) return;
10382
10430
  const t = value.trim();
@@ -10402,7 +10450,7 @@ var ChatInput = forwardRef(function ChatInput2({ placeholder, streaming, onSend,
10402
10450
  stopRef.current?.focus();
10403
10451
  }
10404
10452
  }), []);
10405
- useEffect32(() => {
10453
+ useEffect33(() => {
10406
10454
  if (streaming || disabled || !textBoxWantsFocusRef.current) return;
10407
10455
  textBoxWantsFocusRef.current = false;
10408
10456
  const box = textareaRef.current;
@@ -10433,7 +10481,7 @@ var ChatInput = forwardRef(function ChatInput2({ placeholder, streaming, onSend,
10433
10481
  });
10434
10482
 
10435
10483
  // src/components/TabBar.tsx
10436
- import { useEffect as useEffect33, useLayoutEffect, useRef as useRef27 } from "react";
10484
+ import { useEffect as useEffect34, useLayoutEffect, useRef as useRef28 } from "react";
10437
10485
  import { Fragment as Fragment13, jsx as jsx68, jsxs as jsxs63 } from "react/jsx-runtime";
10438
10486
  var FIT_STEPS = [[0, false], [1, false], [1, true], [2, true], [3, true], [4, true], [5, true], [6, true]];
10439
10487
  function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule, hasBuilder = false, gamesEnabled, clubEnabled, favouritesEnabled }) {
@@ -10456,9 +10504,9 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
10456
10504
  ...favouritesEnabled && !clubEnabled ? [{ tab: "favourites", label: ui.tabFavourites, count: 0, dot: false }] : []
10457
10505
  ];
10458
10506
  const track = useTrack();
10459
- const listRef = useRef27(null);
10507
+ const listRef = useRef28(null);
10460
10508
  const activeTab = monitor.activeTab;
10461
- useEffect33(() => {
10509
+ useEffect34(() => {
10462
10510
  const el = listRef.current?.querySelector("[data-on]");
10463
10511
  if (!el || typeof el.scrollIntoView !== "function") return;
10464
10512
  const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
@@ -10581,19 +10629,19 @@ function MarketAccordion({ match, monitor, ui, slip }) {
10581
10629
  }
10582
10630
 
10583
10631
  // src/components/LiveFactBlock.tsx
10584
- import { useRef as useRef29, useState as useState44 } from "react";
10632
+ import { useRef as useRef30, useState as useState45 } from "react";
10585
10633
 
10586
10634
  // src/useFactView.ts
10587
- import { useEffect as useEffect34, useRef as useRef28 } from "react";
10635
+ import { useEffect as useEffect35, useRef as useRef29 } from "react";
10588
10636
  var DWELL_MS = 1e3;
10589
10637
  var seen = /* @__PURE__ */ new Set();
10590
10638
  function useFactView(ref, fact, entity2) {
10591
10639
  const log = useEventLog();
10592
- const entityRef = useRef28(entity2);
10640
+ const entityRef = useRef29(entity2);
10593
10641
  entityRef.current = entity2;
10594
10642
  const id = fact?.id;
10595
10643
  const factKey = fact?.factKey;
10596
- useEffect34(() => {
10644
+ useEffect35(() => {
10597
10645
  if (id === void 0 || factKey === void 0 || seen.has(id) || !log) return;
10598
10646
  const el = ref.current;
10599
10647
  if (!el) return;
@@ -10630,10 +10678,10 @@ function useFactView(ref, fact, entity2) {
10630
10678
  // src/components/LiveFactBlock.tsx
10631
10679
  import { jsx as jsx70, jsxs as jsxs65 } from "react/jsx-runtime";
10632
10680
  function LiveFactBlock({ facts, match, ui, slip, onAsk }) {
10633
- const [expanded, setExpanded] = useState44(false);
10681
+ const [expanded, setExpanded] = useState45(false);
10634
10682
  const { oddsFormat } = useOddsSettings();
10635
10683
  const log = useEventLog();
10636
- const sectionRef = useRef29(null);
10684
+ const sectionRef = useRef30(null);
10637
10685
  const [current, ...earlier] = facts;
10638
10686
  const entity2 = current?.market ? { entityType: "market", entityId: current.market.marketDeveloperName } : { entityType: "match", entityId: String(match.matchId) };
10639
10687
  useFactView(sectionRef, current, entity2);
@@ -10707,7 +10755,7 @@ function LiveFactBlock({ facts, match, ui, slip, onAsk }) {
10707
10755
  }
10708
10756
 
10709
10757
  // src/components/MonitorFormH2H.tsx
10710
- import { useState as useState45 } from "react";
10758
+ import { useState as useState46 } from "react";
10711
10759
  import { Fragment as Fragment14, jsx as jsx71, jsxs as jsxs66 } from "react/jsx-runtime";
10712
10760
  function resultClass2(result) {
10713
10761
  if (result === "W") return "ss-w-h2h-result--win";
@@ -10723,7 +10771,7 @@ function FormDots({ form, ui }) {
10723
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)) });
10724
10772
  }
10725
10773
  function MonitorFormH2H({ formAndH2H, homeTeamName, awayTeamName, ui }) {
10726
- const [expanded, setExpanded] = useState45(false);
10774
+ const [expanded, setExpanded] = useState46(false);
10727
10775
  const { homeForm, awayForm, h2h, homeShortCode, awayShortCode } = formAndH2H;
10728
10776
  if (homeForm.length === 0 && awayForm.length === 0 && !h2h) {
10729
10777
  return /* @__PURE__ */ jsx71(Fragment14, {});
@@ -10956,7 +11004,7 @@ var sportLabel = (ui, sport) => {
10956
11004
  };
10957
11005
 
10958
11006
  // src/components/NbaFormSection.tsx
10959
- import { useState as useState46 } from "react";
11007
+ import { useState as useState47 } from "react";
10960
11008
 
10961
11009
  // src/components/NbaFormRest.tsx
10962
11010
  import { jsx as jsx74, jsxs as jsxs69 } from "react/jsx-runtime";
@@ -11055,8 +11103,8 @@ function Row2({ game, abbr, tonight, ui }) {
11055
11103
  ] });
11056
11104
  }
11057
11105
  function NbaFormSection({ match, monitor, ui }) {
11058
- const [open, setOpen] = useState46(false);
11059
- const [side, setSide] = useState46("away");
11106
+ const [open, setOpen] = useState47(false);
11107
+ const [side, setSide] = useState47("away");
11060
11108
  const form = useNbaForm(match, monitor);
11061
11109
  const b = match.basketball;
11062
11110
  if (!form || !b || !form.home && !form.away) return null;
@@ -11098,10 +11146,10 @@ function NbaFormSection({ match, monitor, ui }) {
11098
11146
  }
11099
11147
 
11100
11148
  // src/components/NbaPropsSection.tsx
11101
- import { useEffect as useEffect36, useState as useState48 } from "react";
11149
+ import { useEffect as useEffect37, useState as useState49 } from "react";
11102
11150
 
11103
11151
  // src/components/PropsPieces.tsx
11104
- import { useEffect as useEffect35, useState as useState47 } from "react";
11152
+ import { useEffect as useEffect36, useState as useState48 } from "react";
11105
11153
  import { Fragment as Fragment15, jsx as jsx76, jsxs as jsxs71 } from "react/jsx-runtime";
11106
11154
  var livePlayer = (bundle, p) => bundle.live === true || !p.live && !p.nflLive ? p : { ...p, live: null, nflLive: null };
11107
11155
  var hasLiveLine = (p) => p.live != null || p.nflLive != null;
@@ -11114,9 +11162,9 @@ function preKickoff(match) {
11114
11162
  return Number.isFinite(kickoff) && Date.now() < kickoff;
11115
11163
  }
11116
11164
  function usePreKickoff(match) {
11117
- const [, setTick] = useState47(0);
11165
+ const [, setTick] = useState48(0);
11118
11166
  const pre = preKickoff(match);
11119
- useEffect35(() => {
11167
+ useEffect36(() => {
11120
11168
  if (!pre || !match.kickoffUtc) return;
11121
11169
  const wait = Math.min(Math.max(Date.parse(match.kickoffUtc) - Date.now(), 0), MAX_TIMER_MS);
11122
11170
  const id = setTimeout(() => setTick((t) => t + 1), wait);
@@ -11130,7 +11178,7 @@ function usePropsOpen(match, monitor, descriptor) {
11130
11178
  const pre = descriptor.sport === "basketball" ? match.phase === "preMatch" : beforeKickoff;
11131
11179
  const live = match.phase === "live";
11132
11180
  const open = pre || live;
11133
- useEffect35(() => {
11181
+ useEffect36(() => {
11134
11182
  if (!open) return;
11135
11183
  if (sport) monitor.loadPlayerProps?.(match.matchId, sport);
11136
11184
  else monitor.loadPlayerProps?.(match.matchId);
@@ -11208,7 +11256,7 @@ function PropBars({ bars, line, title, wide, ui, note }) {
11208
11256
  function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
11209
11257
  const player = livePlayer(bundle, given);
11210
11258
  const stats = descriptor.stats.map((k) => player.stats.find((s) => s.stat === k)).filter((s) => s != null);
11211
- const [picked, setPicked] = useState47(null);
11259
+ const [picked, setPicked] = useState48(null);
11212
11260
  const active = stats.find((s) => s.stat === picked) ?? stats[0];
11213
11261
  const sample = active?.games?.length ?? 0;
11214
11262
  const hitsOf = (price, text2) => descriptor.showHits && sample > 0 && price.hits != null ? text2(price.hits) : null;
@@ -11257,7 +11305,7 @@ function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
11257
11305
  ] });
11258
11306
  }
11259
11307
  function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
11260
- const [openId, setOpenId] = useState47(null);
11308
+ const [openId, setOpenId] = useState48(null);
11261
11309
  return /* @__PURE__ */ jsx76("div", { className: "ss-w-props-list", children: players.map((given) => {
11262
11310
  const p = livePlayer(bundle, given);
11263
11311
  const isOpen = openId === p.playerId;
@@ -11294,12 +11342,12 @@ function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
11294
11342
  }
11295
11343
  var BOX_QUIET_MS = 12e4;
11296
11344
  function StatsClock({ boxAsOfUtc, match, live, atBreak: atBreak2, ago, ui }) {
11297
- const [tick, setTick] = useState47(0);
11345
+ const [tick, setTick] = useState48(0);
11298
11346
  const time = clock2(boxAsOfUtc, ui);
11299
11347
  const at2 = time === "" ? Number.NaN : Date.parse(boxAsOfUtc);
11300
11348
  const valid = !Number.isNaN(at2);
11301
11349
  const onBreak = atBreak(match);
11302
- useEffect35(() => {
11350
+ useEffect36(() => {
11303
11351
  if (!valid || onBreak) return;
11304
11352
  const age2 = Date.now() - at2;
11305
11353
  const wait = age2 < BOX_QUIET_MS ? BOX_QUIET_MS - age2 : 6e4 - age2 % 6e4;
@@ -11360,12 +11408,12 @@ var nbaDescriptor = (ui, match) => ({
11360
11408
  tenGameBars: false
11361
11409
  });
11362
11410
  function StatsClock2({ bundle, match, ui }) {
11363
- const [tick, setTick] = useState48(0);
11411
+ const [tick, setTick] = useState49(0);
11364
11412
  const at2 = bundle.live === true && bundle.boxAsOfUtc ? Date.parse(bundle.boxAsOfUtc) : Number.NaN;
11365
11413
  const time = clock2(bundle.boxAsOfUtc, ui);
11366
11414
  const valid = !Number.isNaN(at2) && time !== "";
11367
11415
  const onBreak = atBreak(match);
11368
- useEffect36(() => {
11416
+ useEffect37(() => {
11369
11417
  if (!valid || onBreak) return;
11370
11418
  const age2 = Date.now() - at2;
11371
11419
  const wait = age2 < BOX_QUIET_MS2 ? BOX_QUIET_MS2 - age2 : 6e4 - age2 % 6e4;
@@ -11379,7 +11427,7 @@ function StatsClock2({ bundle, match, ui }) {
11379
11427
  return /* @__PURE__ */ jsx77("span", { className: "ss-w-props-asof ss-w-props-asof--live", children: ui.nba.propsStatsLive(time) });
11380
11428
  }
11381
11429
  function NbaPropsSection({ match, monitor, ui, slip }) {
11382
- const [side, setSide] = useState48("home");
11430
+ const [side, setSide] = useState49("home");
11383
11431
  const descriptor = nbaDescriptor(ui, match);
11384
11432
  const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
11385
11433
  if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
@@ -11528,7 +11576,7 @@ function NbaMonitorCard({ match, monitor, ui, slip }) {
11528
11576
  }
11529
11577
 
11530
11578
  // src/components/NflFormSection.tsx
11531
- import { useState as useState49 } from "react";
11579
+ import { useState as useState50 } from "react";
11532
11580
  import { Fragment as Fragment17, jsx as jsx79, jsxs as jsxs74 } from "react/jsx-runtime";
11533
11581
  var outcomeOf = (g) => g.teamScore > g.opponentScore ? "win" : g.teamScore < g.opponentScore ? "loss" : "tie";
11534
11582
  var signedSpread2 = (v) => v > 0 ? `+${v}` : String(v);
@@ -11580,7 +11628,7 @@ function H2hRow({ game, home, ui }) {
11580
11628
  ] });
11581
11629
  }
11582
11630
  function NflFormSection({ match, monitor, ui }) {
11583
- const [segment, setSegment] = useState49("away");
11631
+ const [segment, setSegment] = useState50("away");
11584
11632
  const { live, open } = usePropsOpen(match, monitor, { sport: "americanfootball" });
11585
11633
  const bundle = monitor.playerProps?.[monitorMatchKey("americanfootball", match.matchId)]?.bundle;
11586
11634
  const form = bundle?.form;
@@ -11613,7 +11661,7 @@ function NflFormSection({ match, monitor, ui }) {
11613
11661
  }
11614
11662
 
11615
11663
  // src/components/NflPropsSection.tsx
11616
- import { useState as useState50 } from "react";
11664
+ import { useState as useState51 } from "react";
11617
11665
  import { Fragment as Fragment18, jsx as jsx80, jsxs as jsxs75 } from "react/jsx-runtime";
11618
11666
  var TRENDS_SHOWN = 3;
11619
11667
  var SCORERS_SHOWN = 8;
@@ -11686,7 +11734,7 @@ function ShowMore({ label, onClick }) {
11686
11734
  return /* @__PURE__ */ jsx80("button", { type: "button", className: "ss-w-props-more", onClick, children: label });
11687
11735
  }
11688
11736
  function Trends({ bundle, facts, descriptor, ui, slip }) {
11689
- const [all, setAll] = useState50(false);
11737
+ const [all, setAll] = useState51(false);
11690
11738
  const shown2 = all ? facts : facts.slice(0, TRENDS_SHOWN);
11691
11739
  return /* @__PURE__ */ jsxs75("section", { className: "ss-w-props ss-w-props-trends", lang: ui.locale, children: [
11692
11740
  /* @__PURE__ */ jsx80("div", { className: "ss-w-props-head", children: ui.nfl.propsTrends }),
@@ -11719,7 +11767,7 @@ function Trends({ bundle, facts, descriptor, ui, slip }) {
11719
11767
  ] });
11720
11768
  }
11721
11769
  function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
11722
- const [all, setAll] = useState50(false);
11770
+ const [all, setAll] = useState51(false);
11723
11771
  const shown2 = all ? scorers : scorers.slice(0, SCORERS_SHOWN);
11724
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" });
11725
11773
  return /* @__PURE__ */ jsxs75("div", { className: "ss-w-props-scorers", children: [
@@ -11746,7 +11794,7 @@ function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
11746
11794
  ] });
11747
11795
  }
11748
11796
  function NflPropsSection({ match, monitor, ui, slip }) {
11749
- const [tab, setTab] = useState50(null);
11797
+ const [tab, setTab] = useState51(null);
11750
11798
  const descriptor = nflDescriptor(ui);
11751
11799
  const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
11752
11800
  if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
@@ -11932,7 +11980,7 @@ function NflMonitorCard({ match, monitor, ui, slip }) {
11932
11980
  }
11933
11981
 
11934
11982
  // src/components/TennisMonitorCard.tsx
11935
- import { useRef as useRef30 } from "react";
11983
+ import { useRef as useRef31 } from "react";
11936
11984
  import { toWireSport as toWireSport5 } from "@sensiblestats/widget-sdk";
11937
11985
 
11938
11986
  // src/components/TennisFixtureRow.tsx
@@ -12193,7 +12241,7 @@ function TennisLiveScoreboard({ t, score, live, ui }) {
12193
12241
  }
12194
12242
 
12195
12243
  // src/components/TennisStatsTables.tsx
12196
- import { Fragment as Fragment22, useEffect as useEffect37, useState as useState51 } from "react";
12244
+ import { Fragment as Fragment22, useEffect as useEffect38, useState as useState52 } from "react";
12197
12245
  import { Fragment as Fragment23, jsx as jsx87, jsxs as jsxs82 } from "react/jsx-runtime";
12198
12246
  function formatStat(row, value, locale) {
12199
12247
  if (value == null) return "\u2013";
@@ -12231,8 +12279,8 @@ function Tables({ table, labels, names, locale }) {
12231
12279
  ] });
12232
12280
  }
12233
12281
  function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey }) {
12234
- const [tab, setTab] = useState51("match");
12235
- useEffect37(() => {
12282
+ const [tab, setTab] = useState52("match");
12283
+ useEffect38(() => {
12236
12284
  setTab("match");
12237
12285
  }, [resetKey]);
12238
12286
  const sets = serveReturn.sets.filter((s) => s.table.serve.length + s.table.return.length > 0);
@@ -12398,7 +12446,7 @@ function HeadToHead({ t, ui }) {
12398
12446
  ] });
12399
12447
  }
12400
12448
  function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
12401
- const lastTables = useRef30(null);
12449
+ const lastTables = useRef31(null);
12402
12450
  const t = match.tennis;
12403
12451
  if (!t) return /* @__PURE__ */ jsx88(UnavailableCard, { match, monitor, ui, sport: "tennis" });
12404
12452
  const preMatch = match.phase === "preMatch";
@@ -12478,7 +12526,7 @@ function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
12478
12526
  }
12479
12527
 
12480
12528
  // src/components/ScoreboardStrip.tsx
12481
- import { useEffect as useEffect38, useRef as useRef31 } from "react";
12529
+ import { useEffect as useEffect39, useRef as useRef32 } from "react";
12482
12530
  import { sportOf as sportOf11 } from "@sensiblestats/widget-sdk";
12483
12531
  import { jsx as jsx89, jsxs as jsxs84 } from "react/jsx-runtime";
12484
12532
  function nbaStatus(m, ui) {
@@ -12573,8 +12621,8 @@ function rowsFor(m) {
12573
12621
  ];
12574
12622
  }
12575
12623
  function useStripScroll(selectedKey) {
12576
- const stripRef = useRef31(null);
12577
- useEffect38(() => {
12624
+ const stripRef = useRef32(null);
12625
+ useEffect39(() => {
12578
12626
  const strip = stripRef.current;
12579
12627
  const pressed = strip?.querySelector('[aria-pressed="true"]');
12580
12628
  if (!strip || !pressed) return;
@@ -12820,7 +12868,7 @@ function TrendsPanel({ monitor, ui, slip }) {
12820
12868
  }
12821
12869
 
12822
12870
  // src/components/LivePanel.tsx
12823
- import { useMemo as useMemo10, useState as useState53 } from "react";
12871
+ import { useMemo as useMemo10, useState as useState54 } from "react";
12824
12872
  import { matchKey as matchKey8 } from "@sensiblestats/widget-sdk";
12825
12873
 
12826
12874
  // src/scheduleView.ts
@@ -12995,20 +13043,20 @@ function LeagueGroup({ view, open, onToggle, disambiguate, rowCap, onShowAll, on
12995
13043
  }
12996
13044
 
12997
13045
  // src/components/MatchSheet.tsx
12998
- import { useId as useId2, useState as useState52 } from "react";
13046
+ import { useId as useId2, useState as useState53 } from "react";
12999
13047
  import { localIdOf as localIdOf4, qualifiedId as qualifiedId2, slipSportOf as slipSportOf9, toWireSport as toWireSport6 } from "@sensiblestats/widget-sdk";
13000
13048
 
13001
13049
  // src/useModalDialog.ts
13002
- import { useEffect as useEffect39, useRef as useRef32 } from "react";
13050
+ import { useEffect as useEffect40, useRef as useRef33 } from "react";
13003
13051
  var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
13004
13052
  function useModalDialog(onClose, opts = {}) {
13005
- const dialogRef = useRef32(null);
13006
- const onCloseRef = useRef32(onClose);
13053
+ const dialogRef = useRef33(null);
13054
+ const onCloseRef = useRef33(onClose);
13007
13055
  onCloseRef.current = onClose;
13008
- const openerRef = useRef32(opts.opener);
13056
+ const openerRef = useRef33(opts.opener);
13009
13057
  openerRef.current = opts.opener;
13010
13058
  const restore = opts.restoreFocus ?? true;
13011
- useEffect39(() => {
13059
+ useEffect40(() => {
13012
13060
  const dialog = dialogRef.current;
13013
13061
  const root = dialog?.getRootNode();
13014
13062
  const focusedAtMount = root?.activeElement ?? null;
@@ -13019,7 +13067,7 @@ function useModalDialog(onClose, opts = {}) {
13019
13067
  if (target instanceof HTMLElement) target.focus({ preventScroll: true });
13020
13068
  };
13021
13069
  }, []);
13022
- useEffect39(() => {
13070
+ useEffect40(() => {
13023
13071
  const onKey = (e) => {
13024
13072
  if (e.key !== "Escape") return;
13025
13073
  e.stopPropagation();
@@ -13061,7 +13109,7 @@ function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose,
13061
13109
  const { dialogRef, onKeyDown } = useModalDialog(onClose, { opener });
13062
13110
  const log = useEventLog();
13063
13111
  const titleId = useId2();
13064
- const [limitHit, setLimitHit] = useState52(false);
13112
+ const [limitHit, setLimitHit] = useState53(false);
13065
13113
  const pinSport = slipSportOf9(match.sport);
13066
13114
  const tour = pinSport === "tennis" && isKnownTour(match.tour) ? match.tour : void 0;
13067
13115
  const followable = pinSport !== "tennis" || tour !== void 0;
@@ -13162,9 +13210,9 @@ var OPEN_TOP_GROUPS = 2;
13162
13210
  var QUIET_ROWS = 4;
13163
13211
  function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, onLeague, onSeeAll, onAsk }) {
13164
13212
  const { groups, states, stale } = discovery;
13165
- const [mine, setMine] = useState53(false);
13166
- const [toggled, setToggled] = useState53(/* @__PURE__ */ new Map());
13167
- 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);
13168
13216
  const pinnedKeys = useMemo10(
13169
13217
  () => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => matchKey8(p.sport, p.matchId, p.tour))),
13170
13218
  [monitor.pins]
@@ -13271,20 +13319,20 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
13271
13319
  }
13272
13320
 
13273
13321
  // src/components/ScheduleMatchesPanel.tsx
13274
- import { useEffect as useEffect42, useId as useId3, useMemo as useMemo11, useRef as useRef36, useState as useState55 } from "react";
13322
+ import { useEffect as useEffect43, useId as useId3, useMemo as useMemo11, useRef as useRef37, useState as useState56 } from "react";
13275
13323
  import { matchKey as matchKey10 } from "@sensiblestats/widget-sdk";
13276
13324
 
13277
13325
  // src/useTennisRowPrices.ts
13278
- import { useEffect as useEffect40, useRef as useRef33, useState as useState54 } from "react";
13326
+ import { useEffect as useEffect41, useRef as useRef34, useState as useState55 } from "react";
13279
13327
  import { matchKey as matchKey9 } from "@sensiblestats/widget-sdk";
13280
13328
  var TENNIS_PRICE_POLL_MS = 6e4;
13281
13329
  function useTennisRowPrices(a) {
13282
- const [state, setState] = useState54({ byId: null, stale: false });
13283
- const getPricesRef = useRef33(a.getPrices);
13330
+ const [state, setState] = useState55({ byId: null, stale: false });
13331
+ const getPricesRef = useRef34(a.getPrices);
13284
13332
  getPricesRef.current = a.getPrices;
13285
- const latest = useRef33(0);
13333
+ const latest = useRef34(0);
13286
13334
  const idsKey = a.keys.filter((k) => isKnownTour(k.tour)).slice(0, MAX_TENNIS_KEYS).map((k) => `${k.tour}:${k.matchId}`).sort().join(",");
13287
- useEffect40(() => {
13335
+ useEffect41(() => {
13288
13336
  if (!a.enabled || idsKey === "") {
13289
13337
  latest.current++;
13290
13338
  setState((prev) => prev.byId === null && !prev.stale ? prev : { byId: null, stale: false });
@@ -13322,11 +13370,11 @@ function useTennisRowPrices(a) {
13322
13370
  }
13323
13371
 
13324
13372
  // src/components/DayStrip.tsx
13325
- import { useEffect as useEffect41, useRef as useRef34 } from "react";
13373
+ import { useEffect as useEffect42, useRef as useRef35 } from "react";
13326
13374
  import { jsx as jsx98, jsxs as jsxs92 } from "react/jsx-runtime";
13327
13375
  function DayStrip({ chips, selected, onSelect, ui, locale }) {
13328
- const listRef = useRef34(null);
13329
- useEffect41(() => {
13376
+ const listRef = useRef35(null);
13377
+ useEffect42(() => {
13330
13378
  const el = listRef.current?.querySelector('[aria-pressed="true"]');
13331
13379
  if (!el || typeof el.scrollIntoView !== "function") return;
13332
13380
  const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
@@ -13355,7 +13403,7 @@ function DayStrip({ chips, selected, onSelect, ui, locale }) {
13355
13403
  }
13356
13404
 
13357
13405
  // src/components/games/ui/SearchField.tsx
13358
- import { useCallback as useCallback24, useRef as useRef35 } from "react";
13406
+ import { useCallback as useCallback25, useRef as useRef36 } from "react";
13359
13407
 
13360
13408
  // src/components/games/ui/icons.tsx
13361
13409
  import { jsx as jsx99 } from "react/jsx-runtime";
@@ -13394,8 +13442,8 @@ var IconFlame = ({ size = 16 }) => svg(size, /* @__PURE__ */ jsx99("path", { d:
13394
13442
  // src/components/games/ui/SearchField.tsx
13395
13443
  import { jsx as jsx100, jsxs as jsxs93 } from "react/jsx-runtime";
13396
13444
  function SearchField({ id, label, labelHidden = false, placeholder, value, onChange, disabled, inputRef, onKeyDown, clearLabel }) {
13397
- const localRef = useRef35(null);
13398
- const setInputRef = useCallback24((node) => {
13445
+ const localRef = useRef36(null);
13446
+ const setInputRef = useCallback25((node) => {
13399
13447
  localRef.current = node;
13400
13448
  if (typeof inputRef === "function") inputRef(node);
13401
13449
  else if (inputRef) inputRef.current = node;
@@ -13442,13 +13490,13 @@ var SKELETON_ROWS = 3;
13442
13490
  function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport, day, onDay, loaded, onOpenLive, onAsk, locale, getTennisPrices, slip }) {
13443
13491
  const { localDate: today, states, stale } = discovery;
13444
13492
  const searchId = useId3();
13445
- const [query, setQuery] = useState55("");
13446
- const [toggled, setToggled] = useState55(/* @__PURE__ */ new Map());
13447
- const [expanded, setExpanded] = useState55(/* @__PURE__ */ new Set());
13448
- const listRef = useRef36(null);
13449
- 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);
13450
13498
  const { chips, selected } = loaded;
13451
- useEffect42(() => {
13499
+ useEffect43(() => {
13452
13500
  if (selected !== day) onDay(selected);
13453
13501
  }, [day, selected, onDay]);
13454
13502
  const isToday = selected === today;
@@ -13590,7 +13638,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
13590
13638
  }
13591
13639
 
13592
13640
  // src/components/GamesPanel.tsx
13593
- import { useEffect as useEffect46, useState as useState70 } from "react";
13641
+ import { useEffect as useEffect47, useState as useState71 } from "react";
13594
13642
 
13595
13643
  // src/components/GamesLoginWall.tsx
13596
13644
  import { jsx as jsx102 } from "react/jsx-runtime";
@@ -13599,7 +13647,7 @@ function GamesLoginWall({ ui }) {
13599
13647
  }
13600
13648
 
13601
13649
  // src/components/GamesHub.tsx
13602
- import { useEffect as useEffect43, useState as useState56 } from "react";
13650
+ import { useEffect as useEffect44, useState as useState57 } from "react";
13603
13651
 
13604
13652
  // src/components/games/ui/gameMeta.ts
13605
13653
  function prettifyGameId(gameId) {
@@ -13750,8 +13798,8 @@ function pickHeroGame(games) {
13750
13798
  }
13751
13799
  var tileKey = (g) => `${g.gameId}-${g.gameDay}-${g.fixtureId}`;
13752
13800
  function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
13753
- const [, setTick] = useState56(0);
13754
- useEffect43(() => {
13801
+ const [, setTick] = useState57(0);
13802
+ useEffect44(() => {
13755
13803
  const id = setInterval(() => setTick((t) => t + 1), 6e4);
13756
13804
  return () => clearInterval(id);
13757
13805
  }, []);
@@ -13811,10 +13859,10 @@ function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
13811
13859
  }
13812
13860
 
13813
13861
  // src/components/GameScreenHost.tsx
13814
- import { useEffect as useEffect45, useRef as useRef39, useState as useState68 } from "react";
13862
+ import { useEffect as useEffect46, useRef as useRef40, useState as useState69 } from "react";
13815
13863
 
13816
13864
  // src/useGamePlay.ts
13817
- import { useCallback as useCallback25, useRef as useRef37, useState as useState57 } from "react";
13865
+ import { useCallback as useCallback26, useRef as useRef38, useState as useState58 } from "react";
13818
13866
  function toSubmitResult(payload) {
13819
13867
  return {
13820
13868
  // 'pending' means the play is recorded but awaiting resolution (fixture games)
@@ -13826,17 +13874,17 @@ function toSubmitResult(payload) {
13826
13874
  };
13827
13875
  }
13828
13876
  function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh }) {
13829
- const [result, setResult] = useState57(null);
13830
- const [submitting, setSubmitting] = useState57(false);
13831
- const [rawStatus, setRawStatus] = useState57(null);
13832
- const inFlightRef = useRef37(false);
13833
- const convRef = useRef37(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);
13834
13882
  convRef.current = conversation;
13835
- const optsRef = useRef37({ gameId, gameDay, fixtureId, locale, refresh });
13883
+ const optsRef = useRef38({ gameId, gameDay, fixtureId, locale, refresh });
13836
13884
  optsRef.current = { gameId, gameDay, fixtureId, locale, refresh };
13837
- const resultRef = useRef37(null);
13885
+ const resultRef = useRef38(null);
13838
13886
  resultRef.current = result;
13839
- const refetch = useCallback25(async () => {
13887
+ const refetch = useCallback26(async () => {
13840
13888
  const conv = convRef.current;
13841
13889
  if (!conv) return;
13842
13890
  const opts = optsRef.current;
@@ -13852,7 +13900,7 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
13852
13900
  } catch {
13853
13901
  }
13854
13902
  }, []);
13855
- const submit = useCallback25(async (answerJson) => {
13903
+ const submit = useCallback26(async (answerJson) => {
13856
13904
  const conv = convRef.current;
13857
13905
  if (!conv || inFlightRef.current) return;
13858
13906
  inFlightRef.current = true;
@@ -13879,14 +13927,14 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
13879
13927
  setSubmitting(false);
13880
13928
  }
13881
13929
  }, [refetch]);
13882
- const hydrate = useCallback25(() => {
13930
+ const hydrate = useCallback26(() => {
13883
13931
  void refetch();
13884
13932
  }, [refetch]);
13885
13933
  return { result, submitting, submit, hydrate, rawStatus };
13886
13934
  }
13887
13935
 
13888
13936
  // src/components/games/MysteryTigerGame.tsx
13889
- import { useState as useState59, useId as useId4 } from "react";
13937
+ import { useState as useState60, useId as useId4 } from "react";
13890
13938
 
13891
13939
  // src/components/games/nationFlags.ts
13892
13940
  var FLAGS = {
@@ -14097,7 +14145,7 @@ function isNationCode(flag) {
14097
14145
  }
14098
14146
 
14099
14147
  // src/components/games/PlayerAvatar.tsx
14100
- import { useState as useState58 } from "react";
14148
+ import { useState as useState59 } from "react";
14101
14149
  import { jsx as jsx107 } from "react/jsx-runtime";
14102
14150
  function initialsOf(name) {
14103
14151
  const parts2 = name.trim().split(/\s+/).filter(Boolean);
@@ -14115,7 +14163,7 @@ function PlayerAvatar({
14115
14163
  imagePath,
14116
14164
  className
14117
14165
  }) {
14118
- const [failed, setFailed] = useState58(false);
14166
+ const [failed, setFailed] = useState59(false);
14119
14167
  const showImage = Boolean(imagePath) && !isPlaceholderImage(imagePath) && !failed;
14120
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) }) });
14121
14169
  }
@@ -14359,7 +14407,7 @@ function MysteryTigerGame({
14359
14407
  onBack
14360
14408
  }) {
14361
14409
  const t = ui.games.mysteryTiger;
14362
- const [query, setQuery] = useState59("");
14410
+ const [query, setQuery] = useState60("");
14363
14411
  const inputId = useId4();
14364
14412
  const clientState = parseClientState(result?.clientStateJson);
14365
14413
  const guessResults = clientState?.guessResults ?? [];
@@ -14621,13 +14669,13 @@ function HigherOrLowerGame({
14621
14669
  }
14622
14670
 
14623
14671
  // src/components/games/CareerPathGame.tsx
14624
- import { useState as useState61, useId as useId5 } from "react";
14672
+ import { useState as useState62, useId as useId5 } from "react";
14625
14673
 
14626
14674
  // src/components/games/ui/CrestShield.tsx
14627
- import { useState as useState60 } from "react";
14675
+ import { useState as useState61 } from "react";
14628
14676
  import { jsx as jsx118 } from "react/jsx-runtime";
14629
14677
  function CrestShield({ src, name, size = 28 }) {
14630
- const [failed, setFailed] = useState60(false);
14678
+ const [failed, setFailed] = useState61(false);
14631
14679
  if (src && !isPlaceholderImage(src) && !failed) {
14632
14680
  return /* @__PURE__ */ jsx118("img", { className: "ss-g-crest", src, alt: name, width: size, height: size, loading: "lazy", onError: () => setFailed(true) });
14633
14681
  }
@@ -14659,7 +14707,7 @@ function CareerPathGame({
14659
14707
  }) {
14660
14708
  const s = ui.games.careerPath;
14661
14709
  const title = gameTitle({ gameId: "career-path" }, ui.games.titles);
14662
- const [query, setQuery] = useState61("");
14710
+ const [query, setQuery] = useState62("");
14663
14711
  const inputId = useId5();
14664
14712
  const clientState = parseClientState3(result?.clientStateJson);
14665
14713
  const alreadyGuessedIds = new Set(clientState?.guessResults.map((g) => g.playerId) ?? []);
@@ -14766,7 +14814,7 @@ function CareerPathGame({
14766
14814
  }
14767
14815
 
14768
14816
  // src/components/games/BeatTheGridGame.tsx
14769
- import React, { useEffect as useEffect44, useId as useId6, useRef as useRef38, useState as useState62 } from "react";
14817
+ import React, { useEffect as useEffect45, useId as useId6, useRef as useRef39, useState as useState63 } from "react";
14770
14818
 
14771
14819
  // src/components/games/ui/OptionList.tsx
14772
14820
  import { jsx as jsx120 } from "react/jsx-runtime";
@@ -14855,10 +14903,10 @@ function SearchSheet({
14855
14903
  ui
14856
14904
  }) {
14857
14905
  const s = ui.games.beatTheGrid;
14858
- const [query, setQuery] = useState62("");
14906
+ const [query, setQuery] = useState63("");
14859
14907
  const inputId = useId6();
14860
- const inputRef = useRef38(null);
14861
- useEffect44(() => {
14908
+ const inputRef = useRef39(null);
14909
+ useEffect45(() => {
14862
14910
  inputRef.current?.focus();
14863
14911
  }, [row, col]);
14864
14912
  const filtered = playerPool.filter(
@@ -14923,7 +14971,7 @@ function BeatTheGridGame({
14923
14971
  }) {
14924
14972
  const s = ui.games.beatTheGrid;
14925
14973
  const title = gameTitle({ gameId: "beat-the-grid" }, ui.games.titles);
14926
- const [activeCell, setActiveCell] = useState62(null);
14974
+ const [activeCell, setActiveCell] = useState63(null);
14927
14975
  const clientState = parseClientState4(result?.clientStateJson);
14928
14976
  const filledCells = clientState?.cells ?? [];
14929
14977
  const isLocked2 = result?.alreadyPlayed === true || clientState?.isComplete === true;
@@ -15078,7 +15126,7 @@ function BeatTheGridGame({
15078
15126
  }
15079
15127
 
15080
15128
  // src/components/games/GuessTheXiGame.tsx
15081
- import { useState as useState63, useId as useId7 } from "react";
15129
+ import { useState as useState64, useId as useId7 } from "react";
15082
15130
 
15083
15131
  // src/components/games/ui/PitchSvg.tsx
15084
15132
  import { Fragment as Fragment36, jsx as jsx122, jsxs as jsxs109 } from "react/jsx-runtime";
@@ -15167,7 +15215,7 @@ function GuessTheXiGame({
15167
15215
  onBack
15168
15216
  }) {
15169
15217
  const t = ui.games.guessTheXi;
15170
- const [query, setQuery] = useState63("");
15218
+ const [query, setQuery] = useState64("");
15171
15219
  const inputId = useId7();
15172
15220
  const clientState = parseClientState5(result?.clientStateJson);
15173
15221
  const isOver = result?.alreadyPlayed === true || clientState?.status === "solved" || clientState?.status === "failed";
@@ -15310,7 +15358,7 @@ function GuessTheXiGame({
15310
15358
  }
15311
15359
 
15312
15360
  // src/components/games/DailyQuizGame.tsx
15313
- import { useState as useState64 } from "react";
15361
+ import { useState as useState65 } from "react";
15314
15362
  import { Fragment as Fragment38, jsx as jsx124, jsxs as jsxs111 } from "react/jsx-runtime";
15315
15363
  function parseClientState6(json) {
15316
15364
  if (!json) return null;
@@ -15351,8 +15399,8 @@ function DailyQuizGame({
15351
15399
  }) {
15352
15400
  const s = ui.games.dailyQuiz;
15353
15401
  const title = gameTitle({ gameId: "daily-quiz" }, ui.games.titles);
15354
- const [selections, setSelections] = useState64(/* @__PURE__ */ new Map());
15355
- const [page, setPage] = useState64(0);
15402
+ const [selections, setSelections] = useState65(/* @__PURE__ */ new Map());
15403
+ const [page, setPage] = useState65(0);
15356
15404
  const clientState = parseClientState6(result?.clientStateJson);
15357
15405
  const results2 = clientState?.results ?? [];
15358
15406
  const isRevealed = results2.length > 0 || result?.alreadyPlayed === true;
@@ -15462,7 +15510,7 @@ function DailyQuizGame({
15462
15510
  }
15463
15511
 
15464
15512
  // src/components/games/MatchdayPredictorGame.tsx
15465
- import { useId as useId8, useState as useState65 } from "react";
15513
+ import { useId as useId8, useState as useState66 } from "react";
15466
15514
  import { jsx as jsx125, jsxs as jsxs112 } from "react/jsx-runtime";
15467
15515
  var SCORER_SEARCH_THRESHOLD = 9;
15468
15516
  function parseClientState7(json) {
@@ -15558,11 +15606,11 @@ function MatchdayPredictorGame({
15558
15606
  onBack
15559
15607
  }) {
15560
15608
  const t = ui.games.predictor;
15561
- const [homeScore, setHomeScore] = useState65(0);
15562
- const [awayScore, setAwayScore] = useState65(0);
15563
- const [firstScorerPlayerId, setFirstScorerPlayerId] = useState65(null);
15564
- const [lastEdited, setLastEdited] = useState65("home");
15565
- 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("");
15566
15614
  const searchId = useId8();
15567
15615
  const clientState = parseClientState7(result?.clientStateJson);
15568
15616
  const alreadyPlayed = result?.alreadyPlayed === true;
@@ -15730,7 +15778,7 @@ function MatchdayPredictorGame({
15730
15778
  }
15731
15779
 
15732
15780
  // src/components/games/StartingXiGame.tsx
15733
- import { useId as useId9, useState as useState66 } from "react";
15781
+ import { useId as useId9, useState as useState67 } from "react";
15734
15782
  import { Fragment as Fragment39, jsx as jsx126, jsxs as jsxs113 } from "react/jsx-runtime";
15735
15783
  var POINTS_PER_STARTER = 8;
15736
15784
  var XI_SIZE = 11;
@@ -15774,9 +15822,9 @@ function StartingXiGame({
15774
15822
  lockAtUtc
15775
15823
  }) {
15776
15824
  const t = ui.games.startingXi;
15777
- const [slotPlayers, setSlotPlayers] = useState66(() => Array(XI_SIZE).fill(null));
15778
- const [active, setActive] = useState66(0);
15779
- 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("");
15780
15828
  const searchId = useId9();
15781
15829
  const clientState = parseClientState8(result?.clientStateJson);
15782
15830
  const alreadyPlayed = result?.alreadyPlayed === true;
@@ -15916,7 +15964,7 @@ function StartingXiGame({
15916
15964
  }
15917
15965
 
15918
15966
  // src/components/games/StatLadderGame.tsx
15919
- import { useId as useId10, useState as useState67 } from "react";
15967
+ import { useId as useId10, useState as useState68 } from "react";
15920
15968
  import { jsx as jsx127, jsxs as jsxs114 } from "react/jsx-runtime";
15921
15969
  function ladderClue(ladder) {
15922
15970
  const mystery = ladder.find((r) => r.rank === 2);
@@ -15953,8 +16001,8 @@ function StatLadderGame({
15953
16001
  onBack
15954
16002
  }) {
15955
16003
  const t = ui.games.statLadder;
15956
- const [query, setQuery] = useState67("");
15957
- const [selectedId, setSelectedId] = useState67(null);
16004
+ const [query, setQuery] = useState68("");
16005
+ const [selectedId, setSelectedId] = useState68(null);
15958
16006
  const searchId = useId10();
15959
16007
  const clientState = parseClientState9(result?.clientStateJson);
15960
16008
  const revealed = clientState != null;
@@ -16161,8 +16209,8 @@ function GameScreenHost({
16161
16209
  ui
16162
16210
  }) {
16163
16211
  const { gameId, fixtureId, gameDay = "", lockAtUtc = null } = selected;
16164
- const [configJson, setConfigJson] = useState68(null);
16165
- useEffect45(() => {
16212
+ const [configJson, setConfigJson] = useState69(null);
16213
+ useEffect46(() => {
16166
16214
  setConfigJson(null);
16167
16215
  if (!conversation) return;
16168
16216
  let cancelled = false;
@@ -16185,12 +16233,12 @@ function GameScreenHost({
16185
16233
  fixtureId: fixtureId || void 0,
16186
16234
  locale: ui.hostTag
16187
16235
  });
16188
- useEffect45(() => {
16236
+ useEffect46(() => {
16189
16237
  if (conversation) hydrate();
16190
16238
  }, [conversation, gameId]);
16191
- const hydrateRef = useRef39(hydrate);
16239
+ const hydrateRef = useRef40(hydrate);
16192
16240
  hydrateRef.current = hydrate;
16193
- useEffect45(() => {
16241
+ useEffect46(() => {
16194
16242
  if (!FIXTURE_GAME_IDS.has(gameId)) return;
16195
16243
  if (rawStatus !== "pending") return;
16196
16244
  const timerId = setInterval(() => {
@@ -16303,7 +16351,7 @@ function GameScreenHost({
16303
16351
  }
16304
16352
 
16305
16353
  // src/components/Leaderboard.tsx
16306
- import { useState as useState69 } from "react";
16354
+ import { useState as useState70 } from "react";
16307
16355
 
16308
16356
  // src/components/LeaderboardRow.tsx
16309
16357
  import { jsx as jsx130, jsxs as jsxs116 } from "react/jsx-runtime";
@@ -16390,7 +16438,7 @@ function Leaderboard({
16390
16438
  ui,
16391
16439
  onPlay
16392
16440
  }) {
16393
- const [segment, setSegment] = useState69("weekly");
16441
+ const [segment, setSegment] = useState70("weekly");
16394
16442
  const myRow = segment === "weekly" ? data.myWeeklyRow : data.myAllTimeRow;
16395
16443
  const offBoard = myRow !== null && myRow !== void 0 && myRow.rank === -1;
16396
16444
  const isEmpty = segment === "weekly" ? data.weeklyTop.length === 0 : data.allTimeTop.length === 0;
@@ -16495,9 +16543,9 @@ function GamesPanel({
16495
16543
  leaderboardLoading,
16496
16544
  refreshHub
16497
16545
  }) {
16498
- const [selected, setSelected] = useState70(null);
16499
- const [segment, setSegment] = useState70("play");
16500
- useEffect46(() => {
16546
+ const [selected, setSelected] = useState71(null);
16547
+ const [segment, setSegment] = useState71("play");
16548
+ useEffect47(() => {
16501
16549
  ensureGamesFonts();
16502
16550
  }, []);
16503
16551
  if (!loggedIn) return /* @__PURE__ */ jsx134(GamesLoginWall, { ui });
@@ -16561,10 +16609,10 @@ function GamesPanel({
16561
16609
  }
16562
16610
 
16563
16611
  // src/components/FavouritesPanel.tsx
16564
- import { useEffect as useEffect49, useRef as useRef41, useState as useState73 } from "react";
16612
+ import { useEffect as useEffect50, useRef as useRef42, useState as useState74 } from "react";
16565
16613
 
16566
16614
  // src/components/FavouriteChips.tsx
16567
- import { useEffect as useEffect47, useState as useState71 } from "react";
16615
+ import { useEffect as useEffect48, useState as useState72 } from "react";
16568
16616
  import { Fragment as Fragment41, jsx as jsx135, jsxs as jsxs120 } from "react/jsx-runtime";
16569
16617
  async function toggleWithNotice(controller, kind, id, onNotice) {
16570
16618
  const outcome = await controller.toggle(kind, id);
@@ -16611,12 +16659,12 @@ function Group({ title, entities, sport, ui, controller, onNotice }) {
16611
16659
  ] });
16612
16660
  }
16613
16661
  function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNotice }) {
16614
- const [confirming, setConfirming] = useState71(false);
16662
+ const [confirming, setConfirming] = useState72(false);
16615
16663
  const data = controller.data;
16616
- useEffect47(() => {
16664
+ useEffect48(() => {
16617
16665
  setConfirming(false);
16618
16666
  }, [sport]);
16619
- useEffect47(() => {
16667
+ useEffect48(() => {
16620
16668
  if (!confirming) return;
16621
16669
  const onPointerDown = (e) => {
16622
16670
  if (!(e.target instanceof Element) || !e.target.closest("[data-fav-confirm]")) setConfirming(false);
@@ -16670,21 +16718,21 @@ function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNoti
16670
16718
  }
16671
16719
 
16672
16720
  // src/components/FavouritesSearch.tsx
16673
- import { useEffect as useEffect48, useRef as useRef40, useState as useState72 } from "react";
16721
+ import { useEffect as useEffect49, useRef as useRef41, useState as useState73 } from "react";
16674
16722
  import { jsx as jsx136, jsxs as jsxs121 } from "react/jsx-runtime";
16675
16723
  var MIN_LETTERS = 2;
16676
16724
  var MAX_LENGTH = 64;
16677
16725
  var DEBOUNCE_MS = 250;
16678
16726
  function FavouritesSearch({ controller, ui, sport, onNotice }) {
16679
- const [query, setQuery] = useState72("");
16680
- const [answer, setAnswer] = useState72(null);
16681
- const controllerRef = useRef40(controller);
16727
+ const [query, setQuery] = useState73("");
16728
+ const [answer, setAnswer] = useState73(null);
16729
+ const controllerRef = useRef41(controller);
16682
16730
  controllerRef.current = controller;
16683
16731
  const trimmed = query.trim();
16684
16732
  const queryKey = `${sport}|${trimmed}`;
16685
16733
  const results2 = answer?.key === queryKey ? answer.rows : [];
16686
16734
  const settled = answer?.key === queryKey;
16687
- useEffect48(() => {
16735
+ useEffect49(() => {
16688
16736
  setAnswer(null);
16689
16737
  if (trimmed.length < MIN_LETTERS) return;
16690
16738
  let cancelled = false;
@@ -16747,13 +16795,13 @@ function FavouritesSearch({ controller, ui, sport, onNotice }) {
16747
16795
  // src/components/FavouritesPanel.tsx
16748
16796
  import { jsx as jsx137, jsxs as jsxs122 } from "react/jsx-runtime";
16749
16797
  function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
16750
- const [notice, setNotice] = useState73(null);
16751
- const refreshRef = useRef41(controller.refresh);
16798
+ const [notice, setNotice] = useState74(null);
16799
+ const refreshRef = useRef42(controller.refresh);
16752
16800
  refreshRef.current = controller.refresh;
16753
- useEffect49(() => {
16801
+ useEffect50(() => {
16754
16802
  void refreshRef.current();
16755
16803
  }, []);
16756
- useEffect49(() => {
16804
+ useEffect50(() => {
16757
16805
  setNotice(null);
16758
16806
  }, [sport]);
16759
16807
  const sportLabel2 = sports.find((s) => s.sport === sport)?.label ?? sportLabel(ui, sport);
@@ -16779,7 +16827,7 @@ function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
16779
16827
  }
16780
16828
 
16781
16829
  // src/components/dashboard/v8/SentenceBuilder.tsx
16782
- import { useEffect as useEffect50, useRef as useRef42, useState as useState74 } from "react";
16830
+ import { useEffect as useEffect51, useRef as useRef43, useState as useState75 } from "react";
16783
16831
  import { Fragment as Fragment42, jsx as jsx138, jsxs as jsxs123 } from "react/jsx-runtime";
16784
16832
  var TOTALS = ["any", "3", "5", "10", "20", "50"];
16785
16833
  var BASE_LEGS = [1, 2, 3, 4];
@@ -16805,8 +16853,8 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
16805
16853
  const opening = openingGames(preset);
16806
16854
  const gamesOptions = opening.options;
16807
16855
  const marketOptions = usableMarkets(preset);
16808
- const [fingerprint] = useState74(() => JSON.stringify(preset));
16809
- const [saved] = useState74(() => {
16856
+ const [fingerprint] = useState75(() => JSON.stringify(preset));
16857
+ const [saved] = useState75(() => {
16810
16858
  const kept = memory3?.savedView(sport);
16811
16859
  return kept && kept.fingerprint === fingerprint ? kept : null;
16812
16860
  });
@@ -16820,9 +16868,9 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
16820
16868
  // The server never widens by itself: an all-games preset with no ids asks for it.
16821
16869
  widen: opening.option ? opening.option.matchIds.length === 0 : preset.gamesScope === "all" && preset.matchIds.length === 0
16822
16870
  };
16823
- const [view, setView] = useState74(() => saved?.view ?? openingView);
16824
- const autoWidened = useRef42(false);
16825
- 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);
16826
16874
  const requestFor = (v) => ({
16827
16875
  sport,
16828
16876
  ...v.marketKey !== null ? { marketKey: v.marketKey } : {},
@@ -16834,10 +16882,10 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
16834
16882
  ...operatorUserId ? { operatorUserId } : {},
16835
16883
  ...anonymousUserId ? { anonymousUserId } : {}
16836
16884
  });
16837
- const [first] = useState74(() => requestFor(view));
16885
+ const [first] = useState75(() => requestFor(view));
16838
16886
  const { grid, status: status2, confirmed, request } = useBuilderGrid({ conversation, locale: ui.hostTag, memory: memory3, initial: first });
16839
- const lastRequest = useRef42(first);
16840
- useEffect50(() => {
16887
+ const lastRequest = useRef43(first);
16888
+ useEffect51(() => {
16841
16889
  void request(lastRequest.current);
16842
16890
  }, [request]);
16843
16891
  const send = (req) => {
@@ -16870,14 +16918,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
16870
16918
  const rows = ready && grid.status === "ok" ? legsOf(grid, sport) : null;
16871
16919
  const rowSlip = rows ? guardLegsPreMatch(slip, rows, ui) : slip;
16872
16920
  useNextKickoffRender(rows ? rows.map((l) => l.kickoffUtc) : []);
16873
- const [startedNote, setStartedNote] = useState74(false);
16921
+ const [startedNote, setStartedNote] = useState75(false);
16874
16922
  const anyStarted = rows !== null && rows.some((l) => !preMatchOpen(l.kickoffUtc, Date.now()));
16875
- useEffect50(() => {
16923
+ useEffect51(() => {
16876
16924
  if (startedNote && status2 === "ready" && !anyStarted) setStartedNote(false);
16877
16925
  }, [startedNote, status2, anyStarted]);
16878
16926
  const market = rows?.[0]?.market;
16879
- const [seen2, setSeen] = useState74(null);
16880
- useEffect50(() => {
16927
+ const [seen2, setSeen] = useState75(null);
16928
+ useEffect51(() => {
16881
16929
  if (market) setSeen(market);
16882
16930
  }, [market]);
16883
16931
  const marketName = view.marketKey === null ? null : marketOptions?.find((m) => m.key === view.marketKey)?.label ?? market ?? seen2;
@@ -16890,14 +16938,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
16890
16938
  const quotedAt = rows ? oldestQuote(rows) : null;
16891
16939
  const combo = ready && grid.total !== null ? { sport, totalChosen: view.total, totalActual: grid.total } : void 0;
16892
16940
  const canWiden = gamesOptions === null || allGames !== null;
16893
- useEffect50(() => {
16941
+ useEffect51(() => {
16894
16942
  if (!empty2 || !singles || widened || !canWiden || autoWidened.current) return;
16895
16943
  autoWidened.current = true;
16896
16944
  const next = { ...view, widen: true, matchIds: [], gamesId: allGames ? allGames.id : view.gamesId };
16897
16945
  commit(next, true);
16898
16946
  send(requestFor(next));
16899
16947
  }, [empty2, singles, widened, canWiden, view]);
16900
- useEffect50(() => {
16948
+ useEffect51(() => {
16901
16949
  if (coolOff) onCoolOff?.(sport);
16902
16950
  }, [coolOff, onCoolOff, sport]);
16903
16951
  if (coolOff) return null;
@@ -17300,10 +17348,10 @@ function Squad({ squad, loading, ui, view, onToggleView, stats, statsLoading, se
17300
17348
  }
17301
17349
 
17302
17350
  // src/components/PlayerPhoto.tsx
17303
- import { useState as useState75 } from "react";
17351
+ import { useState as useState76 } from "react";
17304
17352
  import { jsx as jsx144 } from "react/jsx-runtime";
17305
17353
  function PlayerPhoto({ photoUrl, jerseyNumber, size }) {
17306
- const [failed, setFailed] = useState75(false);
17354
+ const [failed, setFailed] = useState76(false);
17307
17355
  const box = { width: size, height: size };
17308
17356
  if (photoUrl && !failed) {
17309
17357
  return /* @__PURE__ */ jsx144("img", { className: "ss-w-pd-photo", style: box, src: photoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
@@ -17338,7 +17386,7 @@ function MiniPitch({ positionCode }) {
17338
17386
  }
17339
17387
 
17340
17388
  // src/components/PerformanceBars.tsx
17341
- import { useState as useState76 } from "react";
17389
+ import { useState as useState77 } from "react";
17342
17390
  import { jsx as jsx146, jsxs as jsxs129 } from "react/jsx-runtime";
17343
17391
  var GROUPS = ["shooting", "passing", "possession", "defending"];
17344
17392
  function finite4(v) {
@@ -17384,7 +17432,7 @@ function unrankedLine(ui, reason) {
17384
17432
  }
17385
17433
  }
17386
17434
  function PerformanceBars({ performance, competitionName, strings }) {
17387
- const [mode, setMode] = useState76("total");
17435
+ const [mode, setMode] = useState77("total");
17388
17436
  const labelled = performance.metrics.filter((m) => Object.prototype.hasOwnProperty.call(strings.perfMetric, m.key));
17389
17437
  if (!labelled.some((m) => valueOf(m, "total") !== null || valueOf(m, "per90") !== null)) return null;
17390
17438
  const subtitle = !performance.ranked ? unrankedLine(strings, performance.unrankedReason) : competitionName ? strings.perfRankedAgainst(competitionName, performance.positionGroup) : null;
@@ -17556,7 +17604,7 @@ function PlayerDetail({ detail, loading, ui, seasonName, onClose }) {
17556
17604
  }
17557
17605
 
17558
17606
  // src/components/PresetTools.tsx
17559
- import { useId as useId11, useState as useState77 } from "react";
17607
+ import { useId as useId11, useState as useState78 } from "react";
17560
17608
  import { Fragment as Fragment45, jsx as jsx148, jsxs as jsxs131 } from "react/jsx-runtime";
17561
17609
  function PresetToolModal({ title, closeLabel, onClose, children, footer, className }) {
17562
17610
  const { dialogRef, onKeyDown } = useModalDialog(onClose, { restoreFocus: false });
@@ -17610,9 +17658,9 @@ function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal,
17610
17658
  const totalOptions = comboTotals(grid);
17611
17659
  const totals = totalOptions.map((o) => o.value);
17612
17660
  const legChoices = comboLegChoices(grid);
17613
- const [total, setTotal] = useState77(() => nearest(totals, initialTotal));
17614
- const [legs, setLegs] = useState77(() => legsForTotal(grid, nearest(totals, initialTotal), clampLegs(legChoices, initialLegs)));
17615
- 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("");
17616
17664
  const cell2 = findCombo(grid, total, legs);
17617
17665
  const minLegs = legChoices[0] ?? legs;
17618
17666
  const maxLegs = legChoices[legChoices.length - 1] ?? legs;
@@ -17682,8 +17730,8 @@ function SettingsSheet({ ui, onClose }) {
17682
17730
  import { Fragment as Fragment46, jsx as jsx150, jsxs as jsxs133 } from "react/jsx-runtime";
17683
17731
  var FULLSCREEN_QUERY = "(max-width: 639px)";
17684
17732
  function useIsModal() {
17685
- const [modal, setModal] = useState78(false);
17686
- useEffect52(() => {
17733
+ const [modal, setModal] = useState79(false);
17734
+ useEffect53(() => {
17687
17735
  if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
17688
17736
  const mql = window.matchMedia(FULLSCREEN_QUERY);
17689
17737
  const sync = () => setModal(mql.matches);
@@ -17695,14 +17743,14 @@ function useIsModal() {
17695
17743
  }
17696
17744
  var HIDDEN_LAYER_STYLE = { position: "absolute", inset: 0, visibility: "hidden", display: "flex", flexDirection: "column" };
17697
17745
  var SQUAD_LAYER_STYLE = { display: "flex", flexDirection: "column", flex: 1, minHeight: 0 };
17698
- 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 }) {
17699
17747
  const { state, close, stop, send, reset } = controller;
17700
- const [squadView, setSquadView] = useState78("roster");
17701
- const [selectedPlayerId, setSelectedPlayerId] = useState78(null);
17748
+ const [squadView, setSquadView] = useState79("roster");
17749
+ const [selectedPlayerId, setSelectedPlayerId] = useState79(null);
17702
17750
  const clearPlayerDetail = clubPlayerDetailResult?.clear;
17703
17751
  const fetchPlayerDetail = clubPlayerDetailResult?.fetch;
17704
- const squadLayerRef = useRef44(null);
17705
- const squadScrollRef = useRef44(null);
17752
+ const squadLayerRef = useRef45(null);
17753
+ const squadScrollRef = useRef45(null);
17706
17754
  const selectPlayer = (playerId) => {
17707
17755
  squadScrollRef.current = squadLayerRef.current?.querySelector(".ss-w-mon-list")?.scrollTop ?? null;
17708
17756
  setSelectedPlayerId(playerId);
@@ -17725,16 +17773,16 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
17725
17773
  const hasBuilder = !clubBrand && (builderOptions?.length ?? 0) > 0;
17726
17774
  const tabs = monitor ?? (hasBuilder ? tabState : void 0);
17727
17775
  const activeTab = tabs?.activeTab;
17728
- useEffect52(() => {
17776
+ useEffect53(() => {
17729
17777
  if (activeTab === "squad" || selectedPlayerId === null) return;
17730
17778
  setSelectedPlayerId(null);
17731
17779
  clearPlayerDetail?.();
17732
17780
  }, [activeTab, selectedPlayerId, clearPlayerDetail]);
17733
- useEffect52(() => {
17781
+ useEffect53(() => {
17734
17782
  if (activeTab === "favourites" && !favouritesEnabled) setMonitorTab?.("chat");
17735
17783
  }, [activeTab, favouritesEnabled, setMonitorTab]);
17736
17784
  const storedTab = tabState?.activeTab;
17737
- useEffect52(() => {
17785
+ useEffect53(() => {
17738
17786
  const unreachable = storedTab === "builder" ? !hasBuilder : !monitor && storedTab !== void 0 && storedTab !== "chat";
17739
17787
  if (unreachable) setMonitorTab?.("chat");
17740
17788
  }, [storedTab, hasBuilder, monitor, setMonitorTab]);
@@ -17743,11 +17791,12 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
17743
17791
  const closeTab = tabs?.activeTab ?? "chat";
17744
17792
  const lastMessage = state.messages[state.messages.length - 1];
17745
17793
  const answering = state.isStreaming && !(lastMessage?.role === "assistant" && lastMessage.isGreeting);
17746
- const closeWith = useCallback26((method) => {
17794
+ const closeWith = useCallback27((method) => {
17747
17795
  track({ name: "widget_close", method, tab: closeTab, answering });
17748
- close();
17749
- }, [track, closeTab, answering, close]);
17750
- useEffect52(() => {
17796
+ if (onCloseRequested) onCloseRequested();
17797
+ else close();
17798
+ }, [track, closeTab, answering, close, onCloseRequested]);
17799
+ useEffect53(() => {
17751
17800
  const onKey = (e) => {
17752
17801
  if (e.key === "Escape") closeWith("escape");
17753
17802
  };
@@ -17763,68 +17812,93 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
17763
17812
  tabs?.setActiveTab("chat");
17764
17813
  send(text2, { grounding, source });
17765
17814
  };
17766
- useEffect52(() => {
17815
+ useEffect53(() => {
17767
17816
  if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
17768
17817
  }, [monitor, state.isStreaming, state.messages.length]);
17769
17818
  const onChatTab = !tabs || tabs.activeTab === "chat";
17770
- const inputRef = useRef44(null);
17771
- const limitRef = useRef44(null);
17772
- const typedSendRef = useRef44(false);
17773
- const focusAfterCloseRef = useRef44(null);
17774
- const [tool, setTool] = useState78(null);
17775
- const panelRef = useRef44(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);
17776
17825
  const settings = useOddsSettings();
17777
- const [settingsOpen, setSettingsOpen] = useState78(false);
17826
+ const [settingsOpen, setSettingsOpen] = useState79(false);
17778
17827
  const hasSettings = settings.oddsOffered || !settings.themeLocked;
17779
- const openSettings = useCallback26(() => {
17828
+ const openSettings = useCallback27(() => {
17780
17829
  setTool(null);
17781
17830
  setSettingsOpen(true);
17782
17831
  }, []);
17783
- const closeSettings = useCallback26(() => {
17832
+ const closeSettings = useCallback27(() => {
17784
17833
  setSettingsOpen(false);
17785
17834
  panelRef.current?.querySelector(".ss-w-kebab")?.focus();
17786
17835
  }, []);
17787
17836
  const paused = isPaused(state.limit);
17788
- useEffect52(() => {
17837
+ useEffect53(() => {
17789
17838
  if (paused) setTool(null);
17790
17839
  }, [paused]);
17791
- useEffect52(() => {
17840
+ useEffect53(() => {
17792
17841
  if (!paused) return;
17793
17842
  if (typedSendRef.current) limitRef.current?.focus();
17794
17843
  typedSendRef.current = false;
17795
17844
  }, [paused]);
17796
- const openTool = useCallback26((next) => {
17845
+ const openTool = useCallback27((next) => {
17797
17846
  setTool(next);
17798
17847
  }, []);
17799
17848
  const toolsValue = useMemo12(
17800
17849
  () => presetGrid && !paused ? { openBuilder: (total, legs) => openTool({ total, legs }), changeLabel: ui.presets.changeCombo } : null,
17801
17850
  [presetGrid, paused, openTool, ui.presets.changeCombo]
17802
17851
  );
17803
- const closeTool = useCallback26(() => {
17852
+ const closeTool = useCallback27(() => {
17804
17853
  focusAfterCloseRef.current = "composer";
17805
17854
  setTool(null);
17806
17855
  }, []);
17807
- const sendAsk = useCallback26((ask) => {
17856
+ const sendAsk = useCallback27((ask) => {
17808
17857
  focusAfterCloseRef.current = "composer";
17809
17858
  setTool(null);
17810
17859
  tabs?.setActiveTab("chat");
17811
17860
  send(ask.message, { displayText: ask.displayText, preset: ask.preset, source: "preset" });
17812
17861
  }, [tabs, send]);
17813
- const formatKickoff = useCallback26((kickoffUtc) => {
17862
+ const formatKickoff = useCallback27((kickoffUtc) => {
17814
17863
  const k = ui.bettingKickoff(kickoffUtc);
17815
17864
  return `${k.dayLabel} ${k.time}`;
17816
17865
  }, [ui]);
17817
- useEffect52(() => {
17866
+ useEffect53(() => {
17818
17867
  if (tool) return;
17819
17868
  const target = focusAfterCloseRef.current;
17820
17869
  focusAfterCloseRef.current = null;
17821
17870
  if (target === "composer") inputRef.current?.focus();
17822
17871
  }, [tool]);
17823
- useEffect52(() => {
17872
+ useEffect53(() => {
17824
17873
  if (!tool || onChatTab && presetGrid) return;
17825
17874
  focusAfterCloseRef.current = "composer";
17826
17875
  setTool(null);
17827
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]);
17828
17902
  return /* @__PURE__ */ jsxs133("div", { ref: panelRef, className: "ss-w-panel", role: "dialog", "aria-modal": isModal, "aria-label": ui.chatDialogLabel, children: [
17829
17903
  /* @__PURE__ */ jsx150(
17830
17904
  ChatHeader,
@@ -18186,6 +18260,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
18186
18260
  .ss-w-root[data-ss-w-pos="right"] .ss-w-panel,
18187
18261
  .ss-w-root[data-ss-w-pos="left"] .ss-w-panel { inset: 0; width: auto; height: auto; border: none; border-radius: 0; }
18188
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); }
18189
18264
  .ss-w-header { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--ss-w-line); }
18190
18265
  .ss-w-header-mark { width: 18px; height: 18px; display: block; object-fit: contain; }
18191
18266
  .ss-w-header-title { font-weight: 660; flex: 1; }
@@ -20773,9 +20848,9 @@ function StatsWidget(props) {
20773
20848
  const injectedClient = "client" in props ? props.client : void 0;
20774
20849
  const cfg = props.config;
20775
20850
  const built = useMemo13(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
20776
- const trackingRef = useRef45({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
20851
+ const trackingRef = useRef46({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
20777
20852
  const track = useMemo13(() => createTracker(() => trackingRef.current), []);
20778
- const eventTextRef = useRef45(false);
20853
+ const eventTextRef = useRef46(false);
20779
20854
  eventTextRef.current = cfg?.eventText === true;
20780
20855
  const logger = useMemo13(() => {
20781
20856
  if (!built) return null;
@@ -20792,9 +20867,9 @@ function StatsWidget(props) {
20792
20867
  [props.config, widgetStrings.strings]
20793
20868
  );
20794
20869
  const oddsSettings = useOddsSettingsState(ui, built?.conversation, cfg?.operatorId || "default");
20795
- const rootRef = useRef45(null);
20796
- const introDoneRef = useRef45(false);
20797
- const markIntroDone = useCallback27(() => {
20870
+ const rootRef = useRef46(null);
20871
+ const introDoneRef = useRef46(false);
20872
+ const markIntroDone = useCallback28(() => {
20798
20873
  introDoneRef.current = true;
20799
20874
  }, []);
20800
20875
  const language = injectedClient ? void 0 : hostTag(cfg);
@@ -20833,15 +20908,15 @@ function StatsWidget(props) {
20833
20908
  });
20834
20909
  const operatorUserId = cfg?.userContext?.operatorUserId;
20835
20910
  const anonymousUserId = cfg?.userContext?.anonymousUserId;
20836
- const getSchedule = useCallback27(
20911
+ const getSchedule = useCallback28(
20837
20912
  (localDate, utcOffsetMinutes) => built ? built.conversation.getSchedule(localDate, utcOffsetMinutes, operatorUserId, anonymousUserId) : Promise.resolve(null),
20838
20913
  [built, operatorUserId, anonymousUserId]
20839
20914
  );
20840
- const getStates = useCallback27(
20915
+ const getStates = useCallback28(
20841
20916
  (matchIds, nbaGameIds, nflGameIds, tennisMatches) => built ? built.conversation.getStates(matchIds, nbaGameIds, nflGameIds, requestTag, tennisMatches) : Promise.resolve(null),
20842
20917
  [built, requestTag]
20843
20918
  );
20844
- const getTennisPrices = useCallback27(
20919
+ const getTennisPrices = useCallback28(
20845
20920
  (keys) => built ? built.conversation.getStates([], [], [], requestTag, [], keys).then((p) => p?.tennisPrices ?? null) : Promise.resolve(null),
20846
20921
  [built, requestTag]
20847
20922
  );
@@ -20865,7 +20940,7 @@ function StatsWidget(props) {
20865
20940
  return [...seen2];
20866
20941
  }, [discovery.matchDays, discovery.groups]);
20867
20942
  const scheduleSport = useScheduleSport(offeredSports);
20868
- const [liveLeague, setLiveLeague] = useState79(null);
20943
+ const [liveLeague, setLiveLeague] = useState80(null);
20869
20944
  const [matchesDay, setMatchesDay] = useMatchesDayPick(discovery.localDate);
20870
20945
  const matchesLoaded = useMatchesDay({
20871
20946
  discovery,
@@ -20875,8 +20950,8 @@ function StatsWidget(props) {
20875
20950
  enabled: panelOpen && monitor.activeTab === "matches",
20876
20951
  timeZone: ui.timeZone
20877
20952
  });
20878
- const prevLiveSnapshotRef = useRef45(monitor.snapshot);
20879
- useEffect53(() => {
20953
+ const prevLiveSnapshotRef = useRef46(monitor.snapshot);
20954
+ useEffect54(() => {
20880
20955
  const snap = monitor.snapshot;
20881
20956
  if (!snap || snap === prevLiveSnapshotRef.current) return;
20882
20957
  prevLiveSnapshotRef.current = snap;
@@ -20916,7 +20991,7 @@ function StatsWidget(props) {
20916
20991
  const clubSquadResult = useClubSquad(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
20917
20992
  const clubSquadStatsResult = useClubSquadStats(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
20918
20993
  const clubPlayerDetailResult = useClubPlayerDetail(built?.conversation ?? null);
20919
- const [favSportPick, setFavSportPick] = useState79(null);
20994
+ const [favSportPick, setFavSportPick] = useState80(null);
20920
20995
  const latestGreeting = useMemo13(() => {
20921
20996
  for (const m of [...controller.state.messages].reverse()) {
20922
20997
  if (m.role === "assistant" && m.defaultSport !== void 0) return m;
@@ -20932,13 +21007,13 @@ function StatsWidget(props) {
20932
21007
  const favSport = [favSportPick, rememberedSport, latestGreeting?.defaultSport].find(offered) ?? "football";
20933
21008
  const favSports = favSportOptions.length > 0 ? favSportOptions : [{ sport: favSport, label: sportLabel(ui, favSport) }];
20934
21009
  const hasFavouritesIdentity = !!(operatorUserId || anonymousUserId);
20935
- const [builderSportPick, setBuilderSportPick] = useState79(null);
21010
+ const [builderSportPick, setBuilderSportPick] = useState80(null);
20936
21011
  const builderGreeting = useMemo13(
20937
21012
  () => [...controller.state.messages].reverse().find((m) => m.role === "assistant" && (m.greetingDashboard !== void 0 || m.greetingDashboards !== void 0)) ?? null,
20938
21013
  [controller.state.messages]
20939
21014
  );
20940
- const [coolOff, setCoolOff] = useState79(null);
20941
- const onBuilderCoolOff = useCallback27((sport) => {
21015
+ const [coolOff, setCoolOff] = useState80(null);
21016
+ const onBuilderCoolOff = useCallback28((sport) => {
20942
21017
  if (!builderGreeting) return;
20943
21018
  setCoolOff((prev) => {
20944
21019
  const sports = prev?.greeting === builderGreeting ? prev.sports : [];
@@ -20958,7 +21033,7 @@ function StatsWidget(props) {
20958
21033
  return options.filter((o) => !cooled.includes(o.sport));
20959
21034
  }, [builderGreeting, coolOff, ui]);
20960
21035
  const builderSport = [builderSportPick, rememberedSport, latestGreeting?.defaultSport].find((s) => !!s && builderOptions.some((o) => o.sport === s)) ?? builderOptions[0]?.sport ?? "";
20961
- const [panelEverOpened, setPanelEverOpened] = useState79(panelOpen);
21036
+ const [panelEverOpened, setPanelEverOpened] = useState80(panelOpen);
20962
21037
  if (panelOpen && !panelEverOpened) setPanelEverOpened(true);
20963
21038
  const favourites = useFavourites({
20964
21039
  conversation: built?.conversation ?? null,
@@ -20970,14 +21045,14 @@ function StatsWidget(props) {
20970
21045
  onChanged: discovery.refreshSchedule
20971
21046
  });
20972
21047
  const favouritesEnabled = hasFavouritesIdentity && favourites.status !== "refused";
20973
- const getPricePresets = useCallback27(
21048
+ const getPricePresets = useCallback28(
20974
21049
  (locale) => built ? built.conversation.getPricePresets(locale, { pool: "open" }) : Promise.resolve(null),
20975
21050
  [built]
20976
21051
  );
20977
21052
  const presetGrid = usePresetGrid({ getPricePresets, isOpen: panelOpen, locale: ui.hostTag });
20978
21053
  const markLiveActivity = monitor.markLiveActivity;
20979
- const prevLiveCountRef = useRef45(0);
20980
- useEffect53(() => {
21054
+ const prevLiveCountRef = useRef46(0);
21055
+ useEffect54(() => {
20981
21056
  const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
20982
21057
  prevLiveCountRef.current = discovery.liveCount;
20983
21058
  if (rose) markLiveActivity();
@@ -21015,8 +21090,6 @@ function StatsWidget(props) {
21015
21090
  () => built ? createDashboardTapSignal((input) => built.conversation.sendSignal(input), logger) : void 0,
21016
21091
  [built, logger]
21017
21092
  );
21018
- const dismissPopup = usePopupTelemetry(logger, panelOpen, controller.state.popupText, controller.dismissPopup);
21019
- useOpenTelemetry(logger, panelOpen);
21020
21093
  const asks = bubbleAsks(controller.state.messages, ui.presets.standoutAsk, oddsSettings.oddsFormat).map((ask) => ({
21021
21094
  label: ask.label,
21022
21095
  onTap: () => runBubbleAsk(ask, {
@@ -21027,10 +21100,24 @@ function StatsWidget(props) {
21027
21100
  log: logger
21028
21101
  })
21029
21102
  }));
21030
- const onControlRef = useRef45(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);
21031
21118
  onControlRef.current = props.onControl;
21032
21119
  const { open: openPanel, close: closePanel } = controller;
21033
- useEffect53(() => {
21120
+ useEffect54(() => {
21034
21121
  onControlRef.current?.({ open: openPanel, close: closePanel });
21035
21122
  return () => onControlRef.current?.(null);
21036
21123
  }, [openPanel, closePanel]);
@@ -21047,11 +21134,11 @@ function StatsWidget(props) {
21047
21134
  page: cfg?.page
21048
21135
  }
21049
21136
  };
21050
- useEffect53(() => {
21137
+ useEffect54(() => {
21051
21138
  if (!logger) return;
21052
21139
  logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
21053
21140
  }, [logger, operatorUserId, anonymousUserId, conversationId]);
21054
- useEffect53(() => {
21141
+ useEffect54(() => {
21055
21142
  if (!logger) return;
21056
21143
  logger.resume();
21057
21144
  const onHide = () => {
@@ -21069,7 +21156,7 @@ function StatsWidget(props) {
21069
21156
  logger.dispose();
21070
21157
  };
21071
21158
  }, [logger]);
21072
- useEffect53(() => {
21159
+ useEffect54(() => {
21073
21160
  if (!built || !ui.injectStyles || widgetStrings.state === "unavailable") return;
21074
21161
  const node = rootRef.current?.getRootNode();
21075
21162
  if (node) injectStyles(node);
@@ -21090,7 +21177,7 @@ function StatsWidget(props) {
21090
21177
  }), [favouritesEnabled, monitor.enabled, clubFixturesResult.settled, clubFixturesResult.tabReady, clubFixturesResult.enabled, monitor.setActiveTab, favourites, built, holds, builderMemory]);
21091
21178
  if (!built || widgetStrings.state === "unavailable") return null;
21092
21179
  const attrs = themeAttrs(ui, oddsSettings.userTheme);
21093
- 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(
21094
21181
  ChatPanel,
21095
21182
  {
21096
21183
  controller,
@@ -21122,9 +21209,11 @@ function StatsWidget(props) {
21122
21209
  presetGrid,
21123
21210
  favouritesEnabled: favouritesEnabled && clubFixturesResult.tabReady && !clubFixturesResult.enabled,
21124
21211
  favourites: { controller: favourites, sport: favSport, sports: favSports, onSportChange: setFavSportPick },
21125
- 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
21126
21215
  }
21127
- ) }) : /* @__PURE__ */ jsx152(
21216
+ ) }) : props.mobile ? null : /* @__PURE__ */ jsx152(
21128
21217
  ChatFab,
21129
21218
  {
21130
21219
  label: stringsPending ? cfg?.launcherLabel : ui.launcherLabel,
@@ -21149,6 +21238,7 @@ function emptyConversation() {
21149
21238
  export {
21150
21239
  StatsWidget,
21151
21240
  WIDGET_CSS,
21241
+ WIDGET_REACT_VERSION,
21152
21242
  createWidgetHost
21153
21243
  };
21154
21244
  //# sourceMappingURL=index.js.map