@wral/hsot-data 0.1.11 → 0.1.13
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/README.md +1 -1
- package/dist/define.mjs +1 -1
- package/dist/define.standalone.js +405 -375
- package/dist/{hsot-school-search-CBbEB6gv.js → hsot-school-search-Cv_ZdUOs.js} +272 -242
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -4,15 +4,15 @@ function de(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
|
-
return e.forEach(([s,
|
|
7
|
+
return e.forEach(([s, o]) => t.set(s, String(o))), `?${t.toString()}`;
|
|
8
8
|
}
|
|
9
9
|
function he({ baseUrl: a, token: e = "", fetchFn: t } = {}) {
|
|
10
10
|
if (!a) throw new Error("createClient requires a baseUrl");
|
|
11
|
-
const s = a.replace(/\/+$/, ""),
|
|
12
|
-
async function
|
|
11
|
+
const s = a.replace(/\/+$/, ""), o = t || ((...n) => fetch(...n));
|
|
12
|
+
async function r(n) {
|
|
13
13
|
const h = { Accept: "application/json" };
|
|
14
14
|
e && (h.Authorization = `Bearer ${e}`);
|
|
15
|
-
const l = await
|
|
15
|
+
const l = await o(`${s}${n}`, { headers: h });
|
|
16
16
|
if (!l.ok) {
|
|
17
17
|
const c = new Error(`api-hsot ${l.status} on ${n}`);
|
|
18
18
|
throw c.status = l.status, c;
|
|
@@ -23,25 +23,25 @@ function he({ baseUrl: a, token: e = "", fetchFn: t } = {}) {
|
|
|
23
23
|
const l = [];
|
|
24
24
|
let c = null;
|
|
25
25
|
for (let m = 0; m < ce; m += 1) {
|
|
26
|
-
const f = de(c ? { ...h, cursor: c } : h), g = await
|
|
26
|
+
const f = de(c ? { ...h, cursor: c } : h), g = await r(`${n}${f}`);
|
|
27
27
|
if (l.push(...g.items || []), c = g.nextCursor || null, !c) break;
|
|
28
28
|
}
|
|
29
29
|
return { items: l, total: l.length, nextCursor: null };
|
|
30
30
|
}
|
|
31
31
|
return {
|
|
32
32
|
listSchools: (n) => d("/schools", n),
|
|
33
|
-
getSchool: (n) =>
|
|
33
|
+
getSchool: (n) => r(`/schools/${n}`),
|
|
34
34
|
listTeams: (n) => d("/teams", n),
|
|
35
|
-
getTeam: (n) =>
|
|
35
|
+
getTeam: (n) => r(`/teams/${n}`),
|
|
36
36
|
listConferences: (n) => d("/conferences", n),
|
|
37
37
|
listPlayers: (n) => d("/players", n),
|
|
38
38
|
listRosters: (n) => d("/rosters", n),
|
|
39
39
|
listGames: (n) => d("/games", n),
|
|
40
|
-
getGame: (n) =>
|
|
40
|
+
getGame: (n) => r(`/games/${n}`),
|
|
41
41
|
listTournaments: (n) => d("/tournaments", n),
|
|
42
42
|
listSeedings: (n, h) => d(`/tournaments/${n}/seedings`, h),
|
|
43
43
|
listRankings: (n) => d("/rankings", n),
|
|
44
|
-
listSports: () =>
|
|
44
|
+
listSports: () => r("/sports")
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
const H = {
|
|
@@ -59,11 +59,11 @@ function D(a) {
|
|
|
59
59
|
section: a.getAttribute("section-href") || H.section
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
-
const
|
|
62
|
+
const S = (a) => a ? a.charAt(0).toUpperCase() + a.slice(1) : "";
|
|
63
63
|
function y(a, e) {
|
|
64
64
|
if (!a) return "TBD";
|
|
65
|
-
const [t, s,
|
|
66
|
-
return !t || !s || !
|
|
65
|
+
const [t, s, o] = String(a).split("-").map(Number);
|
|
66
|
+
return !t || !s || !o ? "TBD" : new Date(t, s - 1, o).toLocaleDateString("en-US", e || { weekday: "short", month: "short", day: "numeric" });
|
|
67
67
|
}
|
|
68
68
|
function U(a) {
|
|
69
69
|
if (!a) return "";
|
|
@@ -75,6 +75,9 @@ function U(a) {
|
|
|
75
75
|
function me(a) {
|
|
76
76
|
return a ? `${Math.floor(a / 12)}-${a % 12}` : "·";
|
|
77
77
|
}
|
|
78
|
+
function pe(a) {
|
|
79
|
+
return (Array.isArray(a?.positions) ? a.positions : String(a?.position ?? "").split(/[/,]/)).map((t) => String(t ?? "").trim()).filter(Boolean).join("/");
|
|
80
|
+
}
|
|
78
81
|
function N(a = /* @__PURE__ */ new Date()) {
|
|
79
82
|
const e = a.getFullYear();
|
|
80
83
|
return a.getMonth() >= 6 ? `${e}-${e + 1}` : `${e - 1}-${e}`;
|
|
@@ -83,10 +86,10 @@ function M(a = /* @__PURE__ */ new Date()) {
|
|
|
83
86
|
const e = (t) => String(t).padStart(2, "0");
|
|
84
87
|
return `${a.getFullYear()}-${e(a.getMonth() + 1)}-${e(a.getDate())}`;
|
|
85
88
|
}
|
|
86
|
-
function
|
|
89
|
+
function fe(a, e = M()) {
|
|
87
90
|
const t = [...new Set((a || []).filter(Boolean))].sort();
|
|
88
91
|
if (!t.length || t.includes(e)) return e;
|
|
89
|
-
const s = t.filter((
|
|
92
|
+
const s = t.filter((o) => o < e);
|
|
90
93
|
return s.length ? s[s.length - 1] : t[0];
|
|
91
94
|
}
|
|
92
95
|
function j(a) {
|
|
@@ -94,21 +97,21 @@ function j(a) {
|
|
|
94
97
|
}
|
|
95
98
|
function E(a) {
|
|
96
99
|
if (!a || !/^#[0-9a-fA-F]{6}$/.test(a)) return "#FFFFFF";
|
|
97
|
-
const e = parseInt(a.slice(1), 16), t = e >> 16 & 255, s = e >> 8 & 255,
|
|
98
|
-
return 0.299 * t + 0.587 * s + 0.114 *
|
|
100
|
+
const e = parseInt(a.slice(1), 16), t = e >> 16 & 255, s = e >> 8 & 255, o = e & 255;
|
|
101
|
+
return 0.299 * t + 0.587 * s + 0.114 * o > 150 ? "#0F1B33" : "#FFFFFF";
|
|
99
102
|
}
|
|
100
|
-
const
|
|
103
|
+
const ue = (a) => {
|
|
101
104
|
const e = ["th", "st", "nd", "rd"], t = a % 100;
|
|
102
105
|
return a + (e[(t - 20) % 10] || e[t] || e[0]);
|
|
103
106
|
};
|
|
104
107
|
function X(a, e) {
|
|
105
|
-
const t = (
|
|
106
|
-
const d = /^\d+/.exec(String(
|
|
108
|
+
const t = (r) => {
|
|
109
|
+
const d = /^\d+/.exec(String(r ?? ""));
|
|
107
110
|
return d ? Number(d[0]) : null;
|
|
108
|
-
}, s = t(a),
|
|
109
|
-
return s !== null &&
|
|
111
|
+
}, s = t(a), o = t(e);
|
|
112
|
+
return s !== null && o !== null && s !== o ? o - s : s !== null && o === null ? -1 : s === null && o !== null ? 1 : String(a ?? "").localeCompare(String(e ?? ""), "en", { sensitivity: "base" });
|
|
110
113
|
}
|
|
111
|
-
function
|
|
114
|
+
function ge(a, e) {
|
|
112
115
|
const t = (s) => String(s?.name ?? s ?? "");
|
|
113
116
|
return t(a).localeCompare(t(e), "en", { numeric: !0, sensitivity: "base" });
|
|
114
117
|
}
|
|
@@ -120,14 +123,14 @@ function se(a) {
|
|
|
120
123
|
}
|
|
121
124
|
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(/ · $/, "") };
|
|
122
125
|
}
|
|
123
|
-
const
|
|
126
|
+
const ve = /* @__PURE__ */ new Set(["game", "story", "page", "forum", "video", "gallery"]);
|
|
124
127
|
function x(a) {
|
|
125
128
|
let e = String(a || "").replace(/^[a-z][a-z0-9+.-]*:\/\/[^/#?]*/i, "");
|
|
126
129
|
const t = e.indexOf("#");
|
|
127
130
|
let s = "";
|
|
128
131
|
t !== -1 && (s = e.slice(t).split("?")[0], e = e.slice(0, t));
|
|
129
|
-
let
|
|
130
|
-
return
|
|
132
|
+
let o = e.split("?")[0] + s;
|
|
133
|
+
return o = o.replace(/([^:])\/{2,}/g, "$1/").replace(/^\/{2,}/, "/"), o = o.replace(/^\/(?=#)/, ""), o.length > 1 && (o = o.replace(/\/+$/, "")), o.toLowerCase();
|
|
131
134
|
}
|
|
132
135
|
function ae() {
|
|
133
136
|
const a = globalThis.location;
|
|
@@ -135,32 +138,32 @@ function ae() {
|
|
|
135
138
|
const e = (a.hash || "").startsWith("#/") ? a.hash : "";
|
|
136
139
|
return x((a.pathname || "") + e);
|
|
137
140
|
}
|
|
138
|
-
function
|
|
141
|
+
function be(a, e, t) {
|
|
139
142
|
if (!t) return null;
|
|
140
143
|
const s = x(a);
|
|
141
144
|
if (!s) return null;
|
|
142
|
-
const
|
|
143
|
-
if (s ===
|
|
145
|
+
const o = x(u(e.game, { sport: t, id: "" })), r = x(u(e.school, { id: "" }));
|
|
146
|
+
if (s === o || s.startsWith(`${o}/`) || s === r || s.startsWith(`${r}/`)) return null;
|
|
144
147
|
const d = x(u(e.section, { sport: t, view: "" }));
|
|
145
148
|
if (s === d) return "";
|
|
146
149
|
if (!s.startsWith(`${d}/`)) return null;
|
|
147
150
|
const n = s.slice(d.length + 1), h = n.split("/");
|
|
148
|
-
return h.length > 2 || h.some((l) => !/^[a-z][a-z-]*$/.test(l)) ||
|
|
151
|
+
return h.length > 2 || h.some((l) => !/^[a-z][a-z-]*$/.test(l)) || ve.has(h[0]) ? null : n;
|
|
149
152
|
}
|
|
150
|
-
function
|
|
151
|
-
const s = (d) => u(t.section, { sport: a, view: d }).replace(/([^:])\/{2,}/g, "$1/"),
|
|
153
|
+
function ye(a, e, t) {
|
|
154
|
+
const s = (d) => u(t.section, { sport: a, view: d }).replace(/([^:])\/{2,}/g, "$1/"), r = new Set((e || []).map((d) => d && d.gender).filter((d) => d === "boys" || d === "girls")).size === 2 ? [
|
|
152
155
|
{ label: "Boys Standings", href: s("boys/standings") },
|
|
153
156
|
{ label: "Girls Standings", href: s("girls/standings") }
|
|
154
157
|
] : [{ label: "Standings", href: s("standings") }];
|
|
155
158
|
return [
|
|
156
|
-
{ label: `${
|
|
159
|
+
{ label: `${S(a)} Home`, href: s("") },
|
|
157
160
|
{ label: "Scores/Schedule", href: s("scores") },
|
|
158
161
|
{ label: "Playoff Brackets", href: s("brackets") },
|
|
159
|
-
...
|
|
162
|
+
...r,
|
|
160
163
|
{ label: "Polls & Rankings", href: s("rankings") }
|
|
161
164
|
];
|
|
162
165
|
}
|
|
163
|
-
function
|
|
166
|
+
function $e(a, e = ae()) {
|
|
164
167
|
const t = x(e);
|
|
165
168
|
for (const s of a.querySelectorAll(':scope > a[slot="nav"]'))
|
|
166
169
|
t && x(s.getAttribute("href")) === t ? s.setAttribute("aria-current", "page") : s.removeAttribute("aria-current");
|
|
@@ -196,7 +199,7 @@ class $ extends te {
|
|
|
196
199
|
this.load();
|
|
197
200
|
}
|
|
198
201
|
updated(e) {
|
|
199
|
-
e.has("api") && e.get("api") !== void 0 && e.get("api") !== this.api && this.load(), e.has("refreshInterval") && this._setupInterval(),
|
|
202
|
+
e.has("api") && e.get("api") !== void 0 && e.get("api") !== this.api && this.load(), e.has("refreshInterval") && this._setupInterval(), $e(this);
|
|
200
203
|
}
|
|
201
204
|
async load() {
|
|
202
205
|
const e = this.client;
|
|
@@ -231,7 +234,7 @@ class $ extends te {
|
|
|
231
234
|
return i``;
|
|
232
235
|
}
|
|
233
236
|
}
|
|
234
|
-
const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])),
|
|
237
|
+
const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), we = b`
|
|
235
238
|
:host {
|
|
236
239
|
--hsot-red: var(--color-red, #D1232A);
|
|
237
240
|
--hsot-red-deep: var(--color-red-dark, #951C21);
|
|
@@ -269,7 +272,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), $e = b`
|
|
|
269
272
|
outline-offset: 1px;
|
|
270
273
|
}
|
|
271
274
|
.mut { color: var(--hsot-gray-5); }
|
|
272
|
-
`,
|
|
275
|
+
`, xe = b`
|
|
273
276
|
.band { background: var(--hsot-white); color: var(--hsot-black); }
|
|
274
277
|
.band .inner { max-width: 1366px; margin: 0 auto; padding: 1.1rem 1.25rem 0; }
|
|
275
278
|
.band h1, .band h2.bandtitle {
|
|
@@ -318,7 +321,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), $e = b`
|
|
|
318
321
|
@media (max-width: 720px) {
|
|
319
322
|
.band h1, .band h2.bandtitle, .band.section h1, .band.section h2.bandtitle { font-size: 1.8rem; }
|
|
320
323
|
}
|
|
321
|
-
`,
|
|
324
|
+
`, ke = b`
|
|
322
325
|
.view { max-width: 1366px; margin: 0 auto; padding: 1.25rem; box-sizing: border-box; }
|
|
323
326
|
/* Optional right rail (slot="rail" light-DOM children): a divided 300px
|
|
324
327
|
column on desktop, stacked under the view content on smaller screens. */
|
|
@@ -382,7 +385,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), $e = b`
|
|
|
382
385
|
.error { padding: 1.2rem 1rem; color: var(--hsot-red-deep); font-size: 0.9rem; }
|
|
383
386
|
.note { font-size: 0.8125rem; color: var(--hsot-gray-5); margin: 0.6rem 0 0; }
|
|
384
387
|
.loading { padding: 1.2rem; color: var(--hsot-gray-5); font-family: var(--hsot-heading-font); }
|
|
385
|
-
`,
|
|
388
|
+
`, Te = b`
|
|
386
389
|
.pill {
|
|
387
390
|
display: inline-block; font-family: var(--hsot-heading-font); font-weight: 700;
|
|
388
391
|
font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.04em;
|
|
@@ -397,7 +400,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), $e = b`
|
|
|
397
400
|
.pill.champ { background: var(--hsot-straw); color: #6b5900; }
|
|
398
401
|
@keyframes hsot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
|
|
399
402
|
@media (prefers-reduced-motion: reduce) { .pill.live { animation: none; } }
|
|
400
|
-
`,
|
|
403
|
+
`, Se = b`
|
|
401
404
|
.tablewrap { overflow-x: auto; }
|
|
402
405
|
table.data { font-family: var(--hsot-heading-font); font-size: 14px; border-collapse: collapse; width: 100%; }
|
|
403
406
|
table.data th {
|
|
@@ -439,7 +442,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), $e = b`
|
|
|
439
442
|
.dot.W { background: var(--hsot-win); }
|
|
440
443
|
.dot.L { background: var(--hsot-loss); }
|
|
441
444
|
.dot.T { background: var(--hsot-tie); }
|
|
442
|
-
`,
|
|
445
|
+
`, Ce = b`
|
|
443
446
|
ul.gamelist { list-style: none; margin: 0; padding: 0; }
|
|
444
447
|
.gamelist li {
|
|
445
448
|
display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 1rem;
|
|
@@ -489,24 +492,24 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), $e = b`
|
|
|
489
492
|
.gamelist .ff { color: var(--hsot-gray-5); font-size: 0.78rem; font-style: italic; }
|
|
490
493
|
.gamelist .where { color: var(--hsot-gray-5); font-size: 0.78rem; }
|
|
491
494
|
.gamelist a.box { font-size: 0.78rem; }
|
|
492
|
-
`, F = [
|
|
495
|
+
`, F = [we, xe, ke, Te, Se, Ie, Ce];
|
|
493
496
|
function G(a) {
|
|
494
497
|
return a.state !== "final" ? null : a.forfeit === "home" ? "away" : a.forfeit === "away" || a.homeScore > a.awayScore ? "home" : a.awayScore > a.homeScore ? "away" : a.tiebreakWinner && a.tiebreakWinner !== "none" ? a.tiebreakWinner : "tie";
|
|
495
498
|
}
|
|
496
|
-
function
|
|
499
|
+
function De(a) {
|
|
497
500
|
return a && (a.forfeit === "home" || a.forfeit === "away") ? a.forfeit : null;
|
|
498
501
|
}
|
|
499
502
|
function z(a, e) {
|
|
500
|
-
const t = {}, s = (
|
|
501
|
-
for (const
|
|
502
|
-
const d = G(
|
|
503
|
+
const t = {}, s = (r) => (t[r] = t[r] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] }, t[r]), o = a.filter((r) => r.state === "final" && r.gameType !== "scrimmage" && (!e || r.date <= e)).sort((r, d) => String(r.date).localeCompare(String(d.date)));
|
|
504
|
+
for (const r of o) {
|
|
505
|
+
const d = G(r), n = r.gameType === "conference";
|
|
503
506
|
for (const h of ["home", "away"]) {
|
|
504
|
-
const l = h === "home" ?
|
|
507
|
+
const l = h === "home" ? r.homeTeamId : r.awayTeamId;
|
|
505
508
|
if (!l) continue;
|
|
506
|
-
const c = s(l), m = h === "home" ?
|
|
509
|
+
const c = s(l), m = h === "home" ? r.homeScore : r.awayScore, f = h === "home" ? r.awayScore : r.homeScore;
|
|
507
510
|
c.pf += m, c.pa += f;
|
|
508
511
|
let g = "T";
|
|
509
|
-
d === "tie" ? (c.t += 1, n && (c.ct += 1)) : d === h ? (c.w += 1, n && (c.cw += 1), g = "W") : (c.l += 1, n && (c.cl += 1), g = "L"), c.results.push({ gameId:
|
|
512
|
+
d === "tie" ? (c.t += 1, n && (c.ct += 1)) : d === h ? (c.w += 1, n && (c.cw += 1), g = "W") : (c.l += 1, n && (c.cl += 1), g = "L"), c.results.push({ gameId: r.id, date: r.date, mark: g, my: m, their: f, opp: h === "home" ? r.awayTeamId : r.homeTeamId, conf: n });
|
|
510
513
|
}
|
|
511
514
|
}
|
|
512
515
|
return t;
|
|
@@ -524,10 +527,10 @@ const Z = (a, e, t) => {
|
|
|
524
527
|
}, J = (a) => a.toFixed(3).replace("0.", ".");
|
|
525
528
|
function w(a, e = !1) {
|
|
526
529
|
if (!a) return "0-0";
|
|
527
|
-
const t = e ? a.cw : a.w, s = e ? a.cl : a.l,
|
|
528
|
-
return `${t}-${s}${
|
|
530
|
+
const t = e ? a.cw : a.w, s = e ? a.cl : a.l, o = e ? a.ct : a.t;
|
|
531
|
+
return `${t}-${s}${o ? `-${o}` : ""}`;
|
|
529
532
|
}
|
|
530
|
-
function
|
|
533
|
+
function oe(a, e) {
|
|
531
534
|
return a.map((t) => {
|
|
532
535
|
const s = e[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] };
|
|
533
536
|
return { team: t, rec: s, confPct: Z(s.cw, s.cl, s.ct), overallPct: Z(s.w, s.l, s.t) };
|
|
@@ -540,18 +543,18 @@ function ee(a, e) {
|
|
|
540
543
|
const t = a[e];
|
|
541
544
|
return t && t.results.length ? t.results[t.results.length - 1] : null;
|
|
542
545
|
}
|
|
543
|
-
function
|
|
544
|
-
let
|
|
545
|
-
for (const
|
|
546
|
-
|
|
547
|
-
return
|
|
546
|
+
function Ye(a, e, t, s = "") {
|
|
547
|
+
let o = null;
|
|
548
|
+
for (const r of a || [])
|
|
549
|
+
r.sport === e && (t && r.effectiveDate > t || s && r.gender && r.gender !== s || (!o || r.effectiveDate > o.effectiveDate) && (o = r));
|
|
550
|
+
return o;
|
|
548
551
|
}
|
|
549
|
-
function W(a, e, t, s,
|
|
550
|
-
const
|
|
551
|
-
if (!
|
|
552
|
+
function W(a, e, t, s, o) {
|
|
553
|
+
const r = e[t];
|
|
554
|
+
if (!r) return null;
|
|
552
555
|
const d = /* @__PURE__ */ new Map();
|
|
553
556
|
for (const h of a || []) {
|
|
554
|
-
if (h.sport !== s ||
|
|
557
|
+
if (h.sport !== s || o && h.effectiveDate > o || h.gender && r.gender !== h.gender && r.gender !== "coed") continue;
|
|
555
558
|
const l = h.gender || "", c = d.get(l);
|
|
556
559
|
(!c || h.effectiveDate > c.effectiveDate) && d.set(l, h);
|
|
557
560
|
}
|
|
@@ -562,35 +565,35 @@ function W(a, e, t, s, r) {
|
|
|
562
565
|
}
|
|
563
566
|
return n ? n.rank : null;
|
|
564
567
|
}
|
|
565
|
-
function
|
|
568
|
+
function Fe(a, e, t) {
|
|
566
569
|
if (!a) return { kind: "none", delta: 0 };
|
|
567
570
|
const s = (a.teamIds || []).indexOf(t) + 1;
|
|
568
571
|
if (!s) return { kind: "none", delta: 0 };
|
|
569
572
|
if (!e) return { kind: "same", delta: 0 };
|
|
570
|
-
const
|
|
571
|
-
if (!
|
|
572
|
-
const
|
|
573
|
-
return
|
|
573
|
+
const o = (e.teamIds || []).indexOf(t) + 1;
|
|
574
|
+
if (!o) return { kind: "new", delta: 0 };
|
|
575
|
+
const r = o - s;
|
|
576
|
+
return r > 0 ? { kind: "up", delta: r } : r < 0 ? { kind: "down", delta: -r } : { kind: "same", delta: 0 };
|
|
574
577
|
}
|
|
575
|
-
function
|
|
578
|
+
function ze(a) {
|
|
576
579
|
return /^https?:\/\//i.test(String(a || ""));
|
|
577
580
|
}
|
|
578
|
-
function
|
|
579
|
-
if (!
|
|
581
|
+
function re(a, { w: e, h: t } = {}) {
|
|
582
|
+
if (!ze(a)) return "";
|
|
580
583
|
const s = [];
|
|
581
584
|
e && s.push(`w=${Math.max(1, Math.round(e))}`), t && s.push(`h=${Math.max(1, Math.round(t))}`), s.push("f=webp");
|
|
582
|
-
const
|
|
583
|
-
return `${a}${
|
|
585
|
+
const o = a.includes("?") ? "&" : "?";
|
|
586
|
+
return `${a}${o}${s.join("&")}`;
|
|
584
587
|
}
|
|
585
588
|
function A(a, e) {
|
|
586
589
|
const t = e * 2;
|
|
587
|
-
return
|
|
590
|
+
return re(a?.logoAssetId, { w: t, h: t });
|
|
588
591
|
}
|
|
589
|
-
function
|
|
590
|
-
return
|
|
592
|
+
function Be(a, e) {
|
|
593
|
+
return re(a?.photoAssetId, { w: e * 2 });
|
|
591
594
|
}
|
|
592
|
-
function V(a, e, { title: t, sub: s, teams:
|
|
593
|
-
const
|
|
595
|
+
function V(a, e, { title: t, sub: s, teams: o }) {
|
|
596
|
+
const r = ae(), n = !!a.querySelector(':scope > a[slot="nav"]') || be(r, e.hrefs, e.sport) !== null;
|
|
594
597
|
return i`
|
|
595
598
|
<div class="band section">
|
|
596
599
|
<div class="inner">
|
|
@@ -598,30 +601,30 @@ function V(a, e, { title: t, sub: s, teams: r }) {
|
|
|
598
601
|
${s ? i`<p class="sub">${s}</p>` : p}
|
|
599
602
|
</div>
|
|
600
603
|
${n ? i`
|
|
601
|
-
<nav class="sectionnav" aria-label="${
|
|
604
|
+
<nav class="sectionnav" aria-label="${S(e.sport)} section">
|
|
602
605
|
<div class="navrow">
|
|
603
606
|
<slot name="nav">
|
|
604
|
-
${
|
|
605
|
-
aria-current=${
|
|
607
|
+
${ye(e.sport, o, e.hrefs).map((h) => i`<a href=${h.href}
|
|
608
|
+
aria-current=${r && x(h.href) === r ? "page" : p}>${h.label}</a>`)}
|
|
606
609
|
</slot>
|
|
607
610
|
</div>
|
|
608
611
|
</nav>` : p}
|
|
609
612
|
</div>
|
|
610
613
|
`;
|
|
611
614
|
}
|
|
612
|
-
const
|
|
615
|
+
const I = (a, e) => {
|
|
613
616
|
const t = a.teamsById[e];
|
|
614
617
|
return t ? a.schoolsById[t.schoolId] : null;
|
|
615
|
-
}, T = (a, e) =>
|
|
618
|
+
}, T = (a, e) => I(a, e)?.name || "TBD", _ = (a, e) => I(a, e)?.abbr || "TBD";
|
|
616
619
|
function C(a, e = 26) {
|
|
617
620
|
if (!a) return p;
|
|
618
621
|
const t = A(a, e);
|
|
619
622
|
if (t)
|
|
620
623
|
return i`<img class="swatch logo" aria-hidden="true" alt="" loading="lazy"
|
|
621
624
|
src=${t} style="width:${e}px;height:${e}px" />`;
|
|
622
|
-
const s = a.colorPrimary || "#030711",
|
|
625
|
+
const s = a.colorPrimary || "#030711", o = E(s);
|
|
623
626
|
return i`<span class="swatch" aria-hidden="true"
|
|
624
|
-
style="width:${e}px;height:${e}px;background:${s};color:${
|
|
627
|
+
style="width:${e}px;height:${e}px;background:${s};color:${o};font-size:${Math.max(8, e * 0.28)}px"
|
|
625
628
|
>${j(a)}</span>`;
|
|
626
629
|
}
|
|
627
630
|
function Y(a, e, t) {
|
|
@@ -629,17 +632,17 @@ function Y(a, e, t) {
|
|
|
629
632
|
return s ? i`<span class="rankbadge">#${s}</span>` : p;
|
|
630
633
|
}
|
|
631
634
|
function ie(a, e, t) {
|
|
632
|
-
const s =
|
|
635
|
+
const s = I(a, e);
|
|
633
636
|
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>`;
|
|
634
637
|
}
|
|
635
638
|
function K(a, e, t = 5) {
|
|
636
639
|
const s = a.records[e];
|
|
637
640
|
if (!s || !s.results.length) return i`<span class="mut">·</span>`;
|
|
638
|
-
const
|
|
639
|
-
return i`<span class="dots" role="img" aria-label="last ${
|
|
640
|
-
${
|
|
641
|
-
title="${
|
|
642
|
-
href=${u(a.hrefs.game, { sport: a.sport, id:
|
|
641
|
+
const o = s.results.slice(-1 * t);
|
|
642
|
+
return i`<span class="dots" role="img" aria-label="last ${o.length} results">
|
|
643
|
+
${o.map((r) => i`<a class="dot ${r.mark}"
|
|
644
|
+
title="${r.mark} ${r.my}-${r.their} vs ${T(a, r.opp)}"
|
|
645
|
+
href=${u(a.hrefs.game, { sport: a.sport, id: r.gameId })}>${r.mark}</a>`)}
|
|
643
646
|
</span>`;
|
|
644
647
|
}
|
|
645
648
|
function B(a, e) {
|
|
@@ -659,10 +662,10 @@ function R(a) {
|
|
|
659
662
|
}
|
|
660
663
|
function ne(a, e, t) {
|
|
661
664
|
if (!e) return i`<span class="mut">·</span>`;
|
|
662
|
-
const s = e.homeTeamId === t ? e.awayTeamId : e.homeTeamId,
|
|
663
|
-
return i`${e.state === "live" ? i`<span class="pill live">Live</span> ` : i`${y(e.date, { month: "numeric", day: "numeric" })} `}${
|
|
665
|
+
const s = e.homeTeamId === t ? e.awayTeamId : e.homeTeamId, o = e.homeTeamId === t ? "vs" : "at";
|
|
666
|
+
return i`${e.state === "live" ? i`<span class="pill live">Live</span> ` : i`${y(e.date, { month: "numeric", day: "numeric" })} `}${o} ${_(a, s)}`;
|
|
664
667
|
}
|
|
665
|
-
class
|
|
668
|
+
class Pe extends $ {
|
|
666
669
|
static styles = F;
|
|
667
670
|
static properties = {
|
|
668
671
|
...$.properties,
|
|
@@ -681,18 +684,18 @@ class Be extends $ {
|
|
|
681
684
|
this._datePinned = !!this.date;
|
|
682
685
|
}
|
|
683
686
|
async fetchData(e) {
|
|
684
|
-
const t = this.season || N(), [s,
|
|
687
|
+
const t = this.season || N(), [s, o, r, d, n] = await Promise.all([
|
|
685
688
|
e.listSchools(),
|
|
686
689
|
e.listTeams({ sport: this.sport }),
|
|
687
690
|
e.listConferences(),
|
|
688
691
|
e.listGames({ sport: this.sport, season: t }),
|
|
689
692
|
e.listRankings({ sport: this.sport })
|
|
690
693
|
]);
|
|
691
|
-
return this._datePinned || (this.date =
|
|
694
|
+
return this._datePinned || (this.date = fe(d.items.map((h) => h.date)), this._datePinned = !0), {
|
|
692
695
|
season: t,
|
|
693
696
|
schools: s.items,
|
|
694
|
-
teams:
|
|
695
|
-
conferences:
|
|
697
|
+
teams: o.items,
|
|
698
|
+
conferences: r.items,
|
|
696
699
|
games: d.items,
|
|
697
700
|
rankings: n.items
|
|
698
701
|
};
|
|
@@ -708,10 +711,10 @@ class Be extends $ {
|
|
|
708
711
|
}, this._ctxData = this.data), this._ctx;
|
|
709
712
|
}
|
|
710
713
|
renderView() {
|
|
711
|
-
const e = this.ctx, t = v(this.data.conferences), s = [...new Set(this.data.games.map((l) => l.date).filter(Boolean))].sort(),
|
|
714
|
+
const e = this.ctx, t = v(this.data.conferences), s = [...new Set(this.data.games.map((l) => l.date).filter(Boolean))].sort(), o = Number.MAX_SAFE_INTEGER, r = (l) => {
|
|
712
715
|
const c = [l.awayTeamId, l.homeTeamId].map((m) => W(e.rankings, e.teamsById, m, this.sport, l.date)).filter(Boolean);
|
|
713
|
-
return c.length ? Math.min(...c) :
|
|
714
|
-
}, d = this.data.games.filter((l) => l.date === this.date), n = new Map(d.map((l) => [l,
|
|
716
|
+
return c.length ? Math.min(...c) : o;
|
|
717
|
+
}, d = this.data.games.filter((l) => l.date === this.date), n = new Map(d.map((l) => [l, r(l)]));
|
|
715
718
|
d.sort((l, c) => (l.state === "live" ? 0 : 1) - (c.state === "live" ? 0 : 1) || n.get(l) - n.get(c));
|
|
716
719
|
const h = /* @__PURE__ */ new Map();
|
|
717
720
|
return d.forEach((l) => {
|
|
@@ -719,7 +722,7 @@ class Be extends $ {
|
|
|
719
722
|
h.has(c) || h.set(c, []), h.get(c).push(l);
|
|
720
723
|
}), i`
|
|
721
724
|
${V(this, e, {
|
|
722
|
-
title: i`${
|
|
725
|
+
title: i`${S(this.sport)} scores & schedules`,
|
|
723
726
|
sub: i`${y(this.date, { weekday: "long", month: "long", day: "numeric", year: "numeric" })} · ${d.length} games`,
|
|
724
727
|
teams: this.data.teams
|
|
725
728
|
})}
|
|
@@ -759,12 +762,12 @@ class Be extends $ {
|
|
|
759
762
|
// a lone score column on the far right read as detached from the teams).
|
|
760
763
|
// Scheduled games carry their start time on the status pill alone.
|
|
761
764
|
renderGame(e, t) {
|
|
762
|
-
const s = t.state === "final" || t.state === "live",
|
|
765
|
+
const s = t.state === "final" || t.state === "live", o = (d, n, h = p) => i`<span class="side">${ie(e, d, t.date)}${s ? i`<span class="score">${n}</span>` : p}${h}</span>`, r = De(t);
|
|
763
766
|
return i`
|
|
764
767
|
<li>
|
|
765
768
|
${R(t)}
|
|
766
|
-
<span class="opp matchup">${
|
|
767
|
-
${
|
|
769
|
+
<span class="opp matchup">${o(t.awayTeamId, t.awayScore, i`<span class="at">at</span>`)}${o(t.homeTeamId, t.homeScore)}</span>
|
|
770
|
+
${r ? i`<span class="ff">${T(e, r === "home" ? t.homeTeamId : t.awayTeamId)} forfeited</span>` : p}
|
|
768
771
|
<span class="where">${t.venue || ""}</span>
|
|
769
772
|
${t.broadcast ? i`<span class="pill class">${t.broadcast}</span>` : p}
|
|
770
773
|
<a class="box" href=${u(e.hrefs.game, { sport: this.sport, id: t.id })}>Box score →</a>
|
|
@@ -772,8 +775,8 @@ class Be extends $ {
|
|
|
772
775
|
`;
|
|
773
776
|
}
|
|
774
777
|
}
|
|
775
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores",
|
|
776
|
-
class
|
|
778
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores", Pe);
|
|
779
|
+
class Ee extends $ {
|
|
777
780
|
static styles = F;
|
|
778
781
|
static properties = {
|
|
779
782
|
...$.properties,
|
|
@@ -786,7 +789,7 @@ class Pe extends $ {
|
|
|
786
789
|
super(), this.sport = "football", this.season = "", this.classFilter = "All", this.query = "";
|
|
787
790
|
}
|
|
788
791
|
async fetchData(e) {
|
|
789
|
-
const t = this.season || N(), [s,
|
|
792
|
+
const t = this.season || N(), [s, o, r, d, n] = await Promise.all([
|
|
790
793
|
e.listConferences({ active: !0 }),
|
|
791
794
|
e.listSchools(),
|
|
792
795
|
e.listTeams({ sport: this.sport }),
|
|
@@ -796,8 +799,8 @@ class Pe extends $ {
|
|
|
796
799
|
return {
|
|
797
800
|
season: t,
|
|
798
801
|
conferences: s.items,
|
|
799
|
-
schools:
|
|
800
|
-
teams:
|
|
802
|
+
schools: o.items,
|
|
803
|
+
teams: r.items,
|
|
801
804
|
games: d.items,
|
|
802
805
|
rankings: n.items
|
|
803
806
|
};
|
|
@@ -813,10 +816,10 @@ class Pe extends $ {
|
|
|
813
816
|
}, this._ctxData = this.data), this._ctx;
|
|
814
817
|
}
|
|
815
818
|
renderView() {
|
|
816
|
-
const e = this.ctx, t = ["All", ...[...new Set(this.data.conferences.flatMap((
|
|
819
|
+
const e = this.ctx, t = ["All", ...[...new Set(this.data.conferences.flatMap((o) => o.classifications || []))].sort(X)].slice(0, 9), s = this.data.conferences.filter((o) => o.active !== !1).filter((o) => this.classFilter === "All" || (o.classifications || []).includes(this.classFilter)).sort(ge);
|
|
817
820
|
return i`
|
|
818
821
|
${V(this, e, {
|
|
819
|
-
title: i`${
|
|
822
|
+
title: i`${S(this.sport)} standings`,
|
|
820
823
|
sub: i`${this.data.season} season · every conference, computed live from reported results`,
|
|
821
824
|
teams: this.data.teams
|
|
822
825
|
})}
|
|
@@ -824,32 +827,32 @@ class Pe extends $ {
|
|
|
824
827
|
${P(this)}
|
|
825
828
|
<div class="toolbar">
|
|
826
829
|
<div role="group" aria-label="Classification filter">
|
|
827
|
-
${t.map((
|
|
830
|
+
${t.map((o) => i`<button class="chip ${this.classFilter === o ? "on" : ""}"
|
|
828
831
|
@click=${() => {
|
|
829
|
-
this.classFilter =
|
|
830
|
-
}}>${
|
|
832
|
+
this.classFilter = o;
|
|
833
|
+
}}>${o}</button>`)}
|
|
831
834
|
</div>
|
|
832
835
|
<input type="search" placeholder="Find a school…" aria-label="Find a school"
|
|
833
|
-
.value=${this.query} @input=${(
|
|
834
|
-
this.query =
|
|
836
|
+
.value=${this.query} @input=${(o) => {
|
|
837
|
+
this.query = o.target.value;
|
|
835
838
|
}}>
|
|
836
839
|
<span class="spacer"></span>
|
|
837
840
|
<span class="asof">Records through ${y(M(), { month: "long", day: "numeric" })} · conference games count toward both records · scrimmages toward neither</span>
|
|
838
841
|
</div>
|
|
839
|
-
${s.map((
|
|
842
|
+
${s.map((o) => this.renderConference(e, o))}
|
|
840
843
|
`)}
|
|
841
844
|
`;
|
|
842
845
|
}
|
|
843
846
|
renderConference(e, t) {
|
|
844
847
|
const s = this.data.teams.filter((d) => d.conferenceId === t.id);
|
|
845
848
|
if (!s.length) return p;
|
|
846
|
-
const
|
|
849
|
+
const o = this.query.trim().toLowerCase(), r = oe(s, e.records);
|
|
847
850
|
return i`
|
|
848
851
|
<div class="card">
|
|
849
852
|
<div class="card-head">
|
|
850
853
|
<h2>${t.name}</h2>
|
|
851
854
|
${[...t.classifications || []].sort(X).map((d) => i`<span class="pill class">${d}</span>`)}
|
|
852
|
-
<span class="meta">${
|
|
855
|
+
<span class="meta">${r.length} teams · membership derives from teams</span>
|
|
853
856
|
</div>
|
|
854
857
|
<div class="tablewrap"><table class="data">
|
|
855
858
|
<thead><tr>
|
|
@@ -858,15 +861,15 @@ class Pe extends $ {
|
|
|
858
861
|
<th>Streak</th><th>Last 5</th><th>Next</th>
|
|
859
862
|
</tr></thead>
|
|
860
863
|
<tbody>
|
|
861
|
-
${
|
|
864
|
+
${r.map((d, n) => this.renderRow(e, d, n, o))}
|
|
862
865
|
</tbody>
|
|
863
866
|
</table></div>
|
|
864
867
|
</div>
|
|
865
868
|
`;
|
|
866
869
|
}
|
|
867
|
-
renderRow(e, t, s,
|
|
868
|
-
const
|
|
869
|
-
if (
|
|
870
|
+
renderRow(e, t, s, o) {
|
|
871
|
+
const r = e.schoolsById[t.team.schoolId], d = r?.name || t.team.name || "TBD";
|
|
872
|
+
if (o && !d.toLowerCase().includes(o)) return p;
|
|
870
873
|
const n = t.rec.pf - t.rec.pa, h = q(this.data.games, t.team.id), l = () => {
|
|
871
874
|
location.href = u(e.hrefs.school, { id: t.team.schoolId });
|
|
872
875
|
};
|
|
@@ -876,7 +879,7 @@ class Pe extends $ {
|
|
|
876
879
|
}}>
|
|
877
880
|
<td class="mut">${s + 1}</td>
|
|
878
881
|
<td class="teamcell">
|
|
879
|
-
${C(
|
|
882
|
+
${C(r)}${Y(e, t.team.id, null)}
|
|
880
883
|
<a href=${u(e.hrefs.school, { id: t.team.schoolId })}>${d}</a>
|
|
881
884
|
</td>
|
|
882
885
|
<td class="num">${w(t.rec, !0)}</td>
|
|
@@ -893,8 +896,8 @@ class Pe extends $ {
|
|
|
893
896
|
`;
|
|
894
897
|
}
|
|
895
898
|
}
|
|
896
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings",
|
|
897
|
-
const
|
|
899
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings", Ee);
|
|
900
|
+
const Ae = b`
|
|
898
901
|
.hero1 {
|
|
899
902
|
border-radius: var(--hsot-radius-md); color: var(--hsot-white);
|
|
900
903
|
padding: 1.3rem 1.4rem; display: flex; align-items: center; gap: 1.2rem;
|
|
@@ -911,8 +914,8 @@ const Ee = b`
|
|
|
911
914
|
.delta.new { background: var(--hsot-straw); color: #6b5900; border-radius: var(--hsot-radius-xs); padding: 0.1rem 0.3rem; font-size: 0.7rem; }
|
|
912
915
|
.sparkline { vertical-align: middle; }
|
|
913
916
|
`;
|
|
914
|
-
class
|
|
915
|
-
static styles = [...F,
|
|
917
|
+
class _e extends $ {
|
|
918
|
+
static styles = [...F, Ae];
|
|
916
919
|
static properties = {
|
|
917
920
|
...$.properties,
|
|
918
921
|
sport: { type: String },
|
|
@@ -929,7 +932,7 @@ class Ae extends $ {
|
|
|
929
932
|
e && (this.pollDate = e);
|
|
930
933
|
}
|
|
931
934
|
async fetchData(e) {
|
|
932
|
-
const t = this.season || N(), [s,
|
|
935
|
+
const t = this.season || N(), [s, o, r, d, n] = await Promise.all([
|
|
933
936
|
e.listRankings({ sport: this.sport, ...this.gender ? { gender: this.gender } : {} }),
|
|
934
937
|
e.listSchools(),
|
|
935
938
|
e.listTeams({ sport: this.sport }),
|
|
@@ -939,8 +942,8 @@ class Ae extends $ {
|
|
|
939
942
|
return {
|
|
940
943
|
season: t,
|
|
941
944
|
polls: h,
|
|
942
|
-
schools:
|
|
943
|
-
teams:
|
|
945
|
+
schools: o.items,
|
|
946
|
+
teams: r.items,
|
|
944
947
|
conferences: d.items,
|
|
945
948
|
games: n.items
|
|
946
949
|
};
|
|
@@ -974,16 +977,16 @@ class Ae extends $ {
|
|
|
974
977
|
</svg>`;
|
|
975
978
|
}
|
|
976
979
|
movement(e, t, s) {
|
|
977
|
-
const
|
|
978
|
-
return
|
|
980
|
+
const o = Fe(e, t, s);
|
|
981
|
+
return o.kind === "up" ? i`<span class="delta up">▲ ${o.delta}</span>` : o.kind === "down" ? i`<span class="delta down">▼ ${o.delta}</span>` : o.kind === "new" ? i`<span class="delta new">NEW</span>` : o.kind === "same" ? i`<span class="delta same">—</span>` : i`<span class="delta same">·</span>`;
|
|
979
982
|
}
|
|
980
983
|
renderView() {
|
|
981
984
|
const e = this.ctx, t = this.data.polls;
|
|
982
985
|
if (!t.length) return i`<div class="view"><p class="empty">No ${this.sport} polls published yet this season.</p></div>`;
|
|
983
|
-
const s = Math.max(0, t.findIndex((m) => m.effectiveDate === this.pollDate)),
|
|
986
|
+
const s = Math.max(0, t.findIndex((m) => m.effectiveDate === this.pollDate)), o = t[s] || t[0], r = t[s + 1] || null, d = t.slice().reverse(), n = d.indexOf(o), h = v(this.data.conferences), l = (o.teamIds || [])[0], c = l ? I(e, l) : null;
|
|
984
987
|
return i`
|
|
985
988
|
${V(this, e, {
|
|
986
|
-
title: i`${
|
|
989
|
+
title: i`${S(this.sport)} Top 25`,
|
|
987
990
|
sub: i`The HighSchoolOT poll · updated weekly · ${t.length} polls this season`,
|
|
988
991
|
teams: this.data.teams
|
|
989
992
|
})}
|
|
@@ -994,7 +997,7 @@ class Ae extends $ {
|
|
|
994
997
|
<select id="pollsel" @change=${(m) => {
|
|
995
998
|
this.pollDate = m.target.value;
|
|
996
999
|
}}>
|
|
997
|
-
${t.map((m, f) => i`<option value=${m.effectiveDate} ?selected=${m ===
|
|
1000
|
+
${t.map((m, f) => i`<option value=${m.effectiveDate} ?selected=${m === o}>
|
|
998
1001
|
${y(m.effectiveDate, { month: "long", day: "numeric", year: "numeric" })}${f === 0 ? " · current" : ""}
|
|
999
1002
|
</option>`)}
|
|
1000
1003
|
</select>
|
|
@@ -1009,40 +1012,40 @@ class Ae extends $ {
|
|
|
1009
1012
|
<span class="spacer"></span>
|
|
1010
1013
|
<span class="asof">Movement vs. the previous poll · sparkline = season rank history</span>
|
|
1011
1014
|
</div>
|
|
1012
|
-
${c ? this.renderHero(e,
|
|
1015
|
+
${c ? this.renderHero(e, o, r, l, c, h) : p}
|
|
1013
1016
|
<div class="card"><div class="tablewrap"><table class="data">
|
|
1014
1017
|
<thead><tr>
|
|
1015
1018
|
<th class="num">Rk</th><th>Mvmt</th><th>Team</th><th class="num">Record</th>
|
|
1016
1019
|
<th>Conference</th><th>Last result</th><th>Next</th><th>Season</th>
|
|
1017
1020
|
</tr></thead>
|
|
1018
1021
|
<tbody>
|
|
1019
|
-
${(
|
|
1022
|
+
${(o.teamIds || []).map((m, f) => f === 0 || !m ? p : this.renderRow(e, o, r, d, n, h, m, f + 1))}
|
|
1020
1023
|
</tbody>
|
|
1021
1024
|
</table></div></div>
|
|
1022
1025
|
<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>
|
|
1023
1026
|
`)}
|
|
1024
1027
|
`;
|
|
1025
1028
|
}
|
|
1026
|
-
renderHero(e, t, s,
|
|
1027
|
-
const n = e.records[
|
|
1029
|
+
renderHero(e, t, s, o, r, d) {
|
|
1030
|
+
const n = e.records[o], h = ee(e.records, o), l = d[e.teamsById[o]?.conferenceId], c = `linear-gradient(120deg, ${r.colorPrimary || "#030711"} 0%, var(--hsot-black) 85%)`;
|
|
1028
1031
|
return i`
|
|
1029
1032
|
<div class="hero1" style="background:${c}">
|
|
1030
1033
|
<div class="bigrank">#1</div>
|
|
1031
|
-
${C(
|
|
1034
|
+
${C(r, 64)}
|
|
1032
1035
|
<div>
|
|
1033
|
-
<h2><a href=${u(e.hrefs.school, { id:
|
|
1036
|
+
<h2><a href=${u(e.hrefs.school, { id: r.id })}>${r.name} ${r.mascot || ""}</a></h2>
|
|
1034
1037
|
<div class="facts">
|
|
1035
1038
|
${w(n)} overall${l ? i` · ${w(n, !0)} ${l.name}` : p}
|
|
1036
1039
|
· streak ${L(n?.results) || "·"}
|
|
1037
1040
|
${h ? i` · last: ${h.mark} ${h.my}-${h.their} vs ${_(e, h.opp)}` : p}
|
|
1038
|
-
${this.movement(t, s,
|
|
1041
|
+
${this.movement(t, s, o)}
|
|
1039
1042
|
</div>
|
|
1040
1043
|
</div>
|
|
1041
1044
|
</div>
|
|
1042
1045
|
`;
|
|
1043
1046
|
}
|
|
1044
|
-
renderRow(e, t, s,
|
|
1045
|
-
const l =
|
|
1047
|
+
renderRow(e, t, s, o, r, d, n, h) {
|
|
1048
|
+
const l = I(e, n);
|
|
1046
1049
|
if (!l) return p;
|
|
1047
1050
|
const c = e.records[n], m = ee(e.records, n), f = q(this.data.games, n), g = d[e.teamsById[n]?.conferenceId], k = () => {
|
|
1048
1051
|
location.href = u(e.hrefs.school, { id: l.id });
|
|
@@ -1061,13 +1064,13 @@ class Ae extends $ {
|
|
|
1061
1064
|
<b style="color:${m.mark === "W" ? "var(--hsot-win)" : m.mark === "L" ? "var(--hsot-loss)" : "var(--hsot-tie)"}">${m.mark}</b>
|
|
1062
1065
|
${m.my}-${m.their} vs ${_(e, m.opp)}</a>` : i`<span class="mut">·</span>`}</td>
|
|
1063
1066
|
<td>${ne(e, f, n)}</td>
|
|
1064
|
-
<td>${this.sparkline(n,
|
|
1067
|
+
<td>${this.sparkline(n, o, r)}</td>
|
|
1065
1068
|
</tr>
|
|
1066
1069
|
`;
|
|
1067
1070
|
}
|
|
1068
1071
|
}
|
|
1069
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings",
|
|
1070
|
-
const
|
|
1072
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings", _e);
|
|
1073
|
+
const Re = b`
|
|
1071
1074
|
.schoolhero { color: var(--hsot-white); padding: 1.6rem 1.25rem 1.3rem; }
|
|
1072
1075
|
.schoolhero .inner { max-width: 1366px; margin: 0 auto; display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
|
|
1073
1076
|
.schoolhero .crest {
|
|
@@ -1089,15 +1092,40 @@ const _e = b`
|
|
|
1089
1092
|
.tile .k { font-family: var(--hsot-heading-font); text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.08em; font-weight: 700; color: var(--hsot-red-deep); }
|
|
1090
1093
|
.tile .v { font-family: var(--hsot-heading-font); font-weight: 700; font-size: 1.7rem; line-height: 1.15; color: var(--hsot-black); }
|
|
1091
1094
|
.tile .s { font-size: 0.78rem; color: var(--hsot-gray-5); }
|
|
1092
|
-
|
|
1095
|
+
/* Schedule and roster split the width evenly. The roster used to get
|
|
1096
|
+
5/12 (~393px beside the rail), which held six columns; the season
|
|
1097
|
+
photo and the College column (2026-09) took its table to ~480px and
|
|
1098
|
+
gave the card a horizontal scrollbar on desktop while the schedule
|
|
1099
|
+
sat in white space. Both tracks are minmax(0, …) so a table that is
|
|
1100
|
+
still too wide scrolls inside its card instead of stretching the
|
|
1101
|
+
grid — and the page — past the viewport. */
|
|
1102
|
+
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; }
|
|
1093
1103
|
/* The season roster photo heads the roster card, above the table. Natural
|
|
1094
1104
|
height: a team photo is never cropped to a box — the card's overflow
|
|
1095
1105
|
rounds its top corners. */
|
|
1096
1106
|
.rosterphoto { display: block; width: 100%; height: auto; background: var(--hsot-gray-1); border-bottom: 1px solid var(--hsot-gray-2); }
|
|
1097
|
-
|
|
1107
|
+
/* Roster table: a little less side padding than the shared table so all
|
|
1108
|
+
seven columns fit the card beside the rail. */
|
|
1109
|
+
table.data.roster th, table.data.roster td { padding-left: 10px; padding-right: 10px; }
|
|
1110
|
+
table.data.roster .sub { display: none; }
|
|
1111
|
+
/* A bare 1fr here was the mobile bug: its implicit minimum is the
|
|
1112
|
+
content's width, so the nowrap roster table widened the single column
|
|
1113
|
+
past the phone and the whole page scrolled sideways. */
|
|
1114
|
+
@media (max-width: 900px) { .cols { grid-template-columns: minmax(0, 1fr); } .schoolhero h1 { font-size: 1.9rem; } }
|
|
1115
|
+
@media (max-width: 720px) {
|
|
1116
|
+
/* Phone: the roster fits the screen instead of scrolling. Position
|
|
1117
|
+
and class fold under the player's name, names and colleges may
|
|
1118
|
+
wrap, and cells tighten. Five columns come to ~330px, inside a
|
|
1119
|
+
360px phone's view padding. */
|
|
1120
|
+
table.data.roster { font-size: 13px; }
|
|
1121
|
+
table.data.roster th, table.data.roster td { padding: 7px 8px; }
|
|
1122
|
+
table.data.roster .pos, table.data.roster .cls { display: none; }
|
|
1123
|
+
table.data.roster td.player, table.data.roster td.college { white-space: normal; }
|
|
1124
|
+
table.data.roster .sub { display: block; font-weight: 400; font-size: 0.78rem; color: var(--hsot-gray-5); }
|
|
1125
|
+
}
|
|
1098
1126
|
`;
|
|
1099
|
-
class
|
|
1100
|
-
static styles = [...F,
|
|
1127
|
+
class Ne extends $ {
|
|
1128
|
+
static styles = [...F, Re];
|
|
1101
1129
|
static properties = {
|
|
1102
1130
|
...$.properties,
|
|
1103
1131
|
schoolId: { type: String, attribute: "school-id" },
|
|
@@ -1114,7 +1142,7 @@ class Re extends $ {
|
|
|
1114
1142
|
e && !this.sport && (this.sport = e);
|
|
1115
1143
|
}
|
|
1116
1144
|
async fetchData(e) {
|
|
1117
|
-
const t = this.season || N(), s = await e.getSchool(this.schoolId),
|
|
1145
|
+
const t = this.season || N(), s = await e.getSchool(this.schoolId), r = (await e.listTeams({ schoolId: this.schoolId })).items, d = r.find((k) => k.sport === (this.sport || "football")) || r[0] || null, [n, h, l, c, m, f, g] = await Promise.all([
|
|
1118
1146
|
d ? e.listGames({ sport: d.sport, season: t }) : Promise.resolve({ items: [] }),
|
|
1119
1147
|
d ? e.listTeams({ sport: d.sport }) : Promise.resolve({ items: [] }),
|
|
1120
1148
|
e.listSchools(),
|
|
@@ -1128,7 +1156,7 @@ class Re extends $ {
|
|
|
1128
1156
|
return {
|
|
1129
1157
|
season: t,
|
|
1130
1158
|
school: s,
|
|
1131
|
-
teams:
|
|
1159
|
+
teams: r,
|
|
1132
1160
|
active: d,
|
|
1133
1161
|
games: n.items,
|
|
1134
1162
|
allTeams: h.items,
|
|
@@ -1153,9 +1181,9 @@ class Re extends $ {
|
|
|
1153
1181
|
this.sport = e, this.load();
|
|
1154
1182
|
}
|
|
1155
1183
|
renderView() {
|
|
1156
|
-
const { school: e, teams: t, active: s, season:
|
|
1184
|
+
const { school: e, teams: t, active: s, season: o } = this.data;
|
|
1157
1185
|
if (!e) return i`<div class="view"><p class="empty">School not found.</p></div>`;
|
|
1158
|
-
const
|
|
1186
|
+
const r = this.ctx, d = E(e.colorPrimary || "#030711"), n = (e.adm || [])[0], h = v(this.data.conferences), l = s ? h[s.conferenceId] : null;
|
|
1159
1187
|
return i`
|
|
1160
1188
|
<div class="schoolhero" style="background:linear-gradient(115deg, ${e.colorPrimary || "#030711"} 0%, ${e.colorPrimary || "#030711"} 55%, var(--hsot-black) 100%);color:${d}">
|
|
1161
1189
|
<div class="inner">
|
|
@@ -1182,20 +1210,20 @@ class Re extends $ {
|
|
|
1182
1210
|
</div>
|
|
1183
1211
|
${B(this, i`
|
|
1184
1212
|
${P(this)}
|
|
1185
|
-
${s ? this.renderTeam(
|
|
1213
|
+
${s ? this.renderTeam(r, s, l, o) : i`<p class="empty">No teams recorded for this school yet.</p>`}
|
|
1186
1214
|
`)}
|
|
1187
1215
|
`;
|
|
1188
1216
|
}
|
|
1189
|
-
renderTeam(e, t, s,
|
|
1190
|
-
const
|
|
1217
|
+
renderTeam(e, t, s, o) {
|
|
1218
|
+
const r = e.records[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] }, d = r.w + r.l + r.t, n = s ? this.data.allTeams.filter((m) => m.conferenceId === s.id) : [], h = s ? oe(n, e.records).findIndex((m) => m.team.id === t.id) + 1 : 0, l = W(e.rankings, e.teamsById, t.id, t.sport, null), c = this.data.games.filter((m) => m.homeTeamId === t.id || m.awayTeamId === t.id).sort((m, f) => String(m.date).localeCompare(String(f.date)));
|
|
1191
1219
|
return i`
|
|
1192
1220
|
<div class="tiles">
|
|
1193
|
-
<div class="tile"><div class="k">Overall</div><div class="v">${w(
|
|
1194
|
-
<div class="tile"><div class="k">${s?.name || "Conference"}</div><div class="v">${w(
|
|
1195
|
-
<div class="s">${h ? `${
|
|
1196
|
-
<div class="tile"><div class="k">Points</div><div class="v">${d ? (
|
|
1197
|
-
<div class="s">scored per game · ${d ? (
|
|
1198
|
-
<div class="tile"><div class="k">Streak</div><div class="v">${L(
|
|
1221
|
+
<div class="tile"><div class="k">Overall</div><div class="v">${w(r)}</div><div class="s">${d} games played</div></div>
|
|
1222
|
+
<div class="tile"><div class="k">${s?.name || "Conference"}</div><div class="v">${w(r, !0)}</div>
|
|
1223
|
+
<div class="s">${h ? `${ue(h)} of ${n.length}` : "·"}</div></div>
|
|
1224
|
+
<div class="tile"><div class="k">Points</div><div class="v">${d ? (r.pf / d).toFixed(1) : "0.0"}</div>
|
|
1225
|
+
<div class="s">scored per game · ${d ? (r.pa / d).toFixed(1) : "0.0"} allowed</div></div>
|
|
1226
|
+
<div class="tile"><div class="k">Streak</div><div class="v">${L(r.results) || "·"}</div>
|
|
1199
1227
|
<div class="s">last 5: ${K(e, t.id)}</div></div>
|
|
1200
1228
|
<div class="tile"><div class="k">HSOT Top 25</div><div class="v">${l ? `#${l}` : "NR"}</div>
|
|
1201
1229
|
<div class="s"><a href=${u(e.hrefs.section, { sport: t.sport, view: "rankings" })}>full poll</a></div></div>
|
|
@@ -1208,21 +1236,21 @@ class Re extends $ {
|
|
|
1208
1236
|
<div>
|
|
1209
1237
|
<div class="section-title">Schedule & results</div>
|
|
1210
1238
|
<div class="card">
|
|
1211
|
-
${c.length ? i`<ul class="gamelist">${c.map((m) => this.renderGameRow(e, t, m))}</ul>` : i`<p class="empty">No ${t.sport} games recorded for ${
|
|
1239
|
+
${c.length ? i`<ul class="gamelist">${c.map((m) => this.renderGameRow(e, t, m))}</ul>` : i`<p class="empty">No ${t.sport} games recorded for ${o}.</p>`}
|
|
1212
1240
|
</div>
|
|
1213
1241
|
</div>
|
|
1214
1242
|
<div>
|
|
1215
|
-
<div class="section-title">Roster · ${
|
|
1216
|
-
<div class="card">${this.renderRoster(t,
|
|
1243
|
+
<div class="section-title">Roster · ${o}</div>
|
|
1244
|
+
<div class="card">${this.renderRoster(t, o)}</div>
|
|
1217
1245
|
</div>
|
|
1218
1246
|
</div>
|
|
1219
1247
|
`;
|
|
1220
1248
|
}
|
|
1221
1249
|
renderGameRow(e, t, s) {
|
|
1222
|
-
const
|
|
1250
|
+
const o = s.homeTeamId === t.id, r = o ? s.awayTeamId : s.homeTeamId, d = o ? s.homeScore : s.awayScore, n = o ? s.awayScore : s.homeScore;
|
|
1223
1251
|
let h = i`<span class="mut">${U(s.time)}</span>`;
|
|
1224
1252
|
if (s.state === "final") {
|
|
1225
|
-
const c = G(s), m = c === "tie" ? "T" : c === (
|
|
1253
|
+
const c = G(s), m = c === "tie" ? "T" : c === (o ? "home" : "away") ? "W" : "L";
|
|
1226
1254
|
h = i`<span class=${m}>${m}</span> ${d}-${n}${s.finish === "overtime" ? i` <span class="mut">OT</span>` : p}${s.forfeit && s.forfeit !== "none" ? i` <span class="mut">FF</span>` : p}`;
|
|
1227
1255
|
} else s.state === "live" && (h = i`<span style="color:var(--hsot-red)">${d}-${n}</span>`);
|
|
1228
1256
|
const l = s.gameType === "conference" ? "Conf" : s.gameType === "nonconference" ? "Non-conf" : s.gameType === "playoff" ? `Playoff${s.label ? ` · ${s.label}` : ""}` : "Scrimmage";
|
|
@@ -1231,7 +1259,7 @@ class Re extends $ {
|
|
|
1231
1259
|
<span class="d">${y(s.date)}</span>
|
|
1232
1260
|
${se(s).kind === "sched" ? p : R(s)}
|
|
1233
1261
|
<span class="res">${h}</span>
|
|
1234
|
-
<span class="opp">${
|
|
1262
|
+
<span class="opp">${o ? "vs" : "at"} ${ie(e, r, s.date)}
|
|
1235
1263
|
<span class="pill type">${l}</span>
|
|
1236
1264
|
${s.broadcast ? i`<span class="pill class">${s.broadcast}</span>` : p}
|
|
1237
1265
|
</span>
|
|
@@ -1244,37 +1272,39 @@ class Re extends $ {
|
|
|
1244
1272
|
const s = this.data.roster;
|
|
1245
1273
|
if (!s)
|
|
1246
1274
|
return i`<p class="empty">Roster not published for ${t}.</p>`;
|
|
1247
|
-
const
|
|
1275
|
+
const o = Be(s, 560), r = this.data.school?.name || "", d = v(this.data.players), n = s.entries.slice().sort((l, c) => (l.number || 0) - (c.number || 0)), h = n.some((l) => d[l.playerId]?.college);
|
|
1248
1276
|
return i`
|
|
1249
|
-
${
|
|
1250
|
-
alt="${
|
|
1251
|
-
<div class="tablewrap"><table class="data">
|
|
1252
|
-
<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>${h ? i`<th>College</th>` : p}</tr></thead>
|
|
1277
|
+
${o ? i`<img class="rosterphoto" src=${o} loading="lazy" decoding="async"
|
|
1278
|
+
alt="${r} ${e.name} ${t} team photo" />` : p}
|
|
1279
|
+
<div class="tablewrap"><table class="data roster">
|
|
1280
|
+
<thead><tr><th class="num">No.</th><th>Player</th><th class="pos">Pos</th><th class="cls">Class</th><th class="num">Ht</th><th class="num">Wt</th>${h ? i`<th>College</th>` : p}</tr></thead>
|
|
1253
1281
|
<tbody>
|
|
1254
1282
|
${n.map((l) => {
|
|
1255
1283
|
const c = d[l.playerId];
|
|
1256
|
-
|
|
1284
|
+
if (!c) return p;
|
|
1285
|
+
const m = pe(l), f = [m, c.classOf].filter(Boolean).join(" · ") || "·";
|
|
1286
|
+
return i`<tr>
|
|
1257
1287
|
<td class="num mut">${l.number ?? "·"}</td>
|
|
1258
|
-
<td style="font-weight:500">${c.firstName} ${c.lastName}</td>
|
|
1259
|
-
<td>${
|
|
1260
|
-
<td class="mut">${c.classOf || "·"}</td>
|
|
1288
|
+
<td class="player" style="font-weight:500">${c.firstName} ${c.lastName}<span class="sub">${f}</span></td>
|
|
1289
|
+
<td class="pos">${m || "·"}</td>
|
|
1290
|
+
<td class="cls mut">${c.classOf || "·"}</td>
|
|
1261
1291
|
<td class="num">${me(c.heightIn)}</td>
|
|
1262
1292
|
<td class="num">${c.weightLb || "·"}</td>
|
|
1263
|
-
${h ? i`<td>${c.college || "·"}</td>` : p}
|
|
1264
|
-
</tr
|
|
1293
|
+
${h ? i`<td class="college">${c.college || "·"}</td>` : p}
|
|
1294
|
+
</tr>`;
|
|
1265
1295
|
})}
|
|
1266
1296
|
</tbody>
|
|
1267
1297
|
</table></div>
|
|
1268
1298
|
`;
|
|
1269
1299
|
}
|
|
1270
1300
|
}
|
|
1271
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school",
|
|
1272
|
-
const
|
|
1273
|
-
function
|
|
1301
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school", Ne);
|
|
1302
|
+
const Le = "https://api.wral.com/search";
|
|
1303
|
+
function Oe(a) {
|
|
1274
1304
|
return a.map((e) => `uri:"${e}"`).join(" OR ");
|
|
1275
1305
|
}
|
|
1276
|
-
function
|
|
1277
|
-
const t = String(a ||
|
|
1306
|
+
function He(a, e) {
|
|
1307
|
+
const t = String(a || Le).replace(/\/+$/, ""), s = new URLSearchParams({ query: Oe(e), sort: "score", lang: "en" });
|
|
1278
1308
|
return `${t}/v1/query?${s}`;
|
|
1279
1309
|
}
|
|
1280
1310
|
function le(a) {
|
|
@@ -1292,13 +1322,13 @@ function le(a) {
|
|
|
1292
1322
|
}
|
|
1293
1323
|
return { uri: a, title: a };
|
|
1294
1324
|
}
|
|
1295
|
-
async function
|
|
1296
|
-
const
|
|
1297
|
-
if (!
|
|
1298
|
-
const
|
|
1325
|
+
async function Ue(a, e, t) {
|
|
1326
|
+
const o = await ((...n) => fetch(...n))(He(a, e));
|
|
1327
|
+
if (!o.ok) throw new Error(`search answered ${o.status}`);
|
|
1328
|
+
const r = await o.json(), d = new Map((r.items || []).map((n) => [n.uri, n]));
|
|
1299
1329
|
return e.map((n) => d.get(n) || le(n));
|
|
1300
1330
|
}
|
|
1301
|
-
const
|
|
1331
|
+
const Me = b`
|
|
1302
1332
|
.breadcrumbs { font-size: 0.8125rem; margin: 0.9rem 0 0; color: var(--hsot-gray-5); }
|
|
1303
1333
|
.breadcrumbs a { text-decoration: none; }
|
|
1304
1334
|
.scorehead { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center; padding: 1.4rem 1rem; }
|
|
@@ -1337,8 +1367,8 @@ const Ue = b`
|
|
|
1337
1367
|
.cols { grid-template-columns: 1fr; }
|
|
1338
1368
|
}
|
|
1339
1369
|
`;
|
|
1340
|
-
class
|
|
1341
|
-
static styles = [...F,
|
|
1370
|
+
class je extends $ {
|
|
1371
|
+
static styles = [...F, Me];
|
|
1342
1372
|
static properties = {
|
|
1343
1373
|
...$.properties,
|
|
1344
1374
|
gameId: { type: String, attribute: "game-id" },
|
|
@@ -1352,7 +1382,7 @@ class Me extends $ {
|
|
|
1352
1382
|
super(), this.gameId = "", this.searchApi = "";
|
|
1353
1383
|
}
|
|
1354
1384
|
async fetchData(e) {
|
|
1355
|
-
const t = await e.getGame(this.gameId), s = Array.isArray(t.coverageUrls) ? t.coverageUrls : [], [
|
|
1385
|
+
const t = await e.getGame(this.gameId), s = Array.isArray(t.coverageUrls) ? t.coverageUrls : [], [o, r, d, n, h, l] = await Promise.all([
|
|
1356
1386
|
e.listSchools(),
|
|
1357
1387
|
e.listTeams({ sport: t.sport }),
|
|
1358
1388
|
e.listConferences(),
|
|
@@ -1360,12 +1390,12 @@ class Me extends $ {
|
|
|
1360
1390
|
e.listGames({ sport: t.sport, season: t.season }),
|
|
1361
1391
|
// A search outage must not blank the box score — degrade to bare
|
|
1362
1392
|
// links (fetchCoverage already degrades per-URL index misses).
|
|
1363
|
-
s.length ?
|
|
1393
|
+
s.length ? Ue(this.searchApi, s).catch(() => s.map(le)) : Promise.resolve([])
|
|
1364
1394
|
]);
|
|
1365
1395
|
return {
|
|
1366
1396
|
game: t,
|
|
1367
|
-
schools:
|
|
1368
|
-
teams:
|
|
1397
|
+
schools: o.items,
|
|
1398
|
+
teams: r.items,
|
|
1369
1399
|
conferences: d.items,
|
|
1370
1400
|
rankings: n.items,
|
|
1371
1401
|
games: h.items,
|
|
@@ -1385,18 +1415,18 @@ class Me extends $ {
|
|
|
1385
1415
|
renderView() {
|
|
1386
1416
|
const e = this.data.game;
|
|
1387
1417
|
if (!e) return i`<div class="view"><p class="empty">Game not found.</p></div>`;
|
|
1388
|
-
const t = this.ctx, s = v(this.data.conferences),
|
|
1418
|
+
const t = this.ctx, s = v(this.data.conferences), o = t.teamsById[e.awayTeamId] ? t.schoolsById[t.teamsById[e.awayTeamId].schoolId] : null, r = t.teamsById[e.homeTeamId] ? t.schoolsById[t.teamsById[e.homeTeamId].schoolId] : null, d = G(e), n = (c) => e.state === "final" && d !== c && d !== "tie" ? "opacity:0.45" : "", h = e.conferenceId ? s[e.conferenceId] : null, l = this.data.games.filter((c) => c.id !== e.id && c.state === "final" && c.gameType !== "scrimmage" && (c.homeTeamId === e.homeTeamId && c.awayTeamId === e.awayTeamId || c.homeTeamId === e.awayTeamId && c.awayTeamId === e.homeTeamId));
|
|
1389
1419
|
return i`
|
|
1390
1420
|
${B(this, i`
|
|
1391
1421
|
${P(this)}
|
|
1392
1422
|
<p class="breadcrumbs">
|
|
1393
|
-
<a href=${u(t.hrefs.section, { sport: e.sport, view: "scores" })}>${
|
|
1423
|
+
<a href=${u(t.hrefs.section, { sport: e.sport, view: "scores" })}>${S(e.sport)}</a> /
|
|
1394
1424
|
<a href=${u(t.hrefs.section, { sport: e.sport, view: "scores" })}>Scores/Schedules</a> /
|
|
1395
1425
|
${T(t, e.awayTeamId)} at ${T(t, e.homeTeamId)}
|
|
1396
1426
|
</p>
|
|
1397
1427
|
<div class="card">
|
|
1398
1428
|
<div class="scorehead">
|
|
1399
|
-
${this.teamBlock(t, e, e.awayTeamId,
|
|
1429
|
+
${this.teamBlock(t, e, e.awayTeamId, o, !1)}
|
|
1400
1430
|
<div class="mid">
|
|
1401
1431
|
<div class="bigscore">
|
|
1402
1432
|
<span style=${n("away")}>${e.awayScore}</span>
|
|
@@ -1412,9 +1442,9 @@ class Me extends $ {
|
|
|
1412
1442
|
${(e.tags || []).map((c) => i`<span class="pill type">${c}</span>`)}
|
|
1413
1443
|
</div>
|
|
1414
1444
|
</div>
|
|
1415
|
-
${this.teamBlock(t, e, e.homeTeamId,
|
|
1445
|
+
${this.teamBlock(t, e, e.homeTeamId, r, !0)}
|
|
1416
1446
|
</div>
|
|
1417
|
-
${this.renderLineScore(e,
|
|
1447
|
+
${this.renderLineScore(e, o, r)}
|
|
1418
1448
|
${e.notes ? i`<p class="note" style="padding:0 1rem 0.9rem;text-align:center">${e.notes}</p>` : p}
|
|
1419
1449
|
</div>
|
|
1420
1450
|
${(this.data.coverage || []).length ? i`
|
|
@@ -1435,7 +1465,7 @@ class Me extends $ {
|
|
|
1435
1465
|
</div>` : p}
|
|
1436
1466
|
<div class="section-title">Season context</div>
|
|
1437
1467
|
<div class="cols">
|
|
1438
|
-
${[[e.awayTeamId,
|
|
1468
|
+
${[[e.awayTeamId, o], [e.homeTeamId, r]].map(([c, m]) => this.renderContext(t, c, m))}
|
|
1439
1469
|
</div>
|
|
1440
1470
|
${l.length ? i`
|
|
1441
1471
|
<div class="section-title">Head to head this season</div>
|
|
@@ -1449,36 +1479,36 @@ class Me extends $ {
|
|
|
1449
1479
|
`)}
|
|
1450
1480
|
`;
|
|
1451
1481
|
}
|
|
1452
|
-
teamBlock(e, t, s,
|
|
1453
|
-
if (!
|
|
1454
|
-
const d = e.teamsById[s], n = e.records[s], h = A(
|
|
1482
|
+
teamBlock(e, t, s, o, r) {
|
|
1483
|
+
if (!o) return i`<div class="teamblock ${r ? "right" : ""}"><div class="tname">TBD</div></div>`;
|
|
1484
|
+
const d = e.teamsById[s], n = e.records[s], h = A(o, 58);
|
|
1455
1485
|
return i`
|
|
1456
|
-
<div class="teamblock ${
|
|
1457
|
-
${h ? i`<img class="crest logo" alt="" loading="lazy" src=${h} />` : i`<span class="crest" style="background:${
|
|
1486
|
+
<div class="teamblock ${r ? "right" : ""}">
|
|
1487
|
+
${h ? i`<img class="crest logo" alt="" loading="lazy" src=${h} />` : i`<span class="crest" style="background:${o.colorPrimary || "#030711"};color:${E(o.colorPrimary || "#030711")}">${j(o)}</span>`}
|
|
1458
1488
|
<div>
|
|
1459
|
-
<div class="tname">${Y(e, s, t.date)}<a href=${u(e.hrefs.school, { id:
|
|
1460
|
-
<div class="trec">${
|
|
1489
|
+
<div class="tname">${Y(e, s, t.date)}<a href=${u(e.hrefs.school, { id: o.id })}>${o.name}</a></div>
|
|
1490
|
+
<div class="trec">${o.mascot || ""} · ${w(n)}${d?.conferenceId ? i` · ${w(n, !0)} conf` : p}</div>
|
|
1461
1491
|
</div>
|
|
1462
1492
|
</div>
|
|
1463
1493
|
`;
|
|
1464
1494
|
}
|
|
1465
1495
|
renderLineScore(e, t, s) {
|
|
1466
|
-
const
|
|
1467
|
-
if (!
|
|
1496
|
+
const o = e.periodScores || [];
|
|
1497
|
+
if (!o.length)
|
|
1468
1498
|
return i`<p class="empty" style="text-align:center">Period scoring will appear once the game starts.</p>`;
|
|
1469
|
-
const
|
|
1470
|
-
const m =
|
|
1499
|
+
const r = Math.max(4, ...o.map((l) => l.period)), d = (l) => l <= 4 ? String(l) : `OT${l > 5 ? l - 4 : ""}`, n = (l, c) => {
|
|
1500
|
+
const m = o.find((f) => f.period === c);
|
|
1471
1501
|
return m ? m[l] : e.state === "final" ? 0 : "·";
|
|
1472
1502
|
}, h = (l, c, m) => i`
|
|
1473
1503
|
<tr>
|
|
1474
1504
|
<td class="teamcell">${C(l, 20)}${l?.abbr || "TBD"}</td>
|
|
1475
|
-
${Array.from({ length:
|
|
1505
|
+
${Array.from({ length: r }, (f, g) => i`<td class="num">${n(c, g + 1)}</td>`)}
|
|
1476
1506
|
<td class="num" style="font-weight:700">${m}</td>
|
|
1477
1507
|
</tr>`;
|
|
1478
1508
|
return i`
|
|
1479
1509
|
<div class="tablewrap" style="border-top:1px solid var(--hsot-gray-2)">
|
|
1480
1510
|
<table class="data" style="max-width:560px;margin:0.6rem auto 0.9rem">
|
|
1481
|
-
<thead><tr><th>Team</th>${Array.from({ length:
|
|
1511
|
+
<thead><tr><th>Team</th>${Array.from({ length: r }, (l, c) => i`<th class="num">${d(c + 1)}</th>`)}<th class="num">T</th></tr></thead>
|
|
1482
1512
|
<tbody>
|
|
1483
1513
|
${h(t, "away", e.awayScore)}
|
|
1484
1514
|
${h(s, "home", e.homeScore)}
|
|
@@ -1489,24 +1519,24 @@ class Me extends $ {
|
|
|
1489
1519
|
}
|
|
1490
1520
|
renderContext(e, t, s) {
|
|
1491
1521
|
if (!s) return p;
|
|
1492
|
-
const
|
|
1522
|
+
const o = e.records[t], r = q(this.data.games, t);
|
|
1493
1523
|
return i`
|
|
1494
1524
|
<div class="card ctxcard">
|
|
1495
1525
|
<div class="who">${C(s)}${s.name}</div>
|
|
1496
1526
|
<div class="row">
|
|
1497
1527
|
<span>Last 5: ${K(e, t)}</span>
|
|
1498
|
-
<span>Streak: <b>${
|
|
1499
|
-
<span>PF/PA: <b>${
|
|
1500
|
-
<span>Next: ${
|
|
1501
|
-
${
|
|
1528
|
+
<span>Streak: <b>${o ? L(o.results) : "·"}</b></span>
|
|
1529
|
+
<span>PF/PA: <b>${o ? `${o.pf} / ${o.pa}` : "·"}</b></span>
|
|
1530
|
+
<span>Next: ${r ? i`${y(r.date, { month: "numeric", day: "numeric" })}
|
|
1531
|
+
${r.homeTeamId === t ? "vs" : "at"} ${_(e, r.homeTeamId === t ? r.awayTeamId : r.homeTeamId)}` : "·"}</span>
|
|
1502
1532
|
</div>
|
|
1503
1533
|
</div>
|
|
1504
1534
|
`;
|
|
1505
1535
|
}
|
|
1506
1536
|
}
|
|
1507
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore",
|
|
1508
|
-
const
|
|
1509
|
-
class
|
|
1537
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore", je);
|
|
1538
|
+
const Ge = 250, qe = 2;
|
|
1539
|
+
class We extends te {
|
|
1510
1540
|
static properties = {
|
|
1511
1541
|
api: { type: String },
|
|
1512
1542
|
schoolHref: { type: String, attribute: "school-href" },
|
|
@@ -1586,11 +1616,11 @@ class qe extends te {
|
|
|
1586
1616
|
}
|
|
1587
1617
|
onInput(e) {
|
|
1588
1618
|
const t = e.target.value.trim();
|
|
1589
|
-
if (clearTimeout(this.debounceTimer), t.length <
|
|
1619
|
+
if (clearTimeout(this.debounceTimer), t.length < qe) {
|
|
1590
1620
|
this.abortController?.abort(), this.results = [], this.open = !1, this.searched = !1;
|
|
1591
1621
|
return;
|
|
1592
1622
|
}
|
|
1593
|
-
this.debounceTimer = setTimeout(() => this.search(t),
|
|
1623
|
+
this.debounceTimer = setTimeout(() => this.search(t), Ge);
|
|
1594
1624
|
}
|
|
1595
1625
|
async search(e) {
|
|
1596
1626
|
this.abortController?.abort(), this.abortController = new AbortController();
|
|
@@ -1600,8 +1630,8 @@ class qe extends te {
|
|
|
1600
1630
|
});
|
|
1601
1631
|
if (!s.ok)
|
|
1602
1632
|
return;
|
|
1603
|
-
const
|
|
1604
|
-
this.results =
|
|
1633
|
+
const o = await s.json();
|
|
1634
|
+
this.results = o.items || [], this.activeIndex = -1, this.searched = !0, this.open = !0;
|
|
1605
1635
|
} catch (t) {
|
|
1606
1636
|
t.name !== "AbortError" && console.warn("school search failed", t);
|
|
1607
1637
|
}
|
|
@@ -1635,15 +1665,15 @@ class qe extends te {
|
|
|
1635
1665
|
return [e.location, e.county && `${e.county} County`].filter(Boolean).join(" — ");
|
|
1636
1666
|
}
|
|
1637
1667
|
renderOption(e, t) {
|
|
1638
|
-
const s = this.where(e),
|
|
1639
|
-
|
|
1668
|
+
const s = this.where(e), o = (r) => {
|
|
1669
|
+
r.preventDefault(), this.go(e);
|
|
1640
1670
|
};
|
|
1641
1671
|
return i`
|
|
1642
1672
|
<li
|
|
1643
1673
|
id="school-option-${t}"
|
|
1644
1674
|
role="option"
|
|
1645
1675
|
aria-selected="${t === this.activeIndex ? "true" : "false"}"
|
|
1646
|
-
@pointerdown="${
|
|
1676
|
+
@pointerdown="${o}"
|
|
1647
1677
|
@mousemove="${() => {
|
|
1648
1678
|
this.activeIndex = t;
|
|
1649
1679
|
}}"
|
|
@@ -1657,7 +1687,7 @@ class qe extends te {
|
|
|
1657
1687
|
const e = this.searched && !this.results.length, t = i`<li class="empty">No schools found</li>`;
|
|
1658
1688
|
return i`
|
|
1659
1689
|
<ul id="school-search-listbox" role="listbox" aria-label="Schools">
|
|
1660
|
-
${this.results.map((s,
|
|
1690
|
+
${this.results.map((s, o) => this.renderOption(s, o))}
|
|
1661
1691
|
${e ? t : p}
|
|
1662
1692
|
</ul>
|
|
1663
1693
|
`;
|
|
@@ -1683,23 +1713,23 @@ class qe extends te {
|
|
|
1683
1713
|
`;
|
|
1684
1714
|
}
|
|
1685
1715
|
}
|
|
1686
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-school-search") && globalThis.customElements.define("hsot-school-search",
|
|
1716
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-school-search") && globalThis.customElements.define("hsot-school-search", We);
|
|
1687
1717
|
export {
|
|
1688
1718
|
H as D,
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1719
|
+
je as H,
|
|
1720
|
+
_e as a,
|
|
1721
|
+
Ne as b,
|
|
1722
|
+
We as c,
|
|
1723
|
+
Pe as d,
|
|
1724
|
+
Ee as e,
|
|
1695
1725
|
z as f,
|
|
1696
1726
|
he as g,
|
|
1697
1727
|
u as h,
|
|
1698
1728
|
G as i,
|
|
1699
|
-
|
|
1729
|
+
Ye as j,
|
|
1700
1730
|
L as k,
|
|
1701
|
-
|
|
1731
|
+
Fe as p,
|
|
1702
1732
|
w as r,
|
|
1703
|
-
|
|
1733
|
+
oe as s,
|
|
1704
1734
|
W as t
|
|
1705
1735
|
};
|