@sensiblestats/widget-react 0.155.0 → 0.157.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
@@ -38,7 +38,7 @@ __export(index_exports, {
38
38
  module.exports = __toCommonJS(index_exports);
39
39
 
40
40
  // src/StatsWidget.tsx
41
- var import_react123 = require("react");
41
+ var import_react124 = require("react");
42
42
  var import_widget_sdk39 = require("@sensiblestats/widget-sdk");
43
43
 
44
44
  // src/strings/tag.ts
@@ -1422,7 +1422,7 @@ function parseCustomTotal(text2, format2) {
1422
1422
  }
1423
1423
 
1424
1424
  // src/version.generated.ts
1425
- var WIDGET_REACT_VERSION = "0.155.0";
1425
+ var WIDGET_REACT_VERSION = "0.157.0";
1426
1426
 
1427
1427
  // src/config.ts
1428
1428
  var COLOR_KEYS = ["accent", "cta", "surface", "ink"];
@@ -2841,7 +2841,7 @@ function isValidId(value) {
2841
2841
  return typeof value === "number" && Number.isSafeInteger(value) && value > 0;
2842
2842
  }
2843
2843
  function createWidgetHost() {
2844
- const state = { queue: [], sink: null };
2844
+ const state = { queue: [], sink: null, teaser: null };
2845
2845
  const dispatch = (command) => {
2846
2846
  if (state.sink) {
2847
2847
  state.sink(command);
@@ -2887,11 +2887,49 @@ function createWidgetHost() {
2887
2887
  if (isValidId(id)) dispatch({ kind: "matchOpened", matchId: id });
2888
2888
  } catch {
2889
2889
  }
2890
+ },
2891
+ // A teaser tap is about what is on screen now, so it is never queued for a widget that is not there.
2892
+ tapAsk(index) {
2893
+ teaser(state, (t) => t.tapAsk(index));
2894
+ },
2895
+ tapPrice() {
2896
+ try {
2897
+ return state.teaser ? state.teaser.tapPrice().catch(() => null) : Promise.resolve(null);
2898
+ } catch {
2899
+ return Promise.resolve(null);
2900
+ }
2901
+ },
2902
+ tapCta() {
2903
+ teaser(state, (t) => t.tapCta());
2904
+ },
2905
+ tapTeaser() {
2906
+ teaser(state, (t) => t.tapTeaser());
2907
+ },
2908
+ dismissTeaser() {
2909
+ teaser(state, (t) => t.dismissTeaser());
2910
+ },
2911
+ teaserShown() {
2912
+ teaser(state, (t) => t.teaserShown());
2890
2913
  }
2891
2914
  };
2892
2915
  STATES.set(host, state);
2893
2916
  return host;
2894
2917
  }
2918
+ function teaser(state, call) {
2919
+ try {
2920
+ if (state.teaser) call(state.teaser);
2921
+ } catch {
2922
+ }
2923
+ }
2924
+ function attachTeaser(host, control) {
2925
+ const state = STATES.get(host);
2926
+ if (!state) return () => {
2927
+ };
2928
+ state.teaser = control;
2929
+ return () => {
2930
+ if (state.teaser === control) state.teaser = null;
2931
+ };
2932
+ }
2895
2933
  function attachHost(host, sink) {
2896
2934
  const state = STATES.get(host);
2897
2935
  if (!state) return () => {
@@ -3127,6 +3165,12 @@ function useHostEvents(opts) {
3127
3165
  const { host, operatorId, currentUser, logger, isOpen, closePanel } = opts;
3128
3166
  const [added, setAdded] = (0, import_react2.useState)({});
3129
3167
  const [settled, setSettled] = (0, import_react2.useState)({});
3168
+ const [marksUser, setMarksUser] = (0, import_react2.useState)(currentUser);
3169
+ if (marksUser !== currentUser) {
3170
+ setMarksUser(currentUser);
3171
+ setAdded({});
3172
+ setSettled({});
3173
+ }
3130
3174
  const markAdded = (0, import_react2.useCallback)((key) => {
3131
3175
  setAdded((prev) => prev[key] ? prev : { ...prev, [key]: true });
3132
3176
  }, []);
@@ -4742,7 +4786,13 @@ function phaseForPin(snapshot, pin) {
4742
4786
  function useLiveMonitor(opts) {
4743
4787
  const sessionIdRef = (0, import_react8.useRef)(crypto.randomUUID());
4744
4788
  const [pins, setPins] = (0, import_react8.useState)([]);
4745
- const [store] = (0, import_react8.useState)(() => createPinStore(opts.storageKey, sessionIdRef.current, setPins));
4789
+ const [owned, setOwned] = (0, import_react8.useState)(() => ({ key: opts.storageKey, store: createPinStore(opts.storageKey, sessionIdRef.current, setPins) }));
4790
+ let current = owned;
4791
+ if (owned.key !== opts.storageKey) {
4792
+ current = { key: opts.storageKey, store: createPinStore(opts.storageKey, sessionIdRef.current, setPins) };
4793
+ setOwned(current);
4794
+ }
4795
+ const store = current.store;
4746
4796
  const [enabled, setEnabled] = (0, import_react8.useState)(true);
4747
4797
  const [snapshot, setSnapshotState] = (0, import_react8.useState)(null);
4748
4798
  const { activeTab, setActiveTab: setActiveTabState } = useTabs("chat");
@@ -8397,8 +8447,9 @@ function useMobileBinding(args) {
8397
8447
  tapTeaser: () => latest.current.onTeaserTap(),
8398
8448
  tapPrice: (matchOddsId) => {
8399
8449
  const { panelOpen: open, popupText: text2, price: shown2 } = latest.current;
8400
- if (open || !text2 || shown2?.matchOddsId !== matchOddsId) return;
8401
- priceRef.current?.();
8450
+ if (open || !text2 || shown2?.matchOddsId !== matchOddsId || !priceRef.current) return false;
8451
+ priceRef.current();
8452
+ return true;
8402
8453
  },
8403
8454
  dismissTeaser: () => latest.current.dismissPopup(),
8404
8455
  teaserShown: () => setConfirmedShown(latest.current.popupText),
@@ -8406,6 +8457,14 @@ function useMobileBinding(args) {
8406
8457
  });
8407
8458
  return () => binding.onHandle(null);
8408
8459
  }, [binding]);
8460
+ const { labels, theme } = args;
8461
+ const labelsKey = labels ? JSON.stringify([labels.launcher, labels.dismiss]) : "";
8462
+ (0, import_react56.useEffect)(() => {
8463
+ if (labels) binding?.onLabels?.(labels);
8464
+ }, [binding, labelsKey]);
8465
+ (0, import_react56.useEffect)(() => {
8466
+ if (theme) binding?.onTheme?.(theme);
8467
+ }, [binding, theme]);
8409
8468
  const onCloseRequested = (0, import_react56.useCallback)(() => bindingRef.current?.onCloseRequested(), []);
8410
8469
  const onRegisterBack = (0, import_react56.useCallback)((fn) => {
8411
8470
  backRef.current = fn;
@@ -8418,11 +8477,96 @@ function useMobileBinding(args) {
8418
8477
  return { confirmedShown, onCloseRequested, onRegisterBack, onRegisterPrice, onPriceResult, priceInFlight };
8419
8478
  }
8420
8479
 
8421
- // src/openTelemetry.ts
8480
+ // src/webTeaser.ts
8481
+ function webTeaserBinding(host, deliver, drawsLauncher) {
8482
+ let price;
8483
+ let delivered = null;
8484
+ let detach = () => {
8485
+ };
8486
+ const waiting = /* @__PURE__ */ new Set();
8487
+ const emit = (teaser2) => {
8488
+ delivered = teaser2;
8489
+ try {
8490
+ deliver(teaser2);
8491
+ } catch {
8492
+ }
8493
+ };
8494
+ return {
8495
+ onTeaser: (teaser2) => {
8496
+ price = teaser2.price;
8497
+ emit(teaser2.text === null && teaser2.asks.length === 0 ? null : teaser2);
8498
+ },
8499
+ onCloseRequested: () => {
8500
+ },
8501
+ onPriceResult: (result) => {
8502
+ for (const w of [...waiting]) {
8503
+ if (w.matchOddsId !== result.matchOddsId) continue;
8504
+ waiting.delete(w);
8505
+ w.resolve(result);
8506
+ }
8507
+ },
8508
+ onHandle: (handle) => {
8509
+ detach();
8510
+ detach = () => {
8511
+ };
8512
+ if (!handle) {
8513
+ price = void 0;
8514
+ for (const w of [...waiting]) w.resolve(null);
8515
+ waiting.clear();
8516
+ if (delivered !== null) emit(null);
8517
+ return;
8518
+ }
8519
+ if (!host || !drawsLauncher) return;
8520
+ detach = attachTeaser(host, {
8521
+ tapAsk: handle.tapAsk,
8522
+ tapCta: handle.tapCta,
8523
+ tapTeaser: handle.tapTeaser,
8524
+ dismissTeaser: handle.dismissTeaser,
8525
+ teaserShown: handle.teaserShown,
8526
+ tapPrice: () => {
8527
+ if (!price) return Promise.resolve(null);
8528
+ const matchOddsId = price.matchOddsId;
8529
+ return new Promise((resolve) => {
8530
+ const w = { matchOddsId, resolve };
8531
+ waiting.add(w);
8532
+ if (!handle.tapPrice(matchOddsId)) {
8533
+ waiting.delete(w);
8534
+ resolve(null);
8535
+ }
8536
+ });
8537
+ }
8538
+ });
8539
+ }
8540
+ };
8541
+ }
8542
+
8543
+ // src/resolvedTheme.ts
8422
8544
  var import_react57 = require("react");
8545
+ var QUERY = "(prefers-color-scheme: dark)";
8546
+ function systemDark() {
8547
+ try {
8548
+ return typeof window.matchMedia === "function" && window.matchMedia(QUERY).matches;
8549
+ } catch {
8550
+ return false;
8551
+ }
8552
+ }
8553
+ function subscribe(onChange) {
8554
+ if (typeof window.matchMedia !== "function") return () => {
8555
+ };
8556
+ const query = window.matchMedia(QUERY);
8557
+ query.addEventListener("change", onChange);
8558
+ return () => query.removeEventListener("change", onChange);
8559
+ }
8560
+ function useResolvedTheme(choice) {
8561
+ const dark = (0, import_react57.useSyncExternalStore)(subscribe, systemDark, () => false);
8562
+ return choice === "auto" ? dark ? "dark" : "light" : choice;
8563
+ }
8564
+
8565
+ // src/openTelemetry.ts
8566
+ var import_react58 = require("react");
8423
8567
  function useOpenTelemetry(log, isOpen) {
8424
- const openLoggedRef = (0, import_react57.useRef)(false);
8425
- (0, import_react57.useEffect)(() => {
8568
+ const openLoggedRef = (0, import_react58.useRef)(false);
8569
+ (0, import_react58.useEffect)(() => {
8426
8570
  if (!isOpen) {
8427
8571
  openLoggedRef.current = false;
8428
8572
  return;
@@ -8434,13 +8578,13 @@ function useOpenTelemetry(log, isOpen) {
8434
8578
  }
8435
8579
 
8436
8580
  // src/components/ChatFab.tsx
8437
- var import_react59 = require("react");
8581
+ var import_react60 = require("react");
8438
8582
 
8439
8583
  // src/components/BrandMark.tsx
8440
- var import_react58 = require("react");
8584
+ var import_react59 = require("react");
8441
8585
  var import_jsx_runtime34 = require("react/jsx-runtime");
8442
8586
  function BrandMark({ logoUrl, className }) {
8443
- const [failed, setFailed] = (0, import_react58.useState)(false);
8587
+ const [failed, setFailed] = (0, import_react59.useState)(false);
8444
8588
  if (!logoUrl || failed) return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SsMark, { className });
8445
8589
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("img", { className, src: logoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
8446
8590
  }
@@ -8484,9 +8628,9 @@ function ChatFab({ label, busy = false, greeting, popupText, logoUrl, onOpen, on
8484
8628
  const bubble = popupText ?? greeting;
8485
8629
  const hidden = busy && !label;
8486
8630
  const track = useTrack();
8487
- const [intro, setIntro] = (0, import_react59.useState)(false);
8488
- const armedRef = (0, import_react59.useRef)(introAllowed);
8489
- (0, import_react59.useEffect)(() => {
8631
+ const [intro, setIntro] = (0, import_react60.useState)(false);
8632
+ const armedRef = (0, import_react60.useRef)(introAllowed);
8633
+ (0, import_react60.useEffect)(() => {
8490
8634
  if (armedRef.current && bubble) {
8491
8635
  armedRef.current = false;
8492
8636
  setIntro(true);
@@ -8507,23 +8651,23 @@ function ChatFab({ label, busy = false, greeting, popupText, logoUrl, onOpen, on
8507
8651
  }
8508
8652
 
8509
8653
  // src/components/BubblePrice.tsx
8510
- var import_react60 = require("react");
8654
+ var import_react61 = require("react");
8511
8655
  var import_jsx_runtime37 = require("react/jsx-runtime");
8512
8656
  function BubblePrice({ matchId, price, conversation, slip, ui, hook, sport }) {
8513
- const selections = (0, import_react60.useMemo)(() => [price.selection], [price.selection]);
8657
+ const selections = (0, import_react61.useMemo)(() => [price.selection], [price.selection]);
8514
8658
  const add = useRepriceAdd({ conversation, locale: ui.hostTag, slip, ui, sport });
8515
8659
  return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "ss-w-greeting-pick", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(PriceButtons, { selections, ui, rowLabel: price.label || price.selection.label, sport, onAdd: add ? (s) => add(matchId, price.market, s, hook) : void 0 }) });
8516
8660
  }
8517
8661
 
8518
8662
  // src/components/MobileBubblePrice.tsx
8519
- var import_react61 = require("react");
8663
+ var import_react62 = require("react");
8520
8664
  function MobileBubblePrice(props) {
8521
8665
  const add = useRepriceAdd({ conversation: props.conversation, locale: props.ui.hostTag, slip: props.slip, ui: props.ui, sport: props.sport });
8522
8666
  const marks = useSettledMarks();
8523
- const latest = (0, import_react61.useRef)({ props, add, marks });
8667
+ const latest = (0, import_react62.useRef)({ props, add, marks });
8524
8668
  latest.current = { props, add, marks };
8525
8669
  const { onRegister, inFlight: inFlight2 } = props;
8526
- (0, import_react61.useEffect)(() => {
8670
+ (0, import_react62.useEffect)(() => {
8527
8671
  onRegister(() => {
8528
8672
  const { props: p, add: run, marks: m } = latest.current;
8529
8673
  const id = p.price.selection.matchOddsId;
@@ -8559,10 +8703,10 @@ function MobileBubblePrice(props) {
8559
8703
  }
8560
8704
 
8561
8705
  // src/components/ChatPanel.tsx
8562
- var import_react122 = require("react");
8706
+ var import_react123 = require("react");
8563
8707
 
8564
8708
  // src/components/ChatHeader.tsx
8565
- var import_react62 = require("react");
8709
+ var import_react63 = require("react");
8566
8710
  var import_jsx_runtime38 = require("react/jsx-runtime");
8567
8711
  function ChatHeader({
8568
8712
  onClose,
@@ -8578,18 +8722,18 @@ function ChatHeader({
8578
8722
  onOpenFavourites,
8579
8723
  favouritesLabel
8580
8724
  }) {
8581
- const [menuOpen, setMenuOpen] = (0, import_react62.useState)(false);
8582
- const wrapRef = (0, import_react62.useRef)(null);
8583
- const kebabRef = (0, import_react62.useRef)(null);
8584
- const firstItemRef = (0, import_react62.useRef)(null);
8725
+ const [menuOpen, setMenuOpen] = (0, import_react63.useState)(false);
8726
+ const wrapRef = (0, import_react63.useRef)(null);
8727
+ const kebabRef = (0, import_react63.useRef)(null);
8728
+ const firstItemRef = (0, import_react63.useRef)(null);
8585
8729
  const hasNew = !!(canReset && onNewConversation);
8586
8730
  const hasSettings = !!onOpenSettings;
8587
8731
  const hasFavourites = !!onOpenFavourites;
8588
8732
  const hasMenu = hasFavourites || hasNew || hasSettings;
8589
- (0, import_react62.useEffect)(() => {
8733
+ (0, import_react63.useEffect)(() => {
8590
8734
  if (menuOpen) firstItemRef.current?.focus();
8591
8735
  }, [menuOpen]);
8592
- (0, import_react62.useEffect)(() => {
8736
+ (0, import_react63.useEffect)(() => {
8593
8737
  if (!menuOpen) return;
8594
8738
  const onPointer = (e) => {
8595
8739
  if (!(wrapRef.current && e.composedPath().includes(wrapRef.current))) setMenuOpen(false);
@@ -8677,10 +8821,10 @@ function ChatHeader({
8677
8821
  }
8678
8822
 
8679
8823
  // src/components/MessageList.tsx
8680
- var import_react77 = require("react");
8824
+ var import_react78 = require("react");
8681
8825
 
8682
8826
  // src/components/ChatMessage.tsx
8683
- var import_react76 = require("react");
8827
+ var import_react77 = require("react");
8684
8828
 
8685
8829
  // src/components/Markdown.tsx
8686
8830
  var import_react_markdown = __toESM(require("react-markdown"), 1);
@@ -8698,7 +8842,7 @@ function Markdown({ text: text2 }) {
8698
8842
  }
8699
8843
 
8700
8844
  // src/components/EntityCardList.tsx
8701
- var import_react63 = require("react");
8845
+ var import_react64 = require("react");
8702
8846
  var import_jsx_runtime40 = require("react/jsx-runtime");
8703
8847
  var MAX_VISIBLE = 3;
8704
8848
  var RECORD_RE = /^(\d+)-(\d+)-(\d+)$/;
@@ -8801,7 +8945,7 @@ function ScopeTabs({ scopes, active, onSelect }) {
8801
8945
  )) });
8802
8946
  }
8803
8947
  function EntityCardItem({ c }) {
8804
- const [active, setActive] = (0, import_react63.useState)(0);
8948
+ const [active, setActive] = (0, import_react64.useState)(0);
8805
8949
  const hasBody = c.scopes.length > 0;
8806
8950
  if (!hasBody) {
8807
8951
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "ss-w-ecard ss-w-ecard-bare", "data-kind": c.kind, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CardHeader, { c, showScopeCrest: false }) });
@@ -8816,7 +8960,7 @@ function EntityCardItem({ c }) {
8816
8960
  ] });
8817
8961
  }
8818
8962
  function EntityCardList({ cards, disabled, showLessLabel, showMoreLabel }) {
8819
- const [expanded, setExpanded] = (0, import_react63.useState)(false);
8963
+ const [expanded, setExpanded] = (0, import_react64.useState)(false);
8820
8964
  if (cards.length === 0) return null;
8821
8965
  const visible = expanded ? cards : cards.slice(0, MAX_VISIBLE);
8822
8966
  const overflow = cards.length - MAX_VISIBLE;
@@ -8965,20 +9109,20 @@ function BettingInsightList({ insights, ui, slip, monitor }) {
8965
9109
  }
8966
9110
 
8967
9111
  // src/components/ComboCardList.tsx
8968
- var import_react66 = require("react");
9112
+ var import_react67 = require("react");
8969
9113
 
8970
9114
  // src/components/AddAllToSlipButton.tsx
8971
- var import_react64 = require("react");
9115
+ var import_react65 = require("react");
8972
9116
  var import_jsx_runtime43 = require("react/jsx-runtime");
8973
9117
  function AddAllToSlipButton({ legs, slip, ui, labels, combo, chatCombo, sizeless, hold, onStartedGame }) {
8974
9118
  const add = useSlipAdd(slip, ui);
8975
9119
  const slipState = useSlipState();
8976
9120
  const log = useEventLog();
8977
9121
  const track = useTrack();
8978
- const [pending, setPending] = (0, import_react64.useState)(false);
8979
- const [settledLocal, setSettledLocal] = (0, import_react64.useState)({});
8980
- const [toast, setToast] = (0, import_react64.useState)(null);
8981
- const dismiss = (0, import_react64.useCallback)(() => setToast(null), []);
9122
+ const [pending, setPending] = (0, import_react65.useState)(false);
9123
+ const [settledLocal, setSettledLocal] = (0, import_react65.useState)({});
9124
+ const [toast, setToast] = (0, import_react65.useState)(null);
9125
+ const dismiss = (0, import_react65.useCallback)(() => setToast(null), []);
8982
9126
  if (!slip.onAddToSlip || legs.length < 2) return null;
8983
9127
  const settled = slipState ? slipState.settled : settledLocal;
8984
9128
  const open = legs.filter((leg) => !settled[slipKey(leg)]);
@@ -9051,10 +9195,10 @@ function AddAllToSlipButton({ legs, slip, ui, labels, combo, chatCombo, sizeless
9051
9195
  }
9052
9196
 
9053
9197
  // src/presetToolsContext.ts
9054
- var import_react65 = require("react");
9055
- var PresetToolsContext = (0, import_react65.createContext)(null);
9198
+ var import_react66 = require("react");
9199
+ var PresetToolsContext = (0, import_react66.createContext)(null);
9056
9200
  function usePresetTools() {
9057
- return (0, import_react65.useContext)(PresetToolsContext);
9201
+ return (0, import_react66.useContext)(PresetToolsContext);
9058
9202
  }
9059
9203
 
9060
9204
  // src/components/ComboCardList.tsx
@@ -9068,7 +9212,7 @@ function ComboLegRow({ leg, addToSlipEnabled, ui, slip, monitor, hold, closed, s
9068
9212
  const showPin = !!monitor && leg.pinEnabled;
9069
9213
  const factText = leg.fact ? (leg.fact.direction === "over" ? ui.presets.legFactOver : ui.presets.legFactUnder)(leg.fact.hits, leg.fact.games) : void 0;
9070
9214
  const line = leg.statText ?? factText;
9071
- const noteId = (0, import_react66.useId)();
9215
+ const noteId = (0, import_react67.useId)();
9072
9216
  return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("li", { className: "ss-w-combo-leg", children: [
9073
9217
  leg.competition || kickoff || showPin ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "ss-w-combo-leg-meta", children: [
9074
9218
  /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "ss-w-bi-comp", children: leg.competition ?? "" }),
@@ -9692,7 +9836,7 @@ function NbaInsightList({ insights, ui, slip, monitor }) {
9692
9836
  }
9693
9837
 
9694
9838
  // src/components/NflInsightList.tsx
9695
- var import_react67 = require("react");
9839
+ var import_react68 = require("react");
9696
9840
 
9697
9841
  // src/strings/types.ts
9698
9842
  var fillNfl = (template, values) => template.replace(/\{(\w+)\}/g, (whole, key) => key in values ? String(values[key]) : whole);
@@ -9709,7 +9853,7 @@ function teamImage(vm, abbr) {
9709
9853
  return void 0;
9710
9854
  }
9711
9855
  function Badge({ abbr, url }) {
9712
- const [failed, setFailed] = (0, import_react67.useState)(false);
9856
+ const [failed, setFailed] = (0, import_react68.useState)(false);
9713
9857
  if (url && !failed) {
9714
9858
  return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("img", { className: "ss-w-nfl-badge ss-w-nfl-badge--img", src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
9715
9859
  }
@@ -10320,7 +10464,7 @@ function TennisInsightList({ insights, ui }) {
10320
10464
  }
10321
10465
 
10322
10466
  // src/components/CompactOddsList.tsx
10323
- var import_react68 = require("react");
10467
+ var import_react69 = require("react");
10324
10468
  var import_widget_sdk23 = require("@sensiblestats/widget-sdk");
10325
10469
 
10326
10470
  // src/compactList.ts
@@ -10442,11 +10586,11 @@ function Row2({ row, columns, ui, slip, monitor, rowRef }) {
10442
10586
  ] });
10443
10587
  }
10444
10588
  function CompactOddsList({ list, ui, slip, monitor }) {
10445
- const [shown2, setShown] = (0, import_react68.useState)(COMPACT_PAGE);
10589
+ const [shown2, setShown] = (0, import_react69.useState)(COMPACT_PAGE);
10446
10590
  const hidden = list.rowCount - shown2;
10447
- const [focusIndex, setFocusIndex] = (0, import_react68.useState)(null);
10448
- const focusRef = (0, import_react68.useRef)(null);
10449
- (0, import_react68.useEffect)(() => {
10591
+ const [focusIndex, setFocusIndex] = (0, import_react69.useState)(null);
10592
+ const focusRef = (0, import_react69.useRef)(null);
10593
+ (0, import_react69.useEffect)(() => {
10450
10594
  if (focusIndex !== null) focusRef.current?.focus();
10451
10595
  }, [focusIndex]);
10452
10596
  let left = shown2;
@@ -10718,7 +10862,7 @@ function FixtureCard({ card, ui }) {
10718
10862
  }
10719
10863
 
10720
10864
  // src/components/dashboard/CountdownCard.tsx
10721
- var import_react69 = require("react");
10865
+ var import_react70 = require("react");
10722
10866
  var import_jsx_runtime54 = require("react/jsx-runtime");
10723
10867
  var DAY_MS3 = 864e5;
10724
10868
  function remainingSegments(kickoffUnix, nowMs, withSeconds) {
@@ -10737,12 +10881,12 @@ function remainingSegments(kickoffUnix, nowMs, withSeconds) {
10737
10881
  function CountdownCard({ card, ui }) {
10738
10882
  const { data } = card;
10739
10883
  const unitLabel = { d: data.daysUnit, h: data.hoursUnit, m: data.minutesUnit, s: data.secondsUnit };
10740
- const [nowMs, setNowMs] = (0, import_react69.useState)(() => Date.now());
10741
- const [reduced] = (0, import_react69.useState)(
10884
+ const [nowMs, setNowMs] = (0, import_react70.useState)(() => Date.now());
10885
+ const [reduced] = (0, import_react70.useState)(
10742
10886
  () => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches
10743
10887
  );
10744
10888
  const withinDay = data.kickoffUnix * 1e3 - nowMs < DAY_MS3;
10745
- (0, import_react69.useEffect)(() => {
10889
+ (0, import_react70.useEffect)(() => {
10746
10890
  if (reduced) return;
10747
10891
  const id = window.setInterval(() => setNowMs(Date.now()), withinDay ? 1e3 : 6e4);
10748
10892
  return () => window.clearInterval(id);
@@ -10750,7 +10894,7 @@ function CountdownCard({ card, ui }) {
10750
10894
  const segments = remainingSegments(data.kickoffUnix, nowMs, withinDay && !reduced);
10751
10895
  return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "ss-w-fandash-card ss-w-fandash-countdown", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "ss-w-fandash-countdown-top", children: [
10752
10896
  /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "ss-w-fandash-eyebrow", children: card.title ?? ui.countdownTitle }),
10753
- segments ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "ss-w-fandash-countdown-clock", children: segments.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_react69.Fragment, { children: [
10897
+ segments ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "ss-w-fandash-countdown-clock", children: segments.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_react70.Fragment, { children: [
10754
10898
  i > 0 ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "ss-w-fandash-countdown-colon", children: ":" }) : null,
10755
10899
  /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "ss-w-fandash-countdown-seg", children: [
10756
10900
  /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "ss-w-fandash-countdown-value", children: s.value }),
@@ -10761,7 +10905,7 @@ function CountdownCard({ card, ui }) {
10761
10905
  }
10762
10906
 
10763
10907
  // src/components/dashboard/InjuriesCard.tsx
10764
- var import_react70 = require("react");
10908
+ var import_react71 = require("react");
10765
10909
  var import_jsx_runtime55 = require("react/jsx-runtime");
10766
10910
  var SHOWN = 3;
10767
10911
  function ColHead({ name, crestUrl }) {
@@ -10784,7 +10928,7 @@ function InjuryList({ rows, emptyLabel, limit }) {
10784
10928
  }
10785
10929
  function InjuriesCard({ card, ui }) {
10786
10930
  const { data } = card;
10787
- const [expanded, setExpanded] = (0, import_react70.useState)(false);
10931
+ const [expanded, setExpanded] = (0, import_react71.useState)(false);
10788
10932
  const hidden = Math.max(0, data.ours.length - SHOWN) + Math.max(0, data.theirs.length - SHOWN);
10789
10933
  const limit = expanded ? void 0 : SHOWN;
10790
10934
  const { showMore, showLess } = ui;
@@ -10889,7 +11033,7 @@ function LinksCard({ card }) {
10889
11033
  }
10890
11034
 
10891
11035
  // src/components/dashboard/PostMatchResultCard.tsx
10892
- var import_react71 = require("react");
11036
+ var import_react72 = require("react");
10893
11037
  var import_jsx_runtime61 = require("react/jsx-runtime");
10894
11038
  function initials3(name) {
10895
11039
  return name.trim().slice(0, 3).toUpperCase();
@@ -10899,7 +11043,7 @@ function PostMatchCrest({
10899
11043
  name,
10900
11044
  side
10901
11045
  }) {
10902
- const [failed, setFailed] = (0, import_react71.useState)(false);
11046
+ const [failed, setFailed] = (0, import_react72.useState)(false);
10903
11047
  const cls = `ss-w-fandash-postmatch-crest ss-w-fandash-postmatch-crest--${side}`;
10904
11048
  if (url && !failed) {
10905
11049
  return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
@@ -11098,10 +11242,10 @@ function RestingFormCard({ card }) {
11098
11242
  }
11099
11243
 
11100
11244
  // src/components/dashboard/LiveScoreCard.tsx
11101
- var import_react73 = require("react");
11245
+ var import_react74 = require("react");
11102
11246
 
11103
11247
  // src/useLiveClock.ts
11104
- var import_react72 = require("react");
11248
+ var import_react73 = require("react");
11105
11249
  var TICK_MS = 6e4;
11106
11250
  var MAX_LIVE_TICK_MINUTES = 15;
11107
11251
  function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
@@ -11110,10 +11254,10 @@ function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
11110
11254
  return minute + Math.min(Math.max(0, elapsedMinutes), MAX_LIVE_TICK_MINUTES);
11111
11255
  }
11112
11256
  function useLiveClock(minute, clockRunning, receivedAtMs) {
11113
- const [displayMinute, setDisplayMinute] = (0, import_react72.useState)(
11257
+ const [displayMinute, setDisplayMinute] = (0, import_react73.useState)(
11114
11258
  () => computeDisplayMinute(minute, clockRunning, receivedAtMs)
11115
11259
  );
11116
- (0, import_react72.useEffect)(() => {
11260
+ (0, import_react73.useEffect)(() => {
11117
11261
  setDisplayMinute(computeDisplayMinute(minute, clockRunning, receivedAtMs));
11118
11262
  if (!clockRunning) return;
11119
11263
  const id = window.setInterval(() => {
@@ -11130,7 +11274,7 @@ function initials5(name) {
11130
11274
  return name.trim().slice(0, 3).toUpperCase();
11131
11275
  }
11132
11276
  function LiveCrest({ url, name, side }) {
11133
- const [failed, setFailed] = (0, import_react73.useState)(false);
11277
+ const [failed, setFailed] = (0, import_react74.useState)(false);
11134
11278
  const cls = `ss-w-fandash-live-crest ss-w-fandash-live-crest--${side}`;
11135
11279
  if (url && !failed) {
11136
11280
  return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
@@ -11152,7 +11296,7 @@ function LiveScoreCard({
11152
11296
  }) {
11153
11297
  const { data } = card;
11154
11298
  const seedKey = `${data.minute}:${data.homeScore}:${data.awayScore}`;
11155
- const seedRef = (0, import_react73.useRef)(null);
11299
+ const seedRef = (0, import_react74.useRef)(null);
11156
11300
  if (!seedRef.current || seedRef.current.key !== seedKey) {
11157
11301
  seedRef.current = { key: seedKey, receivedAtMs: Date.now() };
11158
11302
  }
@@ -11198,7 +11342,7 @@ function LiveScoreCard({
11198
11342
  }
11199
11343
 
11200
11344
  // src/components/dashboard/LiveTimelineCard.tsx
11201
- var import_react74 = require("react");
11345
+ var import_react75 = require("react");
11202
11346
  var import_jsx_runtime71 = require("react/jsx-runtime");
11203
11347
  var SHOWN2 = 3;
11204
11348
  function EventIcon({ type }) {
@@ -11240,7 +11384,7 @@ function EventRow({ e }) {
11240
11384
  ] });
11241
11385
  }
11242
11386
  function LiveTimelineCard({ card, ui }) {
11243
- const [expanded, setExpanded] = (0, import_react74.useState)(false);
11387
+ const [expanded, setExpanded] = (0, import_react75.useState)(false);
11244
11388
  const events = card.data.events;
11245
11389
  if (!events || events.length === 0) return null;
11246
11390
  const sorted2 = [...events].sort((a, b) => b.minute - a.minute);
@@ -11264,7 +11408,7 @@ function LiveTimelineCard({ card, ui }) {
11264
11408
  }
11265
11409
 
11266
11410
  // src/components/dashboard/MomentumWave.tsx
11267
- var import_react75 = require("react");
11411
+ var import_react76 = require("react");
11268
11412
  var import_jsx_runtime72 = require("react/jsx-runtime");
11269
11413
  var WIDTH = 270;
11270
11414
  var HEIGHT = 56;
@@ -11289,7 +11433,7 @@ function MomentumWave({
11289
11433
  }) {
11290
11434
  if (points.length === 0) return null;
11291
11435
  const { area, line, lastLeftPct, lastTopPx } = buildPaths(points);
11292
- const clipId = (0, import_react75.useId)();
11436
+ const clipId = (0, import_react76.useId)();
11293
11437
  const topClipId = `${clipId}-top`;
11294
11438
  const bottomClipId = `${clipId}-bottom`;
11295
11439
  const topClass = clubIsHome ? "ss-w-fandash-live-mom-home" : "ss-w-fandash-live-mom-away";
@@ -11439,7 +11583,7 @@ function FanDashboardCard({ card, onTap, ui, goalEvents }) {
11439
11583
  // src/components/ChatMessage.tsx
11440
11584
  var import_jsx_runtime75 = require("react/jsx-runtime");
11441
11585
  function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor, onGreetingSport }) {
11442
- const [sport, setSport] = (0, import_react76.useState)(null);
11586
+ const [sport, setSport] = (0, import_react77.useState)(null);
11443
11587
  if (message.role === "user") {
11444
11588
  return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "ss-w-msg ss-w-user", "data-msg-id": message.id, children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "ss-w-bubble", children: message.text }) });
11445
11589
  }
@@ -11498,11 +11642,11 @@ function turnAnchor(messages) {
11498
11642
  function MessageList({ controller, ui, slip, onDashboardTap, monitor, onGreetingSport }) {
11499
11643
  const { state, send } = controller;
11500
11644
  const { oddsFormat } = useOddsSettings();
11501
- const listRef = (0, import_react77.useRef)(null);
11502
- const endRef = (0, import_react77.useRef)(null);
11503
- const pinnedRef = (0, import_react77.useRef)(true);
11504
- const anchoredTurnRef = (0, import_react77.useRef)(null);
11505
- (0, import_react77.useEffect)(() => {
11645
+ const listRef = (0, import_react78.useRef)(null);
11646
+ const endRef = (0, import_react78.useRef)(null);
11647
+ const pinnedRef = (0, import_react78.useRef)(true);
11648
+ const anchoredTurnRef = (0, import_react78.useRef)(null);
11649
+ (0, import_react78.useEffect)(() => {
11506
11650
  const anchor = turnAnchor(state.messages);
11507
11651
  const list = listRef.current;
11508
11652
  if (anchor && anchor.turnId !== anchoredTurnRef.current) {
@@ -11561,13 +11705,13 @@ function MessageList({ controller, ui, slip, onDashboardTap, monitor, onGreeting
11561
11705
  }
11562
11706
 
11563
11707
  // src/components/ChatInput.tsx
11564
- var import_react78 = require("react");
11708
+ var import_react79 = require("react");
11565
11709
  var import_jsx_runtime78 = require("react/jsx-runtime");
11566
- var ChatInput = (0, import_react78.forwardRef)(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel, sendLabel, disabled = false }, ref) {
11567
- const [value, setValue] = (0, import_react78.useState)("");
11568
- const textareaRef = (0, import_react78.useRef)(null);
11569
- const stopRef = (0, import_react78.useRef)(null);
11570
- const textBoxWantsFocusRef = (0, import_react78.useRef)(false);
11710
+ var ChatInput = (0, import_react79.forwardRef)(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel, sendLabel, disabled = false }, ref) {
11711
+ const [value, setValue] = (0, import_react79.useState)("");
11712
+ const textareaRef = (0, import_react79.useRef)(null);
11713
+ const stopRef = (0, import_react79.useRef)(null);
11714
+ const textBoxWantsFocusRef = (0, import_react79.useRef)(false);
11571
11715
  const submit = () => {
11572
11716
  if (disabled) return;
11573
11717
  const t = value.trim();
@@ -11581,7 +11725,7 @@ var ChatInput = (0, import_react78.forwardRef)(function ChatInput2({ placeholder
11581
11725
  submit();
11582
11726
  }
11583
11727
  };
11584
- (0, import_react78.useImperativeHandle)(ref, () => ({
11728
+ (0, import_react79.useImperativeHandle)(ref, () => ({
11585
11729
  focus() {
11586
11730
  const box = textareaRef.current;
11587
11731
  if (box && !box.disabled) {
@@ -11593,7 +11737,7 @@ var ChatInput = (0, import_react78.forwardRef)(function ChatInput2({ placeholder
11593
11737
  stopRef.current?.focus();
11594
11738
  }
11595
11739
  }), []);
11596
- (0, import_react78.useEffect)(() => {
11740
+ (0, import_react79.useEffect)(() => {
11597
11741
  if (streaming || disabled || !textBoxWantsFocusRef.current) return;
11598
11742
  textBoxWantsFocusRef.current = false;
11599
11743
  const box = textareaRef.current;
@@ -11624,7 +11768,7 @@ var ChatInput = (0, import_react78.forwardRef)(function ChatInput2({ placeholder
11624
11768
  });
11625
11769
 
11626
11770
  // src/components/TabBar.tsx
11627
- var import_react79 = require("react");
11771
+ var import_react80 = require("react");
11628
11772
  var import_jsx_runtime79 = require("react/jsx-runtime");
11629
11773
  var TIGHT_LEVELS = [0, 1, 2, 3, 4, 5, 6, 7];
11630
11774
  var FOCUS_EDGE = 24;
@@ -11647,16 +11791,16 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
11647
11791
  ...gamesEnabled ? [{ tab: "games", label: ui.tabGames, count: 0, dot: false }] : []
11648
11792
  ];
11649
11793
  const track = useTrack();
11650
- const listRef = (0, import_react79.useRef)(null);
11794
+ const listRef = (0, import_react80.useRef)(null);
11651
11795
  const activeTab = monitor.activeTab;
11652
- (0, import_react79.useEffect)(() => {
11796
+ (0, import_react80.useEffect)(() => {
11653
11797
  const el = listRef.current?.querySelector("[data-on]");
11654
11798
  if (!el || typeof el.scrollIntoView !== "function") return;
11655
11799
  const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
11656
11800
  el.scrollIntoView({ block: "nearest", inline: "nearest", behavior: reduce ? "auto" : "smooth" });
11657
11801
  }, [activeTab]);
11658
11802
  const labelSignature = tabs.map((t) => `${t.tab}:${t.label}:${t.count}`).join("|");
11659
- (0, import_react79.useLayoutEffect)(() => {
11803
+ (0, import_react80.useLayoutEffect)(() => {
11660
11804
  const strip = listRef.current;
11661
11805
  if (!strip) return;
11662
11806
  const measure = () => {
@@ -11680,7 +11824,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
11680
11824
  fonts?.removeEventListener?.("loadingdone", measure);
11681
11825
  };
11682
11826
  }, [labelSignature]);
11683
- const pointerDown = (0, import_react79.useRef)(false);
11827
+ const pointerDown = (0, import_react80.useRef)(false);
11684
11828
  const keepFocusedTabInView = (e) => {
11685
11829
  const strip = e.currentTarget;
11686
11830
  const tab = e.target;
@@ -11740,7 +11884,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
11740
11884
  }
11741
11885
 
11742
11886
  // src/components/MonitorTabs.tsx
11743
- var import_react92 = require("react");
11887
+ var import_react93 = require("react");
11744
11888
 
11745
11889
  // src/components/MarketAccordion.tsx
11746
11890
  var import_widget_sdk24 = require("@sensiblestats/widget-sdk");
@@ -11802,7 +11946,7 @@ function MarketAccordion({ match, monitor, ui, slip }) {
11802
11946
  }
11803
11947
 
11804
11948
  // src/components/MonitorFormH2H.tsx
11805
- var import_react80 = require("react");
11949
+ var import_react81 = require("react");
11806
11950
  var import_jsx_runtime81 = require("react/jsx-runtime");
11807
11951
  function resultClass2(result) {
11808
11952
  if (result === "W") return "ss-w-h2h-result--win";
@@ -11818,7 +11962,7 @@ function FormDots({ form, ui }) {
11818
11962
  return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "ss-w-h2h-dots", children: form.map((m, i) => /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { className: `ss-w-h2h-result ${resultClass2(m.result)}`, children: resultLabel(m.result, ui) }, i)) });
11819
11963
  }
11820
11964
  function MonitorFormH2H({ formAndH2H, homeTeamName, awayTeamName, ui }) {
11821
- const [expanded, setExpanded] = (0, import_react80.useState)(false);
11965
+ const [expanded, setExpanded] = (0, import_react81.useState)(false);
11822
11966
  const { homeForm, awayForm, h2h, homeShortCode, awayShortCode } = formAndH2H;
11823
11967
  if (homeForm.length === 0 && awayForm.length === 0 && !h2h) {
11824
11968
  return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_jsx_runtime81.Fragment, {});
@@ -11896,10 +12040,10 @@ function MonitorFormH2H({ formAndH2H, homeTeamName, awayTeamName, ui }) {
11896
12040
  }
11897
12041
 
11898
12042
  // src/components/CompLogo.tsx
11899
- var import_react81 = require("react");
12043
+ var import_react82 = require("react");
11900
12044
  var import_jsx_runtime82 = require("react/jsx-runtime");
11901
12045
  function CompLogo({ url }) {
11902
- const [failed, setFailed] = (0, import_react81.useState)(null);
12046
+ const [failed, setFailed] = (0, import_react82.useState)(null);
11903
12047
  if (!url || failed === url) return null;
11904
12048
  return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("img", { className: "ss-w-mon-comp-logo", src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(url) });
11905
12049
  }
@@ -12057,7 +12201,7 @@ function MonitorSkeleton({ pin, monitor, ui }) {
12057
12201
  }
12058
12202
 
12059
12203
  // src/components/NbaMonitorCard.tsx
12060
- var import_react85 = require("react");
12204
+ var import_react86 = require("react");
12061
12205
 
12062
12206
  // src/sportLabel.ts
12063
12207
  var CODE = { football: "football", basketball: "nba", nba: "nba", americanfootball: "nfl", nfl: "nfl", tennis: "tennis" };
@@ -12067,7 +12211,7 @@ var sportLabel = (ui, sport) => {
12067
12211
  };
12068
12212
 
12069
12213
  // src/components/NbaFormSection.tsx
12070
- var import_react82 = require("react");
12214
+ var import_react83 = require("react");
12071
12215
 
12072
12216
  // src/components/NbaFormRest.tsx
12073
12217
  var import_jsx_runtime85 = require("react/jsx-runtime");
@@ -12167,8 +12311,8 @@ function Row3({ game, abbr, tonight, ui }) {
12167
12311
  ] });
12168
12312
  }
12169
12313
  function NbaFormSection({ match, monitor, ui }) {
12170
- const [open, setOpen] = (0, import_react82.useState)(false);
12171
- const [side, setSide] = (0, import_react82.useState)("away");
12314
+ const [open, setOpen] = (0, import_react83.useState)(false);
12315
+ const [side, setSide] = (0, import_react83.useState)("away");
12172
12316
  const form = useNbaForm(match, monitor);
12173
12317
  const b = match.basketball;
12174
12318
  if (!form || !b || !form.home && !form.away) return null;
@@ -12213,10 +12357,10 @@ function NbaFormSection({ match, monitor, ui }) {
12213
12357
  }
12214
12358
 
12215
12359
  // src/components/NbaPropsSection.tsx
12216
- var import_react84 = require("react");
12360
+ var import_react85 = require("react");
12217
12361
 
12218
12362
  // src/components/PropsPieces.tsx
12219
- var import_react83 = require("react");
12363
+ var import_react84 = require("react");
12220
12364
  var import_jsx_runtime87 = require("react/jsx-runtime");
12221
12365
  var livePlayer = (bundle, p) => bundle.live === true || !p.live && !p.nflLive ? p : { ...p, live: null, nflLive: null };
12222
12366
  var hasLiveLine = (p) => p.live != null || p.nflLive != null;
@@ -12229,9 +12373,9 @@ function preKickoff(match) {
12229
12373
  return Number.isFinite(kickoff) && Date.now() < kickoff;
12230
12374
  }
12231
12375
  function usePreKickoff(match) {
12232
- const [, setTick] = (0, import_react83.useState)(0);
12376
+ const [, setTick] = (0, import_react84.useState)(0);
12233
12377
  const pre = preKickoff(match);
12234
- (0, import_react83.useEffect)(() => {
12378
+ (0, import_react84.useEffect)(() => {
12235
12379
  if (!pre || !match.kickoffUtc) return;
12236
12380
  const wait = Math.min(Math.max(Date.parse(match.kickoffUtc) - Date.now(), 0), MAX_TIMER_MS);
12237
12381
  const id = setTimeout(() => setTick((t) => t + 1), wait);
@@ -12245,7 +12389,7 @@ function usePropsOpen(match, monitor, descriptor) {
12245
12389
  const pre = descriptor.sport === "basketball" ? match.phase === "preMatch" : beforeKickoff;
12246
12390
  const live = match.phase === "live";
12247
12391
  const open = pre || live;
12248
- (0, import_react83.useEffect)(() => {
12392
+ (0, import_react84.useEffect)(() => {
12249
12393
  if (!open) return;
12250
12394
  if (sport) monitor.loadPlayerProps?.(match.matchId, sport);
12251
12395
  else monitor.loadPlayerProps?.(match.matchId);
@@ -12323,7 +12467,7 @@ function PropBars({ bars, line, title, wide, ui, note }) {
12323
12467
  function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
12324
12468
  const player = livePlayer(bundle, given);
12325
12469
  const stats = descriptor.stats.map((k) => player.stats.find((s) => s.stat === k)).filter((s) => s != null);
12326
- const [picked, setPicked] = (0, import_react83.useState)(null);
12470
+ const [picked, setPicked] = (0, import_react84.useState)(null);
12327
12471
  const active = stats.find((s) => s.stat === picked) ?? stats[0];
12328
12472
  const sample = active?.games?.length ?? 0;
12329
12473
  const hitsOf = (price, text2) => descriptor.showHits && sample > 0 && price.hits != null ? text2(price.hits) : null;
@@ -12372,8 +12516,8 @@ function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
12372
12516
  ] });
12373
12517
  }
12374
12518
  function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
12375
- const [openId, setOpenId] = (0, import_react83.useState)(null);
12376
- const [brokenShots, setBrokenShots] = (0, import_react83.useState)(/* @__PURE__ */ new Set());
12519
+ const [openId, setOpenId] = (0, import_react84.useState)(null);
12520
+ const [brokenShots, setBrokenShots] = (0, import_react84.useState)(/* @__PURE__ */ new Set());
12377
12521
  return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "ss-w-props-list", children: players.map((given) => {
12378
12522
  const p = livePlayer(bundle, given);
12379
12523
  const isOpen = openId === p.playerId;
@@ -12419,12 +12563,12 @@ function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
12419
12563
  }
12420
12564
  var BOX_QUIET_MS = 12e4;
12421
12565
  function StatsClock({ boxAsOfUtc, match, live, atBreak: atBreak2, ago, ui }) {
12422
- const [tick, setTick] = (0, import_react83.useState)(0);
12566
+ const [tick, setTick] = (0, import_react84.useState)(0);
12423
12567
  const time = clock2(boxAsOfUtc, ui);
12424
12568
  const at2 = time === "" ? Number.NaN : Date.parse(boxAsOfUtc);
12425
12569
  const valid = !Number.isNaN(at2);
12426
12570
  const onBreak = atBreak(match);
12427
- (0, import_react83.useEffect)(() => {
12571
+ (0, import_react84.useEffect)(() => {
12428
12572
  if (!valid || onBreak) return;
12429
12573
  const age2 = Date.now() - at2;
12430
12574
  const wait = age2 < BOX_QUIET_MS ? BOX_QUIET_MS - age2 : 6e4 - age2 % 6e4;
@@ -12485,12 +12629,12 @@ var nbaDescriptor = (ui, match) => ({
12485
12629
  tenGameBars: false
12486
12630
  });
12487
12631
  function StatsClock2({ bundle, match, ui }) {
12488
- const [tick, setTick] = (0, import_react84.useState)(0);
12632
+ const [tick, setTick] = (0, import_react85.useState)(0);
12489
12633
  const at2 = bundle.live === true && bundle.boxAsOfUtc ? Date.parse(bundle.boxAsOfUtc) : Number.NaN;
12490
12634
  const time = clock2(bundle.boxAsOfUtc, ui);
12491
12635
  const valid = !Number.isNaN(at2) && time !== "";
12492
12636
  const onBreak = atBreak(match);
12493
- (0, import_react84.useEffect)(() => {
12637
+ (0, import_react85.useEffect)(() => {
12494
12638
  if (!valid || onBreak) return;
12495
12639
  const age2 = Date.now() - at2;
12496
12640
  const wait = age2 < BOX_QUIET_MS2 ? BOX_QUIET_MS2 - age2 : 6e4 - age2 % 6e4;
@@ -12504,7 +12648,7 @@ function StatsClock2({ bundle, match, ui }) {
12504
12648
  return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "ss-w-props-asof ss-w-props-asof--live", children: ui.nba.propsStatsLive(time) });
12505
12649
  }
12506
12650
  function NbaPropsSection({ match, monitor, ui, slip }) {
12507
- const [side, setSide] = (0, import_react84.useState)("home");
12651
+ const [side, setSide] = (0, import_react85.useState)("home");
12508
12652
  const descriptor = nbaDescriptor(ui, match);
12509
12653
  const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
12510
12654
  if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
@@ -12542,7 +12686,7 @@ function city(teamName, nickname) {
12542
12686
  return name.slice(0, name.length - nickname.length).trim() || null;
12543
12687
  }
12544
12688
  function BadgeCrest({ url, abbreviation }) {
12545
- const [failed, setFailed] = (0, import_react85.useState)(false);
12689
+ const [failed, setFailed] = (0, import_react86.useState)(false);
12546
12690
  if (url && !failed) {
12547
12691
  return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("img", { className: "ss-w-nbamon-badge ss-w-nbamon-badge--img", src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
12548
12692
  }
@@ -12677,7 +12821,7 @@ function NbaMonitorCard({ match, monitor, ui, slip, onAsk }) {
12677
12821
  }
12678
12822
 
12679
12823
  // src/components/NflFormSection.tsx
12680
- var import_react86 = require("react");
12824
+ var import_react87 = require("react");
12681
12825
  var import_jsx_runtime90 = require("react/jsx-runtime");
12682
12826
  var outcomeOf = (g) => g.teamScore > g.opponentScore ? "win" : g.teamScore < g.opponentScore ? "loss" : "tie";
12683
12827
  var signedSpread2 = (v) => v > 0 ? `+${v}` : String(v);
@@ -12730,7 +12874,7 @@ function H2hRow({ game, home, ui }) {
12730
12874
  ] });
12731
12875
  }
12732
12876
  function NflFormSection({ match, monitor, ui }) {
12733
- const [segment, setSegment] = (0, import_react86.useState)("away");
12877
+ const [segment, setSegment] = (0, import_react87.useState)("away");
12734
12878
  const { live, open } = usePropsOpen(match, monitor, { sport: "americanfootball" });
12735
12879
  const bundle = monitor.playerProps?.[monitorMatchKey("americanfootball", match.matchId)]?.bundle;
12736
12880
  const form = bundle?.form;
@@ -12763,7 +12907,7 @@ function NflFormSection({ match, monitor, ui }) {
12763
12907
  }
12764
12908
 
12765
12909
  // src/components/NflPropsSection.tsx
12766
- var import_react87 = require("react");
12910
+ var import_react88 = require("react");
12767
12911
  var import_jsx_runtime91 = require("react/jsx-runtime");
12768
12912
  var TRENDS_SHOWN = 3;
12769
12913
  var SCORERS_SHOWN = 8;
@@ -12836,7 +12980,7 @@ function ShowMore({ label, onClick }) {
12836
12980
  return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("button", { type: "button", className: "ss-w-props-more", onClick, children: label });
12837
12981
  }
12838
12982
  function Trends({ bundle, facts, descriptor, ui, slip }) {
12839
- const [all, setAll] = (0, import_react87.useState)(false);
12983
+ const [all, setAll] = (0, import_react88.useState)(false);
12840
12984
  const shown2 = all ? facts : facts.slice(0, TRENDS_SHOWN);
12841
12985
  return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("section", { className: "ss-w-props ss-w-props-trends", lang: ui.locale, children: [
12842
12986
  /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "ss-w-props-head", children: ui.nfl.propsTrends }),
@@ -12869,7 +13013,7 @@ function Trends({ bundle, facts, descriptor, ui, slip }) {
12869
13013
  ] });
12870
13014
  }
12871
13015
  function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
12872
- const [all, setAll] = (0, import_react87.useState)(false);
13016
+ const [all, setAll] = (0, import_react88.useState)(false);
12873
13017
  const shown2 = all ? scorers : scorers.slice(0, SCORERS_SHOWN);
12874
13018
  const cell2 = (name, column, price, stat) => price && stat ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(PropPrice, { price, label: "", ariaName: `${name}, ${column}`, player: name, stat, bundle, descriptor, ui, slip }) : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "ss-w-props-scorer-none", children: "\u2014" });
12875
13019
  return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "ss-w-props-scorers", children: [
@@ -12899,7 +13043,7 @@ function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
12899
13043
  ] });
12900
13044
  }
12901
13045
  function NflPropsSection({ match, monitor, ui, slip }) {
12902
- const [tab, setTab] = (0, import_react87.useState)(null);
13046
+ const [tab, setTab] = (0, import_react88.useState)(null);
12903
13047
  const descriptor = nflDescriptor(ui);
12904
13048
  const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
12905
13049
  if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
@@ -13099,14 +13243,14 @@ function NflMonitorCard({ match, monitor, ui, slip, onAsk }) {
13099
13243
  }
13100
13244
 
13101
13245
  // src/components/TennisMonitorCard.tsx
13102
- var import_react90 = require("react");
13246
+ var import_react91 = require("react");
13103
13247
  var import_widget_sdk27 = require("@sensiblestats/widget-sdk");
13104
13248
 
13105
13249
  // src/components/TennisFixtureRow.tsx
13106
13250
  var import_widget_sdk26 = require("@sensiblestats/widget-sdk");
13107
13251
 
13108
13252
  // src/components/FixtureRow.tsx
13109
- var import_react88 = require("react");
13253
+ var import_react89 = require("react");
13110
13254
  var import_widget_sdk25 = require("@sensiblestats/widget-sdk");
13111
13255
  var import_jsx_runtime95 = require("react/jsx-runtime");
13112
13256
  function splitAtFirstSpace(label) {
@@ -13120,7 +13264,7 @@ function kickoffLabel(kickoffUnix, tag2, clock3, timeZone) {
13120
13264
  return formatTime(kickoffUnix * 1e3, tag2, clock3, { timeZone });
13121
13265
  }
13122
13266
  function Side2({ name, crest, abbr, away = false }) {
13123
- const [failed, setFailed] = (0, import_react88.useState)(false);
13267
+ const [failed, setFailed] = (0, import_react89.useState)(false);
13124
13268
  return /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("span", { className: away ? "ss-w-drow-side ss-w-drow-side--away" : "ss-w-drow-side", children: [
13125
13269
  crest && !failed ? /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("img", { className: abbr ? "ss-w-drow-crest ss-w-drow-crest--wide" : "ss-w-drow-crest", src: crest, alt: "", onError: () => setFailed(true) }) : abbr ? /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: "ss-w-drow-crest ss-w-drow-crest--abbr", children: abbr }) : null,
13126
13270
  /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: "ss-w-drow-nm", children: name })
@@ -13362,7 +13506,7 @@ function TennisLiveScoreboard({ t, score, live, ui }) {
13362
13506
  }
13363
13507
 
13364
13508
  // src/components/TennisStatsTables.tsx
13365
- var import_react89 = require("react");
13509
+ var import_react90 = require("react");
13366
13510
  var import_jsx_runtime98 = require("react/jsx-runtime");
13367
13511
  function formatStat(row, value, locale) {
13368
13512
  if (value == null) return "\u2013";
@@ -13400,8 +13544,8 @@ function Tables({ table, labels, names, locale }) {
13400
13544
  ] });
13401
13545
  }
13402
13546
  function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey }) {
13403
- const [tab, setTab] = (0, import_react89.useState)("match");
13404
- (0, import_react89.useEffect)(() => {
13547
+ const [tab, setTab] = (0, import_react90.useState)("match");
13548
+ (0, import_react90.useEffect)(() => {
13405
13549
  setTab("match");
13406
13550
  }, [resetKey]);
13407
13551
  const sets = serveReturn.sets.filter((s) => s.table.serve.length + s.table.return.length > 0);
@@ -13432,7 +13576,7 @@ function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey })
13432
13576
  ] }),
13433
13577
  today.rows.map((r) => {
13434
13578
  const f = (v) => formatStat({ kind: "pct" }, v, locale);
13435
- return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(import_react89.Fragment, { children: [
13579
+ return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(import_react90.Fragment, { children: [
13436
13580
  /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { className: "ss-w-ts-l", children: r.label }),
13437
13581
  /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("span", { className: "ss-w-ts-today-v ss-w-ts-today-v--a", children: [
13438
13582
  f(r.p1Today),
@@ -13567,7 +13711,7 @@ function HeadToHead({ t, ui }) {
13567
13711
  ] });
13568
13712
  }
13569
13713
  function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
13570
- const lastTables = (0, import_react90.useRef)(null);
13714
+ const lastTables = (0, import_react91.useRef)(null);
13571
13715
  const t = match.tennis;
13572
13716
  if (!t) return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(UnavailableCard, { match, monitor, ui, sport: "tennis" });
13573
13717
  const preMatch = match.phase === "preMatch";
@@ -13647,7 +13791,7 @@ function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
13647
13791
  }
13648
13792
 
13649
13793
  // src/components/ScoreboardStrip.tsx
13650
- var import_react91 = require("react");
13794
+ var import_react92 = require("react");
13651
13795
  var import_widget_sdk28 = require("@sensiblestats/widget-sdk");
13652
13796
  var import_jsx_runtime100 = require("react/jsx-runtime");
13653
13797
  function nbaStatus(m, ui) {
@@ -13742,8 +13886,8 @@ function rowsFor(m) {
13742
13886
  ];
13743
13887
  }
13744
13888
  function useStripScroll(selectedKey) {
13745
- const stripRef = (0, import_react91.useRef)(null);
13746
- (0, import_react91.useEffect)(() => {
13889
+ const stripRef = (0, import_react92.useRef)(null);
13890
+ (0, import_react92.useEffect)(() => {
13747
13891
  const strip = stripRef.current;
13748
13892
  const pressed = strip?.querySelector('[aria-pressed="true"]');
13749
13893
  if (!strip || !pressed) return;
@@ -13917,7 +14061,7 @@ function OddsLiveStrip({ m, ui }) {
13917
14061
  ] });
13918
14062
  }
13919
14063
  function MatchesPanel({ monitor, ui, slip, onAsk, discovery }) {
13920
- const seedIndex = (0, import_react92.useMemo)(() => buildSeedIndex(discovery?.groups ?? []), [discovery?.groups]);
14064
+ const seedIndex = (0, import_react93.useMemo)(() => buildSeedIndex(discovery?.groups ?? []), [discovery?.groups]);
13921
14065
  const tiles = orderTiles(
13922
14066
  monitor.pins,
13923
14067
  monitor.snapshot,
@@ -13989,7 +14133,7 @@ function TrendsPanel({ monitor, ui, slip }) {
13989
14133
  }
13990
14134
 
13991
14135
  // src/components/LivePanel.tsx
13992
- var import_react95 = require("react");
14136
+ var import_react96 = require("react");
13993
14137
  var import_widget_sdk35 = require("@sensiblestats/widget-sdk");
13994
14138
 
13995
14139
  // src/scheduleView.ts
@@ -14164,20 +14308,20 @@ function LeagueGroup({ view, open, onToggle, disambiguate, rowCap, onShowAll, on
14164
14308
  }
14165
14309
 
14166
14310
  // src/components/MatchSheet.tsx
14167
- var import_react94 = require("react");
14311
+ var import_react95 = require("react");
14168
14312
  var import_widget_sdk33 = require("@sensiblestats/widget-sdk");
14169
14313
 
14170
14314
  // src/useModalDialog.ts
14171
- var import_react93 = require("react");
14315
+ var import_react94 = require("react");
14172
14316
  var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
14173
14317
  function useModalDialog(onClose, opts = {}) {
14174
- const dialogRef = (0, import_react93.useRef)(null);
14175
- const onCloseRef = (0, import_react93.useRef)(onClose);
14318
+ const dialogRef = (0, import_react94.useRef)(null);
14319
+ const onCloseRef = (0, import_react94.useRef)(onClose);
14176
14320
  onCloseRef.current = onClose;
14177
- const openerRef = (0, import_react93.useRef)(opts.opener);
14321
+ const openerRef = (0, import_react94.useRef)(opts.opener);
14178
14322
  openerRef.current = opts.opener;
14179
14323
  const restore = opts.restoreFocus ?? true;
14180
- (0, import_react93.useEffect)(() => {
14324
+ (0, import_react94.useEffect)(() => {
14181
14325
  const dialog = dialogRef.current;
14182
14326
  const root = dialog?.getRootNode();
14183
14327
  const focusedAtMount = root?.activeElement ?? null;
@@ -14188,7 +14332,7 @@ function useModalDialog(onClose, opts = {}) {
14188
14332
  if (target instanceof HTMLElement) target.focus({ preventScroll: true });
14189
14333
  };
14190
14334
  }, []);
14191
- (0, import_react93.useEffect)(() => {
14335
+ (0, import_react94.useEffect)(() => {
14192
14336
  const onKey = (e) => {
14193
14337
  if (e.key !== "Escape") return;
14194
14338
  e.stopPropagation();
@@ -14229,8 +14373,8 @@ function kickoffDate(kickoffUnix, lang, timeZone) {
14229
14373
  function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose, opener }) {
14230
14374
  const { dialogRef, onKeyDown } = useModalDialog(onClose, { opener });
14231
14375
  const log = useEventLog();
14232
- const titleId = (0, import_react94.useId)();
14233
- const [limitHit, setLimitHit] = (0, import_react94.useState)(false);
14376
+ const titleId = (0, import_react95.useId)();
14377
+ const [limitHit, setLimitHit] = (0, import_react95.useState)(false);
14234
14378
  const pinSport = (0, import_widget_sdk33.slipSportOf)(match.sport);
14235
14379
  const tour = pinSport === "tennis" && isKnownTour(match.tour) ? match.tour : void 0;
14236
14380
  const followable = pinSport !== "tennis" || tour !== void 0;
@@ -14331,10 +14475,10 @@ var OPEN_TOP_GROUPS = 2;
14331
14475
  var QUIET_ROWS = 4;
14332
14476
  function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, onLeague, onSeeAll, onAsk }) {
14333
14477
  const { groups, states, stale } = discovery;
14334
- const [mine, setMine] = (0, import_react95.useState)(false);
14335
- const [toggled, setToggled] = (0, import_react95.useState)(/* @__PURE__ */ new Map());
14336
- const [sheet, setSheet] = (0, import_react95.useState)(null);
14337
- const pinnedKeys = (0, import_react95.useMemo)(
14478
+ const [mine, setMine] = (0, import_react96.useState)(false);
14479
+ const [toggled, setToggled] = (0, import_react96.useState)(/* @__PURE__ */ new Map());
14480
+ const [sheet, setSheet] = (0, import_react96.useState)(null);
14481
+ const pinnedKeys = (0, import_react96.useMemo)(
14338
14482
  () => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk35.matchKey)(p.sport, p.matchId, p.tour))),
14339
14483
  [monitor.pins]
14340
14484
  );
@@ -14440,20 +14584,20 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
14440
14584
  }
14441
14585
 
14442
14586
  // src/components/ScheduleMatchesPanel.tsx
14443
- var import_react99 = require("react");
14587
+ var import_react100 = require("react");
14444
14588
  var import_widget_sdk37 = require("@sensiblestats/widget-sdk");
14445
14589
 
14446
14590
  // src/useTennisRowPrices.ts
14447
- var import_react96 = require("react");
14591
+ var import_react97 = require("react");
14448
14592
  var import_widget_sdk36 = require("@sensiblestats/widget-sdk");
14449
14593
  var TENNIS_PRICE_POLL_MS = 6e4;
14450
14594
  function useTennisRowPrices(a) {
14451
- const [state, setState] = (0, import_react96.useState)({ byId: null, stale: false });
14452
- const getPricesRef = (0, import_react96.useRef)(a.getPrices);
14595
+ const [state, setState] = (0, import_react97.useState)({ byId: null, stale: false });
14596
+ const getPricesRef = (0, import_react97.useRef)(a.getPrices);
14453
14597
  getPricesRef.current = a.getPrices;
14454
- const latest = (0, import_react96.useRef)(0);
14598
+ const latest = (0, import_react97.useRef)(0);
14455
14599
  const idsKey = a.keys.filter((k) => isKnownTour(k.tour)).slice(0, MAX_TENNIS_KEYS).map((k) => `${k.tour}:${k.matchId}`).sort().join(",");
14456
- (0, import_react96.useEffect)(() => {
14600
+ (0, import_react97.useEffect)(() => {
14457
14601
  if (!a.enabled || idsKey === "") {
14458
14602
  latest.current++;
14459
14603
  setState((prev) => prev.byId === null && !prev.stale ? prev : { byId: null, stale: false });
@@ -14491,11 +14635,11 @@ function useTennisRowPrices(a) {
14491
14635
  }
14492
14636
 
14493
14637
  // src/components/DayStrip.tsx
14494
- var import_react97 = require("react");
14638
+ var import_react98 = require("react");
14495
14639
  var import_jsx_runtime109 = require("react/jsx-runtime");
14496
14640
  function DayStrip({ chips, selected, onSelect, ui, locale }) {
14497
- const listRef = (0, import_react97.useRef)(null);
14498
- (0, import_react97.useEffect)(() => {
14641
+ const listRef = (0, import_react98.useRef)(null);
14642
+ (0, import_react98.useEffect)(() => {
14499
14643
  const el = listRef.current?.querySelector('[aria-pressed="true"]');
14500
14644
  if (!el || typeof el.scrollIntoView !== "function") return;
14501
14645
  const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
@@ -14524,7 +14668,7 @@ function DayStrip({ chips, selected, onSelect, ui, locale }) {
14524
14668
  }
14525
14669
 
14526
14670
  // src/components/games/ui/SearchField.tsx
14527
- var import_react98 = require("react");
14671
+ var import_react99 = require("react");
14528
14672
 
14529
14673
  // src/components/games/ui/icons.tsx
14530
14674
  var import_jsx_runtime110 = require("react/jsx-runtime");
@@ -14563,8 +14707,8 @@ var IconFlame = ({ size = 16 }) => svg(size, /* @__PURE__ */ (0, import_jsx_runt
14563
14707
  // src/components/games/ui/SearchField.tsx
14564
14708
  var import_jsx_runtime111 = require("react/jsx-runtime");
14565
14709
  function SearchField({ id, label, labelHidden = false, placeholder, value, onChange, disabled, inputRef, onKeyDown, clearLabel }) {
14566
- const localRef = (0, import_react98.useRef)(null);
14567
- const setInputRef = (0, import_react98.useCallback)((node) => {
14710
+ const localRef = (0, import_react99.useRef)(null);
14711
+ const setInputRef = (0, import_react99.useCallback)((node) => {
14568
14712
  localRef.current = node;
14569
14713
  if (typeof inputRef === "function") inputRef(node);
14570
14714
  else if (inputRef) inputRef.current = node;
@@ -14610,18 +14754,18 @@ var TOP_ROW_CAP = 3;
14610
14754
  var SKELETON_ROWS = 3;
14611
14755
  function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport, day, onDay, loaded, onOpenLive, onAsk, locale, getTennisPrices, slip }) {
14612
14756
  const { localDate: today, states, stale } = discovery;
14613
- const searchId = (0, import_react99.useId)();
14614
- const [query, setQuery] = (0, import_react99.useState)("");
14615
- const [toggled, setToggled] = (0, import_react99.useState)(/* @__PURE__ */ new Map());
14616
- const [expanded, setExpanded] = (0, import_react99.useState)(/* @__PURE__ */ new Set());
14617
- const listRef = (0, import_react99.useRef)(null);
14618
- const [sheet, setSheet] = (0, import_react99.useState)(null);
14757
+ const searchId = (0, import_react100.useId)();
14758
+ const [query, setQuery] = (0, import_react100.useState)("");
14759
+ const [toggled, setToggled] = (0, import_react100.useState)(/* @__PURE__ */ new Map());
14760
+ const [expanded, setExpanded] = (0, import_react100.useState)(/* @__PURE__ */ new Set());
14761
+ const listRef = (0, import_react100.useRef)(null);
14762
+ const [sheet, setSheet] = (0, import_react100.useState)(null);
14619
14763
  const { chips, selected } = loaded;
14620
- (0, import_react99.useEffect)(() => {
14764
+ (0, import_react100.useEffect)(() => {
14621
14765
  if (selected !== day) onDay(selected);
14622
14766
  }, [day, selected, onDay]);
14623
14767
  const isToday = selected === today;
14624
- const pinnedKeys = (0, import_react99.useMemo)(
14768
+ const pinnedKeys = (0, import_react100.useMemo)(
14625
14769
  () => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk37.matchKey)(p.sport, p.matchId, p.tour))),
14626
14770
  [monitor.pins]
14627
14771
  );
@@ -14759,7 +14903,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
14759
14903
  }
14760
14904
 
14761
14905
  // src/components/GamesPanel.tsx
14762
- var import_react114 = require("react");
14906
+ var import_react115 = require("react");
14763
14907
 
14764
14908
  // src/components/GamesLoginWall.tsx
14765
14909
  var import_jsx_runtime113 = require("react/jsx-runtime");
@@ -14768,7 +14912,7 @@ function GamesLoginWall({ ui }) {
14768
14912
  }
14769
14913
 
14770
14914
  // src/components/GamesHub.tsx
14771
- var import_react100 = require("react");
14915
+ var import_react101 = require("react");
14772
14916
 
14773
14917
  // src/components/games/ui/gameMeta.ts
14774
14918
  function prettifyGameId(gameId) {
@@ -14919,8 +15063,8 @@ function pickHeroGame(games) {
14919
15063
  }
14920
15064
  var tileKey = (g) => `${g.gameId}-${g.gameDay}-${g.fixtureId}`;
14921
15065
  function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
14922
- const [, setTick] = (0, import_react100.useState)(0);
14923
- (0, import_react100.useEffect)(() => {
15066
+ const [, setTick] = (0, import_react101.useState)(0);
15067
+ (0, import_react101.useEffect)(() => {
14924
15068
  const id = setInterval(() => setTick((t) => t + 1), 6e4);
14925
15069
  return () => clearInterval(id);
14926
15070
  }, []);
@@ -14980,10 +15124,10 @@ function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
14980
15124
  }
14981
15125
 
14982
15126
  // src/components/GameScreenHost.tsx
14983
- var import_react112 = require("react");
15127
+ var import_react113 = require("react");
14984
15128
 
14985
15129
  // src/useGamePlay.ts
14986
- var import_react101 = require("react");
15130
+ var import_react102 = require("react");
14987
15131
  function toSubmitResult(payload) {
14988
15132
  return {
14989
15133
  // 'pending' means the play is recorded but awaiting resolution (fixture games)
@@ -14995,17 +15139,17 @@ function toSubmitResult(payload) {
14995
15139
  };
14996
15140
  }
14997
15141
  function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh }) {
14998
- const [result, setResult] = (0, import_react101.useState)(null);
14999
- const [submitting, setSubmitting] = (0, import_react101.useState)(false);
15000
- const [rawStatus, setRawStatus] = (0, import_react101.useState)(null);
15001
- const inFlightRef = (0, import_react101.useRef)(false);
15002
- const convRef = (0, import_react101.useRef)(conversation);
15142
+ const [result, setResult] = (0, import_react102.useState)(null);
15143
+ const [submitting, setSubmitting] = (0, import_react102.useState)(false);
15144
+ const [rawStatus, setRawStatus] = (0, import_react102.useState)(null);
15145
+ const inFlightRef = (0, import_react102.useRef)(false);
15146
+ const convRef = (0, import_react102.useRef)(conversation);
15003
15147
  convRef.current = conversation;
15004
- const optsRef = (0, import_react101.useRef)({ gameId, gameDay, fixtureId, locale, refresh });
15148
+ const optsRef = (0, import_react102.useRef)({ gameId, gameDay, fixtureId, locale, refresh });
15005
15149
  optsRef.current = { gameId, gameDay, fixtureId, locale, refresh };
15006
- const resultRef = (0, import_react101.useRef)(null);
15150
+ const resultRef = (0, import_react102.useRef)(null);
15007
15151
  resultRef.current = result;
15008
- const refetch = (0, import_react101.useCallback)(async () => {
15152
+ const refetch = (0, import_react102.useCallback)(async () => {
15009
15153
  const conv = convRef.current;
15010
15154
  if (!conv) return;
15011
15155
  const opts = optsRef.current;
@@ -15021,7 +15165,7 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
15021
15165
  } catch {
15022
15166
  }
15023
15167
  }, []);
15024
- const submit = (0, import_react101.useCallback)(async (answerJson) => {
15168
+ const submit = (0, import_react102.useCallback)(async (answerJson) => {
15025
15169
  const conv = convRef.current;
15026
15170
  if (!conv || inFlightRef.current) return;
15027
15171
  inFlightRef.current = true;
@@ -15048,14 +15192,14 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
15048
15192
  setSubmitting(false);
15049
15193
  }
15050
15194
  }, [refetch]);
15051
- const hydrate = (0, import_react101.useCallback)(() => {
15195
+ const hydrate = (0, import_react102.useCallback)(() => {
15052
15196
  void refetch();
15053
15197
  }, [refetch]);
15054
15198
  return { result, submitting, submit, hydrate, rawStatus };
15055
15199
  }
15056
15200
 
15057
15201
  // src/components/games/MysteryTigerGame.tsx
15058
- var import_react103 = require("react");
15202
+ var import_react104 = require("react");
15059
15203
 
15060
15204
  // src/components/games/nationFlags.ts
15061
15205
  var FLAGS = {
@@ -15266,7 +15410,7 @@ function isNationCode(flag) {
15266
15410
  }
15267
15411
 
15268
15412
  // src/components/games/PlayerAvatar.tsx
15269
- var import_react102 = require("react");
15413
+ var import_react103 = require("react");
15270
15414
  var import_jsx_runtime118 = require("react/jsx-runtime");
15271
15415
  function initialsOf(name) {
15272
15416
  const parts2 = name.trim().split(/\s+/).filter(Boolean);
@@ -15284,7 +15428,7 @@ function PlayerAvatar({
15284
15428
  imagePath,
15285
15429
  className
15286
15430
  }) {
15287
- const [failed, setFailed] = (0, import_react102.useState)(false);
15431
+ const [failed, setFailed] = (0, import_react103.useState)(false);
15288
15432
  const showImage = Boolean(imagePath) && !isPlaceholderImage(imagePath) && !failed;
15289
15433
  return /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("div", { className, "aria-hidden": "true", children: showImage ? /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("img", { src: imagePath, alt: "", loading: "lazy", onError: () => setFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("span", { className: "ss-w-av-initials", children: initialsOf(name) }) });
15290
15434
  }
@@ -15528,8 +15672,8 @@ function MysteryTigerGame({
15528
15672
  onBack
15529
15673
  }) {
15530
15674
  const t = ui.games.mysteryTiger;
15531
- const [query, setQuery] = (0, import_react103.useState)("");
15532
- const inputId = (0, import_react103.useId)();
15675
+ const [query, setQuery] = (0, import_react104.useState)("");
15676
+ const inputId = (0, import_react104.useId)();
15533
15677
  const clientState = parseClientState(result?.clientStateJson);
15534
15678
  const guessResults = clientState?.guessResults ?? [];
15535
15679
  const alreadyGuessedIds = new Set(guessResults.map((g) => g.playerId));
@@ -15790,13 +15934,13 @@ function HigherOrLowerGame({
15790
15934
  }
15791
15935
 
15792
15936
  // src/components/games/CareerPathGame.tsx
15793
- var import_react105 = require("react");
15937
+ var import_react106 = require("react");
15794
15938
 
15795
15939
  // src/components/games/ui/CrestShield.tsx
15796
- var import_react104 = require("react");
15940
+ var import_react105 = require("react");
15797
15941
  var import_jsx_runtime129 = require("react/jsx-runtime");
15798
15942
  function CrestShield({ src, name, size = 28 }) {
15799
- const [failed, setFailed] = (0, import_react104.useState)(false);
15943
+ const [failed, setFailed] = (0, import_react105.useState)(false);
15800
15944
  if (src && !isPlaceholderImage(src) && !failed) {
15801
15945
  return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("img", { className: "ss-g-crest", src, alt: name, width: size, height: size, loading: "lazy", onError: () => setFailed(true) });
15802
15946
  }
@@ -15828,8 +15972,8 @@ function CareerPathGame({
15828
15972
  }) {
15829
15973
  const s = ui.games.careerPath;
15830
15974
  const title = gameTitle({ gameId: "career-path" }, ui.games.titles);
15831
- const [query, setQuery] = (0, import_react105.useState)("");
15832
- const inputId = (0, import_react105.useId)();
15975
+ const [query, setQuery] = (0, import_react106.useState)("");
15976
+ const inputId = (0, import_react106.useId)();
15833
15977
  const clientState = parseClientState3(result?.clientStateJson);
15834
15978
  const alreadyGuessedIds = new Set(clientState?.guessResults.map((g) => g.playerId) ?? []);
15835
15979
  const isOver = result?.alreadyPlayed === true || clientState?.solved === true || clientState?.failed === true;
@@ -15935,7 +16079,7 @@ function CareerPathGame({
15935
16079
  }
15936
16080
 
15937
16081
  // src/components/games/BeatTheGridGame.tsx
15938
- var import_react106 = __toESM(require("react"), 1);
16082
+ var import_react107 = __toESM(require("react"), 1);
15939
16083
 
15940
16084
  // src/components/games/ui/OptionList.tsx
15941
16085
  var import_jsx_runtime131 = require("react/jsx-runtime");
@@ -16024,10 +16168,10 @@ function SearchSheet({
16024
16168
  ui
16025
16169
  }) {
16026
16170
  const s = ui.games.beatTheGrid;
16027
- const [query, setQuery] = (0, import_react106.useState)("");
16028
- const inputId = (0, import_react106.useId)();
16029
- const inputRef = (0, import_react106.useRef)(null);
16030
- (0, import_react106.useEffect)(() => {
16171
+ const [query, setQuery] = (0, import_react107.useState)("");
16172
+ const inputId = (0, import_react107.useId)();
16173
+ const inputRef = (0, import_react107.useRef)(null);
16174
+ (0, import_react107.useEffect)(() => {
16031
16175
  inputRef.current?.focus();
16032
16176
  }, [row, col]);
16033
16177
  const filtered = playerPool.filter(
@@ -16092,7 +16236,7 @@ function BeatTheGridGame({
16092
16236
  }) {
16093
16237
  const s = ui.games.beatTheGrid;
16094
16238
  const title = gameTitle({ gameId: "beat-the-grid" }, ui.games.titles);
16095
- const [activeCell, setActiveCell] = (0, import_react106.useState)(null);
16239
+ const [activeCell, setActiveCell] = (0, import_react107.useState)(null);
16096
16240
  const clientState = parseClientState4(result?.clientStateJson);
16097
16241
  const filledCells = clientState?.cells ?? [];
16098
16242
  const isLocked2 = result?.alreadyPlayed === true || clientState?.isComplete === true;
@@ -16166,7 +16310,7 @@ function BeatTheGridGame({
16166
16310
  /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { "aria-hidden": "true", children: abbr }),
16167
16311
  /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { className: "ss-g-sr", children: rowLabel })
16168
16312
  ] });
16169
- return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(import_react106.default.Fragment, { children: [
16313
+ return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(import_react107.default.Fragment, { children: [
16170
16314
  /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("div", { className: "ss-g-btg-rowhdr", "data-meta": rowMeta ? "true" : void 0, children: rowHeaderContent }),
16171
16315
  cols.map((colLabel, colIdx) => {
16172
16316
  const filled = findCellResult(filledCells, rowIdx, colIdx);
@@ -16247,7 +16391,7 @@ function BeatTheGridGame({
16247
16391
  }
16248
16392
 
16249
16393
  // src/components/games/GuessTheXiGame.tsx
16250
- var import_react107 = require("react");
16394
+ var import_react108 = require("react");
16251
16395
 
16252
16396
  // src/components/games/ui/PitchSvg.tsx
16253
16397
  var import_jsx_runtime133 = require("react/jsx-runtime");
@@ -16336,8 +16480,8 @@ function GuessTheXiGame({
16336
16480
  onBack
16337
16481
  }) {
16338
16482
  const t = ui.games.guessTheXi;
16339
- const [query, setQuery] = (0, import_react107.useState)("");
16340
- const inputId = (0, import_react107.useId)();
16483
+ const [query, setQuery] = (0, import_react108.useState)("");
16484
+ const inputId = (0, import_react108.useId)();
16341
16485
  const clientState = parseClientState5(result?.clientStateJson);
16342
16486
  const isOver = result?.alreadyPlayed === true || clientState?.status === "solved" || clientState?.status === "failed";
16343
16487
  const solved = clientState?.status === "solved";
@@ -16479,7 +16623,7 @@ function GuessTheXiGame({
16479
16623
  }
16480
16624
 
16481
16625
  // src/components/games/DailyQuizGame.tsx
16482
- var import_react108 = require("react");
16626
+ var import_react109 = require("react");
16483
16627
  var import_jsx_runtime135 = require("react/jsx-runtime");
16484
16628
  function parseClientState6(json) {
16485
16629
  if (!json) return null;
@@ -16520,8 +16664,8 @@ function DailyQuizGame({
16520
16664
  }) {
16521
16665
  const s = ui.games.dailyQuiz;
16522
16666
  const title = gameTitle({ gameId: "daily-quiz" }, ui.games.titles);
16523
- const [selections, setSelections] = (0, import_react108.useState)(/* @__PURE__ */ new Map());
16524
- const [page, setPage] = (0, import_react108.useState)(0);
16667
+ const [selections, setSelections] = (0, import_react109.useState)(/* @__PURE__ */ new Map());
16668
+ const [page, setPage] = (0, import_react109.useState)(0);
16525
16669
  const clientState = parseClientState6(result?.clientStateJson);
16526
16670
  const results2 = clientState?.results ?? [];
16527
16671
  const isRevealed = results2.length > 0 || result?.alreadyPlayed === true;
@@ -16631,7 +16775,7 @@ function DailyQuizGame({
16631
16775
  }
16632
16776
 
16633
16777
  // src/components/games/MatchdayPredictorGame.tsx
16634
- var import_react109 = require("react");
16778
+ var import_react110 = require("react");
16635
16779
  var import_jsx_runtime136 = require("react/jsx-runtime");
16636
16780
  var SCORER_SEARCH_THRESHOLD = 9;
16637
16781
  function parseClientState7(json) {
@@ -16727,12 +16871,12 @@ function MatchdayPredictorGame({
16727
16871
  onBack
16728
16872
  }) {
16729
16873
  const t = ui.games.predictor;
16730
- const [homeScore, setHomeScore] = (0, import_react109.useState)(0);
16731
- const [awayScore, setAwayScore] = (0, import_react109.useState)(0);
16732
- const [firstScorerPlayerId, setFirstScorerPlayerId] = (0, import_react109.useState)(null);
16733
- const [lastEdited, setLastEdited] = (0, import_react109.useState)("home");
16734
- const [query, setQuery] = (0, import_react109.useState)("");
16735
- const searchId = (0, import_react109.useId)();
16874
+ const [homeScore, setHomeScore] = (0, import_react110.useState)(0);
16875
+ const [awayScore, setAwayScore] = (0, import_react110.useState)(0);
16876
+ const [firstScorerPlayerId, setFirstScorerPlayerId] = (0, import_react110.useState)(null);
16877
+ const [lastEdited, setLastEdited] = (0, import_react110.useState)("home");
16878
+ const [query, setQuery] = (0, import_react110.useState)("");
16879
+ const searchId = (0, import_react110.useId)();
16736
16880
  const clientState = parseClientState7(result?.clientStateJson);
16737
16881
  const alreadyPlayed = result?.alreadyPlayed === true;
16738
16882
  const header = /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
@@ -16899,7 +17043,7 @@ function MatchdayPredictorGame({
16899
17043
  }
16900
17044
 
16901
17045
  // src/components/games/StartingXiGame.tsx
16902
- var import_react110 = require("react");
17046
+ var import_react111 = require("react");
16903
17047
  var import_jsx_runtime137 = require("react/jsx-runtime");
16904
17048
  var POINTS_PER_STARTER = 8;
16905
17049
  var XI_SIZE = 11;
@@ -16943,10 +17087,10 @@ function StartingXiGame({
16943
17087
  lockAtUtc
16944
17088
  }) {
16945
17089
  const t = ui.games.startingXi;
16946
- const [slotPlayers, setSlotPlayers] = (0, import_react110.useState)(() => Array(XI_SIZE).fill(null));
16947
- const [active, setActive] = (0, import_react110.useState)(0);
16948
- const [query, setQuery] = (0, import_react110.useState)("");
16949
- const searchId = (0, import_react110.useId)();
17090
+ const [slotPlayers, setSlotPlayers] = (0, import_react111.useState)(() => Array(XI_SIZE).fill(null));
17091
+ const [active, setActive] = (0, import_react111.useState)(0);
17092
+ const [query, setQuery] = (0, import_react111.useState)("");
17093
+ const searchId = (0, import_react111.useId)();
16950
17094
  const clientState = parseClientState8(result?.clientStateJson);
16951
17095
  const alreadyPlayed = result?.alreadyPlayed === true;
16952
17096
  const header = /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
@@ -17085,7 +17229,7 @@ function StartingXiGame({
17085
17229
  }
17086
17230
 
17087
17231
  // src/components/games/StatLadderGame.tsx
17088
- var import_react111 = require("react");
17232
+ var import_react112 = require("react");
17089
17233
  var import_jsx_runtime138 = require("react/jsx-runtime");
17090
17234
  function ladderClue(ladder) {
17091
17235
  const mystery = ladder.find((r) => r.rank === 2);
@@ -17122,9 +17266,9 @@ function StatLadderGame({
17122
17266
  onBack
17123
17267
  }) {
17124
17268
  const t = ui.games.statLadder;
17125
- const [query, setQuery] = (0, import_react111.useState)("");
17126
- const [selectedId, setSelectedId] = (0, import_react111.useState)(null);
17127
- const searchId = (0, import_react111.useId)();
17269
+ const [query, setQuery] = (0, import_react112.useState)("");
17270
+ const [selectedId, setSelectedId] = (0, import_react112.useState)(null);
17271
+ const searchId = (0, import_react112.useId)();
17128
17272
  const clientState = parseClientState9(result?.clientStateJson);
17129
17273
  const revealed = clientState != null;
17130
17274
  const header = /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(GameHeader, { title: gameTitle({ gameId: "stat-ladder" }, ui.games.titles), eyebrow: t.eyebrow, onBack, backLabel: ui.back });
@@ -17330,8 +17474,8 @@ function GameScreenHost({
17330
17474
  ui
17331
17475
  }) {
17332
17476
  const { gameId, fixtureId, gameDay = "", lockAtUtc = null } = selected;
17333
- const [configJson, setConfigJson] = (0, import_react112.useState)(null);
17334
- (0, import_react112.useEffect)(() => {
17477
+ const [configJson, setConfigJson] = (0, import_react113.useState)(null);
17478
+ (0, import_react113.useEffect)(() => {
17335
17479
  setConfigJson(null);
17336
17480
  if (!conversation) return;
17337
17481
  let cancelled = false;
@@ -17354,12 +17498,12 @@ function GameScreenHost({
17354
17498
  fixtureId: fixtureId || void 0,
17355
17499
  locale: ui.hostTag
17356
17500
  });
17357
- (0, import_react112.useEffect)(() => {
17501
+ (0, import_react113.useEffect)(() => {
17358
17502
  if (conversation) hydrate();
17359
17503
  }, [conversation, gameId]);
17360
- const hydrateRef = (0, import_react112.useRef)(hydrate);
17504
+ const hydrateRef = (0, import_react113.useRef)(hydrate);
17361
17505
  hydrateRef.current = hydrate;
17362
- (0, import_react112.useEffect)(() => {
17506
+ (0, import_react113.useEffect)(() => {
17363
17507
  if (!FIXTURE_GAME_IDS.has(gameId)) return;
17364
17508
  if (rawStatus !== "pending") return;
17365
17509
  const timerId = setInterval(() => {
@@ -17472,7 +17616,7 @@ function GameScreenHost({
17472
17616
  }
17473
17617
 
17474
17618
  // src/components/Leaderboard.tsx
17475
- var import_react113 = require("react");
17619
+ var import_react114 = require("react");
17476
17620
 
17477
17621
  // src/components/LeaderboardRow.tsx
17478
17622
  var import_jsx_runtime141 = require("react/jsx-runtime");
@@ -17559,7 +17703,7 @@ function Leaderboard({
17559
17703
  ui,
17560
17704
  onPlay
17561
17705
  }) {
17562
- const [segment, setSegment] = (0, import_react113.useState)("weekly");
17706
+ const [segment, setSegment] = (0, import_react114.useState)("weekly");
17563
17707
  const myRow = segment === "weekly" ? data.myWeeklyRow : data.myAllTimeRow;
17564
17708
  const offBoard = myRow !== null && myRow !== void 0 && myRow.rank === -1;
17565
17709
  const isEmpty = segment === "weekly" ? data.weeklyTop.length === 0 : data.allTimeTop.length === 0;
@@ -17664,9 +17808,9 @@ function GamesPanel({
17664
17808
  leaderboardLoading,
17665
17809
  refreshHub
17666
17810
  }) {
17667
- const [selected, setSelected] = (0, import_react114.useState)(null);
17668
- const [segment, setSegment] = (0, import_react114.useState)("play");
17669
- (0, import_react114.useEffect)(() => {
17811
+ const [selected, setSelected] = (0, import_react115.useState)(null);
17812
+ const [segment, setSegment] = (0, import_react115.useState)("play");
17813
+ (0, import_react115.useEffect)(() => {
17670
17814
  ensureGamesFonts();
17671
17815
  }, []);
17672
17816
  if (!loggedIn) return /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(GamesLoginWall, { ui });
@@ -17730,10 +17874,10 @@ function GamesPanel({
17730
17874
  }
17731
17875
 
17732
17876
  // src/components/FavouritesPanel.tsx
17733
- var import_react117 = require("react");
17877
+ var import_react118 = require("react");
17734
17878
 
17735
17879
  // src/components/FavouriteChips.tsx
17736
- var import_react115 = require("react");
17880
+ var import_react116 = require("react");
17737
17881
  var import_jsx_runtime146 = require("react/jsx-runtime");
17738
17882
  async function toggleWithNotice(controller, kind, id, onNotice) {
17739
17883
  const outcome = await controller.toggle(kind, id);
@@ -17779,12 +17923,12 @@ function Group({ title, entities, sport, ui, controller, onNotice }) {
17779
17923
  ] });
17780
17924
  }
17781
17925
  function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNotice }) {
17782
- const [confirming, setConfirming] = (0, import_react115.useState)(false);
17926
+ const [confirming, setConfirming] = (0, import_react116.useState)(false);
17783
17927
  const data = controller.data;
17784
- (0, import_react115.useEffect)(() => {
17928
+ (0, import_react116.useEffect)(() => {
17785
17929
  setConfirming(false);
17786
17930
  }, [sport]);
17787
- (0, import_react115.useEffect)(() => {
17931
+ (0, import_react116.useEffect)(() => {
17788
17932
  if (!confirming) return;
17789
17933
  const onPointerDown = (e) => {
17790
17934
  if (!(e.target instanceof Element) || !e.target.closest("[data-fav-confirm]")) setConfirming(false);
@@ -17838,21 +17982,21 @@ function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNoti
17838
17982
  }
17839
17983
 
17840
17984
  // src/components/FavouritesSearch.tsx
17841
- var import_react116 = require("react");
17985
+ var import_react117 = require("react");
17842
17986
  var import_jsx_runtime147 = require("react/jsx-runtime");
17843
17987
  var MIN_LETTERS = 2;
17844
17988
  var MAX_LENGTH = 64;
17845
17989
  var DEBOUNCE_MS = 250;
17846
17990
  function FavouritesSearch({ controller, ui, sport, onNotice }) {
17847
- const [query, setQuery] = (0, import_react116.useState)("");
17848
- const [answer, setAnswer] = (0, import_react116.useState)(null);
17849
- const controllerRef = (0, import_react116.useRef)(controller);
17991
+ const [query, setQuery] = (0, import_react117.useState)("");
17992
+ const [answer, setAnswer] = (0, import_react117.useState)(null);
17993
+ const controllerRef = (0, import_react117.useRef)(controller);
17850
17994
  controllerRef.current = controller;
17851
17995
  const trimmed = query.trim();
17852
17996
  const queryKey = `${sport}|${trimmed}`;
17853
17997
  const results2 = answer?.key === queryKey ? answer.rows : [];
17854
17998
  const settled = answer?.key === queryKey;
17855
- (0, import_react116.useEffect)(() => {
17999
+ (0, import_react117.useEffect)(() => {
17856
18000
  setAnswer(null);
17857
18001
  if (trimmed.length < MIN_LETTERS) return;
17858
18002
  let cancelled = false;
@@ -17915,13 +18059,13 @@ function FavouritesSearch({ controller, ui, sport, onNotice }) {
17915
18059
  // src/components/FavouritesPanel.tsx
17916
18060
  var import_jsx_runtime148 = require("react/jsx-runtime");
17917
18061
  function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
17918
- const [notice, setNotice] = (0, import_react117.useState)(null);
17919
- const refreshRef = (0, import_react117.useRef)(controller.refresh);
18062
+ const [notice, setNotice] = (0, import_react118.useState)(null);
18063
+ const refreshRef = (0, import_react118.useRef)(controller.refresh);
17920
18064
  refreshRef.current = controller.refresh;
17921
- (0, import_react117.useEffect)(() => {
18065
+ (0, import_react118.useEffect)(() => {
17922
18066
  void refreshRef.current();
17923
18067
  }, []);
17924
- (0, import_react117.useEffect)(() => {
18068
+ (0, import_react118.useEffect)(() => {
17925
18069
  setNotice(null);
17926
18070
  }, [sport]);
17927
18071
  const sportLabel2 = sports.find((s) => s.sport === sport)?.label ?? sportLabel(ui, sport);
@@ -17947,11 +18091,11 @@ function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
17947
18091
  }
17948
18092
 
17949
18093
  // src/components/PresetTools.tsx
17950
- var import_react118 = require("react");
18094
+ var import_react119 = require("react");
17951
18095
  var import_jsx_runtime149 = require("react/jsx-runtime");
17952
18096
  function PresetToolModal({ title, closeLabel, onClose, children, footer, className }) {
17953
18097
  const { dialogRef, onKeyDown } = useModalDialog(onClose, { restoreFocus: false });
17954
- const titleId = (0, import_react118.useId)();
18098
+ const titleId = (0, import_react119.useId)();
17955
18099
  return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: className ? `ss-w-tool-backdrop ${className}` : "ss-w-tool-backdrop", children: /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { ref: dialogRef, className: "ss-w-tool", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, tabIndex: -1, onKeyDown, children: [
17956
18100
  /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "ss-w-tool-head", children: [
17957
18101
  /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("h2", { id: titleId, className: "ss-w-tool-title", children: title }),
@@ -18001,9 +18145,9 @@ function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal,
18001
18145
  const totalOptions = comboTotals(grid);
18002
18146
  const totals = totalOptions.map((o) => o.value);
18003
18147
  const legChoices = comboLegChoices(grid);
18004
- const [total, setTotal] = (0, import_react118.useState)(() => nearest(totals, initialTotal));
18005
- const [legs, setLegs] = (0, import_react118.useState)(() => legsForTotal(grid, nearest(totals, initialTotal), clampLegs(legChoices, initialLegs)));
18006
- const [announcement, setAnnouncement] = (0, import_react118.useState)("");
18148
+ const [total, setTotal] = (0, import_react119.useState)(() => nearest(totals, initialTotal));
18149
+ const [legs, setLegs] = (0, import_react119.useState)(() => legsForTotal(grid, nearest(totals, initialTotal), clampLegs(legChoices, initialLegs)));
18150
+ const [announcement, setAnnouncement] = (0, import_react119.useState)("");
18007
18151
  const cell2 = findCombo(grid, total, legs);
18008
18152
  const minLegs = legChoices[0] ?? legs;
18009
18153
  const maxLegs = legChoices[legChoices.length - 1] ?? legs;
@@ -18042,7 +18186,7 @@ function FavouritesSheet({ ui, controller, sport, sports, onSportChange, onClose
18042
18186
  }
18043
18187
 
18044
18188
  // src/components/dashboard/v8/SentenceBuilder.tsx
18045
- var import_react119 = require("react");
18189
+ var import_react120 = require("react");
18046
18190
  var import_widget_sdk38 = require("@sensiblestats/widget-sdk");
18047
18191
  var import_jsx_runtime151 = require("react/jsx-runtime");
18048
18192
  var TOTALS = ["any", "3", "5", "10", "20", "50"];
@@ -18083,8 +18227,8 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
18083
18227
  const opening = openingGames(preset);
18084
18228
  const gamesOptions = opening.options;
18085
18229
  const marketOptions = usableMarkets(preset);
18086
- const [fingerprint] = (0, import_react119.useState)(() => JSON.stringify(preset));
18087
- const [saved] = (0, import_react119.useState)(() => {
18230
+ const [fingerprint] = (0, import_react120.useState)(() => JSON.stringify(preset));
18231
+ const [saved] = (0, import_react120.useState)(() => {
18088
18232
  const kept = memory3?.savedView(sport);
18089
18233
  return kept && kept.fingerprint === fingerprint ? kept : null;
18090
18234
  });
@@ -18099,9 +18243,9 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
18099
18243
  // The server never widens by itself: an all-games preset with no ids asks for it.
18100
18244
  widen: opening.option ? opening.option.matchIds.length === 0 : preset.gamesScope === "all" && preset.matchIds.length === 0
18101
18245
  };
18102
- const [view, setView] = (0, import_react119.useState)(() => saved?.view ?? openingView);
18103
- const autoWidened = (0, import_react119.useRef)(false);
18104
- const [widenedNote, setWidenedNote] = (0, import_react119.useState)(saved?.widenedNote ?? false);
18246
+ const [view, setView] = (0, import_react120.useState)(() => saved?.view ?? openingView);
18247
+ const autoWidened = (0, import_react120.useRef)(false);
18248
+ const [widenedNote, setWidenedNote] = (0, import_react120.useState)(saved?.widenedNote ?? false);
18105
18249
  const track = useTrack();
18106
18250
  const requestFor = (v, extra) => ({
18107
18251
  sport,
@@ -18117,18 +18261,18 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
18117
18261
  ...operatorUserId ? { operatorUserId } : {},
18118
18262
  ...anonymousUserId ? { anonymousUserId } : {}
18119
18263
  });
18120
- const [editing, setEditing] = (0, import_react119.useState)(false);
18121
- const [draft, setDraft] = (0, import_react119.useState)("");
18122
- const [invalid, setInvalid] = (0, import_react119.useState)(null);
18123
- const inputRef = (0, import_react119.useRef)(null);
18124
- const pencilRef = (0, import_react119.useRef)(null);
18125
- const noteId = (0, import_react119.useId)();
18126
- const customId = (0, import_react119.useId)();
18127
- (0, import_react119.useEffect)(() => {
18264
+ const [editing, setEditing] = (0, import_react120.useState)(false);
18265
+ const [draft, setDraft] = (0, import_react120.useState)("");
18266
+ const [invalid, setInvalid] = (0, import_react120.useState)(null);
18267
+ const inputRef = (0, import_react120.useRef)(null);
18268
+ const pencilRef = (0, import_react120.useRef)(null);
18269
+ const noteId = (0, import_react120.useId)();
18270
+ const customId = (0, import_react120.useId)();
18271
+ (0, import_react120.useEffect)(() => {
18128
18272
  if (editing) inputRef.current?.focus();
18129
18273
  }, [editing]);
18130
18274
  const customLabel = (c) => c.format === oddsFormat ? c.text : c.decimal;
18131
- (0, import_react119.useEffect)(() => {
18275
+ (0, import_react120.useEffect)(() => {
18132
18276
  if (view.legs === 1) {
18133
18277
  setEditing(false);
18134
18278
  setDraft("");
@@ -18144,16 +18288,16 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
18144
18288
  setEditing(false);
18145
18289
  pencilRef.current?.focus();
18146
18290
  };
18147
- const [first] = (0, import_react119.useState)(() => requestFor(view));
18291
+ const [first] = (0, import_react120.useState)(() => requestFor(view));
18148
18292
  const { grid, answeredFor, status: status2, confirmed, request } = useBuilderGrid({ conversation, locale: ui.hostTag, memory: memory3, initial: first });
18149
- const [shown2, setShown] = (0, import_react119.useState)(null);
18293
+ const [shown2, setShown] = (0, import_react120.useState)(null);
18150
18294
  if (grid === null) {
18151
18295
  if (shown2 !== null && status2 === "ready") setShown(null);
18152
18296
  } else if (answeredFor && (shown2?.seen !== grid || shown2.seenReq !== answeredFor)) {
18153
18297
  setShown(shownAfter(shown2, grid, answeredFor));
18154
18298
  }
18155
- const lastRequest = (0, import_react119.useRef)(first);
18156
- (0, import_react119.useEffect)(() => {
18299
+ const lastRequest = (0, import_react120.useRef)(first);
18300
+ (0, import_react120.useEffect)(() => {
18157
18301
  void request(lastRequest.current);
18158
18302
  }, [request]);
18159
18303
  const send = (req) => {
@@ -18191,7 +18335,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
18191
18335
  };
18192
18336
  const canNarrow = preset.matchIds.length > 0;
18193
18337
  const ready = status2 === "ready" && grid !== null;
18194
- const [tapped, setTapped] = (0, import_react119.useState)(null);
18338
+ const [tapped, setTapped] = (0, import_react120.useState)(null);
18195
18339
  const busy = tapped !== null && status2 === "loading" && shown2 !== null;
18196
18340
  const g = ready ? shown2?.grid ?? grid : busy ? shown2.grid : null;
18197
18341
  const suggested = g?.status === "miss" || g?.nearest === true ? g.legCountThatLands : null;
@@ -18200,8 +18344,8 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
18200
18344
  ...[preset.legs, suggested].filter((n) => n !== null && n > 4)
18201
18345
  ])).sort((a, b) => a - b);
18202
18346
  const rows = g && g.status === "ok" ? legsOf(g, sport) : null;
18203
- const sectionRef = (0, import_react119.useRef)(null);
18204
- (0, import_react119.useEffect)(() => {
18347
+ const sectionRef = (0, import_react120.useRef)(null);
18348
+ (0, import_react120.useEffect)(() => {
18205
18349
  if (tapped === null || status2 !== "ready") return;
18206
18350
  setTapped(null);
18207
18351
  const root = sectionRef.current;
@@ -18218,14 +18362,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
18218
18362
  }, [tapped, status2]);
18219
18363
  const rowSlip = rows ? guardLegsPreMatch(slip, rows, ui) : slip;
18220
18364
  useNextKickoffRender(rows ? rows.map((l) => l.kickoffUtc) : []);
18221
- const [startedNote, setStartedNote] = (0, import_react119.useState)(false);
18365
+ const [startedNote, setStartedNote] = (0, import_react120.useState)(false);
18222
18366
  const anyStarted = rows !== null && rows.some((l) => !preMatchOpen(l.kickoffUtc, Date.now()));
18223
- (0, import_react119.useEffect)(() => {
18367
+ (0, import_react120.useEffect)(() => {
18224
18368
  if (startedNote && status2 === "ready" && !anyStarted) setStartedNote(false);
18225
18369
  }, [startedNote, status2, anyStarted]);
18226
18370
  const market = rows?.[0]?.market;
18227
- const [seen2, setSeen] = (0, import_react119.useState)(null);
18228
- (0, import_react119.useEffect)(() => {
18371
+ const [seen2, setSeen] = (0, import_react120.useState)(null);
18372
+ (0, import_react120.useEffect)(() => {
18229
18373
  if (market) setSeen(market);
18230
18374
  }, [market]);
18231
18375
  const marketName = view.marketKey === null ? null : marketOptions?.find((m) => m.key === view.marketKey)?.label ?? market ?? seen2;
@@ -18269,14 +18413,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
18269
18413
  };
18270
18414
  };
18271
18415
  const canWiden = gamesOptions === null || allGames !== null;
18272
- (0, import_react119.useEffect)(() => {
18416
+ (0, import_react120.useEffect)(() => {
18273
18417
  if (!empty2 || !singles || widened || !canWiden || autoWidened.current) return;
18274
18418
  autoWidened.current = true;
18275
18419
  const next = { ...view, widen: true, matchIds: [], gamesId: allGames ? allGames.id : view.gamesId };
18276
18420
  commit(next, true);
18277
18421
  send(requestFor(next));
18278
18422
  }, [empty2, singles, widened, canWiden, view]);
18279
- (0, import_react119.useEffect)(() => {
18423
+ (0, import_react120.useEffect)(() => {
18280
18424
  if (coolOff) onCoolOff?.(sport);
18281
18425
  }, [coolOff, onCoolOff, sport]);
18282
18426
  if (coolOff) return null;
@@ -18743,10 +18887,10 @@ function Squad({ squad, loading, ui, view, onToggleView, stats, statsLoading, se
18743
18887
  }
18744
18888
 
18745
18889
  // src/components/PlayerPhoto.tsx
18746
- var import_react120 = require("react");
18890
+ var import_react121 = require("react");
18747
18891
  var import_jsx_runtime157 = require("react/jsx-runtime");
18748
18892
  function PlayerPhoto({ photoUrl, jerseyNumber, size }) {
18749
- const [failed, setFailed] = (0, import_react120.useState)(false);
18893
+ const [failed, setFailed] = (0, import_react121.useState)(false);
18750
18894
  const box = { width: size, height: size };
18751
18895
  if (photoUrl && !failed) {
18752
18896
  return /* @__PURE__ */ (0, import_jsx_runtime157.jsx)("img", { className: "ss-w-pd-photo", style: box, src: photoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
@@ -18781,7 +18925,7 @@ function MiniPitch({ positionCode }) {
18781
18925
  }
18782
18926
 
18783
18927
  // src/components/PerformanceBars.tsx
18784
- var import_react121 = require("react");
18928
+ var import_react122 = require("react");
18785
18929
  var import_jsx_runtime159 = require("react/jsx-runtime");
18786
18930
  var GROUPS = ["shooting", "passing", "possession", "defending"];
18787
18931
  function finite4(v) {
@@ -18827,7 +18971,7 @@ function unrankedLine(ui, reason) {
18827
18971
  }
18828
18972
  }
18829
18973
  function PerformanceBars({ performance, competitionName, strings }) {
18830
- const [mode, setMode] = (0, import_react121.useState)("total");
18974
+ const [mode, setMode] = (0, import_react122.useState)("total");
18831
18975
  const labelled = performance.metrics.filter((m) => Object.prototype.hasOwnProperty.call(strings.perfMetric, m.key));
18832
18976
  if (!labelled.some((m) => valueOf(m, "total") !== null || valueOf(m, "per90") !== null)) return null;
18833
18977
  const subtitle = !performance.ranked ? unrankedLine(strings, performance.unrankedReason) : competitionName ? strings.perfRankedAgainst(competitionName, performance.positionGroup) : null;
@@ -19036,8 +19180,8 @@ function SettingsSheet({ ui, onClose }) {
19036
19180
  var import_jsx_runtime162 = require("react/jsx-runtime");
19037
19181
  var FULLSCREEN_QUERY = "(max-width: 639px)";
19038
19182
  function useIsModal() {
19039
- const [modal, setModal] = (0, import_react122.useState)(false);
19040
- (0, import_react122.useEffect)(() => {
19183
+ const [modal, setModal] = (0, import_react123.useState)(false);
19184
+ (0, import_react123.useEffect)(() => {
19041
19185
  if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
19042
19186
  const mql = window.matchMedia(FULLSCREEN_QUERY);
19043
19187
  const sync = () => setModal(mql.matches);
@@ -19051,12 +19195,12 @@ var HIDDEN_LAYER_STYLE = { position: "absolute", inset: 0, visibility: "hidden",
19051
19195
  var SQUAD_LAYER_STYLE = { display: "flex", flexDirection: "column", flex: 1, minHeight: 0 };
19052
19196
  function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, schedule, gamesResult, leaderboardResult, clubFixturesResult, clubStandingsResult, clubSquadResult, clubSquadStatsResult, clubPlayerDetailResult, loggedIn, conversation, presetGrid, favouritesEnabled, favourites, builder, onCloseRequested, onRegisterBack }) {
19053
19197
  const { state, close, stop, send, reset } = controller;
19054
- const [squadView, setSquadView] = (0, import_react122.useState)("roster");
19055
- const [selectedPlayerId, setSelectedPlayerId] = (0, import_react122.useState)(null);
19198
+ const [squadView, setSquadView] = (0, import_react123.useState)("roster");
19199
+ const [selectedPlayerId, setSelectedPlayerId] = (0, import_react123.useState)(null);
19056
19200
  const clearPlayerDetail = clubPlayerDetailResult?.clear;
19057
19201
  const fetchPlayerDetail = clubPlayerDetailResult?.fetch;
19058
- const squadLayerRef = (0, import_react122.useRef)(null);
19059
- const squadScrollRef = (0, import_react122.useRef)(null);
19202
+ const squadLayerRef = (0, import_react123.useRef)(null);
19203
+ const squadScrollRef = (0, import_react123.useRef)(null);
19060
19204
  const selectPlayer = (playerId) => {
19061
19205
  squadScrollRef.current = squadLayerRef.current?.querySelector(".ss-w-mon-list")?.scrollTop ?? null;
19062
19206
  setSelectedPlayerId(playerId);
@@ -19066,7 +19210,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
19066
19210
  setSelectedPlayerId(null);
19067
19211
  clearPlayerDetail?.();
19068
19212
  };
19069
- (0, import_react122.useLayoutEffect)(() => {
19213
+ (0, import_react123.useLayoutEffect)(() => {
19070
19214
  if (selectedPlayerId !== null || squadScrollRef.current === null) return;
19071
19215
  const list = squadLayerRef.current?.querySelector(".ss-w-mon-list");
19072
19216
  if (list) list.scrollTop = squadScrollRef.current;
@@ -19079,7 +19223,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
19079
19223
  const hasBuilder = !clubBrand && (builderOptions?.length ?? 0) > 0;
19080
19224
  const tabs = monitor ?? (hasBuilder ? tabState : void 0);
19081
19225
  const activeTab = tabs?.activeTab;
19082
- (0, import_react122.useEffect)(() => {
19226
+ (0, import_react123.useEffect)(() => {
19083
19227
  if (activeTab === "squad" || selectedPlayerId === null) return;
19084
19228
  setSelectedPlayerId(null);
19085
19229
  clearPlayerDetail?.();
@@ -19088,11 +19232,11 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
19088
19232
  const favouritesOpen = favouritesOffered && (favourites?.open ?? false);
19089
19233
  const favouritesAskedOpen = favourites?.open ?? false;
19090
19234
  const setFavouritesOpen = favourites?.onOpenChange;
19091
- (0, import_react122.useEffect)(() => {
19235
+ (0, import_react123.useEffect)(() => {
19092
19236
  if (favouritesAskedOpen && !favouritesOffered) setFavouritesOpen?.(false);
19093
19237
  }, [favouritesAskedOpen, favouritesOffered, setFavouritesOpen]);
19094
19238
  const storedTab = tabState?.activeTab;
19095
- (0, import_react122.useEffect)(() => {
19239
+ (0, import_react123.useEffect)(() => {
19096
19240
  const unreachable = storedTab === "builder" ? !hasBuilder : !monitor && storedTab !== void 0 && storedTab !== "chat";
19097
19241
  if (unreachable) setMonitorTab?.("chat");
19098
19242
  }, [storedTab, hasBuilder, monitor, setMonitorTab]);
@@ -19101,12 +19245,12 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
19101
19245
  const closeTab = tabs?.activeTab ?? "chat";
19102
19246
  const lastMessage = state.messages[state.messages.length - 1];
19103
19247
  const answering = state.isStreaming && !(lastMessage?.role === "assistant" && lastMessage.isGreeting);
19104
- const closeWith = (0, import_react122.useCallback)((method) => {
19248
+ const closeWith = (0, import_react123.useCallback)((method) => {
19105
19249
  track({ name: "widget_close", method, tab: closeTab, answering });
19106
19250
  if (onCloseRequested) onCloseRequested();
19107
19251
  else close();
19108
19252
  }, [track, closeTab, answering, close, onCloseRequested]);
19109
- (0, import_react122.useEffect)(() => {
19253
+ (0, import_react123.useEffect)(() => {
19110
19254
  const onKey = (e) => {
19111
19255
  if (e.key === "Escape") closeWith("escape");
19112
19256
  };
@@ -19122,78 +19266,78 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
19122
19266
  tabs?.setActiveTab("chat");
19123
19267
  send(text2, { grounding, source });
19124
19268
  };
19125
- (0, import_react122.useEffect)(() => {
19269
+ (0, import_react123.useEffect)(() => {
19126
19270
  if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
19127
19271
  }, [monitor, state.isStreaming, state.messages.length]);
19128
19272
  const onChatTab = !tabs || tabs.activeTab === "chat";
19129
- const inputRef = (0, import_react122.useRef)(null);
19130
- const limitRef = (0, import_react122.useRef)(null);
19131
- const typedSendRef = (0, import_react122.useRef)(false);
19132
- const focusAfterCloseRef = (0, import_react122.useRef)(null);
19133
- const [tool, setTool] = (0, import_react122.useState)(null);
19134
- const panelRef = (0, import_react122.useRef)(null);
19135
- const [settingsOpen, setSettingsOpen] = (0, import_react122.useState)(false);
19136
- const openSettings = (0, import_react122.useCallback)(() => {
19273
+ const inputRef = (0, import_react123.useRef)(null);
19274
+ const limitRef = (0, import_react123.useRef)(null);
19275
+ const typedSendRef = (0, import_react123.useRef)(false);
19276
+ const focusAfterCloseRef = (0, import_react123.useRef)(null);
19277
+ const [tool, setTool] = (0, import_react123.useState)(null);
19278
+ const panelRef = (0, import_react123.useRef)(null);
19279
+ const [settingsOpen, setSettingsOpen] = (0, import_react123.useState)(false);
19280
+ const openSettings = (0, import_react123.useCallback)(() => {
19137
19281
  setTool(null);
19138
19282
  setFavouritesOpen?.(false);
19139
19283
  setSettingsOpen(true);
19140
19284
  }, [setFavouritesOpen]);
19141
- const closeSettings = (0, import_react122.useCallback)(() => {
19285
+ const closeSettings = (0, import_react123.useCallback)(() => {
19142
19286
  setSettingsOpen(false);
19143
19287
  panelRef.current?.querySelector(".ss-w-kebab")?.focus();
19144
19288
  }, []);
19145
- const openFavourites = (0, import_react122.useCallback)(() => setFavouritesOpen?.(true), [setFavouritesOpen]);
19146
- const closeFavourites = (0, import_react122.useCallback)(() => {
19289
+ const openFavourites = (0, import_react123.useCallback)(() => setFavouritesOpen?.(true), [setFavouritesOpen]);
19290
+ const closeFavourites = (0, import_react123.useCallback)(() => {
19147
19291
  setFavouritesOpen?.(false);
19148
19292
  panelRef.current?.querySelector(".ss-w-kebab")?.focus();
19149
19293
  }, [setFavouritesOpen]);
19150
- (0, import_react122.useEffect)(() => {
19294
+ (0, import_react123.useEffect)(() => {
19151
19295
  if (!favouritesOpen) return;
19152
19296
  setTool(null);
19153
19297
  setSettingsOpen(false);
19154
19298
  }, [favouritesOpen]);
19155
19299
  const paused = isPaused(state.limit);
19156
- (0, import_react122.useEffect)(() => {
19300
+ (0, import_react123.useEffect)(() => {
19157
19301
  if (paused) setTool(null);
19158
19302
  }, [paused]);
19159
- (0, import_react122.useEffect)(() => {
19303
+ (0, import_react123.useEffect)(() => {
19160
19304
  if (!paused) return;
19161
19305
  if (typedSendRef.current) limitRef.current?.focus();
19162
19306
  typedSendRef.current = false;
19163
19307
  }, [paused]);
19164
- const openTool = (0, import_react122.useCallback)((next) => {
19308
+ const openTool = (0, import_react123.useCallback)((next) => {
19165
19309
  setTool(next);
19166
19310
  }, []);
19167
- const toolsValue = (0, import_react122.useMemo)(
19311
+ const toolsValue = (0, import_react123.useMemo)(
19168
19312
  () => presetGrid && !paused ? { openBuilder: (total, legs) => openTool({ total, legs }), changeLabel: ui.presets.changeCombo } : null,
19169
19313
  [presetGrid, paused, openTool, ui.presets.changeCombo]
19170
19314
  );
19171
- const closeTool = (0, import_react122.useCallback)(() => {
19315
+ const closeTool = (0, import_react123.useCallback)(() => {
19172
19316
  focusAfterCloseRef.current = "composer";
19173
19317
  setTool(null);
19174
19318
  }, []);
19175
- const sendAsk = (0, import_react122.useCallback)((ask) => {
19319
+ const sendAsk = (0, import_react123.useCallback)((ask) => {
19176
19320
  focusAfterCloseRef.current = "composer";
19177
19321
  setTool(null);
19178
19322
  tabs?.setActiveTab("chat");
19179
19323
  send(ask.message, { displayText: ask.displayText, preset: ask.preset, source: "preset" });
19180
19324
  }, [tabs, send]);
19181
- const formatKickoff = (0, import_react122.useCallback)((kickoffUtc) => {
19325
+ const formatKickoff = (0, import_react123.useCallback)((kickoffUtc) => {
19182
19326
  const k = ui.bettingKickoff(kickoffUtc);
19183
19327
  return `${k.dayLabel} ${k.time}`;
19184
19328
  }, [ui]);
19185
- (0, import_react122.useEffect)(() => {
19329
+ (0, import_react123.useEffect)(() => {
19186
19330
  if (tool) return;
19187
19331
  const target = focusAfterCloseRef.current;
19188
19332
  focusAfterCloseRef.current = null;
19189
19333
  if (target === "composer") inputRef.current?.focus();
19190
19334
  }, [tool]);
19191
- (0, import_react122.useEffect)(() => {
19335
+ (0, import_react123.useEffect)(() => {
19192
19336
  if (!tool || onChatTab && presetGrid) return;
19193
19337
  focusAfterCloseRef.current = "composer";
19194
19338
  setTool(null);
19195
19339
  }, [tool, onChatTab, presetGrid]);
19196
- const backRef = (0, import_react122.useRef)(() => false);
19340
+ const backRef = (0, import_react123.useRef)(() => false);
19197
19341
  backRef.current = () => {
19198
19342
  if (favouritesOpen) {
19199
19343
  closeFavourites();
@@ -19217,7 +19361,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
19217
19361
  }
19218
19362
  return false;
19219
19363
  };
19220
- (0, import_react122.useEffect)(() => {
19364
+ (0, import_react123.useEffect)(() => {
19221
19365
  if (!onRegisterBack) return;
19222
19366
  onRegisterBack(() => backRef.current());
19223
19367
  return () => onRegisterBack(null);
@@ -22296,13 +22440,15 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
22296
22440
  // src/StatsWidget.tsx
22297
22441
  var import_jsx_runtime164 = require("react/jsx-runtime");
22298
22442
  var NO_OWNER = {};
22299
- function buildClient(props) {
22443
+ function buildClient(props, onUnavailable) {
22300
22444
  try {
22301
22445
  if ("client" in props && props.client) {
22302
22446
  return { client: props.client, conversation: props.client.conversation() };
22303
22447
  }
22304
22448
  const cfg = props.config;
22305
- const client = new import_widget_sdk39.StatsWidgetClient(toClientOptions(cfg));
22449
+ const options = toClientOptions(cfg);
22450
+ const base = options.fetch ?? ((input, init) => globalThis.fetch(input, init));
22451
+ const client = new import_widget_sdk39.StatsWidgetClient({ ...options, fetch: (0, import_widget_sdk39.observingFetch)(base, onUnavailable) });
22306
22452
  return { client, conversation: client.conversation(toUserContext(cfg)) };
22307
22453
  } catch (err) {
22308
22454
  console.error("[StatsWidget] failed to initialize:", err instanceof Error ? err.message : err);
@@ -22320,12 +22466,19 @@ function injectStyles(root) {
22320
22466
  function StatsWidget(props) {
22321
22467
  const injectedClient = "client" in props ? props.client : void 0;
22322
22468
  const cfg = props.config;
22323
- const built = (0, import_react123.useMemo)(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
22324
- const trackingRef = (0, import_react123.useRef)({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
22325
- const track = (0, import_react123.useMemo)(() => createTracker(() => trackingRef.current), []);
22326
- const eventTextRef = (0, import_react123.useRef)(false);
22469
+ const onUnavailableRef = (0, import_react124.useRef)(cfg?.onUnavailable);
22470
+ onUnavailableRef.current = cfg?.onUnavailable;
22471
+ const built = (0, import_react124.useMemo)(() => buildClient(props, (reason) => {
22472
+ try {
22473
+ onUnavailableRef.current?.(reason);
22474
+ } catch {
22475
+ }
22476
+ }), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId]);
22477
+ const trackingRef = (0, import_react124.useRef)({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
22478
+ const track = (0, import_react124.useMemo)(() => createTracker(() => trackingRef.current), []);
22479
+ const eventTextRef = (0, import_react124.useRef)(false);
22327
22480
  eventTextRef.current = cfg?.eventText === true;
22328
- const logger = (0, import_react123.useMemo)(() => {
22481
+ const logger = (0, import_react124.useMemo)(() => {
22329
22482
  if (!built) return null;
22330
22483
  const raw = built.client.createEventLogger({
22331
22484
  operatorUserId: cfg?.userContext?.operatorUserId,
@@ -22335,27 +22488,27 @@ function StatsWidget(props) {
22335
22488
  }, [built?.client, track]);
22336
22489
  const widgetStrings = useWidgetStrings(cfg, built?.conversation ?? null);
22337
22490
  const stringsPending = widgetStrings.strings === void 0;
22338
- const ui = (0, import_react123.useMemo)(
22491
+ const ui = (0, import_react124.useMemo)(
22339
22492
  () => normalizeUi(props.config ?? { operatorId: "", publicKey: "" }, widgetStrings.strings ?? BUNDLED),
22340
22493
  [props.config, widgetStrings.strings]
22341
22494
  );
22342
22495
  const oddsSettings = useOddsSettingsState(ui, built?.conversation, cfg?.operatorId || "default");
22343
- const rootRef = (0, import_react123.useRef)(null);
22344
- const introDoneRef = (0, import_react123.useRef)(false);
22345
- const markIntroDone = (0, import_react123.useCallback)(() => {
22496
+ const rootRef = (0, import_react124.useRef)(null);
22497
+ const introDoneRef = (0, import_react124.useRef)(false);
22498
+ const markIntroDone = (0, import_react124.useCallback)(() => {
22346
22499
  introDoneRef.current = true;
22347
22500
  }, []);
22348
22501
  const language = injectedClient ? void 0 : hostTag(cfg);
22349
22502
  const threadLanguage = familyOf(language);
22350
- const convStorageKey = `ss-w-conv:${cfg?.operatorId ?? ""}:${cfg?.userContext?.operatorUserId ?? "anon"}${threadLanguage ? `:lang=${threadLanguage}` : ""}`;
22351
- const sportScope = (0, import_react123.useMemo)(
22503
+ const convStorageKey = `ss-w-conv:${cfg?.operatorId ?? ""}:${cfg?.userContext?.operatorUserId ?? "anon"}${cfg?.userContext?.anonymousUserId ? `:a=${cfg.userContext.anonymousUserId}` : ""}${threadLanguage ? `:lang=${threadLanguage}` : ""}`;
22504
+ const sportScope = (0, import_react124.useMemo)(
22352
22505
  () => ({ operatorId: cfg?.operatorId ?? "", operatorUserId: cfg?.userContext?.operatorUserId, anonymousUserId: cfg?.userContext?.anonymousUserId }),
22353
22506
  [cfg?.operatorId, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId]
22354
22507
  );
22355
- const chatTracking = (0, import_react123.useMemo)(() => ({ track, eventText: () => eventTextRef.current }), [track]);
22508
+ const chatTracking = (0, import_react124.useMemo)(() => ({ track, eventText: () => eventTextRef.current }), [track]);
22356
22509
  const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey, cfg?.page, sportScope, language, chatTracking, injectedClient ? oddsSettings.userOddsFormat : oddsSettings.oddsFormat);
22357
22510
  const panelOpen = controller.state.isOpen && !stringsPending;
22358
- const liveCardWatches = (0, import_react123.useMemo)(() => {
22511
+ const liveCardWatches = (0, import_react124.useMemo)(() => {
22359
22512
  const seen2 = /* @__PURE__ */ new Set();
22360
22513
  const out = [];
22361
22514
  for (const msg of controller.state.messages) {
@@ -22381,19 +22534,19 @@ function StatsWidget(props) {
22381
22534
  });
22382
22535
  const operatorUserId = cfg?.userContext?.operatorUserId;
22383
22536
  const anonymousUserId = cfg?.userContext?.anonymousUserId;
22384
- const getSchedule = (0, import_react123.useCallback)(
22537
+ const getSchedule = (0, import_react124.useCallback)(
22385
22538
  (localDate, utcOffsetMinutes) => built ? built.conversation.getSchedule(localDate, utcOffsetMinutes, operatorUserId, anonymousUserId) : Promise.resolve(null),
22386
22539
  [built, operatorUserId, anonymousUserId]
22387
22540
  );
22388
- const getStates = (0, import_react123.useCallback)(
22541
+ const getStates = (0, import_react124.useCallback)(
22389
22542
  (matchIds, nbaGameIds, nflGameIds, tennisMatches) => built ? built.conversation.getStates(matchIds, nbaGameIds, nflGameIds, requestTag, tennisMatches) : Promise.resolve(null),
22390
22543
  [built, requestTag]
22391
22544
  );
22392
- const getTennisPrices = (0, import_react123.useCallback)(
22545
+ const getTennisPrices = (0, import_react124.useCallback)(
22393
22546
  (keys) => built ? built.conversation.getStates([], [], [], requestTag, [], keys).then((p) => p?.tennisPrices ?? null) : Promise.resolve(null),
22394
22547
  [built, requestTag]
22395
22548
  );
22396
- const pinnedMatchIds = (0, import_react123.useMemo)(
22549
+ const pinnedMatchIds = (0, import_react124.useMemo)(
22397
22550
  () => footballMatchPinIds(monitor.pins),
22398
22551
  [monitor.pins]
22399
22552
  );
@@ -22407,13 +22560,13 @@ function StatsWidget(props) {
22407
22560
  pinnedMatchIds,
22408
22561
  timeZone: ui.timeZone
22409
22562
  });
22410
- const offeredSports = (0, import_react123.useMemo)(() => {
22563
+ const offeredSports = (0, import_react124.useMemo)(() => {
22411
22564
  const seen2 = new Set(discovery.matchDays.map((d) => d.sport));
22412
22565
  for (const g of discovery.groups) seen2.add(g.sport ?? "football");
22413
22566
  return [...seen2];
22414
22567
  }, [discovery.matchDays, discovery.groups]);
22415
22568
  const scheduleSport = useScheduleSport(offeredSports);
22416
- const [liveLeague, setLiveLeague] = (0, import_react123.useState)(null);
22569
+ const [liveLeague, setLiveLeague] = (0, import_react124.useState)(null);
22417
22570
  const [matchesDay, setMatchesDay] = useMatchesDayPick(discovery.localDate);
22418
22571
  const matchesLoaded = useMatchesDay({
22419
22572
  discovery,
@@ -22423,8 +22576,8 @@ function StatsWidget(props) {
22423
22576
  enabled: panelOpen && monitor.activeTab === "matches",
22424
22577
  timeZone: ui.timeZone
22425
22578
  });
22426
- const prevLiveSnapshotRef = (0, import_react123.useRef)(monitor.snapshot);
22427
- (0, import_react123.useEffect)(() => {
22579
+ const prevLiveSnapshotRef = (0, import_react124.useRef)(monitor.snapshot);
22580
+ (0, import_react124.useEffect)(() => {
22428
22581
  const snap = monitor.snapshot;
22429
22582
  if (!snap || snap === prevLiveSnapshotRef.current) return;
22430
22583
  prevLiveSnapshotRef.current = snap;
@@ -22464,14 +22617,14 @@ function StatsWidget(props) {
22464
22617
  const clubSquadResult = useClubSquad(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
22465
22618
  const clubSquadStatsResult = useClubSquadStats(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
22466
22619
  const clubPlayerDetailResult = useClubPlayerDetail(built?.conversation ?? null);
22467
- const [favSportPick, setFavSportPick] = (0, import_react123.useState)(null);
22468
- const latestGreeting = (0, import_react123.useMemo)(() => {
22620
+ const [favSportPick, setFavSportPick] = (0, import_react124.useState)(null);
22621
+ const latestGreeting = (0, import_react124.useMemo)(() => {
22469
22622
  for (const m of [...controller.state.messages].reverse()) {
22470
22623
  if (m.role === "assistant" && m.defaultSport !== void 0) return m;
22471
22624
  }
22472
22625
  return null;
22473
22626
  }, [controller.state.messages]);
22474
- const favSportOptions = (0, import_react123.useMemo)(
22627
+ const favSportOptions = (0, import_react124.useMemo)(
22475
22628
  () => (switchSets(latestGreeting?.greetingDashboards) ?? []).map((set) => ({ sport: set.sport, label: set.label })),
22476
22629
  [latestGreeting]
22477
22630
  );
@@ -22480,20 +22633,20 @@ function StatsWidget(props) {
22480
22633
  const favSport = [favSportPick, rememberedSport, latestGreeting?.defaultSport].find(offered) ?? "football";
22481
22634
  const favSports = favSportOptions.length > 0 ? favSportOptions : [{ sport: favSport, label: sportLabel(ui, favSport) }];
22482
22635
  const hasFavouritesIdentity = !!(operatorUserId || anonymousUserId);
22483
- const [builderSportPick, setBuilderSportPick] = (0, import_react123.useState)(null);
22484
- const builderGreeting = (0, import_react123.useMemo)(
22636
+ const [builderSportPick, setBuilderSportPick] = (0, import_react124.useState)(null);
22637
+ const builderGreeting = (0, import_react124.useMemo)(
22485
22638
  () => [...controller.state.messages].reverse().find((m) => m.role === "assistant" && (m.greetingDashboard !== void 0 || m.greetingDashboards !== void 0)) ?? null,
22486
22639
  [controller.state.messages]
22487
22640
  );
22488
- const [coolOff, setCoolOff] = (0, import_react123.useState)(null);
22489
- const onBuilderCoolOff = (0, import_react123.useCallback)((sport) => {
22641
+ const [coolOff, setCoolOff] = (0, import_react124.useState)(null);
22642
+ const onBuilderCoolOff = (0, import_react124.useCallback)((sport) => {
22490
22643
  if (!builderGreeting) return;
22491
22644
  setCoolOff((prev) => {
22492
22645
  const sports = prev?.greeting === builderGreeting ? prev.sports : [];
22493
22646
  return sports.includes(sport) ? prev : { greeting: builderGreeting, sports: [...sports, sport] };
22494
22647
  });
22495
22648
  }, [builderGreeting]);
22496
- const builderOptions = (0, import_react123.useMemo)(() => {
22649
+ const builderOptions = (0, import_react124.useMemo)(() => {
22497
22650
  const greeting = builderGreeting;
22498
22651
  if (!greeting) return [];
22499
22652
  const cooled = coolOff?.greeting === greeting ? coolOff.sports : [];
@@ -22510,7 +22663,7 @@ function StatsWidget(props) {
22510
22663
  return options.filter((o) => !cooled.includes(o.sport));
22511
22664
  }, [builderGreeting, coolOff, ui]);
22512
22665
  const builderSport = [builderSportPick, rememberedSport, latestGreeting?.defaultSport].find((s) => !!s && builderOptions.some((o) => o.sport === s)) ?? builderOptions[0]?.sport ?? "";
22513
- const [panelEverOpened, setPanelEverOpened] = (0, import_react123.useState)(panelOpen);
22666
+ const [panelEverOpened, setPanelEverOpened] = (0, import_react124.useState)(panelOpen);
22514
22667
  if (panelOpen && !panelEverOpened) setPanelEverOpened(true);
22515
22668
  const favourites = useFavourites({
22516
22669
  conversation: built?.conversation ?? null,
@@ -22522,16 +22675,16 @@ function StatsWidget(props) {
22522
22675
  onChanged: discovery.refreshSchedule
22523
22676
  });
22524
22677
  const favouritesEnabled = hasFavouritesIdentity && favourites.status !== "refused";
22525
- const [favouritesOpen, setFavouritesOpen] = (0, import_react123.useState)(false);
22678
+ const [favouritesOpen, setFavouritesOpen] = (0, import_react124.useState)(false);
22526
22679
  if (!panelOpen && favouritesOpen) setFavouritesOpen(false);
22527
- const getPricePresets = (0, import_react123.useCallback)(
22680
+ const getPricePresets = (0, import_react124.useCallback)(
22528
22681
  (locale) => built ? built.conversation.getPricePresets(locale, { pool: "open" }) : Promise.resolve(null),
22529
22682
  [built]
22530
22683
  );
22531
22684
  const presetGrid = usePresetGrid({ getPricePresets, isOpen: panelOpen, locale: ui.hostTag });
22532
22685
  const markLiveActivity = monitor.markLiveActivity;
22533
- const prevLiveCountRef = (0, import_react123.useRef)(0);
22534
- (0, import_react123.useEffect)(() => {
22686
+ const prevLiveCountRef = (0, import_react124.useRef)(0);
22687
+ (0, import_react124.useEffect)(() => {
22535
22688
  const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
22536
22689
  prevLiveCountRef.current = discovery.liveCount;
22537
22690
  if (rose) markLiveActivity();
@@ -22545,7 +22698,7 @@ function StatsWidget(props) {
22545
22698
  closePanel: controller.close
22546
22699
  });
22547
22700
  const markAdded = hostEvents.markAdded;
22548
- const slip = (0, import_react123.useMemo)(
22701
+ const slip = (0, import_react124.useMemo)(
22549
22702
  () => {
22550
22703
  const handler = props.config?.onAddToSlip;
22551
22704
  return {
@@ -22565,7 +22718,7 @@ function StatsWidget(props) {
22565
22718
  },
22566
22719
  [props.config?.onAddToSlip, props.config?.slipSports, controller.state.conversationId, markAdded]
22567
22720
  );
22568
- const onDashboardTap = (0, import_react123.useMemo)(
22721
+ const onDashboardTap = (0, import_react124.useMemo)(
22569
22722
  () => built ? createDashboardTapSignal((input) => built.conversation.sendSignal(input), logger) : void 0,
22570
22723
  [built, logger]
22571
22724
  );
@@ -22579,18 +22732,24 @@ function StatsWidget(props) {
22579
22732
  log: logger
22580
22733
  })
22581
22734
  }));
22582
- const dismissPopupRef = (0, import_react123.useRef)(() => {
22735
+ const dismissPopupRef = (0, import_react124.useRef)(() => {
22583
22736
  });
22584
- const onCtaRef = (0, import_react123.useRef)(() => {
22737
+ const onCtaRef = (0, import_react124.useRef)(() => {
22585
22738
  });
22586
- const onTeaserTapRef = (0, import_react123.useRef)(() => {
22739
+ const onTeaserTapRef = (0, import_react124.useRef)(() => {
22587
22740
  });
22588
22741
  const bubble = controller.state.greetingBubble;
22589
22742
  const bubblePrice = !stringsPending && controller.state.popupText && bubble?.price && bubble.matchId ? { matchId: bubble.matchId, price: bubble.price, sport: bubble.sport } : null;
22590
22743
  const bubbleGame = !stringsPending && controller.state.popupText && bubble?.game ? instantMs(bubble.startsAtUtc) === null ? bubble.game : ui.v2GameLine(bubble.game, bubble.startsAtUtc) : void 0;
22591
22744
  const bubbleCta = controller.state.popupText ? controller.state.greetingBubble?.cta ?? null : null;
22745
+ const onTeaserRef = (0, import_react124.useRef)(cfg?.onTeaser);
22746
+ onTeaserRef.current = cfg?.onTeaser;
22747
+ const wantsTeaser = cfg?.launcher === false || cfg?.onTeaser !== void 0;
22748
+ const webBinding = (0, import_react124.useMemo)(() => wantsTeaser ? webTeaserBinding(props.host, (teaser2) => onTeaserRef.current?.(teaser2), cfg?.launcher === false) : void 0, [wantsTeaser, props.host, cfg?.launcher]);
22749
+ const hostDrawsLauncher = props.mobile !== void 0 || cfg?.launcher === false;
22750
+ const resolvedTheme = useResolvedTheme(oddsSettings.userTheme ?? ui.theme);
22592
22751
  const mobile = useMobileBinding({
22593
- binding: props.mobile,
22752
+ binding: props.mobile ?? webBinding,
22594
22753
  panelOpen,
22595
22754
  popupText: controller.state.popupText,
22596
22755
  cta: bubbleCta,
@@ -22605,21 +22764,23 @@ function StatsWidget(props) {
22605
22764
  asks,
22606
22765
  open: controller.open,
22607
22766
  close: controller.close,
22608
- dismissPopup: () => dismissPopupRef.current()
22767
+ dismissPopup: () => dismissPopupRef.current(),
22768
+ labels: stringsPending ? null : { launcher: ui.launcherLabel, dismiss: ui.dismissGreeting },
22769
+ theme: resolvedTheme
22609
22770
  });
22610
- const dismissPopup = usePopupTelemetry(logger, panelOpen, controller.state.popupText, controller.dismissPopup, mobile.confirmedShown);
22771
+ const dismissPopup = usePopupTelemetry(logger, panelOpen, controller.state.popupText, controller.dismissPopup, hostDrawsLauncher ? mobile.confirmedShown : void 0);
22611
22772
  dismissPopupRef.current = dismissPopup;
22612
22773
  const greetingMeta = latestGreetingMeta(controller.state.messages);
22613
- useBubbleGreetingShown(logger, logger ?? NO_OWNER, controller.state.popupText, greetingMeta, mobile.confirmedShown);
22614
- const [highlight, setHighlight] = (0, import_react123.useState)(null);
22615
- const clearHighlight = (0, import_react123.useCallback)(() => setHighlight(null), []);
22616
- (0, import_react123.useEffect)(() => {
22774
+ useBubbleGreetingShown(logger, logger ?? NO_OWNER, controller.state.popupText, greetingMeta, hostDrawsLauncher ? mobile.confirmedShown : void 0);
22775
+ const [highlight, setHighlight] = (0, import_react124.useState)(null);
22776
+ const clearHighlight = (0, import_react124.useCallback)(() => setHighlight(null), []);
22777
+ (0, import_react124.useEffect)(() => {
22617
22778
  if (!panelOpen) setHighlight(null);
22618
22779
  }, [panelOpen]);
22619
- const highlightRequest = (0, import_react123.useMemo)(() => highlight ? { ...highlight, clear: clearHighlight } : null, [highlight, clearHighlight]);
22780
+ const highlightRequest = (0, import_react124.useMemo)(() => highlight ? { ...highlight, clear: clearHighlight } : null, [highlight, clearHighlight]);
22620
22781
  const { open: openFromCta, state: { greetingBubble } } = controller;
22621
22782
  const setTab = monitor.setActiveTab;
22622
- const logCtaClick = (0, import_react123.useCallback)(() => {
22783
+ const logCtaClick = (0, import_react124.useCallback)(() => {
22623
22784
  if (!logger || !greetingMeta) return;
22624
22785
  logger.log({ name: "greeting_cta_click", greeting: { greetingId: greetingMeta.greetingId, case: greetingMeta.case, sport: greetingMeta.sport, market: greetingMeta.market ?? null } });
22625
22786
  }, [logger, greetingMeta]);
@@ -22636,12 +22797,12 @@ function StatsWidget(props) {
22636
22797
  if (!bubbleCta) logCtaClick();
22637
22798
  openFromCta();
22638
22799
  };
22639
- const onCta = (0, import_react123.useCallback)(() => onCtaRef.current(), []);
22800
+ const onCta = (0, import_react124.useCallback)(() => onCtaRef.current(), []);
22640
22801
  useOpenTelemetry(logger, panelOpen);
22641
- const onControlRef = (0, import_react123.useRef)(props.onControl);
22802
+ const onControlRef = (0, import_react124.useRef)(props.onControl);
22642
22803
  onControlRef.current = props.onControl;
22643
22804
  const { open: openPanel, close: closePanel } = controller;
22644
- (0, import_react123.useEffect)(() => {
22805
+ (0, import_react124.useEffect)(() => {
22645
22806
  onControlRef.current?.({ open: openPanel, close: closePanel });
22646
22807
  return () => onControlRef.current?.(null);
22647
22808
  }, [openPanel, closePanel]);
@@ -22658,11 +22819,11 @@ function StatsWidget(props) {
22658
22819
  page: cfg?.page
22659
22820
  }
22660
22821
  };
22661
- (0, import_react123.useEffect)(() => {
22822
+ (0, import_react124.useEffect)(() => {
22662
22823
  if (!logger) return;
22663
22824
  logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
22664
22825
  }, [logger, operatorUserId, anonymousUserId, conversationId]);
22665
- (0, import_react123.useEffect)(() => {
22826
+ (0, import_react124.useEffect)(() => {
22666
22827
  if (!logger) return;
22667
22828
  logger.resume();
22668
22829
  const onHide = () => {
@@ -22680,15 +22841,15 @@ function StatsWidget(props) {
22680
22841
  logger.dispose();
22681
22842
  };
22682
22843
  }, [logger]);
22683
- (0, import_react123.useEffect)(() => {
22844
+ (0, import_react124.useEffect)(() => {
22684
22845
  if (!built || !ui.injectStyles || widgetStrings.state === "unavailable") return;
22685
22846
  const node = rootRef.current?.getRootNode();
22686
22847
  if (node) injectStyles(node);
22687
22848
  }, [built, ui.injectStyles, widgetStrings.state]);
22688
22849
  const holds = useSessionHolds();
22689
22850
  const builderConversation = built?.conversation ?? null;
22690
- const builderMemory = (0, import_react123.useMemo)(() => createBuilderMemory(), [builderConversation, controller.state.threadEpoch]);
22691
- const personalGreeting = (0, import_react123.useMemo)(() => ({
22851
+ const builderMemory = (0, import_react124.useMemo)(() => createBuilderMemory(), [builderConversation, controller.state.threadEpoch]);
22852
+ const personalGreeting = (0, import_react124.useMemo)(() => ({
22692
22853
  favourites: favouritesEnabled && monitor.enabled ? favourites : null,
22693
22854
  conversation: built?.conversation ?? null,
22694
22855
  openFavourites: () => setFavouritesOpen(true),
@@ -22736,10 +22897,10 @@ function StatsWidget(props) {
22736
22897
  favouritesEnabled: favouritesEnabled && clubFixturesResult.tabReady && !clubFixturesResult.enabled,
22737
22898
  favourites: { controller: favourites, sport: favSport, sports: favSports, onSportChange: setFavSportPick, open: favouritesOpen, onOpenChange: setFavouritesOpen },
22738
22899
  builder: { options: builderOptions, sport: builderSport, onSportChange: setBuilderSportPick, onCoolOff: onBuilderCoolOff, tabs: monitor },
22739
- onCloseRequested: mobile.onCloseRequested,
22740
- onRegisterBack: mobile.onRegisterBack
22900
+ onCloseRequested: props.mobile ? mobile.onCloseRequested : void 0,
22901
+ onRegisterBack: props.mobile ? mobile.onRegisterBack : void 0
22741
22902
  }
22742
- ) }) }) : props.mobile ? bubblePrice && mobile.onRegisterPrice && mobile.onPriceResult && mobile.priceInFlight ? /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(
22903
+ ) }) }) : hostDrawsLauncher ? bubblePrice && mobile.onRegisterPrice && mobile.onPriceResult && mobile.priceInFlight ? /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(
22743
22904
  MobileBubblePrice,
22744
22905
  {
22745
22906
  matchId: bubblePrice.matchId,