@sensiblestats/widget-react 0.114.0 → 0.115.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/index.cjs +147 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +202 -93
- package/dist/index.js.map +1 -1
- package/dist/styles.css +19 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @sensiblestats/widget-react
|
|
2
2
|
|
|
3
|
+
## 0.115.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Live NBA props show each player's stats so far: value on every stat chip, minutes on the row, a live bar beside the last five games, and the stats clock in the header.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @sensiblestats/widget-sdk@0.81.0
|
|
13
|
+
|
|
14
|
+
## 0.114.1
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- The market-floor card pill now reads "Market price" ("Piyasa oranı" in Turkish), dropping the negative "not a value pick" half.
|
|
19
|
+
|
|
3
20
|
## 0.114.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -100,7 +100,7 @@ var STRINGS = {
|
|
|
100
100
|
fullTime: "Full time"
|
|
101
101
|
},
|
|
102
102
|
yourMarketTag: "Your market",
|
|
103
|
-
marketFloorLabel: "Market price
|
|
103
|
+
marketFloorLabel: "Market price",
|
|
104
104
|
addToSlip: "Add to slip",
|
|
105
105
|
marketPrices: "Market prices",
|
|
106
106
|
moreLines: "More lines",
|
|
@@ -454,6 +454,15 @@ var STRINGS = {
|
|
|
454
454
|
propsLast5: "Last 5 games",
|
|
455
455
|
propsLadderOnly: "Ladder only",
|
|
456
456
|
propsMarkets: (n) => `${n} markets`,
|
|
457
|
+
propsLast5Live: "Last 5 games + live",
|
|
458
|
+
propsLiveBar: "Live",
|
|
459
|
+
propsMinutes: (t) => `${t} min`,
|
|
460
|
+
propsLineChip: (l) => `line ${l}`,
|
|
461
|
+
propsShooting: (made, att) => `FG ${made}/${att}`,
|
|
462
|
+
propsFouls: (n) => `${n} PF`,
|
|
463
|
+
propsStatsLive: (t) => `Stats ${t} UTC \xB7 live`,
|
|
464
|
+
propsStatsAt: (t) => `Stats ${t} UTC`,
|
|
465
|
+
propsStatsAgo: (t, m) => `Stats ${t} UTC \xB7 ${m} min ago`,
|
|
457
466
|
propsStatShort: (stat) => NBA_STAT_SHORT_EN[stat] ?? stat,
|
|
458
467
|
matchupPace: "Pace",
|
|
459
468
|
matchupOffRating: "Offensive rating",
|
|
@@ -781,7 +790,7 @@ var STRINGS = {
|
|
|
781
790
|
fullTime: "Ma\xE7 bitti"
|
|
782
791
|
},
|
|
783
792
|
yourMarketTag: "\u0130lgilendi\u011Fin bahis",
|
|
784
|
-
marketFloorLabel: "Piyasa oran\u0131
|
|
793
|
+
marketFloorLabel: "Piyasa oran\u0131",
|
|
785
794
|
addToSlip: "Kupona ekle",
|
|
786
795
|
marketPrices: "Piyasa oranlar\u0131",
|
|
787
796
|
moreLines: "Di\u011Fer \xE7izgiler",
|
|
@@ -1135,6 +1144,15 @@ var STRINGS = {
|
|
|
1135
1144
|
propsLast5: "Son 5 ma\xE7",
|
|
1136
1145
|
propsLadderOnly: "Sadece alternatif",
|
|
1137
1146
|
propsMarkets: (n) => `${n} market`,
|
|
1147
|
+
propsLast5Live: "Son 5 ma\xE7 + canl\u0131",
|
|
1148
|
+
propsLiveBar: "Canl\u0131",
|
|
1149
|
+
propsMinutes: (t) => `${t} dk`,
|
|
1150
|
+
propsLineChip: (l) => `baraj ${l}`,
|
|
1151
|
+
propsShooting: (made, att) => `\u0130B ${made}/${att}`,
|
|
1152
|
+
propsFouls: (n) => `${n} faul`,
|
|
1153
|
+
propsStatsLive: (t) => `\u0130statistik ${t} UTC \xB7 canl\u0131`,
|
|
1154
|
+
propsStatsAt: (t) => `\u0130statistik ${t} UTC`,
|
|
1155
|
+
propsStatsAgo: (t, m) => `\u0130statistik ${t} UTC \xB7 ${m} dk \xF6nce`,
|
|
1138
1156
|
propsStatShort: (stat) => NBA_STAT_SHORT_TR[stat] ?? stat,
|
|
1139
1157
|
matchupPace: "Tempo",
|
|
1140
1158
|
matchupOffRating: "H\xFCcum reytingi",
|
|
@@ -1479,7 +1497,7 @@ function parseOddsFormat(value) {
|
|
|
1479
1497
|
}
|
|
1480
1498
|
|
|
1481
1499
|
// src/version.generated.ts
|
|
1482
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1500
|
+
var WIDGET_REACT_VERSION = "0.115.0";
|
|
1483
1501
|
|
|
1484
1502
|
// src/config.ts
|
|
1485
1503
|
function normalizeUi(cfg) {
|
|
@@ -4212,6 +4230,7 @@ function useTabs(initial = "chat") {
|
|
|
4212
4230
|
|
|
4213
4231
|
// src/useLiveMonitor.ts
|
|
4214
4232
|
var PROPS_FRESH_MS = 6e4;
|
|
4233
|
+
var PROPS_LIVE_FRESH_MS = 1e4;
|
|
4215
4234
|
var MARKET_FRESH_MS = 45e3;
|
|
4216
4235
|
var MARKET_FETCH_TIMEOUT_MS = 15e3;
|
|
4217
4236
|
var DEFAULT_FOOTBALL_MARKET = "FULLTIME_RESULT";
|
|
@@ -4321,7 +4340,7 @@ function useLiveMonitor(opts) {
|
|
|
4321
4340
|
if (!fn) return;
|
|
4322
4341
|
const key = monitorMatchKey(sport, matchId);
|
|
4323
4342
|
const cur = playerPropsRef.current[key];
|
|
4324
|
-
if (cur?.loading || cur && Date.now() - cur.fetchedAt < PROPS_FRESH_MS) return;
|
|
4343
|
+
if (cur?.loading || cur && Date.now() - cur.fetchedAt < (cur.bundle?.live ? PROPS_LIVE_FRESH_MS : PROPS_FRESH_MS)) return;
|
|
4325
4344
|
const put = (entry) => {
|
|
4326
4345
|
playerPropsRef.current = { ...playerPropsRef.current, [key]: entry };
|
|
4327
4346
|
setPlayerProps((prev) => ({ ...prev, [key]: entry }));
|
|
@@ -7505,7 +7524,7 @@ function InsightCard({ it, ui, slip, monitor }) {
|
|
|
7505
7524
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(AddToSlipButton, { it, slip, ui })
|
|
7506
7525
|
] })
|
|
7507
7526
|
] }),
|
|
7508
|
-
it.isMarketFloor ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "ss-w-bi-floor", children: ui?.marketFloorLabel ?? "Market price
|
|
7527
|
+
it.isMarketFloor ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "ss-w-bi-floor", children: ui?.marketFloorLabel ?? "Market price" }) : null,
|
|
7509
7528
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ReasonStrip, { it }),
|
|
7510
7529
|
it.disclaimer ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "ss-w-bi-disc", children: it.disclaimer }) : null
|
|
7511
7530
|
] });
|
|
@@ -10194,6 +10213,8 @@ var import_react60 = require("react");
|
|
|
10194
10213
|
// src/components/PropsPieces.tsx
|
|
10195
10214
|
var import_react59 = require("react");
|
|
10196
10215
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
10216
|
+
var livePlayer = (bundle, p) => bundle.live === true || !p.live ? p : { ...p, live: null };
|
|
10217
|
+
var mmss = (seconds) => `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, "0")}`;
|
|
10197
10218
|
var MAX_TIMER_MS = 2147483647;
|
|
10198
10219
|
var hasMainLine = (s) => s.over != null || s.under != null;
|
|
10199
10220
|
function preKickoff(match) {
|
|
@@ -10262,51 +10283,68 @@ function PriceCell({ hitsText, children }) {
|
|
|
10262
10283
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ss-w-props-rung-hits", children: hitsText })
|
|
10263
10284
|
] });
|
|
10264
10285
|
}
|
|
10265
|
-
function PropBars({ bars, line, title, wide, ui }) {
|
|
10286
|
+
function PropBars({ bars, line, title, wide, ui, note }) {
|
|
10266
10287
|
const values = bars.map((b) => b.value);
|
|
10267
10288
|
const top = Math.max(...values, line ?? 0, 1) * 1.1;
|
|
10268
10289
|
const pct = (v) => `${v / top * 100}%`;
|
|
10290
|
+
const hasLive = bars.some((b) => b.live);
|
|
10291
|
+
const columns = { "--ss-bars": bars.length };
|
|
10292
|
+
const barClass = (b, v) => b.live ? "ss-w-props-bar ss-w-props-bar--live" : wide && line != null && v < line ? "ss-w-props-bar ss-w-props-bar--under" : "ss-w-props-bar";
|
|
10269
10293
|
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "ss-w-props-l5", children: [
|
|
10270
|
-
/* @__PURE__ */ (0, import_jsx_runtime73.
|
|
10271
|
-
|
|
10272
|
-
|
|
10294
|
+
note ? /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "ss-w-props-l5-head", children: [
|
|
10295
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ss-w-props-cap", children: title }),
|
|
10296
|
+
note
|
|
10297
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ss-w-props-cap", children: title }),
|
|
10298
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: `${wide ? "ss-w-props-bars ss-w-props-bars--wide" : "ss-w-props-bars"}${hasLive ? " ss-w-props-bars--live" : ""}`, style: hasLive ? columns : void 0, children: [
|
|
10299
|
+
bars.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
10273
10300
|
"span",
|
|
10274
10301
|
{
|
|
10275
|
-
className:
|
|
10276
|
-
style: { height: pct(
|
|
10277
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ss-w-props-val", children:
|
|
10302
|
+
className: barClass(b, b.value),
|
|
10303
|
+
style: { height: pct(b.value) },
|
|
10304
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ss-w-props-val", children: b.value })
|
|
10278
10305
|
},
|
|
10279
10306
|
i
|
|
10280
10307
|
)),
|
|
10281
10308
|
line != null && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ss-w-props-ref", style: { bottom: pct(line) }, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ss-w-props-ref-lab", children: ui.nba.lineText(String(line)) }) })
|
|
10282
10309
|
] }),
|
|
10283
|
-
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: wide ? "ss-w-props-opps ss-w-props-opps--wide" : "ss-w-props-opps", children: bars.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("span", { children: [
|
|
10310
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: `${wide ? "ss-w-props-opps ss-w-props-opps--wide" : "ss-w-props-opps"}${hasLive ? " ss-w-props-opps--live" : ""}`, style: hasLive ? columns : void 0, children: bars.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("span", { children: [
|
|
10284
10311
|
b.away && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("i", { className: "ss-w-props-at", children: "@" }),
|
|
10285
|
-
b.label
|
|
10312
|
+
b.live ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("b", { children: b.label }) : b.label
|
|
10286
10313
|
] }, i)) })
|
|
10287
10314
|
] });
|
|
10288
10315
|
}
|
|
10289
|
-
function PropPlayerPanel({ player, bundle, descriptor, ui, slip }) {
|
|
10316
|
+
function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
|
|
10317
|
+
const player = livePlayer(bundle, given);
|
|
10290
10318
|
const stats = descriptor.stats.map((k) => player.stats.find((s) => s.stat === k)).filter((s) => s != null);
|
|
10291
10319
|
const [picked, setPicked] = (0, import_react59.useState)(null);
|
|
10292
10320
|
const active = stats.find((s) => s.stat === picked) ?? stats[0];
|
|
10293
10321
|
const sample = active?.games?.length ?? 0;
|
|
10294
10322
|
const hitsOf = (price, text) => descriptor.showHits && sample > 0 && price.hits != null ? text(price.hits) : null;
|
|
10295
10323
|
const bars = active ? descriptor.bars(active, player) : [];
|
|
10296
|
-
const title = typeof descriptor.barsTitle === "function" ? descriptor.barsTitle(bars.length) : descriptor.barsTitle;
|
|
10324
|
+
const title = typeof descriptor.barsTitle === "function" ? descriptor.barsTitle(bars.length, bars.some((b) => b.live)) : descriptor.barsTitle;
|
|
10297
10325
|
const priceProps = { bundle, descriptor, ui, slip };
|
|
10326
|
+
const liveValue = (s) => player.live ? descriptor.live?.(s, player) ?? null : null;
|
|
10327
|
+
const liveChips = stats.some((s) => liveValue(s) !== null);
|
|
10298
10328
|
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "ss-w-props-panel", children: [
|
|
10299
|
-
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "ss-w-props-chips", children: stats.map((s) =>
|
|
10300
|
-
|
|
10301
|
-
|
|
10302
|
-
|
|
10303
|
-
|
|
10304
|
-
|
|
10305
|
-
|
|
10306
|
-
|
|
10307
|
-
|
|
10308
|
-
|
|
10309
|
-
|
|
10329
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: liveChips ? "ss-w-props-chips ss-w-props-chips--live" : "ss-w-props-chips", children: stats.map((s) => {
|
|
10330
|
+
const now = liveValue(s);
|
|
10331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
|
|
10332
|
+
"button",
|
|
10333
|
+
{
|
|
10334
|
+
type: "button",
|
|
10335
|
+
className: "ss-w-props-chip",
|
|
10336
|
+
"aria-pressed": s === active,
|
|
10337
|
+
"aria-label": now !== null ? [`${now} ${descriptor.statLabel(s.stat)}`, s.line != null ? ui.nba.propsLineChip(ui.nba.lineText(String(s.line))) : null].filter(Boolean).join(", ") : void 0,
|
|
10338
|
+
onClick: () => setPicked(s.stat),
|
|
10339
|
+
children: [
|
|
10340
|
+
now !== null && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("b", { children: now }),
|
|
10341
|
+
descriptor.statLabel(s.stat),
|
|
10342
|
+
now !== null && s.line != null && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("i", { children: ui.nba.propsLineChip(ui.nba.lineText(String(s.line))) })
|
|
10343
|
+
]
|
|
10344
|
+
},
|
|
10345
|
+
s.stat
|
|
10346
|
+
);
|
|
10347
|
+
}) }),
|
|
10310
10348
|
active && hasMainLine(active) && /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: descriptor.sport === "americanfootball" ? "ss-w-props-ou ss-w-props-ou--nfl" : "ss-w-props-ou", children: [
|
|
10311
10349
|
active.over && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(PriceCell, { hitsText: hitsOf(active.over, (h) => fillNfl(ui.nfl.hits, { h, n: sample })), children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(PropPrice, { price: active.over, label: ui.nba.over(ui.nba.lineText(String(active.over.line ?? active.line))), stat: active, ...priceProps }) }),
|
|
10312
10350
|
active.under && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(PriceCell, { hitsText: hitsOf(active.under, (h) => fillNfl(ui.nfl.hits, { h, n: sample })), children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(PropPrice, { price: active.under, label: ui.nba.under(ui.nba.lineText(String(active.under.line ?? active.line))), stat: active, ...priceProps }) })
|
|
@@ -10323,15 +10361,17 @@ function PropPlayerPanel({ player, bundle, descriptor, ui, slip }) {
|
|
|
10323
10361
|
}
|
|
10324
10362
|
) }, p.matchOddsId)) })
|
|
10325
10363
|
] }),
|
|
10326
|
-
active && bars.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(PropBars, { bars, line: active.line, title, wide: descriptor.tenGameBars, ui })
|
|
10364
|
+
active && bars.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(PropBars, { bars, line: active.line, title, wide: descriptor.tenGameBars, ui, note: player.live ? descriptor.liveNote?.(player, ui) : null })
|
|
10327
10365
|
] });
|
|
10328
10366
|
}
|
|
10329
10367
|
function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
10330
10368
|
const [openId, setOpenId] = (0, import_react59.useState)(null);
|
|
10331
|
-
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "ss-w-props-list", children: players.map((
|
|
10369
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "ss-w-props-list", children: players.map((given) => {
|
|
10370
|
+
const p = livePlayer(bundle, given);
|
|
10332
10371
|
const isOpen = openId === p.playerId;
|
|
10333
10372
|
const main = descriptor.mainStat(p);
|
|
10334
|
-
const
|
|
10373
|
+
const now = main && p.live ? descriptor.live?.(main, p) ?? null : null;
|
|
10374
|
+
const meta = [p.position, p.live ? ui.nba.propsMinutes(mmss(p.live.secondsPlayed)) : null, ui.nba.propsMarkets(p.stats.length)].filter(Boolean).join(" \xB7 ");
|
|
10335
10375
|
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "ss-w-props-item", children: [
|
|
10336
10376
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
|
|
10337
10377
|
"button",
|
|
@@ -10346,14 +10386,17 @@ function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
|
10346
10386
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ss-w-props-name", children: p.name }),
|
|
10347
10387
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ss-w-props-meta", children: meta })
|
|
10348
10388
|
] }),
|
|
10349
|
-
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ss-w-props-main", children: main?.line != null ? /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [
|
|
10389
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: now !== null ? "ss-w-props-main ss-w-props-main--live" : "ss-w-props-main", children: main?.line != null ? /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [
|
|
10350
10390
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ss-w-props-stat", children: descriptor.statShort(main.stat) }),
|
|
10351
|
-
/* @__PURE__ */ (0, import_jsx_runtime73.
|
|
10391
|
+
now !== null ? /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("span", { className: "ss-w-props-nowline", children: [
|
|
10392
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ss-w-props-now", children: now }),
|
|
10393
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ss-w-props-line", children: `\xB7 ${ui.nba.lineText(String(main.line))}` })
|
|
10394
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ss-w-props-line", children: ui.nba.lineText(String(main.line)) })
|
|
10352
10395
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ss-w-props-stat", children: ui.nba.propsLadderOnly }) })
|
|
10353
10396
|
]
|
|
10354
10397
|
}
|
|
10355
10398
|
),
|
|
10356
|
-
isOpen && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(PropPlayerPanel, { player:
|
|
10399
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(PropPlayerPanel, { player: given, bundle, descriptor, ui, slip })
|
|
10357
10400
|
] }, p.playerId);
|
|
10358
10401
|
}) });
|
|
10359
10402
|
}
|
|
@@ -10367,21 +10410,65 @@ var GAME_VALUE = {
|
|
|
10367
10410
|
assists: (g) => g.ast,
|
|
10368
10411
|
threes: (g) => g.fg3m
|
|
10369
10412
|
};
|
|
10370
|
-
var
|
|
10413
|
+
var LIVE_VALUE = {
|
|
10414
|
+
points: (l) => l.pts,
|
|
10415
|
+
rebounds: (l) => l.reb,
|
|
10416
|
+
assists: (l) => l.ast,
|
|
10417
|
+
threes: (l) => l.fg3m
|
|
10418
|
+
};
|
|
10419
|
+
var BOX_QUIET_MS = 12e4;
|
|
10420
|
+
var foulTrouble = (pf, period) => period != null && pf >= (period <= 2 ? 3 : 4);
|
|
10421
|
+
var nbaDescriptor = (ui, match) => ({
|
|
10371
10422
|
sport: "basketball",
|
|
10372
10423
|
stats: STAT_ORDER,
|
|
10373
10424
|
statLabel: ui.nba.stat,
|
|
10374
10425
|
statShort: ui.nba.propsStatShort,
|
|
10375
10426
|
mainStat: (p) => p.stats.find((s) => s.stat === "points" && hasMainLine(s)) ?? p.stats.find(hasMainLine),
|
|
10376
|
-
bars: (stat, player) =>
|
|
10377
|
-
|
|
10427
|
+
bars: (stat, player) => {
|
|
10428
|
+
const past = [...player.last5].reverse().map((g) => ({ label: g.opponent, value: (GAME_VALUE[stat.stat] ?? (() => 0))(g) }));
|
|
10429
|
+
const now = LIVE_VALUE[stat.stat];
|
|
10430
|
+
return player.live && now ? [...past, { label: ui.nba.propsLiveBar, value: now(player.live), live: true }] : past;
|
|
10431
|
+
},
|
|
10432
|
+
live: (stat, player) => {
|
|
10433
|
+
const now = LIVE_VALUE[stat.stat];
|
|
10434
|
+
return player.live && now ? now(player.live) : null;
|
|
10435
|
+
},
|
|
10436
|
+
liveNote: (player) => {
|
|
10437
|
+
const l = player.live;
|
|
10438
|
+
if (!l) return null;
|
|
10439
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("span", { className: "ss-w-props-l5-note", children: [
|
|
10440
|
+
ui.nba.propsShooting(l.fgm, l.fga),
|
|
10441
|
+
" \xB7 ",
|
|
10442
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: foulTrouble(l.pf, match.basketball?.period) ? "ss-w-props-pf--warn" : void 0, children: ui.nba.propsFouls(l.pf) })
|
|
10443
|
+
] });
|
|
10444
|
+
},
|
|
10445
|
+
barsTitle: (_n, hasLive) => hasLive ? ui.nba.propsLast5Live : ui.nba.propsLast5,
|
|
10378
10446
|
showHits: false,
|
|
10379
10447
|
rungLabel: (line, ui2) => `${ui2.nba.lineText(String(line))}+`,
|
|
10380
10448
|
tenGameBars: false
|
|
10381
10449
|
});
|
|
10450
|
+
function StatsClock({ bundle, match, ui }) {
|
|
10451
|
+
const [tick, setTick] = (0, import_react60.useState)(0);
|
|
10452
|
+
const at = bundle.live === true && bundle.boxAsOfUtc ? Date.parse(bundle.boxAsOfUtc) : Number.NaN;
|
|
10453
|
+
const time = clock2(bundle.boxAsOfUtc);
|
|
10454
|
+
const valid = !Number.isNaN(at) && time !== "";
|
|
10455
|
+
const onBreak = atBreak(match);
|
|
10456
|
+
(0, import_react60.useEffect)(() => {
|
|
10457
|
+
if (!valid || onBreak) return;
|
|
10458
|
+
const age2 = Date.now() - at;
|
|
10459
|
+
const wait = age2 < BOX_QUIET_MS ? BOX_QUIET_MS - age2 : 6e4 - age2 % 6e4;
|
|
10460
|
+
const id = setTimeout(() => setTick((t) => t + 1), wait);
|
|
10461
|
+
return () => clearTimeout(id);
|
|
10462
|
+
}, [valid, onBreak, at, tick]);
|
|
10463
|
+
if (!valid) return null;
|
|
10464
|
+
if (onBreak) return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "ss-w-props-asof", children: ui.nba.propsStatsAt(time) });
|
|
10465
|
+
const age = Date.now() - at;
|
|
10466
|
+
if (age >= BOX_QUIET_MS) return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "ss-w-props-asof", children: ui.nba.propsStatsAgo(time, Math.floor(age / 6e4)) });
|
|
10467
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "ss-w-props-asof ss-w-props-asof--live", children: ui.nba.propsStatsLive(time) });
|
|
10468
|
+
}
|
|
10382
10469
|
function NbaPropsSection({ match, monitor, ui, slip }) {
|
|
10383
10470
|
const [side, setSide] = (0, import_react60.useState)("home");
|
|
10384
|
-
const descriptor = nbaDescriptor(ui);
|
|
10471
|
+
const descriptor = nbaDescriptor(ui, match);
|
|
10385
10472
|
const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
|
|
10386
10473
|
if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
|
|
10387
10474
|
const bySide = (s) => bundle.players.filter((p) => p.side === s);
|
|
@@ -10392,7 +10479,10 @@ function NbaPropsSection({ match, monitor, ui, slip }) {
|
|
|
10392
10479
|
{ side: "away", abbreviation: bundle.awayAbbreviation }
|
|
10393
10480
|
];
|
|
10394
10481
|
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("section", { className: "ss-w-props", lang: ui.locale, children: [
|
|
10395
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.
|
|
10482
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "ss-w-props-headrow", children: [
|
|
10483
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "ss-w-props-head", children: ui.nba.propsTitle }),
|
|
10484
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(StatsClock, { bundle, match, ui })
|
|
10485
|
+
] }),
|
|
10396
10486
|
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "ss-w-props-seg", children: sides.map((s) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("button", { type: "button", className: "ss-w-props-side", "aria-pressed": shown2 === s.side, onClick: () => setSide(s.side), children: `${s.abbreviation} \xB7 ${bySide(s.side).length}` }, s.side)) }),
|
|
10397
10487
|
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(PropRoster, { bundle, players: bySide(shown2), side: shown2, descriptor, ui, slip }, shown2)
|
|
10398
10488
|
] });
|
|
@@ -17956,6 +18046,25 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
17956
18046
|
.ss-w-props-ref { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed var(--ss-w-ink); }
|
|
17957
18047
|
.ss-w-props-ref-lab { position: absolute; right: 0; top: -7px; width: 28px; text-align: right; line-height: 13px; border-radius: 3px; background: var(--ss-w-bubble); font-size: 9.5px; font-weight: 600; color: var(--ss-w-faint); font-variant-numeric: tabular-nums; }
|
|
17958
18048
|
.ss-w-props-opps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding-right: 32px; text-align: center; font-size: 10px; color: var(--ss-w-faint); }
|
|
18049
|
+
/* Live stats on NBA props (u620): box clock, stat chips with a value, a hatched live bar. */
|
|
18050
|
+
.ss-w-props-headrow { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
|
|
18051
|
+
.ss-w-props-asof { font-size: 10.5px; font-weight: 600; color: var(--ss-w-faint); font-variant-numeric: tabular-nums; text-align: right; }
|
|
18052
|
+
.ss-w-props-asof--live, .ss-w-props-pf--warn { color: var(--ss-w-warn); }
|
|
18053
|
+
.ss-w-props-main--live { flex-direction: column; align-items: flex-end; flex-wrap: nowrap; gap: 2px; max-width: none; }
|
|
18054
|
+
.ss-w-props-nowline { display: flex; align-items: baseline; gap: 4px; }
|
|
18055
|
+
.ss-w-props-now { font-size: 12.5px; font-weight: 800; color: var(--ss-w-ink); }
|
|
18056
|
+
.ss-w-props-main--live .ss-w-props-line { font-weight: 600; color: var(--ss-w-faint); }
|
|
18057
|
+
.ss-w-props-chips--live { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
|
|
18058
|
+
.ss-w-props-chips--live .ss-w-props-chip { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 44px; padding: 6px 4px; border-radius: 10px; font-size: 11px; white-space: normal; text-align: center; }
|
|
18059
|
+
.ss-w-props-chips--live .ss-w-props-chip b { font-size: 15px; font-weight: 800; color: var(--ss-w-ink); font-variant-numeric: tabular-nums; }
|
|
18060
|
+
.ss-w-props-chips--live .ss-w-props-chip i { font-style: normal; font-size: 10px; font-weight: 500; color: var(--ss-w-faint); font-variant-numeric: tabular-nums; }
|
|
18061
|
+
.ss-w-props-chips--live .ss-w-props-chip[aria-pressed="true"] b, .ss-w-props-chips--live .ss-w-props-chip[aria-pressed="true"] i { color: #fff; }
|
|
18062
|
+
.ss-w-props-l5-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; column-gap: 8px; row-gap: 2px; min-width: 0; }
|
|
18063
|
+
.ss-w-props-l5-note { font-size: 11px; color: var(--ss-w-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|
18064
|
+
.ss-w-props-bars--live { grid-template-columns: repeat(var(--ss-bars, 6), minmax(0, 1fr)); gap: 5px; }
|
|
18065
|
+
.ss-w-props-opps--live { grid-template-columns: repeat(var(--ss-bars, 6), minmax(0, 1fr)); gap: 5px; }
|
|
18066
|
+
.ss-w-props-opps b { font-weight: 700; color: var(--ss-w-ink); }
|
|
18067
|
+
.ss-w-props-bar--live { background: repeating-linear-gradient(135deg, var(--ss-w-ink) 0 3px, var(--ss-w-faint) 3px 6px); }
|
|
17959
18068
|
/* NFL props (u605): three tabs, ten-game bars coloured by the line, and the fact and scorer grids. */
|
|
17960
18069
|
.ss-w-props-trends { margin-bottom: 8px; }
|
|
17961
18070
|
.ss-w-props-seg--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|