@sensiblestats/widget-react 0.104.0 → 0.106.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.cjs CHANGED
@@ -37,7 +37,7 @@ __export(index_exports, {
37
37
  module.exports = __toCommonJS(index_exports);
38
38
 
39
39
  // src/StatsWidget.tsx
40
- var import_react78 = require("react");
40
+ var import_react79 = require("react");
41
41
  var import_widget_sdk30 = require("@sensiblestats/widget-sdk");
42
42
 
43
43
  // src/kickoff.ts
@@ -1208,7 +1208,7 @@ function isEnglishLocale(locale) {
1208
1208
  }
1209
1209
 
1210
1210
  // src/version.generated.ts
1211
- var WIDGET_REACT_VERSION = "0.104.0";
1211
+ var WIDGET_REACT_VERSION = "0.106.0";
1212
1212
 
1213
1213
  // src/config.ts
1214
1214
  function normalizeUi(cfg) {
@@ -3023,7 +3023,7 @@ var import_widget_sdk12 = require("@sensiblestats/widget-sdk");
3023
3023
 
3024
3024
  // src/scheduleCache.ts
3025
3025
  var PREFIX2 = "ss-w-schedule:";
3026
- var SCHEMA_VERSION = 3;
3026
+ var SCHEMA_VERSION = 4;
3027
3027
  var TTL_MS3 = 6 * 36e5;
3028
3028
  function scheduleCacheKey(operatorId, encodedUserKey2, localDate) {
3029
3029
  return `${PREFIX2}${operatorId}:${encodedUserKey2}:${localDate}`;
@@ -3101,6 +3101,7 @@ var TERMINAL_PHASES = /* @__PURE__ */ new Set(["fullTime", "postponed"]);
3101
3101
  function dueMatchIds(groups, states, nowMs) {
3102
3102
  const football = /* @__PURE__ */ new Set();
3103
3103
  const nba = /* @__PURE__ */ new Set();
3104
+ const nfl = /* @__PURE__ */ new Set();
3104
3105
  for (const group of groups) {
3105
3106
  for (const match of group.matches) {
3106
3107
  if (nowMs - match.kickoffUnix * 1e3 < 0) continue;
@@ -3109,9 +3110,10 @@ function dueMatchIds(groups, states, nowMs) {
3109
3110
  const sport = sportKeyOf(match.sport);
3110
3111
  if (sport === "football") football.add(match.matchId);
3111
3112
  else if (sport === "basketball") nba.add(match.matchId);
3113
+ else if (sport === "americanfootball") nfl.add(match.matchId);
3112
3114
  }
3113
3115
  }
3114
- return { football: [...football], nba: [...nba] };
3116
+ return { football: [...football], nba: [...nba], nfl: [...nfl] };
3115
3117
  }
3116
3118
 
3117
3119
  // src/useMatchDiscovery.ts
@@ -3173,9 +3175,9 @@ function useMatchDiscovery(opts) {
3173
3175
  }, [opts.operatorId, opts.operatorUserId, opts.anonymousUserId, localDate]);
3174
3176
  const tick = (0, import_react3.useCallback)(async () => {
3175
3177
  const ids = dueMatchIds(groupsRef.current, statesRef.current, Date.now());
3176
- if (ids.football.length === 0 && ids.nba.length === 0) return;
3178
+ if (ids.football.length === 0 && ids.nba.length === 0 && ids.nfl.length === 0) return;
3177
3179
  try {
3178
- const payload = await getStatesRef.current(ids.football, ids.nba);
3180
+ const payload = await getStatesRef.current(ids.football, ids.nba, ids.nfl);
3179
3181
  if (!payload) return;
3180
3182
  setStates((prev) => {
3181
3183
  const next = new Map(prev);
@@ -4704,7 +4706,7 @@ function ChatFab({ label, greeting, popupText, logoUrl, onOpen, onDismissPopup,
4704
4706
  }
4705
4707
 
4706
4708
  // src/components/ChatPanel.tsx
4707
- var import_react77 = require("react");
4709
+ var import_react78 = require("react");
4708
4710
 
4709
4711
  // src/components/ChatHeader.tsx
4710
4712
  var import_react21 = require("react");
@@ -4783,6 +4785,9 @@ function ChatHeader({
4783
4785
  }
4784
4786
 
4785
4787
  // src/components/MessageList.tsx
4788
+ var import_react46 = require("react");
4789
+
4790
+ // src/components/ChatMessage.tsx
4786
4791
  var import_react45 = require("react");
4787
4792
 
4788
4793
  // src/components/Markdown.tsx
@@ -6806,16 +6811,23 @@ var LAYOUT_CLASSES = {
6806
6811
  function layoutClass(layout) {
6807
6812
  return Object.prototype.hasOwnProperty.call(LAYOUT_CLASSES, layout) ? LAYOUT_CLASSES[layout] : LAYOUT_CLASSES.goal;
6808
6813
  }
6809
- function GreetingDashboard({ dashboard, dashboards, defaultSport, onTap, oddsLabel, liveLabel: liveLabel3, sportGroupLabel }) {
6814
+ function switchSets(dashboards) {
6815
+ return dashboards && dashboards.length >= 2 ? dashboards : null;
6816
+ }
6817
+ function initialSport(sets, defaultSport) {
6818
+ return (sets?.some((s) => s.sport === defaultSport) ? defaultSport : sets?.[0]?.sport) ?? "";
6819
+ }
6820
+ function GreetingDashboard({ dashboard, dashboards, defaultSport, onTap, onSportChange, oddsLabel, liveLabel: liveLabel3, sportGroupLabel }) {
6810
6821
  const log = useEventLog();
6811
6822
  const scope = useSportScope();
6812
- const sets = dashboards && dashboards.length >= 2 ? dashboards : null;
6813
- const [selected, setSelected] = (0, import_react37.useState)(() => (sets?.some((s) => s.sport === defaultSport) ? defaultSport : sets?.[0]?.sport) ?? "");
6823
+ const sets = switchSets(dashboards);
6824
+ const [selected, setSelected] = (0, import_react37.useState)(() => initialSport(sets, defaultSport));
6814
6825
  const active = sets?.find((s) => s.sport === selected) ?? null;
6815
6826
  const shown = active ? active.dashboard : dashboard;
6816
6827
  const select = (sport) => {
6817
6828
  if (sport === selected) return;
6818
6829
  setSelected(sport);
6830
+ onSportChange?.(sport);
6819
6831
  if (scope) writeSportChoice(scope.operatorId, encodedUserKey(scope.operatorUserId, scope.anonymousUserId), sport, Date.now());
6820
6832
  log?.log({ name: "dashboard_sport_switch", outcome: sport });
6821
6833
  };
@@ -7654,6 +7666,7 @@ function FanDashboardCard({ card, onTap, ui, goalEvents }) {
7654
7666
  // src/components/ChatMessage.tsx
7655
7667
  var import_jsx_runtime49 = require("react/jsx-runtime");
7656
7668
  function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor }) {
7669
+ const [sport, setSport] = (0, import_react45.useState)(null);
7657
7670
  if (message.role === "user") {
7658
7671
  return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "ss-w-msg ss-w-user", "data-msg-id": message.id, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "ss-w-bubble", children: message.text }) });
7659
7672
  }
@@ -7661,9 +7674,12 @@ function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor }) {
7661
7674
  onAct({ message: card.actionLabel, actionRef: card.actionRef, label: card.actionLabel || card.title || "" });
7662
7675
  };
7663
7676
  const compact = toCompactList(message.marketOdds);
7677
+ const sets = message.greetingDashboard ? switchSets(message.greetingDashboards) : null;
7678
+ const setChips = sets?.some((s) => s.suggestedActions) ? sets.find((s) => s.sport === (sport ?? initialSport(sets, message.defaultSport)))?.suggestedActions ?? [] : null;
7679
+ const actions = setChips ? setChips.map((c) => toActionVM({ ...c })) : message.actions;
7664
7680
  return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "ss-w-msg ss-w-bot", "data-msg-id": message.id, children: [
7665
7681
  message.text && !message.greetingDashboard && !message.clubFanDashboard ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Markdown, { text: message.text }) : null,
7666
- message.greetingDashboard && !message.clubFanDashboard ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(GreetingDashboard, { dashboard: message.greetingDashboard, dashboards: message.greetingDashboards, defaultSport: message.defaultSport, onTap, oddsLabel: ui?.oddsLabel, liveLabel: ui?.liveLabel, sportGroupLabel: ui?.sportGroupLabel }) : null,
7682
+ message.greetingDashboard && !message.clubFanDashboard ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(GreetingDashboard, { dashboard: message.greetingDashboard, dashboards: message.greetingDashboards, defaultSport: message.defaultSport, onTap, onSportChange: setSport, oddsLabel: ui?.oddsLabel, liveLabel: ui?.liveLabel, sportGroupLabel: ui?.sportGroupLabel }) : null,
7667
7683
  message.clubFanDashboard ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ClubFanDashboard, { dashboard: message.clubFanDashboard, onTap: onFanDashboardTap, ui }) : null,
7668
7684
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(EntityCardList, { cards: message.cards, disabled, showLessLabel: ui?.showLess, showMoreLabel: ui?.showMore }),
7669
7685
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(BettingInsightList, { insights: message.insights, ui, slip, monitor }),
@@ -7672,7 +7688,7 @@ function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor }) {
7672
7688
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ComboCardList, { cards: message.comboCards ?? [], ui, slip, monitor }),
7673
7689
  compact ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(CompactOddsList, { list: compact, ui, slip, monitor }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(MarketOddsCardList, { cards: message.marketOdds, ui, slip, monitor }),
7674
7690
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(OddsMovementCardList, { cards: message.oddsMovement, ui, monitor }),
7675
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ActionButtons, { actions: message.actions, loading: false, disabled, onAct })
7691
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ActionButtons, { actions, loading: false, disabled, onAct })
7676
7692
  ] });
7677
7693
  }
7678
7694
 
@@ -7699,11 +7715,11 @@ function turnAnchor(messages) {
7699
7715
  }
7700
7716
  function MessageList({ controller, ui, slip, onDashboardTap, monitor }) {
7701
7717
  const { state, send } = controller;
7702
- const listRef = (0, import_react45.useRef)(null);
7703
- const endRef = (0, import_react45.useRef)(null);
7704
- const pinnedRef = (0, import_react45.useRef)(true);
7705
- const anchoredTurnRef = (0, import_react45.useRef)(null);
7706
- (0, import_react45.useEffect)(() => {
7718
+ const listRef = (0, import_react46.useRef)(null);
7719
+ const endRef = (0, import_react46.useRef)(null);
7720
+ const pinnedRef = (0, import_react46.useRef)(true);
7721
+ const anchoredTurnRef = (0, import_react46.useRef)(null);
7722
+ (0, import_react46.useEffect)(() => {
7707
7723
  const anchor = turnAnchor(state.messages);
7708
7724
  const list = listRef.current;
7709
7725
  if (anchor && anchor.turnId !== anchoredTurnRef.current) {
@@ -7760,13 +7776,13 @@ function MessageList({ controller, ui, slip, onDashboardTap, monitor }) {
7760
7776
  }
7761
7777
 
7762
7778
  // src/components/ChatInput.tsx
7763
- var import_react46 = require("react");
7779
+ var import_react47 = require("react");
7764
7780
  var import_jsx_runtime52 = require("react/jsx-runtime");
7765
- var ChatInput = (0, import_react46.forwardRef)(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel = "Stop response", sendLabel = "Send message", disabled = false, onType }, ref) {
7766
- const [value, setValue] = (0, import_react46.useState)("");
7767
- const textareaRef = (0, import_react46.useRef)(null);
7768
- const stopRef = (0, import_react46.useRef)(null);
7769
- const textBoxWantsFocusRef = (0, import_react46.useRef)(false);
7781
+ var ChatInput = (0, import_react47.forwardRef)(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel = "Stop response", sendLabel = "Send message", disabled = false, onType }, ref) {
7782
+ const [value, setValue] = (0, import_react47.useState)("");
7783
+ const textareaRef = (0, import_react47.useRef)(null);
7784
+ const stopRef = (0, import_react47.useRef)(null);
7785
+ const textBoxWantsFocusRef = (0, import_react47.useRef)(false);
7770
7786
  const submit = () => {
7771
7787
  if (disabled) return;
7772
7788
  const t = value.trim();
@@ -7780,7 +7796,7 @@ var ChatInput = (0, import_react46.forwardRef)(function ChatInput2({ placeholder
7780
7796
  submit();
7781
7797
  }
7782
7798
  };
7783
- (0, import_react46.useImperativeHandle)(ref, () => ({
7799
+ (0, import_react47.useImperativeHandle)(ref, () => ({
7784
7800
  focus() {
7785
7801
  const box = textareaRef.current;
7786
7802
  if (box && !box.disabled) {
@@ -7792,7 +7808,7 @@ var ChatInput = (0, import_react46.forwardRef)(function ChatInput2({ placeholder
7792
7808
  stopRef.current?.focus();
7793
7809
  }
7794
7810
  }), []);
7795
- (0, import_react46.useEffect)(() => {
7811
+ (0, import_react47.useEffect)(() => {
7796
7812
  if (streaming || disabled || !textBoxWantsFocusRef.current) return;
7797
7813
  textBoxWantsFocusRef.current = false;
7798
7814
  const box = textareaRef.current;
@@ -7824,7 +7840,7 @@ var ChatInput = (0, import_react46.forwardRef)(function ChatInput2({ placeholder
7824
7840
  });
7825
7841
 
7826
7842
  // src/components/TabBar.tsx
7827
- var import_react47 = require("react");
7843
+ var import_react48 = require("react");
7828
7844
  var import_jsx_runtime53 = require("react/jsx-runtime");
7829
7845
  function TabBar({ monitor, ui, matchCount, oddsCount, todayCount, hasToday, gamesEnabled, clubEnabled }) {
7830
7846
  const tabs = [
@@ -7840,9 +7856,9 @@ function TabBar({ monitor, ui, matchCount, oddsCount, todayCount, hasToday, game
7840
7856
  ],
7841
7857
  ...gamesEnabled ? [{ tab: "games", label: ui.tabGames, count: 0, dot: false }] : []
7842
7858
  ];
7843
- const listRef = (0, import_react47.useRef)(null);
7859
+ const listRef = (0, import_react48.useRef)(null);
7844
7860
  const activeTab = monitor.activeTab;
7845
- (0, import_react47.useEffect)(() => {
7861
+ (0, import_react48.useEffect)(() => {
7846
7862
  const el = listRef.current?.querySelector("[data-on]");
7847
7863
  if (!el || typeof el.scrollIntoView !== "function") return;
7848
7864
  const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
@@ -7872,7 +7888,7 @@ function TabBar({ monitor, ui, matchCount, oddsCount, todayCount, hasToday, game
7872
7888
  }
7873
7889
 
7874
7890
  // src/components/MonitorTabs.tsx
7875
- var import_react52 = require("react");
7891
+ var import_react53 = require("react");
7876
7892
 
7877
7893
  // src/components/MarketAccordion.tsx
7878
7894
  var import_widget_sdk22 = require("@sensiblestats/widget-sdk");
@@ -7934,10 +7950,10 @@ function MarketAccordion({ match, monitor, ui, slip }) {
7934
7950
  }
7935
7951
 
7936
7952
  // src/components/LiveFactBlock.tsx
7937
- var import_react48 = require("react");
7953
+ var import_react49 = require("react");
7938
7954
  var import_jsx_runtime55 = require("react/jsx-runtime");
7939
7955
  function LiveFactBlock({ facts, matchId, ui, slip, onAsk }) {
7940
- const [expanded, setExpanded] = (0, import_react48.useState)(false);
7956
+ const [expanded, setExpanded] = (0, import_react49.useState)(false);
7941
7957
  const [current, ...earlier] = facts;
7942
7958
  if (!current) return null;
7943
7959
  const m = current.market;
@@ -8005,7 +8021,7 @@ function LiveFactBlock({ facts, matchId, ui, slip, onAsk }) {
8005
8021
  }
8006
8022
 
8007
8023
  // src/components/MonitorFormH2H.tsx
8008
- var import_react49 = require("react");
8024
+ var import_react50 = require("react");
8009
8025
  var import_jsx_runtime56 = require("react/jsx-runtime");
8010
8026
  function resultClass2(result) {
8011
8027
  if (result === "W") return "ss-w-h2h-result--win";
@@ -8021,7 +8037,7 @@ function FormDots({ form, ui }) {
8021
8037
  return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "ss-w-h2h-dots", children: form.map((m, i) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: `ss-w-h2h-result ${resultClass2(m.result)}`, children: resultLabel(m.result, ui) }, i)) });
8022
8038
  }
8023
8039
  function MonitorFormH2H({ formAndH2H, homeTeamName, awayTeamName, ui }) {
8024
- const [expanded, setExpanded] = (0, import_react49.useState)(false);
8040
+ const [expanded, setExpanded] = (0, import_react50.useState)(false);
8025
8041
  const { homeForm, awayForm, h2h, homeShortCode, awayShortCode } = formAndH2H;
8026
8042
  if (homeForm.length === 0 && awayForm.length === 0 && !h2h) {
8027
8043
  return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, {});
@@ -8254,7 +8270,7 @@ function MonitorSkeleton({ pin, monitor, ui }) {
8254
8270
  var import_widget_sdk23 = require("@sensiblestats/widget-sdk");
8255
8271
 
8256
8272
  // src/components/NbaPropsSection.tsx
8257
- var import_react50 = require("react");
8273
+ var import_react51 = require("react");
8258
8274
  var import_jsx_runtime59 = require("react/jsx-runtime");
8259
8275
  var STAT_ORDER = ["points", "rebounds", "assists", "threes"];
8260
8276
  var MAX_TIMER_MS = 2147483647;
@@ -8316,7 +8332,7 @@ function Last5({ games, stat, line, ui }) {
8316
8332
  }
8317
8333
  function PlayerPanel({ player, bundle, ui, slip }) {
8318
8334
  const stats = STAT_ORDER.map((k) => player.stats.find((s) => s.stat === k)).filter((s) => s != null);
8319
- const [picked, setPicked] = (0, import_react50.useState)(null);
8335
+ const [picked, setPicked] = (0, import_react51.useState)(null);
8320
8336
  const active = stats.find((s) => s.stat === picked) ?? stats[0];
8321
8337
  return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ss-w-props-panel", children: [
8322
8338
  /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-props-chips", children: stats.map((s) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
@@ -8353,7 +8369,7 @@ function PlayerPanel({ player, bundle, ui, slip }) {
8353
8369
  ] });
8354
8370
  }
8355
8371
  function Roster({ bundle, players, side, ui, slip }) {
8356
- const [openId, setOpenId] = (0, import_react50.useState)(null);
8372
+ const [openId, setOpenId] = (0, import_react51.useState)(null);
8357
8373
  return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-props-list", children: players.map((p) => {
8358
8374
  const isOpen = openId === p.playerId;
8359
8375
  const main = p.stats.find((s) => s.stat === "points" && hasMainLine(s)) ?? p.stats.find(hasMainLine);
@@ -8384,15 +8400,15 @@ function Roster({ bundle, players, side, ui, slip }) {
8384
8400
  }) });
8385
8401
  }
8386
8402
  function NbaPropsSection({ match, monitor, ui, slip }) {
8387
- const [side, setSide] = (0, import_react50.useState)("home");
8388
- const [, setTick] = (0, import_react50.useState)(0);
8403
+ const [side, setSide] = (0, import_react51.useState)("home");
8404
+ const [, setTick] = (0, import_react51.useState)(0);
8389
8405
  const pre = preTip(match);
8390
8406
  const live = match.phase === "live";
8391
8407
  const open = pre || live;
8392
- (0, import_react50.useEffect)(() => {
8408
+ (0, import_react51.useEffect)(() => {
8393
8409
  if (open) monitor.loadPlayerProps?.(match.matchId);
8394
8410
  }, [match.matchId, match.asOfUtc, open]);
8395
- (0, import_react50.useEffect)(() => {
8411
+ (0, import_react51.useEffect)(() => {
8396
8412
  if (!pre || !match.kickoffUtc) return;
8397
8413
  const wait = Math.min(Math.max(Date.parse(match.kickoffUtc) - Date.now(), 0), MAX_TIMER_MS);
8398
8414
  const id = setTimeout(() => setTick((t) => t + 1), wait);
@@ -8617,7 +8633,7 @@ function NflMonitorCard({ match, monitor, ui, slip }) {
8617
8633
  }
8618
8634
 
8619
8635
  // src/components/ScoreboardStrip.tsx
8620
- var import_react51 = require("react");
8636
+ var import_react52 = require("react");
8621
8637
  var import_widget_sdk24 = require("@sensiblestats/widget-sdk");
8622
8638
  var import_jsx_runtime62 = require("react/jsx-runtime");
8623
8639
  function nbaStatus(m, ui) {
@@ -8692,8 +8708,8 @@ function rowsFor(m) {
8692
8708
  ];
8693
8709
  }
8694
8710
  function ScoreboardStrip({ tiles, selectedKey, onSelect, ui }) {
8695
- const stripRef = (0, import_react51.useRef)(null);
8696
- (0, import_react51.useEffect)(() => {
8711
+ const stripRef = (0, import_react52.useRef)(null);
8712
+ (0, import_react52.useEffect)(() => {
8697
8713
  const strip = stripRef.current;
8698
8714
  const pressed = strip?.querySelector('[aria-pressed="true"]');
8699
8715
  if (!strip || !pressed) return;
@@ -8805,7 +8821,7 @@ function OddsLiveStrip({ m, ui }) {
8805
8821
  ] });
8806
8822
  }
8807
8823
  function MatchesPanel({ monitor, ui, slip, onAsk, discovery }) {
8808
- const seedIndex = (0, import_react52.useMemo)(() => buildSeedIndex(discovery?.groups ?? []), [discovery?.groups]);
8824
+ const seedIndex = (0, import_react53.useMemo)(() => buildSeedIndex(discovery?.groups ?? []), [discovery?.groups]);
8809
8825
  const tiles = orderTiles(
8810
8826
  monitor.pins,
8811
8827
  monitor.snapshot,
@@ -8871,7 +8887,7 @@ function OddsPanel({ monitor, ui, slip }) {
8871
8887
  }
8872
8888
 
8873
8889
  // src/components/TodayPanel.tsx
8874
- var import_react56 = require("react");
8890
+ var import_react57 = require("react");
8875
8891
  var import_widget_sdk29 = require("@sensiblestats/widget-sdk");
8876
8892
 
8877
8893
  // src/placement.ts
@@ -8936,11 +8952,11 @@ function matchingFixtures(group, query) {
8936
8952
  }
8937
8953
 
8938
8954
  // src/useStarTap.ts
8939
- var import_react53 = require("react");
8955
+ var import_react54 = require("react");
8940
8956
  function useStarTap(starLeague) {
8941
- const [pendingId, setPendingId] = (0, import_react53.useState)(null);
8942
- const pendingRef = (0, import_react53.useRef)(null);
8943
- const tap = (0, import_react53.useCallback)(async (competitionId, next) => {
8957
+ const [pendingId, setPendingId] = (0, import_react54.useState)(null);
8958
+ const pendingRef = (0, import_react54.useRef)(null);
8959
+ const tap = (0, import_react54.useCallback)(async (competitionId, next) => {
8944
8960
  if (pendingRef.current !== null) return false;
8945
8961
  pendingRef.current = competitionId;
8946
8962
  setPendingId(competitionId);
@@ -8999,7 +9015,7 @@ function LeagueTile({ group, starClickable: starClickable2, disambiguate, onOpen
8999
9015
  }
9000
9016
 
9001
9017
  // src/components/LeagueDetail.tsx
9002
- var import_react54 = require("react");
9018
+ var import_react55 = require("react");
9003
9019
  var import_widget_sdk27 = require("@sensiblestats/widget-sdk");
9004
9020
 
9005
9021
  // src/components/FixtureRow.tsx
@@ -9029,11 +9045,11 @@ function FixtureRow({ match, state, stale, ui, monitor }) {
9029
9045
  const score = hasScore ? `${state.homeScore}\u2013${state.awayScore}` : void 0;
9030
9046
  const ticked = state?.phase === "live" ? state.minuteLabel ?? null : null;
9031
9047
  const when = state?.isHalfTime && !stale ? ui.halfTime : isLive ? ticked ?? "\u2014" : state?.phase === "live" ? "\u2014" : kickoffLabel(match.kickoffUnix);
9032
- const isNba = match.sport === "basketball";
9048
+ const isUsSport = sportKeyOf(match.sport) !== "football";
9033
9049
  const pinSport = (0, import_widget_sdk26.slipSportOf)(match.sport);
9034
9050
  const liveTone = isLive || state?.isHalfTime;
9035
- const clockParts = isNba && isLive && ticked !== null && !state?.isHalfTime ? splitAtFirstSpace(ticked) : null;
9036
- const dayMarker = isNba && !liveTone && state?.phase !== "live" && isOtherLocalDay(match.kickoffUnix, /* @__PURE__ */ new Date()) ? new Intl.DateTimeFormat(ui.locale === "tr" ? "tr-TR" : "en-GB", { weekday: "short" }).format(new Date(match.kickoffUnix * 1e3)) : null;
9051
+ const clockParts = isUsSport && isLive && ticked !== null && !state?.isHalfTime ? splitAtFirstSpace(ticked) : null;
9052
+ const dayMarker = isUsSport && !liveTone && state?.phase !== "live" && isOtherLocalDay(match.kickoffUnix, /* @__PURE__ */ new Date()) ? new Intl.DateTimeFormat(ui.locale === "tr" ? "tr-TR" : "en-GB", { weekday: "short" }).format(new Date(match.kickoffUnix * 1e3)) : null;
9037
9053
  const twoLines = clockParts ?? (dayMarker !== null ? [when, dayMarker] : null);
9038
9054
  const whenClass = [
9039
9055
  "ss-w-drow-when",
@@ -9043,9 +9059,9 @@ function FixtureRow({ match, state, stale, ui, monitor }) {
9043
9059
  return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: liveTone ? "ss-w-drow ss-w-drow--live" : "ss-w-drow", children: [
9044
9060
  /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: whenClass, children: twoLines ? twoLines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { children: line }, i)) : when }),
9045
9061
  /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("span", { className: "ss-w-drow-fx", children: [
9046
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Side2, { name: match.homeTeamName, crest: match.homeTeamImagePath, abbr: isNba ? match.homeTeamAbbr ?? void 0 : void 0 }),
9062
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Side2, { name: match.homeTeamName, crest: match.homeTeamImagePath, abbr: isUsSport ? match.homeTeamAbbr ?? void 0 : void 0 }),
9047
9063
  /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: hasScore ? "ss-w-drow-sc" : "ss-w-drow-sc ss-w-drow-sc--idle", children: score ?? "\u2013" }),
9048
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Side2, { name: match.awayTeamName, crest: match.awayTeamImagePath, abbr: isNba ? match.awayTeamAbbr ?? void 0 : void 0, away: true })
9064
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Side2, { name: match.awayTeamName, crest: match.awayTeamImagePath, abbr: isUsSport ? match.awayTeamAbbr ?? void 0 : void 0, away: true })
9049
9065
  ] }),
9050
9066
  /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
9051
9067
  PinToggle,
@@ -9062,11 +9078,11 @@ function FixtureRow({ match, state, stale, ui, monitor }) {
9062
9078
  var import_jsx_runtime66 = require("react/jsx-runtime");
9063
9079
  var STAR_PATH2 = "M12 2.5l2.9 5.9 6.5.95-4.7 4.58 1.1 6.47L12 17.35 6.1 20.4l1.1-6.47L2.5 9.35l6.5-.95z";
9064
9080
  function LeagueDetail({ group, position, states, stale, ui, monitor, starTap, onBack, onPrev, onNext }) {
9065
- const [toast, setToast] = (0, import_react54.useState)(null);
9066
- (0, import_react54.useEffect)(() => {
9081
+ const [toast, setToast] = (0, import_react55.useState)(null);
9082
+ (0, import_react55.useEffect)(() => {
9067
9083
  setToast(null);
9068
9084
  }, [group.competitionId]);
9069
- (0, import_react54.useEffect)(() => {
9085
+ (0, import_react55.useEffect)(() => {
9070
9086
  if (toast === null) return;
9071
9087
  const id = setTimeout(() => setToast(null), 4e3);
9072
9088
  return () => clearTimeout(id);
@@ -9219,7 +9235,7 @@ function LeagueRowGroup({ group, states, stale, cap: cap2, starClickable: starCl
9219
9235
  }
9220
9236
 
9221
9237
  // src/components/games/ui/SearchField.tsx
9222
- var import_react55 = require("react");
9238
+ var import_react56 = require("react");
9223
9239
 
9224
9240
  // src/components/games/ui/icons.tsx
9225
9241
  var import_jsx_runtime68 = require("react/jsx-runtime");
@@ -9258,8 +9274,8 @@ var IconFlame = ({ size = 16 }) => svg(size, /* @__PURE__ */ (0, import_jsx_runt
9258
9274
  // src/components/games/ui/SearchField.tsx
9259
9275
  var import_jsx_runtime69 = require("react/jsx-runtime");
9260
9276
  function SearchField({ id, label, labelHidden = false, placeholder, value, onChange, disabled, inputRef, onKeyDown, clearLabel }) {
9261
- const localRef = (0, import_react55.useRef)(null);
9262
- const setInputRef = (0, import_react55.useCallback)((node) => {
9277
+ const localRef = (0, import_react56.useRef)(null);
9278
+ const setInputRef = (0, import_react56.useCallback)((node) => {
9263
9279
  localRef.current = node;
9264
9280
  if (typeof inputRef === "function") inputRef(node);
9265
9281
  else if (inputRef) inputRef.current = node;
@@ -9303,23 +9319,23 @@ function SearchField({ id, label, labelHidden = false, placeholder, value, onCha
9303
9319
  var import_jsx_runtime70 = require("react/jsx-runtime");
9304
9320
  function TodayPanel({ discovery, ui, monitor }) {
9305
9321
  const { groups, states, stale, starLeague } = discovery;
9306
- const searchId = (0, import_react56.useId)();
9307
- const [query, setQuery] = (0, import_react56.useState)("");
9308
- const [selectedCompetitionId, setSelectedCompetitionId] = (0, import_react56.useState)(null);
9309
- const [toast, setToast] = (0, import_react56.useState)(null);
9310
- (0, import_react56.useEffect)(() => {
9322
+ const searchId = (0, import_react57.useId)();
9323
+ const [query, setQuery] = (0, import_react57.useState)("");
9324
+ const [selectedCompetitionId, setSelectedCompetitionId] = (0, import_react57.useState)(null);
9325
+ const [toast, setToast] = (0, import_react57.useState)(null);
9326
+ (0, import_react57.useEffect)(() => {
9311
9327
  if (toast === null) return;
9312
9328
  const id = setTimeout(() => setToast(null), 4e3);
9313
9329
  return () => clearTimeout(id);
9314
9330
  }, [toast]);
9315
9331
  const visibleGroups = visibleGroupsOf(groups, states);
9316
- const pinnedMatchIds = (0, import_react56.useMemo)(
9332
+ const pinnedMatchIds = (0, import_react57.useMemo)(
9317
9333
  () => footballMatchPinIds(monitor.pins),
9318
9334
  [monitor.pins]
9319
9335
  );
9320
- const placement = (0, import_react56.useMemo)(() => placeLeagues(visibleGroups, pinnedMatchIds), [visibleGroups, pinnedMatchIds]);
9336
+ const placement = (0, import_react57.useMemo)(() => placeLeagues(visibleGroups, pinnedMatchIds), [visibleGroups, pinnedMatchIds]);
9321
9337
  const starTap = useStarTap(starLeague);
9322
- const gridStarTap = (0, import_react56.useMemo)(() => ({
9338
+ const gridStarTap = (0, import_react57.useMemo)(() => ({
9323
9339
  pendingId: starTap.pendingId,
9324
9340
  tap: async (competitionId, next) => {
9325
9341
  const ok = await starTap.tap(competitionId, next);
@@ -9353,7 +9369,7 @@ function TodayPanel({ discovery, ui, monitor }) {
9353
9369
  }
9354
9370
  const openIndex = selectedCompetitionId === null ? -1 : placement.order.findIndex((g) => g.competitionId === selectedCompetitionId);
9355
9371
  const openGroup = openIndex === -1 ? void 0 : placement.order[openIndex];
9356
- (0, import_react56.useEffect)(() => {
9372
+ (0, import_react57.useEffect)(() => {
9357
9373
  if (selectedCompetitionId !== null && openGroup === void 0) setSelectedCompetitionId(null);
9358
9374
  }, [selectedCompetitionId, openGroup]);
9359
9375
  const liveRows = stale ? [] : visibleGroups.flatMap((group) => group.matches.filter((m) => isTreatedLive(states.get((0, import_widget_sdk29.matchKey)(m.sport, m.matchId)), stale)).map((match) => ({ match, rank: group.rank }))).sort((a, b) => a.rank - b.rank);
@@ -9509,7 +9525,7 @@ function TodayPanel({ discovery, ui, monitor }) {
9509
9525
  }
9510
9526
 
9511
9527
  // src/components/GamesPanel.tsx
9512
- var import_react71 = require("react");
9528
+ var import_react72 = require("react");
9513
9529
 
9514
9530
  // src/components/GamesLoginWall.tsx
9515
9531
  var import_jsx_runtime71 = require("react/jsx-runtime");
@@ -9518,7 +9534,7 @@ function GamesLoginWall({ ui }) {
9518
9534
  }
9519
9535
 
9520
9536
  // src/components/GamesHub.tsx
9521
- var import_react57 = require("react");
9537
+ var import_react58 = require("react");
9522
9538
 
9523
9539
  // src/components/games/ui/gameMeta.ts
9524
9540
  function prettifyGameId(gameId) {
@@ -9669,8 +9685,8 @@ function pickHeroGame(games) {
9669
9685
  }
9670
9686
  var tileKey = (g) => `${g.gameId}-${g.gameDay}-${g.fixtureId}`;
9671
9687
  function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
9672
- const [, setTick] = (0, import_react57.useState)(0);
9673
- (0, import_react57.useEffect)(() => {
9688
+ const [, setTick] = (0, import_react58.useState)(0);
9689
+ (0, import_react58.useEffect)(() => {
9674
9690
  const id = setInterval(() => setTick((t) => t + 1), 6e4);
9675
9691
  return () => clearInterval(id);
9676
9692
  }, []);
@@ -9730,10 +9746,10 @@ function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
9730
9746
  }
9731
9747
 
9732
9748
  // src/components/GameScreenHost.tsx
9733
- var import_react69 = require("react");
9749
+ var import_react70 = require("react");
9734
9750
 
9735
9751
  // src/useGamePlay.ts
9736
- var import_react58 = require("react");
9752
+ var import_react59 = require("react");
9737
9753
  function toSubmitResult(payload) {
9738
9754
  return {
9739
9755
  // 'pending' means the play is recorded but awaiting resolution (fixture games)
@@ -9745,17 +9761,17 @@ function toSubmitResult(payload) {
9745
9761
  };
9746
9762
  }
9747
9763
  function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh }) {
9748
- const [result, setResult] = (0, import_react58.useState)(null);
9749
- const [submitting, setSubmitting] = (0, import_react58.useState)(false);
9750
- const [rawStatus, setRawStatus] = (0, import_react58.useState)(null);
9751
- const inFlightRef = (0, import_react58.useRef)(false);
9752
- const convRef = (0, import_react58.useRef)(conversation);
9764
+ const [result, setResult] = (0, import_react59.useState)(null);
9765
+ const [submitting, setSubmitting] = (0, import_react59.useState)(false);
9766
+ const [rawStatus, setRawStatus] = (0, import_react59.useState)(null);
9767
+ const inFlightRef = (0, import_react59.useRef)(false);
9768
+ const convRef = (0, import_react59.useRef)(conversation);
9753
9769
  convRef.current = conversation;
9754
- const optsRef = (0, import_react58.useRef)({ gameId, gameDay, fixtureId, locale, refresh });
9770
+ const optsRef = (0, import_react59.useRef)({ gameId, gameDay, fixtureId, locale, refresh });
9755
9771
  optsRef.current = { gameId, gameDay, fixtureId, locale, refresh };
9756
- const resultRef = (0, import_react58.useRef)(null);
9772
+ const resultRef = (0, import_react59.useRef)(null);
9757
9773
  resultRef.current = result;
9758
- const refetch = (0, import_react58.useCallback)(async () => {
9774
+ const refetch = (0, import_react59.useCallback)(async () => {
9759
9775
  const conv = convRef.current;
9760
9776
  if (!conv) return;
9761
9777
  const opts = optsRef.current;
@@ -9771,7 +9787,7 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
9771
9787
  } catch {
9772
9788
  }
9773
9789
  }, []);
9774
- const submit = (0, import_react58.useCallback)(async (answerJson) => {
9790
+ const submit = (0, import_react59.useCallback)(async (answerJson) => {
9775
9791
  const conv = convRef.current;
9776
9792
  if (!conv || inFlightRef.current) return;
9777
9793
  inFlightRef.current = true;
@@ -9798,14 +9814,14 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
9798
9814
  setSubmitting(false);
9799
9815
  }
9800
9816
  }, [refetch]);
9801
- const hydrate = (0, import_react58.useCallback)(() => {
9817
+ const hydrate = (0, import_react59.useCallback)(() => {
9802
9818
  void refetch();
9803
9819
  }, [refetch]);
9804
9820
  return { result, submitting, submit, hydrate, rawStatus };
9805
9821
  }
9806
9822
 
9807
9823
  // src/components/games/MysteryTigerGame.tsx
9808
- var import_react60 = require("react");
9824
+ var import_react61 = require("react");
9809
9825
 
9810
9826
  // src/components/games/nationFlags.ts
9811
9827
  var FLAGS = {
@@ -10016,7 +10032,7 @@ function isNationCode(flag) {
10016
10032
  }
10017
10033
 
10018
10034
  // src/components/games/PlayerAvatar.tsx
10019
- var import_react59 = require("react");
10035
+ var import_react60 = require("react");
10020
10036
  var import_jsx_runtime76 = require("react/jsx-runtime");
10021
10037
  function initialsOf(name) {
10022
10038
  const parts = name.trim().split(/\s+/).filter(Boolean);
@@ -10034,7 +10050,7 @@ function PlayerAvatar({
10034
10050
  imagePath,
10035
10051
  className
10036
10052
  }) {
10037
- const [failed, setFailed] = (0, import_react59.useState)(false);
10053
+ const [failed, setFailed] = (0, import_react60.useState)(false);
10038
10054
  const showImage = Boolean(imagePath) && !isPlaceholderImage(imagePath) && !failed;
10039
10055
  return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className, "aria-hidden": "true", children: showImage ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("img", { src: imagePath, alt: "", loading: "lazy", onError: () => setFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "ss-w-av-initials", children: initialsOf(name) }) });
10040
10056
  }
@@ -10275,8 +10291,8 @@ function MysteryTigerGame({
10275
10291
  onBack
10276
10292
  }) {
10277
10293
  const t = ui.games.mysteryTiger;
10278
- const [query, setQuery] = (0, import_react60.useState)("");
10279
- const inputId = (0, import_react60.useId)();
10294
+ const [query, setQuery] = (0, import_react61.useState)("");
10295
+ const inputId = (0, import_react61.useId)();
10280
10296
  const clientState = parseClientState(result?.clientStateJson);
10281
10297
  const guessResults = clientState?.guessResults ?? [];
10282
10298
  const alreadyGuessedIds = new Set(guessResults.map((g) => g.playerId));
@@ -10537,13 +10553,13 @@ function HigherOrLowerGame({
10537
10553
  }
10538
10554
 
10539
10555
  // src/components/games/CareerPathGame.tsx
10540
- var import_react62 = require("react");
10556
+ var import_react63 = require("react");
10541
10557
 
10542
10558
  // src/components/games/ui/CrestShield.tsx
10543
- var import_react61 = require("react");
10559
+ var import_react62 = require("react");
10544
10560
  var import_jsx_runtime87 = require("react/jsx-runtime");
10545
10561
  function CrestShield({ src, name, size = 28 }) {
10546
- const [failed, setFailed] = (0, import_react61.useState)(false);
10562
+ const [failed, setFailed] = (0, import_react62.useState)(false);
10547
10563
  if (src && !isPlaceholderImage(src) && !failed) {
10548
10564
  return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("img", { className: "ss-g-crest", src, alt: name, width: size, height: size, loading: "lazy", onError: () => setFailed(true) });
10549
10565
  }
@@ -10575,8 +10591,8 @@ function CareerPathGame({
10575
10591
  }) {
10576
10592
  const s = ui.games.careerPath;
10577
10593
  const title = gameTitle({ gameId: "career-path" }, ui.games.titles);
10578
- const [query, setQuery] = (0, import_react62.useState)("");
10579
- const inputId = (0, import_react62.useId)();
10594
+ const [query, setQuery] = (0, import_react63.useState)("");
10595
+ const inputId = (0, import_react63.useId)();
10580
10596
  const clientState = parseClientState3(result?.clientStateJson);
10581
10597
  const alreadyGuessedIds = new Set(clientState?.guessResults.map((g) => g.playerId) ?? []);
10582
10598
  const isOver = result?.alreadyPlayed === true || clientState?.solved === true || clientState?.failed === true;
@@ -10682,7 +10698,7 @@ function CareerPathGame({
10682
10698
  }
10683
10699
 
10684
10700
  // src/components/games/BeatTheGridGame.tsx
10685
- var import_react63 = __toESM(require("react"), 1);
10701
+ var import_react64 = __toESM(require("react"), 1);
10686
10702
 
10687
10703
  // src/components/games/ui/OptionList.tsx
10688
10704
  var import_jsx_runtime89 = require("react/jsx-runtime");
@@ -10771,10 +10787,10 @@ function SearchSheet({
10771
10787
  ui
10772
10788
  }) {
10773
10789
  const s = ui.games.beatTheGrid;
10774
- const [query, setQuery] = (0, import_react63.useState)("");
10775
- const inputId = (0, import_react63.useId)();
10776
- const inputRef = (0, import_react63.useRef)(null);
10777
- (0, import_react63.useEffect)(() => {
10790
+ const [query, setQuery] = (0, import_react64.useState)("");
10791
+ const inputId = (0, import_react64.useId)();
10792
+ const inputRef = (0, import_react64.useRef)(null);
10793
+ (0, import_react64.useEffect)(() => {
10778
10794
  inputRef.current?.focus();
10779
10795
  }, [row, col]);
10780
10796
  const filtered = playerPool.filter(
@@ -10839,7 +10855,7 @@ function BeatTheGridGame({
10839
10855
  }) {
10840
10856
  const s = ui.games.beatTheGrid;
10841
10857
  const title = gameTitle({ gameId: "beat-the-grid" }, ui.games.titles);
10842
- const [activeCell, setActiveCell] = (0, import_react63.useState)(null);
10858
+ const [activeCell, setActiveCell] = (0, import_react64.useState)(null);
10843
10859
  const clientState = parseClientState4(result?.clientStateJson);
10844
10860
  const filledCells = clientState?.cells ?? [];
10845
10861
  const isLocked2 = result?.alreadyPlayed === true || clientState?.isComplete === true;
@@ -10913,7 +10929,7 @@ function BeatTheGridGame({
10913
10929
  /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { "aria-hidden": "true", children: abbr }),
10914
10930
  /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "ss-g-sr", children: rowLabel })
10915
10931
  ] });
10916
- return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(import_react63.default.Fragment, { children: [
10932
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(import_react64.default.Fragment, { children: [
10917
10933
  /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: "ss-g-btg-rowhdr", "data-meta": rowMeta ? "true" : void 0, children: rowHeaderContent }),
10918
10934
  cols.map((colLabel, colIdx) => {
10919
10935
  const filled = findCellResult(filledCells, rowIdx, colIdx);
@@ -10994,7 +11010,7 @@ function BeatTheGridGame({
10994
11010
  }
10995
11011
 
10996
11012
  // src/components/games/GuessTheXiGame.tsx
10997
- var import_react64 = require("react");
11013
+ var import_react65 = require("react");
10998
11014
 
10999
11015
  // src/components/games/ui/PitchSvg.tsx
11000
11016
  var import_jsx_runtime91 = require("react/jsx-runtime");
@@ -11083,8 +11099,8 @@ function GuessTheXiGame({
11083
11099
  onBack
11084
11100
  }) {
11085
11101
  const t = ui.games.guessTheXi;
11086
- const [query, setQuery] = (0, import_react64.useState)("");
11087
- const inputId = (0, import_react64.useId)();
11102
+ const [query, setQuery] = (0, import_react65.useState)("");
11103
+ const inputId = (0, import_react65.useId)();
11088
11104
  const clientState = parseClientState5(result?.clientStateJson);
11089
11105
  const isOver = result?.alreadyPlayed === true || clientState?.status === "solved" || clientState?.status === "failed";
11090
11106
  const solved = clientState?.status === "solved";
@@ -11226,7 +11242,7 @@ function GuessTheXiGame({
11226
11242
  }
11227
11243
 
11228
11244
  // src/components/games/DailyQuizGame.tsx
11229
- var import_react65 = require("react");
11245
+ var import_react66 = require("react");
11230
11246
  var import_jsx_runtime93 = require("react/jsx-runtime");
11231
11247
  function parseClientState6(json) {
11232
11248
  if (!json) return null;
@@ -11267,8 +11283,8 @@ function DailyQuizGame({
11267
11283
  }) {
11268
11284
  const s = ui.games.dailyQuiz;
11269
11285
  const title = gameTitle({ gameId: "daily-quiz" }, ui.games.titles);
11270
- const [selections, setSelections] = (0, import_react65.useState)(/* @__PURE__ */ new Map());
11271
- const [page, setPage] = (0, import_react65.useState)(0);
11286
+ const [selections, setSelections] = (0, import_react66.useState)(/* @__PURE__ */ new Map());
11287
+ const [page, setPage] = (0, import_react66.useState)(0);
11272
11288
  const clientState = parseClientState6(result?.clientStateJson);
11273
11289
  const results = clientState?.results ?? [];
11274
11290
  const isRevealed = results.length > 0 || result?.alreadyPlayed === true;
@@ -11378,7 +11394,7 @@ function DailyQuizGame({
11378
11394
  }
11379
11395
 
11380
11396
  // src/components/games/MatchdayPredictorGame.tsx
11381
- var import_react66 = require("react");
11397
+ var import_react67 = require("react");
11382
11398
  var import_jsx_runtime94 = require("react/jsx-runtime");
11383
11399
  var SCORER_SEARCH_THRESHOLD = 9;
11384
11400
  function parseClientState7(json) {
@@ -11474,12 +11490,12 @@ function MatchdayPredictorGame({
11474
11490
  onBack
11475
11491
  }) {
11476
11492
  const t = ui.games.predictor;
11477
- const [homeScore, setHomeScore] = (0, import_react66.useState)(0);
11478
- const [awayScore, setAwayScore] = (0, import_react66.useState)(0);
11479
- const [firstScorerPlayerId, setFirstScorerPlayerId] = (0, import_react66.useState)(null);
11480
- const [lastEdited, setLastEdited] = (0, import_react66.useState)("home");
11481
- const [query, setQuery] = (0, import_react66.useState)("");
11482
- const searchId = (0, import_react66.useId)();
11493
+ const [homeScore, setHomeScore] = (0, import_react67.useState)(0);
11494
+ const [awayScore, setAwayScore] = (0, import_react67.useState)(0);
11495
+ const [firstScorerPlayerId, setFirstScorerPlayerId] = (0, import_react67.useState)(null);
11496
+ const [lastEdited, setLastEdited] = (0, import_react67.useState)("home");
11497
+ const [query, setQuery] = (0, import_react67.useState)("");
11498
+ const searchId = (0, import_react67.useId)();
11483
11499
  const clientState = parseClientState7(result?.clientStateJson);
11484
11500
  const alreadyPlayed = result?.alreadyPlayed === true;
11485
11501
  const header = /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
@@ -11646,7 +11662,7 @@ function MatchdayPredictorGame({
11646
11662
  }
11647
11663
 
11648
11664
  // src/components/games/StartingXiGame.tsx
11649
- var import_react67 = require("react");
11665
+ var import_react68 = require("react");
11650
11666
  var import_jsx_runtime95 = require("react/jsx-runtime");
11651
11667
  var POINTS_PER_STARTER = 8;
11652
11668
  var XI_SIZE = 11;
@@ -11690,10 +11706,10 @@ function StartingXiGame({
11690
11706
  lockAtUtc
11691
11707
  }) {
11692
11708
  const t = ui.games.startingXi;
11693
- const [slotPlayers, setSlotPlayers] = (0, import_react67.useState)(() => Array(XI_SIZE).fill(null));
11694
- const [active, setActive] = (0, import_react67.useState)(0);
11695
- const [query, setQuery] = (0, import_react67.useState)("");
11696
- const searchId = (0, import_react67.useId)();
11709
+ const [slotPlayers, setSlotPlayers] = (0, import_react68.useState)(() => Array(XI_SIZE).fill(null));
11710
+ const [active, setActive] = (0, import_react68.useState)(0);
11711
+ const [query, setQuery] = (0, import_react68.useState)("");
11712
+ const searchId = (0, import_react68.useId)();
11697
11713
  const clientState = parseClientState8(result?.clientStateJson);
11698
11714
  const alreadyPlayed = result?.alreadyPlayed === true;
11699
11715
  const header = /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
@@ -11832,7 +11848,7 @@ function StartingXiGame({
11832
11848
  }
11833
11849
 
11834
11850
  // src/components/games/StatLadderGame.tsx
11835
- var import_react68 = require("react");
11851
+ var import_react69 = require("react");
11836
11852
  var import_jsx_runtime96 = require("react/jsx-runtime");
11837
11853
  function ladderClue(ladder) {
11838
11854
  const mystery = ladder.find((r) => r.rank === 2);
@@ -11869,9 +11885,9 @@ function StatLadderGame({
11869
11885
  onBack
11870
11886
  }) {
11871
11887
  const t = ui.games.statLadder;
11872
- const [query, setQuery] = (0, import_react68.useState)("");
11873
- const [selectedId, setSelectedId] = (0, import_react68.useState)(null);
11874
- const searchId = (0, import_react68.useId)();
11888
+ const [query, setQuery] = (0, import_react69.useState)("");
11889
+ const [selectedId, setSelectedId] = (0, import_react69.useState)(null);
11890
+ const searchId = (0, import_react69.useId)();
11875
11891
  const clientState = parseClientState9(result?.clientStateJson);
11876
11892
  const revealed = clientState != null;
11877
11893
  const header = /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(GameHeader, { title: gameTitle({ gameId: "stat-ladder" }, ui.games.titles), eyebrow: t.eyebrow, onBack, backLabel: ui.back });
@@ -12077,8 +12093,8 @@ function GameScreenHost({
12077
12093
  ui
12078
12094
  }) {
12079
12095
  const { gameId, fixtureId, gameDay = "", lockAtUtc = null } = selected;
12080
- const [configJson, setConfigJson] = (0, import_react69.useState)(null);
12081
- (0, import_react69.useEffect)(() => {
12096
+ const [configJson, setConfigJson] = (0, import_react70.useState)(null);
12097
+ (0, import_react70.useEffect)(() => {
12082
12098
  setConfigJson(null);
12083
12099
  if (!conversation) return;
12084
12100
  let cancelled = false;
@@ -12101,12 +12117,12 @@ function GameScreenHost({
12101
12117
  fixtureId: fixtureId || void 0,
12102
12118
  locale: ui.games.lang
12103
12119
  });
12104
- (0, import_react69.useEffect)(() => {
12120
+ (0, import_react70.useEffect)(() => {
12105
12121
  if (conversation) hydrate();
12106
12122
  }, [conversation, gameId]);
12107
- const hydrateRef = (0, import_react69.useRef)(hydrate);
12123
+ const hydrateRef = (0, import_react70.useRef)(hydrate);
12108
12124
  hydrateRef.current = hydrate;
12109
- (0, import_react69.useEffect)(() => {
12125
+ (0, import_react70.useEffect)(() => {
12110
12126
  if (!FIXTURE_GAME_IDS.has(gameId)) return;
12111
12127
  if (rawStatus !== "pending") return;
12112
12128
  const timerId = setInterval(() => {
@@ -12219,7 +12235,7 @@ function GameScreenHost({
12219
12235
  }
12220
12236
 
12221
12237
  // src/components/Leaderboard.tsx
12222
- var import_react70 = require("react");
12238
+ var import_react71 = require("react");
12223
12239
 
12224
12240
  // src/components/LeaderboardRow.tsx
12225
12241
  var import_jsx_runtime99 = require("react/jsx-runtime");
@@ -12304,7 +12320,7 @@ function Leaderboard({
12304
12320
  ui,
12305
12321
  onPlay
12306
12322
  }) {
12307
- const [segment, setSegment] = (0, import_react70.useState)("weekly");
12323
+ const [segment, setSegment] = (0, import_react71.useState)("weekly");
12308
12324
  const myRow = segment === "weekly" ? data.myWeeklyRow : data.myAllTimeRow;
12309
12325
  const offBoard = myRow !== null && myRow !== void 0 && myRow.rank === -1;
12310
12326
  const isEmpty = segment === "weekly" ? data.weeklyTop.length === 0 : data.allTimeTop.length === 0;
@@ -12407,9 +12423,9 @@ function GamesPanel({
12407
12423
  leaderboardLoading,
12408
12424
  refreshHub
12409
12425
  }) {
12410
- const [selected, setSelected] = (0, import_react71.useState)(null);
12411
- const [segment, setSegment] = (0, import_react71.useState)("play");
12412
- (0, import_react71.useEffect)(() => {
12426
+ const [selected, setSelected] = (0, import_react72.useState)(null);
12427
+ const [segment, setSegment] = (0, import_react72.useState)("play");
12428
+ (0, import_react72.useEffect)(() => {
12413
12429
  ensureGamesFonts();
12414
12430
  }, []);
12415
12431
  if (!loggedIn) return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(GamesLoginWall, { ui });
@@ -12710,10 +12726,10 @@ function Squad({ squad, loading, ui, view, onToggleView, stats, statsLoading, se
12710
12726
  }
12711
12727
 
12712
12728
  // src/components/PlayerPhoto.tsx
12713
- var import_react72 = require("react");
12729
+ var import_react73 = require("react");
12714
12730
  var import_jsx_runtime108 = require("react/jsx-runtime");
12715
12731
  function PlayerPhoto({ photoUrl, jerseyNumber, size }) {
12716
- const [failed, setFailed] = (0, import_react72.useState)(false);
12732
+ const [failed, setFailed] = (0, import_react73.useState)(false);
12717
12733
  const box = { width: size, height: size };
12718
12734
  if (photoUrl && !failed) {
12719
12735
  return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("img", { className: "ss-w-pd-photo", style: box, src: photoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
@@ -12748,7 +12764,7 @@ function MiniPitch({ positionCode }) {
12748
12764
  }
12749
12765
 
12750
12766
  // src/components/PerformanceBars.tsx
12751
- var import_react73 = require("react");
12767
+ var import_react74 = require("react");
12752
12768
  var import_jsx_runtime110 = require("react/jsx-runtime");
12753
12769
  var GROUPS = ["shooting", "passing", "possession", "defending"];
12754
12770
  function finite3(v) {
@@ -12794,7 +12810,7 @@ function unrankedLine(ui, reason) {
12794
12810
  }
12795
12811
  }
12796
12812
  function PerformanceBars({ performance, competitionName, strings }) {
12797
- const [mode, setMode] = (0, import_react73.useState)("total");
12813
+ const [mode, setMode] = (0, import_react74.useState)("total");
12798
12814
  const labelled = performance.metrics.filter((m) => Object.prototype.hasOwnProperty.call(strings.perfMetric, m.key));
12799
12815
  if (!labelled.some((m) => valueOf(m, "total") !== null || valueOf(m, "per90") !== null)) return null;
12800
12816
  const subtitle = !performance.ranked ? unrankedLine(strings, performance.unrankedReason) : competitionName ? strings.perfRankedAgainst(competitionName, performance.positionGroup) : null;
@@ -12966,10 +12982,10 @@ function PlayerDetail({ detail, loading, ui, seasonName, onClose }) {
12966
12982
  }
12967
12983
 
12968
12984
  // src/components/PresetSpeedDial.tsx
12969
- var import_react74 = require("react");
12985
+ var import_react75 = require("react");
12970
12986
  var import_jsx_runtime112 = require("react/jsx-runtime");
12971
12987
  function PresetSpeedDial({ expanded, showDot, strings, onToggle, onOpen, rootRef, buttonRef }) {
12972
- const pillsId = (0, import_react74.useId)();
12988
+ const pillsId = (0, import_react75.useId)();
12973
12989
  const tabIndex = expanded ? 0 : -1;
12974
12990
  return /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("div", { ref: rootRef, className: "ss-w-dial", children: [
12975
12991
  /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(
@@ -13003,16 +13019,16 @@ function PresetSpeedDial({ expanded, showDot, strings, onToggle, onOpen, rootRef
13003
13019
  }
13004
13020
 
13005
13021
  // src/components/PresetTools.tsx
13006
- var import_react75 = require("react");
13022
+ var import_react76 = require("react");
13007
13023
  var import_jsx_runtime113 = require("react/jsx-runtime");
13008
13024
  var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
13009
13025
  function PresetToolModal({ title, closeLabel, onClose, children, footer }) {
13010
- const dialogRef = (0, import_react75.useRef)(null);
13011
- const titleId = (0, import_react75.useId)();
13012
- (0, import_react75.useEffect)(() => {
13026
+ const dialogRef = (0, import_react76.useRef)(null);
13027
+ const titleId = (0, import_react76.useId)();
13028
+ (0, import_react76.useEffect)(() => {
13013
13029
  dialogRef.current?.focus();
13014
13030
  }, []);
13015
- (0, import_react75.useEffect)(() => {
13031
+ (0, import_react76.useEffect)(() => {
13016
13032
  const onKey = (e) => {
13017
13033
  if (e.key !== "Escape") return;
13018
13034
  e.stopPropagation();
@@ -13054,7 +13070,7 @@ function PresetToolModal({ title, closeLabel, onClose, children, footer }) {
13054
13070
  function fillTemplate(template, slots) {
13055
13071
  return template.split(/(\{[a-z]+\})/).filter((part) => part !== "").map((part, i) => {
13056
13072
  const key = /^\{([a-z]+)\}$/.exec(part)?.[1];
13057
- return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(import_react75.Fragment, { children: key !== void 0 && key in slots ? slots[key] : part }, i);
13073
+ return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(import_react76.Fragment, { children: key !== void 0 && key in slots ? slots[key] : part }, i);
13058
13074
  });
13059
13075
  }
13060
13076
  function NumberSelect({ current, choices: choices2, label, notToday, lockEmpty = true, onChoose }) {
@@ -13123,15 +13139,15 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
13123
13139
  const totals = comboTotals(grid);
13124
13140
  const legChoices = comboLegChoices(grid);
13125
13141
  const count = FIXED_SINGLES_COUNT;
13126
- const [maxPrice, setMaxPrice] = (0, import_react75.useState)(() => startSingles(grid.singles, limits, START.maxPrice, count));
13127
- const [minPrice, setMinPrice] = (0, import_react75.useState)(() => startSingles(grid.singlesFrom, floors, START.minPrice, count));
13128
- const [start] = (0, import_react75.useState)(() => startCombo(grid, totals, legChoices, START.comboTotal, START.comboLegs));
13129
- const [total, setTotal] = (0, import_react75.useState)(start.total);
13130
- const [legs, setLegs] = (0, import_react75.useState)(start.legs);
13131
- const [bigStart] = (0, import_react75.useState)(() => startCombo(grid, totals, legChoices, BIG_COMBO.total, BIG_COMBO.legs));
13132
- const [bigTotal, setBigTotal] = (0, import_react75.useState)(bigStart.total);
13133
- const [bigLegs, setBigLegs] = (0, import_react75.useState)(bigStart.legs);
13134
- const [announcement, setAnnouncement] = (0, import_react75.useState)("");
13142
+ const [maxPrice, setMaxPrice] = (0, import_react76.useState)(() => startSingles(grid.singles, limits, START.maxPrice, count));
13143
+ const [minPrice, setMinPrice] = (0, import_react76.useState)(() => startSingles(grid.singlesFrom, floors, START.minPrice, count));
13144
+ const [start] = (0, import_react76.useState)(() => startCombo(grid, totals, legChoices, START.comboTotal, START.comboLegs));
13145
+ const [total, setTotal] = (0, import_react76.useState)(start.total);
13146
+ const [legs, setLegs] = (0, import_react76.useState)(start.legs);
13147
+ const [bigStart] = (0, import_react76.useState)(() => startCombo(grid, totals, legChoices, BIG_COMBO.total, BIG_COMBO.legs));
13148
+ const [bigTotal, setBigTotal] = (0, import_react76.useState)(bigStart.total);
13149
+ const [bigLegs, setBigLegs] = (0, import_react76.useState)(bigStart.legs);
13150
+ const [announcement, setAnnouncement] = (0, import_react76.useState)("");
13135
13151
  const maxCell = findSingles(grid.singles, maxPrice, count);
13136
13152
  const minCell = findSingles(grid.singlesFrom, minPrice, count);
13137
13153
  const comboCell = findCombo(grid, total, legs);
@@ -13175,7 +13191,7 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
13175
13191
  const totalChoices = totals.map((v) => ({ value: v, text: v.toFixed(1), available: legChoices.some((n) => !!findCombo(grid, v, n)) }));
13176
13192
  const legChoicesFor = (t) => legChoices.map((n) => ({ value: n, text: String(n), available: !!findCombo(grid, t, n) }));
13177
13193
  const markets = grid.markets ?? [];
13178
- const [marketIdx, setMarketIdx] = (0, import_react75.useState)(0);
13194
+ const [marketIdx, setMarketIdx] = (0, import_react76.useState)(0);
13179
13195
  const marketCell = markets[marketIdx] ?? null;
13180
13196
  const marketLabels = markets.map((c) => strings.marketShort(c.marketDeveloperName, c.marketLabel, c.selectionLabel ?? null));
13181
13197
  const singlesReady = (cell2) => cell2 ? strings.readyCount(cell2.picks.length) : strings.unavailable;
@@ -13256,14 +13272,14 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
13256
13272
  function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal, initialLegs, onSend, onClose }) {
13257
13273
  const totals = comboTotals(grid);
13258
13274
  const legChoices = comboLegChoices(grid);
13259
- const [start] = (0, import_react75.useState)(() => initialTotal === void 0 ? startCombo(grid, totals, legChoices, START.comboTotal, START.comboLegs) : null);
13260
- const [total, setTotal] = (0, import_react75.useState)(() => initialTotal !== void 0 ? nearest(totals, initialTotal) : start.total);
13261
- const [legs, setLegs] = (0, import_react75.useState)(() => {
13275
+ const [start] = (0, import_react76.useState)(() => initialTotal === void 0 ? startCombo(grid, totals, legChoices, START.comboTotal, START.comboLegs) : null);
13276
+ const [total, setTotal] = (0, import_react76.useState)(() => initialTotal !== void 0 ? nearest(totals, initialTotal) : start.total);
13277
+ const [legs, setLegs] = (0, import_react76.useState)(() => {
13262
13278
  if (initialTotal === void 0) return initialLegs !== void 0 ? clampLegs(legChoices, initialLegs) : start.legs;
13263
13279
  const from = initialLegs !== void 0 ? clampLegs(legChoices, initialLegs) : startValue(legChoices, START.comboLegs);
13264
13280
  return legsForTotal(grid, nearest(totals, initialTotal), from);
13265
13281
  });
13266
- const [announcement, setAnnouncement] = (0, import_react75.useState)("");
13282
+ const [announcement, setAnnouncement] = (0, import_react76.useState)("");
13267
13283
  const cell2 = findCombo(grid, total, legs);
13268
13284
  const minLegs = legChoices[0] ?? legs;
13269
13285
  const maxLegs = legChoices[legChoices.length - 1] ?? legs;
@@ -13296,7 +13312,7 @@ function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal,
13296
13312
  }
13297
13313
 
13298
13314
  // src/usePresetDial.ts
13299
- var import_react76 = require("react");
13315
+ var import_react77 = require("react");
13300
13316
  function sendInFlight(messages, isStreaming) {
13301
13317
  const last = messages[messages.length - 1];
13302
13318
  return isStreaming && !!last && last.role === "assistant" && !last.done && !last.isGreeting;
@@ -13310,25 +13326,25 @@ function lastUserId(messages) {
13310
13326
  }
13311
13327
  var SCROLL_KEYS = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "PageUp", "PageDown", "Home", "End", " "]);
13312
13328
  function usePresetDial({ layerRef, dialRef, dialButtonRef, messages, isStreaming, activeTab }) {
13313
- const [expanded, setExpanded] = (0, import_react76.useState)(() => !sendInFlight(messages, isStreaming));
13314
- const fold = (0, import_react76.useCallback)(() => setExpanded(false), []);
13315
- const toggle = (0, import_react76.useCallback)(() => setExpanded((e) => !e), []);
13329
+ const [expanded, setExpanded] = (0, import_react77.useState)(() => !sendInFlight(messages, isStreaming));
13330
+ const fold = (0, import_react77.useCallback)(() => setExpanded(false), []);
13331
+ const toggle = (0, import_react77.useCallback)(() => setExpanded((e) => !e), []);
13316
13332
  const currentUserId = lastUserId(messages);
13317
- const userIdRef = (0, import_react76.useRef)(currentUserId);
13318
- (0, import_react76.useEffect)(() => {
13333
+ const userIdRef = (0, import_react77.useRef)(currentUserId);
13334
+ (0, import_react77.useEffect)(() => {
13319
13335
  if (currentUserId === userIdRef.current) return;
13320
13336
  userIdRef.current = currentUserId;
13321
13337
  setExpanded(false);
13322
13338
  }, [currentUserId]);
13323
- const tabRef = (0, import_react76.useRef)(activeTab);
13324
- (0, import_react76.useEffect)(() => {
13339
+ const tabRef = (0, import_react77.useRef)(activeTab);
13340
+ (0, import_react77.useEffect)(() => {
13325
13341
  if (activeTab === tabRef.current) return;
13326
13342
  tabRef.current = activeTab;
13327
13343
  setExpanded(false);
13328
13344
  }, [activeTab]);
13329
- const expandedRef = (0, import_react76.useRef)(expanded);
13345
+ const expandedRef = (0, import_react77.useRef)(expanded);
13330
13346
  expandedRef.current = expanded;
13331
- (0, import_react76.useEffect)(() => {
13347
+ (0, import_react77.useEffect)(() => {
13332
13348
  const onEscape = (e) => {
13333
13349
  const dial = dialRef.current;
13334
13350
  if (e.key !== "Escape" || !dial || !e.composedPath().includes(dial)) return;
@@ -13341,7 +13357,7 @@ function usePresetDial({ layerRef, dialRef, dialButtonRef, messages, isStreaming
13341
13357
  window.addEventListener("keydown", onEscape, true);
13342
13358
  return () => window.removeEventListener("keydown", onEscape, true);
13343
13359
  }, [dialRef, dialButtonRef]);
13344
- (0, import_react76.useEffect)(() => {
13360
+ (0, import_react77.useEffect)(() => {
13345
13361
  if (!expanded) return;
13346
13362
  const layer = layerRef.current;
13347
13363
  const inDial = (e) => {
@@ -13396,8 +13412,8 @@ function markToolSeen() {
13396
13412
  var import_jsx_runtime114 = require("react/jsx-runtime");
13397
13413
  var FULLSCREEN_QUERY = "(max-width: 639px)";
13398
13414
  function useIsModal() {
13399
- const [modal, setModal] = (0, import_react77.useState)(false);
13400
- (0, import_react77.useEffect)(() => {
13415
+ const [modal, setModal] = (0, import_react78.useState)(false);
13416
+ (0, import_react78.useEffect)(() => {
13401
13417
  if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
13402
13418
  const mql = window.matchMedia(FULLSCREEN_QUERY);
13403
13419
  const sync = () => setModal(mql.matches);
@@ -13411,12 +13427,12 @@ var HIDDEN_LAYER_STYLE = { position: "absolute", inset: 0, visibility: "hidden",
13411
13427
  var SQUAD_LAYER_STYLE = { display: "flex", flexDirection: "column", flex: 1, minHeight: 0 };
13412
13428
  function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, gamesResult, leaderboardResult, clubFixturesResult, clubStandingsResult, clubSquadResult, clubSquadStatsResult, clubPlayerDetailResult, loggedIn, conversation, presetGrid }) {
13413
13429
  const { state, close, stop, send, reset } = controller;
13414
- const [squadView, setSquadView] = (0, import_react77.useState)("roster");
13415
- const [selectedPlayerId, setSelectedPlayerId] = (0, import_react77.useState)(null);
13430
+ const [squadView, setSquadView] = (0, import_react78.useState)("roster");
13431
+ const [selectedPlayerId, setSelectedPlayerId] = (0, import_react78.useState)(null);
13416
13432
  const clearPlayerDetail = clubPlayerDetailResult?.clear;
13417
13433
  const fetchPlayerDetail = clubPlayerDetailResult?.fetch;
13418
- const squadLayerRef = (0, import_react77.useRef)(null);
13419
- const squadScrollRef = (0, import_react77.useRef)(null);
13434
+ const squadLayerRef = (0, import_react78.useRef)(null);
13435
+ const squadScrollRef = (0, import_react78.useRef)(null);
13420
13436
  const selectPlayer = (playerId) => {
13421
13437
  squadScrollRef.current = squadLayerRef.current?.querySelector(".ss-w-mon-list")?.scrollTop ?? null;
13422
13438
  setSelectedPlayerId(playerId);
@@ -13426,20 +13442,20 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
13426
13442
  setSelectedPlayerId(null);
13427
13443
  clearPlayerDetail?.();
13428
13444
  };
13429
- (0, import_react77.useLayoutEffect)(() => {
13445
+ (0, import_react78.useLayoutEffect)(() => {
13430
13446
  if (selectedPlayerId !== null || squadScrollRef.current === null) return;
13431
13447
  const list = squadLayerRef.current?.querySelector(".ss-w-mon-list");
13432
13448
  if (list) list.scrollTop = squadScrollRef.current;
13433
13449
  squadScrollRef.current = null;
13434
13450
  }, [selectedPlayerId]);
13435
13451
  const activeTab = monitor?.activeTab;
13436
- (0, import_react77.useEffect)(() => {
13452
+ (0, import_react78.useEffect)(() => {
13437
13453
  if (activeTab === "squad" || selectedPlayerId === null) return;
13438
13454
  setSelectedPlayerId(null);
13439
13455
  clearPlayerDetail?.();
13440
13456
  }, [activeTab, selectedPlayerId, clearPlayerDetail]);
13441
13457
  const isModal = useIsModal();
13442
- (0, import_react77.useEffect)(() => {
13458
+ (0, import_react78.useEffect)(() => {
13443
13459
  const onKey = (e) => {
13444
13460
  if (e.key === "Escape") close();
13445
13461
  };
@@ -13455,19 +13471,19 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
13455
13471
  monitor?.setActiveTab("chat");
13456
13472
  send(text, { grounding });
13457
13473
  };
13458
- (0, import_react77.useEffect)(() => {
13474
+ (0, import_react78.useEffect)(() => {
13459
13475
  if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
13460
13476
  }, [monitor, state.isStreaming, state.messages.length]);
13461
13477
  const onChatTab = !monitor || monitor.activeTab === "chat";
13462
- const layerRef = (0, import_react77.useRef)(null);
13463
- const dialRef = (0, import_react77.useRef)(null);
13464
- const dialButtonRef = (0, import_react77.useRef)(null);
13465
- const inputRef = (0, import_react77.useRef)(null);
13466
- const limitRef = (0, import_react77.useRef)(null);
13467
- const typedSendRef = (0, import_react77.useRef)(false);
13468
- const focusAfterCloseRef = (0, import_react77.useRef)(null);
13469
- const [tool, setTool] = (0, import_react77.useState)(null);
13470
- const [toolSeen, setToolSeen] = (0, import_react77.useState)(readToolSeen);
13478
+ const layerRef = (0, import_react78.useRef)(null);
13479
+ const dialRef = (0, import_react78.useRef)(null);
13480
+ const dialButtonRef = (0, import_react78.useRef)(null);
13481
+ const inputRef = (0, import_react78.useRef)(null);
13482
+ const limitRef = (0, import_react78.useRef)(null);
13483
+ const typedSendRef = (0, import_react78.useRef)(false);
13484
+ const focusAfterCloseRef = (0, import_react78.useRef)(null);
13485
+ const [tool, setTool] = (0, import_react78.useState)(null);
13486
+ const [toolSeen, setToolSeen] = (0, import_react78.useState)(readToolSeen);
13471
13487
  const dial = usePresetDial({
13472
13488
  layerRef,
13473
13489
  dialRef,
@@ -13479,47 +13495,47 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
13479
13495
  const { fold } = dial;
13480
13496
  const paused = isPaused(state.limit);
13481
13497
  const showDial = !!presetGrid && onChatTab && !tool && !paused;
13482
- (0, import_react77.useEffect)(() => {
13498
+ (0, import_react78.useEffect)(() => {
13483
13499
  if (paused) setTool(null);
13484
13500
  }, [paused]);
13485
- (0, import_react77.useEffect)(() => {
13501
+ (0, import_react78.useEffect)(() => {
13486
13502
  if (!paused) return;
13487
13503
  if (typedSendRef.current) limitRef.current?.focus();
13488
13504
  typedSendRef.current = false;
13489
13505
  }, [paused]);
13490
- const openTool = (0, import_react77.useCallback)((next) => {
13506
+ const openTool = (0, import_react78.useCallback)((next) => {
13491
13507
  fold();
13492
13508
  markToolSeen();
13493
13509
  setToolSeen(true);
13494
13510
  setTool(next);
13495
13511
  }, [fold]);
13496
- const onPill = (0, import_react77.useCallback)((kind) => openTool(kind === "numbers" ? { kind: "numbers" } : { kind: "combo" }), [openTool]);
13497
- const toolsValue = (0, import_react77.useMemo)(
13512
+ const onPill = (0, import_react78.useCallback)((kind) => openTool(kind === "numbers" ? { kind: "numbers" } : { kind: "combo" }), [openTool]);
13513
+ const toolsValue = (0, import_react78.useMemo)(
13498
13514
  () => presetGrid && !paused ? { openBuilder: (total, legs) => openTool({ kind: "combo", total, legs }), changeLabel: ui.presets.changeCombo } : null,
13499
13515
  [presetGrid, paused, openTool, ui.presets.changeCombo]
13500
13516
  );
13501
- const closeTool = (0, import_react77.useCallback)(() => {
13517
+ const closeTool = (0, import_react78.useCallback)(() => {
13502
13518
  focusAfterCloseRef.current = "dial";
13503
13519
  setTool(null);
13504
13520
  }, []);
13505
- const sendAsk = (0, import_react77.useCallback)((ask) => {
13521
+ const sendAsk = (0, import_react78.useCallback)((ask) => {
13506
13522
  focusAfterCloseRef.current = "composer";
13507
13523
  setTool(null);
13508
13524
  monitor?.setActiveTab("chat");
13509
13525
  send(ask.message, { displayText: ask.displayText, preset: ask.preset });
13510
13526
  }, [monitor, send]);
13511
- const formatKickoff = (0, import_react77.useCallback)((kickoffUtc) => {
13527
+ const formatKickoff = (0, import_react78.useCallback)((kickoffUtc) => {
13512
13528
  const k = ui.bettingKickoff(kickoffUtc);
13513
13529
  return `${k.dayLabel} ${k.time}`;
13514
13530
  }, [ui]);
13515
- (0, import_react77.useEffect)(() => {
13531
+ (0, import_react78.useEffect)(() => {
13516
13532
  if (tool) return;
13517
13533
  const target = focusAfterCloseRef.current;
13518
13534
  focusAfterCloseRef.current = null;
13519
13535
  if (target === "dial") dialButtonRef.current?.focus();
13520
13536
  else if (target === "composer") inputRef.current?.focus();
13521
13537
  }, [tool]);
13522
- (0, import_react77.useEffect)(() => {
13538
+ (0, import_react78.useEffect)(() => {
13523
13539
  if (!tool || onChatTab && presetGrid) return;
13524
13540
  focusAfterCloseRef.current = "composer";
13525
13541
  setTool(null);
@@ -15894,28 +15910,28 @@ function injectStyles(root) {
15894
15910
  function StatsWidget(props) {
15895
15911
  const injectedClient = "client" in props ? props.client : void 0;
15896
15912
  const cfg = props.config;
15897
- const built = (0, import_react78.useMemo)(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
15898
- const logger = (0, import_react78.useMemo)(
15913
+ const built = (0, import_react79.useMemo)(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
15914
+ const logger = (0, import_react79.useMemo)(
15899
15915
  () => built ? built.client.createEventLogger({
15900
15916
  operatorUserId: cfg?.userContext?.operatorUserId,
15901
15917
  anonymousUserId: cfg?.userContext?.anonymousUserId
15902
15918
  }) : null,
15903
15919
  [built?.client]
15904
15920
  );
15905
- const ui = (0, import_react78.useMemo)(() => normalizeUi(props.config ?? { operatorId: "", publicKey: "" }), [props.config]);
15906
- const rootRef = (0, import_react78.useRef)(null);
15907
- const introDoneRef = (0, import_react78.useRef)(false);
15908
- const markIntroDone = (0, import_react78.useCallback)(() => {
15921
+ const ui = (0, import_react79.useMemo)(() => normalizeUi(props.config ?? { operatorId: "", publicKey: "" }), [props.config]);
15922
+ const rootRef = (0, import_react79.useRef)(null);
15923
+ const introDoneRef = (0, import_react79.useRef)(false);
15924
+ const markIntroDone = (0, import_react79.useCallback)(() => {
15909
15925
  introDoneRef.current = true;
15910
15926
  }, []);
15911
15927
  const convStorageKey = `ss-w-conv:${cfg?.operatorId ?? ""}:${cfg?.userContext?.operatorUserId ?? "anon"}`;
15912
- const sportScope = (0, import_react78.useMemo)(
15928
+ const sportScope = (0, import_react79.useMemo)(
15913
15929
  () => ({ operatorId: cfg?.operatorId ?? "", operatorUserId: cfg?.userContext?.operatorUserId, anonymousUserId: cfg?.userContext?.anonymousUserId }),
15914
15930
  [cfg?.operatorId, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId]
15915
15931
  );
15916
15932
  const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey, cfg?.page, sportScope);
15917
- const [hasToday, setHasToday] = (0, import_react78.useState)(false);
15918
- const liveCardWatches = (0, import_react78.useMemo)(() => {
15933
+ const [hasToday, setHasToday] = (0, import_react79.useState)(false);
15934
+ const liveCardWatches = (0, import_react79.useMemo)(() => {
15919
15935
  const seen = /* @__PURE__ */ new Set();
15920
15936
  const out = [];
15921
15937
  for (const msg of controller.state.messages) {
@@ -15942,19 +15958,19 @@ function StatsWidget(props) {
15942
15958
  });
15943
15959
  const operatorUserId = cfg?.userContext?.operatorUserId;
15944
15960
  const anonymousUserId = cfg?.userContext?.anonymousUserId;
15945
- const getSchedule = (0, import_react78.useCallback)(
15961
+ const getSchedule = (0, import_react79.useCallback)(
15946
15962
  (localDate, utcOffsetMinutes) => built ? built.conversation.getSchedule(localDate, utcOffsetMinutes, operatorUserId, anonymousUserId) : Promise.resolve(null),
15947
15963
  [built, operatorUserId, anonymousUserId]
15948
15964
  );
15949
- const postLeagueStar = (0, import_react78.useCallback)(
15965
+ const postLeagueStar = (0, import_react79.useCallback)(
15950
15966
  (competitionId, starred) => built ? built.conversation.starLeague(competitionId, starred, operatorUserId, anonymousUserId) : Promise.resolve(null),
15951
15967
  [built, operatorUserId, anonymousUserId]
15952
15968
  );
15953
- const getStates = (0, import_react78.useCallback)(
15954
- (matchIds, nbaGameIds) => built ? built.conversation.getStates(matchIds, nbaGameIds) : Promise.resolve(null),
15969
+ const getStates = (0, import_react79.useCallback)(
15970
+ (matchIds, nbaGameIds, nflGameIds) => built ? built.conversation.getStates(matchIds, nbaGameIds, nflGameIds) : Promise.resolve(null),
15955
15971
  [built]
15956
15972
  );
15957
- const pinnedMatchIds = (0, import_react78.useMemo)(
15973
+ const pinnedMatchIds = (0, import_react79.useMemo)(
15958
15974
  () => footballMatchPinIds(monitor.pins),
15959
15975
  [monitor.pins]
15960
15976
  );
@@ -15969,11 +15985,11 @@ function StatsWidget(props) {
15969
15985
  pinnedMatchIds
15970
15986
  });
15971
15987
  const todayHasContent = visibleGroupsOf(discovery.groups, discovery.states).length > 0;
15972
- (0, import_react78.useEffect)(() => {
15988
+ (0, import_react79.useEffect)(() => {
15973
15989
  setHasToday(todayHasContent);
15974
15990
  }, [todayHasContent]);
15975
- const prevLiveSnapshotRef = (0, import_react78.useRef)(monitor.snapshot);
15976
- (0, import_react78.useEffect)(() => {
15991
+ const prevLiveSnapshotRef = (0, import_react79.useRef)(monitor.snapshot);
15992
+ (0, import_react79.useEffect)(() => {
15977
15993
  const snap = monitor.snapshot;
15978
15994
  if (!snap || snap === prevLiveSnapshotRef.current) return;
15979
15995
  prevLiveSnapshotRef.current = snap;
@@ -16013,14 +16029,14 @@ function StatsWidget(props) {
16013
16029
  const clubSquadResult = useClubSquad(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
16014
16030
  const clubSquadStatsResult = useClubSquadStats(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
16015
16031
  const clubPlayerDetailResult = useClubPlayerDetail(built?.conversation ?? null);
16016
- const getPricePresets = (0, import_react78.useCallback)(
16032
+ const getPricePresets = (0, import_react79.useCallback)(
16017
16033
  (locale2) => built ? built.conversation.getPricePresets(locale2, { pool: "open" }) : Promise.resolve(null),
16018
16034
  [built]
16019
16035
  );
16020
16036
  const presetGrid = usePresetGrid({ getPricePresets, isOpen: controller.state.isOpen, locale: ui.presets.lang });
16021
16037
  const markTodayActivity = monitor.markTodayActivity;
16022
- const prevLiveCountRef = (0, import_react78.useRef)(0);
16023
- (0, import_react78.useEffect)(() => {
16038
+ const prevLiveCountRef = (0, import_react79.useRef)(0);
16039
+ (0, import_react79.useEffect)(() => {
16024
16040
  const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
16025
16041
  prevLiveCountRef.current = discovery.liveCount;
16026
16042
  if (rose) markTodayActivity();
@@ -16034,7 +16050,7 @@ function StatsWidget(props) {
16034
16050
  closePanel: controller.close
16035
16051
  });
16036
16052
  const markAdded = hostEvents.markAdded;
16037
- const slip = (0, import_react78.useMemo)(
16053
+ const slip = (0, import_react79.useMemo)(
16038
16054
  () => {
16039
16055
  const handler = props.config?.onAddToSlip;
16040
16056
  return {
@@ -16054,7 +16070,7 @@ function StatsWidget(props) {
16054
16070
  },
16055
16071
  [props.config?.onAddToSlip, props.config?.slipSports, controller.state.conversationId, markAdded]
16056
16072
  );
16057
- const onDashboardTap = (0, import_react78.useMemo)(
16073
+ const onDashboardTap = (0, import_react79.useMemo)(
16058
16074
  () => built ? createDashboardTapSignal((input) => built.conversation.sendSignal(input), logger) : void 0,
16059
16075
  [built, logger]
16060
16076
  );
@@ -16071,11 +16087,11 @@ function StatsWidget(props) {
16071
16087
  })
16072
16088
  }));
16073
16089
  const conversationId = controller.state.conversationId ?? void 0;
16074
- (0, import_react78.useEffect)(() => {
16090
+ (0, import_react79.useEffect)(() => {
16075
16091
  if (!logger) return;
16076
16092
  logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
16077
16093
  }, [logger, operatorUserId, anonymousUserId, conversationId]);
16078
- (0, import_react78.useEffect)(() => {
16094
+ (0, import_react79.useEffect)(() => {
16079
16095
  if (!logger) return;
16080
16096
  logger.resume();
16081
16097
  const onHide = () => {
@@ -16093,7 +16109,7 @@ function StatsWidget(props) {
16093
16109
  logger.dispose();
16094
16110
  };
16095
16111
  }, [logger]);
16096
- (0, import_react78.useEffect)(() => {
16112
+ (0, import_react79.useEffect)(() => {
16097
16113
  if (!built || !ui.injectStyles) return;
16098
16114
  const node = rootRef.current?.getRootNode();
16099
16115
  if (node) injectStyles(node);