@sensiblestats/widget-react 0.128.0 → 0.129.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 +12 -0
- package/dist/index.cjs +291 -184
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +291 -184
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -897,19 +897,69 @@ var formatTime = (when, tag2, clock3, opts) => formatDate(when, tag2, { ...clock
|
|
|
897
897
|
var clockOf = (ui) => ui.clock ?? "24h";
|
|
898
898
|
var formatFixed = (n, tag2, digits) => formatNumber(n, tag2, { minimumFractionDigits: digits, maximumFractionDigits: digits });
|
|
899
899
|
|
|
900
|
+
// src/zone.ts
|
|
901
|
+
var DAY_MS = 864e5;
|
|
902
|
+
var formatters = /* @__PURE__ */ new Map();
|
|
903
|
+
var formatterFor = (timeZone) => {
|
|
904
|
+
let f = formatters.get(timeZone);
|
|
905
|
+
if (!f) {
|
|
906
|
+
f = new Intl.DateTimeFormat(BUNDLED_TAG, {
|
|
907
|
+
timeZone,
|
|
908
|
+
year: "numeric",
|
|
909
|
+
month: "2-digit",
|
|
910
|
+
day: "2-digit",
|
|
911
|
+
hour: "2-digit",
|
|
912
|
+
minute: "2-digit",
|
|
913
|
+
second: "2-digit",
|
|
914
|
+
hourCycle: "h23"
|
|
915
|
+
});
|
|
916
|
+
formatters.set(timeZone, f);
|
|
917
|
+
}
|
|
918
|
+
return f;
|
|
919
|
+
};
|
|
920
|
+
function validZone(timeZone) {
|
|
921
|
+
if (typeof timeZone !== "string" || timeZone.trim() === "") return void 0;
|
|
922
|
+
const zone = timeZone.trim();
|
|
923
|
+
try {
|
|
924
|
+
new Intl.DateTimeFormat("en", { timeZone: zone });
|
|
925
|
+
return zone;
|
|
926
|
+
} catch {
|
|
927
|
+
return void 0;
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
function zonedParts(ms, timeZone) {
|
|
931
|
+
const out = { year: NaN, month: NaN, day: NaN, hour: NaN, minute: NaN, second: NaN };
|
|
932
|
+
if (Number.isNaN(ms)) return out;
|
|
933
|
+
if (timeZone === void 0) {
|
|
934
|
+
const d = new Date(ms);
|
|
935
|
+
return { year: d.getFullYear(), month: d.getMonth() + 1, day: d.getDate(), hour: d.getHours(), minute: d.getMinutes(), second: d.getSeconds() };
|
|
936
|
+
}
|
|
937
|
+
for (const p of formatterFor(timeZone).formatToParts(ms)) {
|
|
938
|
+
if (p.type in out) out[p.type] = Number(p.value);
|
|
939
|
+
}
|
|
940
|
+
return out;
|
|
941
|
+
}
|
|
942
|
+
function zonedDayNumber(ms, timeZone) {
|
|
943
|
+
const p = zonedParts(ms, timeZone);
|
|
944
|
+
return Date.UTC(p.year, p.month - 1, p.day) / DAY_MS;
|
|
945
|
+
}
|
|
946
|
+
function zoneOffsetMinutes(ms, timeZone) {
|
|
947
|
+
const p = zonedParts(ms, timeZone);
|
|
948
|
+
const wall = Date.UTC(p.year, p.month - 1, p.day, p.hour, p.minute, p.second);
|
|
949
|
+
return Math.round((wall - Math.floor(ms / 1e3) * 1e3) / 6e4);
|
|
950
|
+
}
|
|
951
|
+
|
|
900
952
|
// src/kickoff.ts
|
|
901
|
-
function formatBettingKickoff(kickoffUtc, ui, tag2, clock3 = "24h", now = /* @__PURE__ */ new Date()) {
|
|
953
|
+
function formatBettingKickoff(kickoffUtc, ui, tag2, clock3 = "24h", now = /* @__PURE__ */ new Date(), timeZone) {
|
|
902
954
|
const at2 = new Date(kickoffUtc);
|
|
903
|
-
const time = formatTime(at2, tag2, clock3);
|
|
904
|
-
const
|
|
905
|
-
const
|
|
906
|
-
const dayDiff = Math.round((atLocalDate.getTime() - nowLocalDate.getTime()) / 864e5);
|
|
907
|
-
const dayLabel = dayDiff === 0 ? ui.today : dayDiff === 1 ? ui.tomorrow : formatDate(at2, tag2, { weekday: "short", day: "numeric", month: "short" });
|
|
955
|
+
const time = formatTime(at2, tag2, clock3, { timeZone });
|
|
956
|
+
const dayDiff = zonedDayNumber(at2.getTime(), timeZone) - zonedDayNumber(now.getTime(), timeZone);
|
|
957
|
+
const dayLabel = dayDiff === 0 ? ui.today : dayDiff === 1 ? ui.tomorrow : formatDate(at2, tag2, { weekday: "short", day: "numeric", month: "short", timeZone });
|
|
908
958
|
return { dayLabel, time };
|
|
909
959
|
}
|
|
910
960
|
|
|
911
961
|
// src/nbaFormDay.ts
|
|
912
|
-
var
|
|
962
|
+
var DAY_MS2 = 864e5;
|
|
913
963
|
var ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
914
964
|
function utcMs(etDate) {
|
|
915
965
|
if (!ISO_DATE.test(etDate)) return null;
|
|
@@ -921,7 +971,7 @@ function formDay(etDate, anchorEtDate, tag2) {
|
|
|
921
971
|
const at2 = utcMs(etDate);
|
|
922
972
|
if (at2 === null) return etDate;
|
|
923
973
|
const anchor = utcMs(anchorEtDate);
|
|
924
|
-
const days = anchor === null ? Infinity : Math.abs(Math.round((at2 - anchor) /
|
|
974
|
+
const days = anchor === null ? Infinity : Math.abs(Math.round((at2 - anchor) / DAY_MS2));
|
|
925
975
|
const options = days <= 6 ? { weekday: "short", timeZone: "UTC" } : { day: "numeric", month: "short", timeZone: "UTC" };
|
|
926
976
|
return formatDate(at2, tag2, options);
|
|
927
977
|
}
|
|
@@ -977,13 +1027,13 @@ var shortDate = (tag2, ms, opts) => nbsp(formatDate(ms, tag2, opts).replace("Sep
|
|
|
977
1027
|
var signed = (line) => line.replace(/^-/, "\u2212");
|
|
978
1028
|
var decimalMark = (tag2) => new Intl.NumberFormat(tag2).formatToParts(1.1).find((p) => p.type === "decimal")?.value ?? ".";
|
|
979
1029
|
var INTL_LEAVES = {
|
|
980
|
-
chartTimeLabel: (c) => (ms) => formatDate(ms, c.tag, { day: "numeric", month: "short", ...clockFields(c.clock) }),
|
|
981
|
-
logShortDate: (c) => (ms) => shortDate(c.tag, ms, { day: "numeric", month: "short" }),
|
|
1030
|
+
chartTimeLabel: (c) => (ms) => formatDate(ms, c.tag, { day: "numeric", month: "short", ...clockFields(c.clock), timeZone: c.timeZone }),
|
|
1031
|
+
logShortDate: (c) => (ms) => shortDate(c.tag, ms, { day: "numeric", month: "short", timeZone: c.timeZone }),
|
|
982
1032
|
"games.formatPts": (c) => (n) => formatNumber(n, c.tag),
|
|
983
|
-
"games.formatDayTime": (c) => (iso) => formatDate(iso, c.tag, { weekday: "short", ...clockFields(c.clock) }),
|
|
1033
|
+
"games.formatDayTime": (c) => (iso) => formatDate(iso, c.tag, { weekday: "short", ...clockFields(c.clock), timeZone: c.timeZone }),
|
|
984
1034
|
"nba.lineText": (c) => (line) => signed(line).replace(".", decimalMark(c.tag)),
|
|
985
1035
|
"nba.formDay": (c) => (etDate, anchorEtDate) => formDay(etDate, anchorEtDate, c.tag),
|
|
986
|
-
bettingKickoff: (c) => (kickoffUtc, now) => formatBettingKickoff(kickoffUtc, { today: c.t("widget.today"), tomorrow: c.t("widget.tomorrow") }, c.tag, c.clock, now),
|
|
1036
|
+
bettingKickoff: (c) => (kickoffUtc, now) => formatBettingKickoff(kickoffUtc, { today: c.t("widget.today"), tomorrow: c.t("widget.tomorrow") }, c.tag, c.clock, now, c.timeZone),
|
|
987
1037
|
v8FormResult: (c) => (result) => codeLabel(c.table, "result", result) ?? result
|
|
988
1038
|
};
|
|
989
1039
|
var pairs = (c, key, list) => list.map(([home, away]) => c.t(key, { home, away })).join(", ");
|
|
@@ -1016,7 +1066,7 @@ var ROW_LEAVES = {
|
|
|
1016
1066
|
availabilityNext: (c) => (opponent, isHome, ms) => {
|
|
1017
1067
|
const line = c.t(isHome ? "widget.availabilityNext.home" : "widget.availabilityNext.away", { opponent });
|
|
1018
1068
|
if (ms === null || !(ms > 0)) return line;
|
|
1019
|
-
return c.t("widget.availabilityNext.dated", { text: line, date: shortDate(c.tag, ms, { weekday: "short", day: "numeric", month: "short" }) });
|
|
1069
|
+
return c.t("widget.availabilityNext.dated", { text: line, date: shortDate(c.tag, ms, { weekday: "short", day: "numeric", month: "short", timeZone: c.timeZone }) });
|
|
1020
1070
|
},
|
|
1021
1071
|
availabilityBack: (c) => (ms) => c.t("widget.availabilityBack", { date: shortDate(c.tag, ms, { day: "numeric", month: "short" }) }),
|
|
1022
1072
|
perfRankedAgainst: (c) => (competition, group) => c.t("widget.perfRankedAgainst", { competition, group: codeLabel(c.table, "groupNoun", group) ?? group }),
|
|
@@ -1187,7 +1237,7 @@ function setPath(root, path, value) {
|
|
|
1187
1237
|
node[parts2[parts2.length - 1]] = value;
|
|
1188
1238
|
}
|
|
1189
1239
|
var ownedByLeaf = (key) => key.startsWith("widget.code.") || Object.keys(LEAVES).some((path) => key === `widget.${path}` || key.startsWith(`widget.${path}.`));
|
|
1190
|
-
function buildLocaleStrings(table, tag2, clock3 = "24h") {
|
|
1240
|
+
function buildLocaleStrings(table, tag2, clock3 = "24h", timeZone) {
|
|
1191
1241
|
const root = {};
|
|
1192
1242
|
for (const [key, row] of Object.entries(table)) {
|
|
1193
1243
|
if (key.startsWith("widget.") && typeof row === "string" && !ownedByLeaf(key)) setPath(root, key.slice("widget.".length), row);
|
|
@@ -1195,6 +1245,7 @@ function buildLocaleStrings(table, tag2, clock3 = "24h") {
|
|
|
1195
1245
|
const ctx = {
|
|
1196
1246
|
tag: tag2,
|
|
1197
1247
|
clock: clock3,
|
|
1248
|
+
timeZone,
|
|
1198
1249
|
table,
|
|
1199
1250
|
t: (key, tokens = {}) => fill(table[key] ?? key, tokens, tag2)
|
|
1200
1251
|
};
|
|
@@ -1219,7 +1270,7 @@ function parseOddsFormat(value) {
|
|
|
1219
1270
|
}
|
|
1220
1271
|
|
|
1221
1272
|
// src/version.generated.ts
|
|
1222
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1273
|
+
var WIDGET_REACT_VERSION = "0.129.0";
|
|
1223
1274
|
|
|
1224
1275
|
// src/config.ts
|
|
1225
1276
|
function hostTag(cfg) {
|
|
@@ -1228,7 +1279,8 @@ function hostTag(cfg) {
|
|
|
1228
1279
|
}
|
|
1229
1280
|
var isBundledFamily = (tag2) => sameFamily(tag2, BUNDLED_TAG);
|
|
1230
1281
|
function normalizeUi(cfg, loaded) {
|
|
1231
|
-
const
|
|
1282
|
+
const timeZone = validZone(cfg.timeZone);
|
|
1283
|
+
const strings = buildLocaleStrings(loaded.strings, loaded.tag, loaded.clock, timeZone);
|
|
1232
1284
|
return {
|
|
1233
1285
|
theme: cfg.theme ?? "auto",
|
|
1234
1286
|
oddsFormat: parseOddsFormat(cfg.oddsFormat) ?? "decimal",
|
|
@@ -1237,6 +1289,7 @@ function normalizeUi(cfg, loaded) {
|
|
|
1237
1289
|
headerTitle: cfg.headerTitle,
|
|
1238
1290
|
locale: loaded.tag,
|
|
1239
1291
|
clock: loaded.clock,
|
|
1292
|
+
timeZone,
|
|
1240
1293
|
hostTag: hostTag(cfg),
|
|
1241
1294
|
rawBettingLabels: isBundledFamily(loaded.tag),
|
|
1242
1295
|
cta: cfg.cta,
|
|
@@ -1742,9 +1795,9 @@ function projectSeries(samples) {
|
|
|
1742
1795
|
yMin = pMin - FLAT_DOMAIN_PAD;
|
|
1743
1796
|
yMax = pMax + FLAT_DOMAIN_PAD;
|
|
1744
1797
|
} else {
|
|
1745
|
-
const
|
|
1746
|
-
yMin = pMin -
|
|
1747
|
-
yMax = pMax +
|
|
1798
|
+
const pad = (pMax - pMin) * 0.1;
|
|
1799
|
+
yMin = pMin - pad;
|
|
1800
|
+
yMax = pMax + pad;
|
|
1748
1801
|
}
|
|
1749
1802
|
const x = (atMs) => round2(PLOT_X0 + (atMs - tMin) / (tMax - tMin) * (PLOT_X1 - PLOT_X0));
|
|
1750
1803
|
const y = (price) => round2(PLOT_Y1 - (price - yMin) / (yMax - yMin) * (PLOT_Y1 - PLOT_Y0));
|
|
@@ -3507,12 +3560,12 @@ import { matchKey as matchKey3 } from "@sensiblestats/widget-sdk";
|
|
|
3507
3560
|
var PREFIX2 = "ss-w-schedule:";
|
|
3508
3561
|
var SCHEMA_VERSION = 7;
|
|
3509
3562
|
var TTL_MS3 = 6 * 36e5;
|
|
3510
|
-
function scheduleCacheKey(operatorId, encodedUserKey2, localDate) {
|
|
3511
|
-
return `${PREFIX2}${operatorId}:${encodedUserKey2}:${localDate}`;
|
|
3563
|
+
function scheduleCacheKey(operatorId, encodedUserKey2, localDate, timeZone) {
|
|
3564
|
+
return `${PREFIX2}${operatorId}:${encodedUserKey2}:${timeZone ?? "local"}:${localDate}`;
|
|
3512
3565
|
}
|
|
3513
|
-
function read(operatorId, encodedUserKey2, localDate) {
|
|
3566
|
+
function read(operatorId, encodedUserKey2, localDate, timeZone) {
|
|
3514
3567
|
try {
|
|
3515
|
-
const raw = localStorage.getItem(scheduleCacheKey(operatorId, encodedUserKey2, localDate));
|
|
3568
|
+
const raw = localStorage.getItem(scheduleCacheKey(operatorId, encodedUserKey2, localDate, timeZone));
|
|
3516
3569
|
if (!raw) return null;
|
|
3517
3570
|
const entry = JSON.parse(raw);
|
|
3518
3571
|
if (entry.v !== SCHEMA_VERSION || !entry.payload) return null;
|
|
@@ -3521,13 +3574,13 @@ function read(operatorId, encodedUserKey2, localDate) {
|
|
|
3521
3574
|
return null;
|
|
3522
3575
|
}
|
|
3523
3576
|
}
|
|
3524
|
-
function readSchedule(operatorId, encodedUserKey2, localDate, nowMs) {
|
|
3525
|
-
const entry = read(operatorId, encodedUserKey2, localDate);
|
|
3577
|
+
function readSchedule(operatorId, encodedUserKey2, localDate, nowMs, timeZone) {
|
|
3578
|
+
const entry = read(operatorId, encodedUserKey2, localDate, timeZone);
|
|
3526
3579
|
if (!entry) return null;
|
|
3527
3580
|
return nowMs - entry.at > TTL_MS3 ? null : entry.payload;
|
|
3528
3581
|
}
|
|
3529
|
-
function readScheduleIgnoringTtl(operatorId, encodedUserKey2, localDate) {
|
|
3530
|
-
return read(operatorId, encodedUserKey2, localDate)?.payload ?? null;
|
|
3582
|
+
function readScheduleIgnoringTtl(operatorId, encodedUserKey2, localDate, timeZone) {
|
|
3583
|
+
return read(operatorId, encodedUserKey2, localDate, timeZone)?.payload ?? null;
|
|
3531
3584
|
}
|
|
3532
3585
|
function skeletonOnly(payload) {
|
|
3533
3586
|
return {
|
|
@@ -3566,8 +3619,8 @@ function skeletonOnly(payload) {
|
|
|
3566
3619
|
}))
|
|
3567
3620
|
};
|
|
3568
3621
|
}
|
|
3569
|
-
function writeSchedule(operatorId, encodedUserKey2, localDate, payload, nowMs) {
|
|
3570
|
-
const keep = scheduleCacheKey(operatorId, encodedUserKey2, localDate);
|
|
3622
|
+
function writeSchedule(operatorId, encodedUserKey2, localDate, payload, nowMs, timeZone) {
|
|
3623
|
+
const keep = scheduleCacheKey(operatorId, encodedUserKey2, localDate, timeZone);
|
|
3571
3624
|
const mine = `${PREFIX2}${operatorId}:${encodedUserKey2}:`;
|
|
3572
3625
|
try {
|
|
3573
3626
|
for (let i = localStorage.length - 1; i >= 0; i--) {
|
|
@@ -3579,9 +3632,9 @@ function writeSchedule(operatorId, encodedUserKey2, localDate, payload, nowMs) {
|
|
|
3579
3632
|
} catch {
|
|
3580
3633
|
}
|
|
3581
3634
|
}
|
|
3582
|
-
function clearSchedule(operatorId, encodedUserKey2, localDate) {
|
|
3635
|
+
function clearSchedule(operatorId, encodedUserKey2, localDate, timeZone) {
|
|
3583
3636
|
try {
|
|
3584
|
-
localStorage.removeItem(scheduleCacheKey(operatorId, encodedUserKey2, localDate));
|
|
3637
|
+
localStorage.removeItem(scheduleCacheKey(operatorId, encodedUserKey2, localDate, timeZone));
|
|
3585
3638
|
} catch {
|
|
3586
3639
|
}
|
|
3587
3640
|
}
|
|
@@ -3623,6 +3676,51 @@ function nearestTennisKeys(open) {
|
|
|
3623
3676
|
return [...open.values()].sort((a, b) => a.kickoffUnix - b.kickoffUnix).slice(0, MAX_TENNIS_KEYS).map((e) => e.key);
|
|
3624
3677
|
}
|
|
3625
3678
|
|
|
3679
|
+
// src/scheduleDays.ts
|
|
3680
|
+
var MAX_AFTER_TODAY = 6;
|
|
3681
|
+
var parts = (date) => {
|
|
3682
|
+
const [y = 0, m = 1, d = 1] = date.split("-").map(Number);
|
|
3683
|
+
return [y, m, d];
|
|
3684
|
+
};
|
|
3685
|
+
function offsetOf(localDate, timeZone) {
|
|
3686
|
+
const [y, m, d] = parts(localDate);
|
|
3687
|
+
if (timeZone === void 0) return -new Date(y, m - 1, d, 12).getTimezoneOffset();
|
|
3688
|
+
const utcNoon = Date.UTC(y, m - 1, d, 12);
|
|
3689
|
+
return zoneOffsetMinutes(utcNoon - zoneOffsetMinutes(utcNoon, timeZone) * 6e4, timeZone);
|
|
3690
|
+
}
|
|
3691
|
+
function localDateOfUnix(unix, offsetMinutes = -new Date(unix * 1e3).getTimezoneOffset()) {
|
|
3692
|
+
return new Date((unix + offsetMinutes * 60) * 1e3).toISOString().slice(0, 10);
|
|
3693
|
+
}
|
|
3694
|
+
var dayAfter = (date) => {
|
|
3695
|
+
const [y, m, d] = parts(date);
|
|
3696
|
+
return new Date(Date.UTC(y, m - 1, d + 1)).toISOString().slice(0, 10);
|
|
3697
|
+
};
|
|
3698
|
+
function buildDayChips(today, matchDays, sport) {
|
|
3699
|
+
const dates = /* @__PURE__ */ new Set();
|
|
3700
|
+
for (const md of matchDays) {
|
|
3701
|
+
if (sport !== "all" && md.sport !== sport) continue;
|
|
3702
|
+
for (const date of md.dates) if (date > today) dates.add(date);
|
|
3703
|
+
}
|
|
3704
|
+
const chips = [{ date: today, isToday: true, gapBefore: false }];
|
|
3705
|
+
for (const date of [...dates].sort().slice(0, MAX_AFTER_TODAY)) {
|
|
3706
|
+
const prev = chips[chips.length - 1];
|
|
3707
|
+
chips.push({ date, isToday: false, gapBefore: prev !== void 0 && dayAfter(prev.date) !== date });
|
|
3708
|
+
}
|
|
3709
|
+
return chips;
|
|
3710
|
+
}
|
|
3711
|
+
function weekdayAndDay(date, tag2) {
|
|
3712
|
+
const [y, m, d] = parts(date);
|
|
3713
|
+
const at2 = new Date(Date.UTC(y, m - 1, d, 12));
|
|
3714
|
+
return {
|
|
3715
|
+
weekday: formatDate(at2, tag2, { weekday: "short", timeZone: "UTC" }),
|
|
3716
|
+
day: formatDate(at2, tag2, { day: "numeric", timeZone: "UTC" })
|
|
3717
|
+
};
|
|
3718
|
+
}
|
|
3719
|
+
function weekdayLong(date, tag2) {
|
|
3720
|
+
const [y, m, d] = parts(date);
|
|
3721
|
+
return formatDate(new Date(Date.UTC(y, m - 1, d, 12)), tag2, { weekday: "long", timeZone: "UTC" });
|
|
3722
|
+
}
|
|
3723
|
+
|
|
3626
3724
|
// src/liveClock.ts
|
|
3627
3725
|
import { matchKey as matchKey2 } from "@sensiblestats/widget-sdk";
|
|
3628
3726
|
function isTreatedLive(state, pollStale) {
|
|
@@ -3642,7 +3740,11 @@ var STALE_AFTER_FAILURES = 2;
|
|
|
3642
3740
|
function encodedUserKey(operatorUserId, anonymousUserId) {
|
|
3643
3741
|
return encodeURIComponent(operatorUserId || anonymousUserId || "none");
|
|
3644
3742
|
}
|
|
3645
|
-
function localDateOf(now) {
|
|
3743
|
+
function localDateOf(now, timeZone) {
|
|
3744
|
+
if (timeZone !== void 0) {
|
|
3745
|
+
const p = zonedParts(now.getTime(), timeZone);
|
|
3746
|
+
return `${p.year}-${`${p.month}`.padStart(2, "0")}-${`${p.day}`.padStart(2, "0")}`;
|
|
3747
|
+
}
|
|
3646
3748
|
const y = now.getFullYear();
|
|
3647
3749
|
const m = `${now.getMonth() + 1}`.padStart(2, "0");
|
|
3648
3750
|
const d = `${now.getDate()}`.padStart(2, "0");
|
|
@@ -3668,19 +3770,19 @@ function useMatchDiscovery(opts) {
|
|
|
3668
3770
|
statesRef.current = states;
|
|
3669
3771
|
const getStatesRef = useRef4(opts.getStates);
|
|
3670
3772
|
getStatesRef.current = opts.getStates;
|
|
3671
|
-
const [localDate, setLocalDate] = useState4(() => localDateOf(/* @__PURE__ */ new Date()));
|
|
3773
|
+
const [localDate, setLocalDate] = useState4(() => localDateOf(/* @__PURE__ */ new Date(), opts.timeZone));
|
|
3672
3774
|
useEffect5(() => {
|
|
3673
3775
|
const id = setInterval(() => {
|
|
3674
|
-
const next = localDateOf(/* @__PURE__ */ new Date());
|
|
3776
|
+
const next = localDateOf(/* @__PURE__ */ new Date(), opts.timeZone);
|
|
3675
3777
|
setLocalDate((prev) => prev === next ? prev : next);
|
|
3676
3778
|
}, ROLLOVER_CHECK_MS);
|
|
3677
3779
|
return () => clearInterval(id);
|
|
3678
|
-
}, []);
|
|
3780
|
+
}, [opts.timeZone]);
|
|
3679
3781
|
useEffect5(() => {
|
|
3680
3782
|
let cancelled = false;
|
|
3681
|
-
const utcOffsetMinutes = -(/* @__PURE__ */ new Date()).getTimezoneOffset();
|
|
3783
|
+
const utcOffsetMinutes = opts.timeZone === void 0 ? -(/* @__PURE__ */ new Date()).getTimezoneOffset() : offsetOf(localDate, opts.timeZone);
|
|
3682
3784
|
const key = encodedUserKey(opts.operatorUserId, opts.anonymousUserId);
|
|
3683
|
-
const cached = readSchedule(opts.operatorId, key, localDate, Date.now());
|
|
3785
|
+
const cached = readSchedule(opts.operatorId, key, localDate, Date.now(), opts.timeZone);
|
|
3684
3786
|
if (cached) {
|
|
3685
3787
|
if (!cancelled) {
|
|
3686
3788
|
setGroups(cached.groups);
|
|
@@ -3700,12 +3802,12 @@ function useMatchDiscovery(opts) {
|
|
|
3700
3802
|
setScheduleLoaded(true);
|
|
3701
3803
|
return;
|
|
3702
3804
|
}
|
|
3703
|
-
writeSchedule(opts.operatorId, key, localDate, payload, Date.now());
|
|
3805
|
+
writeSchedule(opts.operatorId, key, localDate, payload, Date.now(), opts.timeZone);
|
|
3704
3806
|
setGroups(payload.groups);
|
|
3705
3807
|
setMatchDays(payload.matchDays ?? []);
|
|
3706
3808
|
setScheduleLoaded(true);
|
|
3707
3809
|
} catch {
|
|
3708
|
-
const fallback = readScheduleIgnoringTtl(opts.operatorId, key, localDate);
|
|
3810
|
+
const fallback = readScheduleIgnoringTtl(opts.operatorId, key, localDate, opts.timeZone);
|
|
3709
3811
|
if (!cancelled && fallback) {
|
|
3710
3812
|
setGroups(fallback.groups);
|
|
3711
3813
|
setMatchDays(fallback.matchDays ?? []);
|
|
@@ -3716,7 +3818,7 @@ function useMatchDiscovery(opts) {
|
|
|
3716
3818
|
return () => {
|
|
3717
3819
|
cancelled = true;
|
|
3718
3820
|
};
|
|
3719
|
-
}, [opts.operatorId, opts.operatorUserId, opts.anonymousUserId, localDate, refreshKey]);
|
|
3821
|
+
}, [opts.operatorId, opts.operatorUserId, opts.anonymousUserId, localDate, refreshKey, opts.timeZone]);
|
|
3720
3822
|
const tick = useCallback2(async () => {
|
|
3721
3823
|
const ids = dueMatchIds(groupsRef.current, statesRef.current, Date.now());
|
|
3722
3824
|
if (ids.football.length === 0 && ids.nba.length === 0 && ids.nfl.length === 0 && ids.tennis.length === 0) return;
|
|
@@ -3751,10 +3853,10 @@ function useMatchDiscovery(opts) {
|
|
|
3751
3853
|
return n;
|
|
3752
3854
|
}, [groups, states, stale]);
|
|
3753
3855
|
const refreshSchedule = useCallback2(async () => {
|
|
3754
|
-
clearSchedule(opts.operatorId, encodedUserKey(opts.operatorUserId, opts.anonymousUserId), localDate);
|
|
3856
|
+
clearSchedule(opts.operatorId, encodedUserKey(opts.operatorUserId, opts.anonymousUserId), localDate, opts.timeZone);
|
|
3755
3857
|
setRefreshKey((n) => n + 1);
|
|
3756
3858
|
setScheduleVersion((n) => n + 1);
|
|
3757
|
-
}, [opts.operatorId, opts.operatorUserId, opts.anonymousUserId, localDate]);
|
|
3859
|
+
}, [opts.operatorId, opts.operatorUserId, opts.anonymousUserId, localDate, opts.timeZone]);
|
|
3758
3860
|
return { groups, localDate, matchDays, scheduleLoaded, states, liveCount, stale, refreshSchedule, scheduleVersion, _tick: tick };
|
|
3759
3861
|
}
|
|
3760
3862
|
|
|
@@ -6289,8 +6391,8 @@ function OddsRow({ vm, row, ui, slip, inSlipIds, history, suppressSlip }) {
|
|
|
6289
6391
|
] });
|
|
6290
6392
|
}
|
|
6291
6393
|
var STALE_AFTER_MS = 12e4;
|
|
6292
|
-
function fmtHhMm(iso, tag2, clock3) {
|
|
6293
|
-
return formatTime(iso, tag2, clock3);
|
|
6394
|
+
function fmtHhMm(iso, tag2, clock3, timeZone) {
|
|
6395
|
+
return formatTime(iso, tag2, clock3, { timeZone });
|
|
6294
6396
|
}
|
|
6295
6397
|
function MarketOddsCard({ vm, ui, slip, monitor, inSlipIds, hideHeader, pinRef }) {
|
|
6296
6398
|
const [open, setOpen] = useState24(false);
|
|
@@ -6303,7 +6405,7 @@ function MarketOddsCard({ vm, ui, slip, monitor, inSlipIds, hideHeader, pinRef }
|
|
|
6303
6405
|
const isClosed = closedReason !== null;
|
|
6304
6406
|
const asOfMs = live ? new Date(live.asOfUtc).getTime() : NaN;
|
|
6305
6407
|
const isStale = live != null && !isClosed && (vm.awaitingLiveUpdate === true || Date.now() - asOfMs > STALE_AFTER_MS);
|
|
6306
|
-
const staleTime = isStale && live ? fmtHhMm(live.asOfUtc, ui.locale, clockOf(ui)) : null;
|
|
6408
|
+
const staleTime = isStale && live ? fmtHhMm(live.asOfUtc, ui.locale, clockOf(ui), ui.timeZone) : null;
|
|
6307
6409
|
const [, setStaleTick] = useState24(0);
|
|
6308
6410
|
const watchStale = live != null && !isClosed && !isStale;
|
|
6309
6411
|
useEffect19(() => {
|
|
@@ -6429,9 +6531,9 @@ function allowedForStars(stars, leg) {
|
|
|
6429
6531
|
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
6430
6532
|
var asOf = (iso, ui) => {
|
|
6431
6533
|
const at2 = new Date(iso);
|
|
6432
|
-
const time = fmtHhMm(iso, ui.locale, clockOf(ui));
|
|
6433
|
-
if (at2.
|
|
6434
|
-
return `${formatDate(at2, ui.locale, { day: "numeric", month: "short" })} ${time}`;
|
|
6534
|
+
const time = fmtHhMm(iso, ui.locale, clockOf(ui), ui.timeZone);
|
|
6535
|
+
if (zonedDayNumber(at2.getTime(), ui.timeZone) === zonedDayNumber(Date.now(), ui.timeZone)) return time;
|
|
6536
|
+
return `${formatDate(at2, ui.locale, { day: "numeric", month: "short", timeZone: ui.timeZone })} ${time}`;
|
|
6435
6537
|
};
|
|
6436
6538
|
function CardLine({ card, ui, slip, sport, marketKey, conversation, operatorUserId, anonymousUserId }) {
|
|
6437
6539
|
const matchId = card.matchId;
|
|
@@ -6653,9 +6755,8 @@ function instantMs(iso) {
|
|
|
6653
6755
|
const ms = Date.parse(iso);
|
|
6654
6756
|
return Number.isNaN(ms) ? null : ms;
|
|
6655
6757
|
}
|
|
6656
|
-
function localDayStart(ms) {
|
|
6657
|
-
|
|
6658
|
-
return new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime();
|
|
6758
|
+
function localDayStart(ms, timeZone) {
|
|
6759
|
+
return zonedDayNumber(ms, timeZone) * 864e5;
|
|
6659
6760
|
}
|
|
6660
6761
|
function kickoffText(ui, iso) {
|
|
6661
6762
|
if (instantMs(iso) === null) return null;
|
|
@@ -6820,15 +6921,15 @@ function MatchCard({ card, ui, slip, sport, marketKey, conversation, operatorUse
|
|
|
6820
6921
|
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
6821
6922
|
var STATUSES = ["available", "doubtful", "out"];
|
|
6822
6923
|
var MAX_MARKS = 30;
|
|
6823
|
-
|
|
6824
|
-
function clock(iso) {
|
|
6924
|
+
function clock(iso, ui) {
|
|
6825
6925
|
if (!iso) return null;
|
|
6826
6926
|
const at2 = new Date(iso);
|
|
6827
|
-
|
|
6927
|
+
if (Number.isNaN(at2.getTime())) return null;
|
|
6928
|
+
return formatTime(at2, ui.locale, clockOf(ui), { timeZone: ui.timeZone });
|
|
6828
6929
|
}
|
|
6829
6930
|
function badge(card, ui) {
|
|
6830
6931
|
if (card.status === "out") {
|
|
6831
|
-
const time = clock(card.statusAsOfUtc);
|
|
6932
|
+
const time = clock(card.statusAsOfUtc, ui);
|
|
6832
6933
|
return { kind: "out", text: time ? ui.v8Out(time) : ui.v8OutNoTime };
|
|
6833
6934
|
}
|
|
6834
6935
|
return card.status === "doubtful" ? { kind: "doubtful", text: ui.v8Doubtful } : null;
|
|
@@ -6876,10 +6977,10 @@ function SinceLines({ since, ui }) {
|
|
|
6876
6977
|
// src/components/dashboard/v8/YouRibbon.tsx
|
|
6877
6978
|
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
6878
6979
|
var FROM_CHATS_SHOWN = 2;
|
|
6879
|
-
function showsNoGamesNote(chip, now = Date.now()) {
|
|
6980
|
+
function showsNoGamesNote(chip, now = Date.now(), timeZone) {
|
|
6880
6981
|
if (chip.kind !== "competition") return false;
|
|
6881
6982
|
const at2 = instantMs(chip.nextGameAtUtc);
|
|
6882
|
-
if (at2 !== null) return localDayStart(at2) > localDayStart(now);
|
|
6983
|
+
if (at2 !== null) return localDayStart(at2, timeZone) > localDayStart(now, timeZone);
|
|
6883
6984
|
return chip.noGamesToday === true;
|
|
6884
6985
|
}
|
|
6885
6986
|
function YouRibbon({ ribbon, ui, controller, holds, sport, onMore }) {
|
|
@@ -6889,7 +6990,7 @@ function YouRibbon({ ribbon, ui, controller, holds, sport, onMore }) {
|
|
|
6889
6990
|
return /* @__PURE__ */ jsxs22("section", { className: "ss-w-v8-sec ss-w-v8-ribbon", children: [
|
|
6890
6991
|
/* @__PURE__ */ jsxs22("div", { className: "ss-w-v8-chips", children: [
|
|
6891
6992
|
ribbon.stars.map((chip, i) => {
|
|
6892
|
-
const quiet = showsNoGamesNote(chip);
|
|
6993
|
+
const quiet = showsNoGamesNote(chip, Date.now(), ui.timeZone);
|
|
6893
6994
|
return /* @__PURE__ */ jsxs22("span", { className: `ss-w-v8-chip ss-w-v8-chip--${chip.kind}`, children: [
|
|
6894
6995
|
chip.playing && !quiet ? /* @__PURE__ */ jsx24("i", { className: "ss-w-v8-playing", "aria-hidden": "true" }) : null,
|
|
6895
6996
|
chip.label,
|
|
@@ -7102,54 +7203,9 @@ import { useCallback as useCallback21, useMemo as useMemo8, useState as useState
|
|
|
7102
7203
|
|
|
7103
7204
|
// src/useScheduleDay.ts
|
|
7104
7205
|
import { useCallback as useCallback20, useEffect as useEffect23, useRef as useRef18, useState as useState28 } from "react";
|
|
7105
|
-
|
|
7106
|
-
// src/scheduleDays.ts
|
|
7107
|
-
var MAX_AFTER_TODAY = 6;
|
|
7108
|
-
var parts = (date) => {
|
|
7109
|
-
const [y = 0, m = 1, d = 1] = date.split("-").map(Number);
|
|
7110
|
-
return [y, m, d];
|
|
7111
|
-
};
|
|
7112
|
-
function offsetOf(localDate) {
|
|
7113
|
-
const [y, m, d] = parts(localDate);
|
|
7114
|
-
return -new Date(y, m - 1, d, 12).getTimezoneOffset();
|
|
7115
|
-
}
|
|
7116
|
-
function localDateOfUnix(unix, offsetMinutes = -new Date(unix * 1e3).getTimezoneOffset()) {
|
|
7117
|
-
return new Date((unix + offsetMinutes * 60) * 1e3).toISOString().slice(0, 10);
|
|
7118
|
-
}
|
|
7119
|
-
var dayAfter = (date) => {
|
|
7120
|
-
const [y, m, d] = parts(date);
|
|
7121
|
-
return new Date(Date.UTC(y, m - 1, d + 1)).toISOString().slice(0, 10);
|
|
7122
|
-
};
|
|
7123
|
-
function buildDayChips(today, matchDays, sport) {
|
|
7124
|
-
const dates = /* @__PURE__ */ new Set();
|
|
7125
|
-
for (const md of matchDays) {
|
|
7126
|
-
if (sport !== "all" && md.sport !== sport) continue;
|
|
7127
|
-
for (const date of md.dates) if (date > today) dates.add(date);
|
|
7128
|
-
}
|
|
7129
|
-
const chips = [{ date: today, isToday: true, gapBefore: false }];
|
|
7130
|
-
for (const date of [...dates].sort().slice(0, MAX_AFTER_TODAY)) {
|
|
7131
|
-
const prev = chips[chips.length - 1];
|
|
7132
|
-
chips.push({ date, isToday: false, gapBefore: prev !== void 0 && dayAfter(prev.date) !== date });
|
|
7133
|
-
}
|
|
7134
|
-
return chips;
|
|
7135
|
-
}
|
|
7136
|
-
function weekdayAndDay(date, tag2) {
|
|
7137
|
-
const [y, m, d] = parts(date);
|
|
7138
|
-
const at2 = new Date(Date.UTC(y, m - 1, d, 12));
|
|
7139
|
-
return {
|
|
7140
|
-
weekday: formatDate(at2, tag2, { weekday: "short", timeZone: "UTC" }),
|
|
7141
|
-
day: formatDate(at2, tag2, { day: "numeric", timeZone: "UTC" })
|
|
7142
|
-
};
|
|
7143
|
-
}
|
|
7144
|
-
function weekdayLong(date, tag2) {
|
|
7145
|
-
const [y, m, d] = parts(date);
|
|
7146
|
-
return formatDate(new Date(Date.UTC(y, m - 1, d, 12)), tag2, { weekday: "long", timeZone: "UTC" });
|
|
7147
|
-
}
|
|
7148
|
-
|
|
7149
|
-
// src/useScheduleDay.ts
|
|
7150
7206
|
var EMPTY = [];
|
|
7151
7207
|
function useScheduleDay(opts) {
|
|
7152
|
-
const { localDate, today, todayGroups, enabled, resetKey } = opts;
|
|
7208
|
+
const { localDate, today, todayGroups, enabled, resetKey, timeZone } = opts;
|
|
7153
7209
|
const getRef = useRef18(opts.getSchedule);
|
|
7154
7210
|
getRef.current = opts.getSchedule;
|
|
7155
7211
|
const daysRef = useRef18(/* @__PURE__ */ new Map());
|
|
@@ -7157,12 +7213,14 @@ function useScheduleDay(opts) {
|
|
|
7157
7213
|
const [retryKey, setRetryKey] = useState28(0);
|
|
7158
7214
|
const [seenDate, setSeenDate] = useState28(localDate);
|
|
7159
7215
|
const [seenReset, setSeenReset] = useState28(resetKey);
|
|
7216
|
+
const [seenZone, setSeenZone] = useState28(timeZone);
|
|
7160
7217
|
if (seenDate !== localDate) {
|
|
7161
7218
|
setSeenDate(localDate);
|
|
7162
7219
|
setFetched({ status: "idle", groups: EMPTY });
|
|
7163
7220
|
}
|
|
7164
|
-
if (seenReset !== resetKey) {
|
|
7221
|
+
if (seenReset !== resetKey || seenZone !== timeZone) {
|
|
7165
7222
|
setSeenReset(resetKey);
|
|
7223
|
+
setSeenZone(timeZone);
|
|
7166
7224
|
daysRef.current.clear();
|
|
7167
7225
|
setFetched({ status: "idle", groups: EMPTY });
|
|
7168
7226
|
}
|
|
@@ -7173,7 +7231,7 @@ function useScheduleDay(opts) {
|
|
|
7173
7231
|
setFetched({ status: "loading", groups: EMPTY });
|
|
7174
7232
|
void (async () => {
|
|
7175
7233
|
try {
|
|
7176
|
-
const payload = await getRef.current(localDate, offsetOf(localDate));
|
|
7234
|
+
const payload = await getRef.current(localDate, offsetOf(localDate, timeZone));
|
|
7177
7235
|
if (cancelled) return;
|
|
7178
7236
|
if (!payload) {
|
|
7179
7237
|
setFetched({ status: "error", groups: EMPTY });
|
|
@@ -7188,7 +7246,7 @@ function useScheduleDay(opts) {
|
|
|
7188
7246
|
return () => {
|
|
7189
7247
|
cancelled = true;
|
|
7190
7248
|
};
|
|
7191
|
-
}, [localDate, isToday, enabled, retryKey, resetKey]);
|
|
7249
|
+
}, [localDate, isToday, enabled, retryKey, resetKey, timeZone]);
|
|
7192
7250
|
const retry = useCallback20(() => {
|
|
7193
7251
|
setRetryKey((k) => k + 1);
|
|
7194
7252
|
}, []);
|
|
@@ -7200,7 +7258,7 @@ function useScheduleDay(opts) {
|
|
|
7200
7258
|
}
|
|
7201
7259
|
|
|
7202
7260
|
// src/useMatchesDay.ts
|
|
7203
|
-
function useMatchesDay({ discovery, day, sport, getSchedule, enabled }) {
|
|
7261
|
+
function useMatchesDay({ discovery, day, sport, getSchedule, enabled, timeZone }) {
|
|
7204
7262
|
const { localDate: today, matchDays } = discovery;
|
|
7205
7263
|
const chips = useMemo8(() => buildDayChips(today, matchDays, sport), [today, matchDays, sport]);
|
|
7206
7264
|
const selected = chips.some((c) => c.date === day) ? day : today;
|
|
@@ -7210,6 +7268,7 @@ function useMatchesDay({ discovery, day, sport, getSchedule, enabled }) {
|
|
|
7210
7268
|
todayGroups: discovery.groups,
|
|
7211
7269
|
getSchedule,
|
|
7212
7270
|
enabled,
|
|
7271
|
+
timeZone,
|
|
7213
7272
|
resetKey: String(discovery.scheduleVersion)
|
|
7214
7273
|
});
|
|
7215
7274
|
return { ...loaded, chips, selected };
|
|
@@ -8729,6 +8788,7 @@ var SCATTER_VIEW = { w: 400, h: 250, pad: { l: 34, r: 12, t: 12, b: 30 } };
|
|
|
8729
8788
|
var FORM_VIEW = { w: 400, h: 170, pad: { l: 28, r: 8, t: 14, b: 40 } };
|
|
8730
8789
|
var PATH_VIEW = { w: 400, h: 165, pad: { l: 8, r: 8, t: 18, b: 22 } };
|
|
8731
8790
|
var ROUND_STEPS = 11;
|
|
8791
|
+
var MIN_SPAN_STEPS = 3;
|
|
8732
8792
|
var MAX_BAR_W = 28;
|
|
8733
8793
|
var BAR_GAP = 4;
|
|
8734
8794
|
var MAX_TICKS = 6;
|
|
@@ -8743,7 +8803,7 @@ function ticksFor(lo, hi) {
|
|
|
8743
8803
|
return out;
|
|
8744
8804
|
}
|
|
8745
8805
|
function scatterScale(e) {
|
|
8746
|
-
const { w, h, pad
|
|
8806
|
+
const { w, h, pad } = SCATTER_VIEW;
|
|
8747
8807
|
const xs = finite3([...e.field.map((d) => d.returnPct), ...e.marked.map((m) => m.returnPct), e.tourReturnPct]);
|
|
8748
8808
|
const ys = finite3([...e.field.map((d) => d.servePct), ...e.marked.map((m) => m.servePct), e.tourServePct]);
|
|
8749
8809
|
const x0 = Math.floor(Math.min(...xs) - 1);
|
|
@@ -8751,49 +8811,94 @@ function scatterScale(e) {
|
|
|
8751
8811
|
const y0 = Math.floor(Math.min(...ys) - 1);
|
|
8752
8812
|
const y1 = Math.ceil(Math.max(...ys) + 1);
|
|
8753
8813
|
return {
|
|
8754
|
-
x: (v) => round22(
|
|
8755
|
-
y: (v) => round22(h -
|
|
8814
|
+
x: (v) => round22(pad.l + (v - x0) / (x1 - x0) * (w - pad.l - pad.r)),
|
|
8815
|
+
y: (v) => round22(h - pad.b - (v - y0) / (y1 - y0) * (h - pad.t - pad.b)),
|
|
8756
8816
|
ticksX: ticksFor(x0, x1),
|
|
8757
8817
|
ticksY: ticksFor(y0, y1)
|
|
8758
8818
|
};
|
|
8759
8819
|
}
|
|
8760
8820
|
function formBars(e) {
|
|
8761
|
-
const { w, h, pad
|
|
8821
|
+
const { w, h, pad } = FORM_VIEW;
|
|
8762
8822
|
const n = e.matches.length;
|
|
8763
8823
|
const bounds = finite3([e.min, e.max, e.tourServePct]);
|
|
8764
8824
|
const lo = Math.min(...bounds) - 4;
|
|
8765
8825
|
const hi = Math.max(...bounds) + 2;
|
|
8766
|
-
const plotW = w -
|
|
8767
|
-
const base = h -
|
|
8768
|
-
const y = (v) => round22(base - (v - lo) / (hi - lo) * (h -
|
|
8826
|
+
const plotW = w - pad.l - pad.r;
|
|
8827
|
+
const base = h - pad.b;
|
|
8828
|
+
const y = (v) => round22(base - (v - lo) / (hi - lo) * (h - pad.t - pad.b));
|
|
8769
8829
|
const slot = plotW / Math.max(n, 1);
|
|
8770
8830
|
const bw = Math.max(1, Math.min(MAX_BAR_W, slot - BAR_GAP));
|
|
8771
8831
|
const bars = e.matches.map((m, i) => {
|
|
8772
8832
|
const top = y(clampTo(m.servePct, lo, hi));
|
|
8773
|
-
return { x: round22(
|
|
8833
|
+
return { x: round22(pad.l + slot * i + (slot - bw) / 2), w: round22(bw), y: top, h: round22(base - top), won: m.result === "W" };
|
|
8774
8834
|
});
|
|
8775
8835
|
return { bars, tourY: y(e.tourServePct) };
|
|
8776
8836
|
}
|
|
8777
|
-
|
|
8778
|
-
|
|
8837
|
+
var GLYPH_W = 4.6;
|
|
8838
|
+
var FORM_GLYPH_W = 5.1;
|
|
8839
|
+
var FORM_LABEL_GAP = 10;
|
|
8840
|
+
var GUTTER_PAD = 6;
|
|
8841
|
+
var ROUND_LABEL_FONT = 9;
|
|
8842
|
+
var ROUND_LABEL_MIN_GAP = ROUND_LABEL_FONT * 1.4;
|
|
8843
|
+
function fitLabel(text2, width, glyph = GLYPH_W) {
|
|
8844
|
+
const max = Math.max(Math.floor((width - 1) / glyph), 2);
|
|
8845
|
+
return text2.length <= max ? text2 : `${text2.slice(0, max - 1)}\u2026`;
|
|
8846
|
+
}
|
|
8847
|
+
function formLabelWidth(slot) {
|
|
8848
|
+
return Math.max(slot * 2 - FORM_LABEL_GAP, 0);
|
|
8849
|
+
}
|
|
8850
|
+
function roundSpan(e) {
|
|
8851
|
+
const known = e.events.filter((ev) => ev.roundIndex >= 0).map((ev) => clampTo(ev.roundIndex, 0, ROUND_STEPS - 1));
|
|
8852
|
+
const lo = Math.min(ROUND_STEPS - MIN_SPAN_STEPS, ...known);
|
|
8853
|
+
return { lo, span: ROUND_STEPS - lo };
|
|
8854
|
+
}
|
|
8855
|
+
function pathRounds(e) {
|
|
8856
|
+
const { h, pad } = PATH_VIEW;
|
|
8857
|
+
const base = h - pad.b;
|
|
8858
|
+
const plotH = h - pad.t - pad.b;
|
|
8859
|
+
const { lo, span } = roundSpan(e);
|
|
8860
|
+
const seen = /* @__PURE__ */ new Map();
|
|
8861
|
+
for (const ev of e.events) {
|
|
8862
|
+
if (ev.roundIndex < 0) continue;
|
|
8863
|
+
const idx = clampTo(ev.roundIndex, 0, ROUND_STEPS - 1);
|
|
8864
|
+
const short = typeof ev.roundShort === "string" ? ev.roundShort : "";
|
|
8865
|
+
if (short !== "" && !seen.has(idx)) seen.set(idx, short);
|
|
8866
|
+
}
|
|
8867
|
+
const kept = [];
|
|
8868
|
+
for (const [roundIndex, label] of [...seen.entries()].sort((a, b) => b[0] - a[0])) {
|
|
8869
|
+
const y = round22(base - (roundIndex - lo + 1) / span * plotH);
|
|
8870
|
+
const last = kept[kept.length - 1];
|
|
8871
|
+
if (last === void 0 || y - last.y >= ROUND_LABEL_MIN_GAP) kept.push({ roundIndex, label, y });
|
|
8872
|
+
}
|
|
8873
|
+
return kept.reverse();
|
|
8874
|
+
}
|
|
8875
|
+
function pathGutter(e) {
|
|
8876
|
+
const rounds = pathRounds(e);
|
|
8877
|
+
if (rounds.length === 0) return PATH_VIEW.pad.l;
|
|
8878
|
+
const longest = Math.max(...rounds.map((r) => r.label.length));
|
|
8879
|
+
return Math.max(PATH_VIEW.pad.l, Math.ceil(longest * GLYPH_W) + GUTTER_PAD + 4);
|
|
8880
|
+
}
|
|
8881
|
+
function pathBars(e, left = PATH_VIEW.pad.l) {
|
|
8882
|
+
const { w, h, pad } = PATH_VIEW;
|
|
8779
8883
|
const n = e.events.length;
|
|
8780
|
-
const plotW = w -
|
|
8781
|
-
const plotH = h -
|
|
8782
|
-
const base = h -
|
|
8884
|
+
const plotW = w - left - pad.r;
|
|
8885
|
+
const plotH = h - pad.t - pad.b;
|
|
8886
|
+
const base = h - pad.b;
|
|
8783
8887
|
const slot = plotW / Math.max(n, 1);
|
|
8784
8888
|
const bw = Math.max(1, Math.min(MAX_BAR_W, slot - BAR_GAP));
|
|
8785
|
-
const
|
|
8889
|
+
const { lo, span } = roundSpan(e);
|
|
8890
|
+
const heightOf = (steps) => Math.min(steps, span) / span * plotH;
|
|
8786
8891
|
return e.events.map((ev, i) => {
|
|
8787
|
-
const idx = clampTo(ev.roundIndex, 0, ROUND_STEPS - 1);
|
|
8788
|
-
const bh = heightOf(idx + 1);
|
|
8892
|
+
const idx = ev.roundIndex < 0 ? lo : clampTo(ev.roundIndex, 0, ROUND_STEPS - 1);
|
|
8893
|
+
const bh = heightOf(idx - lo + 1);
|
|
8789
8894
|
return {
|
|
8790
|
-
x: round22(
|
|
8895
|
+
x: round22(left + slot * i + (slot - bw) / 2),
|
|
8791
8896
|
w: round22(bw),
|
|
8792
8897
|
h: round22(bh),
|
|
8793
8898
|
y: round22(base - bh),
|
|
8794
8899
|
surface: ev.surface ?? null,
|
|
8795
8900
|
title: ev.title,
|
|
8796
|
-
capY: ev.laterRoundsMissing ? round22(base - heightOf(idx + 2)) : null
|
|
8901
|
+
capY: ev.laterRoundsMissing ? round22(base - heightOf(idx - lo + 2)) : null
|
|
8797
8902
|
};
|
|
8798
8903
|
});
|
|
8799
8904
|
}
|
|
@@ -8806,12 +8911,7 @@ function labelSide(p, view) {
|
|
|
8806
8911
|
import { Fragment as Fragment8, jsx as jsx38, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
8807
8912
|
var SURFACES = /* @__PURE__ */ new Set(["hard", "clay", "grass"]);
|
|
8808
8913
|
var surfaceOf = (code) => code && SURFACES.has(code) ? code : "other";
|
|
8809
|
-
var GLYPH_W = 4.6;
|
|
8810
8914
|
var pct = (v, ui, digits = 1) => formatNumber(v / 100, ui.locale, { style: "percent", minimumFractionDigits: digits, maximumFractionDigits: digits });
|
|
8811
|
-
function fitLabel(text2, slot) {
|
|
8812
|
-
const max = Math.max(Math.floor((slot - 1) / GLYPH_W), 2);
|
|
8813
|
-
return text2.length <= max ? text2 : `${text2.slice(0, max - 1)}\u2026`;
|
|
8814
|
-
}
|
|
8815
8915
|
function Country({ code }) {
|
|
8816
8916
|
return code ? /* @__PURE__ */ jsx38("span", { className: "ss-w-tni-cc", children: code }) : null;
|
|
8817
8917
|
}
|
|
@@ -8843,7 +8943,7 @@ function TennisInsightPriceRow({ prices }) {
|
|
|
8843
8943
|
] });
|
|
8844
8944
|
}
|
|
8845
8945
|
function ServeReturnChart({ vm, e, ui }) {
|
|
8846
|
-
const { w, h, pad
|
|
8946
|
+
const { w, h, pad } = SCATTER_VIEW;
|
|
8847
8947
|
const s = scatterScale(e);
|
|
8848
8948
|
const tx = s.x(e.tourReturnPct);
|
|
8849
8949
|
const ty = s.y(e.tourServePct);
|
|
@@ -8855,19 +8955,19 @@ function ServeReturnChart({ vm, e, ui }) {
|
|
|
8855
8955
|
});
|
|
8856
8956
|
return /* @__PURE__ */ jsxs34("svg", { className: "ss-w-tni-svg", viewBox: `0 0 ${w} ${h}`, width: "100%", role: "img", "aria-label": summaryOf(vm, ui), children: [
|
|
8857
8957
|
s.ticksX.map((t) => /* @__PURE__ */ jsxs34("g", { children: [
|
|
8858
|
-
/* @__PURE__ */ jsx38("line", { className: "ss-w-tni-grid", x1: s.x(t), x2: s.x(t), y1:
|
|
8859
|
-
/* @__PURE__ */ jsx38("text", { className: "ss-w-tni-tick", x: s.x(t), y: h -
|
|
8958
|
+
/* @__PURE__ */ jsx38("line", { className: "ss-w-tni-grid", x1: s.x(t), x2: s.x(t), y1: pad.t, y2: h - pad.b }),
|
|
8959
|
+
/* @__PURE__ */ jsx38("text", { className: "ss-w-tni-tick", x: s.x(t), y: h - pad.b + 11, textAnchor: "middle", children: pct(t, ui, 0) })
|
|
8860
8960
|
] }, `x${t}`)),
|
|
8861
8961
|
s.ticksY.map((t) => /* @__PURE__ */ jsxs34("g", { children: [
|
|
8862
|
-
/* @__PURE__ */ jsx38("line", { className: "ss-w-tni-grid", x1:
|
|
8863
|
-
/* @__PURE__ */ jsx38("text", { className: "ss-w-tni-tick", x:
|
|
8962
|
+
/* @__PURE__ */ jsx38("line", { className: "ss-w-tni-grid", x1: pad.l, x2: w - pad.r, y1: s.y(t), y2: s.y(t) }),
|
|
8963
|
+
/* @__PURE__ */ jsx38("text", { className: "ss-w-tni-tick", x: pad.l - 4, y: s.y(t) + 3, textAnchor: "end", children: pct(t, ui, 0) })
|
|
8864
8964
|
] }, `y${t}`)),
|
|
8865
|
-
/* @__PURE__ */ jsx38("text", { className: "ss-w-tni-axis", x:
|
|
8866
|
-
/* @__PURE__ */ jsx38("text", { className: "ss-w-tni-axis", transform: `translate(8 ${
|
|
8965
|
+
/* @__PURE__ */ jsx38("text", { className: "ss-w-tni-axis", x: pad.l + (w - pad.l - pad.r) / 2, y: h - 3, textAnchor: "middle", children: e.xAxis }),
|
|
8966
|
+
/* @__PURE__ */ jsx38("text", { className: "ss-w-tni-axis", transform: `translate(8 ${pad.t + (h - pad.t - pad.b) / 2}) rotate(-90)`, textAnchor: "middle", children: e.yAxis }),
|
|
8867
8967
|
e.field.map((d) => /* @__PURE__ */ jsx38("circle", { className: "ss-w-tni-dot", cx: s.x(d.returnPct), cy: s.y(d.servePct), r: 2.4 }, d.playerId)),
|
|
8868
|
-
/* @__PURE__ */ jsx38("line", { className: "ss-w-tni-tour", x1: tx, x2: tx, y1:
|
|
8869
|
-
/* @__PURE__ */ jsx38("line", { className: "ss-w-tni-tour", x1:
|
|
8870
|
-
/* @__PURE__ */ jsx38("text", { className: "ss-w-tni-lab ss-w-tni-lab-faint", x: w -
|
|
8968
|
+
/* @__PURE__ */ jsx38("line", { className: "ss-w-tni-tour", x1: tx, x2: tx, y1: pad.t, y2: h - pad.b }),
|
|
8969
|
+
/* @__PURE__ */ jsx38("line", { className: "ss-w-tni-tour", x1: pad.l, x2: w - pad.r, y1: ty, y2: ty }),
|
|
8970
|
+
/* @__PURE__ */ jsx38("text", { className: "ss-w-tni-lab ss-w-tni-lab-faint", x: w - pad.r - 2, y: ty - 4, textAnchor: "end", children: e.tourAverage }),
|
|
8871
8971
|
e.marked.map((m, i) => {
|
|
8872
8972
|
const l = labels[i];
|
|
8873
8973
|
return /* @__PURE__ */ jsxs34("g", { children: [
|
|
@@ -8888,15 +8988,15 @@ function ServeReturnCard({ vm, e, ui }) {
|
|
|
8888
8988
|
] });
|
|
8889
8989
|
}
|
|
8890
8990
|
function ServeFormCard({ vm, e, ui }) {
|
|
8891
|
-
const { w, h, pad
|
|
8991
|
+
const { w, h, pad } = FORM_VIEW;
|
|
8892
8992
|
const { bars, tourY } = formBars(e);
|
|
8893
8993
|
const lo = Math.min(e.min, e.tourServePct) - 4;
|
|
8894
8994
|
const hi = Math.max(e.max, e.tourServePct) + 2;
|
|
8895
|
-
const base = h -
|
|
8896
|
-
const yOf = (v) => base - (v - lo) / (hi - lo) * (h -
|
|
8995
|
+
const base = h - pad.b;
|
|
8996
|
+
const yOf = (v) => base - (v - lo) / (hi - lo) * (h - pad.t - pad.b);
|
|
8897
8997
|
const ticks = [];
|
|
8898
8998
|
for (let t = Math.ceil(lo / 5) * 5; t <= hi; t += 5) ticks.push(t);
|
|
8899
|
-
const slot = (w -
|
|
8999
|
+
const slot = (w - pad.l - pad.r) / Math.max(e.matches.length, 1);
|
|
8900
9000
|
const tiles = [
|
|
8901
9001
|
{ label: e.labels.average, value: pct(e.average, ui) },
|
|
8902
9002
|
e.winsAverage == null ? null : { label: e.labels.inWins, value: pct(e.winsAverage, ui) },
|
|
@@ -8905,10 +9005,10 @@ function ServeFormCard({ vm, e, ui }) {
|
|
|
8905
9005
|
].filter((t) => t !== null);
|
|
8906
9006
|
return /* @__PURE__ */ jsxs34(Fragment8, { children: [
|
|
8907
9007
|
/* @__PURE__ */ jsxs34("svg", { className: "ss-w-tni-svg", viewBox: `0 0 ${w} ${h}`, width: "100%", role: "img", "aria-label": summaryOf(vm, ui), children: [
|
|
8908
|
-
/* @__PURE__ */ jsx38("text", { className: "ss-w-tni-axis", x:
|
|
9008
|
+
/* @__PURE__ */ jsx38("text", { className: "ss-w-tni-axis", x: pad.l, y: 9, children: e.labels.metric }),
|
|
8909
9009
|
ticks.map((t) => /* @__PURE__ */ jsxs34("g", { children: [
|
|
8910
|
-
/* @__PURE__ */ jsx38("line", { className: "ss-w-tni-grid", x1:
|
|
8911
|
-
/* @__PURE__ */ jsx38("text", { className: "ss-w-tni-tick", x:
|
|
9010
|
+
/* @__PURE__ */ jsx38("line", { className: "ss-w-tni-grid", x1: pad.l, x2: w - pad.r, y1: yOf(t), y2: yOf(t) }),
|
|
9011
|
+
/* @__PURE__ */ jsx38("text", { className: "ss-w-tni-tick", x: pad.l - 4, y: yOf(t) + 3, textAnchor: "end", children: pct(t, ui, 0) })
|
|
8912
9012
|
] }, t)),
|
|
8913
9013
|
bars.map((b, i) => {
|
|
8914
9014
|
const m = e.matches[i];
|
|
@@ -8917,11 +9017,11 @@ function ServeFormCard({ vm, e, ui }) {
|
|
|
8917
9017
|
return /* @__PURE__ */ jsxs34("g", { children: [
|
|
8918
9018
|
/* @__PURE__ */ jsx38("rect", { className: `ss-w-tni-fbar ss-w-tni-fbar-${b.won ? "w" : "l"}`, x: b.x, y: b.y, width: b.w, height: b.h, rx: 2, children: /* @__PURE__ */ jsx38("title", { children: `${m.opponent} \xB7 ${resultLabel2} \xB7 ${pct(m.servePct, ui)}` }) }),
|
|
8919
9019
|
/* @__PURE__ */ jsx38("text", { className: `ss-w-tni-xl ss-w-tni-xl-${b.won ? "w" : "l"}`, x: cx, y: base + 11, textAnchor: "middle", children: resultLabel2 }),
|
|
8920
|
-
/* @__PURE__ */ jsx38("text", { className: "ss-w-tni-xl", x: cx, y: base + (i % 2 === 0 ? 22 : 32), textAnchor: "middle", children: fitLabel(m.opponent, slot
|
|
9020
|
+
/* @__PURE__ */ jsx38("text", { className: "ss-w-tni-xl", x: cx, y: base + (i % 2 === 0 ? 22 : 32), textAnchor: "middle", children: fitLabel(m.opponent, formLabelWidth(slot), FORM_GLYPH_W) })
|
|
8921
9021
|
] }, m.matchId);
|
|
8922
9022
|
}),
|
|
8923
|
-
/* @__PURE__ */ jsx38("line", { className: "ss-w-tni-tour", x1:
|
|
8924
|
-
/* @__PURE__ */ jsx38("text", { className: "ss-w-tni-lab ss-w-tni-lab-faint", x: w -
|
|
9023
|
+
/* @__PURE__ */ jsx38("line", { className: "ss-w-tni-tour", x1: pad.l, x2: w - pad.r, y1: tourY, y2: tourY }),
|
|
9024
|
+
/* @__PURE__ */ jsx38("text", { className: "ss-w-tni-lab ss-w-tni-lab-faint", x: w - pad.r - 2, y: pad.t - 4, textAnchor: "end", children: `${e.labels.tourAverage} ${pct(e.tourServePct, ui)}` })
|
|
8925
9025
|
] }),
|
|
8926
9026
|
/* @__PURE__ */ jsx38("div", { className: "ss-w-tni-tiles", children: tiles.map((t) => /* @__PURE__ */ jsxs34("div", { className: "ss-w-tni-tile", children: [
|
|
8927
9027
|
/* @__PURE__ */ jsx38("span", { className: "ss-w-tni-tile-v", children: t.value }),
|
|
@@ -8930,22 +9030,27 @@ function ServeFormCard({ vm, e, ui }) {
|
|
|
8930
9030
|
] });
|
|
8931
9031
|
}
|
|
8932
9032
|
function SeasonPathCard({ vm, e, ui }) {
|
|
8933
|
-
const { w, h, pad
|
|
8934
|
-
const
|
|
8935
|
-
const
|
|
8936
|
-
const
|
|
8937
|
-
const
|
|
9033
|
+
const { w, h, pad } = PATH_VIEW;
|
|
9034
|
+
const left = pathGutter(e);
|
|
9035
|
+
const bars = pathBars(e, left);
|
|
9036
|
+
const rounds = pathRounds(e);
|
|
9037
|
+
const base = h - pad.b;
|
|
9038
|
+
const labelled = (w - pad.l - pad.r) / Math.max(e.events.length, 1) >= 22;
|
|
8938
9039
|
const NAME_ROOM = 46;
|
|
9040
|
+
const namesShown = labelled && e.events.some((ev) => ev.name);
|
|
8939
9041
|
const hasTitle = e.events.some((ev) => ev.title);
|
|
8940
9042
|
const hasCap = e.events.some((ev) => ev.laterRoundsMissing);
|
|
8941
9043
|
const aliveChip = e.aliveLabel ? e.events.some((ev) => ev.alive) : false;
|
|
8942
9044
|
return /* @__PURE__ */ jsxs34(Fragment8, { children: [
|
|
8943
|
-
/* @__PURE__ */ jsxs34("svg", { className: "ss-w-tni-svg", viewBox: `0 0 ${w} ${h + NAME_ROOM}`, width: "100%", role: "img", "aria-label": summaryOf(vm, ui), children: [
|
|
8944
|
-
/* @__PURE__ */
|
|
9045
|
+
/* @__PURE__ */ jsxs34("svg", { className: "ss-w-tni-svg", viewBox: `0 0 ${w} ${h + (namesShown ? NAME_ROOM : -14)}`, width: "100%", role: "img", "aria-label": summaryOf(vm, ui), children: [
|
|
9046
|
+
rounds.map((r) => /* @__PURE__ */ jsxs34("g", { children: [
|
|
9047
|
+
/* @__PURE__ */ jsx38("line", { className: "ss-w-tni-grid ss-w-tni-rline", x1: left, x2: w - pad.r, y1: r.y, y2: r.y }),
|
|
9048
|
+
/* @__PURE__ */ jsx38("text", { className: "ss-w-tni-tick", x: left - 4, y: r.y + 3, textAnchor: "end", children: r.label })
|
|
9049
|
+
] }, `r${r.roundIndex}`)),
|
|
9050
|
+
/* @__PURE__ */ jsx38("line", { className: "ss-w-tni-grid", x1: left, x2: w - pad.r, y1: base, y2: base }),
|
|
8945
9051
|
bars.map((b, i) => {
|
|
8946
9052
|
const ev = e.events[i];
|
|
8947
9053
|
const surface = surfaceOf(b.surface);
|
|
8948
|
-
const short = typeof ev.roundShort === "string" && ev.roundShort !== "" ? ev.roundShort : null;
|
|
8949
9054
|
return /* @__PURE__ */ jsxs34("g", { children: [
|
|
8950
9055
|
/* @__PURE__ */ jsx38(
|
|
8951
9056
|
"rect",
|
|
@@ -8963,7 +9068,6 @@ function SeasonPathCard({ vm, e, ui }) {
|
|
|
8963
9068
|
),
|
|
8964
9069
|
b.capY !== null ? /* @__PURE__ */ jsx38("rect", { className: "ss-w-tni-cap", x: b.x, y: b.capY, width: b.w, height: b.y - b.capY, rx: Math.min(2, b.w / 2), children: /* @__PURE__ */ jsx38("title", { children: e.laterRoundsMissingLabel }) }) : null,
|
|
8965
9070
|
b.title ? /* @__PURE__ */ jsx38("path", { className: "ss-w-tni-titlemark", d: `M${b.x + b.w / 2} ${b.y - 9} l3.5 6 h-7 z`, children: /* @__PURE__ */ jsx38("title", { children: e.titleMark }) }) : null,
|
|
8966
|
-
labelled && short && short.length * GLYPH_W <= slot - 1 ? /* @__PURE__ */ jsx38("text", { className: "ss-w-tni-xl", x: b.x + b.w / 2, y: base + 12, textAnchor: "middle", children: short }) : null,
|
|
8967
9071
|
labelled && ev.name ? /* @__PURE__ */ jsx38("text", { className: "ss-w-tni-xl ss-w-tni-xl-name", transform: `translate(${b.x + b.w / 2 + 3} ${base + 19}) rotate(90)`, children: fitLabel(ev.name, NAME_ROOM * 1.1) }) : null
|
|
8968
9072
|
] }, `${ev.tournamentId}:${i}`);
|
|
8969
9073
|
})
|
|
@@ -9367,7 +9471,7 @@ function FixtureCard({ card, ui }) {
|
|
|
9367
9471
|
// src/components/dashboard/CountdownCard.tsx
|
|
9368
9472
|
import { Fragment as Fragment11, useEffect as useEffect29, useState as useState36 } from "react";
|
|
9369
9473
|
import { jsx as jsx43, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
9370
|
-
var
|
|
9474
|
+
var DAY_MS3 = 864e5;
|
|
9371
9475
|
function remainingSegments(kickoffUnix, nowMs, withSeconds) {
|
|
9372
9476
|
const totalSeconds = Math.floor((kickoffUnix * 1e3 - nowMs) / 1e3);
|
|
9373
9477
|
if (totalSeconds <= 0) return null;
|
|
@@ -9375,10 +9479,10 @@ function remainingSegments(kickoffUnix, nowMs, withSeconds) {
|
|
|
9375
9479
|
const hours = Math.floor(totalSeconds % 86400 / 3600);
|
|
9376
9480
|
const minutes = Math.floor(totalSeconds % 3600 / 60);
|
|
9377
9481
|
const seconds = totalSeconds % 60;
|
|
9378
|
-
const
|
|
9379
|
-
if (days > 0) return [{ value:
|
|
9380
|
-
const segs = [{ value:
|
|
9381
|
-
if (withSeconds) segs.push({ value:
|
|
9482
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
9483
|
+
if (days > 0) return [{ value: pad(days), unit: "d" }, { value: pad(hours), unit: "h" }];
|
|
9484
|
+
const segs = [{ value: pad(hours), unit: "h" }, { value: pad(minutes), unit: "m" }];
|
|
9485
|
+
if (withSeconds) segs.push({ value: pad(seconds), unit: "s" });
|
|
9382
9486
|
return segs;
|
|
9383
9487
|
}
|
|
9384
9488
|
function CountdownCard({ card, ui }) {
|
|
@@ -9388,7 +9492,7 @@ function CountdownCard({ card, ui }) {
|
|
|
9388
9492
|
const [reduced] = useState36(
|
|
9389
9493
|
() => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
|
9390
9494
|
);
|
|
9391
|
-
const withinDay = data.kickoffUnix * 1e3 - nowMs <
|
|
9495
|
+
const withinDay = data.kickoffUnix * 1e3 - nowMs < DAY_MS3;
|
|
9392
9496
|
useEffect29(() => {
|
|
9393
9497
|
if (reduced) return;
|
|
9394
9498
|
const id = window.setInterval(() => setNowMs(Date.now()), withinDay ? 1e3 : 6e4);
|
|
@@ -10696,7 +10800,7 @@ function MonitorMatchCard({ match, promotedPins, monitor, ui, slip, onAsk }) {
|
|
|
10696
10800
|
] })
|
|
10697
10801
|
] }, row.label);
|
|
10698
10802
|
}) }),
|
|
10699
|
-
match.status === "stale" && /* @__PURE__ */ jsx72("span", { className: "ss-w-mon-asof", children: ui.asOf(formatTime(match.asOfUtc, ui.locale, clockOf(ui))) }),
|
|
10803
|
+
match.status === "stale" && /* @__PURE__ */ jsx72("span", { className: "ss-w-mon-asof", children: ui.asOf(formatTime(match.asOfUtc, ui.locale, clockOf(ui), { timeZone: ui.timeZone })) }),
|
|
10700
10804
|
match.momentum.length > 0 && /* @__PURE__ */ jsxs67("div", { className: "ss-w-mon-mom", children: [
|
|
10701
10805
|
/* @__PURE__ */ jsx72("span", { className: "ss-w-mon-stat-l", children: ui.momentumLabel }),
|
|
10702
10806
|
/* @__PURE__ */ jsx72(MomentumWave, { points: match.momentum, label: ui.momentumLabel, clubIsHome: true })
|
|
@@ -11723,12 +11827,11 @@ function splitAtFirstSpace(label) {
|
|
|
11723
11827
|
const i = label.indexOf(" ");
|
|
11724
11828
|
return i > 0 && i < label.length - 1 ? [label.slice(0, i), label.slice(i + 1)] : null;
|
|
11725
11829
|
}
|
|
11726
|
-
function isOtherLocalDay(kickoffUnix, now) {
|
|
11727
|
-
|
|
11728
|
-
return at2.getFullYear() !== now.getFullYear() || at2.getMonth() !== now.getMonth() || at2.getDate() !== now.getDate();
|
|
11830
|
+
function isOtherLocalDay(kickoffUnix, now, timeZone) {
|
|
11831
|
+
return zonedDayNumber(kickoffUnix * 1e3, timeZone) !== zonedDayNumber(now.getTime(), timeZone);
|
|
11729
11832
|
}
|
|
11730
|
-
function kickoffLabel(kickoffUnix, tag2, clock3) {
|
|
11731
|
-
return formatTime(kickoffUnix * 1e3, tag2, clock3);
|
|
11833
|
+
function kickoffLabel(kickoffUnix, tag2, clock3, timeZone) {
|
|
11834
|
+
return formatTime(kickoffUnix * 1e3, tag2, clock3, { timeZone });
|
|
11732
11835
|
}
|
|
11733
11836
|
function Side2({ name, crest, abbr, away = false }) {
|
|
11734
11837
|
return /* @__PURE__ */ jsxs79("span", { className: away ? "ss-w-drow-side ss-w-drow-side--away" : "ss-w-drow-side", children: [
|
|
@@ -11746,12 +11849,12 @@ function rowStatusOf(state, stale, ui) {
|
|
|
11746
11849
|
}
|
|
11747
11850
|
function FixtureRow({ match, state, stale, ui, monitor, onOpen }) {
|
|
11748
11851
|
const { isLive, hasScore, score, ticked, when: clock3 } = rowStatusOf(state, stale, ui);
|
|
11749
|
-
const when = clock3 ?? kickoffLabel(match.kickoffUnix, ui.locale, clockOf(ui));
|
|
11852
|
+
const when = clock3 ?? kickoffLabel(match.kickoffUnix, ui.locale, clockOf(ui), ui.timeZone);
|
|
11750
11853
|
const isUsSport = sportKeyOf(match.sport) !== "football";
|
|
11751
11854
|
const pinSport = slipSportOf8(match.sport);
|
|
11752
11855
|
const liveTone = isLive || state?.isHalfTime;
|
|
11753
11856
|
const clockParts = isUsSport && isLive && ticked !== null && !state?.isHalfTime ? splitAtFirstSpace(ticked) : null;
|
|
11754
|
-
const dayMarker = isUsSport && !liveTone && state?.phase !== "live" && isOtherLocalDay(match.kickoffUnix, /* @__PURE__ */ new Date()) ? formatDate(match.kickoffUnix * 1e3, ui.locale, { weekday: "short" }) : null;
|
|
11857
|
+
const dayMarker = isUsSport && !liveTone && state?.phase !== "live" && isOtherLocalDay(match.kickoffUnix, /* @__PURE__ */ new Date(), ui.timeZone) ? formatDate(match.kickoffUnix * 1e3, ui.locale, { weekday: "short", timeZone: ui.timeZone }) : null;
|
|
11755
11858
|
const twoLines = clockParts ?? (dayMarker !== null ? [when, dayMarker] : null);
|
|
11756
11859
|
const whenClass = [
|
|
11757
11860
|
"ss-w-drow-when",
|
|
@@ -11921,7 +12024,7 @@ function TennisFixtureRow({ match, state, stale, ui, prices, slip, monitor }) {
|
|
|
11921
12024
|
live ? /* @__PURE__ */ jsxs80("span", { className: "ss-w-trow-when ss-w-trow-live", children: [
|
|
11922
12025
|
ui.liveLabel,
|
|
11923
12026
|
setLabel ? /* @__PURE__ */ jsx85("span", { className: "ss-w-trow-set", children: setLabel }) : null
|
|
11924
|
-
] }) : endMark ? /* @__PURE__ */ jsx85("span", { className: "ss-w-trow-when ss-w-trow-when--end", children: endMark }) : match.timeTba ? /* @__PURE__ */ jsx85("span", { className: "ss-w-trow-when ss-w-trow-when--tba", children: ui.tennis.timeTba }) : /* @__PURE__ */ jsx85("span", { className: "ss-w-trow-when", children: kickoffLabel(match.kickoffUnix, ui.locale, clockOf(ui)) }),
|
|
12027
|
+
] }) : endMark ? /* @__PURE__ */ jsx85("span", { className: "ss-w-trow-when ss-w-trow-when--end", children: endMark }) : match.timeTba ? /* @__PURE__ */ jsx85("span", { className: "ss-w-trow-when ss-w-trow-when--tba", children: ui.tennis.timeTba }) : /* @__PURE__ */ jsx85("span", { className: "ss-w-trow-when", children: kickoffLabel(match.kickoffUnix, ui.locale, clockOf(ui), ui.timeZone) }),
|
|
11925
12028
|
pinned ? /* @__PURE__ */ jsx85("button", { type: "button", className: "ss-w-trow-players ss-w-trow-open", onClick: open, children: players }) : /* @__PURE__ */ jsx85("span", { className: "ss-w-trow-players", children: players }),
|
|
11926
12029
|
showPrices && (entry === void 0 ? /* @__PURE__ */ jsx85("span", { className: "ss-w-trow-prices" }) : entry === null ? /* @__PURE__ */ jsx85("span", { className: "ss-w-trow-prices", children: /* @__PURE__ */ jsx85("span", { className: "ss-w-trow-noodds", children: ui.tennis.noOdds }) }) : /* @__PURE__ */ jsx85(TennisPriceCell, { match, price: entry, ui, slip })),
|
|
11927
12030
|
pinnable && monitor && pin && /* @__PURE__ */ jsx85(PinToggle, { ui, monitor, pin })
|
|
@@ -12516,7 +12619,7 @@ function OddsLiveStrip({ m, ui }) {
|
|
|
12516
12619
|
m.minuteLabel && /* @__PURE__ */ jsx91("span", { className: "ss-w-mon-min", children: m.minuteLabel }),
|
|
12517
12620
|
m.isSuspended && !m.isSettled && /* @__PURE__ */ jsx91("span", { className: "ss-w-mon-susp", children: ui.suspendedLabel }),
|
|
12518
12621
|
m.isSettled && /* @__PURE__ */ jsx91("span", { className: "ss-w-mon-pill", children: ui.fullTimeLabel }),
|
|
12519
|
-
stale && /* @__PURE__ */ jsx91("span", { className: "ss-w-mon-asof", children: ui.asOf(formatTime(m.asOfUtc, ui.locale, clockOf(ui))) })
|
|
12622
|
+
stale && /* @__PURE__ */ jsx91("span", { className: "ss-w-mon-asof", children: ui.asOf(formatTime(m.asOfUtc, ui.locale, clockOf(ui), { timeZone: ui.timeZone })) })
|
|
12520
12623
|
] });
|
|
12521
12624
|
}
|
|
12522
12625
|
function MatchesPanel({ monitor, ui, slip, onAsk, discovery }) {
|
|
@@ -12643,7 +12746,7 @@ var countryThenName = (a, b) => {
|
|
|
12643
12746
|
};
|
|
12644
12747
|
function matchSections(a) {
|
|
12645
12748
|
const live = (m) => isTreatedLive(a.states.get(keyOf3(m)), a.stale);
|
|
12646
|
-
const offset = offsetOf(a.date);
|
|
12749
|
+
const offset = offsetOf(a.date, a.timeZone);
|
|
12647
12750
|
const onDate = (m) => localDateOfUnix(m.kickoffUnix, offset) === a.date;
|
|
12648
12751
|
const afterMidnight = [];
|
|
12649
12752
|
const built = [];
|
|
@@ -12826,8 +12929,8 @@ function useModalDialog(onClose, opts = {}) {
|
|
|
12826
12929
|
|
|
12827
12930
|
// src/components/MatchSheet.tsx
|
|
12828
12931
|
import { jsx as jsx95, jsxs as jsxs89 } from "react/jsx-runtime";
|
|
12829
|
-
function kickoffDate(kickoffUnix, lang) {
|
|
12830
|
-
return formatDate(kickoffUnix * 1e3, lang, { weekday: "short", day: "numeric", month: "short" });
|
|
12932
|
+
function kickoffDate(kickoffUnix, lang, timeZone) {
|
|
12933
|
+
return formatDate(kickoffUnix * 1e3, lang, { weekday: "short", day: "numeric", month: "short", timeZone });
|
|
12831
12934
|
}
|
|
12832
12935
|
function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose, opener }) {
|
|
12833
12936
|
const { dialogRef, onKeyDown } = useModalDialog(onClose, { opener });
|
|
@@ -12880,7 +12983,7 @@ function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose,
|
|
|
12880
12983
|
};
|
|
12881
12984
|
const { score, when } = rowStatusOf(state, stale, ui);
|
|
12882
12985
|
const statusParts = [when, score].filter((v) => v !== null && v !== void 0);
|
|
12883
|
-
const status2 = statusParts.length > 0 ? statusParts.join(" \xB7 ") : ui.kickoffLine(kickoffDate(match.kickoffUnix, ui.locale), kickoffLabel(match.kickoffUnix, ui.locale, clockOf(ui)));
|
|
12986
|
+
const status2 = statusParts.length > 0 ? statusParts.join(" \xB7 ") : ui.kickoffLine(kickoffDate(match.kickoffUnix, ui.locale, ui.timeZone), kickoffLabel(match.kickoffUnix, ui.locale, clockOf(ui), ui.timeZone));
|
|
12884
12987
|
return /* @__PURE__ */ jsx95("div", { className: "ss-w-tool-backdrop ss-w-sheet-backdrop", onClick: onBackdrop, children: /* @__PURE__ */ jsxs89("div", { ref: dialogRef, className: "ss-w-tool ss-w-sheet", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, tabIndex: -1, onKeyDown, children: [
|
|
12885
12988
|
/* @__PURE__ */ jsxs89("div", { className: "ss-w-tool-head", children: [
|
|
12886
12989
|
/* @__PURE__ */ jsxs89("h2", { id: titleId, className: "ss-w-tool-title", children: [
|
|
@@ -13237,7 +13340,8 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
13237
13340
|
pinnedKeys,
|
|
13238
13341
|
isToday,
|
|
13239
13342
|
date: selected,
|
|
13240
|
-
query: q
|
|
13343
|
+
query: q,
|
|
13344
|
+
timeZone: ui.timeZone
|
|
13241
13345
|
});
|
|
13242
13346
|
const priced = sectionsFor("");
|
|
13243
13347
|
const { sections, afterMidnight } = searching ? sectionsFor(query) : priced;
|
|
@@ -16779,7 +16883,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
16779
16883
|
void request(lastRequest.current);
|
|
16780
16884
|
} }) : null
|
|
16781
16885
|
] }),
|
|
16782
|
-
quotedAt ? /* @__PURE__ */ jsx138("p", { className: "ss-w-v8-builder-note", "data-testid": "v8-asof", children: ui.v8PricesAsOf(fmtHhMm(quotedAt, ui.locale, clockOf(ui))) }) : null
|
|
16886
|
+
quotedAt ? /* @__PURE__ */ jsx138("p", { className: "ss-w-v8-builder-note", "data-testid": "v8-asof", children: ui.v8PricesAsOf(fmtHhMm(quotedAt, ui.locale, clockOf(ui), ui.timeZone)) }) : null
|
|
16783
16887
|
] }) : null
|
|
16784
16888
|
] }) : null });
|
|
16785
16889
|
}
|
|
@@ -20470,6 +20574,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
20470
20574
|
.ss-w-root[data-ss-w-theme="dark"] .ss-w-tni { --ss-w-tni-hard: #5b83c8; --ss-w-tni-clay: #e0835a; --ss-w-tni-grass: #5cc069; --ss-w-tni-other: #8b95a1; }
|
|
20471
20575
|
.ss-w-tni-svg { display: block; width: 100%; height: auto; max-width: 100%; overflow: hidden; font-variant-numeric: tabular-nums; }
|
|
20472
20576
|
.ss-w-tni-grid { stroke: var(--ss-w-line); stroke-width: 1; }
|
|
20577
|
+
.ss-w-tni-rline { stroke-dasharray: 2 3; opacity: 0.6; }
|
|
20473
20578
|
.ss-w-tni-tick { font-size: 9px; fill: var(--ss-w-faint); }
|
|
20474
20579
|
.ss-w-tni-axis { font-size: 9.5px; fill: var(--ss-w-faint); }
|
|
20475
20580
|
.ss-w-tni-dot { fill: var(--ss-w-ink); opacity: 0.35; }
|
|
@@ -20623,7 +20728,8 @@ function StatsWidget(props) {
|
|
|
20623
20728
|
operatorUserId,
|
|
20624
20729
|
anonymousUserId,
|
|
20625
20730
|
isOpen: panelOpen,
|
|
20626
|
-
pinnedMatchIds
|
|
20731
|
+
pinnedMatchIds,
|
|
20732
|
+
timeZone: ui.timeZone
|
|
20627
20733
|
});
|
|
20628
20734
|
const offeredSports = useMemo13(() => {
|
|
20629
20735
|
const seen = new Set(discovery.matchDays.map((d) => d.sport));
|
|
@@ -20638,7 +20744,8 @@ function StatsWidget(props) {
|
|
|
20638
20744
|
day: matchesDay,
|
|
20639
20745
|
sport: scheduleSport.sport,
|
|
20640
20746
|
getSchedule,
|
|
20641
|
-
enabled: panelOpen && monitor.activeTab === "matches"
|
|
20747
|
+
enabled: panelOpen && monitor.activeTab === "matches",
|
|
20748
|
+
timeZone: ui.timeZone
|
|
20642
20749
|
});
|
|
20643
20750
|
const prevLiveSnapshotRef = useRef43(monitor.snapshot);
|
|
20644
20751
|
useEffect52(() => {
|