@wral/hsot-data 0.1.10 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import { LitElement as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
1
|
+
import { LitElement as te, html as i, css as b, nothing as p, svg as Q } from "lit";
|
|
2
|
+
const ce = 50;
|
|
3
|
+
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
7
|
return e.forEach(([s, o]) => t.set(s, String(o))), `?${t.toString()}`;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
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(/\/+$/, ""), o = t || ((...
|
|
12
|
-
async function
|
|
11
|
+
const s = a.replace(/\/+$/, ""), o = t || ((...l) => fetch(...l));
|
|
12
|
+
async function r(l) {
|
|
13
13
|
const h = { Accept: "application/json" };
|
|
14
14
|
e && (h.Authorization = `Bearer ${e}`);
|
|
15
|
-
const
|
|
16
|
-
if (!
|
|
17
|
-
const c = new Error(`api-hsot ${
|
|
18
|
-
throw c.status =
|
|
15
|
+
const n = await o(`${s}${l}`, { headers: h });
|
|
16
|
+
if (!n.ok) {
|
|
17
|
+
const c = new Error(`api-hsot ${n.status} on ${l}`);
|
|
18
|
+
throw c.status = n.status, c;
|
|
19
19
|
}
|
|
20
|
-
return
|
|
20
|
+
return n.json();
|
|
21
21
|
}
|
|
22
|
-
async function d(
|
|
23
|
-
const
|
|
22
|
+
async function d(l, h = {}) {
|
|
23
|
+
const n = [];
|
|
24
24
|
let c = null;
|
|
25
|
-
for (let m = 0; m <
|
|
26
|
-
const f =
|
|
27
|
-
if (
|
|
25
|
+
for (let m = 0; m < ce; m += 1) {
|
|
26
|
+
const f = de(c ? { ...h, cursor: c } : h), g = await r(`${l}${f}`);
|
|
27
|
+
if (n.push(...g.items || []), c = g.nextCursor || null, !c) break;
|
|
28
28
|
}
|
|
29
|
-
return { items:
|
|
29
|
+
return { items: n, total: n.length, nextCursor: null };
|
|
30
30
|
}
|
|
31
31
|
return {
|
|
32
|
-
listSchools: (
|
|
33
|
-
getSchool: (
|
|
34
|
-
listTeams: (
|
|
35
|
-
getTeam: (
|
|
36
|
-
listConferences: (
|
|
37
|
-
listPlayers: (
|
|
38
|
-
listRosters: (
|
|
39
|
-
listGames: (
|
|
40
|
-
getGame: (
|
|
41
|
-
listTournaments: (
|
|
42
|
-
listSeedings: (
|
|
43
|
-
listRankings: (
|
|
44
|
-
listSports: () =>
|
|
32
|
+
listSchools: (l) => d("/schools", l),
|
|
33
|
+
getSchool: (l) => r(`/schools/${l}`),
|
|
34
|
+
listTeams: (l) => d("/teams", l),
|
|
35
|
+
getTeam: (l) => r(`/teams/${l}`),
|
|
36
|
+
listConferences: (l) => d("/conferences", l),
|
|
37
|
+
listPlayers: (l) => d("/players", l),
|
|
38
|
+
listRosters: (l) => d("/rosters", l),
|
|
39
|
+
listGames: (l) => d("/games", l),
|
|
40
|
+
getGame: (l) => r(`/games/${l}`),
|
|
41
|
+
listTournaments: (l) => d("/tournaments", l),
|
|
42
|
+
listSeedings: (l, h) => d(`/tournaments/${l}/seedings`, h),
|
|
43
|
+
listRankings: (l) => d("/rankings", l),
|
|
44
|
+
listSports: () => r("/sports")
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
const H = {
|
|
@@ -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 me(a) {
|
|
76
76
|
return a ? `${Math.floor(a / 12)}-${a % 12}` : "·";
|
|
77
77
|
}
|
|
78
78
|
function N(a = /* @__PURE__ */ new Date()) {
|
|
@@ -83,7 +83,7 @@ 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 pe(a, e = M()) {
|
|
87
87
|
const t = [...new Set((a || []).filter(Boolean))].sort();
|
|
88
88
|
if (!t.length || t.includes(e)) return e;
|
|
89
89
|
const s = t.filter((o) => o < e);
|
|
@@ -97,11 +97,22 @@ function E(a) {
|
|
|
97
97
|
const e = parseInt(a.slice(1), 16), t = e >> 16 & 255, s = e >> 8 & 255, o = e & 255;
|
|
98
98
|
return 0.299 * t + 0.587 * s + 0.114 * o > 150 ? "#0F1B33" : "#FFFFFF";
|
|
99
99
|
}
|
|
100
|
-
const
|
|
100
|
+
const fe = (a) => {
|
|
101
101
|
const e = ["th", "st", "nd", "rd"], t = a % 100;
|
|
102
102
|
return a + (e[(t - 20) % 10] || e[t] || e[0]);
|
|
103
103
|
};
|
|
104
|
-
function
|
|
104
|
+
function X(a, e) {
|
|
105
|
+
const t = (r) => {
|
|
106
|
+
const d = /^\d+/.exec(String(r ?? ""));
|
|
107
|
+
return d ? Number(d[0]) : null;
|
|
108
|
+
}, s = t(a), o = t(e);
|
|
109
|
+
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
|
+
}
|
|
111
|
+
function ue(a, e) {
|
|
112
|
+
const t = (s) => String(s?.name ?? s ?? "");
|
|
113
|
+
return t(a).localeCompare(t(e), "en", { numeric: !0, sensitivity: "base" });
|
|
114
|
+
}
|
|
115
|
+
function se(a) {
|
|
105
116
|
if (a.state === "live") return { kind: "live", label: `Live · ${a.period || ""}`.replace(/ · $/, "") };
|
|
106
117
|
if (a.state === "final") {
|
|
107
118
|
const e = [];
|
|
@@ -109,7 +120,7 @@ function te(a) {
|
|
|
109
120
|
}
|
|
110
121
|
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
122
|
}
|
|
112
|
-
const
|
|
123
|
+
const ge = /* @__PURE__ */ new Set(["game", "story", "page", "forum", "video", "gallery"]);
|
|
113
124
|
function x(a) {
|
|
114
125
|
let e = String(a || "").replace(/^[a-z][a-z0-9+.-]*:\/\/[^/#?]*/i, "");
|
|
115
126
|
const t = e.indexOf("#");
|
|
@@ -118,26 +129,26 @@ function x(a) {
|
|
|
118
129
|
let o = e.split("?")[0] + s;
|
|
119
130
|
return o = o.replace(/([^:])\/{2,}/g, "$1/").replace(/^\/{2,}/, "/"), o = o.replace(/^\/(?=#)/, ""), o.length > 1 && (o = o.replace(/\/+$/, "")), o.toLowerCase();
|
|
120
131
|
}
|
|
121
|
-
function
|
|
132
|
+
function ae() {
|
|
122
133
|
const a = globalThis.location;
|
|
123
134
|
if (!a) return "";
|
|
124
135
|
const e = (a.hash || "").startsWith("#/") ? a.hash : "";
|
|
125
136
|
return x((a.pathname || "") + e);
|
|
126
137
|
}
|
|
127
|
-
function
|
|
138
|
+
function ve(a, e, t) {
|
|
128
139
|
if (!t) return null;
|
|
129
140
|
const s = x(a);
|
|
130
141
|
if (!s) return null;
|
|
131
|
-
const o = x(u(e.game, { sport: t, id: "" })),
|
|
132
|
-
if (s === o || s.startsWith(`${o}/`) || s ===
|
|
142
|
+
const o = x(u(e.game, { sport: t, id: "" })), r = x(u(e.school, { id: "" }));
|
|
143
|
+
if (s === o || s.startsWith(`${o}/`) || s === r || s.startsWith(`${r}/`)) return null;
|
|
133
144
|
const d = x(u(e.section, { sport: t, view: "" }));
|
|
134
145
|
if (s === d) return "";
|
|
135
146
|
if (!s.startsWith(`${d}/`)) return null;
|
|
136
|
-
const
|
|
137
|
-
return h.length > 2 || h.some((
|
|
147
|
+
const l = s.slice(d.length + 1), h = l.split("/");
|
|
148
|
+
return h.length > 2 || h.some((n) => !/^[a-z][a-z-]*$/.test(n)) || ge.has(h[0]) ? null : l;
|
|
138
149
|
}
|
|
139
|
-
function
|
|
140
|
-
const s = (d) => u(t.section, { sport: a, view: d }).replace(/([^:])\/{2,}/g, "$1/"),
|
|
150
|
+
function be(a, e, t) {
|
|
151
|
+
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 ? [
|
|
141
152
|
{ label: "Boys Standings", href: s("boys/standings") },
|
|
142
153
|
{ label: "Girls Standings", href: s("girls/standings") }
|
|
143
154
|
] : [{ label: "Standings", href: s("standings") }];
|
|
@@ -145,16 +156,16 @@ function ge(a, e, t) {
|
|
|
145
156
|
{ label: `${I(a)} Home`, href: s("") },
|
|
146
157
|
{ label: "Scores/Schedule", href: s("scores") },
|
|
147
158
|
{ label: "Playoff Brackets", href: s("brackets") },
|
|
148
|
-
...
|
|
159
|
+
...r,
|
|
149
160
|
{ label: "Polls & Rankings", href: s("rankings") }
|
|
150
161
|
];
|
|
151
162
|
}
|
|
152
|
-
function
|
|
163
|
+
function ye(a, e = ae()) {
|
|
153
164
|
const t = x(e);
|
|
154
165
|
for (const s of a.querySelectorAll(':scope > a[slot="nav"]'))
|
|
155
166
|
t && x(s.getAttribute("href")) === t ? s.setAttribute("aria-current", "page") : s.removeAttribute("aria-current");
|
|
156
167
|
}
|
|
157
|
-
class $ extends
|
|
168
|
+
class $ extends te {
|
|
158
169
|
static properties = {
|
|
159
170
|
api: { type: String },
|
|
160
171
|
refreshInterval: { type: Number, attribute: "refresh-interval" },
|
|
@@ -173,7 +184,7 @@ class $ extends ee {
|
|
|
173
184
|
this._client = e, this.isConnected && this.load();
|
|
174
185
|
}
|
|
175
186
|
get client() {
|
|
176
|
-
return this._client ? this._client : this.api ?
|
|
187
|
+
return this._client ? this._client : this.api ? he({ baseUrl: this.api }) : null;
|
|
177
188
|
}
|
|
178
189
|
connectedCallback() {
|
|
179
190
|
super.connectedCallback(), this._setupInterval();
|
|
@@ -185,7 +196,7 @@ class $ extends ee {
|
|
|
185
196
|
this.load();
|
|
186
197
|
}
|
|
187
198
|
updated(e) {
|
|
188
|
-
e.has("api") && e.get("api") !== void 0 && e.get("api") !== this.api && this.load(), e.has("refreshInterval") && this._setupInterval(),
|
|
199
|
+
e.has("api") && e.get("api") !== void 0 && e.get("api") !== this.api && this.load(), e.has("refreshInterval") && this._setupInterval(), ye(this);
|
|
189
200
|
}
|
|
190
201
|
async load() {
|
|
191
202
|
const e = this.client;
|
|
@@ -214,13 +225,13 @@ class $ extends ee {
|
|
|
214
225
|
this._refreshId && (clearInterval(this._refreshId), this._refreshId = null);
|
|
215
226
|
}
|
|
216
227
|
render() {
|
|
217
|
-
return this.error === "not-configured" ?
|
|
228
|
+
return this.error === "not-configured" ? i`<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 ? i`<div class="error">Unable to load right now. <button class="chip" @click=${() => this.load()}>Retry</button></div>` : this.data ? this.renderView() : i`<div class="loading" role="status">Loading…</div>`;
|
|
218
229
|
}
|
|
219
230
|
renderView() {
|
|
220
|
-
return
|
|
231
|
+
return i``;
|
|
221
232
|
}
|
|
222
233
|
}
|
|
223
|
-
const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])),
|
|
234
|
+
const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), $e = b`
|
|
224
235
|
:host {
|
|
225
236
|
--hsot-red: var(--color-red, #D1232A);
|
|
226
237
|
--hsot-red-deep: var(--color-red-dark, #951C21);
|
|
@@ -258,7 +269,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), be = b`
|
|
|
258
269
|
outline-offset: 1px;
|
|
259
270
|
}
|
|
260
271
|
.mut { color: var(--hsot-gray-5); }
|
|
261
|
-
`,
|
|
272
|
+
`, we = b`
|
|
262
273
|
.band { background: var(--hsot-white); color: var(--hsot-black); }
|
|
263
274
|
.band .inner { max-width: 1366px; margin: 0 auto; padding: 1.1rem 1.25rem 0; }
|
|
264
275
|
.band h1, .band h2.bandtitle {
|
|
@@ -307,7 +318,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), be = b`
|
|
|
307
318
|
@media (max-width: 720px) {
|
|
308
319
|
.band h1, .band h2.bandtitle, .band.section h1, .band.section h2.bandtitle { font-size: 1.8rem; }
|
|
309
320
|
}
|
|
310
|
-
`,
|
|
321
|
+
`, xe = b`
|
|
311
322
|
.view { max-width: 1366px; margin: 0 auto; padding: 1.25rem; box-sizing: border-box; }
|
|
312
323
|
/* Optional right rail (slot="rail" light-DOM children): a divided 300px
|
|
313
324
|
column on desktop, stacked under the view content on smaller screens. */
|
|
@@ -371,7 +382,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), be = b`
|
|
|
371
382
|
.error { padding: 1.2rem 1rem; color: var(--hsot-red-deep); font-size: 0.9rem; }
|
|
372
383
|
.note { font-size: 0.8125rem; color: var(--hsot-gray-5); margin: 0.6rem 0 0; }
|
|
373
384
|
.loading { padding: 1.2rem; color: var(--hsot-gray-5); font-family: var(--hsot-heading-font); }
|
|
374
|
-
`,
|
|
385
|
+
`, ke = b`
|
|
375
386
|
.pill {
|
|
376
387
|
display: inline-block; font-family: var(--hsot-heading-font); font-weight: 700;
|
|
377
388
|
font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.04em;
|
|
@@ -386,7 +397,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), be = b`
|
|
|
386
397
|
.pill.champ { background: var(--hsot-straw); color: #6b5900; }
|
|
387
398
|
@keyframes hsot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
|
|
388
399
|
@media (prefers-reduced-motion: reduce) { .pill.live { animation: none; } }
|
|
389
|
-
`,
|
|
400
|
+
`, Te = b`
|
|
390
401
|
.tablewrap { overflow-x: auto; }
|
|
391
402
|
table.data { font-family: var(--hsot-heading-font); font-size: 14px; border-collapse: collapse; width: 100%; }
|
|
392
403
|
table.data th {
|
|
@@ -404,7 +415,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), be = b`
|
|
|
404
415
|
table.data tbody tr.rowlink:hover { background: var(--hsot-gray-1); }
|
|
405
416
|
table.data td.teamcell a { color: inherit; text-decoration: none; font-weight: 500; }
|
|
406
417
|
table.data td.teamcell a:hover { text-decoration: underline; }
|
|
407
|
-
`,
|
|
418
|
+
`, Ie = b`
|
|
408
419
|
.swatch {
|
|
409
420
|
display: inline-flex; align-items: center; justify-content: center;
|
|
410
421
|
width: 26px; height: 26px; border-radius: 50%;
|
|
@@ -428,7 +439,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), be = b`
|
|
|
428
439
|
.dot.W { background: var(--hsot-win); }
|
|
429
440
|
.dot.L { background: var(--hsot-loss); }
|
|
430
441
|
.dot.T { background: var(--hsot-tie); }
|
|
431
|
-
`,
|
|
442
|
+
`, Se = b`
|
|
432
443
|
ul.gamelist { list-style: none; margin: 0; padding: 0; }
|
|
433
444
|
.gamelist li {
|
|
434
445
|
display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 1rem;
|
|
@@ -478,24 +489,24 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), be = b`
|
|
|
478
489
|
.gamelist .ff { color: var(--hsot-gray-5); font-size: 0.78rem; font-style: italic; }
|
|
479
490
|
.gamelist .where { color: var(--hsot-gray-5); font-size: 0.78rem; }
|
|
480
491
|
.gamelist a.box { font-size: 0.78rem; }
|
|
481
|
-
`, F = [
|
|
492
|
+
`, F = [$e, we, xe, ke, Te, Ie, Se];
|
|
482
493
|
function G(a) {
|
|
483
494
|
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
495
|
}
|
|
485
|
-
function
|
|
496
|
+
function Ce(a) {
|
|
486
497
|
return a && (a.forfeit === "home" || a.forfeit === "away") ? a.forfeit : null;
|
|
487
498
|
}
|
|
488
499
|
function z(a, e) {
|
|
489
|
-
const t = {}, s = (
|
|
490
|
-
for (const
|
|
491
|
-
const d = G(
|
|
500
|
+
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)));
|
|
501
|
+
for (const r of o) {
|
|
502
|
+
const d = G(r), l = r.gameType === "conference";
|
|
492
503
|
for (const h of ["home", "away"]) {
|
|
493
|
-
const
|
|
494
|
-
if (!
|
|
495
|
-
const c = s(
|
|
504
|
+
const n = h === "home" ? r.homeTeamId : r.awayTeamId;
|
|
505
|
+
if (!n) continue;
|
|
506
|
+
const c = s(n), m = h === "home" ? r.homeScore : r.awayScore, f = h === "home" ? r.awayScore : r.homeScore;
|
|
496
507
|
c.pf += m, c.pa += f;
|
|
497
508
|
let g = "T";
|
|
498
|
-
d === "tie" ? (c.t += 1,
|
|
509
|
+
d === "tie" ? (c.t += 1, l && (c.ct += 1)) : d === h ? (c.w += 1, l && (c.cw += 1), g = "W") : (c.l += 1, l && (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: l });
|
|
499
510
|
}
|
|
500
511
|
}
|
|
501
512
|
return t;
|
|
@@ -507,65 +518,65 @@ function L(a) {
|
|
|
507
518
|
for (let s = a.length - 1; s >= 0 && a[s].mark === e; s -= 1) t += 1;
|
|
508
519
|
return e + t;
|
|
509
520
|
}
|
|
510
|
-
const
|
|
521
|
+
const Z = (a, e, t) => {
|
|
511
522
|
const s = a + e + t;
|
|
512
523
|
return s ? (a + t / 2) / s : 0;
|
|
513
|
-
},
|
|
524
|
+
}, J = (a) => a.toFixed(3).replace("0.", ".");
|
|
514
525
|
function w(a, e = !1) {
|
|
515
526
|
if (!a) return "0-0";
|
|
516
527
|
const t = e ? a.cw : a.w, s = e ? a.cl : a.l, o = e ? a.ct : a.t;
|
|
517
528
|
return `${t}-${s}${o ? `-${o}` : ""}`;
|
|
518
529
|
}
|
|
519
|
-
function
|
|
530
|
+
function oe(a, e) {
|
|
520
531
|
return a.map((t) => {
|
|
521
532
|
const s = e[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] };
|
|
522
|
-
return { team: t, rec: s, confPct:
|
|
533
|
+
return { team: t, rec: s, confPct: Z(s.cw, s.cl, s.ct), overallPct: Z(s.w, s.l, s.t) };
|
|
523
534
|
}).sort((t, s) => s.confPct - t.confPct || s.overallPct - t.overallPct || s.rec.pf - s.rec.pa - (t.rec.pf - t.rec.pa));
|
|
524
535
|
}
|
|
525
536
|
function q(a, e) {
|
|
526
537
|
return a.filter((t) => (t.homeTeamId === e || t.awayTeamId === e) && (t.state === "scheduled" || t.state === "live") && t.gameType !== "scrimmage").sort((t, s) => String(t.date).localeCompare(String(s.date)))[0] || null;
|
|
527
538
|
}
|
|
528
|
-
function
|
|
539
|
+
function ee(a, e) {
|
|
529
540
|
const t = a[e];
|
|
530
541
|
return t && t.results.length ? t.results[t.results.length - 1] : null;
|
|
531
542
|
}
|
|
532
|
-
function
|
|
543
|
+
function Ve(a, e, t, s = "") {
|
|
533
544
|
let o = null;
|
|
534
|
-
for (const
|
|
535
|
-
|
|
545
|
+
for (const r of a || [])
|
|
546
|
+
r.sport === e && (t && r.effectiveDate > t || s && r.gender && r.gender !== s || (!o || r.effectiveDate > o.effectiveDate) && (o = r));
|
|
536
547
|
return o;
|
|
537
548
|
}
|
|
538
549
|
function W(a, e, t, s, o) {
|
|
539
|
-
const
|
|
540
|
-
if (!
|
|
550
|
+
const r = e[t];
|
|
551
|
+
if (!r) return null;
|
|
541
552
|
const d = /* @__PURE__ */ new Map();
|
|
542
553
|
for (const h of a || []) {
|
|
543
|
-
if (h.sport !== s || o && h.effectiveDate > o || h.gender &&
|
|
544
|
-
const
|
|
545
|
-
(!c || h.effectiveDate > c.effectiveDate) && d.set(
|
|
554
|
+
if (h.sport !== s || o && h.effectiveDate > o || h.gender && r.gender !== h.gender && r.gender !== "coed") continue;
|
|
555
|
+
const n = h.gender || "", c = d.get(n);
|
|
556
|
+
(!c || h.effectiveDate > c.effectiveDate) && d.set(n, h);
|
|
546
557
|
}
|
|
547
|
-
let
|
|
558
|
+
let l = null;
|
|
548
559
|
for (const h of d.values()) {
|
|
549
|
-
const
|
|
550
|
-
|
|
560
|
+
const n = (h.teamIds || []).indexOf(t);
|
|
561
|
+
n !== -1 && (!l || h.effectiveDate > l.effectiveDate) && (l = { poll: h, rank: n + 1 });
|
|
551
562
|
}
|
|
552
|
-
return
|
|
563
|
+
return l ? l.rank : null;
|
|
553
564
|
}
|
|
554
|
-
function
|
|
565
|
+
function De(a, e, t) {
|
|
555
566
|
if (!a) return { kind: "none", delta: 0 };
|
|
556
567
|
const s = (a.teamIds || []).indexOf(t) + 1;
|
|
557
568
|
if (!s) return { kind: "none", delta: 0 };
|
|
558
569
|
if (!e) return { kind: "same", delta: 0 };
|
|
559
570
|
const o = (e.teamIds || []).indexOf(t) + 1;
|
|
560
571
|
if (!o) return { kind: "new", delta: 0 };
|
|
561
|
-
const
|
|
562
|
-
return
|
|
572
|
+
const r = o - s;
|
|
573
|
+
return r > 0 ? { kind: "up", delta: r } : r < 0 ? { kind: "down", delta: -r } : { kind: "same", delta: 0 };
|
|
563
574
|
}
|
|
564
|
-
function
|
|
575
|
+
function Fe(a) {
|
|
565
576
|
return /^https?:\/\//i.test(String(a || ""));
|
|
566
577
|
}
|
|
567
|
-
function
|
|
568
|
-
if (!
|
|
578
|
+
function re(a, { w: e, h: t } = {}) {
|
|
579
|
+
if (!Fe(a)) return "";
|
|
569
580
|
const s = [];
|
|
570
581
|
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
582
|
const o = a.includes("?") ? "&" : "?";
|
|
@@ -573,25 +584,25 @@ function oe(a, { w: e, h: t } = {}) {
|
|
|
573
584
|
}
|
|
574
585
|
function A(a, e) {
|
|
575
586
|
const t = e * 2;
|
|
576
|
-
return
|
|
587
|
+
return re(a?.logoAssetId, { w: t, h: t });
|
|
577
588
|
}
|
|
578
|
-
function
|
|
579
|
-
return
|
|
589
|
+
function ze(a, e) {
|
|
590
|
+
return re(a?.photoAssetId, { w: e * 2 });
|
|
580
591
|
}
|
|
581
592
|
function V(a, e, { title: t, sub: s, teams: o }) {
|
|
582
|
-
const
|
|
583
|
-
return
|
|
593
|
+
const r = ae(), l = !!a.querySelector(':scope > a[slot="nav"]') || ve(r, e.hrefs, e.sport) !== null;
|
|
594
|
+
return i`
|
|
584
595
|
<div class="band section">
|
|
585
596
|
<div class="inner">
|
|
586
597
|
<h1>${t}</h1>
|
|
587
|
-
${s ?
|
|
598
|
+
${s ? i`<p class="sub">${s}</p>` : p}
|
|
588
599
|
</div>
|
|
589
|
-
${
|
|
600
|
+
${l ? i`
|
|
590
601
|
<nav class="sectionnav" aria-label="${I(e.sport)} section">
|
|
591
602
|
<div class="navrow">
|
|
592
603
|
<slot name="nav">
|
|
593
|
-
${
|
|
594
|
-
aria-current=${
|
|
604
|
+
${be(e.sport, o, e.hrefs).map((h) => i`<a href=${h.href}
|
|
605
|
+
aria-current=${r && x(h.href) === r ? "page" : p}>${h.label}</a>`)}
|
|
595
606
|
</slot>
|
|
596
607
|
</div>
|
|
597
608
|
</nav>` : p}
|
|
@@ -606,52 +617,52 @@ function C(a, e = 26) {
|
|
|
606
617
|
if (!a) return p;
|
|
607
618
|
const t = A(a, e);
|
|
608
619
|
if (t)
|
|
609
|
-
return
|
|
620
|
+
return i`<img class="swatch logo" aria-hidden="true" alt="" loading="lazy"
|
|
610
621
|
src=${t} style="width:${e}px;height:${e}px" />`;
|
|
611
622
|
const s = a.colorPrimary || "#030711", o = E(s);
|
|
612
|
-
return
|
|
623
|
+
return i`<span class="swatch" aria-hidden="true"
|
|
613
624
|
style="width:${e}px;height:${e}px;background:${s};color:${o};font-size:${Math.max(8, e * 0.28)}px"
|
|
614
625
|
>${j(a)}</span>`;
|
|
615
626
|
}
|
|
616
627
|
function Y(a, e, t) {
|
|
617
628
|
const s = W(a.rankings, a.teamsById, e, a.sport, t);
|
|
618
|
-
return s ?
|
|
629
|
+
return s ? i`<span class="rankbadge">#${s}</span>` : p;
|
|
619
630
|
}
|
|
620
|
-
function
|
|
631
|
+
function ie(a, e, t) {
|
|
621
632
|
const s = S(a, e);
|
|
622
|
-
return s ?
|
|
633
|
+
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>`;
|
|
623
634
|
}
|
|
624
635
|
function K(a, e, t = 5) {
|
|
625
636
|
const s = a.records[e];
|
|
626
|
-
if (!s || !s.results.length) return
|
|
637
|
+
if (!s || !s.results.length) return i`<span class="mut">·</span>`;
|
|
627
638
|
const o = s.results.slice(-1 * t);
|
|
628
|
-
return
|
|
629
|
-
${o.map((
|
|
630
|
-
title="${
|
|
631
|
-
href=${u(a.hrefs.game, { sport: a.sport, id:
|
|
639
|
+
return i`<span class="dots" role="img" aria-label="last ${o.length} results">
|
|
640
|
+
${o.map((r) => i`<a class="dot ${r.mark}"
|
|
641
|
+
title="${r.mark} ${r.my}-${r.their} vs ${T(a, r.opp)}"
|
|
642
|
+
href=${u(a.hrefs.game, { sport: a.sport, id: r.gameId })}>${r.mark}</a>`)}
|
|
632
643
|
</span>`;
|
|
633
644
|
}
|
|
634
645
|
function B(a, e) {
|
|
635
|
-
return a.querySelector(':scope > [slot="rail"]') ?
|
|
646
|
+
return a.querySelector(':scope > [slot="rail"]') ? i`<div class="view withrail">
|
|
636
647
|
<div class="viewmain">${e}</div>
|
|
637
648
|
<aside class="viewrail"><slot name="rail"></slot></aside>
|
|
638
|
-
</div>` :
|
|
649
|
+
</div>` : i`<div class="view">${e}</div>`;
|
|
639
650
|
}
|
|
640
651
|
function P(a) {
|
|
641
652
|
if (!a.promoImage) return p;
|
|
642
|
-
const e =
|
|
643
|
-
return
|
|
653
|
+
const e = i`<img src=${a.promoImage} alt=${a.promoAlt || "Sponsor"}>`;
|
|
654
|
+
return i`<div class="promo">${a.promoHref ? i`<a href=${a.promoHref} target="_blank" rel="sponsored noopener">${e}</a>` : e}</div>`;
|
|
644
655
|
}
|
|
645
656
|
function R(a) {
|
|
646
|
-
const e =
|
|
647
|
-
return
|
|
657
|
+
const e = se(a);
|
|
658
|
+
return i`<span class="pill ${e.kind}">${e.label}</span>`;
|
|
648
659
|
}
|
|
649
|
-
function
|
|
650
|
-
if (!e) return
|
|
660
|
+
function ne(a, e, t) {
|
|
661
|
+
if (!e) return i`<span class="mut">·</span>`;
|
|
651
662
|
const s = e.homeTeamId === t ? e.awayTeamId : e.homeTeamId, o = e.homeTeamId === t ? "vs" : "at";
|
|
652
|
-
return
|
|
663
|
+
return i`${e.state === "live" ? i`<span class="pill live">Live</span> ` : i`${y(e.date, { month: "numeric", day: "numeric" })} `}${o} ${_(a, s)}`;
|
|
653
664
|
}
|
|
654
|
-
class
|
|
665
|
+
class Be extends $ {
|
|
655
666
|
static styles = F;
|
|
656
667
|
static properties = {
|
|
657
668
|
...$.properties,
|
|
@@ -670,20 +681,20 @@ class Fe extends $ {
|
|
|
670
681
|
this._datePinned = !!this.date;
|
|
671
682
|
}
|
|
672
683
|
async fetchData(e) {
|
|
673
|
-
const t = this.season || N(), [s, o,
|
|
684
|
+
const t = this.season || N(), [s, o, r, d, l] = await Promise.all([
|
|
674
685
|
e.listSchools(),
|
|
675
686
|
e.listTeams({ sport: this.sport }),
|
|
676
687
|
e.listConferences(),
|
|
677
688
|
e.listGames({ sport: this.sport, season: t }),
|
|
678
689
|
e.listRankings({ sport: this.sport })
|
|
679
690
|
]);
|
|
680
|
-
return this._datePinned || (this.date =
|
|
691
|
+
return this._datePinned || (this.date = pe(d.items.map((h) => h.date)), this._datePinned = !0), {
|
|
681
692
|
season: t,
|
|
682
693
|
schools: s.items,
|
|
683
694
|
teams: o.items,
|
|
684
|
-
conferences:
|
|
695
|
+
conferences: r.items,
|
|
685
696
|
games: d.items,
|
|
686
|
-
rankings:
|
|
697
|
+
rankings: l.items
|
|
687
698
|
};
|
|
688
699
|
}
|
|
689
700
|
get ctx() {
|
|
@@ -697,30 +708,30 @@ class Fe extends $ {
|
|
|
697
708
|
}, this._ctxData = this.data), this._ctx;
|
|
698
709
|
}
|
|
699
710
|
renderView() {
|
|
700
|
-
const e = this.ctx, t = v(this.data.conferences), s = [...new Set(this.data.games.map((
|
|
701
|
-
const c = [
|
|
711
|
+
const e = this.ctx, t = v(this.data.conferences), s = [...new Set(this.data.games.map((n) => n.date).filter(Boolean))].sort(), o = Number.MAX_SAFE_INTEGER, r = (n) => {
|
|
712
|
+
const c = [n.awayTeamId, n.homeTeamId].map((m) => W(e.rankings, e.teamsById, m, this.sport, n.date)).filter(Boolean);
|
|
702
713
|
return c.length ? Math.min(...c) : o;
|
|
703
|
-
}, d = this.data.games.filter((
|
|
704
|
-
d.sort((
|
|
714
|
+
}, d = this.data.games.filter((n) => n.date === this.date), l = new Map(d.map((n) => [n, r(n)]));
|
|
715
|
+
d.sort((n, c) => (n.state === "live" ? 0 : 1) - (c.state === "live" ? 0 : 1) || l.get(n) - l.get(c));
|
|
705
716
|
const h = /* @__PURE__ */ new Map();
|
|
706
|
-
return d.forEach((
|
|
707
|
-
const c =
|
|
708
|
-
h.has(c) || h.set(c, []), h.get(c).push(
|
|
709
|
-
}),
|
|
717
|
+
return d.forEach((n) => {
|
|
718
|
+
const c = n.gameType === "conference" && n.conferenceId ? t[n.conferenceId]?.name || "Conference" : n.gameType === "playoff" ? "Playoffs" : n.gameType === "scrimmage" ? "Scrimmages" : "Nonconference";
|
|
719
|
+
h.has(c) || h.set(c, []), h.get(c).push(n);
|
|
720
|
+
}), i`
|
|
710
721
|
${V(this, e, {
|
|
711
|
-
title:
|
|
712
|
-
sub:
|
|
722
|
+
title: i`${I(this.sport)} scores & schedules`,
|
|
723
|
+
sub: i`${y(this.date, { weekday: "long", month: "long", day: "numeric", year: "numeric" })} · ${d.length} games`,
|
|
713
724
|
teams: this.data.teams
|
|
714
725
|
})}
|
|
715
|
-
${B(this,
|
|
726
|
+
${B(this, i`
|
|
716
727
|
${P(this)}
|
|
717
728
|
<div class="toolbar">
|
|
718
729
|
<label class="asof" for="datesel">Date</label>
|
|
719
|
-
<select id="datesel" @change=${(
|
|
720
|
-
this.date =
|
|
730
|
+
<select id="datesel" @change=${(n) => {
|
|
731
|
+
this.date = n.target.value;
|
|
721
732
|
}}>
|
|
722
|
-
${(s.includes(this.date) ? s : [...s, this.date].sort()).map((
|
|
723
|
-
${y(
|
|
733
|
+
${(s.includes(this.date) ? s : [...s, this.date].sort()).map((n) => i`<option value=${n} ?selected=${n === this.date}>
|
|
734
|
+
${y(n, { weekday: "short", month: "short", day: "numeric" })}${n === M() ? " · today" : ""}
|
|
724
735
|
</option>`)}
|
|
725
736
|
</select>
|
|
726
737
|
<button class="chip" ?disabled=${s.indexOf(this.date) <= 0}
|
|
@@ -734,9 +745,9 @@ class Fe extends $ {
|
|
|
734
745
|
<span class="spacer"></span>
|
|
735
746
|
<span class="asof">Live games first · report a score to see it update here</span>
|
|
736
747
|
</div>
|
|
737
|
-
${d.length ? p :
|
|
738
|
-
${[...h.entries()].map(([
|
|
739
|
-
<div class="section-title">${
|
|
748
|
+
${d.length ? p : i`<p class="empty">No ${this.sport} games on this date.</p>`}
|
|
749
|
+
${[...h.entries()].map(([n, c]) => i`
|
|
750
|
+
<div class="section-title">${n}</div>
|
|
740
751
|
<div class="card"><ul class="gamelist">
|
|
741
752
|
${c.map((m) => this.renderGame(e, m))}
|
|
742
753
|
</ul></div>
|
|
@@ -748,21 +759,21 @@ class Fe extends $ {
|
|
|
748
759
|
// a lone score column on the far right read as detached from the teams).
|
|
749
760
|
// Scheduled games carry their start time on the status pill alone.
|
|
750
761
|
renderGame(e, t) {
|
|
751
|
-
const s = t.state === "final" || t.state === "live", o = (d,
|
|
752
|
-
return
|
|
762
|
+
const s = t.state === "final" || t.state === "live", o = (d, l, h = p) => i`<span class="side">${ie(e, d, t.date)}${s ? i`<span class="score">${l}</span>` : p}${h}</span>`, r = Ce(t);
|
|
763
|
+
return i`
|
|
753
764
|
<li>
|
|
754
765
|
${R(t)}
|
|
755
|
-
<span class="opp matchup">${o(t.awayTeamId, t.awayScore,
|
|
756
|
-
${
|
|
766
|
+
<span class="opp matchup">${o(t.awayTeamId, t.awayScore, i`<span class="at">at</span>`)}${o(t.homeTeamId, t.homeScore)}</span>
|
|
767
|
+
${r ? i`<span class="ff">${T(e, r === "home" ? t.homeTeamId : t.awayTeamId)} forfeited</span>` : p}
|
|
757
768
|
<span class="where">${t.venue || ""}</span>
|
|
758
|
-
${t.broadcast ?
|
|
769
|
+
${t.broadcast ? i`<span class="pill class">${t.broadcast}</span>` : p}
|
|
759
770
|
<a class="box" href=${u(e.hrefs.game, { sport: this.sport, id: t.id })}>Box score →</a>
|
|
760
771
|
</li>
|
|
761
772
|
`;
|
|
762
773
|
}
|
|
763
774
|
}
|
|
764
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores",
|
|
765
|
-
class
|
|
775
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores", Be);
|
|
776
|
+
class Pe extends $ {
|
|
766
777
|
static styles = F;
|
|
767
778
|
static properties = {
|
|
768
779
|
...$.properties,
|
|
@@ -775,7 +786,7 @@ class ze extends $ {
|
|
|
775
786
|
super(), this.sport = "football", this.season = "", this.classFilter = "All", this.query = "";
|
|
776
787
|
}
|
|
777
788
|
async fetchData(e) {
|
|
778
|
-
const t = this.season || N(), [s, o,
|
|
789
|
+
const t = this.season || N(), [s, o, r, d, l] = await Promise.all([
|
|
779
790
|
e.listConferences({ active: !0 }),
|
|
780
791
|
e.listSchools(),
|
|
781
792
|
e.listTeams({ sport: this.sport }),
|
|
@@ -786,9 +797,9 @@ class ze extends $ {
|
|
|
786
797
|
season: t,
|
|
787
798
|
conferences: s.items,
|
|
788
799
|
schools: o.items,
|
|
789
|
-
teams:
|
|
800
|
+
teams: r.items,
|
|
790
801
|
games: d.items,
|
|
791
|
-
rankings:
|
|
802
|
+
rankings: l.items
|
|
792
803
|
};
|
|
793
804
|
}
|
|
794
805
|
get ctx() {
|
|
@@ -802,18 +813,18 @@ class ze extends $ {
|
|
|
802
813
|
}, this._ctxData = this.data), this._ctx;
|
|
803
814
|
}
|
|
804
815
|
renderView() {
|
|
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
|
|
816
|
+
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(ue);
|
|
817
|
+
return i`
|
|
807
818
|
${V(this, e, {
|
|
808
|
-
title:
|
|
809
|
-
sub:
|
|
819
|
+
title: i`${I(this.sport)} standings`,
|
|
820
|
+
sub: i`${this.data.season} season · every conference, computed live from reported results`,
|
|
810
821
|
teams: this.data.teams
|
|
811
822
|
})}
|
|
812
|
-
${B(this,
|
|
823
|
+
${B(this, i`
|
|
813
824
|
${P(this)}
|
|
814
825
|
<div class="toolbar">
|
|
815
826
|
<div role="group" aria-label="Classification filter">
|
|
816
|
-
${t.map((o) =>
|
|
827
|
+
${t.map((o) => i`<button class="chip ${this.classFilter === o ? "on" : ""}"
|
|
817
828
|
@click=${() => {
|
|
818
829
|
this.classFilter = o;
|
|
819
830
|
}}>${o}</button>`)}
|
|
@@ -832,13 +843,13 @@ class ze extends $ {
|
|
|
832
843
|
renderConference(e, t) {
|
|
833
844
|
const s = this.data.teams.filter((d) => d.conferenceId === t.id);
|
|
834
845
|
if (!s.length) return p;
|
|
835
|
-
const o = this.query.trim().toLowerCase(),
|
|
836
|
-
return
|
|
846
|
+
const o = this.query.trim().toLowerCase(), r = oe(s, e.records);
|
|
847
|
+
return i`
|
|
837
848
|
<div class="card">
|
|
838
849
|
<div class="card-head">
|
|
839
850
|
<h2>${t.name}</h2>
|
|
840
|
-
${
|
|
841
|
-
<span class="meta">${
|
|
851
|
+
${[...t.classifications || []].sort(X).map((d) => i`<span class="pill class">${d}</span>`)}
|
|
852
|
+
<span class="meta">${r.length} teams · membership derives from teams</span>
|
|
842
853
|
</div>
|
|
843
854
|
<div class="tablewrap"><table class="data">
|
|
844
855
|
<thead><tr>
|
|
@@ -847,43 +858,43 @@ class ze extends $ {
|
|
|
847
858
|
<th>Streak</th><th>Last 5</th><th>Next</th>
|
|
848
859
|
</tr></thead>
|
|
849
860
|
<tbody>
|
|
850
|
-
${
|
|
861
|
+
${r.map((d, l) => this.renderRow(e, d, l, o))}
|
|
851
862
|
</tbody>
|
|
852
863
|
</table></div>
|
|
853
864
|
</div>
|
|
854
865
|
`;
|
|
855
866
|
}
|
|
856
867
|
renderRow(e, t, s, o) {
|
|
857
|
-
const
|
|
868
|
+
const r = e.schoolsById[t.team.schoolId], d = r?.name || t.team.name || "TBD";
|
|
858
869
|
if (o && !d.toLowerCase().includes(o)) return p;
|
|
859
|
-
const
|
|
870
|
+
const l = t.rec.pf - t.rec.pa, h = q(this.data.games, t.team.id), n = () => {
|
|
860
871
|
location.href = u(e.hrefs.school, { id: t.team.schoolId });
|
|
861
872
|
};
|
|
862
|
-
return
|
|
873
|
+
return i`
|
|
863
874
|
<tr class="rowlink" @click=${(c) => {
|
|
864
|
-
c.target.closest("a") ||
|
|
875
|
+
c.target.closest("a") || n();
|
|
865
876
|
}}>
|
|
866
877
|
<td class="mut">${s + 1}</td>
|
|
867
878
|
<td class="teamcell">
|
|
868
|
-
${C(
|
|
879
|
+
${C(r)}${Y(e, t.team.id, null)}
|
|
869
880
|
<a href=${u(e.hrefs.school, { id: t.team.schoolId })}>${d}</a>
|
|
870
881
|
</td>
|
|
871
882
|
<td class="num">${w(t.rec, !0)}</td>
|
|
872
|
-
<td class="num">${
|
|
883
|
+
<td class="num">${J(t.confPct)}</td>
|
|
873
884
|
<td class="num">${w(t.rec)}</td>
|
|
874
|
-
<td class="num">${
|
|
885
|
+
<td class="num">${J(t.overallPct)}</td>
|
|
875
886
|
<td class="num">${t.rec.pf}</td>
|
|
876
887
|
<td class="num">${t.rec.pa}</td>
|
|
877
|
-
<td class="num" style="color:${
|
|
888
|
+
<td class="num" style="color:${l >= 0 ? "var(--hsot-win)" : "var(--hsot-loss)"}">${l > 0 ? "+" : ""}${l}</td>
|
|
878
889
|
<td>${L(t.rec.results) || "·"}</td>
|
|
879
890
|
<td>${K(e, t.team.id)}</td>
|
|
880
|
-
<td>${
|
|
891
|
+
<td>${ne(e, h, t.team.id)}</td>
|
|
881
892
|
</tr>
|
|
882
893
|
`;
|
|
883
894
|
}
|
|
884
895
|
}
|
|
885
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings",
|
|
886
|
-
const
|
|
896
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings", Pe);
|
|
897
|
+
const Ee = b`
|
|
887
898
|
.hero1 {
|
|
888
899
|
border-radius: var(--hsot-radius-md); color: var(--hsot-white);
|
|
889
900
|
padding: 1.3rem 1.4rem; display: flex; align-items: center; gap: 1.2rem;
|
|
@@ -900,8 +911,8 @@ const Be = b`
|
|
|
900
911
|
.delta.new { background: var(--hsot-straw); color: #6b5900; border-radius: var(--hsot-radius-xs); padding: 0.1rem 0.3rem; font-size: 0.7rem; }
|
|
901
912
|
.sparkline { vertical-align: middle; }
|
|
902
913
|
`;
|
|
903
|
-
class
|
|
904
|
-
static styles = [...F,
|
|
914
|
+
class Ae extends $ {
|
|
915
|
+
static styles = [...F, Ee];
|
|
905
916
|
static properties = {
|
|
906
917
|
...$.properties,
|
|
907
918
|
sport: { type: String },
|
|
@@ -918,20 +929,20 @@ class Pe extends $ {
|
|
|
918
929
|
e && (this.pollDate = e);
|
|
919
930
|
}
|
|
920
931
|
async fetchData(e) {
|
|
921
|
-
const t = this.season || N(), [s, o,
|
|
932
|
+
const t = this.season || N(), [s, o, r, d, l] = await Promise.all([
|
|
922
933
|
e.listRankings({ sport: this.sport, ...this.gender ? { gender: this.gender } : {} }),
|
|
923
934
|
e.listSchools(),
|
|
924
935
|
e.listTeams({ sport: this.sport }),
|
|
925
936
|
e.listConferences(),
|
|
926
937
|
e.listGames({ sport: this.sport, season: t })
|
|
927
|
-
]), h = s.items.filter((
|
|
938
|
+
]), h = s.items.filter((n) => !this.gender || !n.gender || n.gender === this.gender).sort((n, c) => c.effectiveDate.localeCompare(n.effectiveDate));
|
|
928
939
|
return {
|
|
929
940
|
season: t,
|
|
930
941
|
polls: h,
|
|
931
942
|
schools: o.items,
|
|
932
|
-
teams:
|
|
943
|
+
teams: r.items,
|
|
933
944
|
conferences: d.items,
|
|
934
|
-
games:
|
|
945
|
+
games: l.items
|
|
935
946
|
};
|
|
936
947
|
}
|
|
937
948
|
get ctx() {
|
|
@@ -945,45 +956,45 @@ class Pe extends $ {
|
|
|
945
956
|
}, this._ctxData = this.data), this._ctx;
|
|
946
957
|
}
|
|
947
958
|
sparkline(e, t, s) {
|
|
948
|
-
const
|
|
959
|
+
const l = t.map((m, f) => {
|
|
949
960
|
const g = (m.teamIds || []).indexOf(e);
|
|
950
961
|
if (g === -1) return null;
|
|
951
962
|
const k = t.length === 1 ? 96 / 2 : f / (t.length - 1) * 90 + 3, O = 3 + g / 24 * 20;
|
|
952
963
|
return { x: k, y: O };
|
|
953
964
|
}), h = [];
|
|
954
|
-
let
|
|
955
|
-
if (
|
|
956
|
-
m ?
|
|
957
|
-
}),
|
|
958
|
-
const c =
|
|
959
|
-
return
|
|
965
|
+
let n = [];
|
|
966
|
+
if (l.forEach((m) => {
|
|
967
|
+
m ? n.push(m) : n.length && (h.push(n), n = []);
|
|
968
|
+
}), n.length && h.push(n), !h.length) return p;
|
|
969
|
+
const c = l[s];
|
|
970
|
+
return i`<svg class="sparkline" width=${96} height=${26} viewBox="0 0 ${96} ${26}" role="img" aria-label="rank history">
|
|
960
971
|
${h.map((m) => Q`<polyline fill="none" stroke="var(--hsot-red)" stroke-width="2"
|
|
961
972
|
points=${m.map((f) => `${f.x.toFixed(1)},${f.y.toFixed(1)}`).join(" ")}></polyline>`)}
|
|
962
973
|
${c ? Q`<circle cx=${c.x.toFixed(1)} cy=${c.y.toFixed(1)} r="3" fill="var(--hsot-black)"></circle>` : p}
|
|
963
974
|
</svg>`;
|
|
964
975
|
}
|
|
965
976
|
movement(e, t, s) {
|
|
966
|
-
const o =
|
|
967
|
-
return o.kind === "up" ?
|
|
977
|
+
const o = De(e, t, s);
|
|
978
|
+
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>`;
|
|
968
979
|
}
|
|
969
980
|
renderView() {
|
|
970
981
|
const e = this.ctx, t = this.data.polls;
|
|
971
|
-
if (!t.length) return
|
|
972
|
-
const s = Math.max(0, t.findIndex((m) => m.effectiveDate === this.pollDate)), o = t[s] || t[0],
|
|
973
|
-
return
|
|
982
|
+
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)), o = t[s] || t[0], r = t[s + 1] || null, d = t.slice().reverse(), l = d.indexOf(o), h = v(this.data.conferences), n = (o.teamIds || [])[0], c = n ? S(e, n) : null;
|
|
984
|
+
return i`
|
|
974
985
|
${V(this, e, {
|
|
975
|
-
title:
|
|
976
|
-
sub:
|
|
986
|
+
title: i`${I(this.sport)} Top 25`,
|
|
987
|
+
sub: i`The HighSchoolOT poll · updated weekly · ${t.length} polls this season`,
|
|
977
988
|
teams: this.data.teams
|
|
978
989
|
})}
|
|
979
|
-
${B(this,
|
|
990
|
+
${B(this, i`
|
|
980
991
|
${P(this)}
|
|
981
992
|
<div class="toolbar">
|
|
982
993
|
<label class="asof" for="pollsel">Poll of</label>
|
|
983
994
|
<select id="pollsel" @change=${(m) => {
|
|
984
995
|
this.pollDate = m.target.value;
|
|
985
996
|
}}>
|
|
986
|
-
${t.map((m, f) =>
|
|
997
|
+
${t.map((m, f) => i`<option value=${m.effectiveDate} ?selected=${m === o}>
|
|
987
998
|
${y(m.effectiveDate, { month: "long", day: "numeric", year: "numeric" })}${f === 0 ? " · current" : ""}
|
|
988
999
|
</option>`)}
|
|
989
1000
|
</select>
|
|
@@ -998,65 +1009,65 @@ class Pe extends $ {
|
|
|
998
1009
|
<span class="spacer"></span>
|
|
999
1010
|
<span class="asof">Movement vs. the previous poll · sparkline = season rank history</span>
|
|
1000
1011
|
</div>
|
|
1001
|
-
${c ? this.renderHero(e, o,
|
|
1012
|
+
${c ? this.renderHero(e, o, r, n, c, h) : p}
|
|
1002
1013
|
<div class="card"><div class="tablewrap"><table class="data">
|
|
1003
1014
|
<thead><tr>
|
|
1004
1015
|
<th class="num">Rk</th><th>Mvmt</th><th>Team</th><th class="num">Record</th>
|
|
1005
1016
|
<th>Conference</th><th>Last result</th><th>Next</th><th>Season</th>
|
|
1006
1017
|
</tr></thead>
|
|
1007
1018
|
<tbody>
|
|
1008
|
-
${(o.teamIds || []).map((m, f) => f === 0 || !m ? p : this.renderRow(e, o,
|
|
1019
|
+
${(o.teamIds || []).map((m, f) => f === 0 || !m ? p : this.renderRow(e, o, r, d, l, h, m, f + 1))}
|
|
1009
1020
|
</tbody>
|
|
1010
1021
|
</table></div></div>
|
|
1011
1022
|
<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>
|
|
1012
1023
|
`)}
|
|
1013
1024
|
`;
|
|
1014
1025
|
}
|
|
1015
|
-
renderHero(e, t, s, o,
|
|
1016
|
-
const
|
|
1017
|
-
return
|
|
1026
|
+
renderHero(e, t, s, o, r, d) {
|
|
1027
|
+
const l = e.records[o], h = ee(e.records, o), n = d[e.teamsById[o]?.conferenceId], c = `linear-gradient(120deg, ${r.colorPrimary || "#030711"} 0%, var(--hsot-black) 85%)`;
|
|
1028
|
+
return i`
|
|
1018
1029
|
<div class="hero1" style="background:${c}">
|
|
1019
1030
|
<div class="bigrank">#1</div>
|
|
1020
|
-
${C(
|
|
1031
|
+
${C(r, 64)}
|
|
1021
1032
|
<div>
|
|
1022
|
-
<h2><a href=${u(e.hrefs.school, { id:
|
|
1033
|
+
<h2><a href=${u(e.hrefs.school, { id: r.id })}>${r.name} ${r.mascot || ""}</a></h2>
|
|
1023
1034
|
<div class="facts">
|
|
1024
|
-
${w(
|
|
1025
|
-
· streak ${L(
|
|
1026
|
-
${h ?
|
|
1035
|
+
${w(l)} overall${n ? i` · ${w(l, !0)} ${n.name}` : p}
|
|
1036
|
+
· streak ${L(l?.results) || "·"}
|
|
1037
|
+
${h ? i` · last: ${h.mark} ${h.my}-${h.their} vs ${_(e, h.opp)}` : p}
|
|
1027
1038
|
${this.movement(t, s, o)}
|
|
1028
1039
|
</div>
|
|
1029
1040
|
</div>
|
|
1030
1041
|
</div>
|
|
1031
1042
|
`;
|
|
1032
1043
|
}
|
|
1033
|
-
renderRow(e, t, s, o,
|
|
1034
|
-
const
|
|
1035
|
-
if (!
|
|
1036
|
-
const c = e.records[
|
|
1037
|
-
location.href = u(e.hrefs.school, { id:
|
|
1044
|
+
renderRow(e, t, s, o, r, d, l, h) {
|
|
1045
|
+
const n = S(e, l);
|
|
1046
|
+
if (!n) return p;
|
|
1047
|
+
const c = e.records[l], m = ee(e.records, l), f = q(this.data.games, l), g = d[e.teamsById[l]?.conferenceId], k = () => {
|
|
1048
|
+
location.href = u(e.hrefs.school, { id: n.id });
|
|
1038
1049
|
};
|
|
1039
|
-
return
|
|
1050
|
+
return i`
|
|
1040
1051
|
<tr class="rowlink" @click=${(O) => {
|
|
1041
1052
|
O.target.closest("a") || k();
|
|
1042
1053
|
}}>
|
|
1043
1054
|
<td class="num" style="font-weight:700">${h}</td>
|
|
1044
|
-
<td>${this.movement(t, s,
|
|
1045
|
-
<td class="teamcell">${C(
|
|
1046
|
-
<span class="mut" style="font-size:0.78rem">${
|
|
1055
|
+
<td>${this.movement(t, s, l)}</td>
|
|
1056
|
+
<td class="teamcell">${C(n)}<a href=${u(e.hrefs.school, { id: n.id })}>${n.name}</a>
|
|
1057
|
+
<span class="mut" style="font-size:0.78rem">${n.mascot || ""}</span></td>
|
|
1047
1058
|
<td class="num">${w(c)}</td>
|
|
1048
1059
|
<td class="mut">${g?.name || "Independent"}</td>
|
|
1049
|
-
<td>${m ?
|
|
1060
|
+
<td>${m ? i`<a class="box" style="text-decoration:none" href=${u(e.hrefs.game, { sport: this.sport, id: m.gameId })}>
|
|
1050
1061
|
<b style="color:${m.mark === "W" ? "var(--hsot-win)" : m.mark === "L" ? "var(--hsot-loss)" : "var(--hsot-tie)"}">${m.mark}</b>
|
|
1051
|
-
${m.my}-${m.their} vs ${_(e, m.opp)}</a>` :
|
|
1052
|
-
<td>${
|
|
1053
|
-
<td>${this.sparkline(
|
|
1062
|
+
${m.my}-${m.their} vs ${_(e, m.opp)}</a>` : i`<span class="mut">·</span>`}</td>
|
|
1063
|
+
<td>${ne(e, f, l)}</td>
|
|
1064
|
+
<td>${this.sparkline(l, o, r)}</td>
|
|
1054
1065
|
</tr>
|
|
1055
1066
|
`;
|
|
1056
1067
|
}
|
|
1057
1068
|
}
|
|
1058
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings",
|
|
1059
|
-
const
|
|
1069
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings", Ae);
|
|
1070
|
+
const _e = b`
|
|
1060
1071
|
.schoolhero { color: var(--hsot-white); padding: 1.6rem 1.25rem 1.3rem; }
|
|
1061
1072
|
.schoolhero .inner { max-width: 1366px; margin: 0 auto; display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
|
|
1062
1073
|
.schoolhero .crest {
|
|
@@ -1078,15 +1089,40 @@ const Ee = b`
|
|
|
1078
1089
|
.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); }
|
|
1079
1090
|
.tile .v { font-family: var(--hsot-heading-font); font-weight: 700; font-size: 1.7rem; line-height: 1.15; color: var(--hsot-black); }
|
|
1080
1091
|
.tile .s { font-size: 0.78rem; color: var(--hsot-gray-5); }
|
|
1081
|
-
|
|
1092
|
+
/* Schedule and roster split the width evenly. The roster used to get
|
|
1093
|
+
5/12 (~393px beside the rail), which held six columns; the season
|
|
1094
|
+
photo and the College column (2026-09) took its table to ~480px and
|
|
1095
|
+
gave the card a horizontal scrollbar on desktop while the schedule
|
|
1096
|
+
sat in white space. Both tracks are minmax(0, …) so a table that is
|
|
1097
|
+
still too wide scrolls inside its card instead of stretching the
|
|
1098
|
+
grid — and the page — past the viewport. */
|
|
1099
|
+
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; }
|
|
1082
1100
|
/* The season roster photo heads the roster card, above the table. Natural
|
|
1083
1101
|
height: a team photo is never cropped to a box — the card's overflow
|
|
1084
1102
|
rounds its top corners. */
|
|
1085
1103
|
.rosterphoto { display: block; width: 100%; height: auto; background: var(--hsot-gray-1); border-bottom: 1px solid var(--hsot-gray-2); }
|
|
1086
|
-
|
|
1104
|
+
/* Roster table: a little less side padding than the shared table so all
|
|
1105
|
+
seven columns fit the card beside the rail. */
|
|
1106
|
+
table.data.roster th, table.data.roster td { padding-left: 10px; padding-right: 10px; }
|
|
1107
|
+
table.data.roster .sub { display: none; }
|
|
1108
|
+
/* A bare 1fr here was the mobile bug: its implicit minimum is the
|
|
1109
|
+
content's width, so the nowrap roster table widened the single column
|
|
1110
|
+
past the phone and the whole page scrolled sideways. */
|
|
1111
|
+
@media (max-width: 900px) { .cols { grid-template-columns: minmax(0, 1fr); } .schoolhero h1 { font-size: 1.9rem; } }
|
|
1112
|
+
@media (max-width: 720px) {
|
|
1113
|
+
/* Phone: the roster fits the screen instead of scrolling. Position
|
|
1114
|
+
and class fold under the player's name, names and colleges may
|
|
1115
|
+
wrap, and cells tighten. Five columns come to ~330px, inside a
|
|
1116
|
+
360px phone's view padding. */
|
|
1117
|
+
table.data.roster { font-size: 13px; }
|
|
1118
|
+
table.data.roster th, table.data.roster td { padding: 7px 8px; }
|
|
1119
|
+
table.data.roster .pos, table.data.roster .cls { display: none; }
|
|
1120
|
+
table.data.roster td.player, table.data.roster td.college { white-space: normal; }
|
|
1121
|
+
table.data.roster .sub { display: block; font-weight: 400; font-size: 0.78rem; color: var(--hsot-gray-5); }
|
|
1122
|
+
}
|
|
1087
1123
|
`;
|
|
1088
|
-
class
|
|
1089
|
-
static styles = [...F,
|
|
1124
|
+
class Re extends $ {
|
|
1125
|
+
static styles = [...F, _e];
|
|
1090
1126
|
static properties = {
|
|
1091
1127
|
...$.properties,
|
|
1092
1128
|
schoolId: { type: String, attribute: "school-id" },
|
|
@@ -1103,7 +1139,7 @@ class Ae extends $ {
|
|
|
1103
1139
|
e && !this.sport && (this.sport = e);
|
|
1104
1140
|
}
|
|
1105
1141
|
async fetchData(e) {
|
|
1106
|
-
const t = this.season || N(), s = await e.getSchool(this.schoolId),
|
|
1142
|
+
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, [l, h, n, c, m, f, g] = await Promise.all([
|
|
1107
1143
|
d ? e.listGames({ sport: d.sport, season: t }) : Promise.resolve({ items: [] }),
|
|
1108
1144
|
d ? e.listTeams({ sport: d.sport }) : Promise.resolve({ items: [] }),
|
|
1109
1145
|
e.listSchools(),
|
|
@@ -1117,11 +1153,11 @@ class Ae extends $ {
|
|
|
1117
1153
|
return {
|
|
1118
1154
|
season: t,
|
|
1119
1155
|
school: s,
|
|
1120
|
-
teams:
|
|
1156
|
+
teams: r,
|
|
1121
1157
|
active: d,
|
|
1122
|
-
games:
|
|
1158
|
+
games: l.items,
|
|
1123
1159
|
allTeams: h.items,
|
|
1124
|
-
schools:
|
|
1160
|
+
schools: n.items,
|
|
1125
1161
|
conferences: c.items,
|
|
1126
1162
|
rankings: m.items,
|
|
1127
1163
|
roster: f.items.find((k) => k.season === t) || null,
|
|
@@ -1143,61 +1179,61 @@ class Ae extends $ {
|
|
|
1143
1179
|
}
|
|
1144
1180
|
renderView() {
|
|
1145
1181
|
const { school: e, teams: t, active: s, season: o } = this.data;
|
|
1146
|
-
if (!e) return
|
|
1147
|
-
const
|
|
1148
|
-
return
|
|
1182
|
+
if (!e) return i`<div class="view"><p class="empty">School not found.</p></div>`;
|
|
1183
|
+
const r = this.ctx, d = E(e.colorPrimary || "#030711"), l = (e.adm || [])[0], h = v(this.data.conferences), n = s ? h[s.conferenceId] : null;
|
|
1184
|
+
return i`
|
|
1149
1185
|
<div class="schoolhero" style="background:linear-gradient(115deg, ${e.colorPrimary || "#030711"} 0%, ${e.colorPrimary || "#030711"} 55%, var(--hsot-black) 100%);color:${d}">
|
|
1150
1186
|
<div class="inner">
|
|
1151
|
-
${A(e, 84) ?
|
|
1187
|
+
${A(e, 84) ? i`<img class="crest logo" alt="" loading="lazy" src=${A(e, 84)} />` : i`<div class="crest" style="background:${e.colorSecondary || "#7C7C7C"};color:${E(e.colorSecondary || "#7C7C7C")}">${j(e)}</div>`}
|
|
1152
1188
|
<div style="min-width:260px">
|
|
1153
1189
|
<h1>${e.name} <span class="mascot">${e.mascot || ""}</span></h1>
|
|
1154
1190
|
<div class="facts">
|
|
1155
|
-
${e.location ?
|
|
1156
|
-
${e.association ?
|
|
1157
|
-
${
|
|
1158
|
-
${
|
|
1159
|
-
${e.openingYear ?
|
|
1160
|
-
${e.areaCode ?
|
|
1191
|
+
${e.location ? i`<span><b>Location</b>${e.location}${e.county ? i` · ${e.county} County` : p}</span>` : p}
|
|
1192
|
+
${e.association ? i`<span><b>League</b>${e.association}${e.classification ? i` · ${e.classification}` : p}</span>` : p}
|
|
1193
|
+
${n ? i`<span><b>Conference</b>${n.name}</span>` : p}
|
|
1194
|
+
${l ? i`<span><b>Enrollment</b>${l.value.toLocaleString()} (${l.season} ADM)</span>` : p}
|
|
1195
|
+
${e.openingYear ? i`<span><b>Opened</b>${e.openingYear}</span>` : p}
|
|
1196
|
+
${e.areaCode ? i`<span><b>Area</b>${e.areaCode}</span>` : p}
|
|
1161
1197
|
</div>
|
|
1162
1198
|
</div>
|
|
1163
1199
|
</div>
|
|
1164
1200
|
</div>
|
|
1165
1201
|
<div class="band">
|
|
1166
1202
|
<nav class="tabs" aria-label="Teams">
|
|
1167
|
-
${t.map((c) => c.id === s?.id ?
|
|
1203
|
+
${t.map((c) => c.id === s?.id ? i`<a class="on" href="#" @click=${(m) => m.preventDefault()}>${c.name}</a>` : i`<a href="#" @click=${(m) => {
|
|
1168
1204
|
m.preventDefault(), this.switchSport(c.sport);
|
|
1169
1205
|
}}>${c.name}</a>`)}
|
|
1170
1206
|
</nav>
|
|
1171
1207
|
</div>
|
|
1172
|
-
${B(this,
|
|
1208
|
+
${B(this, i`
|
|
1173
1209
|
${P(this)}
|
|
1174
|
-
${s ? this.renderTeam(
|
|
1210
|
+
${s ? this.renderTeam(r, s, n, o) : i`<p class="empty">No teams recorded for this school yet.</p>`}
|
|
1175
1211
|
`)}
|
|
1176
1212
|
`;
|
|
1177
1213
|
}
|
|
1178
1214
|
renderTeam(e, t, s, o) {
|
|
1179
|
-
const
|
|
1180
|
-
return
|
|
1215
|
+
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, l = s ? this.data.allTeams.filter((m) => m.conferenceId === s.id) : [], h = s ? oe(l, e.records).findIndex((m) => m.team.id === t.id) + 1 : 0, n = 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)));
|
|
1216
|
+
return i`
|
|
1181
1217
|
<div class="tiles">
|
|
1182
|
-
<div class="tile"><div class="k">Overall</div><div class="v">${w(
|
|
1183
|
-
<div class="tile"><div class="k">${s?.name || "Conference"}</div><div class="v">${w(
|
|
1184
|
-
<div class="s">${h ? `${
|
|
1185
|
-
<div class="tile"><div class="k">Points</div><div class="v">${d ? (
|
|
1186
|
-
<div class="s">scored per game · ${d ? (
|
|
1187
|
-
<div class="tile"><div class="k">Streak</div><div class="v">${L(
|
|
1218
|
+
<div class="tile"><div class="k">Overall</div><div class="v">${w(r)}</div><div class="s">${d} games played</div></div>
|
|
1219
|
+
<div class="tile"><div class="k">${s?.name || "Conference"}</div><div class="v">${w(r, !0)}</div>
|
|
1220
|
+
<div class="s">${h ? `${fe(h)} of ${l.length}` : "·"}</div></div>
|
|
1221
|
+
<div class="tile"><div class="k">Points</div><div class="v">${d ? (r.pf / d).toFixed(1) : "0.0"}</div>
|
|
1222
|
+
<div class="s">scored per game · ${d ? (r.pa / d).toFixed(1) : "0.0"} allowed</div></div>
|
|
1223
|
+
<div class="tile"><div class="k">Streak</div><div class="v">${L(r.results) || "·"}</div>
|
|
1188
1224
|
<div class="s">last 5: ${K(e, t.id)}</div></div>
|
|
1189
|
-
<div class="tile"><div class="k">HSOT Top 25</div><div class="v">${
|
|
1225
|
+
<div class="tile"><div class="k">HSOT Top 25</div><div class="v">${n ? `#${n}` : "NR"}</div>
|
|
1190
1226
|
<div class="s"><a href=${u(e.hrefs.section, { sport: t.sport, view: "rankings" })}>full poll</a></div></div>
|
|
1191
1227
|
</div>
|
|
1192
|
-
${(t.championships || []).length ?
|
|
1228
|
+
${(t.championships || []).length ? i`
|
|
1193
1229
|
<div style="margin:-0.2rem 0 1rem;display:flex;gap:0.4rem;flex-wrap:wrap">
|
|
1194
|
-
${t.championships.map((m) =>
|
|
1230
|
+
${t.championships.map((m) => i`<span class="pill champ">★ ${m.season} ${m.title} champion${m.classification ? ` · ${m.classification}` : ""}${m.region ? ` · ${m.region}` : ""}</span>`)}
|
|
1195
1231
|
</div>` : p}
|
|
1196
1232
|
<div class="cols">
|
|
1197
1233
|
<div>
|
|
1198
1234
|
<div class="section-title">Schedule & results</div>
|
|
1199
1235
|
<div class="card">
|
|
1200
|
-
${c.length ?
|
|
1236
|
+
${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>`}
|
|
1201
1237
|
</div>
|
|
1202
1238
|
</div>
|
|
1203
1239
|
<div>
|
|
@@ -1208,21 +1244,21 @@ class Ae extends $ {
|
|
|
1208
1244
|
`;
|
|
1209
1245
|
}
|
|
1210
1246
|
renderGameRow(e, t, s) {
|
|
1211
|
-
const o = s.homeTeamId === t.id,
|
|
1212
|
-
let h =
|
|
1247
|
+
const o = s.homeTeamId === t.id, r = o ? s.awayTeamId : s.homeTeamId, d = o ? s.homeScore : s.awayScore, l = o ? s.awayScore : s.homeScore;
|
|
1248
|
+
let h = i`<span class="mut">${U(s.time)}</span>`;
|
|
1213
1249
|
if (s.state === "final") {
|
|
1214
1250
|
const c = G(s), m = c === "tie" ? "T" : c === (o ? "home" : "away") ? "W" : "L";
|
|
1215
|
-
h =
|
|
1216
|
-
} else s.state === "live" && (h =
|
|
1217
|
-
const
|
|
1218
|
-
return
|
|
1251
|
+
h = i`<span class=${m}>${m}</span> ${d}-${l}${s.finish === "overtime" ? i` <span class="mut">OT</span>` : p}${s.forfeit && s.forfeit !== "none" ? i` <span class="mut">FF</span>` : p}`;
|
|
1252
|
+
} else s.state === "live" && (h = i`<span style="color:var(--hsot-red)">${d}-${l}</span>`);
|
|
1253
|
+
const n = s.gameType === "conference" ? "Conf" : s.gameType === "nonconference" ? "Non-conf" : s.gameType === "playoff" ? `Playoff${s.label ? ` · ${s.label}` : ""}` : "Scrimmage";
|
|
1254
|
+
return i`
|
|
1219
1255
|
<li>
|
|
1220
1256
|
<span class="d">${y(s.date)}</span>
|
|
1221
|
-
${
|
|
1257
|
+
${se(s).kind === "sched" ? p : R(s)}
|
|
1222
1258
|
<span class="res">${h}</span>
|
|
1223
|
-
<span class="opp">${o ? "vs" : "at"} ${
|
|
1224
|
-
<span class="pill type">${
|
|
1225
|
-
${s.broadcast ?
|
|
1259
|
+
<span class="opp">${o ? "vs" : "at"} ${ie(e, r, s.date)}
|
|
1260
|
+
<span class="pill type">${n}</span>
|
|
1261
|
+
${s.broadcast ? i`<span class="pill class">${s.broadcast}</span>` : p}
|
|
1226
1262
|
</span>
|
|
1227
1263
|
<span class="where">${s.venue || ""}</span>
|
|
1228
1264
|
<a class="box" href=${u(e.hrefs.game, { sport: t.sport, id: s.id })}>Box score →</a>
|
|
@@ -1232,41 +1268,43 @@ class Ae extends $ {
|
|
|
1232
1268
|
renderRoster(e, t) {
|
|
1233
1269
|
const s = this.data.roster;
|
|
1234
1270
|
if (!s)
|
|
1235
|
-
return
|
|
1236
|
-
const o =
|
|
1237
|
-
return
|
|
1238
|
-
${o ?
|
|
1239
|
-
alt="${
|
|
1240
|
-
<div class="tablewrap"><table class="data">
|
|
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 ?
|
|
1271
|
+
return i`<p class="empty">Roster not published for ${t}.</p>`;
|
|
1272
|
+
const o = ze(s, 560), r = this.data.school?.name || "", d = v(this.data.players), l = s.entries.slice().sort((n, c) => (n.number || 0) - (c.number || 0)), h = l.some((n) => d[n.playerId]?.college);
|
|
1273
|
+
return i`
|
|
1274
|
+
${o ? i`<img class="rosterphoto" src=${o} loading="lazy" decoding="async"
|
|
1275
|
+
alt="${r} ${e.name} ${t} team photo" />` : p}
|
|
1276
|
+
<div class="tablewrap"><table class="data roster">
|
|
1277
|
+
<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>
|
|
1242
1278
|
<tbody>
|
|
1243
|
-
${
|
|
1244
|
-
const c = d[
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
<td>${
|
|
1249
|
-
<td class="
|
|
1250
|
-
<td class="
|
|
1279
|
+
${l.map((n) => {
|
|
1280
|
+
const c = d[n.playerId];
|
|
1281
|
+
if (!c) return p;
|
|
1282
|
+
const m = [n.position, c.classOf].filter(Boolean).join(" · ") || "·";
|
|
1283
|
+
return i`<tr>
|
|
1284
|
+
<td class="num mut">${n.number ?? "·"}</td>
|
|
1285
|
+
<td class="player" style="font-weight:500">${c.firstName} ${c.lastName}<span class="sub">${m}</span></td>
|
|
1286
|
+
<td class="pos">${n.position || "·"}</td>
|
|
1287
|
+
<td class="cls mut">${c.classOf || "·"}</td>
|
|
1288
|
+
<td class="num">${me(c.heightIn)}</td>
|
|
1251
1289
|
<td class="num">${c.weightLb || "·"}</td>
|
|
1252
|
-
${h ?
|
|
1253
|
-
</tr
|
|
1290
|
+
${h ? i`<td class="college">${c.college || "·"}</td>` : p}
|
|
1291
|
+
</tr>`;
|
|
1254
1292
|
})}
|
|
1255
1293
|
</tbody>
|
|
1256
1294
|
</table></div>
|
|
1257
1295
|
`;
|
|
1258
1296
|
}
|
|
1259
1297
|
}
|
|
1260
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school",
|
|
1261
|
-
const
|
|
1262
|
-
function
|
|
1298
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school", Re);
|
|
1299
|
+
const Ne = "https://api.wral.com/search";
|
|
1300
|
+
function Le(a) {
|
|
1263
1301
|
return a.map((e) => `uri:"${e}"`).join(" OR ");
|
|
1264
1302
|
}
|
|
1265
|
-
function
|
|
1266
|
-
const t = String(a ||
|
|
1303
|
+
function Oe(a, e) {
|
|
1304
|
+
const t = String(a || Ne).replace(/\/+$/, ""), s = new URLSearchParams({ query: Le(e), sort: "score", lang: "en" });
|
|
1267
1305
|
return `${t}/v1/query?${s}`;
|
|
1268
1306
|
}
|
|
1269
|
-
function
|
|
1307
|
+
function le(a) {
|
|
1270
1308
|
try {
|
|
1271
1309
|
const e = new URL(a);
|
|
1272
1310
|
if (/(^|\.)smugmug\.com$/i.test(e.hostname)) {
|
|
@@ -1281,13 +1319,13 @@ function ne(a) {
|
|
|
1281
1319
|
}
|
|
1282
1320
|
return { uri: a, title: a };
|
|
1283
1321
|
}
|
|
1284
|
-
async function
|
|
1285
|
-
const o = await ((...
|
|
1322
|
+
async function He(a, e, t) {
|
|
1323
|
+
const o = await ((...l) => fetch(...l))(Oe(a, e));
|
|
1286
1324
|
if (!o.ok) throw new Error(`search answered ${o.status}`);
|
|
1287
|
-
const
|
|
1288
|
-
return e.map((
|
|
1325
|
+
const r = await o.json(), d = new Map((r.items || []).map((l) => [l.uri, l]));
|
|
1326
|
+
return e.map((l) => d.get(l) || le(l));
|
|
1289
1327
|
}
|
|
1290
|
-
const
|
|
1328
|
+
const Ue = b`
|
|
1291
1329
|
.breadcrumbs { font-size: 0.8125rem; margin: 0.9rem 0 0; color: var(--hsot-gray-5); }
|
|
1292
1330
|
.breadcrumbs a { text-decoration: none; }
|
|
1293
1331
|
.scorehead { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center; padding: 1.4rem 1rem; }
|
|
@@ -1326,8 +1364,8 @@ const Oe = b`
|
|
|
1326
1364
|
.cols { grid-template-columns: 1fr; }
|
|
1327
1365
|
}
|
|
1328
1366
|
`;
|
|
1329
|
-
class
|
|
1330
|
-
static styles = [...F,
|
|
1367
|
+
class Me extends $ {
|
|
1368
|
+
static styles = [...F, Ue];
|
|
1331
1369
|
static properties = {
|
|
1332
1370
|
...$.properties,
|
|
1333
1371
|
gameId: { type: String, attribute: "game-id" },
|
|
@@ -1341,7 +1379,7 @@ class He extends $ {
|
|
|
1341
1379
|
super(), this.gameId = "", this.searchApi = "";
|
|
1342
1380
|
}
|
|
1343
1381
|
async fetchData(e) {
|
|
1344
|
-
const t = await e.getGame(this.gameId), s = Array.isArray(t.coverageUrls) ? t.coverageUrls : [], [o,
|
|
1382
|
+
const t = await e.getGame(this.gameId), s = Array.isArray(t.coverageUrls) ? t.coverageUrls : [], [o, r, d, l, h, n] = await Promise.all([
|
|
1345
1383
|
e.listSchools(),
|
|
1346
1384
|
e.listTeams({ sport: t.sport }),
|
|
1347
1385
|
e.listConferences(),
|
|
@@ -1349,16 +1387,16 @@ class He extends $ {
|
|
|
1349
1387
|
e.listGames({ sport: t.sport, season: t.season }),
|
|
1350
1388
|
// A search outage must not blank the box score — degrade to bare
|
|
1351
1389
|
// links (fetchCoverage already degrades per-URL index misses).
|
|
1352
|
-
s.length ?
|
|
1390
|
+
s.length ? He(this.searchApi, s).catch(() => s.map(le)) : Promise.resolve([])
|
|
1353
1391
|
]);
|
|
1354
1392
|
return {
|
|
1355
1393
|
game: t,
|
|
1356
1394
|
schools: o.items,
|
|
1357
|
-
teams:
|
|
1395
|
+
teams: r.items,
|
|
1358
1396
|
conferences: d.items,
|
|
1359
|
-
rankings:
|
|
1397
|
+
rankings: l.items,
|
|
1360
1398
|
games: h.items,
|
|
1361
|
-
coverage:
|
|
1399
|
+
coverage: n
|
|
1362
1400
|
};
|
|
1363
1401
|
}
|
|
1364
1402
|
get ctx() {
|
|
@@ -1373,10 +1411,10 @@ class He extends $ {
|
|
|
1373
1411
|
}
|
|
1374
1412
|
renderView() {
|
|
1375
1413
|
const e = this.data.game;
|
|
1376
|
-
if (!e) return
|
|
1377
|
-
const t = this.ctx, s = v(this.data.conferences), o = t.teamsById[e.awayTeamId] ? t.schoolsById[t.teamsById[e.awayTeamId].schoolId] : null,
|
|
1378
|
-
return
|
|
1379
|
-
${B(this,
|
|
1414
|
+
if (!e) return i`<div class="view"><p class="empty">Game not found.</p></div>`;
|
|
1415
|
+
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), l = (c) => e.state === "final" && d !== c && d !== "tie" ? "opacity:0.45" : "", h = e.conferenceId ? s[e.conferenceId] : null, n = 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));
|
|
1416
|
+
return i`
|
|
1417
|
+
${B(this, i`
|
|
1380
1418
|
${P(this)}
|
|
1381
1419
|
<p class="breadcrumbs">
|
|
1382
1420
|
<a href=${u(t.hrefs.section, { sport: e.sport, view: "scores" })}>${I(e.sport)}</a> /
|
|
@@ -1388,34 +1426,34 @@ class He extends $ {
|
|
|
1388
1426
|
${this.teamBlock(t, e, e.awayTeamId, o, !1)}
|
|
1389
1427
|
<div class="mid">
|
|
1390
1428
|
<div class="bigscore">
|
|
1391
|
-
<span style=${
|
|
1429
|
+
<span style=${l("away")}>${e.awayScore}</span>
|
|
1392
1430
|
<span class="mut" style="font-size:1.6rem">–</span>
|
|
1393
|
-
<span style=${
|
|
1431
|
+
<span style=${l("home")}>${e.homeScore}</span>
|
|
1394
1432
|
</div>
|
|
1395
1433
|
<div class="status">${R(e)}</div>
|
|
1396
|
-
<div class="status">${y(e.date, { weekday: "short", month: "short", day: "numeric", year: "numeric" })}${e.state === "scheduled" && e.time ?
|
|
1397
|
-
${e.broadcast ?
|
|
1434
|
+
<div class="status">${y(e.date, { weekday: "short", month: "short", day: "numeric", year: "numeric" })}${e.state === "scheduled" && e.time ? i` · ${U(e.time)}` : p} · ${e.venue || "Venue TBD"}
|
|
1435
|
+
${e.broadcast ? i` · <span class="pill class">${e.broadcast}</span>` : p}</div>
|
|
1398
1436
|
<div class="status">
|
|
1399
1437
|
<span class="pill type">${e.gameType === "conference" ? `${h?.name || "Conference"} game` : e.gameType}</span>
|
|
1400
|
-
${e.label ?
|
|
1401
|
-
${(e.tags || []).map((c) =>
|
|
1438
|
+
${e.label ? i`<span class="pill type">Bracket ${e.label}</span>` : p}
|
|
1439
|
+
${(e.tags || []).map((c) => i`<span class="pill type">${c}</span>`)}
|
|
1402
1440
|
</div>
|
|
1403
1441
|
</div>
|
|
1404
|
-
${this.teamBlock(t, e, e.homeTeamId,
|
|
1442
|
+
${this.teamBlock(t, e, e.homeTeamId, r, !0)}
|
|
1405
1443
|
</div>
|
|
1406
|
-
${this.renderLineScore(e, o,
|
|
1407
|
-
${e.notes ?
|
|
1444
|
+
${this.renderLineScore(e, o, r)}
|
|
1445
|
+
${e.notes ? i`<p class="note" style="padding:0 1rem 0.9rem;text-align:center">${e.notes}</p>` : p}
|
|
1408
1446
|
</div>
|
|
1409
|
-
${(this.data.coverage || []).length ?
|
|
1447
|
+
${(this.data.coverage || []).length ? i`
|
|
1410
1448
|
<div class="section-title">Coverage</div>
|
|
1411
1449
|
<div class="covgrid">
|
|
1412
|
-
${this.data.coverage.map((c) =>
|
|
1450
|
+
${this.data.coverage.map((c) => i`
|
|
1413
1451
|
<a class="card covcard" href=${c.uri}>
|
|
1414
|
-
${c.image ?
|
|
1452
|
+
${c.image ? i`<img class="covimg" src=${c.image} alt="" loading="lazy" />` : p}
|
|
1415
1453
|
<div class="covbody">
|
|
1416
|
-
<div class="covtitle">${c.videoDuration ?
|
|
1417
|
-
${c.description ?
|
|
1418
|
-
${c.author || c.publishedTime ?
|
|
1454
|
+
<div class="covtitle">${c.videoDuration ? i`<span class="pill live" style="animation:none">Video</span> ` : p}${c.photos ? i`<span class="pill live" style="animation:none">Photos</span> ` : p}${c.title || c.uri}</div>
|
|
1455
|
+
${c.description ? i`<p class="covdesc">${c.description}</p>` : p}
|
|
1456
|
+
${c.author || c.publishedTime ? i`
|
|
1419
1457
|
<div class="covmeta">${[c.author, c.publishedTime ? new Date(c.publishedTime).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" }) : ""].filter(Boolean).join(" · ")}</div>
|
|
1420
1458
|
` : p}
|
|
1421
1459
|
</div>
|
|
@@ -1424,12 +1462,12 @@ class He extends $ {
|
|
|
1424
1462
|
</div>` : p}
|
|
1425
1463
|
<div class="section-title">Season context</div>
|
|
1426
1464
|
<div class="cols">
|
|
1427
|
-
${[[e.awayTeamId, o], [e.homeTeamId,
|
|
1465
|
+
${[[e.awayTeamId, o], [e.homeTeamId, r]].map(([c, m]) => this.renderContext(t, c, m))}
|
|
1428
1466
|
</div>
|
|
1429
|
-
${
|
|
1467
|
+
${n.length ? i`
|
|
1430
1468
|
<div class="section-title">Head to head this season</div>
|
|
1431
1469
|
<div class="card"><ul class="gamelist">
|
|
1432
|
-
${
|
|
1470
|
+
${n.map((c) => i`<li>
|
|
1433
1471
|
<span class="d">${y(c.date)}</span>${R(c)}
|
|
1434
1472
|
<span class="opp">${T(t, c.awayTeamId)} ${c.awayScore}, ${T(t, c.homeTeamId)} ${c.homeScore}</span>
|
|
1435
1473
|
<a class="box" href=${u(t.hrefs.game, { sport: e.sport, id: c.id })}>Box score →</a>
|
|
@@ -1438,15 +1476,15 @@ class He extends $ {
|
|
|
1438
1476
|
`)}
|
|
1439
1477
|
`;
|
|
1440
1478
|
}
|
|
1441
|
-
teamBlock(e, t, s, o,
|
|
1442
|
-
if (!o) return
|
|
1443
|
-
const d = e.teamsById[s],
|
|
1444
|
-
return
|
|
1445
|
-
<div class="teamblock ${
|
|
1446
|
-
${h ?
|
|
1479
|
+
teamBlock(e, t, s, o, r) {
|
|
1480
|
+
if (!o) return i`<div class="teamblock ${r ? "right" : ""}"><div class="tname">TBD</div></div>`;
|
|
1481
|
+
const d = e.teamsById[s], l = e.records[s], h = A(o, 58);
|
|
1482
|
+
return i`
|
|
1483
|
+
<div class="teamblock ${r ? "right" : ""}">
|
|
1484
|
+
${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>`}
|
|
1447
1485
|
<div>
|
|
1448
1486
|
<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(
|
|
1487
|
+
<div class="trec">${o.mascot || ""} · ${w(l)}${d?.conferenceId ? i` · ${w(l, !0)} conf` : p}</div>
|
|
1450
1488
|
</div>
|
|
1451
1489
|
</div>
|
|
1452
1490
|
`;
|
|
@@ -1454,20 +1492,20 @@ class He extends $ {
|
|
|
1454
1492
|
renderLineScore(e, t, s) {
|
|
1455
1493
|
const o = e.periodScores || [];
|
|
1456
1494
|
if (!o.length)
|
|
1457
|
-
return
|
|
1458
|
-
const
|
|
1495
|
+
return i`<p class="empty" style="text-align:center">Period scoring will appear once the game starts.</p>`;
|
|
1496
|
+
const r = Math.max(4, ...o.map((n) => n.period)), d = (n) => n <= 4 ? String(n) : `OT${n > 5 ? n - 4 : ""}`, l = (n, c) => {
|
|
1459
1497
|
const m = o.find((f) => f.period === c);
|
|
1460
|
-
return m ? m[
|
|
1461
|
-
}, h = (
|
|
1498
|
+
return m ? m[n] : e.state === "final" ? 0 : "·";
|
|
1499
|
+
}, h = (n, c, m) => i`
|
|
1462
1500
|
<tr>
|
|
1463
|
-
<td class="teamcell">${C(
|
|
1464
|
-
${Array.from({ length:
|
|
1501
|
+
<td class="teamcell">${C(n, 20)}${n?.abbr || "TBD"}</td>
|
|
1502
|
+
${Array.from({ length: r }, (f, g) => i`<td class="num">${l(c, g + 1)}</td>`)}
|
|
1465
1503
|
<td class="num" style="font-weight:700">${m}</td>
|
|
1466
1504
|
</tr>`;
|
|
1467
|
-
return
|
|
1505
|
+
return i`
|
|
1468
1506
|
<div class="tablewrap" style="border-top:1px solid var(--hsot-gray-2)">
|
|
1469
1507
|
<table class="data" style="max-width:560px;margin:0.6rem auto 0.9rem">
|
|
1470
|
-
<thead><tr><th>Team</th>${Array.from({ length:
|
|
1508
|
+
<thead><tr><th>Team</th>${Array.from({ length: r }, (n, c) => i`<th class="num">${d(c + 1)}</th>`)}<th class="num">T</th></tr></thead>
|
|
1471
1509
|
<tbody>
|
|
1472
1510
|
${h(t, "away", e.awayScore)}
|
|
1473
1511
|
${h(s, "home", e.homeScore)}
|
|
@@ -1478,24 +1516,24 @@ class He extends $ {
|
|
|
1478
1516
|
}
|
|
1479
1517
|
renderContext(e, t, s) {
|
|
1480
1518
|
if (!s) return p;
|
|
1481
|
-
const o = e.records[t],
|
|
1482
|
-
return
|
|
1519
|
+
const o = e.records[t], r = q(this.data.games, t);
|
|
1520
|
+
return i`
|
|
1483
1521
|
<div class="card ctxcard">
|
|
1484
1522
|
<div class="who">${C(s)}${s.name}</div>
|
|
1485
1523
|
<div class="row">
|
|
1486
1524
|
<span>Last 5: ${K(e, t)}</span>
|
|
1487
1525
|
<span>Streak: <b>${o ? L(o.results) : "·"}</b></span>
|
|
1488
1526
|
<span>PF/PA: <b>${o ? `${o.pf} / ${o.pa}` : "·"}</b></span>
|
|
1489
|
-
<span>Next: ${
|
|
1490
|
-
${
|
|
1527
|
+
<span>Next: ${r ? i`${y(r.date, { month: "numeric", day: "numeric" })}
|
|
1528
|
+
${r.homeTeamId === t ? "vs" : "at"} ${_(e, r.homeTeamId === t ? r.awayTeamId : r.homeTeamId)}` : "·"}</span>
|
|
1491
1529
|
</div>
|
|
1492
1530
|
</div>
|
|
1493
1531
|
`;
|
|
1494
1532
|
}
|
|
1495
1533
|
}
|
|
1496
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore",
|
|
1497
|
-
const
|
|
1498
|
-
class
|
|
1534
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore", Me);
|
|
1535
|
+
const je = 250, Ge = 2;
|
|
1536
|
+
class qe extends te {
|
|
1499
1537
|
static properties = {
|
|
1500
1538
|
api: { type: String },
|
|
1501
1539
|
schoolHref: { type: String, attribute: "school-href" },
|
|
@@ -1575,11 +1613,11 @@ class je extends ee {
|
|
|
1575
1613
|
}
|
|
1576
1614
|
onInput(e) {
|
|
1577
1615
|
const t = e.target.value.trim();
|
|
1578
|
-
if (clearTimeout(this.debounceTimer), t.length <
|
|
1616
|
+
if (clearTimeout(this.debounceTimer), t.length < Ge) {
|
|
1579
1617
|
this.abortController?.abort(), this.results = [], this.open = !1, this.searched = !1;
|
|
1580
1618
|
return;
|
|
1581
1619
|
}
|
|
1582
|
-
this.debounceTimer = setTimeout(() => this.search(t),
|
|
1620
|
+
this.debounceTimer = setTimeout(() => this.search(t), je);
|
|
1583
1621
|
}
|
|
1584
1622
|
async search(e) {
|
|
1585
1623
|
this.abortController?.abort(), this.abortController = new AbortController();
|
|
@@ -1624,10 +1662,10 @@ class je extends ee {
|
|
|
1624
1662
|
return [e.location, e.county && `${e.county} County`].filter(Boolean).join(" — ");
|
|
1625
1663
|
}
|
|
1626
1664
|
renderOption(e, t) {
|
|
1627
|
-
const s = this.where(e), o = (
|
|
1628
|
-
|
|
1665
|
+
const s = this.where(e), o = (r) => {
|
|
1666
|
+
r.preventDefault(), this.go(e);
|
|
1629
1667
|
};
|
|
1630
|
-
return
|
|
1668
|
+
return i`
|
|
1631
1669
|
<li
|
|
1632
1670
|
id="school-option-${t}"
|
|
1633
1671
|
role="option"
|
|
@@ -1638,13 +1676,13 @@ class je extends ee {
|
|
|
1638
1676
|
}}"
|
|
1639
1677
|
>
|
|
1640
1678
|
<span class="name">${e.name}</span>
|
|
1641
|
-
${s ?
|
|
1679
|
+
${s ? i`<span class="where">${s}</span>` : p}
|
|
1642
1680
|
</li>
|
|
1643
1681
|
`;
|
|
1644
1682
|
}
|
|
1645
1683
|
renderListbox() {
|
|
1646
|
-
const e = this.searched && !this.results.length, t =
|
|
1647
|
-
return
|
|
1684
|
+
const e = this.searched && !this.results.length, t = i`<li class="empty">No schools found</li>`;
|
|
1685
|
+
return i`
|
|
1648
1686
|
<ul id="school-search-listbox" role="listbox" aria-label="Schools">
|
|
1649
1687
|
${this.results.map((s, o) => this.renderOption(s, o))}
|
|
1650
1688
|
${e ? t : p}
|
|
@@ -1653,7 +1691,7 @@ class je extends ee {
|
|
|
1653
1691
|
}
|
|
1654
1692
|
render() {
|
|
1655
1693
|
const e = this.activeIndex >= 0 ? `school-option-${this.activeIndex}` : "";
|
|
1656
|
-
return
|
|
1694
|
+
return i`
|
|
1657
1695
|
<input
|
|
1658
1696
|
type="text"
|
|
1659
1697
|
role="combobox"
|
|
@@ -1672,23 +1710,23 @@ class je extends ee {
|
|
|
1672
1710
|
`;
|
|
1673
1711
|
}
|
|
1674
1712
|
}
|
|
1675
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-school-search") && globalThis.customElements.define("hsot-school-search",
|
|
1713
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-school-search") && globalThis.customElements.define("hsot-school-search", qe);
|
|
1676
1714
|
export {
|
|
1677
1715
|
H as D,
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1716
|
+
Me as H,
|
|
1717
|
+
Ae as a,
|
|
1718
|
+
Re as b,
|
|
1719
|
+
qe as c,
|
|
1720
|
+
Be as d,
|
|
1721
|
+
Pe as e,
|
|
1684
1722
|
z as f,
|
|
1685
|
-
|
|
1723
|
+
he as g,
|
|
1686
1724
|
u as h,
|
|
1687
1725
|
G as i,
|
|
1688
|
-
|
|
1726
|
+
Ve as j,
|
|
1689
1727
|
L as k,
|
|
1690
|
-
|
|
1728
|
+
De as p,
|
|
1691
1729
|
w as r,
|
|
1692
|
-
|
|
1730
|
+
oe as s,
|
|
1693
1731
|
W as t
|
|
1694
1732
|
};
|