@sensiblestats/widget-react 0.111.0 → 0.112.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -37,7 +37,7 @@ __export(index_exports, {
37
37
  module.exports = __toCommonJS(index_exports);
38
38
 
39
39
  // src/StatsWidget.tsx
40
- var import_react95 = require("react");
40
+ var import_react93 = require("react");
41
41
  var import_widget_sdk32 = require("@sensiblestats/widget-sdk");
42
42
 
43
43
  // src/kickoff.ts
@@ -402,19 +402,7 @@ var STRINGS = {
402
402
  },
403
403
  presets: {
404
404
  lang: "en",
405
- setNumbers: "Set the numbers",
406
405
  buildCombo: "Build a combo",
407
- dialName: "Set the numbers and Build a combo",
408
- maxPriceRow: "{count} picks, max {price}",
409
- minPriceRow: "Picks from {price} up",
410
- comboRow: "Combo of {legs} paying {total}",
411
- bigComboRow: "Total {total} with {legs} matches",
412
- readyCount: (n) => `${n} ready`,
413
- readyAt: (total) => `ready at ${total}`,
414
- maxPriceDisplay: (count, price) => `${count} picks, max ${price}`,
415
- maxPriceMessage: (count, price) => `Show me ${count} picks priced at ${price} or less.`,
416
- minPriceDisplay: (count, price) => `${count} picks from ${price} up`,
417
- minPriceMessage: (count, price) => `Show me ${count} picks priced at ${price} or more.`,
418
406
  comboDisplay: (legs, total) => `A combo of ${legs} priced at about ${total}`,
419
407
  comboMessage: (legs, total) => `Build me a combo of ${legs} priced at about ${total}.`,
420
408
  unavailable: "Not available today.",
@@ -424,14 +412,7 @@ var STRINGS = {
424
412
  matchesLabel: "Matches",
425
413
  fewerMatches: "Fewer matches",
426
414
  moreMatches: "More matches",
427
- maxPriceName: "Max price",
428
- minPriceName: "Lowest price",
429
- notToday: " \xB7 not today",
430
415
  changeCombo: "Change total or matches",
431
- marketRow: "{market} picks today",
432
- marketName: "Market",
433
- marketShort: (dev, market, sel) => ({ BOTH_TEAMS_TO_SCORE: "BTTS", DOUBLE_CHANCE: "Double chance", FULLTIME_RESULT: "Match winner" })[dev] ?? (dev === "GOALS_OVER_UNDER" && sel ? sel : sel ? `${market} ${sel}` : market),
434
- marketMessage: (market, sel, count) => `Show me ${count} ${sel ? `${market} \u2013 ${sel}` : market} picks.`,
435
416
  standoutAsk: "Standout matches today"
436
417
  },
437
418
  nba: {
@@ -1100,19 +1081,7 @@ var STRINGS = {
1100
1081
  },
1101
1082
  presets: {
1102
1083
  lang: "tr",
1103
- setNumbers: "Say\u0131lar\u0131 belirle",
1104
1084
  buildCombo: "Kombin olu\u015Ftur",
1105
- dialName: "Say\u0131lar\u0131 belirle ve Kombin olu\u015Ftur",
1106
- maxPriceRow: "{count} se\xE7im, en fazla {price}",
1107
- minPriceRow: "{price} ve \xFCzeri se\xE7imler",
1108
- comboRow: "Yakla\u015F\u0131k {total} oranl\u0131 {legs} ma\xE7l\u0131k kombin",
1109
- bigComboRow: "{legs} ma\xE7la toplam {total}",
1110
- readyCount: (n) => `${n} haz\u0131r`,
1111
- readyAt: (total) => `${total} ile haz\u0131r`,
1112
- maxPriceDisplay: (count, price) => `${count} se\xE7im, en fazla ${price}`,
1113
- maxPriceMessage: (count, price) => `${price} veya alt\u0131 oranl\u0131 ${count} se\xE7im g\xF6ster.`,
1114
- minPriceDisplay: (count, price) => `${count} se\xE7im, ${price} ve \xFCzeri`,
1115
- minPriceMessage: (count, price) => `${price} veya \xFCzeri oranl\u0131 ${count} se\xE7im g\xF6ster.`,
1116
1085
  comboDisplay: (legs, total) => `${legs} ma\xE7l\u0131k kombin, yakla\u015F\u0131k ${total}`,
1117
1086
  comboMessage: (legs, total) => `Yakla\u015F\u0131k ${total} oranl\u0131 ${legs} ma\xE7l\u0131k bir kombin haz\u0131rla.`,
1118
1087
  unavailable: "Bug\xFCn mevcut de\u011Fil.",
@@ -1122,14 +1091,7 @@ var STRINGS = {
1122
1091
  matchesLabel: "Ma\xE7 say\u0131s\u0131",
1123
1092
  fewerMatches: "Daha az ma\xE7",
1124
1093
  moreMatches: "Daha fazla ma\xE7",
1125
- maxPriceName: "En y\xFCksek oran",
1126
- minPriceName: "En d\xFC\u015F\xFCk oran",
1127
- notToday: " \xB7 bug\xFCn yok",
1128
1094
  changeCombo: "Toplam\u0131 veya ma\xE7lar\u0131 de\u011Fi\u015Ftir",
1129
- marketRow: "Bug\xFCnk\xFC {market} se\xE7imleri",
1130
- marketName: "Bahis t\xFCr\xFC",
1131
- marketShort: (dev, market, sel) => ({ BOTH_TEAMS_TO_SCORE: "KG Var", DOUBLE_CHANCE: "\xC7ifte \u015Fans", FULLTIME_RESULT: "Ma\xE7 sonucu" })[dev] ?? (dev === "GOALS_OVER_UNDER" && sel ? sel : sel ? `${market} ${sel}` : market),
1132
- marketMessage: (market, sel, count) => `${count} ${sel ? `${market} \u2013 ${sel}` : market} se\xE7imi g\xF6ster.`,
1133
1095
  standoutAsk: "Bug\xFCn\xFCn \xF6ne \xE7\u0131kan ma\xE7lar\u0131"
1134
1096
  },
1135
1097
  nba: {
@@ -1506,7 +1468,7 @@ function parseOddsFormat(value) {
1506
1468
  }
1507
1469
 
1508
1470
  // src/version.generated.ts
1509
- var WIDGET_REACT_VERSION = "0.111.0";
1471
+ var WIDGET_REACT_VERSION = "0.112.1";
1510
1472
 
1511
1473
  // src/config.ts
1512
1474
  function normalizeUi(cfg) {
@@ -4995,10 +4957,8 @@ function useClubPlayerDetail(conversation) {
4995
4957
  var import_react15 = require("react");
4996
4958
 
4997
4959
  // src/presetGrid.ts
4998
- var FIXED_SINGLES_COUNT = 3;
4999
4960
  var MIN_COMBO_LEGS = 2;
5000
4961
  var MAX_COMBO_LEGS = 6;
5001
- var START = { maxPrice: 1.5, minPrice: 2, comboTotal: 5, comboLegs: 3 };
5002
4962
  var finite2 = (v) => typeof v === "number" && Number.isFinite(v);
5003
4963
  var cents = (n) => Math.round(n * 100);
5004
4964
  function samePrice(a, b) {
@@ -5007,14 +4967,12 @@ function samePrice(a, b) {
5007
4967
  function isPresetGrid(v) {
5008
4968
  if (!v || typeof v !== "object") return false;
5009
4969
  const g = v;
5010
- return Array.isArray(g.singles) && Array.isArray(g.singlesFrom) && Array.isArray(g.combos) && Array.isArray(g.limitOptions) && Array.isArray(g.floorOptions) && Array.isArray(g.totalOptions) && finite2(g.maxLegs);
4970
+ return Array.isArray(g.combos) && Array.isArray(g.totalOptions) && finite2(g.maxLegs);
5011
4971
  }
5012
4972
  function drawable(p) {
5013
4973
  return !!p && finite2(p.price) && finite2(p.matchOddsId) && finite2(p.matchId) && typeof p.homeTeamName === "string" && typeof p.awayTeamName === "string";
5014
4974
  }
5015
4975
  var byValue = (options) => [...options].sort((a, b) => a.value - b.value);
5016
- var singlesLimits = (grid) => byValue(grid.limitOptions);
5017
- var singlesFloors = (grid) => byValue(grid.floorOptions);
5018
4976
  var comboTotals = (grid) => byValue(grid.totalOptions);
5019
4977
  function comboLegChoices(grid) {
5020
4978
  const max = Math.min(MAX_COMBO_LEGS, Math.floor(grid.maxLegs));
@@ -5022,9 +4980,6 @@ function comboLegChoices(grid) {
5022
4980
  for (let n = MIN_COMBO_LEGS; n <= max; n++) out.push(n);
5023
4981
  return out;
5024
4982
  }
5025
- function startValue(values, preferred) {
5026
- return values.find((v) => samePrice(v, preferred)) ?? values[0] ?? preferred;
5027
- }
5028
4983
  function nearest(values, target) {
5029
4984
  const first = values[0];
5030
4985
  if (first === void 0) return target;
@@ -5038,10 +4993,6 @@ function clampLegs(values, legs) {
5038
4993
  if (lo === void 0 || hi === void 0) return legs;
5039
4994
  return Math.min(Math.max(Math.round(legs), lo), hi);
5040
4995
  }
5041
- function findSingles(cells, price, count) {
5042
- const cell2 = cells.find((c) => !!c && finite2(c.price) && samePrice(c.price, price) && c.count === count);
5043
- return cell2 && Array.isArray(cell2.picks) && cell2.picks.length === count && cell2.picks.every(drawable) ? cell2 : null;
5044
- }
5045
4996
  function findCombo(grid, total, legs) {
5046
4997
  const cell2 = grid.combos.find((c) => !!c && finite2(c.total) && samePrice(c.total, total) && c.legs === legs);
5047
4998
  const combo = cell2?.combo;
@@ -5062,45 +5013,9 @@ function legsForTotal(grid, total, legs) {
5062
5013
  }
5063
5014
  return best;
5064
5015
  }
5065
- function startSingles(cells, values, start, count) {
5066
- const home = startValue(values, start);
5067
- if (findSingles(cells, home, count)) return home;
5068
- let best = null;
5069
- for (const v of values) {
5070
- if (!findSingles(cells, v, count)) continue;
5071
- if (best === null || Math.abs(cents(v) - cents(start)) < Math.abs(cents(best) - cents(start))) best = v;
5072
- }
5073
- return best ?? home;
5074
- }
5075
- function startCombo(grid, totals, legChoices, startTotal, startLegs) {
5076
- const home = { total: startValue(totals, startTotal), legs: startValue(legChoices, startLegs) };
5077
- if (findCombo(grid, home.total, home.legs)) return home;
5078
- let best = null;
5079
- for (const t of totals) {
5080
- if (!legChoices.some((n) => findCombo(grid, t, n))) continue;
5081
- if (best === null || Math.abs(cents(t) - cents(startTotal)) < Math.abs(cents(best) - cents(startTotal))) best = t;
5082
- }
5083
- return best === null ? home : { total: best, legs: legsForTotal(grid, best, home.legs) };
5084
- }
5085
5016
  function idsOf(picks) {
5086
5017
  return { matchOddsIds: picks.map((p) => p.matchOddsId), matchIds: picks.map((p) => p.matchId) };
5087
5018
  }
5088
- function maxPriceAsk(cell2, s, format2) {
5089
- const price = formatOdds(cell2.priceFormats, format2);
5090
- return {
5091
- message: s.maxPriceMessage(cell2.count, price),
5092
- displayText: s.maxPriceDisplay(cell2.count, price),
5093
- preset: { kind: "max_price", price: cell2.price, count: cell2.count, ...idsOf(cell2.picks) }
5094
- };
5095
- }
5096
- function minPriceAsk(cell2, s, format2) {
5097
- const price = formatOdds(cell2.priceFormats, format2);
5098
- return {
5099
- message: s.minPriceMessage(cell2.count, price),
5100
- displayText: s.minPriceDisplay(cell2.count, price),
5101
- preset: { kind: "min_price", price: cell2.price, count: cell2.count, ...idsOf(cell2.picks) }
5102
- };
5103
- }
5104
5019
  function comboAsk(cell2, s, format2) {
5105
5020
  const total = formatOdds(cell2.totalFormats, format2);
5106
5021
  return {
@@ -5109,16 +5024,6 @@ function comboAsk(cell2, s, format2) {
5109
5024
  preset: { kind: "combo", total: cell2.total, legs: cell2.legs, ...idsOf(cell2.combo.legs) }
5110
5025
  };
5111
5026
  }
5112
- function marketAsk(cell2, s) {
5113
- return {
5114
- message: s.marketMessage(cell2.marketLabel, cell2.selectionLabel ?? null, cell2.count),
5115
- displayText: marketDisplay(cell2, s),
5116
- preset: { kind: "market", marketDeveloperName: cell2.marketDeveloperName, ...idsOf(cell2.picks) }
5117
- };
5118
- }
5119
- function marketDisplay(cell2, s) {
5120
- return s.marketRow.replace("{market}", s.marketShort(cell2.marketDeveloperName, cell2.marketLabel, cell2.selectionLabel ?? null));
5121
- }
5122
5027
 
5123
5028
  // src/usePresetGrid.ts
5124
5029
  var GRID_MAX_AGE_MS = 6e5;
@@ -5166,7 +5071,7 @@ function usePresetGrid({ getPricePresets, isOpen, locale, now = Date.now }) {
5166
5071
  return grid;
5167
5072
  }
5168
5073
  function hasAnyCell(grid) {
5169
- return grid.singles.length > 0 || grid.singlesFrom.length > 0 || grid.combos.length > 0 || grid.markets !== void 0 && grid.markets.length > 0;
5074
+ return grid.combos.length > 0;
5170
5075
  }
5171
5076
 
5172
5077
  // src/useFavourites.ts
@@ -5423,20 +5328,6 @@ function KebabIcon() {
5423
5328
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "12", cy: "19", r: "1.6" })
5424
5329
  ] }) });
5425
5330
  }
5426
- function SlidersIcon() {
5427
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { viewBox: "0 0 24 24", width: "1em", height: "1em", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", children: [
5428
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M4 6h9M17 6h3M4 12h3M11 12h9M4 18h11M19 18h1" }),
5429
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "15", cy: "6", r: "2" }),
5430
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "9", cy: "12", r: "2" }),
5431
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "17", cy: "18", r: "2" })
5432
- ] }) });
5433
- }
5434
- function ComboIcon() {
5435
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { viewBox: "0 0 24 24", width: "1em", height: "1em", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinejoin: "round", children: [
5436
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "3", y: "3", width: "11", height: "11", rx: "2" }),
5437
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "10", y: "10", width: "11", height: "11", rx: "2" })
5438
- ] }) });
5439
- }
5440
5331
  var DASHBOARD_EMOJI = {
5441
5332
  football: "\u26BD",
5442
5333
  "goal-net": "\u{1F945}",
@@ -7723,7 +7614,7 @@ function ChatFab({ label, greeting, popupText, logoUrl, onOpen, onDismissPopup,
7723
7614
  }
7724
7615
 
7725
7616
  // src/components/ChatPanel.tsx
7726
- var import_react94 = require("react");
7617
+ var import_react92 = require("react");
7727
7618
 
7728
7619
  // src/components/ChatHeader.tsx
7729
7620
  var import_react45 = require("react");
@@ -10037,7 +9928,7 @@ function MessageList({ controller, ui, slip, onDashboardTap, monitor }) {
10037
9928
  // src/components/ChatInput.tsx
10038
9929
  var import_react57 = require("react");
10039
9930
  var import_jsx_runtime67 = require("react/jsx-runtime");
10040
- var ChatInput = (0, import_react57.forwardRef)(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel = "Stop response", sendLabel = "Send message", disabled = false, onType }, ref) {
9931
+ var ChatInput = (0, import_react57.forwardRef)(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel = "Stop response", sendLabel = "Send message", disabled = false }, ref) {
10041
9932
  const [value, setValue] = (0, import_react57.useState)("");
10042
9933
  const textareaRef = (0, import_react57.useRef)(null);
10043
9934
  const stopRef = (0, import_react57.useRef)(null);
@@ -10089,7 +9980,6 @@ var ChatInput = (0, import_react57.forwardRef)(function ChatInput2({ placeholder
10089
9980
  disabled: streaming || disabled,
10090
9981
  onChange: (e) => {
10091
9982
  setValue(e.target.value);
10092
- onType?.();
10093
9983
  },
10094
9984
  onKeyDown
10095
9985
  }
@@ -15784,54 +15674,17 @@ function PlayerDetail({ detail, loading, ui, seasonName, onClose }) {
15784
15674
  ] });
15785
15675
  }
15786
15676
 
15787
- // src/components/PresetSpeedDial.tsx
15677
+ // src/components/PresetTools.tsx
15788
15678
  var import_react91 = require("react");
15789
15679
  var import_jsx_runtime133 = require("react/jsx-runtime");
15790
- function PresetSpeedDial({ expanded, showDot, strings, onToggle, onOpen, rootRef, buttonRef }) {
15791
- const pillsId = (0, import_react91.useId)();
15792
- const tabIndex = expanded ? 0 : -1;
15793
- return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { ref: rootRef, className: "ss-w-dial", children: [
15794
- /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(
15795
- "button",
15796
- {
15797
- ref: buttonRef,
15798
- type: "button",
15799
- className: "ss-w-dial-btn",
15800
- "aria-expanded": expanded,
15801
- "aria-controls": pillsId,
15802
- "aria-label": strings.dialName,
15803
- onClick: onToggle,
15804
- children: [
15805
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "ss-w-dial-icon ss-w-dial-icon--open", children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(SlidersIcon, {}) }),
15806
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "ss-w-dial-icon ss-w-dial-icon--close", children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(CloseIcon, {}) }),
15807
- showDot && !expanded ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "ss-w-dial-dot", "aria-hidden": "true" }) : null
15808
- ]
15809
- }
15810
- ),
15811
- /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { id: pillsId, className: "ss-w-dial-pills", "data-open": expanded ? "" : void 0, children: [
15812
- /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("button", { type: "button", className: "ss-w-dial-pill", tabIndex, onClick: () => onOpen("numbers"), children: [
15813
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(SlidersIcon, {}),
15814
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "ss-w-dial-pill-label", children: strings.setNumbers })
15815
- ] }),
15816
- /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("button", { type: "button", className: "ss-w-dial-pill", tabIndex, onClick: () => onOpen("combo"), children: [
15817
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(ComboIcon, {}),
15818
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "ss-w-dial-pill-label", children: strings.buildCombo })
15819
- ] })
15820
- ] })
15821
- ] });
15822
- }
15823
-
15824
- // src/components/PresetTools.tsx
15825
- var import_react92 = require("react");
15826
- var import_jsx_runtime134 = require("react/jsx-runtime");
15827
15680
  var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
15828
15681
  function PresetToolModal({ title, closeLabel, onClose, children, footer, className }) {
15829
- const dialogRef = (0, import_react92.useRef)(null);
15830
- const titleId = (0, import_react92.useId)();
15831
- (0, import_react92.useEffect)(() => {
15682
+ const dialogRef = (0, import_react91.useRef)(null);
15683
+ const titleId = (0, import_react91.useId)();
15684
+ (0, import_react91.useEffect)(() => {
15832
15685
  dialogRef.current?.focus({ preventScroll: true });
15833
15686
  }, []);
15834
- (0, import_react92.useEffect)(() => {
15687
+ (0, import_react91.useEffect)(() => {
15835
15688
  const onKey = (e) => {
15836
15689
  if (e.key !== "Escape") return;
15837
15690
  e.stopPropagation();
@@ -15861,242 +15714,58 @@ function PresetToolModal({ title, closeLabel, onClose, children, footer, classNa
15861
15714
  first.focus();
15862
15715
  }
15863
15716
  };
15864
- return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: className ? `ss-w-tool-backdrop ${className}` : "ss-w-tool-backdrop", children: /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { ref: dialogRef, className: "ss-w-tool", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, tabIndex: -1, onKeyDown: trapTab, children: [
15865
- /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "ss-w-tool-head", children: [
15866
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("h2", { id: titleId, className: "ss-w-tool-title", children: title }),
15867
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("button", { type: "button", className: "ss-w-tool-close", "aria-label": closeLabel, onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(CloseIcon, {}) })
15717
+ return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("div", { className: className ? `ss-w-tool-backdrop ${className}` : "ss-w-tool-backdrop", children: /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { ref: dialogRef, className: "ss-w-tool", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, tabIndex: -1, onKeyDown: trapTab, children: [
15718
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "ss-w-tool-head", children: [
15719
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("h2", { id: titleId, className: "ss-w-tool-title", children: title }),
15720
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("button", { type: "button", className: "ss-w-tool-close", "aria-label": closeLabel, onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(CloseIcon, {}) })
15868
15721
  ] }),
15869
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "ss-w-tool-body", children }),
15870
- footer ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "ss-w-tool-foot", children: footer }) : null
15722
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("div", { className: "ss-w-tool-body", children }),
15723
+ footer ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("div", { className: "ss-w-tool-foot", children: footer }) : null
15871
15724
  ] }) });
15872
15725
  }
15873
- function fillTemplate(template, slots) {
15874
- return template.split(/(\{[a-z]+\})/).filter((part) => part !== "").map((part, i) => {
15875
- const key = /^\{([a-z]+)\}$/.exec(part)?.[1];
15876
- return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_react92.Fragment, { children: key !== void 0 && key in slots ? slots[key] : part }, i);
15877
- });
15878
- }
15879
- function NumberSelect({ current, choices, label, notToday, lockEmpty = true, onChoose }) {
15880
- const selected = Math.max(0, choices.findIndex((c) => samePrice(c.value, current)));
15881
- return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("span", { className: "ss-w-tool-num", children: [
15882
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { className: "ss-w-tool-num-size", "aria-hidden": "true", children: choices[selected]?.text ?? "" }),
15883
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("select", { className: "ss-w-tool-num-select", "aria-label": label, value: String(selected), onChange: (e) => {
15884
- const c = choices[Number(e.target.value)];
15885
- if (c) onChoose(c);
15886
- }, children: choices.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("option", { value: String(i), disabled: lockEmpty && !c.available && i !== selected, children: c.available ? c.text : `${c.text}${notToday}` }, c.key)) })
15887
- ] });
15888
- }
15889
- function ChoiceSelect({ currentIdx, sizeLabels, optionLabels, label, onChoose }) {
15890
- const sizeText = sizeLabels[currentIdx] ?? "";
15891
- return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("span", { className: "ss-w-tool-num", children: [
15892
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { className: "ss-w-tool-num-size", "aria-hidden": "true", children: sizeText }),
15893
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("select", { className: "ss-w-tool-num-select", "aria-label": label, value: String(currentIdx), onChange: (e) => onChoose(Number(e.target.value)), children: optionLabels.map((opt, i) => /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("option", { value: String(i), children: opt }, i)) })
15894
- ] });
15895
- }
15896
15726
  function SendButton({ label, display, disabled, onClick }) {
15897
- return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("button", { type: "button", className: "ss-w-tool-send", "aria-label": `${label}: ${display}`, disabled, onClick, children: label });
15727
+ return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("button", { type: "button", className: "ss-w-tool-send", "aria-label": `${label}: ${display}`, disabled, onClick, children: label });
15898
15728
  }
15899
15729
  function PickList({ picks, formatKickoff }) {
15900
15730
  const { oddsFormat } = useOddsSettings();
15901
- return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("ul", { className: "ss-w-tool-picks", role: "list", children: picks.map((p) => /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("li", { className: "ss-w-tool-pick", children: [
15902
- /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("span", { className: "ss-w-tool-pick-match", children: [
15731
+ return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("ul", { className: "ss-w-tool-picks", role: "list", children: picks.map((p) => /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("li", { className: "ss-w-tool-pick", children: [
15732
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("span", { className: "ss-w-tool-pick-match", children: [
15903
15733
  p.homeTeamName,
15904
15734
  " \u2013 ",
15905
15735
  p.awayTeamName
15906
15736
  ] }),
15907
- /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("span", { className: "ss-w-tool-pick-sel", children: [
15737
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("span", { className: "ss-w-tool-pick-sel", children: [
15908
15738
  p.marketLabel,
15909
15739
  ": ",
15910
15740
  p.selectionLabel,
15911
15741
  p.line ? ` ${p.line}` : ""
15912
15742
  ] }),
15913
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { className: "ss-w-tool-pick-kick", children: formatKickoff(p.kickoffUtc) }),
15914
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { className: "ss-w-tool-pick-price", children: formatOdds(p.priceFormats, oddsFormat) })
15743
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "ss-w-tool-pick-kick", children: formatKickoff(p.kickoffUtc) }),
15744
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "ss-w-tool-pick-price", children: formatOdds(p.priceFormats, oddsFormat) })
15915
15745
  ] }, p.matchOddsId)) });
15916
15746
  }
15917
15747
  function ComboPreview({ cell: cell2, formatKickoff }) {
15918
15748
  const { oddsFormat } = useOddsSettings();
15919
- return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(import_jsx_runtime134.Fragment, { children: [
15920
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(PickList, { picks: cell2.combo.legs, formatKickoff }),
15921
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "ss-w-tool-math", children: oddsFormat === "decimal" ? cell2.combo.multiplication : formatOdds(cell2.combo.totalFormats, oddsFormat) })
15749
+ return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_jsx_runtime133.Fragment, { children: [
15750
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(PickList, { picks: cell2.combo.legs, formatKickoff }),
15751
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("div", { className: "ss-w-tool-math", children: oddsFormat === "decimal" ? cell2.combo.multiplication : formatOdds(cell2.combo.totalFormats, oddsFormat) })
15922
15752
  ] });
15923
15753
  }
15924
15754
  function Unavailable({ text }) {
15925
- return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "ss-w-tool-unavailable", children: text });
15926
- }
15927
- function AskRow({ icon, ask, ready, send }) {
15928
- return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("section", { className: "ss-w-tool-row ss-w-tool-row--ask", children: [
15929
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { className: "ss-w-tool-icon", "aria-hidden": "true", children: icon }),
15930
- /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "ss-w-tool-main", children: [
15931
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "ss-w-tool-ask", children: ask }),
15932
- ready ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { className: "ss-w-tool-ready", children: ready }) : null
15933
- ] }),
15934
- send
15935
- ] });
15755
+ return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { className: "ss-w-tool-unavailable", children: text });
15936
15756
  }
15937
- function RoundSend({ label, display, disabled, onClick }) {
15938
- return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("button", { type: "button", className: "ss-w-tool-go", "aria-label": `${label}: ${display}`, disabled, onClick, children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(SendIcon, {}) });
15939
- }
15940
- var optionChoice = (o, format2, available) => ({ key: o.key, value: o.value, text: formatOdds(o.formats, format2), available });
15941
15757
  var textOf = (options, value, format2) => {
15942
15758
  const o = options.find((x) => samePrice(x.value, value));
15943
15759
  return o ? formatOdds(o.formats, format2) : "";
15944
15760
  };
15945
- var BIG_COMBO = { total: 50, legs: 6 };
15946
- function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
15947
- const { oddsFormat } = useOddsSettings();
15948
- const limitOptions = singlesLimits(grid);
15949
- const floorOptions = singlesFloors(grid);
15950
- const totalOptions = comboTotals(grid);
15951
- const limits = limitOptions.map((o) => o.value);
15952
- const floors = floorOptions.map((o) => o.value);
15953
- const totals = totalOptions.map((o) => o.value);
15954
- const legChoices = comboLegChoices(grid);
15955
- const count = FIXED_SINGLES_COUNT;
15956
- const [maxPrice, setMaxPrice] = (0, import_react92.useState)(() => startSingles(grid.singles, limits, START.maxPrice, count));
15957
- const [minPrice, setMinPrice] = (0, import_react92.useState)(() => startSingles(grid.singlesFrom, floors, START.minPrice, count));
15958
- const [start] = (0, import_react92.useState)(() => startCombo(grid, totals, legChoices, START.comboTotal, START.comboLegs));
15959
- const [total, setTotal] = (0, import_react92.useState)(start.total);
15960
- const [legs, setLegs] = (0, import_react92.useState)(start.legs);
15961
- const [bigStart] = (0, import_react92.useState)(() => startCombo(grid, totals, legChoices, BIG_COMBO.total, BIG_COMBO.legs));
15962
- const [bigTotal, setBigTotal] = (0, import_react92.useState)(bigStart.total);
15963
- const [bigLegs, setBigLegs] = (0, import_react92.useState)(bigStart.legs);
15964
- const [announcement, setAnnouncement] = (0, import_react92.useState)("");
15965
- const maxCell = findSingles(grid.singles, maxPrice, count);
15966
- const minCell = findSingles(grid.singlesFrom, minPrice, count);
15967
- const comboCell = findCombo(grid, total, legs);
15968
- const bigCell = findCombo(grid, bigTotal, bigLegs);
15969
- const announce = (display, available) => setAnnouncement(available ? display : `${display}. ${strings.unavailable}`);
15970
- const chooseMarket = (idx) => {
15971
- setMarketIdx(idx);
15972
- const cell2 = markets[idx];
15973
- if (cell2) announce(marketDisplay(cell2, strings), cell2.count > 0);
15974
- };
15975
- const totalText = (v) => textOf(totalOptions, v, oddsFormat);
15976
- const chooseMax = (c) => {
15977
- setMaxPrice(c.value);
15978
- announce(strings.maxPriceDisplay(count, c.text), !!findSingles(grid.singles, c.value, count));
15979
- };
15980
- const chooseMin = (c) => {
15981
- setMinPrice(c.value);
15982
- announce(strings.minPriceDisplay(count, c.text), !!findSingles(grid.singlesFrom, c.value, count));
15983
- };
15984
- const chooseLegs = (c) => {
15985
- setLegs(c.value);
15986
- announce(strings.comboDisplay(c.value, totalText(total)), !!findCombo(grid, total, c.value));
15987
- };
15988
- const chooseTotal = (c) => {
15989
- const l = legsForTotal(grid, c.value, legs);
15990
- setTotal(c.value);
15991
- setLegs(l);
15992
- announce(strings.comboDisplay(l, c.text), !!findCombo(grid, c.value, l));
15993
- };
15994
- const chooseBigLegs = (c) => {
15995
- setBigLegs(c.value);
15996
- announce(strings.comboDisplay(c.value, totalText(bigTotal)), !!findCombo(grid, bigTotal, c.value));
15997
- };
15998
- const chooseBigTotal = (c) => {
15999
- const l = legsForTotal(grid, c.value, bigLegs);
16000
- setBigTotal(c.value);
16001
- setBigLegs(l);
16002
- announce(strings.comboDisplay(l, c.text), !!findCombo(grid, c.value, l));
16003
- };
16004
- const maxChoices = limitOptions.map((o) => optionChoice(o, oddsFormat, !!findSingles(grid.singles, o.value, count)));
16005
- const minChoices = floorOptions.map((o) => optionChoice(o, oddsFormat, !!findSingles(grid.singlesFrom, o.value, count)));
16006
- const totalChoices = totalOptions.map((o) => optionChoice(o, oddsFormat, legChoices.some((n) => !!findCombo(grid, o.value, n))));
16007
- const legChoicesFor = (t) => legChoices.map((n) => ({ key: String(n), value: n, text: String(n), available: !!findCombo(grid, t, n) }));
16008
- const markets = grid.markets ?? [];
16009
- const [marketIdx, setMarketIdx] = (0, import_react92.useState)(0);
16010
- const marketCell = markets[marketIdx] ?? null;
16011
- const marketLabels = markets.map((c) => strings.marketShort(c.marketDeveloperName, c.marketLabel, c.selectionLabel ?? null));
16012
- const singlesReady = (cell2) => cell2 ? strings.readyCount(cell2.picks.length) : strings.unavailable;
16013
- const comboReady = (cell2) => cell2 ? strings.readyAt(formatOdds(cell2.combo.totalFormats, oddsFormat)) : strings.unavailable;
16014
- return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(PresetToolModal, { title: strings.setNumbers, closeLabel: strings.close, onClose, children: [
16015
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
16016
- AskRow,
16017
- {
16018
- icon: "\u{1F3AF}",
16019
- ask: fillTemplate(strings.maxPriceRow, {
16020
- count: String(count),
16021
- price: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(NumberSelect, { current: maxPrice, choices: maxChoices, label: strings.maxPriceName, notToday: strings.notToday, onChoose: chooseMax })
16022
- }),
16023
- ready: singlesReady(maxCell),
16024
- send: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(RoundSend, { label: strings.send, display: strings.maxPriceDisplay(count, textOf(limitOptions, maxPrice, oddsFormat)), disabled: !maxCell || streaming, onClick: () => {
16025
- if (maxCell) onSend(maxPriceAsk(maxCell, strings, oddsFormat));
16026
- } })
16027
- }
16028
- ),
16029
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
16030
- AskRow,
16031
- {
16032
- icon: "\u{1F4C8}",
16033
- ask: fillTemplate(strings.minPriceRow, {
16034
- count: String(count),
16035
- price: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(NumberSelect, { current: minPrice, choices: minChoices, label: strings.minPriceName, notToday: strings.notToday, onChoose: chooseMin })
16036
- }),
16037
- ready: singlesReady(minCell),
16038
- send: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(RoundSend, { label: strings.send, display: strings.minPriceDisplay(count, textOf(floorOptions, minPrice, oddsFormat)), disabled: !minCell || streaming, onClick: () => {
16039
- if (minCell) onSend(minPriceAsk(minCell, strings, oddsFormat));
16040
- } })
16041
- }
16042
- ),
16043
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
16044
- AskRow,
16045
- {
16046
- icon: "\u2728",
16047
- ask: fillTemplate(strings.comboRow, {
16048
- legs: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(NumberSelect, { current: legs, choices: legChoicesFor(total), label: strings.matchesLabel, notToday: strings.notToday, lockEmpty: false, onChoose: chooseLegs }),
16049
- total: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(NumberSelect, { current: total, choices: totalChoices, label: strings.totalLabel, notToday: strings.notToday, onChoose: chooseTotal })
16050
- }),
16051
- ready: comboReady(comboCell),
16052
- send: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(RoundSend, { label: strings.send, display: strings.comboDisplay(legs, totalText(total)), disabled: !comboCell || streaming, onClick: () => {
16053
- if (comboCell) onSend(comboAsk(comboCell, strings, oddsFormat));
16054
- } })
16055
- }
16056
- ),
16057
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
16058
- AskRow,
16059
- {
16060
- icon: "\u{1F3C6}",
16061
- ask: fillTemplate(strings.bigComboRow, {
16062
- legs: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(NumberSelect, { current: bigLegs, choices: legChoicesFor(bigTotal), label: strings.matchesLabel, notToday: strings.notToday, lockEmpty: false, onChoose: chooseBigLegs }),
16063
- total: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(NumberSelect, { current: bigTotal, choices: totalChoices, label: strings.totalLabel, notToday: strings.notToday, onChoose: chooseBigTotal })
16064
- }),
16065
- ready: comboReady(bigCell),
16066
- send: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(RoundSend, { label: strings.send, display: strings.comboDisplay(bigLegs, totalText(bigTotal)), disabled: !bigCell || streaming, onClick: () => {
16067
- if (bigCell) onSend(comboAsk(bigCell, strings, oddsFormat));
16068
- } })
16069
- }
16070
- ),
16071
- markets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
16072
- AskRow,
16073
- {
16074
- icon: "\u26BD",
16075
- ask: fillTemplate(strings.marketRow, {
16076
- market: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(ChoiceSelect, { currentIdx: marketIdx, sizeLabels: marketLabels, optionLabels: marketLabels, label: strings.marketName, onChoose: chooseMarket })
16077
- }),
16078
- ready: marketCell ? strings.readyCount(marketCell.count) : null,
16079
- send: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(RoundSend, { label: strings.send, display: marketCell ? marketDisplay(marketCell, strings) : "", disabled: !marketCell || streaming, onClick: () => {
16080
- if (marketCell) onSend(marketAsk(marketCell, strings));
16081
- } })
16082
- }
16083
- ),
16084
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "ss-w-vh", "aria-live": "polite", children: announcement })
16085
- ] });
16086
- }
16087
15761
  function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal, initialLegs, onSend, onClose }) {
16088
15762
  const { oddsFormat } = useOddsSettings();
16089
15763
  const totalOptions = comboTotals(grid);
16090
15764
  const totals = totalOptions.map((o) => o.value);
16091
15765
  const legChoices = comboLegChoices(grid);
16092
- const [start] = (0, import_react92.useState)(() => initialTotal === void 0 ? startCombo(grid, totals, legChoices, START.comboTotal, START.comboLegs) : null);
16093
- const [total, setTotal] = (0, import_react92.useState)(() => initialTotal !== void 0 ? nearest(totals, initialTotal) : start.total);
16094
- const [legs, setLegs] = (0, import_react92.useState)(() => {
16095
- if (initialTotal === void 0) return initialLegs !== void 0 ? clampLegs(legChoices, initialLegs) : start.legs;
16096
- const from = initialLegs !== void 0 ? clampLegs(legChoices, initialLegs) : startValue(legChoices, START.comboLegs);
16097
- return legsForTotal(grid, nearest(totals, initialTotal), from);
16098
- });
16099
- const [announcement, setAnnouncement] = (0, import_react92.useState)("");
15766
+ const [total, setTotal] = (0, import_react91.useState)(() => nearest(totals, initialTotal));
15767
+ const [legs, setLegs] = (0, import_react91.useState)(() => legsForTotal(grid, nearest(totals, initialTotal), clampLegs(legChoices, initialLegs)));
15768
+ const [announcement, setAnnouncement] = (0, import_react91.useState)("");
16100
15769
  const cell2 = findCombo(grid, total, legs);
16101
15770
  const minLegs = legChoices[0] ?? legs;
16102
15771
  const maxLegs = legChoices[legChoices.length - 1] ?? legs;
@@ -16107,164 +15776,67 @@ function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal,
16107
15776
  const d = strings.comboDisplay(nextLegs, textOf(totalOptions, nextTotal, oddsFormat));
16108
15777
  setAnnouncement(findCombo(grid, nextTotal, nextLegs) ? d : `${d}. ${strings.unavailable}`);
16109
15778
  };
16110
- const footer = /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(SendButton, { label: strings.send, display, disabled: !cell2 || streaming, onClick: () => {
15779
+ const footer = /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(SendButton, { label: strings.send, display, disabled: !cell2 || streaming, onClick: () => {
16111
15780
  if (cell2) onSend(comboAsk(cell2, strings, oddsFormat));
16112
15781
  } });
16113
- return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(PresetToolModal, { title: strings.buildCombo, closeLabel: strings.close, onClose, footer, children: [
16114
- /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "ss-w-tool-section", role: "group", "aria-label": strings.totalLabel, children: [
16115
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { className: "ss-w-tool-label", "aria-hidden": "true", children: strings.totalLabel }),
16116
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "ss-w-tool-chips", children: totalOptions.map((o) => /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("button", { type: "button", className: "ss-w-tool-chip", "aria-pressed": samePrice(o.value, total), onClick: () => choose(o.value, samePrice(o.value, total) ? legs : legsForTotal(grid, o.value, legs)), children: formatOdds(o.formats, oddsFormat) }, o.key)) })
15782
+ return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(PresetToolModal, { title: strings.buildCombo, closeLabel: strings.close, onClose, footer, children: [
15783
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "ss-w-tool-section", role: "group", "aria-label": strings.totalLabel, children: [
15784
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "ss-w-tool-label", "aria-hidden": "true", children: strings.totalLabel }),
15785
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("div", { className: "ss-w-tool-chips", children: totalOptions.map((o) => /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("button", { type: "button", className: "ss-w-tool-chip", "aria-pressed": samePrice(o.value, total), onClick: () => choose(o.value, samePrice(o.value, total) ? legs : legsForTotal(grid, o.value, legs)), children: formatOdds(o.formats, oddsFormat) }, o.key)) })
16117
15786
  ] }),
16118
- /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "ss-w-tool-section", role: "group", "aria-label": strings.matchesLabel, children: [
16119
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { className: "ss-w-tool-label", "aria-hidden": "true", children: strings.matchesLabel }),
16120
- /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "ss-w-tool-stepper", children: [
16121
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("button", { type: "button", className: "ss-w-tool-step", "aria-label": strings.fewerMatches, disabled: legs <= minLegs, onClick: () => choose(total, legs - 1), children: "\u2212" }),
16122
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { className: "ss-w-tool-count", children: legs }),
16123
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("button", { type: "button", className: "ss-w-tool-step", "aria-label": strings.moreMatches, disabled: legs >= maxLegs, onClick: () => choose(total, legs + 1), children: "+" })
15787
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "ss-w-tool-section", role: "group", "aria-label": strings.matchesLabel, children: [
15788
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "ss-w-tool-label", "aria-hidden": "true", children: strings.matchesLabel }),
15789
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "ss-w-tool-stepper", children: [
15790
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("button", { type: "button", className: "ss-w-tool-step", "aria-label": strings.fewerMatches, disabled: legs <= minLegs, onClick: () => choose(total, legs - 1), children: "\u2212" }),
15791
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "ss-w-tool-count", children: legs }),
15792
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("button", { type: "button", className: "ss-w-tool-step", "aria-label": strings.moreMatches, disabled: legs >= maxLegs, onClick: () => choose(total, legs + 1), children: "+" })
16124
15793
  ] })
16125
15794
  ] }),
16126
- cell2 ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(ComboPreview, { cell: cell2, formatKickoff }) : /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(Unavailable, { text: strings.unavailable }),
16127
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "ss-w-vh", "aria-live": "polite", children: announcement })
15795
+ cell2 ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(ComboPreview, { cell: cell2, formatKickoff }) : /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Unavailable, { text: strings.unavailable }),
15796
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { className: "ss-w-vh", "aria-live": "polite", children: announcement })
16128
15797
  ] });
16129
15798
  }
16130
15799
 
16131
15800
  // src/components/SettingsSheet.tsx
16132
- var import_jsx_runtime135 = require("react/jsx-runtime");
15801
+ var import_jsx_runtime134 = require("react/jsx-runtime");
16133
15802
  var SAMPLE = { decimal: "2.50", american: "+150", fractional: "3/2" };
16134
15803
  var ODDS = ["decimal", "fractional", "american"];
16135
15804
  var THEMES2 = ["light", "dark", "auto"];
16136
15805
  function SettingsSheet({ ui, onClose }) {
16137
15806
  const s = useOddsSettings();
16138
15807
  const t = ui.settings;
16139
- return /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(
15808
+ return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
16140
15809
  PresetToolModal,
16141
15810
  {
16142
15811
  title: t.title,
16143
15812
  closeLabel: t.close,
16144
15813
  onClose,
16145
15814
  className: "ss-w-set-backdrop-in",
16146
- footer: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("p", { className: "ss-w-set-foot", children: t.foot }),
15815
+ footer: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "ss-w-set-foot", children: t.foot }),
16147
15816
  children: [
16148
- s.oddsOffered && /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("div", { className: "ss-w-set-row", children: [
16149
- /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("div", { className: "ss-w-tool-label", id: "ss-w-set-odds", children: t.oddsLabel }),
16150
- /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("div", { className: "ss-w-set-sample", children: [
16151
- /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("span", { children: t.sampleLabel }),
16152
- /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("b", { children: formatOdds(SAMPLE, s.oddsFormat) })
15817
+ s.oddsOffered && /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "ss-w-set-row", children: [
15818
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "ss-w-tool-label", id: "ss-w-set-odds", children: t.oddsLabel }),
15819
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "ss-w-set-sample", children: [
15820
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { children: t.sampleLabel }),
15821
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("b", { children: formatOdds(SAMPLE, s.oddsFormat) })
16153
15822
  ] }),
16154
- /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("div", { className: "ss-w-set-seg", role: "group", "aria-labelledby": "ss-w-set-odds", children: ODDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("button", { type: "button", "aria-pressed": s.oddsFormat === f, onClick: () => s.setOddsFormat(f), children: t[f] }, f)) })
15823
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "ss-w-set-seg", role: "group", "aria-labelledby": "ss-w-set-odds", children: ODDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("button", { type: "button", "aria-pressed": s.oddsFormat === f, onClick: () => s.setOddsFormat(f), children: t[f] }, f)) })
16155
15824
  ] }),
16156
- !s.themeLocked && /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("div", { className: "ss-w-set-row", children: [
16157
- /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("div", { className: "ss-w-tool-label", id: "ss-w-set-theme", children: t.themeLabel }),
16158
- /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("div", { className: "ss-w-set-seg", role: "group", "aria-labelledby": "ss-w-set-theme", children: THEMES2.map((m) => /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("button", { type: "button", "aria-pressed": s.theme === m, onClick: () => s.setTheme(m), children: t[m] }, m)) })
15825
+ !s.themeLocked && /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "ss-w-set-row", children: [
15826
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "ss-w-tool-label", id: "ss-w-set-theme", children: t.themeLabel }),
15827
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "ss-w-set-seg", role: "group", "aria-labelledby": "ss-w-set-theme", children: THEMES2.map((m) => /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("button", { type: "button", "aria-pressed": s.theme === m, onClick: () => s.setTheme(m), children: t[m] }, m)) })
16159
15828
  ] })
16160
15829
  ]
16161
15830
  }
16162
15831
  );
16163
15832
  }
16164
15833
 
16165
- // src/usePresetDial.ts
16166
- var import_react93 = require("react");
16167
- function sendInFlight(messages, isStreaming) {
16168
- const last = messages[messages.length - 1];
16169
- return isStreaming && !!last && last.role === "assistant" && !last.done && !last.isGreeting;
16170
- }
16171
- function lastUserId(messages) {
16172
- for (let i = messages.length - 1; i >= 0; i--) {
16173
- const m = messages[i];
16174
- if (m && m.role === "user") return m.id;
16175
- }
16176
- return null;
16177
- }
16178
- var SCROLL_KEYS = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "PageUp", "PageDown", "Home", "End", " "]);
16179
- function usePresetDial({ layerRef, dialRef, dialButtonRef, messages, isStreaming, activeTab }) {
16180
- const [expanded, setExpanded] = (0, import_react93.useState)(() => !sendInFlight(messages, isStreaming));
16181
- const fold2 = (0, import_react93.useCallback)(() => setExpanded(false), []);
16182
- const toggle = (0, import_react93.useCallback)(() => setExpanded((e) => !e), []);
16183
- const currentUserId = lastUserId(messages);
16184
- const userIdRef = (0, import_react93.useRef)(currentUserId);
16185
- (0, import_react93.useEffect)(() => {
16186
- if (currentUserId === userIdRef.current) return;
16187
- userIdRef.current = currentUserId;
16188
- setExpanded(false);
16189
- }, [currentUserId]);
16190
- const tabRef = (0, import_react93.useRef)(activeTab);
16191
- (0, import_react93.useEffect)(() => {
16192
- if (activeTab === tabRef.current) return;
16193
- tabRef.current = activeTab;
16194
- setExpanded(false);
16195
- }, [activeTab]);
16196
- const expandedRef = (0, import_react93.useRef)(expanded);
16197
- expandedRef.current = expanded;
16198
- (0, import_react93.useEffect)(() => {
16199
- const onEscape = (e) => {
16200
- const dial = dialRef.current;
16201
- if (e.key !== "Escape" || !dial || !e.composedPath().includes(dial)) return;
16202
- e.stopPropagation();
16203
- e.preventDefault();
16204
- if (!expandedRef.current) return;
16205
- setExpanded(false);
16206
- dialButtonRef.current?.focus();
16207
- };
16208
- window.addEventListener("keydown", onEscape, true);
16209
- return () => window.removeEventListener("keydown", onEscape, true);
16210
- }, [dialRef, dialButtonRef]);
16211
- (0, import_react93.useEffect)(() => {
16212
- if (!expanded) return;
16213
- const layer = layerRef.current;
16214
- const inDial = (e) => {
16215
- const dial = dialRef.current;
16216
- return !!dial && e.composedPath().includes(dial);
16217
- };
16218
- const inList = (e) => e.composedPath().some((n) => n instanceof Element && n.classList.contains("ss-w-list"));
16219
- const onPress = (e) => {
16220
- if (!inDial(e)) setExpanded(false);
16221
- };
16222
- const onScrollGesture = (e) => {
16223
- if (inList(e) && !inDial(e)) setExpanded(false);
16224
- };
16225
- const onKey = (e) => {
16226
- if (SCROLL_KEYS.has(e.key) && inList(e)) setExpanded(false);
16227
- };
16228
- const doc = layer?.ownerDocument ?? document;
16229
- doc.addEventListener("pointerdown", onPress, true);
16230
- layer?.addEventListener("wheel", onScrollGesture, { passive: true });
16231
- layer?.addEventListener("touchmove", onScrollGesture, { passive: true });
16232
- window.addEventListener("keydown", onKey, true);
16233
- return () => {
16234
- doc.removeEventListener("pointerdown", onPress, true);
16235
- layer?.removeEventListener("wheel", onScrollGesture);
16236
- layer?.removeEventListener("touchmove", onScrollGesture);
16237
- window.removeEventListener("keydown", onKey, true);
16238
- };
16239
- }, [expanded, layerRef, dialRef]);
16240
- return { expanded, toggle, fold: fold2 };
16241
- }
16242
-
16243
- // src/presetSeen.ts
16244
- var KEY2 = "ss-w-presets-tool-opened";
16245
- var openedThisPage = false;
16246
- function readToolSeen() {
16247
- if (openedThisPage) return true;
16248
- try {
16249
- return window.localStorage.getItem(KEY2) === "1";
16250
- } catch {
16251
- return false;
16252
- }
16253
- }
16254
- function markToolSeen() {
16255
- openedThisPage = true;
16256
- try {
16257
- window.localStorage.setItem(KEY2, "1");
16258
- } catch {
16259
- }
16260
- }
16261
-
16262
15834
  // src/components/ChatPanel.tsx
16263
- var import_jsx_runtime136 = require("react/jsx-runtime");
15835
+ var import_jsx_runtime135 = require("react/jsx-runtime");
16264
15836
  var FULLSCREEN_QUERY = "(max-width: 639px)";
16265
15837
  function useIsModal() {
16266
- const [modal, setModal] = (0, import_react94.useState)(false);
16267
- (0, import_react94.useEffect)(() => {
15838
+ const [modal, setModal] = (0, import_react92.useState)(false);
15839
+ (0, import_react92.useEffect)(() => {
16268
15840
  if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
16269
15841
  const mql = window.matchMedia(FULLSCREEN_QUERY);
16270
15842
  const sync = () => setModal(mql.matches);
@@ -16276,20 +15848,14 @@ function useIsModal() {
16276
15848
  }
16277
15849
  var HIDDEN_LAYER_STYLE = { position: "absolute", inset: 0, visibility: "hidden", display: "flex", flexDirection: "column" };
16278
15850
  var SQUAD_LAYER_STYLE = { display: "flex", flexDirection: "column", flex: 1, minHeight: 0 };
16279
- function hasPersonalBuilder(messages) {
16280
- return messages.some((m) => m.role === "assistant" && (!!m.greetingDashboard?.personal?.builder || !!m.greetingDashboards?.some((s) => !!s.dashboard.personal?.builder)));
16281
- }
16282
- function greetingInFlight(messages) {
16283
- return messages.some((m) => m.role === "assistant" && m.isGreeting === true && !m.done);
16284
- }
16285
15851
  function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, gamesResult, leaderboardResult, clubFixturesResult, clubStandingsResult, clubSquadResult, clubSquadStatsResult, clubPlayerDetailResult, loggedIn, conversation, presetGrid, favouritesEnabled, favourites }) {
16286
15852
  const { state, close, stop, send, reset } = controller;
16287
- const [squadView, setSquadView] = (0, import_react94.useState)("roster");
16288
- const [selectedPlayerId, setSelectedPlayerId] = (0, import_react94.useState)(null);
15853
+ const [squadView, setSquadView] = (0, import_react92.useState)("roster");
15854
+ const [selectedPlayerId, setSelectedPlayerId] = (0, import_react92.useState)(null);
16289
15855
  const clearPlayerDetail = clubPlayerDetailResult?.clear;
16290
15856
  const fetchPlayerDetail = clubPlayerDetailResult?.fetch;
16291
- const squadLayerRef = (0, import_react94.useRef)(null);
16292
- const squadScrollRef = (0, import_react94.useRef)(null);
15857
+ const squadLayerRef = (0, import_react92.useRef)(null);
15858
+ const squadScrollRef = (0, import_react92.useRef)(null);
16293
15859
  const selectPlayer = (playerId) => {
16294
15860
  squadScrollRef.current = squadLayerRef.current?.querySelector(".ss-w-mon-list")?.scrollTop ?? null;
16295
15861
  setSelectedPlayerId(playerId);
@@ -16299,20 +15865,20 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
16299
15865
  setSelectedPlayerId(null);
16300
15866
  clearPlayerDetail?.();
16301
15867
  };
16302
- (0, import_react94.useLayoutEffect)(() => {
15868
+ (0, import_react92.useLayoutEffect)(() => {
16303
15869
  if (selectedPlayerId !== null || squadScrollRef.current === null) return;
16304
15870
  const list = squadLayerRef.current?.querySelector(".ss-w-mon-list");
16305
15871
  if (list) list.scrollTop = squadScrollRef.current;
16306
15872
  squadScrollRef.current = null;
16307
15873
  }, [selectedPlayerId]);
16308
15874
  const activeTab = monitor?.activeTab;
16309
- (0, import_react94.useEffect)(() => {
15875
+ (0, import_react92.useEffect)(() => {
16310
15876
  if (activeTab === "squad" || selectedPlayerId === null) return;
16311
15877
  setSelectedPlayerId(null);
16312
15878
  clearPlayerDetail?.();
16313
15879
  }, [activeTab, selectedPlayerId, clearPlayerDetail]);
16314
15880
  const setMonitorTab = monitor?.setActiveTab;
16315
- (0, import_react94.useEffect)(() => {
15881
+ (0, import_react92.useEffect)(() => {
16316
15882
  if (activeTab === "favourites" && !favouritesEnabled) setMonitorTab?.("chat");
16317
15883
  }, [activeTab, favouritesEnabled, setMonitorTab]);
16318
15884
  const isModal = useIsModal();
@@ -16320,11 +15886,11 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
16320
15886
  const closeTab = monitor?.activeTab ?? "chat";
16321
15887
  const lastMessage = state.messages[state.messages.length - 1];
16322
15888
  const answering = state.isStreaming && !(lastMessage?.role === "assistant" && lastMessage.isGreeting);
16323
- const closeWith = (0, import_react94.useCallback)((method) => {
15889
+ const closeWith = (0, import_react92.useCallback)((method) => {
16324
15890
  track({ name: "widget_close", method, tab: closeTab, answering });
16325
15891
  close();
16326
15892
  }, [track, closeTab, answering, close]);
16327
- (0, import_react94.useEffect)(() => {
15893
+ (0, import_react92.useEffect)(() => {
16328
15894
  const onKey = (e) => {
16329
15895
  if (e.key === "Escape") closeWith("escape");
16330
15896
  };
@@ -16340,90 +15906,70 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
16340
15906
  monitor?.setActiveTab("chat");
16341
15907
  send(text, { grounding, source: "live_fact" });
16342
15908
  };
16343
- (0, import_react94.useEffect)(() => {
15909
+ (0, import_react92.useEffect)(() => {
16344
15910
  if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
16345
15911
  }, [monitor, state.isStreaming, state.messages.length]);
16346
15912
  const onChatTab = !monitor || monitor.activeTab === "chat";
16347
- const layerRef = (0, import_react94.useRef)(null);
16348
- const dialRef = (0, import_react94.useRef)(null);
16349
- const dialButtonRef = (0, import_react94.useRef)(null);
16350
- const inputRef = (0, import_react94.useRef)(null);
16351
- const limitRef = (0, import_react94.useRef)(null);
16352
- const typedSendRef = (0, import_react94.useRef)(false);
16353
- const focusAfterCloseRef = (0, import_react94.useRef)(null);
16354
- const [tool, setTool] = (0, import_react94.useState)(null);
16355
- const panelRef = (0, import_react94.useRef)(null);
15913
+ const inputRef = (0, import_react92.useRef)(null);
15914
+ const limitRef = (0, import_react92.useRef)(null);
15915
+ const typedSendRef = (0, import_react92.useRef)(false);
15916
+ const focusAfterCloseRef = (0, import_react92.useRef)(null);
15917
+ const [tool, setTool] = (0, import_react92.useState)(null);
15918
+ const panelRef = (0, import_react92.useRef)(null);
16356
15919
  const settings = useOddsSettings();
16357
- const [settingsOpen, setSettingsOpen] = (0, import_react94.useState)(false);
15920
+ const [settingsOpen, setSettingsOpen] = (0, import_react92.useState)(false);
16358
15921
  const hasSettings = settings.oddsOffered || !settings.themeLocked;
16359
- const openSettings = (0, import_react94.useCallback)(() => {
15922
+ const openSettings = (0, import_react92.useCallback)(() => {
16360
15923
  setTool(null);
16361
15924
  setSettingsOpen(true);
16362
15925
  }, []);
16363
- const closeSettings = (0, import_react94.useCallback)(() => {
15926
+ const closeSettings = (0, import_react92.useCallback)(() => {
16364
15927
  setSettingsOpen(false);
16365
15928
  panelRef.current?.querySelector(".ss-w-kebab")?.focus();
16366
15929
  }, []);
16367
- const [toolSeen, setToolSeen] = (0, import_react94.useState)(readToolSeen);
16368
- const dial = usePresetDial({
16369
- layerRef,
16370
- dialRef,
16371
- dialButtonRef,
16372
- messages: state.messages,
16373
- isStreaming: state.isStreaming,
16374
- activeTab: monitor?.activeTab ?? "chat"
16375
- });
16376
- const { fold: fold2 } = dial;
16377
15930
  const paused = isPaused(state.limit);
16378
- const dialWanted = !!presetGrid && !greetingInFlight(state.messages) && !hasPersonalBuilder(state.messages);
16379
- const showDial = dialWanted && onChatTab && !tool && !paused;
16380
- (0, import_react94.useEffect)(() => {
15931
+ (0, import_react92.useEffect)(() => {
16381
15932
  if (paused) setTool(null);
16382
15933
  }, [paused]);
16383
- (0, import_react94.useEffect)(() => {
15934
+ (0, import_react92.useEffect)(() => {
16384
15935
  if (!paused) return;
16385
15936
  if (typedSendRef.current) limitRef.current?.focus();
16386
15937
  typedSendRef.current = false;
16387
15938
  }, [paused]);
16388
- const openTool = (0, import_react94.useCallback)((next) => {
16389
- fold2();
16390
- markToolSeen();
16391
- setToolSeen(true);
15939
+ const openTool = (0, import_react92.useCallback)((next) => {
16392
15940
  setTool(next);
16393
- }, [fold2]);
16394
- const onPill = (0, import_react94.useCallback)((kind) => openTool(kind === "numbers" ? { kind: "numbers" } : { kind: "combo" }), [openTool]);
16395
- const toolsValue = (0, import_react94.useMemo)(
16396
- () => presetGrid && !paused ? { openBuilder: (total, legs) => openTool({ kind: "combo", total, legs }), changeLabel: ui.presets.changeCombo } : null,
15941
+ }, []);
15942
+ const toolsValue = (0, import_react92.useMemo)(
15943
+ () => presetGrid && !paused ? { openBuilder: (total, legs) => openTool({ total, legs }), changeLabel: ui.presets.changeCombo } : null,
16397
15944
  [presetGrid, paused, openTool, ui.presets.changeCombo]
16398
15945
  );
16399
- const closeTool = (0, import_react94.useCallback)(() => {
16400
- focusAfterCloseRef.current = "dial";
15946
+ const closeTool = (0, import_react92.useCallback)(() => {
15947
+ focusAfterCloseRef.current = "composer";
16401
15948
  setTool(null);
16402
15949
  }, []);
16403
- const sendAsk = (0, import_react94.useCallback)((ask) => {
15950
+ const sendAsk = (0, import_react92.useCallback)((ask) => {
16404
15951
  focusAfterCloseRef.current = "composer";
16405
15952
  setTool(null);
16406
15953
  monitor?.setActiveTab("chat");
16407
15954
  send(ask.message, { displayText: ask.displayText, preset: ask.preset, source: "preset" });
16408
15955
  }, [monitor, send]);
16409
- const formatKickoff = (0, import_react94.useCallback)((kickoffUtc) => {
15956
+ const formatKickoff = (0, import_react92.useCallback)((kickoffUtc) => {
16410
15957
  const k = ui.bettingKickoff(kickoffUtc);
16411
15958
  return `${k.dayLabel} ${k.time}`;
16412
15959
  }, [ui]);
16413
- (0, import_react94.useEffect)(() => {
15960
+ (0, import_react92.useEffect)(() => {
16414
15961
  if (tool) return;
16415
15962
  const target = focusAfterCloseRef.current;
16416
15963
  focusAfterCloseRef.current = null;
16417
- if (target === "dial") dialButtonRef.current?.focus();
16418
- else if (target === "composer") inputRef.current?.focus();
15964
+ if (target === "composer") inputRef.current?.focus();
16419
15965
  }, [tool]);
16420
- (0, import_react94.useEffect)(() => {
15966
+ (0, import_react92.useEffect)(() => {
16421
15967
  if (!tool || onChatTab && presetGrid) return;
16422
15968
  focusAfterCloseRef.current = "composer";
16423
15969
  setTool(null);
16424
15970
  }, [tool, onChatTab, presetGrid]);
16425
- return /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)("div", { ref: panelRef, className: "ss-w-panel", role: "dialog", "aria-modal": isModal, "aria-label": ui.chatDialogLabel, children: [
16426
- /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
15971
+ return /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("div", { ref: panelRef, className: "ss-w-panel", role: "dialog", "aria-modal": isModal, "aria-label": ui.chatDialogLabel, children: [
15972
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
16427
15973
  ChatHeader,
16428
15974
  {
16429
15975
  onClose: () => closeWith("button"),
@@ -16438,7 +15984,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
16438
15984
  settingsLabel: ui.settings.title
16439
15985
  }
16440
15986
  ),
16441
- monitor && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
15987
+ monitor && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
16442
15988
  TabBar,
16443
15989
  {
16444
15990
  monitor,
@@ -16452,35 +15998,23 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
16452
15998
  favouritesEnabled: favouritesEnabled ?? false
16453
15999
  }
16454
16000
  ),
16455
- /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)("div", { ref: layerRef, className: "ss-w-chat-layer", "data-dial": dialWanted ? "" : void 0, style: onChatTab ? void 0 : HIDDEN_LAYER_STYLE, children: [
16456
- /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(PresetToolsContext.Provider, { value: toolsValue, children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(MessageList, { controller, ui, slip, onDashboardTap, monitor }) }),
16457
- showDial ? /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
16458
- PresetSpeedDial,
16459
- {
16460
- expanded: dial.expanded,
16461
- showDot: !toolSeen,
16462
- strings: ui.presets,
16463
- onToggle: dial.toggle,
16464
- onOpen: onPill,
16465
- rootRef: dialRef,
16466
- buttonRef: dialButtonRef
16467
- }
16468
- ) : null,
16469
- tool && presetGrid && onChatTab && !paused ? tool.kind === "numbers" ? /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(SetNumbersTool, { grid: presetGrid, strings: ui.presets, streaming: state.isStreaming, onSend: sendAsk, onClose: closeTool }) : /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(BuildComboTool, { grid: presetGrid, strings: ui.presets, streaming: state.isStreaming, formatKickoff, initialTotal: tool.total, initialLegs: tool.legs, onSend: sendAsk, onClose: closeTool }) : null
16001
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("div", { className: "ss-w-chat-layer", style: onChatTab ? void 0 : HIDDEN_LAYER_STYLE, children: [
16002
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(PresetToolsContext.Provider, { value: toolsValue, children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(MessageList, { controller, ui, slip, onDashboardTap, monitor }) }),
16003
+ tool && presetGrid && onChatTab && !paused ? /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(BuildComboTool, { grid: presetGrid, strings: ui.presets, streaming: state.isStreaming, formatKickoff, initialTotal: tool.total, initialLegs: tool.legs, onSend: sendAsk, onClose: closeTool }) : null
16470
16004
  ] }),
16471
- monitor && discovery && monitor.activeTab === "today" && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(TodayPanel, { discovery, ui, monitor }),
16472
- monitor && monitor.activeTab === "following" && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(MatchesPanel, { monitor, ui, slip, onAsk: paused ? void 0 : handleAsk, discovery }),
16473
- monitor && monitor.activeTab === "trends" && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(TrendsPanel, { monitor, ui, slip }),
16474
- monitor && monitor.activeTab === "fixtures" && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(Fixtures, { fixtures: clubFixturesResult?.fixtures ?? [], loading: clubFixturesResult?.loading ?? false, ui }),
16475
- monitor && monitor.activeTab === "standings" && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(Standings, { standings: clubStandingsResult?.data ?? null, loading: clubStandingsResult?.loading ?? false, ui }),
16476
- monitor && monitor.activeTab === "squad" && /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_jsx_runtime136.Fragment, { children: [
16477
- /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
16005
+ monitor && discovery && monitor.activeTab === "today" && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(TodayPanel, { discovery, ui, monitor }),
16006
+ monitor && monitor.activeTab === "following" && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(MatchesPanel, { monitor, ui, slip, onAsk: paused ? void 0 : handleAsk, discovery }),
16007
+ monitor && monitor.activeTab === "trends" && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(TrendsPanel, { monitor, ui, slip }),
16008
+ monitor && monitor.activeTab === "fixtures" && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(Fixtures, { fixtures: clubFixturesResult?.fixtures ?? [], loading: clubFixturesResult?.loading ?? false, ui }),
16009
+ monitor && monitor.activeTab === "standings" && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(Standings, { standings: clubStandingsResult?.data ?? null, loading: clubStandingsResult?.loading ?? false, ui }),
16010
+ monitor && monitor.activeTab === "squad" && /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(import_jsx_runtime135.Fragment, { children: [
16011
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
16478
16012
  "div",
16479
16013
  {
16480
16014
  ref: squadLayerRef,
16481
16015
  style: selectedPlayerId === null ? SQUAD_LAYER_STYLE : HIDDEN_LAYER_STYLE,
16482
16016
  "aria-hidden": selectedPlayerId !== null ? true : void 0,
16483
- children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
16017
+ children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
16484
16018
  Squad,
16485
16019
  {
16486
16020
  squad: clubSquadResult?.data ?? null,
@@ -16498,9 +16032,9 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
16498
16032
  )
16499
16033
  }
16500
16034
  ),
16501
- selectedPlayerId !== null && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(PlayerDetail, { detail: clubPlayerDetailResult?.data ?? null, loading: clubPlayerDetailResult?.loading ?? false, ui, seasonName: clubSquadStatsResult?.seasonName ?? null, onClose: closePlayer })
16035
+ selectedPlayerId !== null && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(PlayerDetail, { detail: clubPlayerDetailResult?.data ?? null, loading: clubPlayerDetailResult?.loading ?? false, ui, seasonName: clubSquadStatsResult?.seasonName ?? null, onClose: closePlayer })
16502
16036
  ] }),
16503
- monitor && monitor.activeTab === "games" && gamesResult && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
16037
+ monitor && monitor.activeTab === "games" && gamesResult && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
16504
16038
  GamesPanel,
16505
16039
  {
16506
16040
  loggedIn: !!loggedIn,
@@ -16515,10 +16049,10 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
16515
16049
  }
16516
16050
  }
16517
16051
  ),
16518
- monitor && monitor.activeTab === "favourites" && favouritesEnabled && favourites && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(FavouritesPanel, { controller: favourites.controller, ui, sport: favourites.sport, sports: favourites.sports, onSportChange: favourites.onSportChange }),
16519
- (!monitor || monitor.activeTab !== "games" && monitor.activeTab !== "favourites") && /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_jsx_runtime136.Fragment, { children: [
16520
- /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("div", { ref: limitRef, className: "ss-w-limit", role: "status", tabIndex: -1, children: state.limit ? limitText(state.limit, ui) : null }),
16521
- paused ? null : /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
16052
+ monitor && monitor.activeTab === "favourites" && favouritesEnabled && favourites && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(FavouritesPanel, { controller: favourites.controller, ui, sport: favourites.sport, sports: favourites.sports, onSportChange: favourites.onSportChange }),
16053
+ (!monitor || monitor.activeTab !== "games" && monitor.activeTab !== "favourites") && /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(import_jsx_runtime135.Fragment, { children: [
16054
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("div", { ref: limitRef, className: "ss-w-limit", role: "status", tabIndex: -1, children: state.limit ? limitText(state.limit, ui) : null }),
16055
+ paused ? null : /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
16522
16056
  ChatInput,
16523
16057
  {
16524
16058
  ref: inputRef,
@@ -16528,19 +16062,18 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
16528
16062
  onStop: stop,
16529
16063
  stopLabel: ui.stopResponse,
16530
16064
  sendLabel: ui.sendMessage,
16531
- disabled: !!tool,
16532
- onType: fold2
16065
+ disabled: !!tool
16533
16066
  }
16534
16067
  )
16535
16068
  ] }),
16536
- settingsOpen && hasSettings ? /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(SettingsSheet, { ui, onClose: closeSettings }) : null
16069
+ settingsOpen && hasSettings ? /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(SettingsSheet, { ui, onClose: closeSettings }) : null
16537
16070
  ] });
16538
16071
  }
16539
16072
 
16540
16073
  // src/components/HostEventsProvider.tsx
16541
- var import_jsx_runtime137 = require("react/jsx-runtime");
16074
+ var import_jsx_runtime136 = require("react/jsx-runtime");
16542
16075
  function HostEventsProvider({ value, children }) {
16543
- return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(SlipStateContext.Provider, { value: value.slipState, children });
16076
+ return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(SlipStateContext.Provider, { value: value.slipState, children });
16544
16077
  }
16545
16078
 
16546
16079
  // src/styles/css.generated.ts
@@ -16745,7 +16278,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
16745
16278
  @keyframes ss-w-greet-dotbounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
16746
16279
 
16747
16280
  /* panel */
16748
- .ss-w-panel { position: fixed; bottom: calc(var(--ss-w-offset-y) + 72px); z-index: 2147483000; display: flex; flex-direction: column; width: min(460px, calc(100vw - 40px)); height: min(640px, calc(100vh - 120px)); background: var(--ss-w-panel); border: 1px solid var(--ss-w-line); border-radius: var(--ss-w-radius); overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,.24); }
16281
+ .ss-w-panel { position: fixed; bottom: var(--ss-w-offset-y); z-index: 2147483000; display: flex; flex-direction: column; width: min(460px, calc(100vw - 40px)); height: min(704px, calc(100vh - 2 * var(--ss-w-offset-y))); background: var(--ss-w-panel); border: 1px solid var(--ss-w-line); border-radius: var(--ss-w-radius); overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,.24); }
16749
16282
  .ss-w-root[data-ss-w-pos="right"] .ss-w-panel { right: var(--ss-w-offset-x); }
16750
16283
  .ss-w-root[data-ss-w-pos="left"] .ss-w-panel { left: var(--ss-w-offset-x); }
16751
16284
  @media (max-width: 639px) {
@@ -17164,7 +16697,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
17164
16697
  .ss-w-combo-addall .ss-w-slip-btn { min-height: 44px; padding: 10px 16px; font-size: 14px; font-weight: 650; border-radius: 22px; white-space: normal; }
17165
16698
  .ss-w-combo-addall .ss-w-toast { position: static; width: auto; max-width: none; font-size: 12px; box-shadow: none; }
17166
16699
 
17167
- /* onboarding presets stage 2: the two tools (spec Stage 2 Behaviour, boards 1c and 2c). A sheet
16700
+ /* onboarding presets: the combo builder (spec Stage 2 Behaviour, board 2c). A sheet
17168
16701
  over the message list, inside .ss-w-chat-layer; the body scrolls and the builder's Send sits in
17169
16702
  the footer, so it stays visible on a phone. Colours come from the theme tokens. */
17170
16703
  .ss-w-tool-backdrop { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; justify-content: flex-end; background: rgba(0,0,0,.35); }
@@ -17175,15 +16708,6 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
17175
16708
  .ss-w-tool-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 12px; padding: 4px 14px 14px; }
17176
16709
  .ss-w-tool-body > * { flex: none; }
17177
16710
  .ss-w-tool-foot { flex: none; padding: 10px 14px 12px; border-top: 1px solid var(--ss-w-line); }
17178
- .ss-w-tool-row { display: flex; flex-direction: column; gap: 8px; padding: 10px 11px; border: 1px solid var(--ss-w-line); border-left: 3px solid var(--ss-w-accent); border-radius: 12px; }
17179
- .ss-w-tool-ask { font-size: 14px; font-weight: 650; line-height: 1.7; color: var(--ss-w-ink); overflow-wrap: anywhere; }
17180
- .ss-w-tool-num { position: relative; display: inline-block; vertical-align: middle; margin: 0 2px; font-variant-numeric: tabular-nums; font-weight: 800; color: var(--ss-w-accent); }
17181
- .ss-w-tool-num-size { display: block; font-size: max(16px, 1em); user-select: none; -webkit-user-select: none; visibility: hidden; box-sizing: border-box; min-width: 44px; min-height: 32px; padding: 6px 26px 6px 10px; line-height: 1.3; white-space: pre; }
17182
- .ss-w-tool-num-select { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0 22px 0 10px; font: inherit; font-size: max(16px, 1em); font-variant-numeric: tabular-nums; font-weight: 800; color: var(--ss-w-accent); background-color: color-mix(in srgb, var(--ss-w-accent) 10%, var(--ss-w-panel)); border: 1.5px solid color-mix(in srgb, var(--ss-w-accent) 65%, var(--ss-w-line)); border-radius: 8px; cursor: pointer; appearance: none; -webkit-appearance: none; }
17183
- .ss-w-tool-num::after { content: ""; position: absolute; right: 9px; top: 50%; width: 5px; height: 5px; margin-top: -4px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); pointer-events: none; }
17184
- .ss-w-tool-num-select:focus-visible { outline: 2px solid var(--ss-w-accent); outline-offset: 2px; }
17185
- .ss-w-tool-num-select option { font-weight: 600; color: var(--ss-w-ink); background: var(--ss-w-panel); }
17186
- .ss-w-tool-num-select option:disabled { color: var(--ss-w-faint); }
17187
16711
  .ss-w-tool-picks { list-style: none; display: flex; flex-direction: column; gap: 4px; }
17188
16712
  .ss-w-tool-pick { display: grid; grid-template-columns: 1fr auto; column-gap: 8px; padding: 5px 8px; font-size: 12px; line-height: 1.35; background: var(--ss-w-bubble); border-radius: 8px; }
17189
16713
  .ss-w-tool-pick-match { grid-column: 1; font-weight: 650; color: var(--ss-w-ink); overflow-wrap: anywhere; }
@@ -17192,13 +16716,6 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
17192
16716
  .ss-w-tool-pick-price { grid-column: 2; grid-row: 1 / span 3; align-self: center; font-family: ui-monospace, monospace; font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 800; color: var(--ss-w-accent); }
17193
16717
  .ss-w-tool-math { padding: 6px 8px; font-family: ui-monospace, monospace; font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 700; text-align: right; color: var(--ss-w-ink); background: color-mix(in srgb, var(--ss-w-accent) 9%, var(--ss-w-panel)); border-radius: 8px; overflow-wrap: anywhere; }
17194
16718
  .ss-w-tool-unavailable { padding: 6px 8px; font-size: 12px; color: var(--ss-w-faint); border: 1px dashed var(--ss-w-line); border-radius: 8px; }
17195
- .ss-w-tool-row--ask { flex-direction: row; align-items: center; gap: 10px; border-left-width: 1px; }
17196
- .ss-w-tool-icon { flex: none; font-size: 20px; line-height: 1; }
17197
- .ss-w-tool-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
17198
- .ss-w-tool-ready { padding: 2px 8px; font-size: 11.5px; font-weight: 650; color: var(--ss-w-accent); background: color-mix(in srgb, var(--ss-w-accent) 12%, transparent); border-radius: 10px; }
17199
- .ss-w-tool-go { flex: none; width: 44px; height: 44px; display: grid; place-items: center; font-size: 17px; color: #fff; background: var(--ss-w-accent); border: none; border-radius: 50%; cursor: pointer; }
17200
- .ss-w-tool-go:disabled { color: var(--ss-w-faint); background: var(--ss-w-bubble); cursor: not-allowed; }
17201
- .ss-w-tool-go:focus-visible { outline: 2px solid var(--ss-w-accent); outline-offset: 2px; }
17202
16719
  .ss-w-tool-send { align-self: flex-end; min-height: 40px; padding: 8px 18px; font: inherit; font-size: 13px; font-weight: 700; color: #fff; background: var(--ss-w-accent); border: none; border-radius: 20px; cursor: pointer; }
17203
16720
  .ss-w-tool-send:disabled { color: var(--ss-w-faint); background: var(--ss-w-bubble); cursor: not-allowed; }
17204
16721
  .ss-w-tool-foot .ss-w-tool-send { width: 100%; }
@@ -17226,34 +16743,8 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
17226
16743
  @keyframes ss-w-sheet-in { from { transform: translateY(12%); } to { transform: none; } }
17227
16744
  }
17228
16745
 
17229
- /* onboarding presets stage 2: the chat layer and the speed dial (spec Stage 2 Behaviour). The
17230
- layer is the message list's positioned box (P6), so the dial sits against the list's bottom
17231
- right and rises with the composer: right 8px puts the 44px button's centre on Send's (12px
17232
- padding + 18px), bottom 10px is above the composer's top border. While the button shows the list
17233
- gets 54px more bottom padding so its last message can scroll clear. */
16746
+ /* The chat layer is the message list's positioned box: a preset tool sheet sits over it. */
17234
16747
  .ss-w-chat-layer { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
17235
- .ss-w-chat-layer[data-dial] .ss-w-list { padding-bottom: 68px; }
17236
- .ss-w-dial { position: absolute; left: 12px; right: 8px; bottom: 10px; z-index: 2; display: flex; flex-direction: column-reverse; align-items: flex-end; gap: 8px; pointer-events: none; }
17237
- .ss-w-dial-btn, .ss-w-dial-pill { pointer-events: auto; }
17238
- .ss-w-dial-btn { position: relative; flex: none; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; font-size: 20px; color: var(--ss-w-accent); background: var(--ss-w-panel); border: 1px solid color-mix(in srgb, var(--ss-w-accent) 40%, var(--ss-w-line)); border-radius: 50%; box-shadow: 0 4px 14px rgba(0,0,0,.18); cursor: pointer; }
17239
- .ss-w-dial-btn[aria-expanded="true"] { color: var(--ss-w-panel); background: var(--ss-w-accent); border-color: var(--ss-w-accent); }
17240
- .ss-w-dial-btn:focus-visible, .ss-w-dial-pill:focus-visible { outline: 2px solid var(--ss-w-accent); outline-offset: 2px; }
17241
- .ss-w-dial-icon { grid-area: 1 / 1; display: grid; place-items: center; transition: transform 200ms ease, opacity 200ms ease; }
17242
- .ss-w-dial-icon--close { opacity: 0; transform: rotate(-90deg); }
17243
- .ss-w-dial-btn[aria-expanded="true"] .ss-w-dial-icon--open { opacity: 0; transform: rotate(90deg); }
17244
- .ss-w-dial-btn[aria-expanded="true"] .ss-w-dial-icon--close { opacity: 1; transform: none; }
17245
- .ss-w-dial-dot { position: absolute; top: 3px; right: 3px; width: 10px; height: 10px; background: var(--ss-w-accent); border: 2px solid var(--ss-w-panel); border-radius: 50%; }
17246
- .ss-w-dial-pills { max-width: 100%; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
17247
- .ss-w-dial-pill { max-width: 100%; min-height: 44px; display: inline-flex; align-items: center; gap: 8px; padding: 6px 16px 6px 12px; font: inherit; font-size: 12.5px; font-weight: 650; line-height: 1.25; text-align: left; white-space: normal; overflow-wrap: anywhere; color: var(--ss-w-ink); background: var(--ss-w-panel); border: 1px solid color-mix(in srgb, var(--ss-w-accent) 35%, var(--ss-w-line)); border-radius: 22px; box-shadow: 0 4px 14px rgba(0,0,0,.16); cursor: pointer; opacity: 0; visibility: hidden; transform: translateY(14px) scale(.5); transform-origin: bottom right; transition: opacity 200ms ease, transform 200ms ease, visibility 0s linear 200ms; }
17248
- .ss-w-dial-pill svg { flex: none; font-size: 18px; color: var(--ss-w-accent); }
17249
- .ss-w-dial-pill-label { min-width: 0; }
17250
- .ss-w-dial-pills[data-open] .ss-w-dial-pill { opacity: 1; visibility: visible; transform: none; transition: opacity 200ms ease, transform 200ms ease, visibility 0s; }
17251
- @media (prefers-reduced-motion: reduce) {
17252
- .ss-w-dial-pill { transform: none; transition: opacity 200ms ease, visibility 0s linear 200ms; }
17253
- .ss-w-dial-pills[data-open] .ss-w-dial-pill { transition: opacity 200ms ease, visibility 0s; }
17254
- .ss-w-dial-icon { transition: opacity 200ms ease; }
17255
- .ss-w-dial-icon--close, .ss-w-dial-btn[aria-expanded="true"] .ss-w-dial-icon--open { transform: none; }
17256
- }
17257
16748
 
17258
16749
  /* Compact price list (D16): three or more cards of one turn, one row per fixture. Team names wrap
17259
16750
  to a second line and are never cut; the time sits above the match pin, with no column of its own. */
@@ -19059,7 +18550,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
19059
18550
  `;
19060
18551
 
19061
18552
  // src/StatsWidget.tsx
19062
- var import_jsx_runtime138 = require("react/jsx-runtime");
18553
+ var import_jsx_runtime137 = require("react/jsx-runtime");
19063
18554
  function buildClient(props) {
19064
18555
  try {
19065
18556
  if ("client" in props && props.client) {
@@ -19084,12 +18575,12 @@ function injectStyles(root) {
19084
18575
  function StatsWidget(props) {
19085
18576
  const injectedClient = "client" in props ? props.client : void 0;
19086
18577
  const cfg = props.config;
19087
- const built = (0, import_react95.useMemo)(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
19088
- const trackingRef = (0, import_react95.useRef)({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
19089
- const track = (0, import_react95.useMemo)(() => createTracker(() => trackingRef.current), []);
19090
- const eventTextRef = (0, import_react95.useRef)(false);
18578
+ const built = (0, import_react93.useMemo)(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
18579
+ const trackingRef = (0, import_react93.useRef)({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
18580
+ const track = (0, import_react93.useMemo)(() => createTracker(() => trackingRef.current), []);
18581
+ const eventTextRef = (0, import_react93.useRef)(false);
19091
18582
  eventTextRef.current = cfg?.eventText === true;
19092
- const logger = (0, import_react95.useMemo)(() => {
18583
+ const logger = (0, import_react93.useMemo)(() => {
19093
18584
  if (!built) return null;
19094
18585
  const raw = built.client.createEventLogger({
19095
18586
  operatorUserId: cfg?.userContext?.operatorUserId,
@@ -19097,24 +18588,24 @@ function StatsWidget(props) {
19097
18588
  });
19098
18589
  return withTracking(raw, track);
19099
18590
  }, [built?.client, track]);
19100
- const ui = (0, import_react95.useMemo)(() => normalizeUi(props.config ?? { operatorId: "", publicKey: "" }), [props.config]);
18591
+ const ui = (0, import_react93.useMemo)(() => normalizeUi(props.config ?? { operatorId: "", publicKey: "" }), [props.config]);
19101
18592
  const oddsSettings = useOddsSettingsState(ui, built?.conversation, cfg?.operatorId || "default");
19102
- const rootRef = (0, import_react95.useRef)(null);
19103
- const introDoneRef = (0, import_react95.useRef)(false);
19104
- const markIntroDone = (0, import_react95.useCallback)(() => {
18593
+ const rootRef = (0, import_react93.useRef)(null);
18594
+ const introDoneRef = (0, import_react93.useRef)(false);
18595
+ const markIntroDone = (0, import_react93.useCallback)(() => {
19105
18596
  introDoneRef.current = true;
19106
18597
  }, []);
19107
18598
  const language = injectedClient ? void 0 : toUserContext(cfg ?? {})?.defaultLanguage;
19108
18599
  const threadLanguage = supportedLanguage(language);
19109
18600
  const convStorageKey = `ss-w-conv:${cfg?.operatorId ?? ""}:${cfg?.userContext?.operatorUserId ?? "anon"}${threadLanguage ? `:lang=${threadLanguage}` : ""}`;
19110
- const sportScope = (0, import_react95.useMemo)(
18601
+ const sportScope = (0, import_react93.useMemo)(
19111
18602
  () => ({ operatorId: cfg?.operatorId ?? "", operatorUserId: cfg?.userContext?.operatorUserId, anonymousUserId: cfg?.userContext?.anonymousUserId }),
19112
18603
  [cfg?.operatorId, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId]
19113
18604
  );
19114
- const chatTracking = (0, import_react95.useMemo)(() => ({ track, eventText: () => eventTextRef.current }), [track]);
18605
+ const chatTracking = (0, import_react93.useMemo)(() => ({ track, eventText: () => eventTextRef.current }), [track]);
19115
18606
  const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey, cfg?.page, sportScope, language, chatTracking, injectedClient ? oddsSettings.userOddsFormat : oddsSettings.oddsFormat);
19116
- const [hasToday, setHasToday] = (0, import_react95.useState)(false);
19117
- const liveCardWatches = (0, import_react95.useMemo)(() => {
18607
+ const [hasToday, setHasToday] = (0, import_react93.useState)(false);
18608
+ const liveCardWatches = (0, import_react93.useMemo)(() => {
19118
18609
  const seen = /* @__PURE__ */ new Set();
19119
18610
  const out = [];
19120
18611
  for (const msg of controller.state.messages) {
@@ -19141,11 +18632,11 @@ function StatsWidget(props) {
19141
18632
  });
19142
18633
  const operatorUserId = cfg?.userContext?.operatorUserId;
19143
18634
  const anonymousUserId = cfg?.userContext?.anonymousUserId;
19144
- const getSchedule = (0, import_react95.useCallback)(
18635
+ const getSchedule = (0, import_react93.useCallback)(
19145
18636
  (localDate, utcOffsetMinutes) => built ? built.conversation.getSchedule(localDate, utcOffsetMinutes, operatorUserId, anonymousUserId) : Promise.resolve(null),
19146
18637
  [built, operatorUserId, anonymousUserId]
19147
18638
  );
19148
- const postLeagueStar = (0, import_react95.useCallback)(
18639
+ const postLeagueStar = (0, import_react93.useCallback)(
19149
18640
  async (competitionId, starred) => {
19150
18641
  if (!built) return null;
19151
18642
  const result = await built.conversation.starLeague(competitionId, starred, operatorUserId, anonymousUserId);
@@ -19154,11 +18645,11 @@ function StatsWidget(props) {
19154
18645
  },
19155
18646
  [built, operatorUserId, anonymousUserId, track]
19156
18647
  );
19157
- const getStates = (0, import_react95.useCallback)(
18648
+ const getStates = (0, import_react93.useCallback)(
19158
18649
  (matchIds, nbaGameIds, nflGameIds) => built ? built.conversation.getStates(matchIds, nbaGameIds, nflGameIds) : Promise.resolve(null),
19159
18650
  [built]
19160
18651
  );
19161
- const pinnedMatchIds = (0, import_react95.useMemo)(
18652
+ const pinnedMatchIds = (0, import_react93.useMemo)(
19162
18653
  () => footballMatchPinIds(monitor.pins),
19163
18654
  [monitor.pins]
19164
18655
  );
@@ -19173,11 +18664,11 @@ function StatsWidget(props) {
19173
18664
  pinnedMatchIds
19174
18665
  });
19175
18666
  const todayHasContent = visibleGroupsOf(discovery.groups, discovery.states).length > 0;
19176
- (0, import_react95.useEffect)(() => {
18667
+ (0, import_react93.useEffect)(() => {
19177
18668
  setHasToday(todayHasContent);
19178
18669
  }, [todayHasContent]);
19179
- const prevLiveSnapshotRef = (0, import_react95.useRef)(monitor.snapshot);
19180
- (0, import_react95.useEffect)(() => {
18670
+ const prevLiveSnapshotRef = (0, import_react93.useRef)(monitor.snapshot);
18671
+ (0, import_react93.useEffect)(() => {
19181
18672
  const snap = monitor.snapshot;
19182
18673
  if (!snap || snap === prevLiveSnapshotRef.current) return;
19183
18674
  prevLiveSnapshotRef.current = snap;
@@ -19217,14 +18708,14 @@ function StatsWidget(props) {
19217
18708
  const clubSquadResult = useClubSquad(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
19218
18709
  const clubSquadStatsResult = useClubSquadStats(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
19219
18710
  const clubPlayerDetailResult = useClubPlayerDetail(built?.conversation ?? null);
19220
- const [favSportPick, setFavSportPick] = (0, import_react95.useState)(null);
19221
- const latestGreeting = (0, import_react95.useMemo)(() => {
18711
+ const [favSportPick, setFavSportPick] = (0, import_react93.useState)(null);
18712
+ const latestGreeting = (0, import_react93.useMemo)(() => {
19222
18713
  for (const m of [...controller.state.messages].reverse()) {
19223
18714
  if (m.role === "assistant" && m.defaultSport !== void 0) return m;
19224
18715
  }
19225
18716
  return null;
19226
18717
  }, [controller.state.messages]);
19227
- const favSportOptions = (0, import_react95.useMemo)(
18718
+ const favSportOptions = (0, import_react93.useMemo)(
19228
18719
  () => (switchSets(latestGreeting?.greetingDashboards) ?? []).map((set) => ({ sport: set.sport, label: set.label })),
19229
18720
  [latestGreeting]
19230
18721
  );
@@ -19233,7 +18724,7 @@ function StatsWidget(props) {
19233
18724
  const favSport = [favSportPick, rememberedSport, latestGreeting?.defaultSport].find(offered) ?? "football";
19234
18725
  const favSports = favSportOptions.length > 0 ? favSportOptions : [{ sport: favSport, label: favSport.charAt(0).toUpperCase() + favSport.slice(1) }];
19235
18726
  const hasFavouritesIdentity = !!(operatorUserId || anonymousUserId);
19236
- const [panelEverOpened, setPanelEverOpened] = (0, import_react95.useState)(controller.state.isOpen);
18727
+ const [panelEverOpened, setPanelEverOpened] = (0, import_react93.useState)(controller.state.isOpen);
19237
18728
  if (controller.state.isOpen && !panelEverOpened) setPanelEverOpened(true);
19238
18729
  const favourites = useFavourites({
19239
18730
  conversation: built?.conversation ?? null,
@@ -19244,14 +18735,14 @@ function StatsWidget(props) {
19244
18735
  track
19245
18736
  });
19246
18737
  const favouritesEnabled = hasFavouritesIdentity && favourites.status !== "refused";
19247
- const getPricePresets = (0, import_react95.useCallback)(
18738
+ const getPricePresets = (0, import_react93.useCallback)(
19248
18739
  (locale2) => built ? built.conversation.getPricePresets(locale2, { pool: "open" }) : Promise.resolve(null),
19249
18740
  [built]
19250
18741
  );
19251
18742
  const presetGrid = usePresetGrid({ getPricePresets, isOpen: controller.state.isOpen, locale: ui.presets.lang });
19252
18743
  const markTodayActivity = monitor.markTodayActivity;
19253
- const prevLiveCountRef = (0, import_react95.useRef)(0);
19254
- (0, import_react95.useEffect)(() => {
18744
+ const prevLiveCountRef = (0, import_react93.useRef)(0);
18745
+ (0, import_react93.useEffect)(() => {
19255
18746
  const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
19256
18747
  prevLiveCountRef.current = discovery.liveCount;
19257
18748
  if (rose) markTodayActivity();
@@ -19265,7 +18756,7 @@ function StatsWidget(props) {
19265
18756
  closePanel: controller.close
19266
18757
  });
19267
18758
  const markAdded = hostEvents.markAdded;
19268
- const slip = (0, import_react95.useMemo)(
18759
+ const slip = (0, import_react93.useMemo)(
19269
18760
  () => {
19270
18761
  const handler = props.config?.onAddToSlip;
19271
18762
  return {
@@ -19285,7 +18776,7 @@ function StatsWidget(props) {
19285
18776
  },
19286
18777
  [props.config?.onAddToSlip, props.config?.slipSports, controller.state.conversationId, markAdded]
19287
18778
  );
19288
- const onDashboardTap = (0, import_react95.useMemo)(
18779
+ const onDashboardTap = (0, import_react93.useMemo)(
19289
18780
  () => built ? createDashboardTapSignal((input) => built.conversation.sendSignal(input), logger) : void 0,
19290
18781
  [built, logger]
19291
18782
  );
@@ -19301,10 +18792,10 @@ function StatsWidget(props) {
19301
18792
  log: logger
19302
18793
  })
19303
18794
  }));
19304
- const onControlRef = (0, import_react95.useRef)(props.onControl);
18795
+ const onControlRef = (0, import_react93.useRef)(props.onControl);
19305
18796
  onControlRef.current = props.onControl;
19306
18797
  const { open: openPanel, close: closePanel } = controller;
19307
- (0, import_react95.useEffect)(() => {
18798
+ (0, import_react93.useEffect)(() => {
19308
18799
  onControlRef.current?.({ open: openPanel, close: closePanel });
19309
18800
  return () => onControlRef.current?.(null);
19310
18801
  }, [openPanel, closePanel]);
@@ -19321,11 +18812,11 @@ function StatsWidget(props) {
19321
18812
  page: cfg?.page
19322
18813
  }
19323
18814
  };
19324
- (0, import_react95.useEffect)(() => {
18815
+ (0, import_react93.useEffect)(() => {
19325
18816
  if (!logger) return;
19326
18817
  logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
19327
18818
  }, [logger, operatorUserId, anonymousUserId, conversationId]);
19328
- (0, import_react95.useEffect)(() => {
18819
+ (0, import_react93.useEffect)(() => {
19329
18820
  if (!logger) return;
19330
18821
  logger.resume();
19331
18822
  const onHide = () => {
@@ -19343,15 +18834,15 @@ function StatsWidget(props) {
19343
18834
  logger.dispose();
19344
18835
  };
19345
18836
  }, [logger]);
19346
- (0, import_react95.useEffect)(() => {
18837
+ (0, import_react93.useEffect)(() => {
19347
18838
  if (!built || !ui.injectStyles) return;
19348
18839
  const node = rootRef.current?.getRootNode();
19349
18840
  if (node) injectStyles(node);
19350
18841
  }, [built, ui.injectStyles]);
19351
18842
  const holds = useSessionHolds();
19352
18843
  const builderConversation = built?.conversation ?? null;
19353
- const builderMemory = (0, import_react95.useMemo)(() => createBuilderMemory(), [builderConversation, controller.state.threadEpoch]);
19354
- const personalGreeting = (0, import_react95.useMemo)(() => ({
18844
+ const builderMemory = (0, import_react93.useMemo)(() => createBuilderMemory(), [builderConversation, controller.state.threadEpoch]);
18845
+ const personalGreeting = (0, import_react93.useMemo)(() => ({
19355
18846
  favourites: favouritesEnabled && monitor.enabled ? favourites : null,
19356
18847
  conversation: built?.conversation ?? null,
19357
18848
  openFavourites: () => monitor.setActiveTab("favourites"),
@@ -19364,7 +18855,7 @@ function StatsWidget(props) {
19364
18855
  }), [favouritesEnabled, monitor.enabled, clubFixturesResult.settled, clubFixturesResult.tabReady, clubFixturesResult.enabled, monitor.setActiveTab, favourites, built, holds, builderMemory]);
19365
18856
  if (!built) return null;
19366
18857
  const attrs = themeAttrs(ui, oddsSettings.userTheme);
19367
- return /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(EventLogContext.Provider, { value: logger, children: /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(TrackingContext.Provider, { value: track, children: /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(SportScopeContext.Provider, { value: sportScope, children: /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(OddsSettingsContext.Provider, { value: oddsSettings, children: /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(HostEventsProvider, { value: hostEvents, children: /* @__PURE__ */ (0, import_jsx_runtime138.jsx)("div", { ref: rootRef, className: "ss-w-root", "data-ss-w-theme": attrs["data-ss-w-theme"], "data-ss-w-pos": attrs["data-ss-w-pos"], style: attrs.style, children: controller.state.isOpen ? /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(PersonalGreetingContext.Provider, { value: personalGreeting, children: /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
18858
+ return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(EventLogContext.Provider, { value: logger, children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(TrackingContext.Provider, { value: track, children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(SportScopeContext.Provider, { value: sportScope, children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(OddsSettingsContext.Provider, { value: oddsSettings, children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(HostEventsProvider, { value: hostEvents, children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("div", { ref: rootRef, className: "ss-w-root", "data-ss-w-theme": attrs["data-ss-w-theme"], "data-ss-w-pos": attrs["data-ss-w-pos"], style: attrs.style, children: controller.state.isOpen ? /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(PersonalGreetingContext.Provider, { value: personalGreeting, children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
19368
18859
  ChatPanel,
19369
18860
  {
19370
18861
  controller,
@@ -19386,7 +18877,7 @@ function StatsWidget(props) {
19386
18877
  favouritesEnabled: favouritesEnabled && clubFixturesResult.tabReady && !clubFixturesResult.enabled,
19387
18878
  favourites: { controller: favourites, sport: favSport, sports: favSports, onSportChange: setFavSportPick }
19388
18879
  }
19389
- ) }) : /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
18880
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
19390
18881
  ChatFab,
19391
18882
  {
19392
18883
  label: ui.launcherLabel,