@wral/hsot-data 0.1.8 → 0.1.10
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 +7 -5
- package/dist/define.mjs +1 -1
- package/dist/define.standalone.js +325 -311
- package/dist/{hsot-school-search-R6y64nMR.js → hsot-school-search-CKZtwPCA.js} +433 -419
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import { LitElement as ee, html as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
1
|
+
import { LitElement as ee, html as r, css as b, nothing as p, svg as Q } from "lit";
|
|
2
|
+
const le = 50;
|
|
3
|
+
function ce(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
|
-
function
|
|
9
|
+
function de({ 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 i(n) {
|
|
13
13
|
const h = { Accept: "application/json" };
|
|
14
14
|
e && (h.Authorization = `Bearer ${e}`);
|
|
15
|
-
const
|
|
16
|
-
if (!
|
|
17
|
-
const
|
|
18
|
-
throw
|
|
15
|
+
const l = await o(`${s}${n}`, { headers: h });
|
|
16
|
+
if (!l.ok) {
|
|
17
|
+
const c = new Error(`api-hsot ${l.status} on ${n}`);
|
|
18
|
+
throw c.status = l.status, c;
|
|
19
19
|
}
|
|
20
|
-
return
|
|
21
|
-
}
|
|
22
|
-
async function
|
|
23
|
-
const
|
|
24
|
-
let
|
|
25
|
-
for (let m = 0; m <
|
|
26
|
-
const f =
|
|
27
|
-
if (
|
|
20
|
+
return l.json();
|
|
21
|
+
}
|
|
22
|
+
async function d(n, h = {}) {
|
|
23
|
+
const l = [];
|
|
24
|
+
let c = null;
|
|
25
|
+
for (let m = 0; m < le; m += 1) {
|
|
26
|
+
const f = ce(c ? { ...h, cursor: c } : h), g = await i(`${n}${f}`);
|
|
27
|
+
if (l.push(...g.items || []), c = g.nextCursor || null, !c) break;
|
|
28
28
|
}
|
|
29
|
-
return { items:
|
|
29
|
+
return { items: l, total: l.length, nextCursor: null };
|
|
30
30
|
}
|
|
31
31
|
return {
|
|
32
|
-
listSchools: (n) =>
|
|
33
|
-
getSchool: (n) =>
|
|
34
|
-
listTeams: (n) =>
|
|
35
|
-
getTeam: (n) =>
|
|
36
|
-
listConferences: (n) =>
|
|
37
|
-
listPlayers: (n) =>
|
|
38
|
-
listRosters: (n) =>
|
|
39
|
-
listGames: (n) =>
|
|
40
|
-
getGame: (n) =>
|
|
41
|
-
listTournaments: (n) =>
|
|
42
|
-
listSeedings: (n, h) =>
|
|
43
|
-
listRankings: (n) =>
|
|
44
|
-
listSports: () =>
|
|
32
|
+
listSchools: (n) => d("/schools", n),
|
|
33
|
+
getSchool: (n) => i(`/schools/${n}`),
|
|
34
|
+
listTeams: (n) => d("/teams", n),
|
|
35
|
+
getTeam: (n) => i(`/teams/${n}`),
|
|
36
|
+
listConferences: (n) => d("/conferences", n),
|
|
37
|
+
listPlayers: (n) => d("/players", n),
|
|
38
|
+
listRosters: (n) => d("/rosters", n),
|
|
39
|
+
listGames: (n) => d("/games", n),
|
|
40
|
+
getGame: (n) => i(`/games/${n}`),
|
|
41
|
+
listTournaments: (n) => d("/tournaments", n),
|
|
42
|
+
listSeedings: (n, h) => d(`/tournaments/${n}/seedings`, h),
|
|
43
|
+
listRankings: (n) => d("/rankings", n),
|
|
44
|
+
listSports: () => i("/sports")
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
const H = {
|
|
@@ -62,8 +62,8 @@ function D(a) {
|
|
|
62
62
|
const I = (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 "";
|
|
@@ -72,7 +72,7 @@ function U(a) {
|
|
|
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 he(a) {
|
|
76
76
|
return a ? `${Math.floor(a / 12)}-${a % 12}` : "·";
|
|
77
77
|
}
|
|
78
78
|
function N(a = /* @__PURE__ */ new Date()) {
|
|
@@ -83,10 +83,10 @@ 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 me(a, e = M()) {
|
|
87
87
|
const t = [...new Set((a || []).filter(Boolean))].sort();
|
|
88
88
|
if (!t.length || t.includes(e)) return e;
|
|
89
|
-
const s = t.filter((
|
|
89
|
+
const s = t.filter((o) => o < e);
|
|
90
90
|
return s.length ? s[s.length - 1] : t[0];
|
|
91
91
|
}
|
|
92
92
|
function j(a) {
|
|
@@ -94,10 +94,10 @@ function j(a) {
|
|
|
94
94
|
}
|
|
95
95
|
function E(a) {
|
|
96
96
|
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 *
|
|
97
|
+
const e = parseInt(a.slice(1), 16), t = e >> 16 & 255, s = e >> 8 & 255, o = e & 255;
|
|
98
|
+
return 0.299 * t + 0.587 * s + 0.114 * o > 150 ? "#0F1B33" : "#FFFFFF";
|
|
99
99
|
}
|
|
100
|
-
const
|
|
100
|
+
const pe = (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
|
};
|
|
@@ -109,14 +109,14 @@ function te(a) {
|
|
|
109
109
|
}
|
|
110
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
|
-
const
|
|
112
|
+
const fe = /* @__PURE__ */ new Set(["game", "story", "page", "forum", "video", "gallery"]);
|
|
113
113
|
function x(a) {
|
|
114
114
|
let e = String(a || "").replace(/^[a-z][a-z0-9+.-]*:\/\/[^/#?]*/i, "");
|
|
115
115
|
const t = e.indexOf("#");
|
|
116
116
|
let s = "";
|
|
117
117
|
t !== -1 && (s = e.slice(t).split("?")[0], e = e.slice(0, t));
|
|
118
|
-
let
|
|
119
|
-
return
|
|
118
|
+
let o = e.split("?")[0] + s;
|
|
119
|
+
return o = o.replace(/([^:])\/{2,}/g, "$1/").replace(/^\/{2,}/, "/"), o = o.replace(/^\/(?=#)/, ""), o.length > 1 && (o = o.replace(/\/+$/, "")), o.toLowerCase();
|
|
120
120
|
}
|
|
121
121
|
function se() {
|
|
122
122
|
const a = globalThis.location;
|
|
@@ -124,20 +124,20 @@ function se() {
|
|
|
124
124
|
const e = (a.hash || "").startsWith("#/") ? a.hash : "";
|
|
125
125
|
return x((a.pathname || "") + e);
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function ue(a, e, t) {
|
|
128
128
|
if (!t) return null;
|
|
129
129
|
const s = x(a);
|
|
130
130
|
if (!s) return null;
|
|
131
|
-
const
|
|
132
|
-
if (s ===
|
|
133
|
-
const
|
|
134
|
-
if (s ===
|
|
135
|
-
if (!s.startsWith(`${
|
|
136
|
-
const n = s.slice(
|
|
137
|
-
return h.length > 2 || h.some((
|
|
131
|
+
const o = x(u(e.game, { sport: t, id: "" })), i = x(u(e.school, { id: "" }));
|
|
132
|
+
if (s === o || s.startsWith(`${o}/`) || s === i || s.startsWith(`${i}/`)) return null;
|
|
133
|
+
const d = x(u(e.section, { sport: t, view: "" }));
|
|
134
|
+
if (s === d) return "";
|
|
135
|
+
if (!s.startsWith(`${d}/`)) return null;
|
|
136
|
+
const n = s.slice(d.length + 1), h = n.split("/");
|
|
137
|
+
return h.length > 2 || h.some((l) => !/^[a-z][a-z-]*$/.test(l)) || fe.has(h[0]) ? null : n;
|
|
138
138
|
}
|
|
139
|
-
function
|
|
140
|
-
const s = (
|
|
139
|
+
function ge(a, e, t) {
|
|
140
|
+
const s = (d) => u(t.section, { sport: a, view: d }).replace(/([^:])\/{2,}/g, "$1/"), i = new Set((e || []).map((d) => d && d.gender).filter((d) => d === "boys" || d === "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") }];
|
|
@@ -145,11 +145,11 @@ function ue(a, e, t) {
|
|
|
145
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
|
+
...i,
|
|
149
149
|
{ label: "Polls & Rankings", href: s("rankings") }
|
|
150
150
|
];
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function ve(a, e = se()) {
|
|
153
153
|
const t = x(e);
|
|
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");
|
|
@@ -173,7 +173,7 @@ class $ extends ee {
|
|
|
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 ? de({ baseUrl: this.api }) : null;
|
|
177
177
|
}
|
|
178
178
|
connectedCallback() {
|
|
179
179
|
super.connectedCallback(), this._setupInterval();
|
|
@@ -185,7 +185,7 @@ class $ extends ee {
|
|
|
185
185
|
this.load();
|
|
186
186
|
}
|
|
187
187
|
updated(e) {
|
|
188
|
-
e.has("api") && e.get("api") !== void 0 && e.get("api") !== this.api && this.load(), e.has("refreshInterval") && this._setupInterval(),
|
|
188
|
+
e.has("api") && e.get("api") !== void 0 && e.get("api") !== this.api && this.load(), e.has("refreshInterval") && this._setupInterval(), ve(this);
|
|
189
189
|
}
|
|
190
190
|
async load() {
|
|
191
191
|
const e = this.client;
|
|
@@ -214,13 +214,13 @@ class $ extends ee {
|
|
|
214
214
|
this._refreshId && (clearInterval(this._refreshId), this._refreshId = null);
|
|
215
215
|
}
|
|
216
216
|
render() {
|
|
217
|
-
return this.error === "not-configured" ?
|
|
217
|
+
return this.error === "not-configured" ? r`<div class="error">This component needs an <code>api</code> attribute (the api-hsot public read-surface base URL) or an injected client.</div>` : this.error ? r`<div class="error">Unable to load right now. <button class="chip" @click=${() => this.load()}>Retry</button></div>` : this.data ? this.renderView() : r`<div class="loading" role="status">Loading…</div>`;
|
|
218
218
|
}
|
|
219
219
|
renderView() {
|
|
220
|
-
return
|
|
220
|
+
return r``;
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
|
-
const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])),
|
|
223
|
+
const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), be = b`
|
|
224
224
|
:host {
|
|
225
225
|
--hsot-red: var(--color-red, #D1232A);
|
|
226
226
|
--hsot-red-deep: var(--color-red-dark, #951C21);
|
|
@@ -258,7 +258,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ve = b`
|
|
|
258
258
|
outline-offset: 1px;
|
|
259
259
|
}
|
|
260
260
|
.mut { color: var(--hsot-gray-5); }
|
|
261
|
-
`,
|
|
261
|
+
`, ye = b`
|
|
262
262
|
.band { background: var(--hsot-white); color: var(--hsot-black); }
|
|
263
263
|
.band .inner { max-width: 1366px; margin: 0 auto; padding: 1.1rem 1.25rem 0; }
|
|
264
264
|
.band h1, .band h2.bandtitle {
|
|
@@ -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
|
+
`, $e = 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
|
+
`, we = 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;
|
|
@@ -386,7 +386,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ve = b`
|
|
|
386
386
|
.pill.champ { background: var(--hsot-straw); color: #6b5900; }
|
|
387
387
|
@keyframes hsot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
|
|
388
388
|
@media (prefers-reduced-motion: reduce) { .pill.live { animation: none; } }
|
|
389
|
-
`,
|
|
389
|
+
`, xe = b`
|
|
390
390
|
.tablewrap { overflow-x: auto; }
|
|
391
391
|
table.data { font-family: var(--hsot-heading-font); font-size: 14px; border-collapse: collapse; width: 100%; }
|
|
392
392
|
table.data th {
|
|
@@ -404,7 +404,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ve = b`
|
|
|
404
404
|
table.data tbody tr.rowlink:hover { background: var(--hsot-gray-1); }
|
|
405
405
|
table.data td.teamcell a { color: inherit; text-decoration: none; font-weight: 500; }
|
|
406
406
|
table.data td.teamcell a:hover { text-decoration: underline; }
|
|
407
|
-
`,
|
|
407
|
+
`, ke = b`
|
|
408
408
|
.swatch {
|
|
409
409
|
display: inline-flex; align-items: center; justify-content: center;
|
|
410
410
|
width: 26px; height: 26px; border-radius: 50%;
|
|
@@ -428,7 +428,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ve = b`
|
|
|
428
428
|
.dot.W { background: var(--hsot-win); }
|
|
429
429
|
.dot.L { background: var(--hsot-loss); }
|
|
430
430
|
.dot.T { background: var(--hsot-tie); }
|
|
431
|
-
`,
|
|
431
|
+
`, Te = b`
|
|
432
432
|
ul.gamelist { list-style: none; margin: 0; padding: 0; }
|
|
433
433
|
.gamelist li {
|
|
434
434
|
display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 1rem;
|
|
@@ -478,24 +478,24 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ve = b`
|
|
|
478
478
|
.gamelist .ff { color: var(--hsot-gray-5); font-size: 0.78rem; font-style: italic; }
|
|
479
479
|
.gamelist .where { color: var(--hsot-gray-5); font-size: 0.78rem; }
|
|
480
480
|
.gamelist a.box { font-size: 0.78rem; }
|
|
481
|
-
`, F = [
|
|
481
|
+
`, F = [be, ye, $e, we, xe, ke, Te];
|
|
482
482
|
function G(a) {
|
|
483
|
-
return a.state !== "final" ? null : a.forfeit
|
|
483
|
+
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";
|
|
484
484
|
}
|
|
485
|
-
function
|
|
486
|
-
return
|
|
485
|
+
function Ie(a) {
|
|
486
|
+
return a && (a.forfeit === "home" || a.forfeit === "away") ? a.forfeit : null;
|
|
487
487
|
}
|
|
488
488
|
function z(a, e) {
|
|
489
|
-
const t = {}, s = (
|
|
490
|
-
for (const
|
|
491
|
-
const
|
|
489
|
+
const t = {}, s = (i) => (t[i] = t[i] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] }, t[i]), o = a.filter((i) => i.state === "final" && i.gameType !== "scrimmage" && (!e || i.date <= e)).sort((i, d) => String(i.date).localeCompare(String(d.date)));
|
|
490
|
+
for (const i of o) {
|
|
491
|
+
const d = G(i), n = i.gameType === "conference";
|
|
492
492
|
for (const h of ["home", "away"]) {
|
|
493
|
-
const
|
|
494
|
-
if (!
|
|
495
|
-
const
|
|
496
|
-
|
|
493
|
+
const l = h === "home" ? i.homeTeamId : i.awayTeamId;
|
|
494
|
+
if (!l) continue;
|
|
495
|
+
const c = s(l), m = h === "home" ? i.homeScore : i.awayScore, f = h === "home" ? i.awayScore : i.homeScore;
|
|
496
|
+
c.pf += m, c.pa += f;
|
|
497
497
|
let g = "T";
|
|
498
|
-
|
|
498
|
+
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: i.id, date: i.date, mark: g, my: m, their: f, opp: h === "home" ? i.awayTeamId : i.homeTeamId, conf: n });
|
|
499
499
|
}
|
|
500
500
|
}
|
|
501
501
|
return t;
|
|
@@ -513,8 +513,8 @@ const X = (a, e, t) => {
|
|
|
513
513
|
}, Z = (a) => a.toFixed(3).replace("0.", ".");
|
|
514
514
|
function w(a, e = !1) {
|
|
515
515
|
if (!a) return "0-0";
|
|
516
|
-
const t = e ? a.cw : a.w, s = e ? a.cl : a.l,
|
|
517
|
-
return `${t}-${s}${
|
|
516
|
+
const t = e ? a.cw : a.w, s = e ? a.cl : a.l, o = e ? a.ct : a.t;
|
|
517
|
+
return `${t}-${s}${o ? `-${o}` : ""}`;
|
|
518
518
|
}
|
|
519
519
|
function ae(a, e) {
|
|
520
520
|
return a.map((t) => {
|
|
@@ -529,61 +529,69 @@ function J(a, e) {
|
|
|
529
529
|
const t = a[e];
|
|
530
530
|
return t && t.results.length ? t.results[t.results.length - 1] : null;
|
|
531
531
|
}
|
|
532
|
-
function
|
|
533
|
-
let
|
|
534
|
-
for (const
|
|
535
|
-
|
|
536
|
-
return
|
|
532
|
+
function qe(a, e, t, s = "") {
|
|
533
|
+
let o = null;
|
|
534
|
+
for (const i of a || [])
|
|
535
|
+
i.sport === e && (t && i.effectiveDate > t || s && i.gender && i.gender !== s || (!o || i.effectiveDate > o.effectiveDate) && (o = i));
|
|
536
|
+
return o;
|
|
537
537
|
}
|
|
538
|
-
function W(a, e, t, s,
|
|
539
|
-
const
|
|
540
|
-
if (!
|
|
541
|
-
const
|
|
538
|
+
function W(a, e, t, s, o) {
|
|
539
|
+
const i = e[t];
|
|
540
|
+
if (!i) return null;
|
|
541
|
+
const d = /* @__PURE__ */ new Map();
|
|
542
542
|
for (const h of a || []) {
|
|
543
|
-
if (h.sport !== s ||
|
|
544
|
-
const
|
|
545
|
-
(!
|
|
543
|
+
if (h.sport !== s || o && h.effectiveDate > o || h.gender && i.gender !== h.gender && i.gender !== "coed") continue;
|
|
544
|
+
const l = h.gender || "", c = d.get(l);
|
|
545
|
+
(!c || h.effectiveDate > c.effectiveDate) && d.set(l, h);
|
|
546
546
|
}
|
|
547
547
|
let n = null;
|
|
548
|
-
for (const h of
|
|
549
|
-
const
|
|
550
|
-
|
|
548
|
+
for (const h of d.values()) {
|
|
549
|
+
const l = (h.teamIds || []).indexOf(t);
|
|
550
|
+
l !== -1 && (!n || h.effectiveDate > n.effectiveDate) && (n = { poll: h, rank: l + 1 });
|
|
551
551
|
}
|
|
552
552
|
return n ? n.rank : null;
|
|
553
553
|
}
|
|
554
|
-
function
|
|
554
|
+
function Se(a, e, t) {
|
|
555
555
|
if (!a) return { kind: "none", delta: 0 };
|
|
556
556
|
const s = (a.teamIds || []).indexOf(t) + 1;
|
|
557
557
|
if (!s) return { kind: "none", delta: 0 };
|
|
558
558
|
if (!e) return { kind: "same", delta: 0 };
|
|
559
|
-
const
|
|
560
|
-
if (!
|
|
561
|
-
const
|
|
562
|
-
return
|
|
559
|
+
const o = (e.teamIds || []).indexOf(t) + 1;
|
|
560
|
+
if (!o) return { kind: "new", delta: 0 };
|
|
561
|
+
const i = o - s;
|
|
562
|
+
return i > 0 ? { kind: "up", delta: i } : i < 0 ? { kind: "down", delta: -i } : { kind: "same", delta: 0 };
|
|
563
563
|
}
|
|
564
|
-
function
|
|
564
|
+
function Ce(a) {
|
|
565
565
|
return /^https?:\/\//i.test(String(a || ""));
|
|
566
566
|
}
|
|
567
|
-
function
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
567
|
+
function oe(a, { w: e, h: t } = {}) {
|
|
568
|
+
if (!Ce(a)) return "";
|
|
569
|
+
const s = [];
|
|
570
|
+
e && s.push(`w=${Math.max(1, Math.round(e))}`), t && s.push(`h=${Math.max(1, Math.round(t))}`), s.push("f=webp");
|
|
571
|
+
const o = a.includes("?") ? "&" : "?";
|
|
572
|
+
return `${a}${o}${s.join("&")}`;
|
|
572
573
|
}
|
|
573
|
-
function
|
|
574
|
-
const
|
|
575
|
-
return
|
|
574
|
+
function A(a, e) {
|
|
575
|
+
const t = e * 2;
|
|
576
|
+
return oe(a?.logoAssetId, { w: t, h: t });
|
|
577
|
+
}
|
|
578
|
+
function De(a, e) {
|
|
579
|
+
return oe(a?.photoAssetId, { w: e * 2 });
|
|
580
|
+
}
|
|
581
|
+
function V(a, e, { title: t, sub: s, teams: o }) {
|
|
582
|
+
const i = se(), n = !!a.querySelector(':scope > a[slot="nav"]') || ue(i, e.hrefs, e.sport) !== null;
|
|
583
|
+
return r`
|
|
576
584
|
<div class="band section">
|
|
577
585
|
<div class="inner">
|
|
578
586
|
<h1>${t}</h1>
|
|
579
|
-
${s ?
|
|
587
|
+
${s ? r`<p class="sub">${s}</p>` : p}
|
|
580
588
|
</div>
|
|
581
|
-
${n ?
|
|
589
|
+
${n ? r`
|
|
582
590
|
<nav class="sectionnav" aria-label="${I(e.sport)} section">
|
|
583
591
|
<div class="navrow">
|
|
584
592
|
<slot name="nav">
|
|
585
|
-
${
|
|
586
|
-
aria-current=${
|
|
593
|
+
${ge(e.sport, o, e.hrefs).map((h) => r`<a href=${h.href}
|
|
594
|
+
aria-current=${i && x(h.href) === i ? "page" : p}>${h.label}</a>`)}
|
|
587
595
|
</slot>
|
|
588
596
|
</div>
|
|
589
597
|
</nav>` : p}
|
|
@@ -593,57 +601,57 @@ function V(a, e, { title: t, sub: s, teams: r }) {
|
|
|
593
601
|
const S = (a, e) => {
|
|
594
602
|
const t = a.teamsById[e];
|
|
595
603
|
return t ? a.schoolsById[t.schoolId] : null;
|
|
596
|
-
}, T = (a, e) => S(a, e)?.name || "TBD",
|
|
604
|
+
}, T = (a, e) => S(a, e)?.name || "TBD", _ = (a, e) => S(a, e)?.abbr || "TBD";
|
|
597
605
|
function C(a, e = 26) {
|
|
598
606
|
if (!a) return p;
|
|
599
|
-
const t =
|
|
607
|
+
const t = A(a, e);
|
|
600
608
|
if (t)
|
|
601
|
-
return
|
|
609
|
+
return r`<img class="swatch logo" aria-hidden="true" alt="" loading="lazy"
|
|
602
610
|
src=${t} style="width:${e}px;height:${e}px" />`;
|
|
603
|
-
const s = a.colorPrimary || "#030711",
|
|
604
|
-
return
|
|
605
|
-
style="width:${e}px;height:${e}px;background:${s};color:${
|
|
611
|
+
const s = a.colorPrimary || "#030711", o = E(s);
|
|
612
|
+
return r`<span class="swatch" aria-hidden="true"
|
|
613
|
+
style="width:${e}px;height:${e}px;background:${s};color:${o};font-size:${Math.max(8, e * 0.28)}px"
|
|
606
614
|
>${j(a)}</span>`;
|
|
607
615
|
}
|
|
608
616
|
function Y(a, e, t) {
|
|
609
617
|
const s = W(a.rankings, a.teamsById, e, a.sport, t);
|
|
610
|
-
return s ?
|
|
618
|
+
return s ? r`<span class="rankbadge">#${s}</span>` : p;
|
|
611
619
|
}
|
|
612
620
|
function re(a, e, t) {
|
|
613
621
|
const s = S(a, e);
|
|
614
|
-
return s ?
|
|
622
|
+
return s ? r`${Y(a, e, t)}<a href=${u(a.hrefs.school, { id: s.id })}>${s.name}</a>` : r`<span class="mut">TBD</span>`;
|
|
615
623
|
}
|
|
616
624
|
function K(a, e, t = 5) {
|
|
617
625
|
const s = a.records[e];
|
|
618
|
-
if (!s || !s.results.length) return
|
|
619
|
-
const
|
|
620
|
-
return
|
|
621
|
-
${
|
|
622
|
-
title="${
|
|
623
|
-
href=${u(a.hrefs.game, { sport: a.sport, id:
|
|
626
|
+
if (!s || !s.results.length) return r`<span class="mut">·</span>`;
|
|
627
|
+
const o = s.results.slice(-1 * t);
|
|
628
|
+
return r`<span class="dots" role="img" aria-label="last ${o.length} results">
|
|
629
|
+
${o.map((i) => r`<a class="dot ${i.mark}"
|
|
630
|
+
title="${i.mark} ${i.my}-${i.their} vs ${T(a, i.opp)}"
|
|
631
|
+
href=${u(a.hrefs.game, { sport: a.sport, id: i.gameId })}>${i.mark}</a>`)}
|
|
624
632
|
</span>`;
|
|
625
633
|
}
|
|
626
634
|
function B(a, e) {
|
|
627
|
-
return a.querySelector(':scope > [slot="rail"]') ?
|
|
635
|
+
return a.querySelector(':scope > [slot="rail"]') ? r`<div class="view withrail">
|
|
628
636
|
<div class="viewmain">${e}</div>
|
|
629
637
|
<aside class="viewrail"><slot name="rail"></slot></aside>
|
|
630
|
-
</div>` :
|
|
638
|
+
</div>` : r`<div class="view">${e}</div>`;
|
|
631
639
|
}
|
|
632
640
|
function P(a) {
|
|
633
641
|
if (!a.promoImage) return p;
|
|
634
|
-
const e =
|
|
635
|
-
return
|
|
642
|
+
const e = r`<img src=${a.promoImage} alt=${a.promoAlt || "Sponsor"}>`;
|
|
643
|
+
return r`<div class="promo">${a.promoHref ? r`<a href=${a.promoHref} target="_blank" rel="sponsored noopener">${e}</a>` : e}</div>`;
|
|
636
644
|
}
|
|
637
645
|
function R(a) {
|
|
638
646
|
const e = te(a);
|
|
639
|
-
return
|
|
647
|
+
return r`<span class="pill ${e.kind}">${e.label}</span>`;
|
|
640
648
|
}
|
|
641
|
-
function
|
|
642
|
-
if (!e) return
|
|
643
|
-
const s = e.homeTeamId === t ? e.awayTeamId : e.homeTeamId,
|
|
644
|
-
return
|
|
649
|
+
function ie(a, e, t) {
|
|
650
|
+
if (!e) return r`<span class="mut">·</span>`;
|
|
651
|
+
const s = e.homeTeamId === t ? e.awayTeamId : e.homeTeamId, o = e.homeTeamId === t ? "vs" : "at";
|
|
652
|
+
return r`${e.state === "live" ? r`<span class="pill live">Live</span> ` : r`${y(e.date, { month: "numeric", day: "numeric" })} `}${o} ${_(a, s)}`;
|
|
645
653
|
}
|
|
646
|
-
class
|
|
654
|
+
class Fe extends $ {
|
|
647
655
|
static styles = F;
|
|
648
656
|
static properties = {
|
|
649
657
|
...$.properties,
|
|
@@ -662,19 +670,19 @@ class Ce extends $ {
|
|
|
662
670
|
this._datePinned = !!this.date;
|
|
663
671
|
}
|
|
664
672
|
async fetchData(e) {
|
|
665
|
-
const t = this.season || N(), [s,
|
|
673
|
+
const t = this.season || N(), [s, o, i, d, n] = await Promise.all([
|
|
666
674
|
e.listSchools(),
|
|
667
675
|
e.listTeams({ sport: this.sport }),
|
|
668
676
|
e.listConferences(),
|
|
669
677
|
e.listGames({ sport: this.sport, season: t }),
|
|
670
678
|
e.listRankings({ sport: this.sport })
|
|
671
679
|
]);
|
|
672
|
-
return this._datePinned || (this.date =
|
|
680
|
+
return this._datePinned || (this.date = me(d.items.map((h) => h.date)), this._datePinned = !0), {
|
|
673
681
|
season: t,
|
|
674
682
|
schools: s.items,
|
|
675
|
-
teams:
|
|
676
|
-
conferences:
|
|
677
|
-
games:
|
|
683
|
+
teams: o.items,
|
|
684
|
+
conferences: i.items,
|
|
685
|
+
games: d.items,
|
|
678
686
|
rankings: n.items
|
|
679
687
|
};
|
|
680
688
|
}
|
|
@@ -689,30 +697,30 @@ class Ce extends $ {
|
|
|
689
697
|
}, this._ctxData = this.data), this._ctx;
|
|
690
698
|
}
|
|
691
699
|
renderView() {
|
|
692
|
-
const e = this.ctx, t = v(this.data.conferences), s = [...new Set(this.data.games.map((
|
|
693
|
-
const
|
|
694
|
-
return
|
|
695
|
-
},
|
|
696
|
-
|
|
700
|
+
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, i = (l) => {
|
|
701
|
+
const c = [l.awayTeamId, l.homeTeamId].map((m) => W(e.rankings, e.teamsById, m, this.sport, l.date)).filter(Boolean);
|
|
702
|
+
return c.length ? Math.min(...c) : o;
|
|
703
|
+
}, d = this.data.games.filter((l) => l.date === this.date), n = new Map(d.map((l) => [l, i(l)]));
|
|
704
|
+
d.sort((l, c) => (l.state === "live" ? 0 : 1) - (c.state === "live" ? 0 : 1) || n.get(l) - n.get(c));
|
|
697
705
|
const h = /* @__PURE__ */ new Map();
|
|
698
|
-
return
|
|
699
|
-
const
|
|
700
|
-
h.has(
|
|
701
|
-
}),
|
|
706
|
+
return d.forEach((l) => {
|
|
707
|
+
const c = l.gameType === "conference" && l.conferenceId ? t[l.conferenceId]?.name || "Conference" : l.gameType === "playoff" ? "Playoffs" : l.gameType === "scrimmage" ? "Scrimmages" : "Nonconference";
|
|
708
|
+
h.has(c) || h.set(c, []), h.get(c).push(l);
|
|
709
|
+
}), r`
|
|
702
710
|
${V(this, e, {
|
|
703
|
-
title:
|
|
704
|
-
sub:
|
|
711
|
+
title: r`${I(this.sport)} scores & schedules`,
|
|
712
|
+
sub: r`${y(this.date, { weekday: "long", month: "long", day: "numeric", year: "numeric" })} · ${d.length} games`,
|
|
705
713
|
teams: this.data.teams
|
|
706
714
|
})}
|
|
707
|
-
${B(this,
|
|
715
|
+
${B(this, r`
|
|
708
716
|
${P(this)}
|
|
709
717
|
<div class="toolbar">
|
|
710
718
|
<label class="asof" for="datesel">Date</label>
|
|
711
|
-
<select id="datesel" @change=${(
|
|
712
|
-
this.date =
|
|
719
|
+
<select id="datesel" @change=${(l) => {
|
|
720
|
+
this.date = l.target.value;
|
|
713
721
|
}}>
|
|
714
|
-
${(s.includes(this.date) ? s : [...s, this.date].sort()).map((
|
|
715
|
-
${y(
|
|
722
|
+
${(s.includes(this.date) ? s : [...s, this.date].sort()).map((l) => r`<option value=${l} ?selected=${l === this.date}>
|
|
723
|
+
${y(l, { weekday: "short", month: "short", day: "numeric" })}${l === M() ? " · today" : ""}
|
|
716
724
|
</option>`)}
|
|
717
725
|
</select>
|
|
718
726
|
<button class="chip" ?disabled=${s.indexOf(this.date) <= 0}
|
|
@@ -726,11 +734,11 @@ class Ce extends $ {
|
|
|
726
734
|
<span class="spacer"></span>
|
|
727
735
|
<span class="asof">Live games first · report a score to see it update here</span>
|
|
728
736
|
</div>
|
|
729
|
-
${
|
|
730
|
-
${[...h.entries()].map(([
|
|
731
|
-
<div class="section-title">${
|
|
737
|
+
${d.length ? p : r`<p class="empty">No ${this.sport} games on this date.</p>`}
|
|
738
|
+
${[...h.entries()].map(([l, c]) => r`
|
|
739
|
+
<div class="section-title">${l}</div>
|
|
732
740
|
<div class="card"><ul class="gamelist">
|
|
733
|
-
${
|
|
741
|
+
${c.map((m) => this.renderGame(e, m))}
|
|
734
742
|
</ul></div>
|
|
735
743
|
`)}
|
|
736
744
|
`)}
|
|
@@ -740,21 +748,21 @@ class Ce extends $ {
|
|
|
740
748
|
// a lone score column on the far right read as detached from the teams).
|
|
741
749
|
// Scheduled games carry their start time on the status pill alone.
|
|
742
750
|
renderGame(e, t) {
|
|
743
|
-
const s = t.state === "final" || t.state === "live",
|
|
744
|
-
return
|
|
751
|
+
const s = t.state === "final" || t.state === "live", o = (d, n, h = p) => r`<span class="side">${re(e, d, t.date)}${s ? r`<span class="score">${n}</span>` : p}${h}</span>`, i = Ie(t);
|
|
752
|
+
return r`
|
|
745
753
|
<li>
|
|
746
754
|
${R(t)}
|
|
747
|
-
<span class="opp matchup">${
|
|
748
|
-
${
|
|
755
|
+
<span class="opp matchup">${o(t.awayTeamId, t.awayScore, r`<span class="at">at</span>`)}${o(t.homeTeamId, t.homeScore)}</span>
|
|
756
|
+
${i ? r`<span class="ff">${T(e, i === "home" ? t.homeTeamId : t.awayTeamId)} forfeited</span>` : p}
|
|
749
757
|
<span class="where">${t.venue || ""}</span>
|
|
750
|
-
${t.broadcast ?
|
|
758
|
+
${t.broadcast ? r`<span class="pill class">${t.broadcast}</span>` : p}
|
|
751
759
|
<a class="box" href=${u(e.hrefs.game, { sport: this.sport, id: t.id })}>Box score →</a>
|
|
752
760
|
</li>
|
|
753
761
|
`;
|
|
754
762
|
}
|
|
755
763
|
}
|
|
756
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores",
|
|
757
|
-
class
|
|
764
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores", Fe);
|
|
765
|
+
class ze extends $ {
|
|
758
766
|
static styles = F;
|
|
759
767
|
static properties = {
|
|
760
768
|
...$.properties,
|
|
@@ -767,7 +775,7 @@ class De extends $ {
|
|
|
767
775
|
super(), this.sport = "football", this.season = "", this.classFilter = "All", this.query = "";
|
|
768
776
|
}
|
|
769
777
|
async fetchData(e) {
|
|
770
|
-
const t = this.season || N(), [s,
|
|
778
|
+
const t = this.season || N(), [s, o, i, d, n] = await Promise.all([
|
|
771
779
|
e.listConferences({ active: !0 }),
|
|
772
780
|
e.listSchools(),
|
|
773
781
|
e.listTeams({ sport: this.sport }),
|
|
@@ -777,9 +785,9 @@ class De extends $ {
|
|
|
777
785
|
return {
|
|
778
786
|
season: t,
|
|
779
787
|
conferences: s.items,
|
|
780
|
-
schools:
|
|
781
|
-
teams:
|
|
782
|
-
games:
|
|
788
|
+
schools: o.items,
|
|
789
|
+
teams: i.items,
|
|
790
|
+
games: d.items,
|
|
783
791
|
rankings: n.items
|
|
784
792
|
};
|
|
785
793
|
}
|
|
@@ -794,43 +802,43 @@ class De extends $ {
|
|
|
794
802
|
}, this._ctxData = this.data), this._ctx;
|
|
795
803
|
}
|
|
796
804
|
renderView() {
|
|
797
|
-
const e = this.ctx, t = ["All", ...new Set(this.data.conferences.flatMap((
|
|
798
|
-
return
|
|
805
|
+
const e = this.ctx, t = ["All", ...new Set(this.data.conferences.flatMap((o) => o.classifications || []))].slice(0, 9), s = this.data.conferences.filter((o) => o.active !== !1).filter((o) => this.classFilter === "All" || (o.classifications || []).includes(this.classFilter));
|
|
806
|
+
return r`
|
|
799
807
|
${V(this, e, {
|
|
800
|
-
title:
|
|
801
|
-
sub:
|
|
808
|
+
title: r`${I(this.sport)} standings`,
|
|
809
|
+
sub: r`${this.data.season} season · every conference, computed live from reported results`,
|
|
802
810
|
teams: this.data.teams
|
|
803
811
|
})}
|
|
804
|
-
${B(this,
|
|
812
|
+
${B(this, r`
|
|
805
813
|
${P(this)}
|
|
806
814
|
<div class="toolbar">
|
|
807
815
|
<div role="group" aria-label="Classification filter">
|
|
808
|
-
${t.map((
|
|
816
|
+
${t.map((o) => r`<button class="chip ${this.classFilter === o ? "on" : ""}"
|
|
809
817
|
@click=${() => {
|
|
810
|
-
this.classFilter =
|
|
811
|
-
}}>${
|
|
818
|
+
this.classFilter = o;
|
|
819
|
+
}}>${o}</button>`)}
|
|
812
820
|
</div>
|
|
813
821
|
<input type="search" placeholder="Find a school…" aria-label="Find a school"
|
|
814
|
-
.value=${this.query} @input=${(
|
|
815
|
-
this.query =
|
|
822
|
+
.value=${this.query} @input=${(o) => {
|
|
823
|
+
this.query = o.target.value;
|
|
816
824
|
}}>
|
|
817
825
|
<span class="spacer"></span>
|
|
818
826
|
<span class="asof">Records through ${y(M(), { month: "long", day: "numeric" })} · conference games count toward both records · scrimmages toward neither</span>
|
|
819
827
|
</div>
|
|
820
|
-
${s.map((
|
|
828
|
+
${s.map((o) => this.renderConference(e, o))}
|
|
821
829
|
`)}
|
|
822
830
|
`;
|
|
823
831
|
}
|
|
824
832
|
renderConference(e, t) {
|
|
825
|
-
const s = this.data.teams.filter((
|
|
833
|
+
const s = this.data.teams.filter((d) => d.conferenceId === t.id);
|
|
826
834
|
if (!s.length) return p;
|
|
827
|
-
const
|
|
828
|
-
return
|
|
835
|
+
const o = this.query.trim().toLowerCase(), i = ae(s, e.records);
|
|
836
|
+
return r`
|
|
829
837
|
<div class="card">
|
|
830
838
|
<div class="card-head">
|
|
831
839
|
<h2>${t.name}</h2>
|
|
832
|
-
${(t.classifications || []).map((
|
|
833
|
-
<span class="meta">${
|
|
840
|
+
${(t.classifications || []).map((d) => r`<span class="pill class">${d}</span>`)}
|
|
841
|
+
<span class="meta">${i.length} teams · membership derives from teams</span>
|
|
834
842
|
</div>
|
|
835
843
|
<div class="tablewrap"><table class="data">
|
|
836
844
|
<thead><tr>
|
|
@@ -839,27 +847,26 @@ class De extends $ {
|
|
|
839
847
|
<th>Streak</th><th>Last 5</th><th>Next</th>
|
|
840
848
|
</tr></thead>
|
|
841
849
|
<tbody>
|
|
842
|
-
${
|
|
850
|
+
${i.map((d, n) => this.renderRow(e, d, n, o))}
|
|
843
851
|
</tbody>
|
|
844
852
|
</table></div>
|
|
845
853
|
</div>
|
|
846
854
|
`;
|
|
847
855
|
}
|
|
848
|
-
renderRow(e, t, s,
|
|
849
|
-
const
|
|
850
|
-
if (
|
|
851
|
-
const n = t.rec.pf - t.rec.pa, h = q(this.data.games, t.team.id),
|
|
852
|
-
<span class="pill champ" title="${m.season} ${m.title} champion">★ ${m.season} ${m.title}</span>`), d = () => {
|
|
856
|
+
renderRow(e, t, s, o) {
|
|
857
|
+
const i = e.schoolsById[t.team.schoolId], d = i?.name || t.team.name || "TBD";
|
|
858
|
+
if (o && !d.toLowerCase().includes(o)) return p;
|
|
859
|
+
const n = t.rec.pf - t.rec.pa, h = q(this.data.games, t.team.id), l = () => {
|
|
853
860
|
location.href = u(e.hrefs.school, { id: t.team.schoolId });
|
|
854
861
|
};
|
|
855
|
-
return
|
|
856
|
-
<tr class="rowlink" @click=${(
|
|
857
|
-
|
|
862
|
+
return r`
|
|
863
|
+
<tr class="rowlink" @click=${(c) => {
|
|
864
|
+
c.target.closest("a") || l();
|
|
858
865
|
}}>
|
|
859
866
|
<td class="mut">${s + 1}</td>
|
|
860
867
|
<td class="teamcell">
|
|
861
|
-
${C(
|
|
862
|
-
<a href=${u(e.hrefs.school, { id: t.team.schoolId })}>${
|
|
868
|
+
${C(i)}${Y(e, t.team.id, null)}
|
|
869
|
+
<a href=${u(e.hrefs.school, { id: t.team.schoolId })}>${d}</a>
|
|
863
870
|
</td>
|
|
864
871
|
<td class="num">${w(t.rec, !0)}</td>
|
|
865
872
|
<td class="num">${Z(t.confPct)}</td>
|
|
@@ -870,13 +877,13 @@ class De extends $ {
|
|
|
870
877
|
<td class="num" style="color:${n >= 0 ? "var(--hsot-win)" : "var(--hsot-loss)"}">${n > 0 ? "+" : ""}${n}</td>
|
|
871
878
|
<td>${L(t.rec.results) || "·"}</td>
|
|
872
879
|
<td>${K(e, t.team.id)}</td>
|
|
873
|
-
<td>${
|
|
880
|
+
<td>${ie(e, h, t.team.id)}</td>
|
|
874
881
|
</tr>
|
|
875
882
|
`;
|
|
876
883
|
}
|
|
877
884
|
}
|
|
878
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings",
|
|
879
|
-
const
|
|
885
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings", ze);
|
|
886
|
+
const Be = b`
|
|
880
887
|
.hero1 {
|
|
881
888
|
border-radius: var(--hsot-radius-md); color: var(--hsot-white);
|
|
882
889
|
padding: 1.3rem 1.4rem; display: flex; align-items: center; gap: 1.2rem;
|
|
@@ -893,8 +900,8 @@ const Fe = b`
|
|
|
893
900
|
.delta.new { background: var(--hsot-straw); color: #6b5900; border-radius: var(--hsot-radius-xs); padding: 0.1rem 0.3rem; font-size: 0.7rem; }
|
|
894
901
|
.sparkline { vertical-align: middle; }
|
|
895
902
|
`;
|
|
896
|
-
class
|
|
897
|
-
static styles = [...F,
|
|
903
|
+
class Pe extends $ {
|
|
904
|
+
static styles = [...F, Be];
|
|
898
905
|
static properties = {
|
|
899
906
|
...$.properties,
|
|
900
907
|
sport: { type: String },
|
|
@@ -911,19 +918,19 @@ class ze extends $ {
|
|
|
911
918
|
e && (this.pollDate = e);
|
|
912
919
|
}
|
|
913
920
|
async fetchData(e) {
|
|
914
|
-
const t = this.season || N(), [s,
|
|
921
|
+
const t = this.season || N(), [s, o, i, d, n] = await Promise.all([
|
|
915
922
|
e.listRankings({ sport: this.sport, ...this.gender ? { gender: this.gender } : {} }),
|
|
916
923
|
e.listSchools(),
|
|
917
924
|
e.listTeams({ sport: this.sport }),
|
|
918
925
|
e.listConferences(),
|
|
919
926
|
e.listGames({ sport: this.sport, season: t })
|
|
920
|
-
]), h = s.items.filter((
|
|
927
|
+
]), h = s.items.filter((l) => !this.gender || !l.gender || l.gender === this.gender).sort((l, c) => c.effectiveDate.localeCompare(l.effectiveDate));
|
|
921
928
|
return {
|
|
922
929
|
season: t,
|
|
923
930
|
polls: h,
|
|
924
|
-
schools:
|
|
925
|
-
teams:
|
|
926
|
-
conferences:
|
|
931
|
+
schools: o.items,
|
|
932
|
+
teams: i.items,
|
|
933
|
+
conferences: d.items,
|
|
927
934
|
games: n.items
|
|
928
935
|
};
|
|
929
936
|
}
|
|
@@ -944,39 +951,39 @@ class ze extends $ {
|
|
|
944
951
|
const k = t.length === 1 ? 96 / 2 : f / (t.length - 1) * 90 + 3, O = 3 + g / 24 * 20;
|
|
945
952
|
return { x: k, y: O };
|
|
946
953
|
}), h = [];
|
|
947
|
-
let
|
|
954
|
+
let l = [];
|
|
948
955
|
if (n.forEach((m) => {
|
|
949
|
-
m ?
|
|
950
|
-
}),
|
|
951
|
-
const
|
|
952
|
-
return
|
|
956
|
+
m ? l.push(m) : l.length && (h.push(l), l = []);
|
|
957
|
+
}), l.length && h.push(l), !h.length) return p;
|
|
958
|
+
const c = n[s];
|
|
959
|
+
return r`<svg class="sparkline" width=${96} height=${26} viewBox="0 0 ${96} ${26}" role="img" aria-label="rank history">
|
|
953
960
|
${h.map((m) => Q`<polyline fill="none" stroke="var(--hsot-red)" stroke-width="2"
|
|
954
961
|
points=${m.map((f) => `${f.x.toFixed(1)},${f.y.toFixed(1)}`).join(" ")}></polyline>`)}
|
|
955
|
-
${
|
|
962
|
+
${c ? Q`<circle cx=${c.x.toFixed(1)} cy=${c.y.toFixed(1)} r="3" fill="var(--hsot-black)"></circle>` : p}
|
|
956
963
|
</svg>`;
|
|
957
964
|
}
|
|
958
965
|
movement(e, t, s) {
|
|
959
|
-
const
|
|
960
|
-
return
|
|
966
|
+
const o = Se(e, t, s);
|
|
967
|
+
return o.kind === "up" ? r`<span class="delta up">▲ ${o.delta}</span>` : o.kind === "down" ? r`<span class="delta down">▼ ${o.delta}</span>` : o.kind === "new" ? r`<span class="delta new">NEW</span>` : o.kind === "same" ? r`<span class="delta same">—</span>` : r`<span class="delta same">·</span>`;
|
|
961
968
|
}
|
|
962
969
|
renderView() {
|
|
963
970
|
const e = this.ctx, t = this.data.polls;
|
|
964
|
-
if (!t.length) return
|
|
965
|
-
const s = Math.max(0, t.findIndex((m) => m.effectiveDate === this.pollDate)),
|
|
966
|
-
return
|
|
971
|
+
if (!t.length) return r`<div class="view"><p class="empty">No ${this.sport} polls published yet this season.</p></div>`;
|
|
972
|
+
const s = Math.max(0, t.findIndex((m) => m.effectiveDate === this.pollDate)), o = t[s] || t[0], i = t[s + 1] || null, d = t.slice().reverse(), n = d.indexOf(o), h = v(this.data.conferences), l = (o.teamIds || [])[0], c = l ? S(e, l) : null;
|
|
973
|
+
return r`
|
|
967
974
|
${V(this, e, {
|
|
968
|
-
title:
|
|
969
|
-
sub:
|
|
975
|
+
title: r`${I(this.sport)} Top 25`,
|
|
976
|
+
sub: r`The HighSchoolOT poll · updated weekly · ${t.length} polls this season`,
|
|
970
977
|
teams: this.data.teams
|
|
971
978
|
})}
|
|
972
|
-
${B(this,
|
|
979
|
+
${B(this, r`
|
|
973
980
|
${P(this)}
|
|
974
981
|
<div class="toolbar">
|
|
975
982
|
<label class="asof" for="pollsel">Poll of</label>
|
|
976
983
|
<select id="pollsel" @change=${(m) => {
|
|
977
984
|
this.pollDate = m.target.value;
|
|
978
985
|
}}>
|
|
979
|
-
${t.map((m, f) =>
|
|
986
|
+
${t.map((m, f) => r`<option value=${m.effectiveDate} ?selected=${m === o}>
|
|
980
987
|
${y(m.effectiveDate, { month: "long", day: "numeric", year: "numeric" })}${f === 0 ? " · current" : ""}
|
|
981
988
|
</option>`)}
|
|
982
989
|
</select>
|
|
@@ -991,65 +998,65 @@ class ze extends $ {
|
|
|
991
998
|
<span class="spacer"></span>
|
|
992
999
|
<span class="asof">Movement vs. the previous poll · sparkline = season rank history</span>
|
|
993
1000
|
</div>
|
|
994
|
-
${
|
|
1001
|
+
${c ? this.renderHero(e, o, i, l, c, h) : p}
|
|
995
1002
|
<div class="card"><div class="tablewrap"><table class="data">
|
|
996
1003
|
<thead><tr>
|
|
997
1004
|
<th class="num">Rk</th><th>Mvmt</th><th>Team</th><th class="num">Record</th>
|
|
998
1005
|
<th>Conference</th><th>Last result</th><th>Next</th><th>Season</th>
|
|
999
1006
|
</tr></thead>
|
|
1000
1007
|
<tbody>
|
|
1001
|
-
${(
|
|
1008
|
+
${(o.teamIds || []).map((m, f) => f === 0 || !m ? p : this.renderRow(e, o, i, d, n, h, m, f + 1))}
|
|
1002
1009
|
</tbody>
|
|
1003
1010
|
</table></div></div>
|
|
1004
1011
|
<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>
|
|
1005
1012
|
`)}
|
|
1006
1013
|
`;
|
|
1007
1014
|
}
|
|
1008
|
-
renderHero(e, t, s,
|
|
1009
|
-
const n = e.records[
|
|
1010
|
-
return
|
|
1011
|
-
<div class="hero1" style="background:${
|
|
1015
|
+
renderHero(e, t, s, o, i, d) {
|
|
1016
|
+
const n = e.records[o], h = J(e.records, o), l = d[e.teamsById[o]?.conferenceId], c = `linear-gradient(120deg, ${i.colorPrimary || "#030711"} 0%, var(--hsot-black) 85%)`;
|
|
1017
|
+
return r`
|
|
1018
|
+
<div class="hero1" style="background:${c}">
|
|
1012
1019
|
<div class="bigrank">#1</div>
|
|
1013
|
-
${C(
|
|
1020
|
+
${C(i, 64)}
|
|
1014
1021
|
<div>
|
|
1015
|
-
<h2><a href=${u(e.hrefs.school, { id:
|
|
1022
|
+
<h2><a href=${u(e.hrefs.school, { id: i.id })}>${i.name} ${i.mascot || ""}</a></h2>
|
|
1016
1023
|
<div class="facts">
|
|
1017
|
-
${w(n)} overall${
|
|
1024
|
+
${w(n)} overall${l ? r` · ${w(n, !0)} ${l.name}` : p}
|
|
1018
1025
|
· streak ${L(n?.results) || "·"}
|
|
1019
|
-
${h ?
|
|
1020
|
-
${this.movement(t, s,
|
|
1026
|
+
${h ? r` · last: ${h.mark} ${h.my}-${h.their} vs ${_(e, h.opp)}` : p}
|
|
1027
|
+
${this.movement(t, s, o)}
|
|
1021
1028
|
</div>
|
|
1022
1029
|
</div>
|
|
1023
1030
|
</div>
|
|
1024
1031
|
`;
|
|
1025
1032
|
}
|
|
1026
|
-
renderRow(e, t, s,
|
|
1027
|
-
const
|
|
1028
|
-
if (!
|
|
1029
|
-
const
|
|
1030
|
-
location.href = u(e.hrefs.school, { id:
|
|
1033
|
+
renderRow(e, t, s, o, i, d, n, h) {
|
|
1034
|
+
const l = S(e, n);
|
|
1035
|
+
if (!l) return p;
|
|
1036
|
+
const c = e.records[n], m = J(e.records, n), f = q(this.data.games, n), g = d[e.teamsById[n]?.conferenceId], k = () => {
|
|
1037
|
+
location.href = u(e.hrefs.school, { id: l.id });
|
|
1031
1038
|
};
|
|
1032
|
-
return
|
|
1039
|
+
return r`
|
|
1033
1040
|
<tr class="rowlink" @click=${(O) => {
|
|
1034
1041
|
O.target.closest("a") || k();
|
|
1035
1042
|
}}>
|
|
1036
1043
|
<td class="num" style="font-weight:700">${h}</td>
|
|
1037
1044
|
<td>${this.movement(t, s, n)}</td>
|
|
1038
|
-
<td class="teamcell">${C(
|
|
1039
|
-
<span class="mut" style="font-size:0.78rem">${
|
|
1040
|
-
<td class="num">${w(
|
|
1045
|
+
<td class="teamcell">${C(l)}<a href=${u(e.hrefs.school, { id: l.id })}>${l.name}</a>
|
|
1046
|
+
<span class="mut" style="font-size:0.78rem">${l.mascot || ""}</span></td>
|
|
1047
|
+
<td class="num">${w(c)}</td>
|
|
1041
1048
|
<td class="mut">${g?.name || "Independent"}</td>
|
|
1042
|
-
<td>${m ?
|
|
1049
|
+
<td>${m ? r`<a class="box" style="text-decoration:none" href=${u(e.hrefs.game, { sport: this.sport, id: m.gameId })}>
|
|
1043
1050
|
<b style="color:${m.mark === "W" ? "var(--hsot-win)" : m.mark === "L" ? "var(--hsot-loss)" : "var(--hsot-tie)"}">${m.mark}</b>
|
|
1044
|
-
${m.my}-${m.their} vs ${
|
|
1045
|
-
<td>${
|
|
1046
|
-
<td>${this.sparkline(n,
|
|
1051
|
+
${m.my}-${m.their} vs ${_(e, m.opp)}</a>` : r`<span class="mut">·</span>`}</td>
|
|
1052
|
+
<td>${ie(e, f, n)}</td>
|
|
1053
|
+
<td>${this.sparkline(n, o, i)}</td>
|
|
1047
1054
|
</tr>
|
|
1048
1055
|
`;
|
|
1049
1056
|
}
|
|
1050
1057
|
}
|
|
1051
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings",
|
|
1052
|
-
const
|
|
1058
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings", Pe);
|
|
1059
|
+
const Ee = b`
|
|
1053
1060
|
.schoolhero { color: var(--hsot-white); padding: 1.6rem 1.25rem 1.3rem; }
|
|
1054
1061
|
.schoolhero .inner { max-width: 1366px; margin: 0 auto; display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
|
|
1055
1062
|
.schoolhero .crest {
|
|
@@ -1072,10 +1079,14 @@ const Be = b`
|
|
|
1072
1079
|
.tile .v { font-family: var(--hsot-heading-font); font-weight: 700; font-size: 1.7rem; line-height: 1.15; color: var(--hsot-black); }
|
|
1073
1080
|
.tile .s { font-size: 0.78rem; color: var(--hsot-gray-5); }
|
|
1074
1081
|
.cols { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 1.25rem; }
|
|
1082
|
+
/* The season roster photo heads the roster card, above the table. Natural
|
|
1083
|
+
height: a team photo is never cropped to a box — the card's overflow
|
|
1084
|
+
rounds its top corners. */
|
|
1085
|
+
.rosterphoto { display: block; width: 100%; height: auto; background: var(--hsot-gray-1); border-bottom: 1px solid var(--hsot-gray-2); }
|
|
1075
1086
|
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } .schoolhero h1 { font-size: 1.9rem; } }
|
|
1076
1087
|
`;
|
|
1077
|
-
class
|
|
1078
|
-
static styles = [...F,
|
|
1088
|
+
class Ae extends $ {
|
|
1089
|
+
static styles = [...F, Ee];
|
|
1079
1090
|
static properties = {
|
|
1080
1091
|
...$.properties,
|
|
1081
1092
|
schoolId: { type: String, attribute: "school-id" },
|
|
@@ -1092,26 +1103,26 @@ class Pe extends $ {
|
|
|
1092
1103
|
e && !this.sport && (this.sport = e);
|
|
1093
1104
|
}
|
|
1094
1105
|
async fetchData(e) {
|
|
1095
|
-
const t = this.season || N(), s = await e.getSchool(this.schoolId),
|
|
1096
|
-
|
|
1097
|
-
|
|
1106
|
+
const t = this.season || N(), s = await e.getSchool(this.schoolId), i = (await e.listTeams({ schoolId: this.schoolId })).items, d = i.find((k) => k.sport === (this.sport || "football")) || i[0] || null, [n, h, l, c, m, f, g] = await Promise.all([
|
|
1107
|
+
d ? e.listGames({ sport: d.sport, season: t }) : Promise.resolve({ items: [] }),
|
|
1108
|
+
d ? e.listTeams({ sport: d.sport }) : Promise.resolve({ items: [] }),
|
|
1098
1109
|
e.listSchools(),
|
|
1099
1110
|
e.listConferences(),
|
|
1100
|
-
|
|
1101
|
-
|
|
1111
|
+
d ? e.listRankings({ sport: d.sport }) : Promise.resolve({ items: [] }),
|
|
1112
|
+
d ? e.listRosters({ teamId: d.id }) : Promise.resolve({ items: [] }),
|
|
1102
1113
|
// teamId is the public surface's one players filter (roster
|
|
1103
1114
|
// membership) — never fetch the whole collection.
|
|
1104
|
-
|
|
1115
|
+
d ? e.listPlayers({ teamId: d.id }) : Promise.resolve({ items: [] })
|
|
1105
1116
|
]);
|
|
1106
1117
|
return {
|
|
1107
1118
|
season: t,
|
|
1108
1119
|
school: s,
|
|
1109
|
-
teams:
|
|
1110
|
-
active:
|
|
1120
|
+
teams: i,
|
|
1121
|
+
active: d,
|
|
1111
1122
|
games: n.items,
|
|
1112
1123
|
allTeams: h.items,
|
|
1113
|
-
schools:
|
|
1114
|
-
conferences:
|
|
1124
|
+
schools: l.items,
|
|
1125
|
+
conferences: c.items,
|
|
1115
1126
|
rankings: m.items,
|
|
1116
1127
|
roster: f.items.find((k) => k.season === t) || null,
|
|
1117
1128
|
players: g.items
|
|
@@ -1131,111 +1142,114 @@ class Pe extends $ {
|
|
|
1131
1142
|
this.sport = e, this.load();
|
|
1132
1143
|
}
|
|
1133
1144
|
renderView() {
|
|
1134
|
-
const { school: e, teams: t, active: s, season:
|
|
1135
|
-
if (!e) return
|
|
1136
|
-
const
|
|
1137
|
-
return
|
|
1138
|
-
<div class="schoolhero" style="background:linear-gradient(115deg, ${e.colorPrimary || "#030711"} 0%, ${e.colorPrimary || "#030711"} 55%, var(--hsot-black) 100%);color:${
|
|
1145
|
+
const { school: e, teams: t, active: s, season: o } = this.data;
|
|
1146
|
+
if (!e) return r`<div class="view"><p class="empty">School not found.</p></div>`;
|
|
1147
|
+
const i = this.ctx, d = E(e.colorPrimary || "#030711"), n = (e.adm || [])[0], h = v(this.data.conferences), l = s ? h[s.conferenceId] : null;
|
|
1148
|
+
return r`
|
|
1149
|
+
<div class="schoolhero" style="background:linear-gradient(115deg, ${e.colorPrimary || "#030711"} 0%, ${e.colorPrimary || "#030711"} 55%, var(--hsot-black) 100%);color:${d}">
|
|
1139
1150
|
<div class="inner">
|
|
1140
|
-
${
|
|
1151
|
+
${A(e, 84) ? r`<img class="crest logo" alt="" loading="lazy" src=${A(e, 84)} />` : r`<div class="crest" style="background:${e.colorSecondary || "#7C7C7C"};color:${E(e.colorSecondary || "#7C7C7C")}">${j(e)}</div>`}
|
|
1141
1152
|
<div style="min-width:260px">
|
|
1142
1153
|
<h1>${e.name} <span class="mascot">${e.mascot || ""}</span></h1>
|
|
1143
1154
|
<div class="facts">
|
|
1144
|
-
${e.location ?
|
|
1145
|
-
${e.association ?
|
|
1146
|
-
${
|
|
1147
|
-
${n ?
|
|
1148
|
-
${e.openingYear ?
|
|
1149
|
-
${e.areaCode ?
|
|
1155
|
+
${e.location ? r`<span><b>Location</b>${e.location}${e.county ? r` · ${e.county} County` : p}</span>` : p}
|
|
1156
|
+
${e.association ? r`<span><b>League</b>${e.association}${e.classification ? r` · ${e.classification}` : p}</span>` : p}
|
|
1157
|
+
${l ? r`<span><b>Conference</b>${l.name}</span>` : p}
|
|
1158
|
+
${n ? r`<span><b>Enrollment</b>${n.value.toLocaleString()} (${n.season} ADM)</span>` : p}
|
|
1159
|
+
${e.openingYear ? r`<span><b>Opened</b>${e.openingYear}</span>` : p}
|
|
1160
|
+
${e.areaCode ? r`<span><b>Area</b>${e.areaCode}</span>` : p}
|
|
1150
1161
|
</div>
|
|
1151
1162
|
</div>
|
|
1152
1163
|
</div>
|
|
1153
1164
|
</div>
|
|
1154
1165
|
<div class="band">
|
|
1155
1166
|
<nav class="tabs" aria-label="Teams">
|
|
1156
|
-
${t.map((
|
|
1157
|
-
m.preventDefault(), this.switchSport(
|
|
1158
|
-
}}>${
|
|
1167
|
+
${t.map((c) => c.id === s?.id ? r`<a class="on" href="#" @click=${(m) => m.preventDefault()}>${c.name}</a>` : r`<a href="#" @click=${(m) => {
|
|
1168
|
+
m.preventDefault(), this.switchSport(c.sport);
|
|
1169
|
+
}}>${c.name}</a>`)}
|
|
1159
1170
|
</nav>
|
|
1160
1171
|
</div>
|
|
1161
|
-
${B(this,
|
|
1172
|
+
${B(this, r`
|
|
1162
1173
|
${P(this)}
|
|
1163
|
-
${s ? this.renderTeam(
|
|
1174
|
+
${s ? this.renderTeam(i, s, l, o) : r`<p class="empty">No teams recorded for this school yet.</p>`}
|
|
1164
1175
|
`)}
|
|
1165
1176
|
`;
|
|
1166
1177
|
}
|
|
1167
|
-
renderTeam(e, t, s,
|
|
1168
|
-
const
|
|
1169
|
-
return
|
|
1178
|
+
renderTeam(e, t, s, o) {
|
|
1179
|
+
const i = e.records[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] }, d = i.w + i.l + i.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, 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)));
|
|
1180
|
+
return r`
|
|
1170
1181
|
<div class="tiles">
|
|
1171
|
-
<div class="tile"><div class="k">Overall</div><div class="v">${w(
|
|
1172
|
-
<div class="tile"><div class="k">${s?.name || "Conference"}</div><div class="v">${w(
|
|
1173
|
-
<div class="s">${h ? `${
|
|
1174
|
-
<div class="tile"><div class="k">Points</div><div class="v">${
|
|
1175
|
-
<div class="s">scored per game · ${
|
|
1176
|
-
<div class="tile"><div class="k">Streak</div><div class="v">${L(
|
|
1182
|
+
<div class="tile"><div class="k">Overall</div><div class="v">${w(i)}</div><div class="s">${d} games played</div></div>
|
|
1183
|
+
<div class="tile"><div class="k">${s?.name || "Conference"}</div><div class="v">${w(i, !0)}</div>
|
|
1184
|
+
<div class="s">${h ? `${pe(h)} of ${n.length}` : "·"}</div></div>
|
|
1185
|
+
<div class="tile"><div class="k">Points</div><div class="v">${d ? (i.pf / d).toFixed(1) : "0.0"}</div>
|
|
1186
|
+
<div class="s">scored per game · ${d ? (i.pa / d).toFixed(1) : "0.0"} allowed</div></div>
|
|
1187
|
+
<div class="tile"><div class="k">Streak</div><div class="v">${L(i.results) || "·"}</div>
|
|
1177
1188
|
<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">${
|
|
1189
|
+
<div class="tile"><div class="k">HSOT Top 25</div><div class="v">${l ? `#${l}` : "NR"}</div>
|
|
1179
1190
|
<div class="s"><a href=${u(e.hrefs.section, { sport: t.sport, view: "rankings" })}>full poll</a></div></div>
|
|
1180
1191
|
</div>
|
|
1181
|
-
${(t.championships || []).length ?
|
|
1192
|
+
${(t.championships || []).length ? r`
|
|
1182
1193
|
<div style="margin:-0.2rem 0 1rem;display:flex;gap:0.4rem;flex-wrap:wrap">
|
|
1183
|
-
${t.championships.map((m) =>
|
|
1194
|
+
${t.championships.map((m) => r`<span class="pill champ">★ ${m.season} ${m.title} champion${m.classification ? ` · ${m.classification}` : ""}${m.region ? ` · ${m.region}` : ""}</span>`)}
|
|
1184
1195
|
</div>` : p}
|
|
1185
1196
|
<div class="cols">
|
|
1186
1197
|
<div>
|
|
1187
1198
|
<div class="section-title">Schedule & results</div>
|
|
1188
1199
|
<div class="card">
|
|
1189
|
-
${
|
|
1200
|
+
${c.length ? r`<ul class="gamelist">${c.map((m) => this.renderGameRow(e, t, m))}</ul>` : r`<p class="empty">No ${t.sport} games recorded for ${o}.</p>`}
|
|
1190
1201
|
</div>
|
|
1191
1202
|
</div>
|
|
1192
1203
|
<div>
|
|
1193
|
-
<div class="section-title">Roster · ${
|
|
1194
|
-
<div class="card">${this.renderRoster(
|
|
1204
|
+
<div class="section-title">Roster · ${o}</div>
|
|
1205
|
+
<div class="card">${this.renderRoster(t, o)}</div>
|
|
1195
1206
|
</div>
|
|
1196
1207
|
</div>
|
|
1197
1208
|
`;
|
|
1198
1209
|
}
|
|
1199
1210
|
renderGameRow(e, t, s) {
|
|
1200
|
-
const
|
|
1201
|
-
let h =
|
|
1211
|
+
const o = s.homeTeamId === t.id, i = o ? s.awayTeamId : s.homeTeamId, d = o ? s.homeScore : s.awayScore, n = o ? s.awayScore : s.homeScore;
|
|
1212
|
+
let h = r`<span class="mut">${U(s.time)}</span>`;
|
|
1202
1213
|
if (s.state === "final") {
|
|
1203
|
-
const
|
|
1204
|
-
h =
|
|
1205
|
-
} else s.state === "live" && (h =
|
|
1206
|
-
const
|
|
1207
|
-
return
|
|
1214
|
+
const c = G(s), m = c === "tie" ? "T" : c === (o ? "home" : "away") ? "W" : "L";
|
|
1215
|
+
h = r`<span class=${m}>${m}</span> ${d}-${n}${s.finish === "overtime" ? r` <span class="mut">OT</span>` : p}${s.forfeit && s.forfeit !== "none" ? r` <span class="mut">FF</span>` : p}`;
|
|
1216
|
+
} else s.state === "live" && (h = r`<span style="color:var(--hsot-red)">${d}-${n}</span>`);
|
|
1217
|
+
const l = s.gameType === "conference" ? "Conf" : s.gameType === "nonconference" ? "Non-conf" : s.gameType === "playoff" ? `Playoff${s.label ? ` · ${s.label}` : ""}` : "Scrimmage";
|
|
1218
|
+
return r`
|
|
1208
1219
|
<li>
|
|
1209
1220
|
<span class="d">${y(s.date)}</span>
|
|
1210
1221
|
${te(s).kind === "sched" ? p : R(s)}
|
|
1211
1222
|
<span class="res">${h}</span>
|
|
1212
|
-
<span class="opp">${
|
|
1213
|
-
<span class="pill type">${
|
|
1214
|
-
${s.broadcast ?
|
|
1223
|
+
<span class="opp">${o ? "vs" : "at"} ${re(e, i, s.date)}
|
|
1224
|
+
<span class="pill type">${l}</span>
|
|
1225
|
+
${s.broadcast ? r`<span class="pill class">${s.broadcast}</span>` : p}
|
|
1215
1226
|
</span>
|
|
1216
1227
|
<span class="where">${s.venue || ""}</span>
|
|
1217
1228
|
<a class="box" href=${u(e.hrefs.game, { sport: t.sport, id: s.id })}>Box score →</a>
|
|
1218
1229
|
</li>
|
|
1219
1230
|
`;
|
|
1220
1231
|
}
|
|
1221
|
-
renderRoster(e) {
|
|
1222
|
-
const
|
|
1223
|
-
if (!
|
|
1224
|
-
return
|
|
1225
|
-
const s = v(this.data.players),
|
|
1226
|
-
return
|
|
1232
|
+
renderRoster(e, t) {
|
|
1233
|
+
const s = this.data.roster;
|
|
1234
|
+
if (!s)
|
|
1235
|
+
return r`<p class="empty">Roster not published for ${t}.</p>`;
|
|
1236
|
+
const o = De(s, 560), i = 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);
|
|
1237
|
+
return r`
|
|
1238
|
+
${o ? r`<img class="rosterphoto" src=${o} loading="lazy" decoding="async"
|
|
1239
|
+
alt="${i} ${e.name} ${t} team photo" />` : p}
|
|
1227
1240
|
<div class="tablewrap"><table class="data">
|
|
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
|
|
1241
|
+
<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 ? r`<th>College</th>` : p}</tr></thead>
|
|
1229
1242
|
<tbody>
|
|
1230
|
-
${
|
|
1231
|
-
const
|
|
1232
|
-
return
|
|
1233
|
-
<td class="num mut">${
|
|
1234
|
-
<td style="font-weight:500">${
|
|
1235
|
-
<td>${
|
|
1236
|
-
<td class="mut">${
|
|
1237
|
-
<td class="num">${
|
|
1238
|
-
<td class="num">${
|
|
1243
|
+
${n.map((l) => {
|
|
1244
|
+
const c = d[l.playerId];
|
|
1245
|
+
return c ? r`<tr>
|
|
1246
|
+
<td class="num mut">${l.number ?? "·"}</td>
|
|
1247
|
+
<td style="font-weight:500">${c.firstName} ${c.lastName}</td>
|
|
1248
|
+
<td>${l.position || "·"}</td>
|
|
1249
|
+
<td class="mut">${c.classOf || "·"}</td>
|
|
1250
|
+
<td class="num">${he(c.heightIn)}</td>
|
|
1251
|
+
<td class="num">${c.weightLb || "·"}</td>
|
|
1252
|
+
${h ? r`<td>${c.college || "·"}</td>` : p}
|
|
1239
1253
|
</tr>` : p;
|
|
1240
1254
|
})}
|
|
1241
1255
|
</tbody>
|
|
@@ -1243,16 +1257,16 @@ class Pe extends $ {
|
|
|
1243
1257
|
`;
|
|
1244
1258
|
}
|
|
1245
1259
|
}
|
|
1246
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school",
|
|
1247
|
-
const
|
|
1248
|
-
function
|
|
1260
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school", Ae);
|
|
1261
|
+
const _e = "https://api.wral.com/search";
|
|
1262
|
+
function Re(a) {
|
|
1249
1263
|
return a.map((e) => `uri:"${e}"`).join(" OR ");
|
|
1250
1264
|
}
|
|
1251
|
-
function
|
|
1252
|
-
const t = String(a ||
|
|
1265
|
+
function Ne(a, e) {
|
|
1266
|
+
const t = String(a || _e).replace(/\/+$/, ""), s = new URLSearchParams({ query: Re(e), sort: "score", lang: "en" });
|
|
1253
1267
|
return `${t}/v1/query?${s}`;
|
|
1254
1268
|
}
|
|
1255
|
-
function
|
|
1269
|
+
function ne(a) {
|
|
1256
1270
|
try {
|
|
1257
1271
|
const e = new URL(a);
|
|
1258
1272
|
if (/(^|\.)smugmug\.com$/i.test(e.hostname)) {
|
|
@@ -1267,13 +1281,13 @@ function ie(a) {
|
|
|
1267
1281
|
}
|
|
1268
1282
|
return { uri: a, title: a };
|
|
1269
1283
|
}
|
|
1270
|
-
async function
|
|
1271
|
-
const
|
|
1272
|
-
if (!
|
|
1273
|
-
const
|
|
1274
|
-
return e.map((n) =>
|
|
1284
|
+
async function Le(a, e, t) {
|
|
1285
|
+
const o = await ((...n) => fetch(...n))(Ne(a, e));
|
|
1286
|
+
if (!o.ok) throw new Error(`search answered ${o.status}`);
|
|
1287
|
+
const i = await o.json(), d = new Map((i.items || []).map((n) => [n.uri, n]));
|
|
1288
|
+
return e.map((n) => d.get(n) || ne(n));
|
|
1275
1289
|
}
|
|
1276
|
-
const
|
|
1290
|
+
const Oe = b`
|
|
1277
1291
|
.breadcrumbs { font-size: 0.8125rem; margin: 0.9rem 0 0; color: var(--hsot-gray-5); }
|
|
1278
1292
|
.breadcrumbs a { text-decoration: none; }
|
|
1279
1293
|
.scorehead { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center; padding: 1.4rem 1rem; }
|
|
@@ -1312,8 +1326,8 @@ const Ne = b`
|
|
|
1312
1326
|
.cols { grid-template-columns: 1fr; }
|
|
1313
1327
|
}
|
|
1314
1328
|
`;
|
|
1315
|
-
class
|
|
1316
|
-
static styles = [...F,
|
|
1329
|
+
class He extends $ {
|
|
1330
|
+
static styles = [...F, Oe];
|
|
1317
1331
|
static properties = {
|
|
1318
1332
|
...$.properties,
|
|
1319
1333
|
gameId: { type: String, attribute: "game-id" },
|
|
@@ -1327,7 +1341,7 @@ class Le extends $ {
|
|
|
1327
1341
|
super(), this.gameId = "", this.searchApi = "";
|
|
1328
1342
|
}
|
|
1329
1343
|
async fetchData(e) {
|
|
1330
|
-
const t = await e.getGame(this.gameId), s = Array.isArray(t.coverageUrls) ? t.coverageUrls : [], [
|
|
1344
|
+
const t = await e.getGame(this.gameId), s = Array.isArray(t.coverageUrls) ? t.coverageUrls : [], [o, i, d, n, h, l] = await Promise.all([
|
|
1331
1345
|
e.listSchools(),
|
|
1332
1346
|
e.listTeams({ sport: t.sport }),
|
|
1333
1347
|
e.listConferences(),
|
|
@@ -1335,16 +1349,16 @@ class Le extends $ {
|
|
|
1335
1349
|
e.listGames({ sport: t.sport, season: t.season }),
|
|
1336
1350
|
// A search outage must not blank the box score — degrade to bare
|
|
1337
1351
|
// links (fetchCoverage already degrades per-URL index misses).
|
|
1338
|
-
s.length ?
|
|
1352
|
+
s.length ? Le(this.searchApi, s).catch(() => s.map(ne)) : Promise.resolve([])
|
|
1339
1353
|
]);
|
|
1340
1354
|
return {
|
|
1341
1355
|
game: t,
|
|
1342
|
-
schools:
|
|
1343
|
-
teams:
|
|
1344
|
-
conferences:
|
|
1356
|
+
schools: o.items,
|
|
1357
|
+
teams: i.items,
|
|
1358
|
+
conferences: d.items,
|
|
1345
1359
|
rankings: n.items,
|
|
1346
1360
|
games: h.items,
|
|
1347
|
-
coverage:
|
|
1361
|
+
coverage: l
|
|
1348
1362
|
};
|
|
1349
1363
|
}
|
|
1350
1364
|
get ctx() {
|
|
@@ -1359,10 +1373,10 @@ class Le extends $ {
|
|
|
1359
1373
|
}
|
|
1360
1374
|
renderView() {
|
|
1361
1375
|
const e = this.data.game;
|
|
1362
|
-
if (!e) return
|
|
1363
|
-
const t = this.ctx, s = v(this.data.conferences),
|
|
1364
|
-
return
|
|
1365
|
-
${B(this,
|
|
1376
|
+
if (!e) return r`<div class="view"><p class="empty">Game not found.</p></div>`;
|
|
1377
|
+
const t = this.ctx, s = v(this.data.conferences), o = t.teamsById[e.awayTeamId] ? t.schoolsById[t.teamsById[e.awayTeamId].schoolId] : null, i = 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));
|
|
1378
|
+
return r`
|
|
1379
|
+
${B(this, r`
|
|
1366
1380
|
${P(this)}
|
|
1367
1381
|
<p class="breadcrumbs">
|
|
1368
1382
|
<a href=${u(t.hrefs.section, { sport: e.sport, view: "scores" })}>${I(e.sport)}</a> /
|
|
@@ -1371,7 +1385,7 @@ class Le extends $ {
|
|
|
1371
1385
|
</p>
|
|
1372
1386
|
<div class="card">
|
|
1373
1387
|
<div class="scorehead">
|
|
1374
|
-
${this.teamBlock(t, e, e.awayTeamId,
|
|
1388
|
+
${this.teamBlock(t, e, e.awayTeamId, o, !1)}
|
|
1375
1389
|
<div class="mid">
|
|
1376
1390
|
<div class="bigscore">
|
|
1377
1391
|
<span style=${n("away")}>${e.awayScore}</span>
|
|
@@ -1379,30 +1393,30 @@ class Le extends $ {
|
|
|
1379
1393
|
<span style=${n("home")}>${e.homeScore}</span>
|
|
1380
1394
|
</div>
|
|
1381
1395
|
<div class="status">${R(e)}</div>
|
|
1382
|
-
<div class="status">${y(e.date, { weekday: "short", month: "short", day: "numeric", year: "numeric" })}${e.state === "scheduled" && e.time ?
|
|
1383
|
-
${e.broadcast ?
|
|
1396
|
+
<div class="status">${y(e.date, { weekday: "short", month: "short", day: "numeric", year: "numeric" })}${e.state === "scheduled" && e.time ? r` · ${U(e.time)}` : p} · ${e.venue || "Venue TBD"}
|
|
1397
|
+
${e.broadcast ? r` · <span class="pill class">${e.broadcast}</span>` : p}</div>
|
|
1384
1398
|
<div class="status">
|
|
1385
1399
|
<span class="pill type">${e.gameType === "conference" ? `${h?.name || "Conference"} game` : e.gameType}</span>
|
|
1386
|
-
${e.label ?
|
|
1387
|
-
${(e.tags || []).map((
|
|
1400
|
+
${e.label ? r`<span class="pill type">Bracket ${e.label}</span>` : p}
|
|
1401
|
+
${(e.tags || []).map((c) => r`<span class="pill type">${c}</span>`)}
|
|
1388
1402
|
</div>
|
|
1389
1403
|
</div>
|
|
1390
|
-
${this.teamBlock(t, e, e.homeTeamId,
|
|
1404
|
+
${this.teamBlock(t, e, e.homeTeamId, i, !0)}
|
|
1391
1405
|
</div>
|
|
1392
|
-
${this.renderLineScore(e,
|
|
1393
|
-
${e.notes ?
|
|
1406
|
+
${this.renderLineScore(e, o, i)}
|
|
1407
|
+
${e.notes ? r`<p class="note" style="padding:0 1rem 0.9rem;text-align:center">${e.notes}</p>` : p}
|
|
1394
1408
|
</div>
|
|
1395
|
-
${(this.data.coverage || []).length ?
|
|
1409
|
+
${(this.data.coverage || []).length ? r`
|
|
1396
1410
|
<div class="section-title">Coverage</div>
|
|
1397
1411
|
<div class="covgrid">
|
|
1398
|
-
${this.data.coverage.map((
|
|
1399
|
-
<a class="card covcard" href=${
|
|
1400
|
-
${
|
|
1412
|
+
${this.data.coverage.map((c) => r`
|
|
1413
|
+
<a class="card covcard" href=${c.uri}>
|
|
1414
|
+
${c.image ? r`<img class="covimg" src=${c.image} alt="" loading="lazy" />` : p}
|
|
1401
1415
|
<div class="covbody">
|
|
1402
|
-
<div class="covtitle">${
|
|
1403
|
-
${
|
|
1404
|
-
${
|
|
1405
|
-
<div class="covmeta">${[
|
|
1416
|
+
<div class="covtitle">${c.videoDuration ? r`<span class="pill live" style="animation:none">Video</span> ` : p}${c.photos ? r`<span class="pill live" style="animation:none">Photos</span> ` : p}${c.title || c.uri}</div>
|
|
1417
|
+
${c.description ? r`<p class="covdesc">${c.description}</p>` : p}
|
|
1418
|
+
${c.author || c.publishedTime ? r`
|
|
1419
|
+
<div class="covmeta">${[c.author, c.publishedTime ? new Date(c.publishedTime).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" }) : ""].filter(Boolean).join(" · ")}</div>
|
|
1406
1420
|
` : p}
|
|
1407
1421
|
</div>
|
|
1408
1422
|
</a>
|
|
@@ -1410,50 +1424,50 @@ class Le extends $ {
|
|
|
1410
1424
|
</div>` : p}
|
|
1411
1425
|
<div class="section-title">Season context</div>
|
|
1412
1426
|
<div class="cols">
|
|
1413
|
-
${[[e.awayTeamId,
|
|
1427
|
+
${[[e.awayTeamId, o], [e.homeTeamId, i]].map(([c, m]) => this.renderContext(t, c, m))}
|
|
1414
1428
|
</div>
|
|
1415
|
-
${
|
|
1429
|
+
${l.length ? r`
|
|
1416
1430
|
<div class="section-title">Head to head this season</div>
|
|
1417
1431
|
<div class="card"><ul class="gamelist">
|
|
1418
|
-
${
|
|
1419
|
-
<span class="d">${y(
|
|
1420
|
-
<span class="opp">${T(t,
|
|
1421
|
-
<a class="box" href=${u(t.hrefs.game, { sport: e.sport, id:
|
|
1432
|
+
${l.map((c) => r`<li>
|
|
1433
|
+
<span class="d">${y(c.date)}</span>${R(c)}
|
|
1434
|
+
<span class="opp">${T(t, c.awayTeamId)} ${c.awayScore}, ${T(t, c.homeTeamId)} ${c.homeScore}</span>
|
|
1435
|
+
<a class="box" href=${u(t.hrefs.game, { sport: e.sport, id: c.id })}>Box score →</a>
|
|
1422
1436
|
</li>`)}
|
|
1423
1437
|
</ul></div>` : p}
|
|
1424
1438
|
`)}
|
|
1425
1439
|
`;
|
|
1426
1440
|
}
|
|
1427
|
-
teamBlock(e, t, s,
|
|
1428
|
-
if (!
|
|
1429
|
-
const
|
|
1430
|
-
return
|
|
1431
|
-
<div class="teamblock ${
|
|
1432
|
-
${h ?
|
|
1441
|
+
teamBlock(e, t, s, o, i) {
|
|
1442
|
+
if (!o) return r`<div class="teamblock ${i ? "right" : ""}"><div class="tname">TBD</div></div>`;
|
|
1443
|
+
const d = e.teamsById[s], n = e.records[s], h = A(o, 58);
|
|
1444
|
+
return r`
|
|
1445
|
+
<div class="teamblock ${i ? "right" : ""}">
|
|
1446
|
+
${h ? r`<img class="crest logo" alt="" loading="lazy" src=${h} />` : r`<span class="crest" style="background:${o.colorPrimary || "#030711"};color:${E(o.colorPrimary || "#030711")}">${j(o)}</span>`}
|
|
1433
1447
|
<div>
|
|
1434
|
-
<div class="tname">${Y(e, s, t.date)}<a href=${u(e.hrefs.school, { id:
|
|
1435
|
-
<div class="trec">${
|
|
1448
|
+
<div class="tname">${Y(e, s, t.date)}<a href=${u(e.hrefs.school, { id: o.id })}>${o.name}</a></div>
|
|
1449
|
+
<div class="trec">${o.mascot || ""} · ${w(n)}${d?.conferenceId ? r` · ${w(n, !0)} conf` : p}</div>
|
|
1436
1450
|
</div>
|
|
1437
1451
|
</div>
|
|
1438
1452
|
`;
|
|
1439
1453
|
}
|
|
1440
1454
|
renderLineScore(e, t, s) {
|
|
1441
|
-
const
|
|
1442
|
-
if (!
|
|
1443
|
-
return
|
|
1444
|
-
const
|
|
1445
|
-
const m =
|
|
1446
|
-
return m ? m[
|
|
1447
|
-
}, h = (
|
|
1455
|
+
const o = e.periodScores || [];
|
|
1456
|
+
if (!o.length)
|
|
1457
|
+
return r`<p class="empty" style="text-align:center">Period scoring will appear once the game starts.</p>`;
|
|
1458
|
+
const i = Math.max(4, ...o.map((l) => l.period)), d = (l) => l <= 4 ? String(l) : `OT${l > 5 ? l - 4 : ""}`, n = (l, c) => {
|
|
1459
|
+
const m = o.find((f) => f.period === c);
|
|
1460
|
+
return m ? m[l] : e.state === "final" ? 0 : "·";
|
|
1461
|
+
}, h = (l, c, m) => r`
|
|
1448
1462
|
<tr>
|
|
1449
|
-
<td class="teamcell">${C(
|
|
1450
|
-
${Array.from({ length:
|
|
1463
|
+
<td class="teamcell">${C(l, 20)}${l?.abbr || "TBD"}</td>
|
|
1464
|
+
${Array.from({ length: i }, (f, g) => r`<td class="num">${n(c, g + 1)}</td>`)}
|
|
1451
1465
|
<td class="num" style="font-weight:700">${m}</td>
|
|
1452
1466
|
</tr>`;
|
|
1453
|
-
return
|
|
1467
|
+
return r`
|
|
1454
1468
|
<div class="tablewrap" style="border-top:1px solid var(--hsot-gray-2)">
|
|
1455
1469
|
<table class="data" style="max-width:560px;margin:0.6rem auto 0.9rem">
|
|
1456
|
-
<thead><tr><th>Team</th>${Array.from({ length:
|
|
1470
|
+
<thead><tr><th>Team</th>${Array.from({ length: i }, (l, c) => r`<th class="num">${d(c + 1)}</th>`)}<th class="num">T</th></tr></thead>
|
|
1457
1471
|
<tbody>
|
|
1458
1472
|
${h(t, "away", e.awayScore)}
|
|
1459
1473
|
${h(s, "home", e.homeScore)}
|
|
@@ -1464,24 +1478,24 @@ class Le extends $ {
|
|
|
1464
1478
|
}
|
|
1465
1479
|
renderContext(e, t, s) {
|
|
1466
1480
|
if (!s) return p;
|
|
1467
|
-
const
|
|
1468
|
-
return
|
|
1481
|
+
const o = e.records[t], i = q(this.data.games, t);
|
|
1482
|
+
return r`
|
|
1469
1483
|
<div class="card ctxcard">
|
|
1470
1484
|
<div class="who">${C(s)}${s.name}</div>
|
|
1471
1485
|
<div class="row">
|
|
1472
1486
|
<span>Last 5: ${K(e, t)}</span>
|
|
1473
|
-
<span>Streak: <b>${
|
|
1474
|
-
<span>PF/PA: <b>${
|
|
1475
|
-
<span>Next: ${
|
|
1476
|
-
${
|
|
1487
|
+
<span>Streak: <b>${o ? L(o.results) : "·"}</b></span>
|
|
1488
|
+
<span>PF/PA: <b>${o ? `${o.pf} / ${o.pa}` : "·"}</b></span>
|
|
1489
|
+
<span>Next: ${i ? r`${y(i.date, { month: "numeric", day: "numeric" })}
|
|
1490
|
+
${i.homeTeamId === t ? "vs" : "at"} ${_(e, i.homeTeamId === t ? i.awayTeamId : i.homeTeamId)}` : "·"}</span>
|
|
1477
1491
|
</div>
|
|
1478
1492
|
</div>
|
|
1479
1493
|
`;
|
|
1480
1494
|
}
|
|
1481
1495
|
}
|
|
1482
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore",
|
|
1483
|
-
const
|
|
1484
|
-
class
|
|
1496
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore", He);
|
|
1497
|
+
const Ue = 250, Me = 2;
|
|
1498
|
+
class je extends ee {
|
|
1485
1499
|
static properties = {
|
|
1486
1500
|
api: { type: String },
|
|
1487
1501
|
schoolHref: { type: String, attribute: "school-href" },
|
|
@@ -1561,11 +1575,11 @@ class Ue extends ee {
|
|
|
1561
1575
|
}
|
|
1562
1576
|
onInput(e) {
|
|
1563
1577
|
const t = e.target.value.trim();
|
|
1564
|
-
if (clearTimeout(this.debounceTimer), t.length <
|
|
1578
|
+
if (clearTimeout(this.debounceTimer), t.length < Me) {
|
|
1565
1579
|
this.abortController?.abort(), this.results = [], this.open = !1, this.searched = !1;
|
|
1566
1580
|
return;
|
|
1567
1581
|
}
|
|
1568
|
-
this.debounceTimer = setTimeout(() => this.search(t),
|
|
1582
|
+
this.debounceTimer = setTimeout(() => this.search(t), Ue);
|
|
1569
1583
|
}
|
|
1570
1584
|
async search(e) {
|
|
1571
1585
|
this.abortController?.abort(), this.abortController = new AbortController();
|
|
@@ -1575,8 +1589,8 @@ class Ue extends ee {
|
|
|
1575
1589
|
});
|
|
1576
1590
|
if (!s.ok)
|
|
1577
1591
|
return;
|
|
1578
|
-
const
|
|
1579
|
-
this.results =
|
|
1592
|
+
const o = await s.json();
|
|
1593
|
+
this.results = o.items || [], this.activeIndex = -1, this.searched = !0, this.open = !0;
|
|
1580
1594
|
} catch (t) {
|
|
1581
1595
|
t.name !== "AbortError" && console.warn("school search failed", t);
|
|
1582
1596
|
}
|
|
@@ -1610,36 +1624,36 @@ class Ue extends ee {
|
|
|
1610
1624
|
return [e.location, e.county && `${e.county} County`].filter(Boolean).join(" — ");
|
|
1611
1625
|
}
|
|
1612
1626
|
renderOption(e, t) {
|
|
1613
|
-
const s = this.where(e),
|
|
1614
|
-
|
|
1627
|
+
const s = this.where(e), o = (i) => {
|
|
1628
|
+
i.preventDefault(), this.go(e);
|
|
1615
1629
|
};
|
|
1616
|
-
return
|
|
1630
|
+
return r`
|
|
1617
1631
|
<li
|
|
1618
1632
|
id="school-option-${t}"
|
|
1619
1633
|
role="option"
|
|
1620
1634
|
aria-selected="${t === this.activeIndex ? "true" : "false"}"
|
|
1621
|
-
@pointerdown="${
|
|
1635
|
+
@pointerdown="${o}"
|
|
1622
1636
|
@mousemove="${() => {
|
|
1623
1637
|
this.activeIndex = t;
|
|
1624
1638
|
}}"
|
|
1625
1639
|
>
|
|
1626
1640
|
<span class="name">${e.name}</span>
|
|
1627
|
-
${s ?
|
|
1641
|
+
${s ? r`<span class="where">${s}</span>` : p}
|
|
1628
1642
|
</li>
|
|
1629
1643
|
`;
|
|
1630
1644
|
}
|
|
1631
1645
|
renderListbox() {
|
|
1632
|
-
const e = this.searched && !this.results.length, t =
|
|
1633
|
-
return
|
|
1646
|
+
const e = this.searched && !this.results.length, t = r`<li class="empty">No schools found</li>`;
|
|
1647
|
+
return r`
|
|
1634
1648
|
<ul id="school-search-listbox" role="listbox" aria-label="Schools">
|
|
1635
|
-
${this.results.map((s,
|
|
1649
|
+
${this.results.map((s, o) => this.renderOption(s, o))}
|
|
1636
1650
|
${e ? t : p}
|
|
1637
1651
|
</ul>
|
|
1638
1652
|
`;
|
|
1639
1653
|
}
|
|
1640
1654
|
render() {
|
|
1641
1655
|
const e = this.activeIndex >= 0 ? `school-option-${this.activeIndex}` : "";
|
|
1642
|
-
return
|
|
1656
|
+
return r`
|
|
1643
1657
|
<input
|
|
1644
1658
|
type="text"
|
|
1645
1659
|
role="combobox"
|
|
@@ -1658,22 +1672,22 @@ class Ue extends ee {
|
|
|
1658
1672
|
`;
|
|
1659
1673
|
}
|
|
1660
1674
|
}
|
|
1661
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-school-search") && globalThis.customElements.define("hsot-school-search",
|
|
1675
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-school-search") && globalThis.customElements.define("hsot-school-search", je);
|
|
1662
1676
|
export {
|
|
1663
1677
|
H as D,
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1678
|
+
He as H,
|
|
1679
|
+
Pe as a,
|
|
1680
|
+
Ae as b,
|
|
1681
|
+
je as c,
|
|
1682
|
+
Fe as d,
|
|
1683
|
+
ze as e,
|
|
1670
1684
|
z as f,
|
|
1671
|
-
|
|
1685
|
+
de as g,
|
|
1672
1686
|
u as h,
|
|
1673
1687
|
G as i,
|
|
1674
|
-
|
|
1688
|
+
qe as j,
|
|
1675
1689
|
L as k,
|
|
1676
|
-
|
|
1690
|
+
Se as p,
|
|
1677
1691
|
w as r,
|
|
1678
1692
|
ae as s,
|
|
1679
1693
|
W as t
|