@wral/hsot-data 0.1.6 → 0.1.8
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.
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { LitElement as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
1
|
+
import { LitElement as ee, html as i, css as b, nothing as p, svg as Q } from "lit";
|
|
2
|
+
const ne = 50;
|
|
3
|
+
function le(a = {}) {
|
|
4
4
|
const e = Object.entries(a).filter(([, s]) => s != null && s !== "");
|
|
5
5
|
if (!e.length) return "";
|
|
6
6
|
const t = new URLSearchParams();
|
|
7
7
|
return e.forEach(([s, r]) => t.set(s, String(r))), `?${t.toString()}`;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function ce({ baseUrl: a, token: e = "", fetchFn: t } = {}) {
|
|
10
10
|
if (!a) throw new Error("createClient requires a baseUrl");
|
|
11
11
|
const s = a.replace(/\/+$/, ""), r = t || ((...n) => fetch(...n));
|
|
12
12
|
async function o(n) {
|
|
13
13
|
const h = { Accept: "application/json" };
|
|
14
14
|
e && (h.Authorization = `Bearer ${e}`);
|
|
15
|
-
const
|
|
16
|
-
if (!
|
|
17
|
-
const d = new Error(`api-hsot ${
|
|
18
|
-
throw d.status =
|
|
15
|
+
const c = await r(`${s}${n}`, { headers: h });
|
|
16
|
+
if (!c.ok) {
|
|
17
|
+
const d = new Error(`api-hsot ${c.status} on ${n}`);
|
|
18
|
+
throw d.status = c.status, d;
|
|
19
19
|
}
|
|
20
|
-
return
|
|
20
|
+
return c.json();
|
|
21
21
|
}
|
|
22
|
-
async function
|
|
23
|
-
const
|
|
22
|
+
async function l(n, h = {}) {
|
|
23
|
+
const c = [];
|
|
24
24
|
let d = null;
|
|
25
|
-
for (let m = 0; m <
|
|
26
|
-
const f =
|
|
27
|
-
if (
|
|
25
|
+
for (let m = 0; m < ne; m += 1) {
|
|
26
|
+
const f = le(d ? { ...h, cursor: d } : h), g = await o(`${n}${f}`);
|
|
27
|
+
if (c.push(...g.items || []), d = g.nextCursor || null, !d) break;
|
|
28
28
|
}
|
|
29
|
-
return { items:
|
|
29
|
+
return { items: c, total: c.length, nextCursor: null };
|
|
30
30
|
}
|
|
31
31
|
return {
|
|
32
|
-
listSchools: (n) =>
|
|
32
|
+
listSchools: (n) => l("/schools", n),
|
|
33
33
|
getSchool: (n) => o(`/schools/${n}`),
|
|
34
|
-
listTeams: (n) =>
|
|
34
|
+
listTeams: (n) => l("/teams", n),
|
|
35
35
|
getTeam: (n) => o(`/teams/${n}`),
|
|
36
|
-
listConferences: (n) =>
|
|
37
|
-
listPlayers: (n) =>
|
|
38
|
-
listRosters: (n) =>
|
|
39
|
-
listGames: (n) =>
|
|
36
|
+
listConferences: (n) => l("/conferences", n),
|
|
37
|
+
listPlayers: (n) => l("/players", n),
|
|
38
|
+
listRosters: (n) => l("/rosters", n),
|
|
39
|
+
listGames: (n) => l("/games", n),
|
|
40
40
|
getGame: (n) => o(`/games/${n}`),
|
|
41
|
-
listTournaments: (n) =>
|
|
42
|
-
listSeedings: (n, h) =>
|
|
43
|
-
listRankings: (n) =>
|
|
41
|
+
listTournaments: (n) => l("/tournaments", n),
|
|
42
|
+
listSeedings: (n, h) => l(`/tournaments/${n}/seedings`, h),
|
|
43
|
+
listRankings: (n) => l("/rankings", n),
|
|
44
44
|
listSports: () => o("/sports")
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
const
|
|
47
|
+
const H = {
|
|
48
48
|
game: "/{sport}/game/{id}/",
|
|
49
49
|
school: "/school/{id}/",
|
|
50
50
|
section: "/{sport}/{view}/"
|
|
@@ -54,42 +54,42 @@ function u(a, e) {
|
|
|
54
54
|
}
|
|
55
55
|
function D(a) {
|
|
56
56
|
return {
|
|
57
|
-
game: a.getAttribute("game-href") ||
|
|
58
|
-
school: a.getAttribute("school-href") ||
|
|
59
|
-
section: a.getAttribute("section-href") ||
|
|
57
|
+
game: a.getAttribute("game-href") || H.game,
|
|
58
|
+
school: a.getAttribute("school-href") || H.school,
|
|
59
|
+
section: a.getAttribute("section-href") || H.section
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
-
const
|
|
63
|
-
function
|
|
62
|
+
const I = (a) => a ? a.charAt(0).toUpperCase() + a.slice(1) : "";
|
|
63
|
+
function y(a, e) {
|
|
64
64
|
if (!a) return "TBD";
|
|
65
65
|
const [t, s, r] = String(a).split("-").map(Number);
|
|
66
66
|
return !t || !s || !r ? "TBD" : new Date(t, s - 1, r).toLocaleDateString("en-US", e || { weekday: "short", month: "short", day: "numeric" });
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function U(a) {
|
|
69
69
|
if (!a) return "";
|
|
70
70
|
const [e, t] = String(a).split(":").map(Number);
|
|
71
71
|
if (Number.isNaN(e)) return "";
|
|
72
72
|
const s = e >= 12 ? "PM" : "AM";
|
|
73
73
|
return `${(e + 11) % 12 + 1}:${String(t || 0).padStart(2, "0")} ${s}`;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function de(a) {
|
|
76
76
|
return a ? `${Math.floor(a / 12)}-${a % 12}` : "·";
|
|
77
77
|
}
|
|
78
78
|
function N(a = /* @__PURE__ */ new Date()) {
|
|
79
79
|
const e = a.getFullYear();
|
|
80
80
|
return a.getMonth() >= 6 ? `${e}-${e + 1}` : `${e - 1}-${e}`;
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function M(a = /* @__PURE__ */ new Date()) {
|
|
83
83
|
const e = (t) => String(t).padStart(2, "0");
|
|
84
84
|
return `${a.getFullYear()}-${e(a.getMonth() + 1)}-${e(a.getDate())}`;
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function he(a, e = M()) {
|
|
87
87
|
const t = [...new Set((a || []).filter(Boolean))].sort();
|
|
88
88
|
if (!t.length || t.includes(e)) return e;
|
|
89
89
|
const s = t.filter((r) => r < e);
|
|
90
90
|
return s.length ? s[s.length - 1] : t[0];
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function j(a) {
|
|
93
93
|
return a ? (a.abbr || a.name || "?").slice(0, 4).toUpperCase() : "?";
|
|
94
94
|
}
|
|
95
95
|
function E(a) {
|
|
@@ -97,17 +97,17 @@ function E(a) {
|
|
|
97
97
|
const e = parseInt(a.slice(1), 16), t = e >> 16 & 255, s = e >> 8 & 255, r = e & 255;
|
|
98
98
|
return 0.299 * t + 0.587 * s + 0.114 * r > 150 ? "#0F1B33" : "#FFFFFF";
|
|
99
99
|
}
|
|
100
|
-
const
|
|
100
|
+
const me = (a) => {
|
|
101
101
|
const e = ["th", "st", "nd", "rd"], t = a % 100;
|
|
102
102
|
return a + (e[(t - 20) % 10] || e[t] || e[0]);
|
|
103
103
|
};
|
|
104
|
-
function
|
|
104
|
+
function te(a) {
|
|
105
105
|
if (a.state === "live") return { kind: "live", label: `Live · ${a.period || ""}`.replace(/ · $/, "") };
|
|
106
106
|
if (a.state === "final") {
|
|
107
107
|
const e = [];
|
|
108
108
|
return a.finish === "overtime" && e.push("OT"), a.finish === "shootout" && e.push("PK-SO"), a.forfeit && a.forfeit !== "none" && e.push("Forfeit"), { kind: "final", label: `Final${e.length ? ` · ${e.join(" · ")}` : ""}` };
|
|
109
109
|
}
|
|
110
|
-
return a.state === "postponed" ? { kind: "warn", label: "Postponed" } : a.state === "canceled" ? { kind: "warn", label: "Canceled" } : { kind: "sched", label: `${
|
|
110
|
+
return a.state === "postponed" ? { kind: "warn", label: "Postponed" } : a.state === "canceled" ? { kind: "warn", label: "Canceled" } : { kind: "sched", label: `${y(a.date, { month: "short", day: "numeric" })} · ${U(a.time)}`.replace(/ · $/, "") };
|
|
111
111
|
}
|
|
112
112
|
const pe = /* @__PURE__ */ new Set(["game", "story", "page", "forum", "video", "gallery"]);
|
|
113
113
|
function x(a) {
|
|
@@ -130,19 +130,19 @@ function fe(a, e, t) {
|
|
|
130
130
|
if (!s) return null;
|
|
131
131
|
const r = x(u(e.game, { sport: t, id: "" })), o = x(u(e.school, { id: "" }));
|
|
132
132
|
if (s === r || s.startsWith(`${r}/`) || s === o || s.startsWith(`${o}/`)) return null;
|
|
133
|
-
const
|
|
134
|
-
if (s ===
|
|
135
|
-
if (!s.startsWith(`${
|
|
136
|
-
const n = s.slice(
|
|
137
|
-
return h.length > 2 || h.some((
|
|
133
|
+
const l = x(u(e.section, { sport: t, view: "" }));
|
|
134
|
+
if (s === l) return "";
|
|
135
|
+
if (!s.startsWith(`${l}/`)) return null;
|
|
136
|
+
const n = s.slice(l.length + 1), h = n.split("/");
|
|
137
|
+
return h.length > 2 || h.some((c) => !/^[a-z][a-z-]*$/.test(c)) || pe.has(h[0]) ? null : n;
|
|
138
138
|
}
|
|
139
139
|
function ue(a, e, t) {
|
|
140
|
-
const s = (
|
|
140
|
+
const s = (l) => u(t.section, { sport: a, view: l }).replace(/([^:])\/{2,}/g, "$1/"), o = new Set((e || []).map((l) => l && l.gender).filter((l) => l === "boys" || l === "girls")).size === 2 ? [
|
|
141
141
|
{ label: "Boys Standings", href: s("boys/standings") },
|
|
142
142
|
{ label: "Girls Standings", href: s("girls/standings") }
|
|
143
143
|
] : [{ label: "Standings", href: s("standings") }];
|
|
144
144
|
return [
|
|
145
|
-
{ label: `${
|
|
145
|
+
{ label: `${I(a)} Home`, href: s("") },
|
|
146
146
|
{ label: "Scores/Schedule", href: s("scores") },
|
|
147
147
|
{ label: "Playoff Brackets", href: s("brackets") },
|
|
148
148
|
...o,
|
|
@@ -154,7 +154,7 @@ function ge(a, e = se()) {
|
|
|
154
154
|
for (const s of a.querySelectorAll(':scope > a[slot="nav"]'))
|
|
155
155
|
t && x(s.getAttribute("href")) === t ? s.setAttribute("aria-current", "page") : s.removeAttribute("aria-current");
|
|
156
156
|
}
|
|
157
|
-
class
|
|
157
|
+
class $ extends ee {
|
|
158
158
|
static properties = {
|
|
159
159
|
api: { type: String },
|
|
160
160
|
refreshInterval: { type: Number, attribute: "refresh-interval" },
|
|
@@ -173,7 +173,7 @@ class y extends te {
|
|
|
173
173
|
this._client = e, this.isConnected && this.load();
|
|
174
174
|
}
|
|
175
175
|
get client() {
|
|
176
|
-
return this._client ? this._client : this.api ?
|
|
176
|
+
return this._client ? this._client : this.api ? ce({ baseUrl: this.api }) : null;
|
|
177
177
|
}
|
|
178
178
|
connectedCallback() {
|
|
179
179
|
super.connectedCallback(), this._setupInterval();
|
|
@@ -307,7 +307,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ve = b`
|
|
|
307
307
|
@media (max-width: 720px) {
|
|
308
308
|
.band h1, .band h2.bandtitle, .band.section h1, .band.section h2.bandtitle { font-size: 1.8rem; }
|
|
309
309
|
}
|
|
310
|
-
`,
|
|
310
|
+
`, ye = b`
|
|
311
311
|
.view { max-width: 1366px; margin: 0 auto; padding: 1.25rem; box-sizing: border-box; }
|
|
312
312
|
/* Optional right rail (slot="rail" light-DOM children): a divided 300px
|
|
313
313
|
column on desktop, stacked under the view content on smaller screens. */
|
|
@@ -371,7 +371,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ve = b`
|
|
|
371
371
|
.error { padding: 1.2rem 1rem; color: var(--hsot-red-deep); font-size: 0.9rem; }
|
|
372
372
|
.note { font-size: 0.8125rem; color: var(--hsot-gray-5); margin: 0.6rem 0 0; }
|
|
373
373
|
.loading { padding: 1.2rem; color: var(--hsot-gray-5); font-family: var(--hsot-heading-font); }
|
|
374
|
-
`,
|
|
374
|
+
`, $e = b`
|
|
375
375
|
.pill {
|
|
376
376
|
display: inline-block; font-family: var(--hsot-heading-font); font-weight: 700;
|
|
377
377
|
font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.04em;
|
|
@@ -437,44 +437,80 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ve = b`
|
|
|
437
437
|
.gamelist li:last-child { border-bottom: none; }
|
|
438
438
|
.gamelist .d { width: 84px; flex: none; color: var(--hsot-gray-5); font-size: 0.8rem; }
|
|
439
439
|
.gamelist .res { width: 86px; flex: none; font-family: var(--hsot-heading-font); font-weight: 700; }
|
|
440
|
+
/* Per-team score block on the scoreboard, in the status pills' bubble shape. */
|
|
441
|
+
.gamelist .score {
|
|
442
|
+
display: inline-block; min-width: 1.15em; text-align: center;
|
|
443
|
+
background: var(--hsot-red); color: var(--hsot-white);
|
|
444
|
+
font-family: var(--hsot-heading-font); font-weight: 700; font-size: 0.8125rem;
|
|
445
|
+
line-height: 1.2; border-radius: var(--hsot-radius-md); padding: 0.14rem 0.4rem;
|
|
446
|
+
margin-left: 0.45rem; vertical-align: middle; font-variant-numeric: tabular-nums;
|
|
447
|
+
}
|
|
440
448
|
.gamelist .res .W { color: var(--hsot-win); }
|
|
441
449
|
.gamelist .res .L { color: var(--hsot-loss); }
|
|
442
450
|
.gamelist .res .T { color: var(--hsot-tie); }
|
|
443
451
|
.gamelist .opp { flex: 1; min-width: 180px; }
|
|
444
452
|
.gamelist .opp a { text-decoration: none; color: inherit; font-weight: 500; }
|
|
445
453
|
.gamelist .opp a:hover { text-decoration: underline; }
|
|
454
|
+
|
|
455
|
+
/* Scoreboard matchup: "Away <score> at Home <score>".
|
|
456
|
+
Scoped to .matchup, not .opp, because hsot-school's schedule rows
|
|
457
|
+
reuse .opp for a single opponent plus pills and must keep the plain
|
|
458
|
+
inline flow.
|
|
459
|
+
|
|
460
|
+
Each team + score is one .side flex item, so a matchup wider than the
|
|
461
|
+
row breaks *between* the two teams instead of through a school's name
|
|
462
|
+
— the "at North / Moore" and "at Greene / Central" wraps the old
|
|
463
|
+
single-span markup produced. */
|
|
464
|
+
.gamelist .opp.matchup {
|
|
465
|
+
display: flex; flex-wrap: wrap; align-items: center; gap: 0 0.35rem;
|
|
466
|
+
}
|
|
467
|
+
.gamelist .opp.matchup .side { display: inline-flex; align-items: center; }
|
|
468
|
+
.gamelist .opp.matchup .at { margin-left: 0.45rem; }
|
|
469
|
+
@media (max-width: 720px) {
|
|
470
|
+
/* Always two lines on a phone, split after the "at", rather than
|
|
471
|
+
one line for short matchups and a break wherever the text runs
|
|
472
|
+
out for long ones. Consistent rows read better than tight ones. */
|
|
473
|
+
.gamelist .opp.matchup { flex-direction: column; align-items: flex-start; row-gap: 0.15rem; }
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/* Names the side that forfeited — the pill only says "Final · Forfeit",
|
|
477
|
+
which leaves a 0-0 row ambiguous about who was awarded the win. */
|
|
478
|
+
.gamelist .ff { color: var(--hsot-gray-5); font-size: 0.78rem; font-style: italic; }
|
|
446
479
|
.gamelist .where { color: var(--hsot-gray-5); font-size: 0.78rem; }
|
|
447
480
|
.gamelist a.box { font-size: 0.78rem; }
|
|
448
|
-
`, F = [ve, be, $e,
|
|
449
|
-
function
|
|
481
|
+
`, F = [ve, be, ye, $e, we, xe, ke];
|
|
482
|
+
function G(a) {
|
|
450
483
|
return a.state !== "final" ? null : a.forfeit && a.forfeit !== "none" ? a.forfeit : a.homeScore > a.awayScore ? "home" : a.awayScore > a.homeScore ? "away" : a.tiebreakWinner && a.tiebreakWinner !== "none" ? a.tiebreakWinner : "tie";
|
|
451
484
|
}
|
|
485
|
+
function Te(a) {
|
|
486
|
+
return !a || !a.forfeit || a.forfeit === "none" ? null : a.forfeit === "home" ? "away" : a.forfeit === "away" ? "home" : null;
|
|
487
|
+
}
|
|
452
488
|
function z(a, e) {
|
|
453
|
-
const t = {}, s = (o) => (t[o] = t[o] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] }, t[o]), r = a.filter((o) => o.state === "final" && o.gameType !== "scrimmage" && (!e || o.date <= e)).sort((o,
|
|
489
|
+
const t = {}, s = (o) => (t[o] = t[o] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] }, t[o]), r = a.filter((o) => o.state === "final" && o.gameType !== "scrimmage" && (!e || o.date <= e)).sort((o, l) => String(o.date).localeCompare(String(l.date)));
|
|
454
490
|
for (const o of r) {
|
|
455
|
-
const
|
|
491
|
+
const l = G(o), n = o.gameType === "conference";
|
|
456
492
|
for (const h of ["home", "away"]) {
|
|
457
|
-
const
|
|
458
|
-
if (!
|
|
459
|
-
const d = s(
|
|
493
|
+
const c = h === "home" ? o.homeTeamId : o.awayTeamId;
|
|
494
|
+
if (!c) continue;
|
|
495
|
+
const d = s(c), m = h === "home" ? o.homeScore : o.awayScore, f = h === "home" ? o.awayScore : o.homeScore;
|
|
460
496
|
d.pf += m, d.pa += f;
|
|
461
497
|
let g = "T";
|
|
462
|
-
|
|
498
|
+
l === "tie" ? (d.t += 1, n && (d.ct += 1)) : l === h ? (d.w += 1, n && (d.cw += 1), g = "W") : (d.l += 1, n && (d.cl += 1), g = "L"), d.results.push({ gameId: o.id, date: o.date, mark: g, my: m, their: f, opp: h === "home" ? o.awayTeamId : o.homeTeamId, conf: n });
|
|
463
499
|
}
|
|
464
500
|
}
|
|
465
501
|
return t;
|
|
466
502
|
}
|
|
467
|
-
function
|
|
503
|
+
function L(a) {
|
|
468
504
|
if (!a || !a.length) return "";
|
|
469
505
|
const e = a[a.length - 1].mark;
|
|
470
506
|
let t = 0;
|
|
471
507
|
for (let s = a.length - 1; s >= 0 && a[s].mark === e; s -= 1) t += 1;
|
|
472
508
|
return e + t;
|
|
473
509
|
}
|
|
474
|
-
const
|
|
510
|
+
const X = (a, e, t) => {
|
|
475
511
|
const s = a + e + t;
|
|
476
512
|
return s ? (a + t / 2) / s : 0;
|
|
477
|
-
},
|
|
513
|
+
}, Z = (a) => a.toFixed(3).replace("0.", ".");
|
|
478
514
|
function w(a, e = !1) {
|
|
479
515
|
if (!a) return "0-0";
|
|
480
516
|
const t = e ? a.cw : a.w, s = e ? a.cl : a.l, r = e ? a.ct : a.t;
|
|
@@ -483,39 +519,39 @@ function w(a, e = !1) {
|
|
|
483
519
|
function ae(a, e) {
|
|
484
520
|
return a.map((t) => {
|
|
485
521
|
const s = e[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] };
|
|
486
|
-
return { team: t, rec: s, confPct:
|
|
522
|
+
return { team: t, rec: s, confPct: X(s.cw, s.cl, s.ct), overallPct: X(s.w, s.l, s.t) };
|
|
487
523
|
}).sort((t, s) => s.confPct - t.confPct || s.overallPct - t.overallPct || s.rec.pf - s.rec.pa - (t.rec.pf - t.rec.pa));
|
|
488
524
|
}
|
|
489
|
-
function
|
|
525
|
+
function q(a, e) {
|
|
490
526
|
return a.filter((t) => (t.homeTeamId === e || t.awayTeamId === e) && (t.state === "scheduled" || t.state === "live") && t.gameType !== "scrimmage").sort((t, s) => String(t.date).localeCompare(String(s.date)))[0] || null;
|
|
491
527
|
}
|
|
492
|
-
function
|
|
528
|
+
function J(a, e) {
|
|
493
529
|
const t = a[e];
|
|
494
530
|
return t && t.results.length ? t.results[t.results.length - 1] : null;
|
|
495
531
|
}
|
|
496
|
-
function
|
|
532
|
+
function je(a, e, t, s = "") {
|
|
497
533
|
let r = null;
|
|
498
534
|
for (const o of a || [])
|
|
499
535
|
o.sport === e && (t && o.effectiveDate > t || s && o.gender && o.gender !== s || (!r || o.effectiveDate > r.effectiveDate) && (r = o));
|
|
500
536
|
return r;
|
|
501
537
|
}
|
|
502
|
-
function
|
|
538
|
+
function W(a, e, t, s, r) {
|
|
503
539
|
const o = e[t];
|
|
504
540
|
if (!o) return null;
|
|
505
|
-
const
|
|
541
|
+
const l = /* @__PURE__ */ new Map();
|
|
506
542
|
for (const h of a || []) {
|
|
507
543
|
if (h.sport !== s || r && h.effectiveDate > r || h.gender && o.gender !== h.gender && o.gender !== "coed") continue;
|
|
508
|
-
const
|
|
509
|
-
(!d || h.effectiveDate > d.effectiveDate) &&
|
|
544
|
+
const c = h.gender || "", d = l.get(c);
|
|
545
|
+
(!d || h.effectiveDate > d.effectiveDate) && l.set(c, h);
|
|
510
546
|
}
|
|
511
547
|
let n = null;
|
|
512
|
-
for (const h of
|
|
513
|
-
const
|
|
514
|
-
|
|
548
|
+
for (const h of l.values()) {
|
|
549
|
+
const c = (h.teamIds || []).indexOf(t);
|
|
550
|
+
c !== -1 && (!n || h.effectiveDate > n.effectiveDate) && (n = { poll: h, rank: c + 1 });
|
|
515
551
|
}
|
|
516
552
|
return n ? n.rank : null;
|
|
517
553
|
}
|
|
518
|
-
function
|
|
554
|
+
function Ie(a, e, t) {
|
|
519
555
|
if (!a) return { kind: "none", delta: 0 };
|
|
520
556
|
const s = (a.teamIds || []).indexOf(t) + 1;
|
|
521
557
|
if (!s) return { kind: "none", delta: 0 };
|
|
@@ -525,16 +561,16 @@ function Te(a, e, t) {
|
|
|
525
561
|
const o = r - s;
|
|
526
562
|
return o > 0 ? { kind: "up", delta: o } : o < 0 ? { kind: "down", delta: -o } : { kind: "same", delta: 0 };
|
|
527
563
|
}
|
|
528
|
-
function
|
|
564
|
+
function Se(a) {
|
|
529
565
|
return /^https?:\/\//i.test(String(a || ""));
|
|
530
566
|
}
|
|
531
567
|
function _(a, e) {
|
|
532
568
|
const t = a?.logoAssetId;
|
|
533
|
-
if (!
|
|
569
|
+
if (!Se(t)) return "";
|
|
534
570
|
const s = Math.max(1, Math.round(e * 2)), r = t.includes("?") ? "&" : "?";
|
|
535
571
|
return `${t}${r}w=${s}&h=${s}&f=webp`;
|
|
536
572
|
}
|
|
537
|
-
function
|
|
573
|
+
function V(a, e, { title: t, sub: s, teams: r }) {
|
|
538
574
|
const o = se(), n = !!a.querySelector(':scope > a[slot="nav"]') || fe(o, e.hrefs, e.sport) !== null;
|
|
539
575
|
return i`
|
|
540
576
|
<div class="band section">
|
|
@@ -543,7 +579,7 @@ function Y(a, e, { title: t, sub: s, teams: r }) {
|
|
|
543
579
|
${s ? i`<p class="sub">${s}</p>` : p}
|
|
544
580
|
</div>
|
|
545
581
|
${n ? i`
|
|
546
|
-
<nav class="sectionnav" aria-label="${
|
|
582
|
+
<nav class="sectionnav" aria-label="${I(e.sport)} section">
|
|
547
583
|
<div class="navrow">
|
|
548
584
|
<slot name="nav">
|
|
549
585
|
${ue(e.sport, r, e.hrefs).map((h) => i`<a href=${h.href}
|
|
@@ -557,7 +593,7 @@ function Y(a, e, { title: t, sub: s, teams: r }) {
|
|
|
557
593
|
const S = (a, e) => {
|
|
558
594
|
const t = a.teamsById[e];
|
|
559
595
|
return t ? a.schoolsById[t.schoolId] : null;
|
|
560
|
-
},
|
|
596
|
+
}, T = (a, e) => S(a, e)?.name || "TBD", A = (a, e) => S(a, e)?.abbr || "TBD";
|
|
561
597
|
function C(a, e = 26) {
|
|
562
598
|
if (!a) return p;
|
|
563
599
|
const t = _(a, e);
|
|
@@ -567,23 +603,23 @@ function C(a, e = 26) {
|
|
|
567
603
|
const s = a.colorPrimary || "#030711", r = E(s);
|
|
568
604
|
return i`<span class="swatch" aria-hidden="true"
|
|
569
605
|
style="width:${e}px;height:${e}px;background:${s};color:${r};font-size:${Math.max(8, e * 0.28)}px"
|
|
570
|
-
>${
|
|
606
|
+
>${j(a)}</span>`;
|
|
571
607
|
}
|
|
572
|
-
function
|
|
573
|
-
const s =
|
|
608
|
+
function Y(a, e, t) {
|
|
609
|
+
const s = W(a.rankings, a.teamsById, e, a.sport, t);
|
|
574
610
|
return s ? i`<span class="rankbadge">#${s}</span>` : p;
|
|
575
611
|
}
|
|
576
|
-
function
|
|
612
|
+
function re(a, e, t) {
|
|
577
613
|
const s = S(a, e);
|
|
578
|
-
return s ? i`${
|
|
614
|
+
return s ? i`${Y(a, e, t)}<a href=${u(a.hrefs.school, { id: s.id })}>${s.name}</a>` : i`<span class="mut">TBD</span>`;
|
|
579
615
|
}
|
|
580
|
-
function
|
|
616
|
+
function K(a, e, t = 5) {
|
|
581
617
|
const s = a.records[e];
|
|
582
618
|
if (!s || !s.results.length) return i`<span class="mut">·</span>`;
|
|
583
619
|
const r = s.results.slice(-1 * t);
|
|
584
620
|
return i`<span class="dots" role="img" aria-label="last ${r.length} results">
|
|
585
621
|
${r.map((o) => i`<a class="dot ${o.mark}"
|
|
586
|
-
title="${o.mark} ${o.my}-${o.their} vs ${
|
|
622
|
+
title="${o.mark} ${o.my}-${o.their} vs ${T(a, o.opp)}"
|
|
587
623
|
href=${u(a.hrefs.game, { sport: a.sport, id: o.gameId })}>${o.mark}</a>`)}
|
|
588
624
|
</span>`;
|
|
589
625
|
}
|
|
@@ -599,18 +635,18 @@ function P(a) {
|
|
|
599
635
|
return i`<div class="promo">${a.promoHref ? i`<a href=${a.promoHref} target="_blank" rel="sponsored noopener">${e}</a>` : e}</div>`;
|
|
600
636
|
}
|
|
601
637
|
function R(a) {
|
|
602
|
-
const e =
|
|
638
|
+
const e = te(a);
|
|
603
639
|
return i`<span class="pill ${e.kind}">${e.label}</span>`;
|
|
604
640
|
}
|
|
605
|
-
function
|
|
641
|
+
function oe(a, e, t) {
|
|
606
642
|
if (!e) return i`<span class="mut">·</span>`;
|
|
607
643
|
const s = e.homeTeamId === t ? e.awayTeamId : e.homeTeamId, r = e.homeTeamId === t ? "vs" : "at";
|
|
608
|
-
return i`${e.state === "live" ? i`<span class="pill live">Live</span> ` : i`${
|
|
644
|
+
return i`${e.state === "live" ? i`<span class="pill live">Live</span> ` : i`${y(e.date, { month: "numeric", day: "numeric" })} `}${r} ${A(a, s)}`;
|
|
609
645
|
}
|
|
610
|
-
class
|
|
646
|
+
class Ce extends $ {
|
|
611
647
|
static styles = F;
|
|
612
648
|
static properties = {
|
|
613
|
-
|
|
649
|
+
...$.properties,
|
|
614
650
|
sport: { type: String },
|
|
615
651
|
season: { type: String },
|
|
616
652
|
date: { type: String }
|
|
@@ -626,19 +662,19 @@ class Se extends y {
|
|
|
626
662
|
this._datePinned = !!this.date;
|
|
627
663
|
}
|
|
628
664
|
async fetchData(e) {
|
|
629
|
-
const t = this.season || N(), [s, r, o,
|
|
665
|
+
const t = this.season || N(), [s, r, o, l, n] = await Promise.all([
|
|
630
666
|
e.listSchools(),
|
|
631
667
|
e.listTeams({ sport: this.sport }),
|
|
632
668
|
e.listConferences(),
|
|
633
669
|
e.listGames({ sport: this.sport, season: t }),
|
|
634
670
|
e.listRankings({ sport: this.sport })
|
|
635
671
|
]);
|
|
636
|
-
return this._datePinned || (this.date =
|
|
672
|
+
return this._datePinned || (this.date = he(l.items.map((h) => h.date)), this._datePinned = !0), {
|
|
637
673
|
season: t,
|
|
638
674
|
schools: s.items,
|
|
639
675
|
teams: r.items,
|
|
640
676
|
conferences: o.items,
|
|
641
|
-
games:
|
|
677
|
+
games: l.items,
|
|
642
678
|
rankings: n.items
|
|
643
679
|
};
|
|
644
680
|
}
|
|
@@ -653,30 +689,30 @@ class Se extends y {
|
|
|
653
689
|
}, this._ctxData = this.data), this._ctx;
|
|
654
690
|
}
|
|
655
691
|
renderView() {
|
|
656
|
-
const e = this.ctx, t = v(this.data.conferences), s = [...new Set(this.data.games.map((
|
|
657
|
-
const d = [
|
|
692
|
+
const e = this.ctx, t = v(this.data.conferences), s = [...new Set(this.data.games.map((c) => c.date).filter(Boolean))].sort(), r = Number.MAX_SAFE_INTEGER, o = (c) => {
|
|
693
|
+
const d = [c.awayTeamId, c.homeTeamId].map((m) => W(e.rankings, e.teamsById, m, this.sport, c.date)).filter(Boolean);
|
|
658
694
|
return d.length ? Math.min(...d) : r;
|
|
659
|
-
},
|
|
660
|
-
|
|
695
|
+
}, l = this.data.games.filter((c) => c.date === this.date), n = new Map(l.map((c) => [c, o(c)]));
|
|
696
|
+
l.sort((c, d) => (c.state === "live" ? 0 : 1) - (d.state === "live" ? 0 : 1) || n.get(c) - n.get(d));
|
|
661
697
|
const h = /* @__PURE__ */ new Map();
|
|
662
|
-
return
|
|
663
|
-
const d =
|
|
664
|
-
h.has(d) || h.set(d, []), h.get(d).push(
|
|
698
|
+
return l.forEach((c) => {
|
|
699
|
+
const d = c.gameType === "conference" && c.conferenceId ? t[c.conferenceId]?.name || "Conference" : c.gameType === "playoff" ? "Playoffs" : c.gameType === "scrimmage" ? "Scrimmages" : "Nonconference";
|
|
700
|
+
h.has(d) || h.set(d, []), h.get(d).push(c);
|
|
665
701
|
}), i`
|
|
666
|
-
${
|
|
667
|
-
title: i`${
|
|
668
|
-
sub: i`${
|
|
702
|
+
${V(this, e, {
|
|
703
|
+
title: i`${I(this.sport)} scores & schedules`,
|
|
704
|
+
sub: i`${y(this.date, { weekday: "long", month: "long", day: "numeric", year: "numeric" })} · ${l.length} games`,
|
|
669
705
|
teams: this.data.teams
|
|
670
706
|
})}
|
|
671
707
|
${B(this, i`
|
|
672
708
|
${P(this)}
|
|
673
709
|
<div class="toolbar">
|
|
674
710
|
<label class="asof" for="datesel">Date</label>
|
|
675
|
-
<select id="datesel" @change=${(
|
|
676
|
-
this.date =
|
|
711
|
+
<select id="datesel" @change=${(c) => {
|
|
712
|
+
this.date = c.target.value;
|
|
677
713
|
}}>
|
|
678
|
-
${(s.includes(this.date) ? s : [...s, this.date].sort()).map((
|
|
679
|
-
${
|
|
714
|
+
${(s.includes(this.date) ? s : [...s, this.date].sort()).map((c) => i`<option value=${c} ?selected=${c === this.date}>
|
|
715
|
+
${y(c, { weekday: "short", month: "short", day: "numeric" })}${c === M() ? " · today" : ""}
|
|
680
716
|
</option>`)}
|
|
681
717
|
</select>
|
|
682
718
|
<button class="chip" ?disabled=${s.indexOf(this.date) <= 0}
|
|
@@ -690,9 +726,9 @@ class Se extends y {
|
|
|
690
726
|
<span class="spacer"></span>
|
|
691
727
|
<span class="asof">Live games first · report a score to see it update here</span>
|
|
692
728
|
</div>
|
|
693
|
-
${
|
|
694
|
-
${[...h.entries()].map(([
|
|
695
|
-
<div class="section-title">${
|
|
729
|
+
${l.length ? p : i`<p class="empty">No ${this.sport} games on this date.</p>`}
|
|
730
|
+
${[...h.entries()].map(([c, d]) => i`
|
|
731
|
+
<div class="section-title">${c}</div>
|
|
696
732
|
<div class="card"><ul class="gamelist">
|
|
697
733
|
${d.map((m) => this.renderGame(e, m))}
|
|
698
734
|
</ul></div>
|
|
@@ -700,13 +736,16 @@ class Se extends y {
|
|
|
700
736
|
`)}
|
|
701
737
|
`;
|
|
702
738
|
}
|
|
739
|
+
// Each team's score rides in a block beside its name (reader feedback:
|
|
740
|
+
// a lone score column on the far right read as detached from the teams).
|
|
741
|
+
// Scheduled games carry their start time on the status pill alone.
|
|
703
742
|
renderGame(e, t) {
|
|
704
|
-
const s = t.state === "final" || t.state === "live"
|
|
743
|
+
const s = t.state === "final" || t.state === "live", r = (l, n, h = p) => i`<span class="side">${re(e, l, t.date)}${s ? i`<span class="score">${n}</span>` : p}${h}</span>`, o = Te(t);
|
|
705
744
|
return i`
|
|
706
745
|
<li>
|
|
707
746
|
${R(t)}
|
|
708
|
-
<span class="opp">${
|
|
709
|
-
|
|
747
|
+
<span class="opp matchup">${r(t.awayTeamId, t.awayScore, i`<span class="at">at</span>`)}${r(t.homeTeamId, t.homeScore)}</span>
|
|
748
|
+
${o ? i`<span class="ff">${T(e, o === "home" ? t.homeTeamId : t.awayTeamId)} forfeited</span>` : p}
|
|
710
749
|
<span class="where">${t.venue || ""}</span>
|
|
711
750
|
${t.broadcast ? i`<span class="pill class">${t.broadcast}</span>` : p}
|
|
712
751
|
<a class="box" href=${u(e.hrefs.game, { sport: this.sport, id: t.id })}>Box score →</a>
|
|
@@ -714,11 +753,11 @@ class Se extends y {
|
|
|
714
753
|
`;
|
|
715
754
|
}
|
|
716
755
|
}
|
|
717
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores",
|
|
718
|
-
class
|
|
756
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores", Ce);
|
|
757
|
+
class De extends $ {
|
|
719
758
|
static styles = F;
|
|
720
759
|
static properties = {
|
|
721
|
-
|
|
760
|
+
...$.properties,
|
|
722
761
|
sport: { type: String },
|
|
723
762
|
season: { type: String },
|
|
724
763
|
classFilter: { state: !0 },
|
|
@@ -728,7 +767,7 @@ class Ce extends y {
|
|
|
728
767
|
super(), this.sport = "football", this.season = "", this.classFilter = "All", this.query = "";
|
|
729
768
|
}
|
|
730
769
|
async fetchData(e) {
|
|
731
|
-
const t = this.season || N(), [s, r, o,
|
|
770
|
+
const t = this.season || N(), [s, r, o, l, n] = await Promise.all([
|
|
732
771
|
e.listConferences({ active: !0 }),
|
|
733
772
|
e.listSchools(),
|
|
734
773
|
e.listTeams({ sport: this.sport }),
|
|
@@ -740,7 +779,7 @@ class Ce extends y {
|
|
|
740
779
|
conferences: s.items,
|
|
741
780
|
schools: r.items,
|
|
742
781
|
teams: o.items,
|
|
743
|
-
games:
|
|
782
|
+
games: l.items,
|
|
744
783
|
rankings: n.items
|
|
745
784
|
};
|
|
746
785
|
}
|
|
@@ -757,8 +796,8 @@ class Ce extends y {
|
|
|
757
796
|
renderView() {
|
|
758
797
|
const e = this.ctx, t = ["All", ...new Set(this.data.conferences.flatMap((r) => r.classifications || []))].slice(0, 9), s = this.data.conferences.filter((r) => r.active !== !1).filter((r) => this.classFilter === "All" || (r.classifications || []).includes(this.classFilter));
|
|
759
798
|
return i`
|
|
760
|
-
${
|
|
761
|
-
title: i`${
|
|
799
|
+
${V(this, e, {
|
|
800
|
+
title: i`${I(this.sport)} standings`,
|
|
762
801
|
sub: i`${this.data.season} season · every conference, computed live from reported results`,
|
|
763
802
|
teams: this.data.teams
|
|
764
803
|
})}
|
|
@@ -776,21 +815,21 @@ class Ce extends y {
|
|
|
776
815
|
this.query = r.target.value;
|
|
777
816
|
}}>
|
|
778
817
|
<span class="spacer"></span>
|
|
779
|
-
<span class="asof">Records through ${
|
|
818
|
+
<span class="asof">Records through ${y(M(), { month: "long", day: "numeric" })} · conference games count toward both records · scrimmages toward neither</span>
|
|
780
819
|
</div>
|
|
781
820
|
${s.map((r) => this.renderConference(e, r))}
|
|
782
821
|
`)}
|
|
783
822
|
`;
|
|
784
823
|
}
|
|
785
824
|
renderConference(e, t) {
|
|
786
|
-
const s = this.data.teams.filter((
|
|
825
|
+
const s = this.data.teams.filter((l) => l.conferenceId === t.id);
|
|
787
826
|
if (!s.length) return p;
|
|
788
827
|
const r = this.query.trim().toLowerCase(), o = ae(s, e.records);
|
|
789
828
|
return i`
|
|
790
829
|
<div class="card">
|
|
791
830
|
<div class="card-head">
|
|
792
831
|
<h2>${t.name}</h2>
|
|
793
|
-
${(t.classifications || []).map((
|
|
832
|
+
${(t.classifications || []).map((l) => i`<span class="pill class">${l}</span>`)}
|
|
794
833
|
<span class="meta">${o.length} teams · membership derives from teams</span>
|
|
795
834
|
</div>
|
|
796
835
|
<div class="tablewrap"><table class="data">
|
|
@@ -800,16 +839,16 @@ class Ce extends y {
|
|
|
800
839
|
<th>Streak</th><th>Last 5</th><th>Next</th>
|
|
801
840
|
</tr></thead>
|
|
802
841
|
<tbody>
|
|
803
|
-
${o.map((
|
|
842
|
+
${o.map((l, n) => this.renderRow(e, l, n, r))}
|
|
804
843
|
</tbody>
|
|
805
844
|
</table></div>
|
|
806
845
|
</div>
|
|
807
846
|
`;
|
|
808
847
|
}
|
|
809
848
|
renderRow(e, t, s, r) {
|
|
810
|
-
const o = e.schoolsById[t.team.schoolId],
|
|
811
|
-
if (r && !
|
|
812
|
-
const n = t.rec.pf - t.rec.pa, h =
|
|
849
|
+
const o = e.schoolsById[t.team.schoolId], l = o?.name || t.team.name || "TBD";
|
|
850
|
+
if (r && !l.toLowerCase().includes(r)) return p;
|
|
851
|
+
const n = t.rec.pf - t.rec.pa, h = q(this.data.games, t.team.id), c = (t.team.championships || []).map((m) => i`
|
|
813
852
|
<span class="pill champ" title="${m.season} ${m.title} champion">★ ${m.season} ${m.title}</span>`), d = () => {
|
|
814
853
|
location.href = u(e.hrefs.school, { id: t.team.schoolId });
|
|
815
854
|
};
|
|
@@ -819,25 +858,25 @@ class Ce extends y {
|
|
|
819
858
|
}}>
|
|
820
859
|
<td class="mut">${s + 1}</td>
|
|
821
860
|
<td class="teamcell">
|
|
822
|
-
${C(o)}${
|
|
823
|
-
<a href=${u(e.hrefs.school, { id: t.team.schoolId })}>${
|
|
861
|
+
${C(o)}${Y(e, t.team.id, null)}
|
|
862
|
+
<a href=${u(e.hrefs.school, { id: t.team.schoolId })}>${l}</a> ${c}
|
|
824
863
|
</td>
|
|
825
864
|
<td class="num">${w(t.rec, !0)}</td>
|
|
826
|
-
<td class="num">${
|
|
865
|
+
<td class="num">${Z(t.confPct)}</td>
|
|
827
866
|
<td class="num">${w(t.rec)}</td>
|
|
828
|
-
<td class="num">${
|
|
867
|
+
<td class="num">${Z(t.overallPct)}</td>
|
|
829
868
|
<td class="num">${t.rec.pf}</td>
|
|
830
869
|
<td class="num">${t.rec.pa}</td>
|
|
831
870
|
<td class="num" style="color:${n >= 0 ? "var(--hsot-win)" : "var(--hsot-loss)"}">${n > 0 ? "+" : ""}${n}</td>
|
|
832
|
-
<td>${
|
|
833
|
-
<td>${
|
|
834
|
-
<td>${
|
|
871
|
+
<td>${L(t.rec.results) || "·"}</td>
|
|
872
|
+
<td>${K(e, t.team.id)}</td>
|
|
873
|
+
<td>${oe(e, h, t.team.id)}</td>
|
|
835
874
|
</tr>
|
|
836
875
|
`;
|
|
837
876
|
}
|
|
838
877
|
}
|
|
839
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings",
|
|
840
|
-
const
|
|
878
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings", De);
|
|
879
|
+
const Fe = b`
|
|
841
880
|
.hero1 {
|
|
842
881
|
border-radius: var(--hsot-radius-md); color: var(--hsot-white);
|
|
843
882
|
padding: 1.3rem 1.4rem; display: flex; align-items: center; gap: 1.2rem;
|
|
@@ -854,10 +893,10 @@ const De = b`
|
|
|
854
893
|
.delta.new { background: var(--hsot-straw); color: #6b5900; border-radius: var(--hsot-radius-xs); padding: 0.1rem 0.3rem; font-size: 0.7rem; }
|
|
855
894
|
.sparkline { vertical-align: middle; }
|
|
856
895
|
`;
|
|
857
|
-
class
|
|
858
|
-
static styles = [...F,
|
|
896
|
+
class ze extends $ {
|
|
897
|
+
static styles = [...F, Fe];
|
|
859
898
|
static properties = {
|
|
860
|
-
|
|
899
|
+
...$.properties,
|
|
861
900
|
sport: { type: String },
|
|
862
901
|
gender: { type: String },
|
|
863
902
|
season: { type: String },
|
|
@@ -872,19 +911,19 @@ class Fe extends y {
|
|
|
872
911
|
e && (this.pollDate = e);
|
|
873
912
|
}
|
|
874
913
|
async fetchData(e) {
|
|
875
|
-
const t = this.season || N(), [s, r, o,
|
|
914
|
+
const t = this.season || N(), [s, r, o, l, n] = await Promise.all([
|
|
876
915
|
e.listRankings({ sport: this.sport, ...this.gender ? { gender: this.gender } : {} }),
|
|
877
916
|
e.listSchools(),
|
|
878
917
|
e.listTeams({ sport: this.sport }),
|
|
879
918
|
e.listConferences(),
|
|
880
919
|
e.listGames({ sport: this.sport, season: t })
|
|
881
|
-
]), h = s.items.filter((
|
|
920
|
+
]), h = s.items.filter((c) => !this.gender || !c.gender || c.gender === this.gender).sort((c, d) => d.effectiveDate.localeCompare(c.effectiveDate));
|
|
882
921
|
return {
|
|
883
922
|
season: t,
|
|
884
923
|
polls: h,
|
|
885
924
|
schools: r.items,
|
|
886
925
|
teams: o.items,
|
|
887
|
-
conferences:
|
|
926
|
+
conferences: l.items,
|
|
888
927
|
games: n.items
|
|
889
928
|
};
|
|
890
929
|
}
|
|
@@ -902,31 +941,31 @@ class Fe extends y {
|
|
|
902
941
|
const n = t.map((m, f) => {
|
|
903
942
|
const g = (m.teamIds || []).indexOf(e);
|
|
904
943
|
if (g === -1) return null;
|
|
905
|
-
const k = t.length === 1 ? 96 / 2 : f / (t.length - 1) * 90 + 3,
|
|
906
|
-
return { x: k, y:
|
|
944
|
+
const k = t.length === 1 ? 96 / 2 : f / (t.length - 1) * 90 + 3, O = 3 + g / 24 * 20;
|
|
945
|
+
return { x: k, y: O };
|
|
907
946
|
}), h = [];
|
|
908
|
-
let
|
|
947
|
+
let c = [];
|
|
909
948
|
if (n.forEach((m) => {
|
|
910
|
-
m ?
|
|
911
|
-
}),
|
|
949
|
+
m ? c.push(m) : c.length && (h.push(c), c = []);
|
|
950
|
+
}), c.length && h.push(c), !h.length) return p;
|
|
912
951
|
const d = n[s];
|
|
913
952
|
return i`<svg class="sparkline" width=${96} height=${26} viewBox="0 0 ${96} ${26}" role="img" aria-label="rank history">
|
|
914
|
-
${h.map((m) =>
|
|
953
|
+
${h.map((m) => Q`<polyline fill="none" stroke="var(--hsot-red)" stroke-width="2"
|
|
915
954
|
points=${m.map((f) => `${f.x.toFixed(1)},${f.y.toFixed(1)}`).join(" ")}></polyline>`)}
|
|
916
|
-
${d ?
|
|
955
|
+
${d ? Q`<circle cx=${d.x.toFixed(1)} cy=${d.y.toFixed(1)} r="3" fill="var(--hsot-black)"></circle>` : p}
|
|
917
956
|
</svg>`;
|
|
918
957
|
}
|
|
919
958
|
movement(e, t, s) {
|
|
920
|
-
const r =
|
|
959
|
+
const r = Ie(e, t, s);
|
|
921
960
|
return r.kind === "up" ? i`<span class="delta up">▲ ${r.delta}</span>` : r.kind === "down" ? i`<span class="delta down">▼ ${r.delta}</span>` : r.kind === "new" ? i`<span class="delta new">NEW</span>` : r.kind === "same" ? i`<span class="delta same">—</span>` : i`<span class="delta same">·</span>`;
|
|
922
961
|
}
|
|
923
962
|
renderView() {
|
|
924
963
|
const e = this.ctx, t = this.data.polls;
|
|
925
964
|
if (!t.length) return i`<div class="view"><p class="empty">No ${this.sport} polls published yet this season.</p></div>`;
|
|
926
|
-
const s = Math.max(0, t.findIndex((m) => m.effectiveDate === this.pollDate)), r = t[s] || t[0], o = t[s + 1] || null,
|
|
965
|
+
const s = Math.max(0, t.findIndex((m) => m.effectiveDate === this.pollDate)), r = t[s] || t[0], o = t[s + 1] || null, l = t.slice().reverse(), n = l.indexOf(r), h = v(this.data.conferences), c = (r.teamIds || [])[0], d = c ? S(e, c) : null;
|
|
927
966
|
return i`
|
|
928
|
-
${
|
|
929
|
-
title: i`${
|
|
967
|
+
${V(this, e, {
|
|
968
|
+
title: i`${I(this.sport)} Top 25`,
|
|
930
969
|
sub: i`The HighSchoolOT poll · updated weekly · ${t.length} polls this season`,
|
|
931
970
|
teams: this.data.teams
|
|
932
971
|
})}
|
|
@@ -938,7 +977,7 @@ class Fe extends y {
|
|
|
938
977
|
this.pollDate = m.target.value;
|
|
939
978
|
}}>
|
|
940
979
|
${t.map((m, f) => i`<option value=${m.effectiveDate} ?selected=${m === r}>
|
|
941
|
-
${
|
|
980
|
+
${y(m.effectiveDate, { month: "long", day: "numeric", year: "numeric" })}${f === 0 ? " · current" : ""}
|
|
942
981
|
</option>`)}
|
|
943
982
|
</select>
|
|
944
983
|
<button class="chip" ?disabled=${s >= t.length - 1}
|
|
@@ -952,22 +991,22 @@ class Fe extends y {
|
|
|
952
991
|
<span class="spacer"></span>
|
|
953
992
|
<span class="asof">Movement vs. the previous poll · sparkline = season rank history</span>
|
|
954
993
|
</div>
|
|
955
|
-
${d ? this.renderHero(e, r, o,
|
|
994
|
+
${d ? this.renderHero(e, r, o, c, d, h) : p}
|
|
956
995
|
<div class="card"><div class="tablewrap"><table class="data">
|
|
957
996
|
<thead><tr>
|
|
958
997
|
<th class="num">Rk</th><th>Mvmt</th><th>Team</th><th class="num">Record</th>
|
|
959
998
|
<th>Conference</th><th>Last result</th><th>Next</th><th>Season</th>
|
|
960
999
|
</tr></thead>
|
|
961
1000
|
<tbody>
|
|
962
|
-
${(r.teamIds || []).map((m, f) => f === 0 || !m ? p : this.renderRow(e, r, o,
|
|
1001
|
+
${(r.teamIds || []).map((m, f) => f === 0 || !m ? p : this.renderRow(e, r, o, l, n, h, m, f + 1))}
|
|
963
1002
|
</tbody>
|
|
964
1003
|
</table></div></div>
|
|
965
1004
|
<p class="note">Ranks elsewhere on the site resolve the poll in effect on the game date, so past box scores keep the ranks they were played under.</p>
|
|
966
1005
|
`)}
|
|
967
1006
|
`;
|
|
968
1007
|
}
|
|
969
|
-
renderHero(e, t, s, r, o,
|
|
970
|
-
const n = e.records[r], h =
|
|
1008
|
+
renderHero(e, t, s, r, o, l) {
|
|
1009
|
+
const n = e.records[r], h = J(e.records, r), c = l[e.teamsById[r]?.conferenceId], d = `linear-gradient(120deg, ${o.colorPrimary || "#030711"} 0%, var(--hsot-black) 85%)`;
|
|
971
1010
|
return i`
|
|
972
1011
|
<div class="hero1" style="background:${d}">
|
|
973
1012
|
<div class="bigrank">#1</div>
|
|
@@ -975,8 +1014,8 @@ class Fe extends y {
|
|
|
975
1014
|
<div>
|
|
976
1015
|
<h2><a href=${u(e.hrefs.school, { id: o.id })}>${o.name} ${o.mascot || ""}</a></h2>
|
|
977
1016
|
<div class="facts">
|
|
978
|
-
${w(n)} overall${
|
|
979
|
-
· streak ${
|
|
1017
|
+
${w(n)} overall${c ? i` · ${w(n, !0)} ${c.name}` : p}
|
|
1018
|
+
· streak ${L(n?.results) || "·"}
|
|
980
1019
|
${h ? i` · last: ${h.mark} ${h.my}-${h.their} vs ${A(e, h.opp)}` : p}
|
|
981
1020
|
${this.movement(t, s, r)}
|
|
982
1021
|
</div>
|
|
@@ -984,33 +1023,33 @@ class Fe extends y {
|
|
|
984
1023
|
</div>
|
|
985
1024
|
`;
|
|
986
1025
|
}
|
|
987
|
-
renderRow(e, t, s, r, o,
|
|
988
|
-
const
|
|
989
|
-
if (!
|
|
990
|
-
const d = e.records[n], m =
|
|
991
|
-
location.href = u(e.hrefs.school, { id:
|
|
1026
|
+
renderRow(e, t, s, r, o, l, n, h) {
|
|
1027
|
+
const c = S(e, n);
|
|
1028
|
+
if (!c) return p;
|
|
1029
|
+
const d = e.records[n], m = J(e.records, n), f = q(this.data.games, n), g = l[e.teamsById[n]?.conferenceId], k = () => {
|
|
1030
|
+
location.href = u(e.hrefs.school, { id: c.id });
|
|
992
1031
|
};
|
|
993
1032
|
return i`
|
|
994
|
-
<tr class="rowlink" @click=${(
|
|
995
|
-
|
|
1033
|
+
<tr class="rowlink" @click=${(O) => {
|
|
1034
|
+
O.target.closest("a") || k();
|
|
996
1035
|
}}>
|
|
997
1036
|
<td class="num" style="font-weight:700">${h}</td>
|
|
998
1037
|
<td>${this.movement(t, s, n)}</td>
|
|
999
|
-
<td class="teamcell">${C(
|
|
1000
|
-
<span class="mut" style="font-size:0.78rem">${
|
|
1038
|
+
<td class="teamcell">${C(c)}<a href=${u(e.hrefs.school, { id: c.id })}>${c.name}</a>
|
|
1039
|
+
<span class="mut" style="font-size:0.78rem">${c.mascot || ""}</span></td>
|
|
1001
1040
|
<td class="num">${w(d)}</td>
|
|
1002
1041
|
<td class="mut">${g?.name || "Independent"}</td>
|
|
1003
1042
|
<td>${m ? i`<a class="box" style="text-decoration:none" href=${u(e.hrefs.game, { sport: this.sport, id: m.gameId })}>
|
|
1004
1043
|
<b style="color:${m.mark === "W" ? "var(--hsot-win)" : m.mark === "L" ? "var(--hsot-loss)" : "var(--hsot-tie)"}">${m.mark}</b>
|
|
1005
1044
|
${m.my}-${m.their} vs ${A(e, m.opp)}</a>` : i`<span class="mut">·</span>`}</td>
|
|
1006
|
-
<td>${
|
|
1045
|
+
<td>${oe(e, f, n)}</td>
|
|
1007
1046
|
<td>${this.sparkline(n, r, o)}</td>
|
|
1008
1047
|
</tr>
|
|
1009
1048
|
`;
|
|
1010
1049
|
}
|
|
1011
1050
|
}
|
|
1012
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings",
|
|
1013
|
-
const
|
|
1051
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings", ze);
|
|
1052
|
+
const Be = b`
|
|
1014
1053
|
.schoolhero { color: var(--hsot-white); padding: 1.6rem 1.25rem 1.3rem; }
|
|
1015
1054
|
.schoolhero .inner { max-width: 1366px; margin: 0 auto; display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
|
|
1016
1055
|
.schoolhero .crest {
|
|
@@ -1035,10 +1074,10 @@ const ze = b`
|
|
|
1035
1074
|
.cols { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 1.25rem; }
|
|
1036
1075
|
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } .schoolhero h1 { font-size: 1.9rem; } }
|
|
1037
1076
|
`;
|
|
1038
|
-
class
|
|
1039
|
-
static styles = [...F,
|
|
1077
|
+
class Pe extends $ {
|
|
1078
|
+
static styles = [...F, Be];
|
|
1040
1079
|
static properties = {
|
|
1041
|
-
|
|
1080
|
+
...$.properties,
|
|
1042
1081
|
schoolId: { type: String, attribute: "school-id" },
|
|
1043
1082
|
sport: { type: String },
|
|
1044
1083
|
season: { type: String },
|
|
@@ -1053,25 +1092,25 @@ class Be extends y {
|
|
|
1053
1092
|
e && !this.sport && (this.sport = e);
|
|
1054
1093
|
}
|
|
1055
1094
|
async fetchData(e) {
|
|
1056
|
-
const t = this.season || N(), s = await e.getSchool(this.schoolId), o = (await e.listTeams({ schoolId: this.schoolId })).items,
|
|
1057
|
-
|
|
1058
|
-
|
|
1095
|
+
const t = this.season || N(), s = await e.getSchool(this.schoolId), o = (await e.listTeams({ schoolId: this.schoolId })).items, l = o.find((k) => k.sport === (this.sport || "football")) || o[0] || null, [n, h, c, d, m, f, g] = await Promise.all([
|
|
1096
|
+
l ? e.listGames({ sport: l.sport, season: t }) : Promise.resolve({ items: [] }),
|
|
1097
|
+
l ? e.listTeams({ sport: l.sport }) : Promise.resolve({ items: [] }),
|
|
1059
1098
|
e.listSchools(),
|
|
1060
1099
|
e.listConferences(),
|
|
1061
|
-
|
|
1062
|
-
|
|
1100
|
+
l ? e.listRankings({ sport: l.sport }) : Promise.resolve({ items: [] }),
|
|
1101
|
+
l ? e.listRosters({ teamId: l.id }) : Promise.resolve({ items: [] }),
|
|
1063
1102
|
// teamId is the public surface's one players filter (roster
|
|
1064
1103
|
// membership) — never fetch the whole collection.
|
|
1065
|
-
|
|
1104
|
+
l ? e.listPlayers({ teamId: l.id }) : Promise.resolve({ items: [] })
|
|
1066
1105
|
]);
|
|
1067
1106
|
return {
|
|
1068
1107
|
season: t,
|
|
1069
1108
|
school: s,
|
|
1070
1109
|
teams: o,
|
|
1071
|
-
active:
|
|
1110
|
+
active: l,
|
|
1072
1111
|
games: n.items,
|
|
1073
1112
|
allTeams: h.items,
|
|
1074
|
-
schools:
|
|
1113
|
+
schools: c.items,
|
|
1075
1114
|
conferences: d.items,
|
|
1076
1115
|
rankings: m.items,
|
|
1077
1116
|
roster: f.items.find((k) => k.season === t) || null,
|
|
@@ -1094,21 +1133,20 @@ class Be extends y {
|
|
|
1094
1133
|
renderView() {
|
|
1095
1134
|
const { school: e, teams: t, active: s, season: r } = this.data;
|
|
1096
1135
|
if (!e) return i`<div class="view"><p class="empty">School not found.</p></div>`;
|
|
1097
|
-
const o = this.ctx,
|
|
1136
|
+
const o = this.ctx, l = E(e.colorPrimary || "#030711"), n = (e.adm || [])[0], h = v(this.data.conferences), c = s ? h[s.conferenceId] : null;
|
|
1098
1137
|
return i`
|
|
1099
|
-
<div class="schoolhero" style="background:linear-gradient(115deg, ${e.colorPrimary || "#030711"} 0%, ${e.colorPrimary || "#030711"} 55%, var(--hsot-black) 100%);color:${
|
|
1138
|
+
<div class="schoolhero" style="background:linear-gradient(115deg, ${e.colorPrimary || "#030711"} 0%, ${e.colorPrimary || "#030711"} 55%, var(--hsot-black) 100%);color:${l}">
|
|
1100
1139
|
<div class="inner">
|
|
1101
|
-
${_(e, 84) ? i`<img class="crest logo" alt="" loading="lazy" src=${_(e, 84)} />` : i`<div class="crest" style="background:${e.colorSecondary || "#7C7C7C"};color:${E(e.colorSecondary || "#7C7C7C")}">${
|
|
1140
|
+
${_(e, 84) ? i`<img class="crest logo" alt="" loading="lazy" src=${_(e, 84)} />` : i`<div class="crest" style="background:${e.colorSecondary || "#7C7C7C"};color:${E(e.colorSecondary || "#7C7C7C")}">${j(e)}</div>`}
|
|
1102
1141
|
<div style="min-width:260px">
|
|
1103
1142
|
<h1>${e.name} <span class="mascot">${e.mascot || ""}</span></h1>
|
|
1104
1143
|
<div class="facts">
|
|
1105
1144
|
${e.location ? i`<span><b>Location</b>${e.location}${e.county ? i` · ${e.county} County` : p}</span>` : p}
|
|
1106
1145
|
${e.association ? i`<span><b>League</b>${e.association}${e.classification ? i` · ${e.classification}` : p}</span>` : p}
|
|
1107
|
-
${
|
|
1146
|
+
${c ? i`<span><b>Conference</b>${c.name}</span>` : p}
|
|
1108
1147
|
${n ? i`<span><b>Enrollment</b>${n.value.toLocaleString()} (${n.season} ADM)</span>` : p}
|
|
1109
1148
|
${e.openingYear ? i`<span><b>Opened</b>${e.openingYear}</span>` : p}
|
|
1110
1149
|
${e.areaCode ? i`<span><b>Area</b>${e.areaCode}</span>` : p}
|
|
1111
|
-
${e.tagSlug ? i`<span><b>Tag</b>#${e.tagSlug}</span>` : p}
|
|
1112
1150
|
</div>
|
|
1113
1151
|
</div>
|
|
1114
1152
|
</div>
|
|
@@ -1122,22 +1160,22 @@ class Be extends y {
|
|
|
1122
1160
|
</div>
|
|
1123
1161
|
${B(this, i`
|
|
1124
1162
|
${P(this)}
|
|
1125
|
-
${s ? this.renderTeam(o, s,
|
|
1163
|
+
${s ? this.renderTeam(o, s, c, r) : i`<p class="empty">No teams recorded for this school yet.</p>`}
|
|
1126
1164
|
`)}
|
|
1127
1165
|
`;
|
|
1128
1166
|
}
|
|
1129
1167
|
renderTeam(e, t, s, r) {
|
|
1130
|
-
const o = e.records[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] },
|
|
1168
|
+
const o = e.records[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] }, l = o.w + o.l + o.t, n = s ? this.data.allTeams.filter((m) => m.conferenceId === s.id) : [], h = s ? ae(n, e.records).findIndex((m) => m.team.id === t.id) + 1 : 0, c = W(e.rankings, e.teamsById, t.id, t.sport, null), d = this.data.games.filter((m) => m.homeTeamId === t.id || m.awayTeamId === t.id).sort((m, f) => String(m.date).localeCompare(String(f.date)));
|
|
1131
1169
|
return i`
|
|
1132
1170
|
<div class="tiles">
|
|
1133
|
-
<div class="tile"><div class="k">Overall</div><div class="v">${w(o)}</div><div class="s">${
|
|
1171
|
+
<div class="tile"><div class="k">Overall</div><div class="v">${w(o)}</div><div class="s">${l} games played</div></div>
|
|
1134
1172
|
<div class="tile"><div class="k">${s?.name || "Conference"}</div><div class="v">${w(o, !0)}</div>
|
|
1135
|
-
<div class="s">${h ? `${
|
|
1136
|
-
<div class="tile"><div class="k">Points</div><div class="v">${
|
|
1137
|
-
<div class="s">scored per game · ${
|
|
1138
|
-
<div class="tile"><div class="k">Streak</div><div class="v">${
|
|
1139
|
-
<div class="s">last 5: ${
|
|
1140
|
-
<div class="tile"><div class="k">HSOT Top 25</div><div class="v">${
|
|
1173
|
+
<div class="s">${h ? `${me(h)} of ${n.length}` : "·"}</div></div>
|
|
1174
|
+
<div class="tile"><div class="k">Points</div><div class="v">${l ? (o.pf / l).toFixed(1) : "0.0"}</div>
|
|
1175
|
+
<div class="s">scored per game · ${l ? (o.pa / l).toFixed(1) : "0.0"} allowed</div></div>
|
|
1176
|
+
<div class="tile"><div class="k">Streak</div><div class="v">${L(o.results) || "·"}</div>
|
|
1177
|
+
<div class="s">last 5: ${K(e, t.id)}</div></div>
|
|
1178
|
+
<div class="tile"><div class="k">HSOT Top 25</div><div class="v">${c ? `#${c}` : "NR"}</div>
|
|
1141
1179
|
<div class="s"><a href=${u(e.hrefs.section, { sport: t.sport, view: "rankings" })}>full poll</a></div></div>
|
|
1142
1180
|
</div>
|
|
1143
1181
|
${(t.championships || []).length ? i`
|
|
@@ -1159,20 +1197,20 @@ class Be extends y {
|
|
|
1159
1197
|
`;
|
|
1160
1198
|
}
|
|
1161
1199
|
renderGameRow(e, t, s) {
|
|
1162
|
-
const r = s.homeTeamId === t.id, o = r ? s.awayTeamId : s.homeTeamId,
|
|
1163
|
-
let h = i`<span class="mut">${
|
|
1200
|
+
const r = s.homeTeamId === t.id, o = r ? s.awayTeamId : s.homeTeamId, l = r ? s.homeScore : s.awayScore, n = r ? s.awayScore : s.homeScore;
|
|
1201
|
+
let h = i`<span class="mut">${U(s.time)}</span>`;
|
|
1164
1202
|
if (s.state === "final") {
|
|
1165
|
-
const d =
|
|
1166
|
-
h = i`<span class=${m}>${m}</span> ${
|
|
1167
|
-
} else s.state === "live" && (h = i`<span style="color:var(--hsot-red)">${
|
|
1168
|
-
const
|
|
1203
|
+
const d = G(s), m = d === "tie" ? "T" : d === (r ? "home" : "away") ? "W" : "L";
|
|
1204
|
+
h = i`<span class=${m}>${m}</span> ${l}-${n}${s.finish === "overtime" ? i` <span class="mut">OT</span>` : p}${s.forfeit && s.forfeit !== "none" ? i` <span class="mut">FF</span>` : p}`;
|
|
1205
|
+
} else s.state === "live" && (h = i`<span style="color:var(--hsot-red)">${l}-${n}</span>`);
|
|
1206
|
+
const c = s.gameType === "conference" ? "Conf" : s.gameType === "nonconference" ? "Non-conf" : s.gameType === "playoff" ? `Playoff${s.label ? ` · ${s.label}` : ""}` : "Scrimmage";
|
|
1169
1207
|
return i`
|
|
1170
1208
|
<li>
|
|
1171
|
-
<span class="d">${
|
|
1172
|
-
${R(s)}
|
|
1209
|
+
<span class="d">${y(s.date)}</span>
|
|
1210
|
+
${te(s).kind === "sched" ? p : R(s)}
|
|
1173
1211
|
<span class="res">${h}</span>
|
|
1174
|
-
<span class="opp">${r ? "vs" : "at"} ${
|
|
1175
|
-
<span class="pill type">${
|
|
1212
|
+
<span class="opp">${r ? "vs" : "at"} ${re(e, o, s.date)}
|
|
1213
|
+
<span class="pill type">${c}</span>
|
|
1176
1214
|
${s.broadcast ? i`<span class="pill class">${s.broadcast}</span>` : p}
|
|
1177
1215
|
</span>
|
|
1178
1216
|
<span class="where">${s.venue || ""}</span>
|
|
@@ -1184,20 +1222,20 @@ class Be extends y {
|
|
|
1184
1222
|
const t = this.data.roster;
|
|
1185
1223
|
if (!t)
|
|
1186
1224
|
return i`<p class="empty">Roster not published for ${e}.</p>`;
|
|
1187
|
-
const s = v(this.data.players), r = t.entries.slice().sort((o,
|
|
1225
|
+
const s = v(this.data.players), r = t.entries.slice().sort((o, l) => (o.number || 0) - (l.number || 0));
|
|
1188
1226
|
return i`
|
|
1189
1227
|
<div class="tablewrap"><table class="data">
|
|
1190
1228
|
<thead><tr><th class="num">No.</th><th>Player</th><th>Pos</th><th>Class</th><th class="num">Ht</th><th class="num">Wt</th></tr></thead>
|
|
1191
1229
|
<tbody>
|
|
1192
1230
|
${r.map((o) => {
|
|
1193
|
-
const
|
|
1194
|
-
return
|
|
1231
|
+
const l = s[o.playerId];
|
|
1232
|
+
return l ? i`<tr>
|
|
1195
1233
|
<td class="num mut">${o.number ?? "·"}</td>
|
|
1196
|
-
<td style="font-weight:500">${
|
|
1234
|
+
<td style="font-weight:500">${l.firstName} ${l.lastName}</td>
|
|
1197
1235
|
<td>${o.position || "·"}</td>
|
|
1198
|
-
<td class="mut">${
|
|
1199
|
-
<td class="num">${
|
|
1200
|
-
<td class="num">${
|
|
1236
|
+
<td class="mut">${l.classOf || "·"}</td>
|
|
1237
|
+
<td class="num">${de(l.heightIn)}</td>
|
|
1238
|
+
<td class="num">${l.weightLb || "·"}</td>
|
|
1201
1239
|
</tr>` : p;
|
|
1202
1240
|
})}
|
|
1203
1241
|
</tbody>
|
|
@@ -1205,16 +1243,16 @@ class Be extends y {
|
|
|
1205
1243
|
`;
|
|
1206
1244
|
}
|
|
1207
1245
|
}
|
|
1208
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school",
|
|
1209
|
-
const
|
|
1210
|
-
function
|
|
1246
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school", Pe);
|
|
1247
|
+
const Ee = "https://api.wral.com/search";
|
|
1248
|
+
function _e(a) {
|
|
1211
1249
|
return a.map((e) => `uri:"${e}"`).join(" OR ");
|
|
1212
1250
|
}
|
|
1213
|
-
function
|
|
1214
|
-
const t = String(a ||
|
|
1251
|
+
function Ae(a, e) {
|
|
1252
|
+
const t = String(a || Ee).replace(/\/+$/, ""), s = new URLSearchParams({ query: _e(e), sort: "score", lang: "en" });
|
|
1215
1253
|
return `${t}/v1/query?${s}`;
|
|
1216
1254
|
}
|
|
1217
|
-
function
|
|
1255
|
+
function ie(a) {
|
|
1218
1256
|
try {
|
|
1219
1257
|
const e = new URL(a);
|
|
1220
1258
|
if (/(^|\.)smugmug\.com$/i.test(e.hostname)) {
|
|
@@ -1229,13 +1267,13 @@ function oe(a) {
|
|
|
1229
1267
|
}
|
|
1230
1268
|
return { uri: a, title: a };
|
|
1231
1269
|
}
|
|
1232
|
-
async function
|
|
1233
|
-
const r = await ((...n) => fetch(...n))(
|
|
1270
|
+
async function Re(a, e, t) {
|
|
1271
|
+
const r = await ((...n) => fetch(...n))(Ae(a, e));
|
|
1234
1272
|
if (!r.ok) throw new Error(`search answered ${r.status}`);
|
|
1235
|
-
const o = await r.json(),
|
|
1236
|
-
return e.map((n) =>
|
|
1273
|
+
const o = await r.json(), l = new Map((o.items || []).map((n) => [n.uri, n]));
|
|
1274
|
+
return e.map((n) => l.get(n) || ie(n));
|
|
1237
1275
|
}
|
|
1238
|
-
const
|
|
1276
|
+
const Ne = b`
|
|
1239
1277
|
.breadcrumbs { font-size: 0.8125rem; margin: 0.9rem 0 0; color: var(--hsot-gray-5); }
|
|
1240
1278
|
.breadcrumbs a { text-decoration: none; }
|
|
1241
1279
|
.scorehead { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center; padding: 1.4rem 1rem; }
|
|
@@ -1274,10 +1312,10 @@ const Re = b`
|
|
|
1274
1312
|
.cols { grid-template-columns: 1fr; }
|
|
1275
1313
|
}
|
|
1276
1314
|
`;
|
|
1277
|
-
class Le extends
|
|
1278
|
-
static styles = [...F,
|
|
1315
|
+
class Le extends $ {
|
|
1316
|
+
static styles = [...F, Ne];
|
|
1279
1317
|
static properties = {
|
|
1280
|
-
|
|
1318
|
+
...$.properties,
|
|
1281
1319
|
gameId: { type: String, attribute: "game-id" },
|
|
1282
1320
|
// The public site search that resolves Game.coverageUrls into cards
|
|
1283
1321
|
// (DEV-1236). Shared cross-stage by design — see the studio host's
|
|
@@ -1289,7 +1327,7 @@ class Le extends y {
|
|
|
1289
1327
|
super(), this.gameId = "", this.searchApi = "";
|
|
1290
1328
|
}
|
|
1291
1329
|
async fetchData(e) {
|
|
1292
|
-
const t = await e.getGame(this.gameId), s = Array.isArray(t.coverageUrls) ? t.coverageUrls : [], [r, o,
|
|
1330
|
+
const t = await e.getGame(this.gameId), s = Array.isArray(t.coverageUrls) ? t.coverageUrls : [], [r, o, l, n, h, c] = await Promise.all([
|
|
1293
1331
|
e.listSchools(),
|
|
1294
1332
|
e.listTeams({ sport: t.sport }),
|
|
1295
1333
|
e.listConferences(),
|
|
@@ -1297,16 +1335,16 @@ class Le extends y {
|
|
|
1297
1335
|
e.listGames({ sport: t.sport, season: t.season }),
|
|
1298
1336
|
// A search outage must not blank the box score — degrade to bare
|
|
1299
1337
|
// links (fetchCoverage already degrades per-URL index misses).
|
|
1300
|
-
s.length ?
|
|
1338
|
+
s.length ? Re(this.searchApi, s).catch(() => s.map(ie)) : Promise.resolve([])
|
|
1301
1339
|
]);
|
|
1302
1340
|
return {
|
|
1303
1341
|
game: t,
|
|
1304
1342
|
schools: r.items,
|
|
1305
1343
|
teams: o.items,
|
|
1306
|
-
conferences:
|
|
1344
|
+
conferences: l.items,
|
|
1307
1345
|
rankings: n.items,
|
|
1308
1346
|
games: h.items,
|
|
1309
|
-
coverage:
|
|
1347
|
+
coverage: c
|
|
1310
1348
|
};
|
|
1311
1349
|
}
|
|
1312
1350
|
get ctx() {
|
|
@@ -1322,14 +1360,14 @@ class Le extends y {
|
|
|
1322
1360
|
renderView() {
|
|
1323
1361
|
const e = this.data.game;
|
|
1324
1362
|
if (!e) return i`<div class="view"><p class="empty">Game not found.</p></div>`;
|
|
1325
|
-
const t = this.ctx, s = v(this.data.conferences), r = t.teamsById[e.awayTeamId] ? t.schoolsById[t.teamsById[e.awayTeamId].schoolId] : null, o = t.teamsById[e.homeTeamId] ? t.schoolsById[t.teamsById[e.homeTeamId].schoolId] : null,
|
|
1363
|
+
const t = this.ctx, s = v(this.data.conferences), r = t.teamsById[e.awayTeamId] ? t.schoolsById[t.teamsById[e.awayTeamId].schoolId] : null, o = t.teamsById[e.homeTeamId] ? t.schoolsById[t.teamsById[e.homeTeamId].schoolId] : null, l = G(e), n = (d) => e.state === "final" && l !== d && l !== "tie" ? "opacity:0.45" : "", h = e.conferenceId ? s[e.conferenceId] : null, c = this.data.games.filter((d) => d.id !== e.id && d.state === "final" && d.gameType !== "scrimmage" && (d.homeTeamId === e.homeTeamId && d.awayTeamId === e.awayTeamId || d.homeTeamId === e.awayTeamId && d.awayTeamId === e.homeTeamId));
|
|
1326
1364
|
return i`
|
|
1327
1365
|
${B(this, i`
|
|
1328
1366
|
${P(this)}
|
|
1329
1367
|
<p class="breadcrumbs">
|
|
1330
|
-
<a href=${u(t.hrefs.section, { sport: e.sport, view: "scores" })}>${
|
|
1368
|
+
<a href=${u(t.hrefs.section, { sport: e.sport, view: "scores" })}>${I(e.sport)}</a> /
|
|
1331
1369
|
<a href=${u(t.hrefs.section, { sport: e.sport, view: "scores" })}>Scores/Schedules</a> /
|
|
1332
|
-
${
|
|
1370
|
+
${T(t, e.awayTeamId)} at ${T(t, e.homeTeamId)}
|
|
1333
1371
|
</p>
|
|
1334
1372
|
<div class="card">
|
|
1335
1373
|
<div class="scorehead">
|
|
@@ -1341,7 +1379,7 @@ class Le extends y {
|
|
|
1341
1379
|
<span style=${n("home")}>${e.homeScore}</span>
|
|
1342
1380
|
</div>
|
|
1343
1381
|
<div class="status">${R(e)}</div>
|
|
1344
|
-
<div class="status">${
|
|
1382
|
+
<div class="status">${y(e.date, { weekday: "short", month: "short", day: "numeric", year: "numeric" })}${e.state === "scheduled" && e.time ? i` · ${U(e.time)}` : p} · ${e.venue || "Venue TBD"}
|
|
1345
1383
|
${e.broadcast ? i` · <span class="pill class">${e.broadcast}</span>` : p}</div>
|
|
1346
1384
|
<div class="status">
|
|
1347
1385
|
<span class="pill type">${e.gameType === "conference" ? `${h?.name || "Conference"} game` : e.gameType}</span>
|
|
@@ -1374,12 +1412,12 @@ class Le extends y {
|
|
|
1374
1412
|
<div class="cols">
|
|
1375
1413
|
${[[e.awayTeamId, r], [e.homeTeamId, o]].map(([d, m]) => this.renderContext(t, d, m))}
|
|
1376
1414
|
</div>
|
|
1377
|
-
${
|
|
1415
|
+
${c.length ? i`
|
|
1378
1416
|
<div class="section-title">Head to head this season</div>
|
|
1379
1417
|
<div class="card"><ul class="gamelist">
|
|
1380
|
-
${
|
|
1381
|
-
<span class="d">${
|
|
1382
|
-
<span class="opp">${
|
|
1418
|
+
${c.map((d) => i`<li>
|
|
1419
|
+
<span class="d">${y(d.date)}</span>${R(d)}
|
|
1420
|
+
<span class="opp">${T(t, d.awayTeamId)} ${d.awayScore}, ${T(t, d.homeTeamId)} ${d.homeScore}</span>
|
|
1383
1421
|
<a class="box" href=${u(t.hrefs.game, { sport: e.sport, id: d.id })}>Box score →</a>
|
|
1384
1422
|
</li>`)}
|
|
1385
1423
|
</ul></div>` : p}
|
|
@@ -1388,13 +1426,13 @@ class Le extends y {
|
|
|
1388
1426
|
}
|
|
1389
1427
|
teamBlock(e, t, s, r, o) {
|
|
1390
1428
|
if (!r) return i`<div class="teamblock ${o ? "right" : ""}"><div class="tname">TBD</div></div>`;
|
|
1391
|
-
const
|
|
1429
|
+
const l = e.teamsById[s], n = e.records[s], h = _(r, 58);
|
|
1392
1430
|
return i`
|
|
1393
1431
|
<div class="teamblock ${o ? "right" : ""}">
|
|
1394
|
-
${h ? i`<img class="crest logo" alt="" loading="lazy" src=${h} />` : i`<span class="crest" style="background:${r.colorPrimary || "#030711"};color:${E(r.colorPrimary || "#030711")}">${
|
|
1432
|
+
${h ? i`<img class="crest logo" alt="" loading="lazy" src=${h} />` : i`<span class="crest" style="background:${r.colorPrimary || "#030711"};color:${E(r.colorPrimary || "#030711")}">${j(r)}</span>`}
|
|
1395
1433
|
<div>
|
|
1396
|
-
<div class="tname">${
|
|
1397
|
-
<div class="trec">${r.mascot || ""} · ${w(n)}${
|
|
1434
|
+
<div class="tname">${Y(e, s, t.date)}<a href=${u(e.hrefs.school, { id: r.id })}>${r.name}</a></div>
|
|
1435
|
+
<div class="trec">${r.mascot || ""} · ${w(n)}${l?.conferenceId ? i` · ${w(n, !0)} conf` : p}</div>
|
|
1398
1436
|
</div>
|
|
1399
1437
|
</div>
|
|
1400
1438
|
`;
|
|
@@ -1403,19 +1441,19 @@ class Le extends y {
|
|
|
1403
1441
|
const r = e.periodScores || [];
|
|
1404
1442
|
if (!r.length)
|
|
1405
1443
|
return i`<p class="empty" style="text-align:center">Period scoring will appear once the game starts.</p>`;
|
|
1406
|
-
const o = Math.max(4, ...r.map((
|
|
1444
|
+
const o = Math.max(4, ...r.map((c) => c.period)), l = (c) => c <= 4 ? String(c) : `OT${c > 5 ? c - 4 : ""}`, n = (c, d) => {
|
|
1407
1445
|
const m = r.find((f) => f.period === d);
|
|
1408
|
-
return m ? m[
|
|
1409
|
-
}, h = (
|
|
1446
|
+
return m ? m[c] : e.state === "final" ? 0 : "·";
|
|
1447
|
+
}, h = (c, d, m) => i`
|
|
1410
1448
|
<tr>
|
|
1411
|
-
<td class="teamcell">${C(
|
|
1449
|
+
<td class="teamcell">${C(c, 20)}${c?.abbr || "TBD"}</td>
|
|
1412
1450
|
${Array.from({ length: o }, (f, g) => i`<td class="num">${n(d, g + 1)}</td>`)}
|
|
1413
1451
|
<td class="num" style="font-weight:700">${m}</td>
|
|
1414
1452
|
</tr>`;
|
|
1415
1453
|
return i`
|
|
1416
1454
|
<div class="tablewrap" style="border-top:1px solid var(--hsot-gray-2)">
|
|
1417
1455
|
<table class="data" style="max-width:560px;margin:0.6rem auto 0.9rem">
|
|
1418
|
-
<thead><tr><th>Team</th>${Array.from({ length: o }, (
|
|
1456
|
+
<thead><tr><th>Team</th>${Array.from({ length: o }, (c, d) => i`<th class="num">${l(d + 1)}</th>`)}<th class="num">T</th></tr></thead>
|
|
1419
1457
|
<tbody>
|
|
1420
1458
|
${h(t, "away", e.awayScore)}
|
|
1421
1459
|
${h(s, "home", e.homeScore)}
|
|
@@ -1426,15 +1464,15 @@ class Le extends y {
|
|
|
1426
1464
|
}
|
|
1427
1465
|
renderContext(e, t, s) {
|
|
1428
1466
|
if (!s) return p;
|
|
1429
|
-
const r = e.records[t], o =
|
|
1467
|
+
const r = e.records[t], o = q(this.data.games, t);
|
|
1430
1468
|
return i`
|
|
1431
1469
|
<div class="card ctxcard">
|
|
1432
1470
|
<div class="who">${C(s)}${s.name}</div>
|
|
1433
1471
|
<div class="row">
|
|
1434
|
-
<span>Last 5: ${
|
|
1435
|
-
<span>Streak: <b>${r ?
|
|
1472
|
+
<span>Last 5: ${K(e, t)}</span>
|
|
1473
|
+
<span>Streak: <b>${r ? L(r.results) : "·"}</b></span>
|
|
1436
1474
|
<span>PF/PA: <b>${r ? `${r.pf} / ${r.pa}` : "·"}</b></span>
|
|
1437
|
-
<span>Next: ${o ? i`${
|
|
1475
|
+
<span>Next: ${o ? i`${y(o.date, { month: "numeric", day: "numeric" })}
|
|
1438
1476
|
${o.homeTeamId === t ? "vs" : "at"} ${A(e, o.homeTeamId === t ? o.awayTeamId : o.homeTeamId)}` : "·"}</span>
|
|
1439
1477
|
</div>
|
|
1440
1478
|
</div>
|
|
@@ -1442,8 +1480,8 @@ class Le extends y {
|
|
|
1442
1480
|
}
|
|
1443
1481
|
}
|
|
1444
1482
|
globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore", Le);
|
|
1445
|
-
const
|
|
1446
|
-
class
|
|
1483
|
+
const Oe = 250, He = 2;
|
|
1484
|
+
class Ue extends ee {
|
|
1447
1485
|
static properties = {
|
|
1448
1486
|
api: { type: String },
|
|
1449
1487
|
schoolHref: { type: String, attribute: "school-href" },
|
|
@@ -1523,11 +1561,11 @@ class He extends te {
|
|
|
1523
1561
|
}
|
|
1524
1562
|
onInput(e) {
|
|
1525
1563
|
const t = e.target.value.trim();
|
|
1526
|
-
if (clearTimeout(this.debounceTimer), t.length <
|
|
1564
|
+
if (clearTimeout(this.debounceTimer), t.length < He) {
|
|
1527
1565
|
this.abortController?.abort(), this.results = [], this.open = !1, this.searched = !1;
|
|
1528
1566
|
return;
|
|
1529
1567
|
}
|
|
1530
|
-
this.debounceTimer = setTimeout(() => this.search(t),
|
|
1568
|
+
this.debounceTimer = setTimeout(() => this.search(t), Oe);
|
|
1531
1569
|
}
|
|
1532
1570
|
async search(e) {
|
|
1533
1571
|
this.abortController?.abort(), this.abortController = new AbortController();
|
|
@@ -1620,23 +1658,23 @@ class He extends te {
|
|
|
1620
1658
|
`;
|
|
1621
1659
|
}
|
|
1622
1660
|
}
|
|
1623
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-school-search") && globalThis.customElements.define("hsot-school-search",
|
|
1661
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-school-search") && globalThis.customElements.define("hsot-school-search", Ue);
|
|
1624
1662
|
export {
|
|
1625
|
-
|
|
1663
|
+
H as D,
|
|
1626
1664
|
Le as H,
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1665
|
+
ze as a,
|
|
1666
|
+
Pe as b,
|
|
1667
|
+
Ue as c,
|
|
1668
|
+
Ce as d,
|
|
1669
|
+
De as e,
|
|
1632
1670
|
z as f,
|
|
1633
|
-
|
|
1671
|
+
ce as g,
|
|
1634
1672
|
u as h,
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1673
|
+
G as i,
|
|
1674
|
+
je as j,
|
|
1675
|
+
L as k,
|
|
1676
|
+
Ie as p,
|
|
1639
1677
|
w as r,
|
|
1640
1678
|
ae as s,
|
|
1641
|
-
|
|
1679
|
+
W as t
|
|
1642
1680
|
};
|