@sensiblestats/widget-react 0.128.1 → 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/dist/index.cjs CHANGED
@@ -935,19 +935,69 @@ var formatTime = (when, tag2, clock3, opts) => formatDate(when, tag2, { ...clock
935
935
  var clockOf = (ui) => ui.clock ?? "24h";
936
936
  var formatFixed = (n, tag2, digits) => formatNumber(n, tag2, { minimumFractionDigits: digits, maximumFractionDigits: digits });
937
937
 
938
+ // src/zone.ts
939
+ var DAY_MS = 864e5;
940
+ var formatters = /* @__PURE__ */ new Map();
941
+ var formatterFor = (timeZone) => {
942
+ let f = formatters.get(timeZone);
943
+ if (!f) {
944
+ f = new Intl.DateTimeFormat(BUNDLED_TAG, {
945
+ timeZone,
946
+ year: "numeric",
947
+ month: "2-digit",
948
+ day: "2-digit",
949
+ hour: "2-digit",
950
+ minute: "2-digit",
951
+ second: "2-digit",
952
+ hourCycle: "h23"
953
+ });
954
+ formatters.set(timeZone, f);
955
+ }
956
+ return f;
957
+ };
958
+ function validZone(timeZone) {
959
+ if (typeof timeZone !== "string" || timeZone.trim() === "") return void 0;
960
+ const zone = timeZone.trim();
961
+ try {
962
+ new Intl.DateTimeFormat("en", { timeZone: zone });
963
+ return zone;
964
+ } catch {
965
+ return void 0;
966
+ }
967
+ }
968
+ function zonedParts(ms, timeZone) {
969
+ const out = { year: NaN, month: NaN, day: NaN, hour: NaN, minute: NaN, second: NaN };
970
+ if (Number.isNaN(ms)) return out;
971
+ if (timeZone === void 0) {
972
+ const d = new Date(ms);
973
+ return { year: d.getFullYear(), month: d.getMonth() + 1, day: d.getDate(), hour: d.getHours(), minute: d.getMinutes(), second: d.getSeconds() };
974
+ }
975
+ for (const p of formatterFor(timeZone).formatToParts(ms)) {
976
+ if (p.type in out) out[p.type] = Number(p.value);
977
+ }
978
+ return out;
979
+ }
980
+ function zonedDayNumber(ms, timeZone) {
981
+ const p = zonedParts(ms, timeZone);
982
+ return Date.UTC(p.year, p.month - 1, p.day) / DAY_MS;
983
+ }
984
+ function zoneOffsetMinutes(ms, timeZone) {
985
+ const p = zonedParts(ms, timeZone);
986
+ const wall = Date.UTC(p.year, p.month - 1, p.day, p.hour, p.minute, p.second);
987
+ return Math.round((wall - Math.floor(ms / 1e3) * 1e3) / 6e4);
988
+ }
989
+
938
990
  // src/kickoff.ts
939
- function formatBettingKickoff(kickoffUtc, ui, tag2, clock3 = "24h", now = /* @__PURE__ */ new Date()) {
991
+ function formatBettingKickoff(kickoffUtc, ui, tag2, clock3 = "24h", now = /* @__PURE__ */ new Date(), timeZone) {
940
992
  const at2 = new Date(kickoffUtc);
941
- const time = formatTime(at2, tag2, clock3);
942
- const atLocalDate = new Date(at2.getFullYear(), at2.getMonth(), at2.getDate());
943
- const nowLocalDate = new Date(now.getFullYear(), now.getMonth(), now.getDate());
944
- const dayDiff = Math.round((atLocalDate.getTime() - nowLocalDate.getTime()) / 864e5);
945
- const dayLabel = dayDiff === 0 ? ui.today : dayDiff === 1 ? ui.tomorrow : formatDate(at2, tag2, { weekday: "short", day: "numeric", month: "short" });
993
+ const time = formatTime(at2, tag2, clock3, { timeZone });
994
+ const dayDiff = zonedDayNumber(at2.getTime(), timeZone) - zonedDayNumber(now.getTime(), timeZone);
995
+ const dayLabel = dayDiff === 0 ? ui.today : dayDiff === 1 ? ui.tomorrow : formatDate(at2, tag2, { weekday: "short", day: "numeric", month: "short", timeZone });
946
996
  return { dayLabel, time };
947
997
  }
948
998
 
949
999
  // src/nbaFormDay.ts
950
- var DAY_MS = 864e5;
1000
+ var DAY_MS2 = 864e5;
951
1001
  var ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
952
1002
  function utcMs(etDate) {
953
1003
  if (!ISO_DATE.test(etDate)) return null;
@@ -959,7 +1009,7 @@ function formDay(etDate, anchorEtDate, tag2) {
959
1009
  const at2 = utcMs(etDate);
960
1010
  if (at2 === null) return etDate;
961
1011
  const anchor = utcMs(anchorEtDate);
962
- const days = anchor === null ? Infinity : Math.abs(Math.round((at2 - anchor) / DAY_MS));
1012
+ const days = anchor === null ? Infinity : Math.abs(Math.round((at2 - anchor) / DAY_MS2));
963
1013
  const options = days <= 6 ? { weekday: "short", timeZone: "UTC" } : { day: "numeric", month: "short", timeZone: "UTC" };
964
1014
  return formatDate(at2, tag2, options);
965
1015
  }
@@ -1015,13 +1065,13 @@ var shortDate = (tag2, ms, opts) => nbsp(formatDate(ms, tag2, opts).replace("Sep
1015
1065
  var signed = (line) => line.replace(/^-/, "\u2212");
1016
1066
  var decimalMark = (tag2) => new Intl.NumberFormat(tag2).formatToParts(1.1).find((p) => p.type === "decimal")?.value ?? ".";
1017
1067
  var INTL_LEAVES = {
1018
- chartTimeLabel: (c) => (ms) => formatDate(ms, c.tag, { day: "numeric", month: "short", ...clockFields(c.clock) }),
1019
- logShortDate: (c) => (ms) => shortDate(c.tag, ms, { day: "numeric", month: "short" }),
1068
+ chartTimeLabel: (c) => (ms) => formatDate(ms, c.tag, { day: "numeric", month: "short", ...clockFields(c.clock), timeZone: c.timeZone }),
1069
+ logShortDate: (c) => (ms) => shortDate(c.tag, ms, { day: "numeric", month: "short", timeZone: c.timeZone }),
1020
1070
  "games.formatPts": (c) => (n) => formatNumber(n, c.tag),
1021
- "games.formatDayTime": (c) => (iso) => formatDate(iso, c.tag, { weekday: "short", ...clockFields(c.clock) }),
1071
+ "games.formatDayTime": (c) => (iso) => formatDate(iso, c.tag, { weekday: "short", ...clockFields(c.clock), timeZone: c.timeZone }),
1022
1072
  "nba.lineText": (c) => (line) => signed(line).replace(".", decimalMark(c.tag)),
1023
1073
  "nba.formDay": (c) => (etDate, anchorEtDate) => formDay(etDate, anchorEtDate, c.tag),
1024
- bettingKickoff: (c) => (kickoffUtc, now) => formatBettingKickoff(kickoffUtc, { today: c.t("widget.today"), tomorrow: c.t("widget.tomorrow") }, c.tag, c.clock, now),
1074
+ bettingKickoff: (c) => (kickoffUtc, now) => formatBettingKickoff(kickoffUtc, { today: c.t("widget.today"), tomorrow: c.t("widget.tomorrow") }, c.tag, c.clock, now, c.timeZone),
1025
1075
  v8FormResult: (c) => (result) => codeLabel(c.table, "result", result) ?? result
1026
1076
  };
1027
1077
  var pairs = (c, key, list) => list.map(([home, away]) => c.t(key, { home, away })).join(", ");
@@ -1054,7 +1104,7 @@ var ROW_LEAVES = {
1054
1104
  availabilityNext: (c) => (opponent, isHome, ms) => {
1055
1105
  const line = c.t(isHome ? "widget.availabilityNext.home" : "widget.availabilityNext.away", { opponent });
1056
1106
  if (ms === null || !(ms > 0)) return line;
1057
- return c.t("widget.availabilityNext.dated", { text: line, date: shortDate(c.tag, ms, { weekday: "short", day: "numeric", month: "short" }) });
1107
+ return c.t("widget.availabilityNext.dated", { text: line, date: shortDate(c.tag, ms, { weekday: "short", day: "numeric", month: "short", timeZone: c.timeZone }) });
1058
1108
  },
1059
1109
  availabilityBack: (c) => (ms) => c.t("widget.availabilityBack", { date: shortDate(c.tag, ms, { day: "numeric", month: "short" }) }),
1060
1110
  perfRankedAgainst: (c) => (competition, group) => c.t("widget.perfRankedAgainst", { competition, group: codeLabel(c.table, "groupNoun", group) ?? group }),
@@ -1225,7 +1275,7 @@ function setPath(root, path, value) {
1225
1275
  node[parts2[parts2.length - 1]] = value;
1226
1276
  }
1227
1277
  var ownedByLeaf = (key) => key.startsWith("widget.code.") || Object.keys(LEAVES).some((path) => key === `widget.${path}` || key.startsWith(`widget.${path}.`));
1228
- function buildLocaleStrings(table, tag2, clock3 = "24h") {
1278
+ function buildLocaleStrings(table, tag2, clock3 = "24h", timeZone) {
1229
1279
  const root = {};
1230
1280
  for (const [key, row] of Object.entries(table)) {
1231
1281
  if (key.startsWith("widget.") && typeof row === "string" && !ownedByLeaf(key)) setPath(root, key.slice("widget.".length), row);
@@ -1233,6 +1283,7 @@ function buildLocaleStrings(table, tag2, clock3 = "24h") {
1233
1283
  const ctx = {
1234
1284
  tag: tag2,
1235
1285
  clock: clock3,
1286
+ timeZone,
1236
1287
  table,
1237
1288
  t: (key, tokens = {}) => fill(table[key] ?? key, tokens, tag2)
1238
1289
  };
@@ -1257,7 +1308,7 @@ function parseOddsFormat(value) {
1257
1308
  }
1258
1309
 
1259
1310
  // src/version.generated.ts
1260
- var WIDGET_REACT_VERSION = "0.128.1";
1311
+ var WIDGET_REACT_VERSION = "0.129.0";
1261
1312
 
1262
1313
  // src/config.ts
1263
1314
  function hostTag(cfg) {
@@ -1266,7 +1317,8 @@ function hostTag(cfg) {
1266
1317
  }
1267
1318
  var isBundledFamily = (tag2) => sameFamily(tag2, BUNDLED_TAG);
1268
1319
  function normalizeUi(cfg, loaded) {
1269
- const strings = buildLocaleStrings(loaded.strings, loaded.tag, loaded.clock);
1320
+ const timeZone = validZone(cfg.timeZone);
1321
+ const strings = buildLocaleStrings(loaded.strings, loaded.tag, loaded.clock, timeZone);
1270
1322
  return {
1271
1323
  theme: cfg.theme ?? "auto",
1272
1324
  oddsFormat: parseOddsFormat(cfg.oddsFormat) ?? "decimal",
@@ -1275,6 +1327,7 @@ function normalizeUi(cfg, loaded) {
1275
1327
  headerTitle: cfg.headerTitle,
1276
1328
  locale: loaded.tag,
1277
1329
  clock: loaded.clock,
1330
+ timeZone,
1278
1331
  hostTag: hostTag(cfg),
1279
1332
  rawBettingLabels: isBundledFamily(loaded.tag),
1280
1333
  cta: cfg.cta,
@@ -1780,9 +1833,9 @@ function projectSeries(samples) {
1780
1833
  yMin = pMin - FLAT_DOMAIN_PAD;
1781
1834
  yMax = pMax + FLAT_DOMAIN_PAD;
1782
1835
  } else {
1783
- const pad2 = (pMax - pMin) * 0.1;
1784
- yMin = pMin - pad2;
1785
- yMax = pMax + pad2;
1836
+ const pad = (pMax - pMin) * 0.1;
1837
+ yMin = pMin - pad;
1838
+ yMax = pMax + pad;
1786
1839
  }
1787
1840
  const x = (atMs) => round2(PLOT_X0 + (atMs - tMin) / (tMax - tMin) * (PLOT_X1 - PLOT_X0));
1788
1841
  const y = (price) => round2(PLOT_Y1 - (price - yMin) / (yMax - yMin) * (PLOT_Y1 - PLOT_Y0));
@@ -3545,12 +3598,12 @@ var import_widget_sdk13 = require("@sensiblestats/widget-sdk");
3545
3598
  var PREFIX2 = "ss-w-schedule:";
3546
3599
  var SCHEMA_VERSION = 7;
3547
3600
  var TTL_MS3 = 6 * 36e5;
3548
- function scheduleCacheKey(operatorId, encodedUserKey2, localDate) {
3549
- return `${PREFIX2}${operatorId}:${encodedUserKey2}:${localDate}`;
3601
+ function scheduleCacheKey(operatorId, encodedUserKey2, localDate, timeZone) {
3602
+ return `${PREFIX2}${operatorId}:${encodedUserKey2}:${timeZone ?? "local"}:${localDate}`;
3550
3603
  }
3551
- function read(operatorId, encodedUserKey2, localDate) {
3604
+ function read(operatorId, encodedUserKey2, localDate, timeZone) {
3552
3605
  try {
3553
- const raw = localStorage.getItem(scheduleCacheKey(operatorId, encodedUserKey2, localDate));
3606
+ const raw = localStorage.getItem(scheduleCacheKey(operatorId, encodedUserKey2, localDate, timeZone));
3554
3607
  if (!raw) return null;
3555
3608
  const entry = JSON.parse(raw);
3556
3609
  if (entry.v !== SCHEMA_VERSION || !entry.payload) return null;
@@ -3559,13 +3612,13 @@ function read(operatorId, encodedUserKey2, localDate) {
3559
3612
  return null;
3560
3613
  }
3561
3614
  }
3562
- function readSchedule(operatorId, encodedUserKey2, localDate, nowMs) {
3563
- const entry = read(operatorId, encodedUserKey2, localDate);
3615
+ function readSchedule(operatorId, encodedUserKey2, localDate, nowMs, timeZone) {
3616
+ const entry = read(operatorId, encodedUserKey2, localDate, timeZone);
3564
3617
  if (!entry) return null;
3565
3618
  return nowMs - entry.at > TTL_MS3 ? null : entry.payload;
3566
3619
  }
3567
- function readScheduleIgnoringTtl(operatorId, encodedUserKey2, localDate) {
3568
- return read(operatorId, encodedUserKey2, localDate)?.payload ?? null;
3620
+ function readScheduleIgnoringTtl(operatorId, encodedUserKey2, localDate, timeZone) {
3621
+ return read(operatorId, encodedUserKey2, localDate, timeZone)?.payload ?? null;
3569
3622
  }
3570
3623
  function skeletonOnly(payload) {
3571
3624
  return {
@@ -3604,8 +3657,8 @@ function skeletonOnly(payload) {
3604
3657
  }))
3605
3658
  };
3606
3659
  }
3607
- function writeSchedule(operatorId, encodedUserKey2, localDate, payload, nowMs) {
3608
- const keep = scheduleCacheKey(operatorId, encodedUserKey2, localDate);
3660
+ function writeSchedule(operatorId, encodedUserKey2, localDate, payload, nowMs, timeZone) {
3661
+ const keep = scheduleCacheKey(operatorId, encodedUserKey2, localDate, timeZone);
3609
3662
  const mine = `${PREFIX2}${operatorId}:${encodedUserKey2}:`;
3610
3663
  try {
3611
3664
  for (let i = localStorage.length - 1; i >= 0; i--) {
@@ -3617,9 +3670,9 @@ function writeSchedule(operatorId, encodedUserKey2, localDate, payload, nowMs) {
3617
3670
  } catch {
3618
3671
  }
3619
3672
  }
3620
- function clearSchedule(operatorId, encodedUserKey2, localDate) {
3673
+ function clearSchedule(operatorId, encodedUserKey2, localDate, timeZone) {
3621
3674
  try {
3622
- localStorage.removeItem(scheduleCacheKey(operatorId, encodedUserKey2, localDate));
3675
+ localStorage.removeItem(scheduleCacheKey(operatorId, encodedUserKey2, localDate, timeZone));
3623
3676
  } catch {
3624
3677
  }
3625
3678
  }
@@ -3661,6 +3714,51 @@ function nearestTennisKeys(open) {
3661
3714
  return [...open.values()].sort((a, b) => a.kickoffUnix - b.kickoffUnix).slice(0, MAX_TENNIS_KEYS).map((e) => e.key);
3662
3715
  }
3663
3716
 
3717
+ // src/scheduleDays.ts
3718
+ var MAX_AFTER_TODAY = 6;
3719
+ var parts = (date) => {
3720
+ const [y = 0, m = 1, d = 1] = date.split("-").map(Number);
3721
+ return [y, m, d];
3722
+ };
3723
+ function offsetOf(localDate, timeZone) {
3724
+ const [y, m, d] = parts(localDate);
3725
+ if (timeZone === void 0) return -new Date(y, m - 1, d, 12).getTimezoneOffset();
3726
+ const utcNoon = Date.UTC(y, m - 1, d, 12);
3727
+ return zoneOffsetMinutes(utcNoon - zoneOffsetMinutes(utcNoon, timeZone) * 6e4, timeZone);
3728
+ }
3729
+ function localDateOfUnix(unix, offsetMinutes = -new Date(unix * 1e3).getTimezoneOffset()) {
3730
+ return new Date((unix + offsetMinutes * 60) * 1e3).toISOString().slice(0, 10);
3731
+ }
3732
+ var dayAfter = (date) => {
3733
+ const [y, m, d] = parts(date);
3734
+ return new Date(Date.UTC(y, m - 1, d + 1)).toISOString().slice(0, 10);
3735
+ };
3736
+ function buildDayChips(today, matchDays, sport) {
3737
+ const dates = /* @__PURE__ */ new Set();
3738
+ for (const md of matchDays) {
3739
+ if (sport !== "all" && md.sport !== sport) continue;
3740
+ for (const date of md.dates) if (date > today) dates.add(date);
3741
+ }
3742
+ const chips = [{ date: today, isToday: true, gapBefore: false }];
3743
+ for (const date of [...dates].sort().slice(0, MAX_AFTER_TODAY)) {
3744
+ const prev = chips[chips.length - 1];
3745
+ chips.push({ date, isToday: false, gapBefore: prev !== void 0 && dayAfter(prev.date) !== date });
3746
+ }
3747
+ return chips;
3748
+ }
3749
+ function weekdayAndDay(date, tag2) {
3750
+ const [y, m, d] = parts(date);
3751
+ const at2 = new Date(Date.UTC(y, m - 1, d, 12));
3752
+ return {
3753
+ weekday: formatDate(at2, tag2, { weekday: "short", timeZone: "UTC" }),
3754
+ day: formatDate(at2, tag2, { day: "numeric", timeZone: "UTC" })
3755
+ };
3756
+ }
3757
+ function weekdayLong(date, tag2) {
3758
+ const [y, m, d] = parts(date);
3759
+ return formatDate(new Date(Date.UTC(y, m - 1, d, 12)), tag2, { weekday: "long", timeZone: "UTC" });
3760
+ }
3761
+
3664
3762
  // src/liveClock.ts
3665
3763
  var import_widget_sdk12 = require("@sensiblestats/widget-sdk");
3666
3764
  function isTreatedLive(state, pollStale) {
@@ -3680,7 +3778,11 @@ var STALE_AFTER_FAILURES = 2;
3680
3778
  function encodedUserKey(operatorUserId, anonymousUserId) {
3681
3779
  return encodeURIComponent(operatorUserId || anonymousUserId || "none");
3682
3780
  }
3683
- function localDateOf(now) {
3781
+ function localDateOf(now, timeZone) {
3782
+ if (timeZone !== void 0) {
3783
+ const p = zonedParts(now.getTime(), timeZone);
3784
+ return `${p.year}-${`${p.month}`.padStart(2, "0")}-${`${p.day}`.padStart(2, "0")}`;
3785
+ }
3684
3786
  const y = now.getFullYear();
3685
3787
  const m = `${now.getMonth() + 1}`.padStart(2, "0");
3686
3788
  const d = `${now.getDate()}`.padStart(2, "0");
@@ -3706,19 +3808,19 @@ function useMatchDiscovery(opts) {
3706
3808
  statesRef.current = states;
3707
3809
  const getStatesRef = (0, import_react5.useRef)(opts.getStates);
3708
3810
  getStatesRef.current = opts.getStates;
3709
- const [localDate, setLocalDate] = (0, import_react5.useState)(() => localDateOf(/* @__PURE__ */ new Date()));
3811
+ const [localDate, setLocalDate] = (0, import_react5.useState)(() => localDateOf(/* @__PURE__ */ new Date(), opts.timeZone));
3710
3812
  (0, import_react5.useEffect)(() => {
3711
3813
  const id = setInterval(() => {
3712
- const next = localDateOf(/* @__PURE__ */ new Date());
3814
+ const next = localDateOf(/* @__PURE__ */ new Date(), opts.timeZone);
3713
3815
  setLocalDate((prev) => prev === next ? prev : next);
3714
3816
  }, ROLLOVER_CHECK_MS);
3715
3817
  return () => clearInterval(id);
3716
- }, []);
3818
+ }, [opts.timeZone]);
3717
3819
  (0, import_react5.useEffect)(() => {
3718
3820
  let cancelled = false;
3719
- const utcOffsetMinutes = -(/* @__PURE__ */ new Date()).getTimezoneOffset();
3821
+ const utcOffsetMinutes = opts.timeZone === void 0 ? -(/* @__PURE__ */ new Date()).getTimezoneOffset() : offsetOf(localDate, opts.timeZone);
3720
3822
  const key = encodedUserKey(opts.operatorUserId, opts.anonymousUserId);
3721
- const cached = readSchedule(opts.operatorId, key, localDate, Date.now());
3823
+ const cached = readSchedule(opts.operatorId, key, localDate, Date.now(), opts.timeZone);
3722
3824
  if (cached) {
3723
3825
  if (!cancelled) {
3724
3826
  setGroups(cached.groups);
@@ -3738,12 +3840,12 @@ function useMatchDiscovery(opts) {
3738
3840
  setScheduleLoaded(true);
3739
3841
  return;
3740
3842
  }
3741
- writeSchedule(opts.operatorId, key, localDate, payload, Date.now());
3843
+ writeSchedule(opts.operatorId, key, localDate, payload, Date.now(), opts.timeZone);
3742
3844
  setGroups(payload.groups);
3743
3845
  setMatchDays(payload.matchDays ?? []);
3744
3846
  setScheduleLoaded(true);
3745
3847
  } catch {
3746
- const fallback = readScheduleIgnoringTtl(opts.operatorId, key, localDate);
3848
+ const fallback = readScheduleIgnoringTtl(opts.operatorId, key, localDate, opts.timeZone);
3747
3849
  if (!cancelled && fallback) {
3748
3850
  setGroups(fallback.groups);
3749
3851
  setMatchDays(fallback.matchDays ?? []);
@@ -3754,7 +3856,7 @@ function useMatchDiscovery(opts) {
3754
3856
  return () => {
3755
3857
  cancelled = true;
3756
3858
  };
3757
- }, [opts.operatorId, opts.operatorUserId, opts.anonymousUserId, localDate, refreshKey]);
3859
+ }, [opts.operatorId, opts.operatorUserId, opts.anonymousUserId, localDate, refreshKey, opts.timeZone]);
3758
3860
  const tick = (0, import_react5.useCallback)(async () => {
3759
3861
  const ids = dueMatchIds(groupsRef.current, statesRef.current, Date.now());
3760
3862
  if (ids.football.length === 0 && ids.nba.length === 0 && ids.nfl.length === 0 && ids.tennis.length === 0) return;
@@ -3789,10 +3891,10 @@ function useMatchDiscovery(opts) {
3789
3891
  return n;
3790
3892
  }, [groups, states, stale]);
3791
3893
  const refreshSchedule = (0, import_react5.useCallback)(async () => {
3792
- clearSchedule(opts.operatorId, encodedUserKey(opts.operatorUserId, opts.anonymousUserId), localDate);
3894
+ clearSchedule(opts.operatorId, encodedUserKey(opts.operatorUserId, opts.anonymousUserId), localDate, opts.timeZone);
3793
3895
  setRefreshKey((n) => n + 1);
3794
3896
  setScheduleVersion((n) => n + 1);
3795
- }, [opts.operatorId, opts.operatorUserId, opts.anonymousUserId, localDate]);
3897
+ }, [opts.operatorId, opts.operatorUserId, opts.anonymousUserId, localDate, opts.timeZone]);
3796
3898
  return { groups, localDate, matchDays, scheduleLoaded, states, liveCount, stale, refreshSchedule, scheduleVersion, _tick: tick };
3797
3899
  }
3798
3900
 
@@ -6327,8 +6429,8 @@ function OddsRow({ vm, row, ui, slip, inSlipIds, history, suppressSlip }) {
6327
6429
  ] });
6328
6430
  }
6329
6431
  var STALE_AFTER_MS = 12e4;
6330
- function fmtHhMm(iso, tag2, clock3) {
6331
- return formatTime(iso, tag2, clock3);
6432
+ function fmtHhMm(iso, tag2, clock3, timeZone) {
6433
+ return formatTime(iso, tag2, clock3, { timeZone });
6332
6434
  }
6333
6435
  function MarketOddsCard({ vm, ui, slip, monitor, inSlipIds, hideHeader, pinRef }) {
6334
6436
  const [open, setOpen] = (0, import_react33.useState)(false);
@@ -6341,7 +6443,7 @@ function MarketOddsCard({ vm, ui, slip, monitor, inSlipIds, hideHeader, pinRef }
6341
6443
  const isClosed = closedReason !== null;
6342
6444
  const asOfMs = live ? new Date(live.asOfUtc).getTime() : NaN;
6343
6445
  const isStale = live != null && !isClosed && (vm.awaitingLiveUpdate === true || Date.now() - asOfMs > STALE_AFTER_MS);
6344
- const staleTime = isStale && live ? fmtHhMm(live.asOfUtc, ui.locale, clockOf(ui)) : null;
6446
+ const staleTime = isStale && live ? fmtHhMm(live.asOfUtc, ui.locale, clockOf(ui), ui.timeZone) : null;
6345
6447
  const [, setStaleTick] = (0, import_react33.useState)(0);
6346
6448
  const watchStale = live != null && !isClosed && !isStale;
6347
6449
  (0, import_react33.useEffect)(() => {
@@ -6467,9 +6569,9 @@ function allowedForStars(stars, leg) {
6467
6569
  var import_jsx_runtime13 = require("react/jsx-runtime");
6468
6570
  var asOf = (iso, ui) => {
6469
6571
  const at2 = new Date(iso);
6470
- const time = fmtHhMm(iso, ui.locale, clockOf(ui));
6471
- if (at2.toDateString() === (/* @__PURE__ */ new Date()).toDateString()) return time;
6472
- return `${formatDate(at2, ui.locale, { day: "numeric", month: "short" })} ${time}`;
6572
+ const time = fmtHhMm(iso, ui.locale, clockOf(ui), ui.timeZone);
6573
+ if (zonedDayNumber(at2.getTime(), ui.timeZone) === zonedDayNumber(Date.now(), ui.timeZone)) return time;
6574
+ return `${formatDate(at2, ui.locale, { day: "numeric", month: "short", timeZone: ui.timeZone })} ${time}`;
6473
6575
  };
6474
6576
  function CardLine({ card, ui, slip, sport, marketKey, conversation, operatorUserId, anonymousUserId }) {
6475
6577
  const matchId = card.matchId;
@@ -6691,9 +6793,8 @@ function instantMs(iso) {
6691
6793
  const ms = Date.parse(iso);
6692
6794
  return Number.isNaN(ms) ? null : ms;
6693
6795
  }
6694
- function localDayStart(ms) {
6695
- const d = new Date(ms);
6696
- return new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime();
6796
+ function localDayStart(ms, timeZone) {
6797
+ return zonedDayNumber(ms, timeZone) * 864e5;
6697
6798
  }
6698
6799
  function kickoffText(ui, iso) {
6699
6800
  if (instantMs(iso) === null) return null;
@@ -6858,15 +6959,15 @@ function MatchCard({ card, ui, slip, sport, marketKey, conversation, operatorUse
6858
6959
  var import_jsx_runtime22 = require("react/jsx-runtime");
6859
6960
  var STATUSES = ["available", "doubtful", "out"];
6860
6961
  var MAX_MARKS = 30;
6861
- var pad = (n) => String(n).padStart(2, "0");
6862
- function clock(iso) {
6962
+ function clock(iso, ui) {
6863
6963
  if (!iso) return null;
6864
6964
  const at2 = new Date(iso);
6865
- return Number.isNaN(at2.getTime()) ? null : `${pad(at2.getHours())}:${pad(at2.getMinutes())}`;
6965
+ if (Number.isNaN(at2.getTime())) return null;
6966
+ return formatTime(at2, ui.locale, clockOf(ui), { timeZone: ui.timeZone });
6866
6967
  }
6867
6968
  function badge(card, ui) {
6868
6969
  if (card.status === "out") {
6869
- const time = clock(card.statusAsOfUtc);
6970
+ const time = clock(card.statusAsOfUtc, ui);
6870
6971
  return { kind: "out", text: time ? ui.v8Out(time) : ui.v8OutNoTime };
6871
6972
  }
6872
6973
  return card.status === "doubtful" ? { kind: "doubtful", text: ui.v8Doubtful } : null;
@@ -6914,10 +7015,10 @@ function SinceLines({ since, ui }) {
6914
7015
  // src/components/dashboard/v8/YouRibbon.tsx
6915
7016
  var import_jsx_runtime24 = require("react/jsx-runtime");
6916
7017
  var FROM_CHATS_SHOWN = 2;
6917
- function showsNoGamesNote(chip, now = Date.now()) {
7018
+ function showsNoGamesNote(chip, now = Date.now(), timeZone) {
6918
7019
  if (chip.kind !== "competition") return false;
6919
7020
  const at2 = instantMs(chip.nextGameAtUtc);
6920
- if (at2 !== null) return localDayStart(at2) > localDayStart(now);
7021
+ if (at2 !== null) return localDayStart(at2, timeZone) > localDayStart(now, timeZone);
6921
7022
  return chip.noGamesToday === true;
6922
7023
  }
6923
7024
  function YouRibbon({ ribbon, ui, controller, holds, sport, onMore }) {
@@ -6927,7 +7028,7 @@ function YouRibbon({ ribbon, ui, controller, holds, sport, onMore }) {
6927
7028
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("section", { className: "ss-w-v8-sec ss-w-v8-ribbon", children: [
6928
7029
  /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "ss-w-v8-chips", children: [
6929
7030
  ribbon.stars.map((chip, i) => {
6930
- const quiet = showsNoGamesNote(chip);
7031
+ const quiet = showsNoGamesNote(chip, Date.now(), ui.timeZone);
6931
7032
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: `ss-w-v8-chip ss-w-v8-chip--${chip.kind}`, children: [
6932
7033
  chip.playing && !quiet ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("i", { className: "ss-w-v8-playing", "aria-hidden": "true" }) : null,
6933
7034
  chip.label,
@@ -7140,54 +7241,9 @@ var import_react40 = require("react");
7140
7241
 
7141
7242
  // src/useScheduleDay.ts
7142
7243
  var import_react39 = require("react");
7143
-
7144
- // src/scheduleDays.ts
7145
- var MAX_AFTER_TODAY = 6;
7146
- var parts = (date) => {
7147
- const [y = 0, m = 1, d = 1] = date.split("-").map(Number);
7148
- return [y, m, d];
7149
- };
7150
- function offsetOf(localDate) {
7151
- const [y, m, d] = parts(localDate);
7152
- return -new Date(y, m - 1, d, 12).getTimezoneOffset();
7153
- }
7154
- function localDateOfUnix(unix, offsetMinutes = -new Date(unix * 1e3).getTimezoneOffset()) {
7155
- return new Date((unix + offsetMinutes * 60) * 1e3).toISOString().slice(0, 10);
7156
- }
7157
- var dayAfter = (date) => {
7158
- const [y, m, d] = parts(date);
7159
- return new Date(Date.UTC(y, m - 1, d + 1)).toISOString().slice(0, 10);
7160
- };
7161
- function buildDayChips(today, matchDays, sport) {
7162
- const dates = /* @__PURE__ */ new Set();
7163
- for (const md of matchDays) {
7164
- if (sport !== "all" && md.sport !== sport) continue;
7165
- for (const date of md.dates) if (date > today) dates.add(date);
7166
- }
7167
- const chips = [{ date: today, isToday: true, gapBefore: false }];
7168
- for (const date of [...dates].sort().slice(0, MAX_AFTER_TODAY)) {
7169
- const prev = chips[chips.length - 1];
7170
- chips.push({ date, isToday: false, gapBefore: prev !== void 0 && dayAfter(prev.date) !== date });
7171
- }
7172
- return chips;
7173
- }
7174
- function weekdayAndDay(date, tag2) {
7175
- const [y, m, d] = parts(date);
7176
- const at2 = new Date(Date.UTC(y, m - 1, d, 12));
7177
- return {
7178
- weekday: formatDate(at2, tag2, { weekday: "short", timeZone: "UTC" }),
7179
- day: formatDate(at2, tag2, { day: "numeric", timeZone: "UTC" })
7180
- };
7181
- }
7182
- function weekdayLong(date, tag2) {
7183
- const [y, m, d] = parts(date);
7184
- return formatDate(new Date(Date.UTC(y, m - 1, d, 12)), tag2, { weekday: "long", timeZone: "UTC" });
7185
- }
7186
-
7187
- // src/useScheduleDay.ts
7188
7244
  var EMPTY = [];
7189
7245
  function useScheduleDay(opts) {
7190
- const { localDate, today, todayGroups, enabled, resetKey } = opts;
7246
+ const { localDate, today, todayGroups, enabled, resetKey, timeZone } = opts;
7191
7247
  const getRef = (0, import_react39.useRef)(opts.getSchedule);
7192
7248
  getRef.current = opts.getSchedule;
7193
7249
  const daysRef = (0, import_react39.useRef)(/* @__PURE__ */ new Map());
@@ -7195,12 +7251,14 @@ function useScheduleDay(opts) {
7195
7251
  const [retryKey, setRetryKey] = (0, import_react39.useState)(0);
7196
7252
  const [seenDate, setSeenDate] = (0, import_react39.useState)(localDate);
7197
7253
  const [seenReset, setSeenReset] = (0, import_react39.useState)(resetKey);
7254
+ const [seenZone, setSeenZone] = (0, import_react39.useState)(timeZone);
7198
7255
  if (seenDate !== localDate) {
7199
7256
  setSeenDate(localDate);
7200
7257
  setFetched({ status: "idle", groups: EMPTY });
7201
7258
  }
7202
- if (seenReset !== resetKey) {
7259
+ if (seenReset !== resetKey || seenZone !== timeZone) {
7203
7260
  setSeenReset(resetKey);
7261
+ setSeenZone(timeZone);
7204
7262
  daysRef.current.clear();
7205
7263
  setFetched({ status: "idle", groups: EMPTY });
7206
7264
  }
@@ -7211,7 +7269,7 @@ function useScheduleDay(opts) {
7211
7269
  setFetched({ status: "loading", groups: EMPTY });
7212
7270
  void (async () => {
7213
7271
  try {
7214
- const payload = await getRef.current(localDate, offsetOf(localDate));
7272
+ const payload = await getRef.current(localDate, offsetOf(localDate, timeZone));
7215
7273
  if (cancelled) return;
7216
7274
  if (!payload) {
7217
7275
  setFetched({ status: "error", groups: EMPTY });
@@ -7226,7 +7284,7 @@ function useScheduleDay(opts) {
7226
7284
  return () => {
7227
7285
  cancelled = true;
7228
7286
  };
7229
- }, [localDate, isToday, enabled, retryKey, resetKey]);
7287
+ }, [localDate, isToday, enabled, retryKey, resetKey, timeZone]);
7230
7288
  const retry = (0, import_react39.useCallback)(() => {
7231
7289
  setRetryKey((k) => k + 1);
7232
7290
  }, []);
@@ -7238,7 +7296,7 @@ function useScheduleDay(opts) {
7238
7296
  }
7239
7297
 
7240
7298
  // src/useMatchesDay.ts
7241
- function useMatchesDay({ discovery, day, sport, getSchedule, enabled }) {
7299
+ function useMatchesDay({ discovery, day, sport, getSchedule, enabled, timeZone }) {
7242
7300
  const { localDate: today, matchDays } = discovery;
7243
7301
  const chips = (0, import_react40.useMemo)(() => buildDayChips(today, matchDays, sport), [today, matchDays, sport]);
7244
7302
  const selected = chips.some((c) => c.date === day) ? day : today;
@@ -7248,6 +7306,7 @@ function useMatchesDay({ discovery, day, sport, getSchedule, enabled }) {
7248
7306
  todayGroups: discovery.groups,
7249
7307
  getSchedule,
7250
7308
  enabled,
7309
+ timeZone,
7251
7310
  resetKey: String(discovery.scheduleVersion)
7252
7311
  });
7253
7312
  return { ...loaded, chips, selected };
@@ -8782,7 +8841,7 @@ function ticksFor(lo, hi) {
8782
8841
  return out;
8783
8842
  }
8784
8843
  function scatterScale(e) {
8785
- const { w, h, pad: pad2 } = SCATTER_VIEW;
8844
+ const { w, h, pad } = SCATTER_VIEW;
8786
8845
  const xs = finite3([...e.field.map((d) => d.returnPct), ...e.marked.map((m) => m.returnPct), e.tourReturnPct]);
8787
8846
  const ys = finite3([...e.field.map((d) => d.servePct), ...e.marked.map((m) => m.servePct), e.tourServePct]);
8788
8847
  const x0 = Math.floor(Math.min(...xs) - 1);
@@ -8790,26 +8849,26 @@ function scatterScale(e) {
8790
8849
  const y0 = Math.floor(Math.min(...ys) - 1);
8791
8850
  const y1 = Math.ceil(Math.max(...ys) + 1);
8792
8851
  return {
8793
- x: (v) => round22(pad2.l + (v - x0) / (x1 - x0) * (w - pad2.l - pad2.r)),
8794
- y: (v) => round22(h - pad2.b - (v - y0) / (y1 - y0) * (h - pad2.t - pad2.b)),
8852
+ x: (v) => round22(pad.l + (v - x0) / (x1 - x0) * (w - pad.l - pad.r)),
8853
+ y: (v) => round22(h - pad.b - (v - y0) / (y1 - y0) * (h - pad.t - pad.b)),
8795
8854
  ticksX: ticksFor(x0, x1),
8796
8855
  ticksY: ticksFor(y0, y1)
8797
8856
  };
8798
8857
  }
8799
8858
  function formBars(e) {
8800
- const { w, h, pad: pad2 } = FORM_VIEW;
8859
+ const { w, h, pad } = FORM_VIEW;
8801
8860
  const n = e.matches.length;
8802
8861
  const bounds = finite3([e.min, e.max, e.tourServePct]);
8803
8862
  const lo = Math.min(...bounds) - 4;
8804
8863
  const hi = Math.max(...bounds) + 2;
8805
- const plotW = w - pad2.l - pad2.r;
8806
- const base = h - pad2.b;
8807
- const y = (v) => round22(base - (v - lo) / (hi - lo) * (h - pad2.t - pad2.b));
8864
+ const plotW = w - pad.l - pad.r;
8865
+ const base = h - pad.b;
8866
+ const y = (v) => round22(base - (v - lo) / (hi - lo) * (h - pad.t - pad.b));
8808
8867
  const slot = plotW / Math.max(n, 1);
8809
8868
  const bw = Math.max(1, Math.min(MAX_BAR_W, slot - BAR_GAP));
8810
8869
  const bars = e.matches.map((m, i) => {
8811
8870
  const top = y(clampTo(m.servePct, lo, hi));
8812
- return { x: round22(pad2.l + slot * i + (slot - bw) / 2), w: round22(bw), y: top, h: round22(base - top), won: m.result === "W" };
8871
+ return { x: round22(pad.l + slot * i + (slot - bw) / 2), w: round22(bw), y: top, h: round22(base - top), won: m.result === "W" };
8813
8872
  });
8814
8873
  return { bars, tourY: y(e.tourServePct) };
8815
8874
  }
@@ -8832,9 +8891,9 @@ function roundSpan(e) {
8832
8891
  return { lo, span: ROUND_STEPS - lo };
8833
8892
  }
8834
8893
  function pathRounds(e) {
8835
- const { h, pad: pad2 } = PATH_VIEW;
8836
- const base = h - pad2.b;
8837
- const plotH = h - pad2.t - pad2.b;
8894
+ const { h, pad } = PATH_VIEW;
8895
+ const base = h - pad.b;
8896
+ const plotH = h - pad.t - pad.b;
8838
8897
  const { lo, span } = roundSpan(e);
8839
8898
  const seen = /* @__PURE__ */ new Map();
8840
8899
  for (const ev of e.events) {
@@ -8858,11 +8917,11 @@ function pathGutter(e) {
8858
8917
  return Math.max(PATH_VIEW.pad.l, Math.ceil(longest * GLYPH_W) + GUTTER_PAD + 4);
8859
8918
  }
8860
8919
  function pathBars(e, left = PATH_VIEW.pad.l) {
8861
- const { w, h, pad: pad2 } = PATH_VIEW;
8920
+ const { w, h, pad } = PATH_VIEW;
8862
8921
  const n = e.events.length;
8863
- const plotW = w - left - pad2.r;
8864
- const plotH = h - pad2.t - pad2.b;
8865
- const base = h - pad2.b;
8922
+ const plotW = w - left - pad.r;
8923
+ const plotH = h - pad.t - pad.b;
8924
+ const base = h - pad.b;
8866
8925
  const slot = plotW / Math.max(n, 1);
8867
8926
  const bw = Math.max(1, Math.min(MAX_BAR_W, slot - BAR_GAP));
8868
8927
  const { lo, span } = roundSpan(e);
@@ -8922,7 +8981,7 @@ function TennisInsightPriceRow({ prices }) {
8922
8981
  ] });
8923
8982
  }
8924
8983
  function ServeReturnChart({ vm, e, ui }) {
8925
- const { w, h, pad: pad2 } = SCATTER_VIEW;
8984
+ const { w, h, pad } = SCATTER_VIEW;
8926
8985
  const s = scatterScale(e);
8927
8986
  const tx = s.x(e.tourReturnPct);
8928
8987
  const ty = s.y(e.tourServePct);
@@ -8934,19 +8993,19 @@ function ServeReturnChart({ vm, e, ui }) {
8934
8993
  });
8935
8994
  return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("svg", { className: "ss-w-tni-svg", viewBox: `0 0 ${w} ${h}`, width: "100%", role: "img", "aria-label": summaryOf(vm, ui), children: [
8936
8995
  s.ticksX.map((t) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("g", { children: [
8937
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { className: "ss-w-tni-grid", x1: s.x(t), x2: s.x(t), y1: pad2.t, y2: h - pad2.b }),
8938
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-tick", x: s.x(t), y: h - pad2.b + 11, textAnchor: "middle", children: pct(t, ui, 0) })
8996
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { className: "ss-w-tni-grid", x1: s.x(t), x2: s.x(t), y1: pad.t, y2: h - pad.b }),
8997
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-tick", x: s.x(t), y: h - pad.b + 11, textAnchor: "middle", children: pct(t, ui, 0) })
8939
8998
  ] }, `x${t}`)),
8940
8999
  s.ticksY.map((t) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("g", { children: [
8941
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { className: "ss-w-tni-grid", x1: pad2.l, x2: w - pad2.r, y1: s.y(t), y2: s.y(t) }),
8942
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-tick", x: pad2.l - 4, y: s.y(t) + 3, textAnchor: "end", children: pct(t, ui, 0) })
9000
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { className: "ss-w-tni-grid", x1: pad.l, x2: w - pad.r, y1: s.y(t), y2: s.y(t) }),
9001
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-tick", x: pad.l - 4, y: s.y(t) + 3, textAnchor: "end", children: pct(t, ui, 0) })
8943
9002
  ] }, `y${t}`)),
8944
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-axis", x: pad2.l + (w - pad2.l - pad2.r) / 2, y: h - 3, textAnchor: "middle", children: e.xAxis }),
8945
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-axis", transform: `translate(8 ${pad2.t + (h - pad2.t - pad2.b) / 2}) rotate(-90)`, textAnchor: "middle", children: e.yAxis }),
9003
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-axis", x: pad.l + (w - pad.l - pad.r) / 2, y: h - 3, textAnchor: "middle", children: e.xAxis }),
9004
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-axis", transform: `translate(8 ${pad.t + (h - pad.t - pad.b) / 2}) rotate(-90)`, textAnchor: "middle", children: e.yAxis }),
8946
9005
  e.field.map((d) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("circle", { className: "ss-w-tni-dot", cx: s.x(d.returnPct), cy: s.y(d.servePct), r: 2.4 }, d.playerId)),
8947
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { className: "ss-w-tni-tour", x1: tx, x2: tx, y1: pad2.t, y2: h - pad2.b }),
8948
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { className: "ss-w-tni-tour", x1: pad2.l, x2: w - pad2.r, y1: ty, y2: ty }),
8949
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-lab ss-w-tni-lab-faint", x: w - pad2.r - 2, y: ty - 4, textAnchor: "end", children: e.tourAverage }),
9006
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { className: "ss-w-tni-tour", x1: tx, x2: tx, y1: pad.t, y2: h - pad.b }),
9007
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { className: "ss-w-tni-tour", x1: pad.l, x2: w - pad.r, y1: ty, y2: ty }),
9008
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-lab ss-w-tni-lab-faint", x: w - pad.r - 2, y: ty - 4, textAnchor: "end", children: e.tourAverage }),
8950
9009
  e.marked.map((m, i) => {
8951
9010
  const l = labels[i];
8952
9011
  return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("g", { children: [
@@ -8967,15 +9026,15 @@ function ServeReturnCard({ vm, e, ui }) {
8967
9026
  ] });
8968
9027
  }
8969
9028
  function ServeFormCard({ vm, e, ui }) {
8970
- const { w, h, pad: pad2 } = FORM_VIEW;
9029
+ const { w, h, pad } = FORM_VIEW;
8971
9030
  const { bars, tourY } = formBars(e);
8972
9031
  const lo = Math.min(e.min, e.tourServePct) - 4;
8973
9032
  const hi = Math.max(e.max, e.tourServePct) + 2;
8974
- const base = h - pad2.b;
8975
- const yOf = (v) => base - (v - lo) / (hi - lo) * (h - pad2.t - pad2.b);
9033
+ const base = h - pad.b;
9034
+ const yOf = (v) => base - (v - lo) / (hi - lo) * (h - pad.t - pad.b);
8976
9035
  const ticks = [];
8977
9036
  for (let t = Math.ceil(lo / 5) * 5; t <= hi; t += 5) ticks.push(t);
8978
- const slot = (w - pad2.l - pad2.r) / Math.max(e.matches.length, 1);
9037
+ const slot = (w - pad.l - pad.r) / Math.max(e.matches.length, 1);
8979
9038
  const tiles = [
8980
9039
  { label: e.labels.average, value: pct(e.average, ui) },
8981
9040
  e.winsAverage == null ? null : { label: e.labels.inWins, value: pct(e.winsAverage, ui) },
@@ -8984,10 +9043,10 @@ function ServeFormCard({ vm, e, ui }) {
8984
9043
  ].filter((t) => t !== null);
8985
9044
  return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
8986
9045
  /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("svg", { className: "ss-w-tni-svg", viewBox: `0 0 ${w} ${h}`, width: "100%", role: "img", "aria-label": summaryOf(vm, ui), children: [
8987
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-axis", x: pad2.l, y: 9, children: e.labels.metric }),
9046
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-axis", x: pad.l, y: 9, children: e.labels.metric }),
8988
9047
  ticks.map((t) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("g", { children: [
8989
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { className: "ss-w-tni-grid", x1: pad2.l, x2: w - pad2.r, y1: yOf(t), y2: yOf(t) }),
8990
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-tick", x: pad2.l - 4, y: yOf(t) + 3, textAnchor: "end", children: pct(t, ui, 0) })
9048
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { className: "ss-w-tni-grid", x1: pad.l, x2: w - pad.r, y1: yOf(t), y2: yOf(t) }),
9049
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-tick", x: pad.l - 4, y: yOf(t) + 3, textAnchor: "end", children: pct(t, ui, 0) })
8991
9050
  ] }, t)),
8992
9051
  bars.map((b, i) => {
8993
9052
  const m = e.matches[i];
@@ -8999,8 +9058,8 @@ function ServeFormCard({ vm, e, ui }) {
8999
9058
  /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("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) })
9000
9059
  ] }, m.matchId);
9001
9060
  }),
9002
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { className: "ss-w-tni-tour", x1: pad2.l, x2: w - pad2.r, y1: tourY, y2: tourY }),
9003
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-lab ss-w-tni-lab-faint", x: w - pad2.r - 2, y: pad2.t - 4, textAnchor: "end", children: `${e.labels.tourAverage} ${pct(e.tourServePct, ui)}` })
9061
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { className: "ss-w-tni-tour", x1: pad.l, x2: w - pad.r, y1: tourY, y2: tourY }),
9062
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("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)}` })
9004
9063
  ] }),
9005
9064
  /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "ss-w-tni-tiles", children: tiles.map((t) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "ss-w-tni-tile", children: [
9006
9065
  /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "ss-w-tni-tile-v", children: t.value }),
@@ -9009,12 +9068,12 @@ function ServeFormCard({ vm, e, ui }) {
9009
9068
  ] });
9010
9069
  }
9011
9070
  function SeasonPathCard({ vm, e, ui }) {
9012
- const { w, h, pad: pad2 } = PATH_VIEW;
9071
+ const { w, h, pad } = PATH_VIEW;
9013
9072
  const left = pathGutter(e);
9014
9073
  const bars = pathBars(e, left);
9015
9074
  const rounds = pathRounds(e);
9016
- const base = h - pad2.b;
9017
- const labelled = (w - pad2.l - pad2.r) / Math.max(e.events.length, 1) >= 22;
9075
+ const base = h - pad.b;
9076
+ const labelled = (w - pad.l - pad.r) / Math.max(e.events.length, 1) >= 22;
9018
9077
  const NAME_ROOM = 46;
9019
9078
  const namesShown = labelled && e.events.some((ev) => ev.name);
9020
9079
  const hasTitle = e.events.some((ev) => ev.title);
@@ -9023,10 +9082,10 @@ function SeasonPathCard({ vm, e, ui }) {
9023
9082
  return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
9024
9083
  /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("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: [
9025
9084
  rounds.map((r) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("g", { children: [
9026
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { className: "ss-w-tni-grid ss-w-tni-rline", x1: left, x2: w - pad2.r, y1: r.y, y2: r.y }),
9085
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { className: "ss-w-tni-grid ss-w-tni-rline", x1: left, x2: w - pad.r, y1: r.y, y2: r.y }),
9027
9086
  /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-tick", x: left - 4, y: r.y + 3, textAnchor: "end", children: r.label })
9028
9087
  ] }, `r${r.roundIndex}`)),
9029
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { className: "ss-w-tni-grid", x1: left, x2: w - pad2.r, y1: base, y2: base }),
9088
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { className: "ss-w-tni-grid", x1: left, x2: w - pad.r, y1: base, y2: base }),
9030
9089
  bars.map((b, i) => {
9031
9090
  const ev = e.events[i];
9032
9091
  const surface = surfaceOf(b.surface);
@@ -9450,7 +9509,7 @@ function FixtureCard({ card, ui }) {
9450
9509
  // src/components/dashboard/CountdownCard.tsx
9451
9510
  var import_react50 = require("react");
9452
9511
  var import_jsx_runtime43 = require("react/jsx-runtime");
9453
- var DAY_MS2 = 864e5;
9512
+ var DAY_MS3 = 864e5;
9454
9513
  function remainingSegments(kickoffUnix, nowMs, withSeconds) {
9455
9514
  const totalSeconds = Math.floor((kickoffUnix * 1e3 - nowMs) / 1e3);
9456
9515
  if (totalSeconds <= 0) return null;
@@ -9458,10 +9517,10 @@ function remainingSegments(kickoffUnix, nowMs, withSeconds) {
9458
9517
  const hours = Math.floor(totalSeconds % 86400 / 3600);
9459
9518
  const minutes = Math.floor(totalSeconds % 3600 / 60);
9460
9519
  const seconds = totalSeconds % 60;
9461
- const pad2 = (n) => String(n).padStart(2, "0");
9462
- if (days > 0) return [{ value: pad2(days), unit: "d" }, { value: pad2(hours), unit: "h" }];
9463
- const segs = [{ value: pad2(hours), unit: "h" }, { value: pad2(minutes), unit: "m" }];
9464
- if (withSeconds) segs.push({ value: pad2(seconds), unit: "s" });
9520
+ const pad = (n) => String(n).padStart(2, "0");
9521
+ if (days > 0) return [{ value: pad(days), unit: "d" }, { value: pad(hours), unit: "h" }];
9522
+ const segs = [{ value: pad(hours), unit: "h" }, { value: pad(minutes), unit: "m" }];
9523
+ if (withSeconds) segs.push({ value: pad(seconds), unit: "s" });
9465
9524
  return segs;
9466
9525
  }
9467
9526
  function CountdownCard({ card, ui }) {
@@ -9471,7 +9530,7 @@ function CountdownCard({ card, ui }) {
9471
9530
  const [reduced] = (0, import_react50.useState)(
9472
9531
  () => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches
9473
9532
  );
9474
- const withinDay = data.kickoffUnix * 1e3 - nowMs < DAY_MS2;
9533
+ const withinDay = data.kickoffUnix * 1e3 - nowMs < DAY_MS3;
9475
9534
  (0, import_react50.useEffect)(() => {
9476
9535
  if (reduced) return;
9477
9536
  const id = window.setInterval(() => setNowMs(Date.now()), withinDay ? 1e3 : 6e4);
@@ -10779,7 +10838,7 @@ function MonitorMatchCard({ match, promotedPins, monitor, ui, slip, onAsk }) {
10779
10838
  ] })
10780
10839
  ] }, row.label);
10781
10840
  }) }),
10782
- match.status === "stale" && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "ss-w-mon-asof", children: ui.asOf(formatTime(match.asOfUtc, ui.locale, clockOf(ui))) }),
10841
+ match.status === "stale" && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "ss-w-mon-asof", children: ui.asOf(formatTime(match.asOfUtc, ui.locale, clockOf(ui), { timeZone: ui.timeZone })) }),
10783
10842
  match.momentum.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "ss-w-mon-mom", children: [
10784
10843
  /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "ss-w-mon-stat-l", children: ui.momentumLabel }),
10785
10844
  /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(MomentumWave, { points: match.momentum, label: ui.momentumLabel, clubIsHome: true })
@@ -11806,12 +11865,11 @@ function splitAtFirstSpace(label) {
11806
11865
  const i = label.indexOf(" ");
11807
11866
  return i > 0 && i < label.length - 1 ? [label.slice(0, i), label.slice(i + 1)] : null;
11808
11867
  }
11809
- function isOtherLocalDay(kickoffUnix, now) {
11810
- const at2 = new Date(kickoffUnix * 1e3);
11811
- return at2.getFullYear() !== now.getFullYear() || at2.getMonth() !== now.getMonth() || at2.getDate() !== now.getDate();
11868
+ function isOtherLocalDay(kickoffUnix, now, timeZone) {
11869
+ return zonedDayNumber(kickoffUnix * 1e3, timeZone) !== zonedDayNumber(now.getTime(), timeZone);
11812
11870
  }
11813
- function kickoffLabel(kickoffUnix, tag2, clock3) {
11814
- return formatTime(kickoffUnix * 1e3, tag2, clock3);
11871
+ function kickoffLabel(kickoffUnix, tag2, clock3, timeZone) {
11872
+ return formatTime(kickoffUnix * 1e3, tag2, clock3, { timeZone });
11815
11873
  }
11816
11874
  function Side2({ name, crest, abbr, away = false }) {
11817
11875
  return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("span", { className: away ? "ss-w-drow-side ss-w-drow-side--away" : "ss-w-drow-side", children: [
@@ -11829,12 +11887,12 @@ function rowStatusOf(state, stale, ui) {
11829
11887
  }
11830
11888
  function FixtureRow({ match, state, stale, ui, monitor, onOpen }) {
11831
11889
  const { isLive, hasScore, score, ticked, when: clock3 } = rowStatusOf(state, stale, ui);
11832
- const when = clock3 ?? kickoffLabel(match.kickoffUnix, ui.locale, clockOf(ui));
11890
+ const when = clock3 ?? kickoffLabel(match.kickoffUnix, ui.locale, clockOf(ui), ui.timeZone);
11833
11891
  const isUsSport = sportKeyOf(match.sport) !== "football";
11834
11892
  const pinSport = (0, import_widget_sdk25.slipSportOf)(match.sport);
11835
11893
  const liveTone = isLive || state?.isHalfTime;
11836
11894
  const clockParts = isUsSport && isLive && ticked !== null && !state?.isHalfTime ? splitAtFirstSpace(ticked) : null;
11837
- const dayMarker = isUsSport && !liveTone && state?.phase !== "live" && isOtherLocalDay(match.kickoffUnix, /* @__PURE__ */ new Date()) ? formatDate(match.kickoffUnix * 1e3, ui.locale, { weekday: "short" }) : null;
11895
+ 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;
11838
11896
  const twoLines = clockParts ?? (dayMarker !== null ? [when, dayMarker] : null);
11839
11897
  const whenClass = [
11840
11898
  "ss-w-drow-when",
@@ -12004,7 +12062,7 @@ function TennisFixtureRow({ match, state, stale, ui, prices, slip, monitor }) {
12004
12062
  live ? /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("span", { className: "ss-w-trow-when ss-w-trow-live", children: [
12005
12063
  ui.liveLabel,
12006
12064
  setLabel ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "ss-w-trow-set", children: setLabel }) : null
12007
- ] }) : endMark ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "ss-w-trow-when ss-w-trow-when--end", children: endMark }) : match.timeTba ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "ss-w-trow-when ss-w-trow-when--tba", children: ui.tennis.timeTba }) : /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "ss-w-trow-when", children: kickoffLabel(match.kickoffUnix, ui.locale, clockOf(ui)) }),
12065
+ ] }) : endMark ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "ss-w-trow-when ss-w-trow-when--end", children: endMark }) : match.timeTba ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "ss-w-trow-when ss-w-trow-when--tba", children: ui.tennis.timeTba }) : /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "ss-w-trow-when", children: kickoffLabel(match.kickoffUnix, ui.locale, clockOf(ui), ui.timeZone) }),
12008
12066
  pinned ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("button", { type: "button", className: "ss-w-trow-players ss-w-trow-open", onClick: open, children: players }) : /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "ss-w-trow-players", children: players }),
12009
12067
  showPrices && (entry === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "ss-w-trow-prices" }) : entry === null ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "ss-w-trow-prices", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "ss-w-trow-noodds", children: ui.tennis.noOdds }) }) : /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(TennisPriceCell, { match, price: entry, ui, slip })),
12010
12068
  pinnable && monitor && pin && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(PinToggle, { ui, monitor, pin })
@@ -12599,7 +12657,7 @@ function OddsLiveStrip({ m, ui }) {
12599
12657
  m.minuteLabel && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "ss-w-mon-min", children: m.minuteLabel }),
12600
12658
  m.isSuspended && !m.isSettled && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "ss-w-mon-susp", children: ui.suspendedLabel }),
12601
12659
  m.isSettled && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "ss-w-mon-pill", children: ui.fullTimeLabel }),
12602
- stale && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "ss-w-mon-asof", children: ui.asOf(formatTime(m.asOfUtc, ui.locale, clockOf(ui))) })
12660
+ stale && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "ss-w-mon-asof", children: ui.asOf(formatTime(m.asOfUtc, ui.locale, clockOf(ui), { timeZone: ui.timeZone })) })
12603
12661
  ] });
12604
12662
  }
12605
12663
  function MatchesPanel({ monitor, ui, slip, onAsk, discovery }) {
@@ -12726,7 +12784,7 @@ var countryThenName = (a, b) => {
12726
12784
  };
12727
12785
  function matchSections(a) {
12728
12786
  const live = (m) => isTreatedLive(a.states.get(keyOf3(m)), a.stale);
12729
- const offset = offsetOf(a.date);
12787
+ const offset = offsetOf(a.date, a.timeZone);
12730
12788
  const onDate = (m) => localDateOfUnix(m.kickoffUnix, offset) === a.date;
12731
12789
  const afterMidnight = [];
12732
12790
  const built = [];
@@ -12909,8 +12967,8 @@ function useModalDialog(onClose, opts = {}) {
12909
12967
 
12910
12968
  // src/components/MatchSheet.tsx
12911
12969
  var import_jsx_runtime95 = require("react/jsx-runtime");
12912
- function kickoffDate(kickoffUnix, lang) {
12913
- return formatDate(kickoffUnix * 1e3, lang, { weekday: "short", day: "numeric", month: "short" });
12970
+ function kickoffDate(kickoffUnix, lang, timeZone) {
12971
+ return formatDate(kickoffUnix * 1e3, lang, { weekday: "short", day: "numeric", month: "short", timeZone });
12914
12972
  }
12915
12973
  function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose, opener }) {
12916
12974
  const { dialogRef, onKeyDown } = useModalDialog(onClose, { opener });
@@ -12963,7 +13021,7 @@ function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose,
12963
13021
  };
12964
13022
  const { score, when } = rowStatusOf(state, stale, ui);
12965
13023
  const statusParts = [when, score].filter((v) => v !== null && v !== void 0);
12966
- const status2 = statusParts.length > 0 ? statusParts.join(" \xB7 ") : ui.kickoffLine(kickoffDate(match.kickoffUnix, ui.locale), kickoffLabel(match.kickoffUnix, ui.locale, clockOf(ui)));
13024
+ 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));
12967
13025
  return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: "ss-w-tool-backdrop ss-w-sheet-backdrop", onClick: onBackdrop, children: /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { ref: dialogRef, className: "ss-w-tool ss-w-sheet", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, tabIndex: -1, onKeyDown, children: [
12968
13026
  /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { className: "ss-w-tool-head", children: [
12969
13027
  /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("h2", { id: titleId, className: "ss-w-tool-title", children: [
@@ -13320,7 +13378,8 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
13320
13378
  pinnedKeys,
13321
13379
  isToday,
13322
13380
  date: selected,
13323
- query: q
13381
+ query: q,
13382
+ timeZone: ui.timeZone
13324
13383
  });
13325
13384
  const priced = sectionsFor("");
13326
13385
  const { sections, afterMidnight } = searching ? sectionsFor(query) : priced;
@@ -16862,7 +16921,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
16862
16921
  void request(lastRequest.current);
16863
16922
  } }) : null
16864
16923
  ] }),
16865
- quotedAt ? /* @__PURE__ */ (0, import_jsx_runtime138.jsx)("p", { className: "ss-w-v8-builder-note", "data-testid": "v8-asof", children: ui.v8PricesAsOf(fmtHhMm(quotedAt, ui.locale, clockOf(ui))) }) : null
16924
+ quotedAt ? /* @__PURE__ */ (0, import_jsx_runtime138.jsx)("p", { className: "ss-w-v8-builder-note", "data-testid": "v8-asof", children: ui.v8PricesAsOf(fmtHhMm(quotedAt, ui.locale, clockOf(ui), ui.timeZone)) }) : null
16866
16925
  ] }) : null
16867
16926
  ] }) : null });
16868
16927
  }
@@ -20707,7 +20766,8 @@ function StatsWidget(props) {
20707
20766
  operatorUserId,
20708
20767
  anonymousUserId,
20709
20768
  isOpen: panelOpen,
20710
- pinnedMatchIds
20769
+ pinnedMatchIds,
20770
+ timeZone: ui.timeZone
20711
20771
  });
20712
20772
  const offeredSports = (0, import_react102.useMemo)(() => {
20713
20773
  const seen = new Set(discovery.matchDays.map((d) => d.sport));
@@ -20722,7 +20782,8 @@ function StatsWidget(props) {
20722
20782
  day: matchesDay,
20723
20783
  sport: scheduleSport.sport,
20724
20784
  getSchedule,
20725
- enabled: panelOpen && monitor.activeTab === "matches"
20785
+ enabled: panelOpen && monitor.activeTab === "matches",
20786
+ timeZone: ui.timeZone
20726
20787
  });
20727
20788
  const prevLiveSnapshotRef = (0, import_react102.useRef)(monitor.snapshot);
20728
20789
  (0, import_react102.useEffect)(() => {