@wral/hsot-data 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -2
- package/dist/client.mjs +49 -0
- package/dist/define.mjs +1 -1
- package/dist/define.standalone.js +536 -508
- package/dist/{hsot-brackets-D5cwGage.js → hsot-brackets-Cc0zj07F.js} +537 -555
- package/dist/index.mjs +16 -15
- package/package.json +2 -1
|
@@ -1,70 +1,33 @@
|
|
|
1
1
|
import { LitElement as ie, html as n, css as $, nothing as p, svg as J } from "lit";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const e = Object.entries(a).filter(([, s]) => s != null && s !== "");
|
|
5
|
-
if (!e.length) return "";
|
|
6
|
-
const t = new URLSearchParams();
|
|
7
|
-
return e.forEach(([s, o]) => t.set(s, String(o))), `?${t.toString()}`;
|
|
8
|
-
}
|
|
9
|
-
function we({ baseUrl: a, token: e = "", fetchFn: t } = {}) {
|
|
10
|
-
if (!a) throw new Error("createClient requires a baseUrl");
|
|
11
|
-
const s = a.replace(/\/+$/, ""), o = t || ((...i) => fetch(...i));
|
|
12
|
-
async function r(i) {
|
|
13
|
-
const h = { Accept: "application/json" };
|
|
14
|
-
e && (h.Authorization = `Bearer ${e}`);
|
|
15
|
-
const c = await o(`${s}${i}`, { headers: h });
|
|
16
|
-
if (!c.ok) {
|
|
17
|
-
const d = new Error(`api-hsot ${c.status} on ${i}`);
|
|
18
|
-
throw d.status = c.status, d;
|
|
19
|
-
}
|
|
20
|
-
return c.json();
|
|
21
|
-
}
|
|
22
|
-
async function l(i, h = {}) {
|
|
23
|
-
const c = [];
|
|
24
|
-
let d = null;
|
|
25
|
-
for (let m = 0; m < ye; m += 1) {
|
|
26
|
-
const f = $e(d ? { ...h, cursor: d } : h), u = await r(`${i}${f}`);
|
|
27
|
-
if (c.push(...u.items || []), d = u.nextCursor || null, !d) break;
|
|
28
|
-
}
|
|
29
|
-
return { items: c, total: c.length, nextCursor: null };
|
|
30
|
-
}
|
|
31
|
-
return {
|
|
32
|
-
listSchools: (i) => l("/schools", i),
|
|
33
|
-
getSchool: (i) => r(`/schools/${i}`),
|
|
34
|
-
listTeams: (i) => l("/teams", i),
|
|
35
|
-
getTeam: (i) => r(`/teams/${i}`),
|
|
36
|
-
listConferences: (i) => l("/conferences", i),
|
|
37
|
-
listPlayers: (i) => l("/players", i),
|
|
38
|
-
listRosters: (i) => l("/rosters", i),
|
|
39
|
-
listGames: (i) => l("/games", i),
|
|
40
|
-
getGame: (i) => r(`/games/${i}`),
|
|
41
|
-
listTournaments: (i) => l("/tournaments", i),
|
|
42
|
-
listSeedings: (i, h) => l(`/tournaments/${i}/seedings`, h),
|
|
43
|
-
listEdges: (i, h) => l(`/tournaments/${i}/edges`, h),
|
|
44
|
-
listRankings: (i) => l("/rankings", i),
|
|
45
|
-
listSports: () => r("/sports")
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
const j = {
|
|
2
|
+
import { createClient as $e } from "./client.mjs";
|
|
3
|
+
const A = {
|
|
49
4
|
game: "/{sport}/game/{id}/",
|
|
50
5
|
school: "/school/{id}/",
|
|
51
|
-
section: "/{sport}/{view}/"
|
|
6
|
+
section: "/{sport}/{view}/",
|
|
7
|
+
// The "Report a Score" page; {id} is the game being reported on, and
|
|
8
|
+
// reportHref() drops the parameter when there is none.
|
|
9
|
+
report: "/report-a-score/?game={id}"
|
|
52
10
|
};
|
|
53
11
|
function g(a, e) {
|
|
54
12
|
return String(a).replace(/\{(\w+)\}/g, (t, s) => e[s] !== void 0 && e[s] !== null ? String(e[s]) : t);
|
|
55
13
|
}
|
|
56
14
|
function z(a) {
|
|
57
15
|
return {
|
|
58
|
-
game: a.getAttribute("game-href") ||
|
|
59
|
-
school: a.getAttribute("school-href") ||
|
|
60
|
-
section: a.getAttribute("section-href") ||
|
|
16
|
+
game: a.getAttribute("game-href") || A.game,
|
|
17
|
+
school: a.getAttribute("school-href") || A.school,
|
|
18
|
+
section: a.getAttribute("section-href") || A.section,
|
|
19
|
+
report: a.getAttribute("report-href") || A.report
|
|
61
20
|
};
|
|
62
21
|
}
|
|
22
|
+
function le(a, e = "") {
|
|
23
|
+
const t = g(a.report || A.report, { id: e || "" });
|
|
24
|
+
return e ? t : t.replace(/([?&])game=(?=&|$)/, "$1").replace(/[?&]$/, "").replace(/\?&/, "?");
|
|
25
|
+
}
|
|
63
26
|
const B = (a) => a ? a.charAt(0).toUpperCase() + a.slice(1) : "";
|
|
64
27
|
function w(a, e) {
|
|
65
28
|
if (!a) return "TBD";
|
|
66
|
-
const [t, s,
|
|
67
|
-
return !t || !s || !
|
|
29
|
+
const [t, s, r] = String(a).split("-").map(Number);
|
|
30
|
+
return !t || !s || !r ? "TBD" : new Date(t, s - 1, r).toLocaleDateString("en-US", e || { weekday: "short", month: "short", day: "numeric" });
|
|
68
31
|
}
|
|
69
32
|
function q(a) {
|
|
70
33
|
if (!a) return "";
|
|
@@ -73,13 +36,13 @@ function q(a) {
|
|
|
73
36
|
const s = e >= 12 ? "PM" : "AM";
|
|
74
37
|
return `${(e + 11) % 12 + 1}:${String(t || 0).padStart(2, "0")} ${s}`;
|
|
75
38
|
}
|
|
76
|
-
function
|
|
39
|
+
function we(a) {
|
|
77
40
|
return a ? `${Math.floor(a / 12)}-${a % 12}` : "·";
|
|
78
41
|
}
|
|
79
|
-
function
|
|
42
|
+
function xe(a) {
|
|
80
43
|
return (Array.isArray(a?.positions) ? a.positions : String(a?.position ?? "").split(/[/,]/)).map((t) => String(t ?? "").trim()).filter(Boolean).join("/");
|
|
81
44
|
}
|
|
82
|
-
function
|
|
45
|
+
function _(a = /* @__PURE__ */ new Date()) {
|
|
83
46
|
const e = a.getFullYear();
|
|
84
47
|
return a.getMonth() >= 6 ? `${e}-${e + 1}` : `${e - 1}-${e}`;
|
|
85
48
|
}
|
|
@@ -87,36 +50,36 @@ function W(a = /* @__PURE__ */ new Date()) {
|
|
|
87
50
|
const e = (t) => String(t).padStart(2, "0");
|
|
88
51
|
return `${a.getFullYear()}-${e(a.getMonth() + 1)}-${e(a.getDate())}`;
|
|
89
52
|
}
|
|
90
|
-
function
|
|
53
|
+
function ke(a, e = W()) {
|
|
91
54
|
const t = [...new Set((a || []).filter(Boolean))].sort();
|
|
92
55
|
if (!t.length || t.includes(e)) return e;
|
|
93
|
-
const s = t.filter((
|
|
56
|
+
const s = t.filter((r) => r < e);
|
|
94
57
|
return s.length ? s[s.length - 1] : t[0];
|
|
95
58
|
}
|
|
96
59
|
function V(a) {
|
|
97
60
|
return a ? (a.abbr || a.name || "?").slice(0, 4).toUpperCase() : "?";
|
|
98
61
|
}
|
|
99
|
-
function
|
|
62
|
+
function M(a) {
|
|
100
63
|
if (!a || !/^#[0-9a-fA-F]{6}$/.test(a)) return "#FFFFFF";
|
|
101
|
-
const e = parseInt(a.slice(1), 16), t = e >> 16 & 255, s = e >> 8 & 255,
|
|
102
|
-
return 0.299 * t + 0.587 * s + 0.114 *
|
|
64
|
+
const e = parseInt(a.slice(1), 16), t = e >> 16 & 255, s = e >> 8 & 255, r = e & 255;
|
|
65
|
+
return 0.299 * t + 0.587 * s + 0.114 * r > 150 ? "#0F1B33" : "#FFFFFF";
|
|
103
66
|
}
|
|
104
|
-
const
|
|
67
|
+
const Se = (a) => {
|
|
105
68
|
const e = ["th", "st", "nd", "rd"], t = a % 100;
|
|
106
69
|
return a + (e[(t - 20) % 10] || e[t] || e[0]);
|
|
107
70
|
};
|
|
108
71
|
function ee(a, e) {
|
|
109
|
-
const t = (
|
|
110
|
-
const l = /^\d+/.exec(String(
|
|
72
|
+
const t = (o) => {
|
|
73
|
+
const l = /^\d+/.exec(String(o ?? ""));
|
|
111
74
|
return l ? Number(l[0]) : null;
|
|
112
|
-
}, s = t(a),
|
|
113
|
-
return s !== null &&
|
|
75
|
+
}, s = t(a), r = t(e);
|
|
76
|
+
return s !== null && r !== null && s !== r ? r - s : s !== null && r === null ? -1 : s === null && r !== null ? 1 : String(a ?? "").localeCompare(String(e ?? ""), "en", { sensitivity: "base" });
|
|
114
77
|
}
|
|
115
|
-
function
|
|
78
|
+
function Ie(a, e) {
|
|
116
79
|
const t = (s) => String(s?.name ?? s ?? "");
|
|
117
80
|
return t(a).localeCompare(t(e), "en", { numeric: !0, sensitivity: "base" });
|
|
118
81
|
}
|
|
119
|
-
function
|
|
82
|
+
function ce(a) {
|
|
120
83
|
if (a.state === "live") {
|
|
121
84
|
const e = [a.period, a.clock].filter(Boolean).join(" ");
|
|
122
85
|
return { kind: "live", label: e ? `Live · ${e}` : "Live" };
|
|
@@ -127,35 +90,35 @@ function le(a) {
|
|
|
127
90
|
}
|
|
128
91
|
return a.state === "postponed" ? { kind: "warn", label: "Postponed" } : a.state === "canceled" ? { kind: "warn", label: "Canceled" } : { kind: "sched", label: `${w(a.date, { month: "short", day: "numeric" })} · ${q(a.time)}`.replace(/ · $/, "") };
|
|
129
92
|
}
|
|
130
|
-
const
|
|
93
|
+
const Te = /* @__PURE__ */ new Set(["game", "story", "page", "forum", "video", "gallery"]);
|
|
131
94
|
function S(a) {
|
|
132
95
|
let e = String(a || "").replace(/^[a-z][a-z0-9+.-]*:\/\/[^/#?]*/i, "");
|
|
133
96
|
const t = e.indexOf("#");
|
|
134
97
|
let s = "";
|
|
135
98
|
t !== -1 && (s = e.slice(t).split("?")[0], e = e.slice(0, t));
|
|
136
|
-
let
|
|
137
|
-
return
|
|
99
|
+
let r = e.split("?")[0] + s;
|
|
100
|
+
return r = r.replace(/([^:])\/{2,}/g, "$1/").replace(/^\/{2,}/, "/"), r = r.replace(/^\/(?=#)/, ""), r.length > 1 && (r = r.replace(/\/+$/, "")), r.toLowerCase();
|
|
138
101
|
}
|
|
139
|
-
function
|
|
102
|
+
function de() {
|
|
140
103
|
const a = globalThis.location;
|
|
141
104
|
if (!a) return "";
|
|
142
105
|
const e = (a.hash || "").startsWith("#/") ? a.hash : "";
|
|
143
106
|
return S((a.pathname || "") + e);
|
|
144
107
|
}
|
|
145
|
-
function
|
|
108
|
+
function Ce(a, e, t) {
|
|
146
109
|
if (!t) return null;
|
|
147
110
|
const s = S(a);
|
|
148
111
|
if (!s) return null;
|
|
149
|
-
const
|
|
150
|
-
if (s ===
|
|
112
|
+
const r = S(g(e.game, { sport: t, id: "" })), o = S(g(e.school, { id: "" }));
|
|
113
|
+
if (s === r || s.startsWith(`${r}/`) || s === o || s.startsWith(`${o}/`)) return null;
|
|
151
114
|
const l = S(g(e.section, { sport: t, view: "" }));
|
|
152
115
|
if (s === l) return "";
|
|
153
116
|
if (!s.startsWith(`${l}/`)) return null;
|
|
154
|
-
const
|
|
155
|
-
return
|
|
117
|
+
const h = s.slice(l.length + 1), d = h.split("/");
|
|
118
|
+
return d.length > 2 || d.some((i) => !/^[a-z][a-z-]*$/.test(i)) || Te.has(d[0]) ? null : h;
|
|
156
119
|
}
|
|
157
|
-
function
|
|
158
|
-
const s = (l) => g(t.section, { sport: a, view: l }).replace(/([^:])\/{2,}/g, "$1/"),
|
|
120
|
+
function De(a, e, t) {
|
|
121
|
+
const s = (l) => g(t.section, { sport: a, view: l }).replace(/([^:])\/{2,}/g, "$1/"), o = new Set((e || []).map((l) => l && l.gender).filter((l) => l === "boys" || l === "girls")).size === 2 ? [
|
|
159
122
|
{ label: "Boys Standings", href: s("boys/standings") },
|
|
160
123
|
{ label: "Girls Standings", href: s("girls/standings") }
|
|
161
124
|
] : [{ label: "Standings", href: s("standings") }];
|
|
@@ -163,11 +126,11 @@ function Be(a, e, t) {
|
|
|
163
126
|
{ label: `${B(a)} Home`, href: s("") },
|
|
164
127
|
{ label: "Scores/Schedule", href: s("scores") },
|
|
165
128
|
{ label: "Playoff Brackets", href: s("brackets") },
|
|
166
|
-
...
|
|
129
|
+
...o,
|
|
167
130
|
{ label: "Polls & Rankings", href: s("rankings") }
|
|
168
131
|
];
|
|
169
132
|
}
|
|
170
|
-
function
|
|
133
|
+
function Be(a, e = de()) {
|
|
171
134
|
const t = S(e);
|
|
172
135
|
for (const s of a.querySelectorAll(':scope > a[slot="nav"]'))
|
|
173
136
|
t && S(s.getAttribute("href")) === t ? s.setAttribute("aria-current", "page") : s.removeAttribute("aria-current");
|
|
@@ -191,7 +154,7 @@ class y extends ie {
|
|
|
191
154
|
this._client = e, this.isConnected && this.load();
|
|
192
155
|
}
|
|
193
156
|
get client() {
|
|
194
|
-
return this._client ? this._client : this.api ?
|
|
157
|
+
return this._client ? this._client : this.api ? $e({ baseUrl: this.api }) : null;
|
|
195
158
|
}
|
|
196
159
|
connectedCallback() {
|
|
197
160
|
super.connectedCallback(), this._setupInterval();
|
|
@@ -203,7 +166,7 @@ class y extends ie {
|
|
|
203
166
|
this.load();
|
|
204
167
|
}
|
|
205
168
|
updated(e) {
|
|
206
|
-
e.has("api") && e.get("api") !== void 0 && e.get("api") !== this.api && this.load(), e.has("refreshInterval") && this._setupInterval(),
|
|
169
|
+
e.has("api") && e.get("api") !== void 0 && e.get("api") !== this.api && this.load(), e.has("refreshInterval") && this._setupInterval(), Be(this);
|
|
207
170
|
}
|
|
208
171
|
async load() {
|
|
209
172
|
const e = this.client;
|
|
@@ -238,7 +201,7 @@ class y extends ie {
|
|
|
238
201
|
return n``;
|
|
239
202
|
}
|
|
240
203
|
}
|
|
241
|
-
const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])),
|
|
204
|
+
const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), Fe = $`
|
|
242
205
|
:host {
|
|
243
206
|
--hsot-red: var(--color-red, #D1232A);
|
|
244
207
|
--hsot-red-deep: var(--color-red-dark, #951C21);
|
|
@@ -276,7 +239,7 @@ const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ze = $`
|
|
|
276
239
|
outline-offset: 1px;
|
|
277
240
|
}
|
|
278
241
|
.mut { color: var(--hsot-gray-5); }
|
|
279
|
-
`,
|
|
242
|
+
`, ze = $`
|
|
280
243
|
.band { background: var(--hsot-white); color: var(--hsot-black); }
|
|
281
244
|
.band .inner { max-width: 1366px; margin: 0 auto; padding: 1.1rem 1.25rem 0; }
|
|
282
245
|
.band h1, .band h2.bandtitle {
|
|
@@ -325,7 +288,7 @@ const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ze = $`
|
|
|
325
288
|
@media (max-width: 720px) {
|
|
326
289
|
.band h1, .band h2.bandtitle, .band.section h1, .band.section h2.bandtitle { font-size: 1.8rem; }
|
|
327
290
|
}
|
|
328
|
-
`,
|
|
291
|
+
`, Pe = $`
|
|
329
292
|
.view { max-width: 1366px; margin: 0 auto; padding: 1.25rem; box-sizing: border-box; }
|
|
330
293
|
/* Optional right rail (slot="rail" light-DOM children): a divided 300px
|
|
331
294
|
column on desktop, stacked under the view content on smaller screens. */
|
|
@@ -389,7 +352,7 @@ const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ze = $`
|
|
|
389
352
|
.error { padding: 1.2rem 1rem; color: var(--hsot-red-deep); font-size: 0.9rem; }
|
|
390
353
|
.note { font-size: 0.8125rem; color: var(--hsot-gray-5); margin: 0.6rem 0 0; }
|
|
391
354
|
.loading { padding: 1.2rem; color: var(--hsot-gray-5); font-family: var(--hsot-heading-font); }
|
|
392
|
-
`,
|
|
355
|
+
`, Ae = $`
|
|
393
356
|
.pill {
|
|
394
357
|
display: inline-block; font-family: var(--hsot-heading-font); font-weight: 700;
|
|
395
358
|
font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.04em;
|
|
@@ -404,7 +367,7 @@ const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ze = $`
|
|
|
404
367
|
.pill.champ { background: var(--hsot-straw); color: #6b5900; }
|
|
405
368
|
@keyframes hsot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
|
|
406
369
|
@media (prefers-reduced-motion: reduce) { .pill.live { animation: none; } }
|
|
407
|
-
`,
|
|
370
|
+
`, Ee = $`
|
|
408
371
|
.tablewrap { overflow-x: auto; }
|
|
409
372
|
table.data { font-family: var(--hsot-heading-font); font-size: 14px; border-collapse: collapse; width: 100%; }
|
|
410
373
|
table.data th {
|
|
@@ -422,7 +385,7 @@ const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ze = $`
|
|
|
422
385
|
table.data tbody tr.rowlink:hover { background: var(--hsot-gray-1); }
|
|
423
386
|
table.data td.teamcell a { color: inherit; text-decoration: none; font-weight: 500; }
|
|
424
387
|
table.data td.teamcell a:hover { text-decoration: underline; }
|
|
425
|
-
`,
|
|
388
|
+
`, _e = $`
|
|
426
389
|
.swatch {
|
|
427
390
|
display: inline-flex; align-items: center; justify-content: center;
|
|
428
391
|
width: 26px; height: 26px; border-radius: 50%;
|
|
@@ -496,29 +459,29 @@ const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ze = $`
|
|
|
496
459
|
.gamelist .ff { color: var(--hsot-gray-5); font-size: 0.78rem; font-style: italic; }
|
|
497
460
|
.gamelist .where { color: var(--hsot-gray-5); font-size: 0.78rem; }
|
|
498
461
|
.gamelist a.box { font-size: 0.78rem; }
|
|
499
|
-
`, P = [ze, Pe, Ae, Ee, _e,
|
|
500
|
-
function
|
|
462
|
+
`, P = [Fe, ze, Pe, Ae, Ee, _e, Ne];
|
|
463
|
+
function H(a) {
|
|
501
464
|
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";
|
|
502
465
|
}
|
|
503
|
-
function
|
|
466
|
+
function Re(a) {
|
|
504
467
|
return a && (a.forfeit === "home" || a.forfeit === "away") ? a.forfeit : null;
|
|
505
468
|
}
|
|
506
|
-
function
|
|
507
|
-
const t = {}, s = (
|
|
508
|
-
for (const
|
|
509
|
-
const l =
|
|
510
|
-
for (const
|
|
511
|
-
const
|
|
512
|
-
if (!
|
|
513
|
-
const
|
|
514
|
-
|
|
469
|
+
function N(a, e) {
|
|
470
|
+
const t = {}, s = (o) => (t[o] = t[o] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] }, t[o]), r = a.filter((o) => o.state === "final" && o.gameType !== "scrimmage" && (!e || o.date <= e)).sort((o, l) => String(o.date).localeCompare(String(l.date)));
|
|
471
|
+
for (const o of r) {
|
|
472
|
+
const l = H(o), h = o.gameType === "conference";
|
|
473
|
+
for (const d of ["home", "away"]) {
|
|
474
|
+
const i = d === "home" ? o.homeTeamId : o.awayTeamId;
|
|
475
|
+
if (!i) continue;
|
|
476
|
+
const c = s(i), m = d === "home" ? o.homeScore : o.awayScore, f = d === "home" ? o.awayScore : o.homeScore;
|
|
477
|
+
c.pf += m, c.pa += f;
|
|
515
478
|
let u = "T";
|
|
516
|
-
l === "tie" ? (
|
|
479
|
+
l === "tie" ? (c.t += 1, h && (c.ct += 1)) : l === d ? (c.w += 1, h && (c.cw += 1), u = "W") : (c.l += 1, h && (c.cl += 1), u = "L"), c.results.push({ gameId: o.id, date: o.date, mark: u, my: m, their: f, opp: d === "home" ? o.awayTeamId : o.homeTeamId, conf: h });
|
|
517
480
|
}
|
|
518
481
|
}
|
|
519
482
|
return t;
|
|
520
483
|
}
|
|
521
|
-
function
|
|
484
|
+
function U(a) {
|
|
522
485
|
if (!a || !a.length) return "";
|
|
523
486
|
const e = a[a.length - 1].mark;
|
|
524
487
|
let t = 0;
|
|
@@ -531,10 +494,10 @@ const te = (a, e, t) => {
|
|
|
531
494
|
}, se = (a) => a.toFixed(3).replace("0.", ".");
|
|
532
495
|
function k(a, e = !1) {
|
|
533
496
|
if (!a) return "0-0";
|
|
534
|
-
const t = e ? a.cw : a.w, s = e ? a.cl : a.l,
|
|
535
|
-
return `${t}-${s}${
|
|
497
|
+
const t = e ? a.cw : a.w, s = e ? a.cl : a.l, r = e ? a.ct : a.t;
|
|
498
|
+
return `${t}-${s}${r ? `-${r}` : ""}`;
|
|
536
499
|
}
|
|
537
|
-
function
|
|
500
|
+
function he(a, e) {
|
|
538
501
|
return a.map((t) => {
|
|
539
502
|
const s = e[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] };
|
|
540
503
|
return { team: t, rec: s, confPct: te(s.cw, s.cl, s.ct), overallPct: te(s.w, s.l, s.t) };
|
|
@@ -548,68 +511,68 @@ function ae(a, e) {
|
|
|
548
511
|
return t && t.results.length ? t.results[t.results.length - 1] : null;
|
|
549
512
|
}
|
|
550
513
|
function $t(a, e, t, s = "") {
|
|
551
|
-
let
|
|
552
|
-
for (const
|
|
553
|
-
|
|
554
|
-
return
|
|
555
|
-
}
|
|
556
|
-
function
|
|
557
|
-
const
|
|
558
|
-
if (!
|
|
514
|
+
let r = null;
|
|
515
|
+
for (const o of a || [])
|
|
516
|
+
o.sport === e && (t && o.effectiveDate > t || s && o.gender && o.gender !== s || (!r || o.effectiveDate > r.effectiveDate) && (r = o));
|
|
517
|
+
return r;
|
|
518
|
+
}
|
|
519
|
+
function K(a, e, t, s, r) {
|
|
520
|
+
const o = e[t];
|
|
521
|
+
if (!o) return null;
|
|
559
522
|
const l = /* @__PURE__ */ new Map();
|
|
560
|
-
for (const
|
|
561
|
-
if (
|
|
562
|
-
const
|
|
563
|
-
(!
|
|
523
|
+
for (const d of a || []) {
|
|
524
|
+
if (d.sport !== s || r && d.effectiveDate > r || d.gender && o.gender !== d.gender && o.gender !== "coed") continue;
|
|
525
|
+
const i = d.gender || "", c = l.get(i);
|
|
526
|
+
(!c || d.effectiveDate > c.effectiveDate) && l.set(i, d);
|
|
564
527
|
}
|
|
565
|
-
let
|
|
566
|
-
for (const
|
|
567
|
-
const
|
|
568
|
-
|
|
528
|
+
let h = null;
|
|
529
|
+
for (const d of l.values()) {
|
|
530
|
+
const i = (d.teamIds || []).indexOf(t);
|
|
531
|
+
i !== -1 && (!h || d.effectiveDate > h.effectiveDate) && (h = { poll: d, rank: i + 1 });
|
|
569
532
|
}
|
|
570
|
-
return
|
|
533
|
+
return h ? h.rank : null;
|
|
571
534
|
}
|
|
572
|
-
function
|
|
535
|
+
function Me(a, e, t) {
|
|
573
536
|
if (!a) return { kind: "none", delta: 0 };
|
|
574
537
|
const s = (a.teamIds || []).indexOf(t) + 1;
|
|
575
538
|
if (!s) return { kind: "none", delta: 0 };
|
|
576
539
|
if (!e) return { kind: "same", delta: 0 };
|
|
577
|
-
const
|
|
578
|
-
if (!
|
|
579
|
-
const
|
|
580
|
-
return
|
|
540
|
+
const r = (e.teamIds || []).indexOf(t) + 1;
|
|
541
|
+
if (!r) return { kind: "new", delta: 0 };
|
|
542
|
+
const o = r - s;
|
|
543
|
+
return o > 0 ? { kind: "up", delta: o } : o < 0 ? { kind: "down", delta: -o } : { kind: "same", delta: 0 };
|
|
581
544
|
}
|
|
582
|
-
function
|
|
545
|
+
function Le(a) {
|
|
583
546
|
return /^https?:\/\//i.test(String(a || ""));
|
|
584
547
|
}
|
|
585
|
-
function
|
|
586
|
-
if (!
|
|
548
|
+
function me(a, { w: e, h: t } = {}) {
|
|
549
|
+
if (!Le(a)) return "";
|
|
587
550
|
const s = [];
|
|
588
551
|
e && s.push(`w=${Math.max(1, Math.round(e))}`), t && s.push(`h=${Math.max(1, Math.round(t))}`), s.push("f=webp");
|
|
589
|
-
const
|
|
590
|
-
return `${a}${
|
|
552
|
+
const r = a.includes("?") ? "&" : "?";
|
|
553
|
+
return `${a}${r}${s.join("&")}`;
|
|
591
554
|
}
|
|
592
|
-
function
|
|
555
|
+
function L(a, e) {
|
|
593
556
|
const t = e * 2;
|
|
594
|
-
return
|
|
557
|
+
return me(a?.logoAssetId, { w: t, h: t });
|
|
595
558
|
}
|
|
596
|
-
function
|
|
597
|
-
return
|
|
559
|
+
function Ge(a, e) {
|
|
560
|
+
return me(a?.photoAssetId, { w: e * 2 });
|
|
598
561
|
}
|
|
599
|
-
function
|
|
600
|
-
const
|
|
562
|
+
function j(a, e, { title: t, sub: s, teams: r }) {
|
|
563
|
+
const o = de(), h = !!a.querySelector(':scope > a[slot="nav"]') || Ce(o, e.hrefs, e.sport) !== null;
|
|
601
564
|
return n`
|
|
602
565
|
<div class="band section">
|
|
603
566
|
<div class="inner">
|
|
604
567
|
<h1>${t}</h1>
|
|
605
568
|
${s ? n`<p class="sub">${s}</p>` : p}
|
|
606
569
|
</div>
|
|
607
|
-
${
|
|
570
|
+
${h ? n`
|
|
608
571
|
<nav class="sectionnav" aria-label="${B(e.sport)} section">
|
|
609
572
|
<div class="navrow">
|
|
610
573
|
<slot name="nav">
|
|
611
|
-
${
|
|
612
|
-
aria-current=${
|
|
574
|
+
${De(e.sport, r, e.hrefs).map((d) => n`<a href=${d.href}
|
|
575
|
+
aria-current=${o && S(d.href) === o ? "page" : p}>${d.label}</a>`)}
|
|
613
576
|
</slot>
|
|
614
577
|
</div>
|
|
615
578
|
</nav>` : p}
|
|
@@ -619,34 +582,34 @@ function U(a, e, { title: t, sub: s, teams: o }) {
|
|
|
619
582
|
const I = (a, e) => {
|
|
620
583
|
const t = a.teamsById[e];
|
|
621
584
|
return t ? a.schoolsById[t.schoolId] : null;
|
|
622
|
-
}, F = (a, e) => I(a, e)?.name || "TBD",
|
|
585
|
+
}, F = (a, e) => I(a, e)?.name || "TBD", G = (a, e) => I(a, e)?.abbr || "TBD";
|
|
623
586
|
function T(a, e = 26) {
|
|
624
587
|
if (!a) return p;
|
|
625
|
-
const t =
|
|
588
|
+
const t = L(a, e);
|
|
626
589
|
if (t)
|
|
627
590
|
return n`<img class="swatch logo" aria-hidden="true" alt="" loading="lazy"
|
|
628
591
|
src=${t} style="width:${e}px;height:${e}px" />`;
|
|
629
|
-
const s = a.colorPrimary || "#030711",
|
|
592
|
+
const s = a.colorPrimary || "#030711", r = M(s);
|
|
630
593
|
return n`<span class="swatch" aria-hidden="true"
|
|
631
|
-
style="width:${e}px;height:${e}px;background:${s};color:${
|
|
594
|
+
style="width:${e}px;height:${e}px;background:${s};color:${r};font-size:${Math.max(8, e * 0.28)}px"
|
|
632
595
|
>${V(a)}</span>`;
|
|
633
596
|
}
|
|
634
|
-
function
|
|
635
|
-
const s =
|
|
597
|
+
function Q(a, e, t) {
|
|
598
|
+
const s = K(a.rankings, a.teamsById, e, a.sport, t);
|
|
636
599
|
return s ? n`<span class="rankbadge">#${s}</span>` : p;
|
|
637
600
|
}
|
|
638
|
-
function
|
|
601
|
+
function O(a, e, t) {
|
|
639
602
|
const s = I(a, e);
|
|
640
|
-
return s ? n`${
|
|
603
|
+
return s ? n`${Q(a, e, t)}<a href=${g(a.hrefs.school, { id: s.id })}>${s.name}</a>` : n`<span class="mut">TBD</span>`;
|
|
641
604
|
}
|
|
642
605
|
function X(a, e, t = 5) {
|
|
643
606
|
const s = a.records[e];
|
|
644
607
|
if (!s || !s.results.length) return n`<span class="mut">·</span>`;
|
|
645
|
-
const
|
|
646
|
-
return n`<span class="dots" role="img" aria-label="last ${
|
|
647
|
-
${
|
|
648
|
-
title="${
|
|
649
|
-
href=${g(a.hrefs.game, { sport: a.sport, id:
|
|
608
|
+
const r = s.results.slice(-1 * t);
|
|
609
|
+
return n`<span class="dots" role="img" aria-label="last ${r.length} results">
|
|
610
|
+
${r.map((o) => n`<a class="dot ${o.mark}"
|
|
611
|
+
title="${o.mark} ${o.my}-${o.their} vs ${F(a, o.opp)}"
|
|
612
|
+
href=${g(a.hrefs.game, { sport: a.sport, id: o.gameId })}>${o.mark}</a>`)}
|
|
650
613
|
</span>`;
|
|
651
614
|
}
|
|
652
615
|
function C(a, e) {
|
|
@@ -660,16 +623,16 @@ function D(a) {
|
|
|
660
623
|
const e = n`<img src=${a.promoImage} alt=${a.promoAlt || "Sponsor"}>`;
|
|
661
624
|
return n`<div class="promo">${a.promoHref ? n`<a href=${a.promoHref} target="_blank" rel="sponsored noopener">${e}</a>` : e}</div>`;
|
|
662
625
|
}
|
|
663
|
-
function
|
|
664
|
-
const e =
|
|
626
|
+
function E(a) {
|
|
627
|
+
const e = ce(a);
|
|
665
628
|
return n`<span class="pill ${e.kind}">${e.label}</span>`;
|
|
666
629
|
}
|
|
667
|
-
function
|
|
630
|
+
function pe(a, e, t) {
|
|
668
631
|
if (!e) return n`<span class="mut">·</span>`;
|
|
669
|
-
const s = e.homeTeamId === t ? e.awayTeamId : e.homeTeamId,
|
|
670
|
-
return n`${e.state === "live" ? n`<span class="pill live">Live</span> ` : n`${w(e.date, { month: "numeric", day: "numeric" })} `}${
|
|
632
|
+
const s = e.homeTeamId === t ? e.awayTeamId : e.homeTeamId, r = e.homeTeamId === t ? "vs" : "at";
|
|
633
|
+
return n`${e.state === "live" ? n`<span class="pill live">Live</span> ` : n`${w(e.date, { month: "numeric", day: "numeric" })} `}${r} ${G(a, s)}`;
|
|
671
634
|
}
|
|
672
|
-
class
|
|
635
|
+
class Oe extends y {
|
|
673
636
|
static styles = P;
|
|
674
637
|
static properties = {
|
|
675
638
|
...y.properties,
|
|
@@ -688,44 +651,44 @@ class He extends y {
|
|
|
688
651
|
this._datePinned = !!this.date;
|
|
689
652
|
}
|
|
690
653
|
async fetchData(e) {
|
|
691
|
-
const t = this.season ||
|
|
654
|
+
const t = this.season || _(), [s, r, o, l, h] = await Promise.all([
|
|
692
655
|
e.listSchools(),
|
|
693
656
|
e.listTeams({ sport: this.sport }),
|
|
694
657
|
e.listConferences(),
|
|
695
658
|
e.listGames({ sport: this.sport, season: t }),
|
|
696
659
|
e.listRankings({ sport: this.sport })
|
|
697
660
|
]);
|
|
698
|
-
return this._datePinned || (this.date =
|
|
661
|
+
return this._datePinned || (this.date = ke(l.items.map((d) => d.date)), this._datePinned = !0), {
|
|
699
662
|
season: t,
|
|
700
663
|
schools: s.items,
|
|
701
|
-
teams:
|
|
702
|
-
conferences:
|
|
664
|
+
teams: r.items,
|
|
665
|
+
conferences: o.items,
|
|
703
666
|
games: l.items,
|
|
704
|
-
rankings:
|
|
667
|
+
rankings: h.items
|
|
705
668
|
};
|
|
706
669
|
}
|
|
707
670
|
get ctx() {
|
|
708
671
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
709
672
|
teamsById: b(this.data.teams),
|
|
710
673
|
schoolsById: b(this.data.schools),
|
|
711
|
-
records:
|
|
674
|
+
records: N(this.data.games),
|
|
712
675
|
rankings: this.data.rankings,
|
|
713
676
|
hrefs: z(this),
|
|
714
677
|
sport: this.sport
|
|
715
678
|
}, this._ctxData = this.data), this._ctx;
|
|
716
679
|
}
|
|
717
680
|
renderView() {
|
|
718
|
-
const e = this.ctx, t = b(this.data.conferences), s = [...new Set(this.data.games.map((
|
|
719
|
-
const
|
|
720
|
-
return
|
|
721
|
-
}, l = this.data.games.filter((
|
|
722
|
-
l.sort((
|
|
723
|
-
const
|
|
724
|
-
return l.forEach((
|
|
725
|
-
const
|
|
726
|
-
|
|
681
|
+
const e = this.ctx, t = b(this.data.conferences), s = [...new Set(this.data.games.map((i) => i.date).filter(Boolean))].sort(), r = Number.MAX_SAFE_INTEGER, o = (i) => {
|
|
682
|
+
const c = [i.awayTeamId, i.homeTeamId].map((m) => K(e.rankings, e.teamsById, m, this.sport, i.date)).filter(Boolean);
|
|
683
|
+
return c.length ? Math.min(...c) : r;
|
|
684
|
+
}, l = this.data.games.filter((i) => i.date === this.date), h = new Map(l.map((i) => [i, o(i)]));
|
|
685
|
+
l.sort((i, c) => (i.state === "live" ? 0 : 1) - (c.state === "live" ? 0 : 1) || h.get(i) - h.get(c));
|
|
686
|
+
const d = /* @__PURE__ */ new Map();
|
|
687
|
+
return l.forEach((i) => {
|
|
688
|
+
const c = i.gameType === "conference" && i.conferenceId ? t[i.conferenceId]?.name || "Conference" : i.gameType === "playoff" ? "Playoffs" : i.gameType === "scrimmage" ? "Scrimmages" : "Nonconference";
|
|
689
|
+
d.has(c) || d.set(c, []), d.get(c).push(i);
|
|
727
690
|
}), n`
|
|
728
|
-
${
|
|
691
|
+
${j(this, e, {
|
|
729
692
|
title: n`${B(this.sport)} scores & schedules`,
|
|
730
693
|
sub: n`${w(this.date, { weekday: "long", month: "long", day: "numeric", year: "numeric" })} · ${l.length} games`,
|
|
731
694
|
teams: this.data.teams
|
|
@@ -734,11 +697,11 @@ class He extends y {
|
|
|
734
697
|
${D(this)}
|
|
735
698
|
<div class="toolbar">
|
|
736
699
|
<label class="asof" for="datesel">Date</label>
|
|
737
|
-
<select id="datesel" @change=${(
|
|
738
|
-
this.date =
|
|
700
|
+
<select id="datesel" @change=${(i) => {
|
|
701
|
+
this.date = i.target.value;
|
|
739
702
|
}}>
|
|
740
|
-
${(s.includes(this.date) ? s : [...s, this.date].sort()).map((
|
|
741
|
-
${w(
|
|
703
|
+
${(s.includes(this.date) ? s : [...s, this.date].sort()).map((i) => n`<option value=${i} ?selected=${i === this.date}>
|
|
704
|
+
${w(i, { weekday: "short", month: "short", day: "numeric" })}${i === W() ? " · today" : ""}
|
|
742
705
|
</option>`)}
|
|
743
706
|
</select>
|
|
744
707
|
<button class="chip" ?disabled=${s.indexOf(this.date) <= 0}
|
|
@@ -750,13 +713,13 @@ class He extends y {
|
|
|
750
713
|
this.date = s[s.indexOf(this.date) + 1];
|
|
751
714
|
}}>Next →</button>
|
|
752
715
|
<span class="spacer"></span>
|
|
753
|
-
<span class="asof">Live games first · report a score to see it update here</span>
|
|
716
|
+
<span class="asof">Live games first · <a href=${le(e.hrefs)}>report a score</a> to see it update here</span>
|
|
754
717
|
</div>
|
|
755
718
|
${l.length ? p : n`<p class="empty">No ${this.sport} games on this date.</p>`}
|
|
756
|
-
${[...
|
|
757
|
-
<div class="section-title">${
|
|
719
|
+
${[...d.entries()].map(([i, c]) => n`
|
|
720
|
+
<div class="section-title">${i}</div>
|
|
758
721
|
<div class="card"><ul class="gamelist">
|
|
759
|
-
${
|
|
722
|
+
${c.map((m) => this.renderGame(e, m))}
|
|
760
723
|
</ul></div>
|
|
761
724
|
`)}
|
|
762
725
|
`)}
|
|
@@ -766,12 +729,12 @@ class He extends y {
|
|
|
766
729
|
// a lone score column on the far right read as detached from the teams).
|
|
767
730
|
// Scheduled games carry their start time on the status pill alone.
|
|
768
731
|
renderGame(e, t) {
|
|
769
|
-
const s = t.state === "final" || t.state === "live",
|
|
732
|
+
const s = t.state === "final" || t.state === "live", r = (l, h, d = p) => n`<span class="side">${O(e, l, t.date)}${s ? n`<span class="score">${h}</span>` : p}${d}</span>`, o = Re(t);
|
|
770
733
|
return n`
|
|
771
734
|
<li>
|
|
772
|
-
${
|
|
773
|
-
<span class="opp matchup">${
|
|
774
|
-
${
|
|
735
|
+
${E(t)}
|
|
736
|
+
<span class="opp matchup">${r(t.awayTeamId, t.awayScore, n`<span class="at">at</span>`)}${r(t.homeTeamId, t.homeScore)}</span>
|
|
737
|
+
${o ? n`<span class="ff">${F(e, o === "home" ? t.homeTeamId : t.awayTeamId)} forfeited</span>` : p}
|
|
775
738
|
<span class="where">${t.venue || ""}</span>
|
|
776
739
|
${t.broadcast ? n`<span class="pill class">${t.broadcast}</span>` : p}
|
|
777
740
|
<a class="box" href=${g(e.hrefs.game, { sport: this.sport, id: t.id })}>Box score →</a>
|
|
@@ -779,8 +742,8 @@ class He extends y {
|
|
|
779
742
|
`;
|
|
780
743
|
}
|
|
781
744
|
}
|
|
782
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores",
|
|
783
|
-
class
|
|
745
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores", Oe);
|
|
746
|
+
class He extends y {
|
|
784
747
|
static styles = P;
|
|
785
748
|
static properties = {
|
|
786
749
|
...y.properties,
|
|
@@ -793,7 +756,7 @@ class Ue extends y {
|
|
|
793
756
|
super(), this.sport = "football", this.season = "", this.classFilter = "All", this.query = "";
|
|
794
757
|
}
|
|
795
758
|
async fetchData(e) {
|
|
796
|
-
const t = this.season ||
|
|
759
|
+
const t = this.season || _(), [s, r, o, l, h] = await Promise.all([
|
|
797
760
|
e.listConferences({ active: !0 }),
|
|
798
761
|
e.listSchools(),
|
|
799
762
|
e.listTeams({ sport: this.sport }),
|
|
@@ -803,26 +766,26 @@ class Ue extends y {
|
|
|
803
766
|
return {
|
|
804
767
|
season: t,
|
|
805
768
|
conferences: s.items,
|
|
806
|
-
schools:
|
|
807
|
-
teams:
|
|
769
|
+
schools: r.items,
|
|
770
|
+
teams: o.items,
|
|
808
771
|
games: l.items,
|
|
809
|
-
rankings:
|
|
772
|
+
rankings: h.items
|
|
810
773
|
};
|
|
811
774
|
}
|
|
812
775
|
get ctx() {
|
|
813
776
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
814
777
|
teamsById: b(this.data.teams),
|
|
815
778
|
schoolsById: b(this.data.schools),
|
|
816
|
-
records:
|
|
779
|
+
records: N(this.data.games),
|
|
817
780
|
rankings: this.data.rankings,
|
|
818
781
|
hrefs: z(this),
|
|
819
782
|
sport: this.sport
|
|
820
783
|
}, this._ctxData = this.data), this._ctx;
|
|
821
784
|
}
|
|
822
785
|
renderView() {
|
|
823
|
-
const e = this.ctx, t = ["All", ...[...new Set(this.data.conferences.flatMap((
|
|
786
|
+
const e = this.ctx, t = ["All", ...[...new Set(this.data.conferences.flatMap((r) => r.classifications || []))].sort(ee)].slice(0, 9), s = this.data.conferences.filter((r) => r.active !== !1).filter((r) => this.classFilter === "All" || (r.classifications || []).includes(this.classFilter)).sort(Ie);
|
|
824
787
|
return n`
|
|
825
|
-
${
|
|
788
|
+
${j(this, e, {
|
|
826
789
|
title: n`${B(this.sport)} standings`,
|
|
827
790
|
sub: n`${this.data.season} season · every conference, computed live from reported results`,
|
|
828
791
|
teams: this.data.teams
|
|
@@ -831,32 +794,32 @@ class Ue extends y {
|
|
|
831
794
|
${D(this)}
|
|
832
795
|
<div class="toolbar">
|
|
833
796
|
<div role="group" aria-label="Classification filter">
|
|
834
|
-
${t.map((
|
|
797
|
+
${t.map((r) => n`<button class="chip ${this.classFilter === r ? "on" : ""}"
|
|
835
798
|
@click=${() => {
|
|
836
|
-
this.classFilter =
|
|
837
|
-
}}>${
|
|
799
|
+
this.classFilter = r;
|
|
800
|
+
}}>${r}</button>`)}
|
|
838
801
|
</div>
|
|
839
802
|
<input type="search" placeholder="Find a school…" aria-label="Find a school"
|
|
840
|
-
.value=${this.query} @input=${(
|
|
841
|
-
this.query =
|
|
803
|
+
.value=${this.query} @input=${(r) => {
|
|
804
|
+
this.query = r.target.value;
|
|
842
805
|
}}>
|
|
843
806
|
<span class="spacer"></span>
|
|
844
807
|
<span class="asof">Records through ${w(W(), { month: "long", day: "numeric" })} · conference games count toward both records · scrimmages toward neither</span>
|
|
845
808
|
</div>
|
|
846
|
-
${s.map((
|
|
809
|
+
${s.map((r) => this.renderConference(e, r))}
|
|
847
810
|
`)}
|
|
848
811
|
`;
|
|
849
812
|
}
|
|
850
813
|
renderConference(e, t) {
|
|
851
814
|
const s = this.data.teams.filter((l) => l.conferenceId === t.id);
|
|
852
815
|
if (!s.length) return p;
|
|
853
|
-
const
|
|
816
|
+
const r = this.query.trim().toLowerCase(), o = he(s, e.records);
|
|
854
817
|
return n`
|
|
855
818
|
<div class="card">
|
|
856
819
|
<div class="card-head">
|
|
857
820
|
<h2>${t.name}</h2>
|
|
858
821
|
${[...t.classifications || []].sort(ee).map((l) => n`<span class="pill class">${l}</span>`)}
|
|
859
|
-
<span class="meta">${
|
|
822
|
+
<span class="meta">${o.length} teams · membership derives from teams</span>
|
|
860
823
|
</div>
|
|
861
824
|
<div class="tablewrap"><table class="data">
|
|
862
825
|
<thead><tr>
|
|
@@ -865,25 +828,25 @@ class Ue extends y {
|
|
|
865
828
|
<th>Streak</th><th>Last 5</th><th>Next</th>
|
|
866
829
|
</tr></thead>
|
|
867
830
|
<tbody>
|
|
868
|
-
${
|
|
831
|
+
${o.map((l, h) => this.renderRow(e, l, h, r))}
|
|
869
832
|
</tbody>
|
|
870
833
|
</table></div>
|
|
871
834
|
</div>
|
|
872
835
|
`;
|
|
873
836
|
}
|
|
874
|
-
renderRow(e, t, s,
|
|
875
|
-
const
|
|
876
|
-
if (
|
|
877
|
-
const
|
|
837
|
+
renderRow(e, t, s, r) {
|
|
838
|
+
const o = e.schoolsById[t.team.schoolId], l = o?.name || t.team.name || "TBD";
|
|
839
|
+
if (r && !l.toLowerCase().includes(r)) return p;
|
|
840
|
+
const h = t.rec.pf - t.rec.pa, d = Y(this.data.games, t.team.id), i = () => {
|
|
878
841
|
location.href = g(e.hrefs.school, { id: t.team.schoolId });
|
|
879
842
|
};
|
|
880
843
|
return n`
|
|
881
|
-
<tr class="rowlink" @click=${(
|
|
882
|
-
|
|
844
|
+
<tr class="rowlink" @click=${(c) => {
|
|
845
|
+
c.target.closest("a") || i();
|
|
883
846
|
}}>
|
|
884
847
|
<td class="mut">${s + 1}</td>
|
|
885
848
|
<td class="teamcell">
|
|
886
|
-
${T(
|
|
849
|
+
${T(o)}${Q(e, t.team.id, null)}
|
|
887
850
|
<a href=${g(e.hrefs.school, { id: t.team.schoolId })}>${l}</a>
|
|
888
851
|
</td>
|
|
889
852
|
<td class="num">${k(t.rec, !0)}</td>
|
|
@@ -892,16 +855,16 @@ class Ue extends y {
|
|
|
892
855
|
<td class="num">${se(t.overallPct)}</td>
|
|
893
856
|
<td class="num">${t.rec.pf}</td>
|
|
894
857
|
<td class="num">${t.rec.pa}</td>
|
|
895
|
-
<td class="num" style="color:${
|
|
896
|
-
<td>${
|
|
858
|
+
<td class="num" style="color:${h >= 0 ? "var(--hsot-win)" : "var(--hsot-loss)"}">${h > 0 ? "+" : ""}${h}</td>
|
|
859
|
+
<td>${U(t.rec.results) || "·"}</td>
|
|
897
860
|
<td>${X(e, t.team.id)}</td>
|
|
898
|
-
<td>${
|
|
861
|
+
<td>${pe(e, d, t.team.id)}</td>
|
|
899
862
|
</tr>
|
|
900
863
|
`;
|
|
901
864
|
}
|
|
902
865
|
}
|
|
903
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings",
|
|
904
|
-
const
|
|
866
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings", He);
|
|
867
|
+
const Ue = $`
|
|
905
868
|
.hero1 {
|
|
906
869
|
border-radius: var(--hsot-radius-md); color: var(--hsot-white);
|
|
907
870
|
padding: 1.3rem 1.4rem; display: flex; align-items: center; gap: 1.2rem;
|
|
@@ -918,8 +881,8 @@ const je = $`
|
|
|
918
881
|
.delta.new { background: var(--hsot-straw); color: #6b5900; border-radius: var(--hsot-radius-xs); padding: 0.1rem 0.3rem; font-size: 0.7rem; }
|
|
919
882
|
.sparkline { vertical-align: middle; }
|
|
920
883
|
`;
|
|
921
|
-
class
|
|
922
|
-
static styles = [...P,
|
|
884
|
+
class je extends y {
|
|
885
|
+
static styles = [...P, Ue];
|
|
923
886
|
static properties = {
|
|
924
887
|
...y.properties,
|
|
925
888
|
sport: { type: String },
|
|
@@ -936,60 +899,60 @@ class qe extends y {
|
|
|
936
899
|
e && (this.pollDate = e);
|
|
937
900
|
}
|
|
938
901
|
async fetchData(e) {
|
|
939
|
-
const t = this.season ||
|
|
902
|
+
const t = this.season || _(), [s, r, o, l, h] = await Promise.all([
|
|
940
903
|
e.listRankings({ sport: this.sport, ...this.gender ? { gender: this.gender } : {} }),
|
|
941
904
|
e.listSchools(),
|
|
942
905
|
e.listTeams({ sport: this.sport }),
|
|
943
906
|
e.listConferences(),
|
|
944
907
|
e.listGames({ sport: this.sport, season: t })
|
|
945
|
-
]),
|
|
908
|
+
]), d = s.items.filter((i) => !this.gender || !i.gender || i.gender === this.gender).sort((i, c) => c.effectiveDate.localeCompare(i.effectiveDate));
|
|
946
909
|
return {
|
|
947
910
|
season: t,
|
|
948
|
-
polls:
|
|
949
|
-
schools:
|
|
950
|
-
teams:
|
|
911
|
+
polls: d,
|
|
912
|
+
schools: r.items,
|
|
913
|
+
teams: o.items,
|
|
951
914
|
conferences: l.items,
|
|
952
|
-
games:
|
|
915
|
+
games: h.items
|
|
953
916
|
};
|
|
954
917
|
}
|
|
955
918
|
get ctx() {
|
|
956
919
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
957
920
|
teamsById: b(this.data.teams),
|
|
958
921
|
schoolsById: b(this.data.schools),
|
|
959
|
-
records:
|
|
922
|
+
records: N(this.data.games),
|
|
960
923
|
rankings: this.data.polls,
|
|
961
924
|
hrefs: z(this),
|
|
962
925
|
sport: this.sport
|
|
963
926
|
}, this._ctxData = this.data), this._ctx;
|
|
964
927
|
}
|
|
965
928
|
sparkline(e, t, s) {
|
|
966
|
-
const
|
|
929
|
+
const h = t.map((m, f) => {
|
|
967
930
|
const u = (m.teamIds || []).indexOf(e);
|
|
968
931
|
if (u === -1) return null;
|
|
969
932
|
const v = t.length === 1 ? 96 / 2 : f / (t.length - 1) * 90 + 3, x = 3 + u / 24 * 20;
|
|
970
933
|
return { x: v, y: x };
|
|
971
|
-
}),
|
|
972
|
-
let
|
|
973
|
-
if (
|
|
974
|
-
m ?
|
|
975
|
-
}),
|
|
976
|
-
const
|
|
934
|
+
}), d = [];
|
|
935
|
+
let i = [];
|
|
936
|
+
if (h.forEach((m) => {
|
|
937
|
+
m ? i.push(m) : i.length && (d.push(i), i = []);
|
|
938
|
+
}), i.length && d.push(i), !d.length) return p;
|
|
939
|
+
const c = h[s];
|
|
977
940
|
return n`<svg class="sparkline" width=${96} height=${26} viewBox="0 0 ${96} ${26}" role="img" aria-label="rank history">
|
|
978
|
-
${
|
|
941
|
+
${d.map((m) => J`<polyline fill="none" stroke="var(--hsot-red)" stroke-width="2"
|
|
979
942
|
points=${m.map((f) => `${f.x.toFixed(1)},${f.y.toFixed(1)}`).join(" ")}></polyline>`)}
|
|
980
|
-
${
|
|
943
|
+
${c ? J`<circle cx=${c.x.toFixed(1)} cy=${c.y.toFixed(1)} r="3" fill="var(--hsot-black)"></circle>` : p}
|
|
981
944
|
</svg>`;
|
|
982
945
|
}
|
|
983
946
|
movement(e, t, s) {
|
|
984
|
-
const
|
|
985
|
-
return
|
|
947
|
+
const r = Me(e, t, s);
|
|
948
|
+
return r.kind === "up" ? n`<span class="delta up">▲ ${r.delta}</span>` : r.kind === "down" ? n`<span class="delta down">▼ ${r.delta}</span>` : r.kind === "new" ? n`<span class="delta new">NEW</span>` : r.kind === "same" ? n`<span class="delta same">—</span>` : n`<span class="delta same">·</span>`;
|
|
986
949
|
}
|
|
987
950
|
renderView() {
|
|
988
951
|
const e = this.ctx, t = this.data.polls;
|
|
989
952
|
if (!t.length) return n`<div class="view"><p class="empty">No ${this.sport} polls published yet this season.</p></div>`;
|
|
990
|
-
const s = Math.max(0, t.findIndex((m) => m.effectiveDate === this.pollDate)),
|
|
953
|
+
const s = Math.max(0, t.findIndex((m) => m.effectiveDate === this.pollDate)), r = t[s] || t[0], o = t[s + 1] || null, l = t.slice().reverse(), h = l.indexOf(r), d = b(this.data.conferences), i = (r.teamIds || [])[0], c = i ? I(e, i) : null;
|
|
991
954
|
return n`
|
|
992
|
-
${
|
|
955
|
+
${j(this, e, {
|
|
993
956
|
title: n`${B(this.sport)} Top 25`,
|
|
994
957
|
sub: n`The HighSchoolOT poll · updated weekly · ${t.length} polls this season`,
|
|
995
958
|
teams: this.data.teams
|
|
@@ -1001,7 +964,7 @@ class qe extends y {
|
|
|
1001
964
|
<select id="pollsel" @change=${(m) => {
|
|
1002
965
|
this.pollDate = m.target.value;
|
|
1003
966
|
}}>
|
|
1004
|
-
${t.map((m, f) => n`<option value=${m.effectiveDate} ?selected=${m ===
|
|
967
|
+
${t.map((m, f) => n`<option value=${m.effectiveDate} ?selected=${m === r}>
|
|
1005
968
|
${w(m.effectiveDate, { month: "long", day: "numeric", year: "numeric" })}${f === 0 ? " · current" : ""}
|
|
1006
969
|
</option>`)}
|
|
1007
970
|
</select>
|
|
@@ -1016,65 +979,65 @@ class qe extends y {
|
|
|
1016
979
|
<span class="spacer"></span>
|
|
1017
980
|
<span class="asof">Movement vs. the previous poll · sparkline = season rank history</span>
|
|
1018
981
|
</div>
|
|
1019
|
-
${
|
|
982
|
+
${c ? this.renderHero(e, r, o, i, c, d) : p}
|
|
1020
983
|
<div class="card"><div class="tablewrap"><table class="data">
|
|
1021
984
|
<thead><tr>
|
|
1022
985
|
<th class="num">Rk</th><th>Mvmt</th><th>Team</th><th class="num">Record</th>
|
|
1023
986
|
<th>Conference</th><th>Last result</th><th>Next</th><th>Season</th>
|
|
1024
987
|
</tr></thead>
|
|
1025
988
|
<tbody>
|
|
1026
|
-
${(
|
|
989
|
+
${(r.teamIds || []).map((m, f) => f === 0 || !m ? p : this.renderRow(e, r, o, l, h, d, m, f + 1))}
|
|
1027
990
|
</tbody>
|
|
1028
991
|
</table></div></div>
|
|
1029
992
|
<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>
|
|
1030
993
|
`)}
|
|
1031
994
|
`;
|
|
1032
995
|
}
|
|
1033
|
-
renderHero(e, t, s,
|
|
1034
|
-
const
|
|
996
|
+
renderHero(e, t, s, r, o, l) {
|
|
997
|
+
const h = e.records[r], d = ae(e.records, r), i = l[e.teamsById[r]?.conferenceId], c = `linear-gradient(120deg, ${o.colorPrimary || "#030711"} 0%, var(--hsot-black) 85%)`;
|
|
1035
998
|
return n`
|
|
1036
|
-
<div class="hero1" style="background:${
|
|
999
|
+
<div class="hero1" style="background:${c}">
|
|
1037
1000
|
<div class="bigrank">#1</div>
|
|
1038
|
-
${T(
|
|
1001
|
+
${T(o, 64)}
|
|
1039
1002
|
<div>
|
|
1040
|
-
<h2><a href=${g(e.hrefs.school, { id:
|
|
1003
|
+
<h2><a href=${g(e.hrefs.school, { id: o.id })}>${o.name} ${o.mascot || ""}</a></h2>
|
|
1041
1004
|
<div class="facts">
|
|
1042
|
-
${k(
|
|
1043
|
-
· streak ${
|
|
1044
|
-
${
|
|
1045
|
-
${this.movement(t, s,
|
|
1005
|
+
${k(h)} overall${i ? n` · ${k(h, !0)} ${i.name}` : p}
|
|
1006
|
+
· streak ${U(h?.results) || "·"}
|
|
1007
|
+
${d ? n` · last: ${d.mark} ${d.my}-${d.their} vs ${G(e, d.opp)}` : p}
|
|
1008
|
+
${this.movement(t, s, r)}
|
|
1046
1009
|
</div>
|
|
1047
1010
|
</div>
|
|
1048
1011
|
</div>
|
|
1049
1012
|
`;
|
|
1050
1013
|
}
|
|
1051
|
-
renderRow(e, t, s,
|
|
1052
|
-
const
|
|
1053
|
-
if (!
|
|
1054
|
-
const
|
|
1055
|
-
location.href = g(e.hrefs.school, { id:
|
|
1014
|
+
renderRow(e, t, s, r, o, l, h, d) {
|
|
1015
|
+
const i = I(e, h);
|
|
1016
|
+
if (!i) return p;
|
|
1017
|
+
const c = e.records[h], m = ae(e.records, h), f = Y(this.data.games, h), u = l[e.teamsById[h]?.conferenceId], v = () => {
|
|
1018
|
+
location.href = g(e.hrefs.school, { id: i.id });
|
|
1056
1019
|
};
|
|
1057
1020
|
return n`
|
|
1058
1021
|
<tr class="rowlink" @click=${(x) => {
|
|
1059
1022
|
x.target.closest("a") || v();
|
|
1060
1023
|
}}>
|
|
1061
|
-
<td class="num" style="font-weight:700">${
|
|
1062
|
-
<td>${this.movement(t, s,
|
|
1063
|
-
<td class="teamcell">${T(
|
|
1064
|
-
<span class="mut" style="font-size:0.78rem">${
|
|
1065
|
-
<td class="num">${k(
|
|
1024
|
+
<td class="num" style="font-weight:700">${d}</td>
|
|
1025
|
+
<td>${this.movement(t, s, h)}</td>
|
|
1026
|
+
<td class="teamcell">${T(i)}<a href=${g(e.hrefs.school, { id: i.id })}>${i.name}</a>
|
|
1027
|
+
<span class="mut" style="font-size:0.78rem">${i.mascot || ""}</span></td>
|
|
1028
|
+
<td class="num">${k(c)}</td>
|
|
1066
1029
|
<td class="mut">${u?.name || "Independent"}</td>
|
|
1067
1030
|
<td>${m ? n`<a class="box" style="text-decoration:none" href=${g(e.hrefs.game, { sport: this.sport, id: m.gameId })}>
|
|
1068
1031
|
<b style="color:${m.mark === "W" ? "var(--hsot-win)" : m.mark === "L" ? "var(--hsot-loss)" : "var(--hsot-tie)"}">${m.mark}</b>
|
|
1069
|
-
${m.my}-${m.their} vs ${
|
|
1070
|
-
<td>${
|
|
1071
|
-
<td>${this.sparkline(
|
|
1032
|
+
${m.my}-${m.their} vs ${G(e, m.opp)}</a>` : n`<span class="mut">·</span>`}</td>
|
|
1033
|
+
<td>${pe(e, f, h)}</td>
|
|
1034
|
+
<td>${this.sparkline(h, r, o)}</td>
|
|
1072
1035
|
</tr>
|
|
1073
1036
|
`;
|
|
1074
1037
|
}
|
|
1075
1038
|
}
|
|
1076
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings",
|
|
1077
|
-
const
|
|
1039
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings", je);
|
|
1040
|
+
const qe = $`
|
|
1078
1041
|
.schoolhero { color: var(--hsot-white); padding: 1.6rem 1.25rem 1.3rem; }
|
|
1079
1042
|
.schoolhero .inner { max-width: 1366px; margin: 0 auto; display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
|
|
1080
1043
|
.schoolhero .crest {
|
|
@@ -1128,8 +1091,8 @@ const We = $`
|
|
|
1128
1091
|
table.data.roster .sub { display: block; font-weight: 400; font-size: 0.78rem; color: var(--hsot-gray-5); }
|
|
1129
1092
|
}
|
|
1130
1093
|
`;
|
|
1131
|
-
class
|
|
1132
|
-
static styles = [...P,
|
|
1094
|
+
class We extends y {
|
|
1095
|
+
static styles = [...P, qe];
|
|
1133
1096
|
static properties = {
|
|
1134
1097
|
...y.properties,
|
|
1135
1098
|
schoolId: { type: String, attribute: "school-id" },
|
|
@@ -1146,7 +1109,7 @@ class Ve extends y {
|
|
|
1146
1109
|
e && !this.sport && (this.sport = e);
|
|
1147
1110
|
}
|
|
1148
1111
|
async fetchData(e) {
|
|
1149
|
-
const t = this.season ||
|
|
1112
|
+
const t = this.season || _(), s = await e.getSchool(this.schoolId), o = (await e.listTeams({ schoolId: this.schoolId })).items, l = o.find((v) => v.sport === (this.sport || "football")) || o[0] || null, [h, d, i, c, m, f, u] = await Promise.all([
|
|
1150
1113
|
l ? e.listGames({ sport: l.sport, season: t }) : Promise.resolve({ items: [] }),
|
|
1151
1114
|
l ? e.listTeams({ sport: l.sport }) : Promise.resolve({ items: [] }),
|
|
1152
1115
|
e.listSchools(),
|
|
@@ -1160,12 +1123,12 @@ class Ve extends y {
|
|
|
1160
1123
|
return {
|
|
1161
1124
|
season: t,
|
|
1162
1125
|
school: s,
|
|
1163
|
-
teams:
|
|
1126
|
+
teams: o,
|
|
1164
1127
|
active: l,
|
|
1165
|
-
games:
|
|
1166
|
-
allTeams:
|
|
1167
|
-
schools:
|
|
1168
|
-
conferences:
|
|
1128
|
+
games: h.items,
|
|
1129
|
+
allTeams: d.items,
|
|
1130
|
+
schools: i.items,
|
|
1131
|
+
conferences: c.items,
|
|
1169
1132
|
rankings: m.items,
|
|
1170
1133
|
roster: f.items.find((v) => v.season === t) || null,
|
|
1171
1134
|
players: u.items
|
|
@@ -1175,7 +1138,7 @@ class Ve extends y {
|
|
|
1175
1138
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
1176
1139
|
teamsById: b(this.data.allTeams.length ? this.data.allTeams : this.data.teams),
|
|
1177
1140
|
schoolsById: b(this.data.schools),
|
|
1178
|
-
records:
|
|
1141
|
+
records: N(this.data.games),
|
|
1179
1142
|
rankings: this.data.rankings,
|
|
1180
1143
|
hrefs: z(this),
|
|
1181
1144
|
sport: this.data.active?.sport || "football"
|
|
@@ -1185,20 +1148,20 @@ class Ve extends y {
|
|
|
1185
1148
|
this.sport = e, this.load();
|
|
1186
1149
|
}
|
|
1187
1150
|
renderView() {
|
|
1188
|
-
const { school: e, teams: t, active: s, season:
|
|
1151
|
+
const { school: e, teams: t, active: s, season: r } = this.data;
|
|
1189
1152
|
if (!e) return n`<div class="view"><p class="empty">School not found.</p></div>`;
|
|
1190
|
-
const
|
|
1153
|
+
const o = this.ctx, l = M(e.colorPrimary || "#030711"), h = (e.adm || [])[0], d = b(this.data.conferences), i = s ? d[s.conferenceId] : null;
|
|
1191
1154
|
return n`
|
|
1192
1155
|
<div class="schoolhero" style="background:linear-gradient(115deg, ${e.colorPrimary || "#030711"} 0%, ${e.colorPrimary || "#030711"} 55%, var(--hsot-black) 100%);color:${l}">
|
|
1193
1156
|
<div class="inner">
|
|
1194
|
-
${
|
|
1157
|
+
${L(e, 84) ? n`<img class="crest logo" alt="" loading="lazy" src=${L(e, 84)} />` : n`<div class="crest" style="background:${e.colorSecondary || "#7C7C7C"};color:${M(e.colorSecondary || "#7C7C7C")}">${V(e)}</div>`}
|
|
1195
1158
|
<div style="min-width:260px">
|
|
1196
1159
|
<h1>${e.name} <span class="mascot">${e.mascot || ""}</span></h1>
|
|
1197
1160
|
<div class="facts">
|
|
1198
1161
|
${e.location ? n`<span><b>Location</b>${e.location}${e.county ? n` · ${e.county} County` : p}</span>` : p}
|
|
1199
1162
|
${e.association ? n`<span><b>League</b>${e.association}${e.classification ? n` · ${e.classification}` : p}</span>` : p}
|
|
1200
|
-
${
|
|
1201
|
-
${
|
|
1163
|
+
${i ? n`<span><b>Conference</b>${i.name}</span>` : p}
|
|
1164
|
+
${h ? n`<span><b>Enrollment</b>${h.value.toLocaleString()} (${h.season} ADM)</span>` : p}
|
|
1202
1165
|
${e.openingYear ? n`<span><b>Opened</b>${e.openingYear}</span>` : p}
|
|
1203
1166
|
${e.areaCode ? n`<span><b>Area</b>${e.areaCode}</span>` : p}
|
|
1204
1167
|
</div>
|
|
@@ -1207,29 +1170,29 @@ class Ve extends y {
|
|
|
1207
1170
|
</div>
|
|
1208
1171
|
<div class="band">
|
|
1209
1172
|
<nav class="tabs" aria-label="Teams">
|
|
1210
|
-
${t.map((
|
|
1211
|
-
m.preventDefault(), this.switchSport(
|
|
1212
|
-
}}>${
|
|
1173
|
+
${t.map((c) => c.id === s?.id ? n`<a class="on" href="#" @click=${(m) => m.preventDefault()}>${c.name}</a>` : n`<a href="#" @click=${(m) => {
|
|
1174
|
+
m.preventDefault(), this.switchSport(c.sport);
|
|
1175
|
+
}}>${c.name}</a>`)}
|
|
1213
1176
|
</nav>
|
|
1214
1177
|
</div>
|
|
1215
1178
|
${C(this, n`
|
|
1216
1179
|
${D(this)}
|
|
1217
|
-
${s ? this.renderTeam(
|
|
1180
|
+
${s ? this.renderTeam(o, s, i, r) : n`<p class="empty">No teams recorded for this school yet.</p>`}
|
|
1218
1181
|
`)}
|
|
1219
1182
|
`;
|
|
1220
1183
|
}
|
|
1221
|
-
renderTeam(e, t, s,
|
|
1222
|
-
const
|
|
1184
|
+
renderTeam(e, t, s, r) {
|
|
1185
|
+
const o = e.records[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] }, l = o.w + o.l + o.t, h = s ? this.data.allTeams.filter((m) => m.conferenceId === s.id) : [], d = s ? he(h, e.records).findIndex((m) => m.team.id === t.id) + 1 : 0, i = K(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)));
|
|
1223
1186
|
return n`
|
|
1224
1187
|
<div class="tiles">
|
|
1225
|
-
<div class="tile"><div class="k">Overall</div><div class="v">${k(
|
|
1226
|
-
<div class="tile"><div class="k">${s?.name || "Conference"}</div><div class="v">${k(
|
|
1227
|
-
<div class="s">${
|
|
1228
|
-
<div class="tile"><div class="k">Points</div><div class="v">${l ? (
|
|
1229
|
-
<div class="s">scored per game · ${l ? (
|
|
1230
|
-
<div class="tile"><div class="k">Streak</div><div class="v">${
|
|
1188
|
+
<div class="tile"><div class="k">Overall</div><div class="v">${k(o)}</div><div class="s">${l} games played</div></div>
|
|
1189
|
+
<div class="tile"><div class="k">${s?.name || "Conference"}</div><div class="v">${k(o, !0)}</div>
|
|
1190
|
+
<div class="s">${d ? `${Se(d)} of ${h.length}` : "·"}</div></div>
|
|
1191
|
+
<div class="tile"><div class="k">Points</div><div class="v">${l ? (o.pf / l).toFixed(1) : "0.0"}</div>
|
|
1192
|
+
<div class="s">scored per game · ${l ? (o.pa / l).toFixed(1) : "0.0"} allowed</div></div>
|
|
1193
|
+
<div class="tile"><div class="k">Streak</div><div class="v">${U(o.results) || "·"}</div>
|
|
1231
1194
|
<div class="s">last 5: ${X(e, t.id)}</div></div>
|
|
1232
|
-
<div class="tile"><div class="k">HSOT Top 25</div><div class="v">${
|
|
1195
|
+
<div class="tile"><div class="k">HSOT Top 25</div><div class="v">${i ? `#${i}` : "NR"}</div>
|
|
1233
1196
|
<div class="s"><a href=${g(e.hrefs.section, { sport: t.sport, view: "rankings" })}>full poll</a></div></div>
|
|
1234
1197
|
</div>
|
|
1235
1198
|
${(t.championships || []).length ? n`
|
|
@@ -1240,31 +1203,31 @@ class Ve extends y {
|
|
|
1240
1203
|
<div>
|
|
1241
1204
|
<div class="section-title">Schedule & results</div>
|
|
1242
1205
|
<div class="card">
|
|
1243
|
-
${
|
|
1206
|
+
${c.length ? n`<ul class="gamelist">${c.map((m) => this.renderGameRow(e, t, m))}</ul>` : n`<p class="empty">No ${t.sport} games recorded for ${r}.</p>`}
|
|
1244
1207
|
</div>
|
|
1245
1208
|
</div>
|
|
1246
1209
|
<div>
|
|
1247
|
-
<div class="section-title">Roster · ${
|
|
1248
|
-
<div class="card">${this.renderRoster(t,
|
|
1210
|
+
<div class="section-title">Roster · ${r}</div>
|
|
1211
|
+
<div class="card">${this.renderRoster(t, r)}</div>
|
|
1249
1212
|
</div>
|
|
1250
1213
|
</div>
|
|
1251
1214
|
`;
|
|
1252
1215
|
}
|
|
1253
1216
|
renderGameRow(e, t, s) {
|
|
1254
|
-
const
|
|
1255
|
-
let
|
|
1217
|
+
const r = s.homeTeamId === t.id, o = r ? s.awayTeamId : s.homeTeamId, l = r ? s.homeScore : s.awayScore, h = r ? s.awayScore : s.homeScore;
|
|
1218
|
+
let d = n`<span class="mut">${q(s.time)}</span>`;
|
|
1256
1219
|
if (s.state === "final") {
|
|
1257
|
-
const
|
|
1258
|
-
|
|
1259
|
-
} else s.state === "live" && (
|
|
1260
|
-
const
|
|
1220
|
+
const c = H(s), m = c === "tie" ? "T" : c === (r ? "home" : "away") ? "W" : "L";
|
|
1221
|
+
d = n`<span class=${m}>${m}</span> ${l}-${h}${s.finish === "overtime" ? n` <span class="mut">OT</span>` : p}${s.forfeit && s.forfeit !== "none" ? n` <span class="mut">FF</span>` : p}`;
|
|
1222
|
+
} else s.state === "live" && (d = n`<span style="color:var(--hsot-red)">${l}-${h}</span>`);
|
|
1223
|
+
const i = s.gameType === "conference" ? "Conf" : s.gameType === "nonconference" ? "Non-conf" : s.gameType === "playoff" ? `Playoff${s.label ? ` · ${s.label}` : ""}` : "Scrimmage";
|
|
1261
1224
|
return n`
|
|
1262
1225
|
<li>
|
|
1263
1226
|
<span class="d">${w(s.date)}</span>
|
|
1264
|
-
${
|
|
1265
|
-
<span class="res">${
|
|
1266
|
-
<span class="opp">${
|
|
1267
|
-
<span class="pill type">${
|
|
1227
|
+
${ce(s).kind === "sched" ? p : E(s)}
|
|
1228
|
+
<span class="res">${d}</span>
|
|
1229
|
+
<span class="opp">${r ? "vs" : "at"} ${O(e, o, s.date)}
|
|
1230
|
+
<span class="pill type">${i}</span>
|
|
1268
1231
|
${s.broadcast ? n`<span class="pill class">${s.broadcast}</span>` : p}
|
|
1269
1232
|
</span>
|
|
1270
1233
|
<span class="where">${s.venue || ""}</span>
|
|
@@ -1276,25 +1239,25 @@ class Ve extends y {
|
|
|
1276
1239
|
const s = this.data.roster;
|
|
1277
1240
|
if (!s)
|
|
1278
1241
|
return n`<p class="empty">Roster not published for ${t}.</p>`;
|
|
1279
|
-
const
|
|
1242
|
+
const r = Ge(s, 560), o = this.data.school?.name || "", l = b(this.data.players), h = s.entries.slice().sort((i, c) => (i.number || 0) - (c.number || 0)), d = h.some((i) => l[i.playerId]?.college);
|
|
1280
1243
|
return n`
|
|
1281
|
-
${
|
|
1282
|
-
alt="${
|
|
1244
|
+
${r ? n`<img class="rosterphoto" src=${r} loading="lazy" decoding="async"
|
|
1245
|
+
alt="${o} ${e.name} ${t} team photo" />` : p}
|
|
1283
1246
|
<div class="tablewrap"><table class="data roster">
|
|
1284
|
-
<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>${
|
|
1247
|
+
<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>${d ? n`<th>College</th>` : p}</tr></thead>
|
|
1285
1248
|
<tbody>
|
|
1286
|
-
${
|
|
1287
|
-
const
|
|
1288
|
-
if (!
|
|
1289
|
-
const m =
|
|
1249
|
+
${h.map((i) => {
|
|
1250
|
+
const c = l[i.playerId];
|
|
1251
|
+
if (!c) return p;
|
|
1252
|
+
const m = xe(i), f = [m, c.classOf].filter(Boolean).join(" · ") || "·";
|
|
1290
1253
|
return n`<tr>
|
|
1291
|
-
<td class="num mut">${
|
|
1292
|
-
<td class="player" style="font-weight:500">${
|
|
1254
|
+
<td class="num mut">${i.number ?? "·"}</td>
|
|
1255
|
+
<td class="player" style="font-weight:500">${c.firstName} ${c.lastName}<span class="sub">${f}</span></td>
|
|
1293
1256
|
<td class="pos">${m || "·"}</td>
|
|
1294
|
-
<td class="cls mut">${
|
|
1295
|
-
<td class="num">${
|
|
1296
|
-
<td class="num">${
|
|
1297
|
-
${
|
|
1257
|
+
<td class="cls mut">${c.classOf || "·"}</td>
|
|
1258
|
+
<td class="num">${we(c.heightIn)}</td>
|
|
1259
|
+
<td class="num">${c.weightLb || "·"}</td>
|
|
1260
|
+
${d ? n`<td class="college">${c.college || "·"}</td>` : p}
|
|
1298
1261
|
</tr>`;
|
|
1299
1262
|
})}
|
|
1300
1263
|
</tbody>
|
|
@@ -1302,8 +1265,8 @@ class Ve extends y {
|
|
|
1302
1265
|
`;
|
|
1303
1266
|
}
|
|
1304
1267
|
}
|
|
1305
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school",
|
|
1306
|
-
const
|
|
1268
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school", We);
|
|
1269
|
+
const fe = {
|
|
1307
1270
|
football: ["quarters", 4],
|
|
1308
1271
|
flag_football: ["quarters", 4],
|
|
1309
1272
|
basketball: ["quarters", 4],
|
|
@@ -1314,22 +1277,22 @@ const pe = {
|
|
|
1314
1277
|
softball: ["innings", 7],
|
|
1315
1278
|
volleyball: ["sets", 3]
|
|
1316
1279
|
};
|
|
1317
|
-
function
|
|
1318
|
-
return (
|
|
1280
|
+
function ue(a) {
|
|
1281
|
+
return (fe[a] || ["quarters", 4])[0];
|
|
1319
1282
|
}
|
|
1320
1283
|
function Z(a) {
|
|
1321
|
-
return (
|
|
1284
|
+
return (fe[a] || ["quarters", 4])[1];
|
|
1322
1285
|
}
|
|
1323
|
-
function
|
|
1324
|
-
const t =
|
|
1286
|
+
function Ve(a, e) {
|
|
1287
|
+
const t = ue(a), s = Z(a);
|
|
1325
1288
|
if (e <= s || t === "innings" || t === "sets") return String(e);
|
|
1326
|
-
const
|
|
1327
|
-
return `OT${
|
|
1289
|
+
const r = e - s;
|
|
1290
|
+
return `OT${r > 1 ? r : ""}`;
|
|
1328
1291
|
}
|
|
1329
|
-
function
|
|
1292
|
+
function Ye(a, e) {
|
|
1330
1293
|
const t = String(a ?? "").trim();
|
|
1331
1294
|
let s;
|
|
1332
|
-
return (s = /^(\d+)Q$/i.exec(t)) || (s = /^(\d+)H$/i.exec(t)) ? Number(s[1]) : /^half$/i.test(t) ?
|
|
1295
|
+
return (s = /^(\d+)Q$/i.exec(t)) || (s = /^(\d+)H$/i.exec(t)) ? Number(s[1]) : /^half$/i.test(t) ? ue(e) === "halves" ? 1 : 2 : (s = /^(\d*)OT(\d*)$/i.exec(t)) ? Z(e) + Number(s[1] || s[2] || 1) : (s = /^[TB](\d+)$/i.exec(t)) || (s = /^(\d+)(?:st|nd|rd|th)\s*set$/i.exec(t)) || (s = /^set\s*(\d+)$/i.exec(t)) ? Number(s[1]) : null;
|
|
1333
1296
|
}
|
|
1334
1297
|
const R = (a) => Number.isInteger(a) && a >= 0 ? a : null;
|
|
1335
1298
|
function Ke(a) {
|
|
@@ -1337,34 +1300,34 @@ function Ke(a) {
|
|
|
1337
1300
|
if (!e.length) return null;
|
|
1338
1301
|
const t = a.sport, s = /* @__PURE__ */ new Map();
|
|
1339
1302
|
for (const m of e) {
|
|
1340
|
-
const f =
|
|
1303
|
+
const f = Ye(m?.period, t), u = R(m?.homeScore), v = R(m?.awayScore);
|
|
1341
1304
|
if (!f || u === null || v === null) return null;
|
|
1342
1305
|
const x = s.get(f) || { home: 0, away: 0 };
|
|
1343
1306
|
x.home = Math.max(x.home, u), x.away = Math.max(x.away, v), s.set(f, x);
|
|
1344
1307
|
}
|
|
1345
|
-
const
|
|
1346
|
-
let l = !0,
|
|
1347
|
-
for (let m = 1; m <=
|
|
1348
|
-
const f = s.get(m) ||
|
|
1349
|
-
(u < 0 || v < 0) && (l = !1),
|
|
1308
|
+
const r = Math.max(...s.keys()), o = [];
|
|
1309
|
+
let l = !0, h = { home: 0, away: 0 };
|
|
1310
|
+
for (let m = 1; m <= r; m += 1) {
|
|
1311
|
+
const f = s.get(m) || h, u = f.home - h.home, v = f.away - h.away;
|
|
1312
|
+
(u < 0 || v < 0) && (l = !1), o.push({ period: m, home: Math.max(u, 0), away: Math.max(v, 0) }), h = { home: Math.max(f.home, h.home), away: Math.max(f.away, h.away) };
|
|
1350
1313
|
}
|
|
1351
|
-
const
|
|
1352
|
-
return l = l &&
|
|
1314
|
+
const d = R(a.homeScore) ?? 0, i = R(a.awayScore) ?? 0, c = l && h.home === d && h.away === i;
|
|
1315
|
+
return l = l && h.home <= d && h.away <= i, { periods: o, reconciled: c, consistent: l };
|
|
1353
1316
|
}
|
|
1354
|
-
function
|
|
1317
|
+
function Qe(a) {
|
|
1355
1318
|
if (Array.isArray(a?.periodScores) && a.periodScores.length) return a.periodScores;
|
|
1356
1319
|
const e = Ke(a);
|
|
1357
1320
|
return e ? a.state === "final" ? e.reconciled ? e.periods : null : e.consistent ? e.periods : null : null;
|
|
1358
1321
|
}
|
|
1359
|
-
const
|
|
1360
|
-
function
|
|
1322
|
+
const Xe = "https://api.wral.com/search";
|
|
1323
|
+
function Ze(a) {
|
|
1361
1324
|
return a.map((e) => `uri:"${e}"`).join(" OR ");
|
|
1362
1325
|
}
|
|
1363
|
-
function
|
|
1364
|
-
const t = String(a ||
|
|
1326
|
+
function Je(a, e) {
|
|
1327
|
+
const t = String(a || Xe).replace(/\/+$/, ""), s = new URLSearchParams({ query: Ze(e), sort: "score", lang: "en" });
|
|
1365
1328
|
return `${t}/v1/query?${s}`;
|
|
1366
1329
|
}
|
|
1367
|
-
function
|
|
1330
|
+
function ge(a) {
|
|
1368
1331
|
try {
|
|
1369
1332
|
const e = new URL(a);
|
|
1370
1333
|
if (/(^|\.)smugmug\.com$/i.test(e.hostname)) {
|
|
@@ -1379,13 +1342,13 @@ function ue(a) {
|
|
|
1379
1342
|
}
|
|
1380
1343
|
return { uri: a, title: a };
|
|
1381
1344
|
}
|
|
1382
|
-
async function
|
|
1383
|
-
const
|
|
1384
|
-
if (!
|
|
1385
|
-
const
|
|
1386
|
-
return e.map((
|
|
1345
|
+
async function et(a, e, t) {
|
|
1346
|
+
const r = await ((...h) => fetch(...h))(Je(a, e));
|
|
1347
|
+
if (!r.ok) throw new Error(`search answered ${r.status}`);
|
|
1348
|
+
const o = await r.json(), l = new Map((o.items || []).map((h) => [h.uri, h]));
|
|
1349
|
+
return e.map((h) => l.get(h) || ge(h));
|
|
1387
1350
|
}
|
|
1388
|
-
const
|
|
1351
|
+
const tt = $`
|
|
1389
1352
|
.breadcrumbs { font-size: 0.8125rem; margin: 0.9rem 0 0; color: var(--hsot-gray-5); }
|
|
1390
1353
|
.breadcrumbs a { text-decoration: none; }
|
|
1391
1354
|
.scorehead { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center; padding: 1.4rem 1rem; }
|
|
@@ -1428,6 +1391,9 @@ const st = $`
|
|
|
1428
1391
|
table.plays-table td.play { white-space: normal; min-width: 12rem; }
|
|
1429
1392
|
/* Game notes are typed with line breaks the desk means to keep. */
|
|
1430
1393
|
.gamenote { padding: 0 1rem 0.9rem; text-align: center; white-space: pre-line; }
|
|
1394
|
+
/* The embed's way out to everything it drops (Coverage, season context,
|
|
1395
|
+
head to head) — the data page still renders all of it. */
|
|
1396
|
+
.fullbox { margin: 0.9rem 0 0; text-align: center; font-size: 0.875rem; }
|
|
1431
1397
|
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
|
|
1432
1398
|
.ctxcard { padding: 0.85rem 1rem; }
|
|
1433
1399
|
.ctxcard .who { font-family: var(--hsot-heading-font); font-weight: 700; margin-bottom: 0.4rem; }
|
|
@@ -1438,8 +1404,8 @@ const st = $`
|
|
|
1438
1404
|
.cols { grid-template-columns: 1fr; }
|
|
1439
1405
|
}
|
|
1440
1406
|
`;
|
|
1441
|
-
class
|
|
1442
|
-
static styles = [...P,
|
|
1407
|
+
class st extends y {
|
|
1408
|
+
static styles = [...P, tt];
|
|
1443
1409
|
static properties = {
|
|
1444
1410
|
...y.properties,
|
|
1445
1411
|
gameId: { type: String, attribute: "game-id" },
|
|
@@ -1447,13 +1413,19 @@ class at extends y {
|
|
|
1447
1413
|
// (DEV-1236). Shared cross-stage by design — see the studio host's
|
|
1448
1414
|
// registry — so the prod default is right everywhere; the attribute
|
|
1449
1415
|
// exists for the same reason the href templates do.
|
|
1450
|
-
searchApi: { type: String, attribute: "search-api" }
|
|
1416
|
+
searchApi: { type: String, attribute: "search-api" },
|
|
1417
|
+
// Story pages embed the box score in the article column, where the page
|
|
1418
|
+
// chrome (breadcrumbs, the report-a-score line) and the cross-links
|
|
1419
|
+
// (Coverage, Season context, head-to-head) belong to the data page, not
|
|
1420
|
+
// the recap. `embed` keeps the score head, line score and scoring plays,
|
|
1421
|
+
// and links out to the full box score for the rest.
|
|
1422
|
+
embed: { type: Boolean }
|
|
1451
1423
|
};
|
|
1452
1424
|
constructor() {
|
|
1453
|
-
super(), this.gameId = "", this.searchApi = "";
|
|
1425
|
+
super(), this.gameId = "", this.searchApi = "", this.embed = !1;
|
|
1454
1426
|
}
|
|
1455
1427
|
async fetchData(e) {
|
|
1456
|
-
const t = await e.getGame(this.gameId), s = Array.isArray(t.coverageUrls) ? t.coverageUrls : [], [
|
|
1428
|
+
const t = await e.getGame(this.gameId), s = Array.isArray(t.coverageUrls) ? t.coverageUrls : [], [r, o, l, h, d, i] = await Promise.all([
|
|
1457
1429
|
e.listSchools(),
|
|
1458
1430
|
e.listTeams({ sport: t.sport }),
|
|
1459
1431
|
e.listConferences(),
|
|
@@ -1461,23 +1433,25 @@ class at extends y {
|
|
|
1461
1433
|
e.listGames({ sport: t.sport, season: t.season }),
|
|
1462
1434
|
// A search outage must not blank the box score — degrade to bare
|
|
1463
1435
|
// links (fetchCoverage already degrades per-URL index misses).
|
|
1464
|
-
|
|
1436
|
+
// The embed drops the Coverage grid, so it skips the search
|
|
1437
|
+
// round-trip entirely rather than fetching cards it will not render.
|
|
1438
|
+
s.length && !this.embed ? et(this.searchApi, s).catch(() => s.map(ge)) : Promise.resolve([])
|
|
1465
1439
|
]);
|
|
1466
1440
|
return {
|
|
1467
1441
|
game: t,
|
|
1468
|
-
schools:
|
|
1469
|
-
teams:
|
|
1442
|
+
schools: r.items,
|
|
1443
|
+
teams: o.items,
|
|
1470
1444
|
conferences: l.items,
|
|
1471
|
-
rankings:
|
|
1472
|
-
games:
|
|
1473
|
-
coverage:
|
|
1445
|
+
rankings: h.items,
|
|
1446
|
+
games: d.items,
|
|
1447
|
+
coverage: i
|
|
1474
1448
|
};
|
|
1475
1449
|
}
|
|
1476
1450
|
get ctx() {
|
|
1477
1451
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
1478
1452
|
teamsById: b(this.data.teams),
|
|
1479
1453
|
schoolsById: b(this.data.schools),
|
|
1480
|
-
records:
|
|
1454
|
+
records: N(this.data.games),
|
|
1481
1455
|
rankings: this.data.rankings,
|
|
1482
1456
|
hrefs: z(this),
|
|
1483
1457
|
sport: this.data.game.sport
|
|
@@ -1486,50 +1460,59 @@ class at extends y {
|
|
|
1486
1460
|
renderView() {
|
|
1487
1461
|
const e = this.data.game;
|
|
1488
1462
|
if (!e) return n`<div class="view"><p class="empty">Game not found.</p></div>`;
|
|
1489
|
-
const t = this.ctx, s = b(this.data.conferences),
|
|
1463
|
+
const t = this.ctx, s = b(this.data.conferences), r = t.teamsById[e.awayTeamId] ? t.schoolsById[t.teamsById[e.awayTeamId].schoolId] : null, o = t.teamsById[e.homeTeamId] ? t.schoolsById[t.teamsById[e.homeTeamId].schoolId] : null, l = H(e), h = (c) => e.state === "final" && l !== c && l !== "tie" ? "opacity:0.45" : "", d = e.conferenceId ? s[e.conferenceId] : null, i = 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));
|
|
1490
1464
|
return n`
|
|
1491
1465
|
${C(this, n`
|
|
1492
1466
|
${D(this)}
|
|
1493
|
-
|
|
1494
|
-
<
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1467
|
+
${this.embed ? p : n`
|
|
1468
|
+
<p class="breadcrumbs">
|
|
1469
|
+
<a href=${g(t.hrefs.section, { sport: e.sport, view: "scores" })}>${B(e.sport)}</a> /
|
|
1470
|
+
<a href=${g(t.hrefs.section, { sport: e.sport, view: "scores" })}>Scores/Schedules</a> /
|
|
1471
|
+
${F(t, e.awayTeamId)} at ${F(t, e.homeTeamId)}
|
|
1472
|
+
</p>`}
|
|
1498
1473
|
<div class="card">
|
|
1499
1474
|
<div class="scorehead">
|
|
1500
|
-
${this.teamBlock(t, e, e.awayTeamId,
|
|
1475
|
+
${this.teamBlock(t, e, e.awayTeamId, r, !1)}
|
|
1501
1476
|
<div class="mid">
|
|
1502
1477
|
<div class="bigscore">
|
|
1503
|
-
<span style=${
|
|
1478
|
+
<span style=${h("away")}>${e.awayScore}</span>
|
|
1504
1479
|
<span class="mut" style="font-size:1.6rem">–</span>
|
|
1505
|
-
<span style=${
|
|
1480
|
+
<span style=${h("home")}>${e.homeScore}</span>
|
|
1506
1481
|
</div>
|
|
1507
|
-
<div class="status">${
|
|
1482
|
+
<div class="status">${E(e)}</div>
|
|
1508
1483
|
<div class="status">${w(e.date, { weekday: "short", month: "short", day: "numeric", year: "numeric" })}${e.state === "scheduled" && e.time ? n` · ${q(e.time)}` : p} · ${e.venue || "Venue TBD"}
|
|
1509
1484
|
${e.broadcast ? n` · <span class="pill class">${e.broadcast}</span>` : p}</div>
|
|
1510
1485
|
<div class="status">
|
|
1511
|
-
<span class="pill type">${e.gameType === "conference" ? `${
|
|
1486
|
+
<span class="pill type">${e.gameType === "conference" ? `${d?.name || "Conference"} game` : e.gameType}</span>
|
|
1512
1487
|
${e.label ? n`<span class="pill type">Bracket ${e.label}</span>` : p}
|
|
1513
|
-
${(e.tags || []).map((
|
|
1488
|
+
${(e.tags || []).map((c) => n`<span class="pill type">${c}</span>`)}
|
|
1514
1489
|
</div>
|
|
1490
|
+
${this.embed ? p : n`
|
|
1491
|
+
<div class="status">
|
|
1492
|
+
<a href=${le(t.hrefs, e.id)}>Report a score for this game</a>
|
|
1493
|
+
</div>`}
|
|
1515
1494
|
</div>
|
|
1516
|
-
${this.teamBlock(t, e, e.homeTeamId,
|
|
1495
|
+
${this.teamBlock(t, e, e.homeTeamId, o, !0)}
|
|
1517
1496
|
</div>
|
|
1518
|
-
${this.renderLineScore(e,
|
|
1519
|
-
${this.renderScoringPlays(e,
|
|
1497
|
+
${this.renderLineScore(e, r, o)}
|
|
1498
|
+
${this.renderScoringPlays(e, r, o)}
|
|
1520
1499
|
${e.notes ? n`<p class="note gamenote">${e.notes}</p>` : p}
|
|
1521
1500
|
</div>
|
|
1501
|
+
${this.embed ? n`
|
|
1502
|
+
<p class="fullbox">
|
|
1503
|
+
<a href=${g(t.hrefs.game, { sport: e.sport, id: e.id })}>Full box score →</a>
|
|
1504
|
+
</p>` : n`
|
|
1522
1505
|
${(this.data.coverage || []).length ? n`
|
|
1523
1506
|
<div class="section-title">Coverage</div>
|
|
1524
1507
|
<div class="covgrid">
|
|
1525
|
-
${this.data.coverage.map((
|
|
1526
|
-
<a class="card covcard" href=${
|
|
1527
|
-
${
|
|
1508
|
+
${this.data.coverage.map((c) => n`
|
|
1509
|
+
<a class="card covcard" href=${c.uri}>
|
|
1510
|
+
${c.image ? n`<img class="covimg" src=${c.image} alt="" loading="lazy" />` : p}
|
|
1528
1511
|
<div class="covbody">
|
|
1529
|
-
<div class="covtitle">${
|
|
1530
|
-
${
|
|
1531
|
-
${
|
|
1532
|
-
<div class="covmeta">${[
|
|
1512
|
+
<div class="covtitle">${c.videoDuration ? n`<span class="pill live" style="animation:none">Video</span> ` : p}${c.photos ? n`<span class="pill live" style="animation:none">Photos</span> ` : p}${c.title || c.uri}</div>
|
|
1513
|
+
${c.description ? n`<p class="covdesc">${c.description}</p>` : p}
|
|
1514
|
+
${c.author || c.publishedTime ? n`
|
|
1515
|
+
<div class="covmeta">${[c.author, c.publishedTime ? new Date(c.publishedTime).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" }) : ""].filter(Boolean).join(" · ")}</div>
|
|
1533
1516
|
` : p}
|
|
1534
1517
|
</div>
|
|
1535
1518
|
</a>
|
|
@@ -1537,62 +1520,62 @@ class at extends y {
|
|
|
1537
1520
|
</div>` : p}
|
|
1538
1521
|
<div class="section-title">Season context</div>
|
|
1539
1522
|
<div class="cols">
|
|
1540
|
-
${[[e.awayTeamId,
|
|
1523
|
+
${[[e.awayTeamId, r], [e.homeTeamId, o]].map(([c, m]) => this.renderContext(t, c, m))}
|
|
1541
1524
|
</div>
|
|
1542
|
-
${
|
|
1525
|
+
${i.length ? n`
|
|
1543
1526
|
<div class="section-title">Head to head this season</div>
|
|
1544
1527
|
<div class="card"><ul class="gamelist">
|
|
1545
|
-
${
|
|
1546
|
-
<span class="d">${w(
|
|
1547
|
-
<span class="opp">${F(t,
|
|
1548
|
-
<a class="box" href=${g(t.hrefs.game, { sport: e.sport, id:
|
|
1528
|
+
${i.map((c) => n`<li>
|
|
1529
|
+
<span class="d">${w(c.date)}</span>${E(c)}
|
|
1530
|
+
<span class="opp">${F(t, c.awayTeamId)} ${c.awayScore}, ${F(t, c.homeTeamId)} ${c.homeScore}</span>
|
|
1531
|
+
<a class="box" href=${g(t.hrefs.game, { sport: e.sport, id: c.id })}>Box score →</a>
|
|
1549
1532
|
</li>`)}
|
|
1550
|
-
</ul></div>` : p}
|
|
1533
|
+
</ul></div>` : p}`}
|
|
1551
1534
|
`)}
|
|
1552
1535
|
`;
|
|
1553
1536
|
}
|
|
1554
|
-
teamBlock(e, t, s,
|
|
1555
|
-
if (!
|
|
1556
|
-
const l = e.teamsById[s],
|
|
1537
|
+
teamBlock(e, t, s, r, o) {
|
|
1538
|
+
if (!r) return n`<div class="teamblock ${o ? "right" : ""}"><div class="tname">TBD</div></div>`;
|
|
1539
|
+
const l = e.teamsById[s], h = e.records[s], d = L(r, 58);
|
|
1557
1540
|
return n`
|
|
1558
|
-
<div class="teamblock ${
|
|
1559
|
-
${
|
|
1541
|
+
<div class="teamblock ${o ? "right" : ""}">
|
|
1542
|
+
${d ? n`<img class="crest logo" alt="" loading="lazy" src=${d} />` : n`<span class="crest" style="background:${r.colorPrimary || "#030711"};color:${M(r.colorPrimary || "#030711")}">${V(r)}</span>`}
|
|
1560
1543
|
<div>
|
|
1561
|
-
<div class="tname">${
|
|
1562
|
-
<div class="trec">${
|
|
1544
|
+
<div class="tname">${Q(e, s, t.date)}<a href=${g(e.hrefs.school, { id: r.id })}>${r.name}</a></div>
|
|
1545
|
+
<div class="trec">${r.mascot || ""} · ${k(h)}${l?.conferenceId ? n` · ${k(h, !0)} conf` : p}</div>
|
|
1563
1546
|
</div>
|
|
1564
1547
|
</div>
|
|
1565
1548
|
`;
|
|
1566
1549
|
}
|
|
1567
1550
|
renderLineScore(e, t, s) {
|
|
1568
|
-
const
|
|
1569
|
-
if (!
|
|
1551
|
+
const r = Qe(e);
|
|
1552
|
+
if (!r)
|
|
1570
1553
|
return e.state === "scheduled" ? n`<p class="empty" style="text-align:center">Period scoring will appear once the game starts.</p>` : p;
|
|
1571
|
-
const
|
|
1572
|
-
const m =
|
|
1573
|
-
return m ? m[
|
|
1574
|
-
},
|
|
1554
|
+
const o = Math.max(Z(e.sport), ...r.map((i) => i.period)), l = (i) => Ve(e.sport, i), h = (i, c) => {
|
|
1555
|
+
const m = r.find((f) => f.period === c);
|
|
1556
|
+
return m ? m[i] : e.state === "final" ? 0 : "·";
|
|
1557
|
+
}, d = (i, c, m) => n`
|
|
1575
1558
|
<tr>
|
|
1576
|
-
<td class="teamcell">${T(
|
|
1577
|
-
${Array.from({ length:
|
|
1559
|
+
<td class="teamcell">${T(i, 20)}${i?.abbr || "TBD"}</td>
|
|
1560
|
+
${Array.from({ length: o }, (f, u) => n`<td class="num">${h(c, u + 1)}</td>`)}
|
|
1578
1561
|
<td class="num" style="font-weight:700">${m}</td>
|
|
1579
1562
|
</tr>`;
|
|
1580
1563
|
return n`
|
|
1581
1564
|
<div class="tablewrap" style="border-top:1px solid var(--hsot-gray-2)">
|
|
1582
1565
|
<table class="data" style="max-width:560px;margin:0.6rem auto 0.9rem">
|
|
1583
|
-
<thead><tr><th>Team</th>${Array.from({ length:
|
|
1566
|
+
<thead><tr><th>Team</th>${Array.from({ length: o }, (i, c) => n`<th class="num">${l(c + 1)}</th>`)}<th class="num">T</th></tr></thead>
|
|
1584
1567
|
<tbody>
|
|
1585
|
-
${
|
|
1586
|
-
${
|
|
1568
|
+
${d(t, "away", e.awayScore)}
|
|
1569
|
+
${d(s, "home", e.homeScore)}
|
|
1587
1570
|
</tbody>
|
|
1588
1571
|
</table>
|
|
1589
1572
|
</div>
|
|
1590
1573
|
`;
|
|
1591
1574
|
}
|
|
1592
1575
|
renderScoringPlays(e, t, s) {
|
|
1593
|
-
const
|
|
1594
|
-
if (!
|
|
1595
|
-
const
|
|
1576
|
+
const r = Array.isArray(e.scoringPlays) ? e.scoringPlays : [];
|
|
1577
|
+
if (!r.length) return p;
|
|
1578
|
+
const o = (l) => [l.period, l.clock].filter(Boolean).join(" ");
|
|
1596
1579
|
return n`
|
|
1597
1580
|
<div class="plays">
|
|
1598
1581
|
<div class="plays-title">Scoring plays</div>
|
|
@@ -1603,8 +1586,8 @@ class at extends y {
|
|
|
1603
1586
|
<th class="num">${t?.abbr || "Away"}</th><th class="num">${s?.abbr || "Home"}</th>
|
|
1604
1587
|
</tr></thead>
|
|
1605
1588
|
<tbody>
|
|
1606
|
-
${
|
|
1607
|
-
<td class="when">${
|
|
1589
|
+
${r.map((l) => n`<tr>
|
|
1590
|
+
<td class="when">${o(l) || "·"}</td>
|
|
1608
1591
|
<td class="play">${l.description || "·"}</td>
|
|
1609
1592
|
<td class="num">${l.awayScore}</td>
|
|
1610
1593
|
<td class="num">${l.homeScore}</td>
|
|
@@ -1617,24 +1600,24 @@ class at extends y {
|
|
|
1617
1600
|
}
|
|
1618
1601
|
renderContext(e, t, s) {
|
|
1619
1602
|
if (!s) return p;
|
|
1620
|
-
const
|
|
1603
|
+
const r = e.records[t], o = Y(this.data.games, t);
|
|
1621
1604
|
return n`
|
|
1622
1605
|
<div class="card ctxcard">
|
|
1623
1606
|
<div class="who">${T(s)}${s.name}</div>
|
|
1624
1607
|
<div class="row">
|
|
1625
1608
|
<span>Last 5: ${X(e, t)}</span>
|
|
1626
|
-
<span>Streak: <b>${
|
|
1627
|
-
<span>PF/PA: <b>${
|
|
1628
|
-
<span>Next: ${
|
|
1629
|
-
${
|
|
1609
|
+
<span>Streak: <b>${r ? U(r.results) : "·"}</b></span>
|
|
1610
|
+
<span>PF/PA: <b>${r ? `${r.pf} / ${r.pa}` : "·"}</b></span>
|
|
1611
|
+
<span>Next: ${o ? n`${w(o.date, { month: "numeric", day: "numeric" })}
|
|
1612
|
+
${o.homeTeamId === t ? "vs" : "at"} ${G(e, o.homeTeamId === t ? o.awayTeamId : o.homeTeamId)}` : "·"}</span>
|
|
1630
1613
|
</div>
|
|
1631
1614
|
</div>
|
|
1632
1615
|
`;
|
|
1633
1616
|
}
|
|
1634
1617
|
}
|
|
1635
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore",
|
|
1636
|
-
const
|
|
1637
|
-
class
|
|
1618
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore", st);
|
|
1619
|
+
const at = 250, rt = 2;
|
|
1620
|
+
class ot extends ie {
|
|
1638
1621
|
static properties = {
|
|
1639
1622
|
api: { type: String },
|
|
1640
1623
|
schoolHref: { type: String, attribute: "school-href" },
|
|
@@ -1718,7 +1701,7 @@ class nt extends ie {
|
|
|
1718
1701
|
this.abortController?.abort(), this.results = [], this.open = !1, this.searched = !1;
|
|
1719
1702
|
return;
|
|
1720
1703
|
}
|
|
1721
|
-
this.debounceTimer = setTimeout(() => this.search(t),
|
|
1704
|
+
this.debounceTimer = setTimeout(() => this.search(t), at);
|
|
1722
1705
|
}
|
|
1723
1706
|
async search(e) {
|
|
1724
1707
|
this.abortController?.abort(), this.abortController = new AbortController();
|
|
@@ -1728,8 +1711,8 @@ class nt extends ie {
|
|
|
1728
1711
|
});
|
|
1729
1712
|
if (!s.ok)
|
|
1730
1713
|
return;
|
|
1731
|
-
const
|
|
1732
|
-
this.results =
|
|
1714
|
+
const r = await s.json();
|
|
1715
|
+
this.results = r.items || [], this.activeIndex = -1, this.searched = !0, this.open = !0;
|
|
1733
1716
|
} catch (t) {
|
|
1734
1717
|
t.name !== "AbortError" && console.warn("school search failed", t);
|
|
1735
1718
|
}
|
|
@@ -1763,15 +1746,15 @@ class nt extends ie {
|
|
|
1763
1746
|
return [e.location, e.county && `${e.county} County`].filter(Boolean).join(" — ");
|
|
1764
1747
|
}
|
|
1765
1748
|
renderOption(e, t) {
|
|
1766
|
-
const s = this.where(e),
|
|
1767
|
-
|
|
1749
|
+
const s = this.where(e), r = (o) => {
|
|
1750
|
+
o.preventDefault(), this.go(e);
|
|
1768
1751
|
};
|
|
1769
1752
|
return n`
|
|
1770
1753
|
<li
|
|
1771
1754
|
id="school-option-${t}"
|
|
1772
1755
|
role="option"
|
|
1773
1756
|
aria-selected="${t === this.activeIndex ? "true" : "false"}"
|
|
1774
|
-
@pointerdown="${
|
|
1757
|
+
@pointerdown="${r}"
|
|
1775
1758
|
@mousemove="${() => {
|
|
1776
1759
|
this.activeIndex = t;
|
|
1777
1760
|
}}"
|
|
@@ -1785,7 +1768,7 @@ class nt extends ie {
|
|
|
1785
1768
|
const e = this.searched && !this.results.length, t = n`<li class="empty">No schools found</li>`;
|
|
1786
1769
|
return n`
|
|
1787
1770
|
<ul id="school-search-listbox" role="listbox" aria-label="Schools">
|
|
1788
|
-
${this.results.map((s,
|
|
1771
|
+
${this.results.map((s, r) => this.renderOption(s, r))}
|
|
1789
1772
|
${e ? t : p}
|
|
1790
1773
|
</ul>
|
|
1791
1774
|
`;
|
|
@@ -1811,111 +1794,111 @@ class nt extends ie {
|
|
|
1811
1794
|
`;
|
|
1812
1795
|
}
|
|
1813
1796
|
}
|
|
1814
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-school-search") && globalThis.customElements.define("hsot-school-search",
|
|
1815
|
-
function
|
|
1816
|
-
const t = new Map(a.map((
|
|
1817
|
-
for (const
|
|
1818
|
-
|
|
1819
|
-
const
|
|
1820
|
-
function
|
|
1821
|
-
const
|
|
1822
|
-
if (!
|
|
1823
|
-
const m = [...s.get(
|
|
1824
|
-
return { game:
|
|
1797
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-school-search") && globalThis.customElements.define("hsot-school-search", ot);
|
|
1798
|
+
function ve(a, e) {
|
|
1799
|
+
const t = new Map(a.map((d) => [d.id, d])), s = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
1800
|
+
for (const d of e || [])
|
|
1801
|
+
d.outcome === "winner" && (s.has(d.targetGameId) || s.set(d.targetGameId, []), s.get(d.targetGameId).push(d), r.has(d.sourceGameId) || r.set(d.sourceGameId, []), r.get(d.sourceGameId).push(d));
|
|
1802
|
+
const o = a.filter((d) => !r.has(d.id)), l = (d) => d.targetSlot === "home" ? 0 : 1;
|
|
1803
|
+
function h(d) {
|
|
1804
|
+
const i = t.get(d);
|
|
1805
|
+
if (!i) return null;
|
|
1806
|
+
const m = [...s.get(d) || []].sort((f, u) => l(f) - l(u)).map((f) => h(f.sourceGameId)).filter(Boolean);
|
|
1807
|
+
return { game: i, children: m, bracketGroup: i.bracketGroup };
|
|
1825
1808
|
}
|
|
1826
|
-
return
|
|
1809
|
+
return o.length === 1 ? h(o[0].id) : o.map((d) => h(d.id));
|
|
1827
1810
|
}
|
|
1828
|
-
function
|
|
1811
|
+
function be(a, e = [], t = 0) {
|
|
1829
1812
|
if (!a) return e;
|
|
1830
1813
|
e[t] || (e[t] = []), e[t].push(a.game);
|
|
1831
|
-
for (const s of a.children || [])
|
|
1814
|
+
for (const s of a.children || []) be(s, e, t + 1);
|
|
1832
1815
|
return e;
|
|
1833
1816
|
}
|
|
1834
|
-
const
|
|
1835
|
-
function
|
|
1836
|
-
const s =
|
|
1837
|
-
return
|
|
1817
|
+
const nt = (a) => Math.max(1, Math.round(Math.log2(a || 2)));
|
|
1818
|
+
function it({ round: a, perGroup: e, groupCount: t = 1 }) {
|
|
1819
|
+
const s = nt(e), o = (t === 4 ? s + 2 : t === 2 ? s + 1 : s) - a;
|
|
1820
|
+
return o === 0 ? t > 1 ? "Championship" : "Final" : o === 1 ? "Semifinal" : `Round ${a}`;
|
|
1838
1821
|
}
|
|
1839
|
-
function
|
|
1822
|
+
function lt(a) {
|
|
1840
1823
|
if (!a || !a.length) return "setup";
|
|
1841
1824
|
const e = Math.max(...a.map((s) => s.round ?? 0)), t = a.filter((s) => (s.round ?? 0) === e);
|
|
1842
1825
|
return t.length && t.every((s) => s.state === "final") ? "complete" : a.some((s) => s.state !== "scheduled" || s.homeScore || s.awayScore || s.round === 1 && (s.homeTeamId || s.awayTeamId)) ? "active" : "setup";
|
|
1843
1826
|
}
|
|
1844
|
-
function
|
|
1827
|
+
function ct(a, e) {
|
|
1845
1828
|
const t = a?.groupNames || [];
|
|
1846
1829
|
if (t.length >= 2) {
|
|
1847
|
-
const
|
|
1848
|
-
return (e || []).some((
|
|
1830
|
+
const r = t.map((o) => ({ key: o, name: o }));
|
|
1831
|
+
return (e || []).some((o) => o.bracketGroup === "Championship") && r.push({ key: "Championship", name: "Championship" }), r;
|
|
1849
1832
|
}
|
|
1850
|
-
const s = [...new Set((e || []).map((
|
|
1833
|
+
const s = [...new Set((e || []).map((r) => r.bracketGroup).filter(Boolean))];
|
|
1851
1834
|
return [{ key: null, name: s.length === 1 ? s[0] : "Bracket" }];
|
|
1852
1835
|
}
|
|
1853
|
-
const
|
|
1836
|
+
const dt = (a, e) => e?.key == null ? [...a || []] : (a || []).filter((t) => t.bracketGroup === e.key), re = (a) => {
|
|
1854
1837
|
const e = /(\d+)\s*$/.exec(a.label || "");
|
|
1855
1838
|
return e ? Number(e[1]) : 1 / 0;
|
|
1856
|
-
},
|
|
1857
|
-
function
|
|
1858
|
-
if (a.every((
|
|
1859
|
-
const t =
|
|
1860
|
-
for (const
|
|
1861
|
-
const
|
|
1862
|
-
|
|
1863
|
-
}
|
|
1864
|
-
return (
|
|
1865
|
-
}
|
|
1866
|
-
function
|
|
1867
|
-
const s =
|
|
1839
|
+
}, oe = (a, e) => re(a) - re(e) || String(a.id).localeCompare(String(e.id));
|
|
1840
|
+
function ht(a, e) {
|
|
1841
|
+
if (a.every((r) => Number.isInteger(r.round))) return (r) => r.round;
|
|
1842
|
+
const t = ve(a, e), s = /* @__PURE__ */ new Map();
|
|
1843
|
+
for (const r of Array.isArray(t) ? t : [t]) {
|
|
1844
|
+
const o = be(r), l = o.length - 1;
|
|
1845
|
+
o.forEach((h, d) => h.forEach((i) => s.set(i.id, l - d + 1)));
|
|
1846
|
+
}
|
|
1847
|
+
return (r) => Number.isInteger(r.round) ? r.round : s.get(r.id) || 1;
|
|
1848
|
+
}
|
|
1849
|
+
function mt(a, e, t) {
|
|
1850
|
+
const s = dt(a, t);
|
|
1868
1851
|
if (!s.length) return [];
|
|
1869
|
-
const
|
|
1870
|
-
for (const
|
|
1871
|
-
const
|
|
1872
|
-
|
|
1852
|
+
const r = ht(a || [], e || []), o = /* @__PURE__ */ new Map();
|
|
1853
|
+
for (const i of s) {
|
|
1854
|
+
const c = r(i);
|
|
1855
|
+
o.has(c) || o.set(c, []), o.get(c).push(i);
|
|
1873
1856
|
}
|
|
1874
1857
|
const l = /* @__PURE__ */ new Map();
|
|
1875
|
-
for (const
|
|
1876
|
-
|
|
1877
|
-
const
|
|
1878
|
-
let
|
|
1879
|
-
for (const
|
|
1880
|
-
let
|
|
1881
|
-
if (
|
|
1858
|
+
for (const i of e || [])
|
|
1859
|
+
i.outcome === "winner" && (l.has(i.targetGameId) || l.set(i.targetGameId, []), l.get(i.targetGameId).push(i.sourceGameId));
|
|
1860
|
+
const h = [];
|
|
1861
|
+
let d = null;
|
|
1862
|
+
for (const i of [...o.keys()].sort((c, m) => c - m)) {
|
|
1863
|
+
let c = [...o.get(i)];
|
|
1864
|
+
if (d) {
|
|
1882
1865
|
const m = (f) => {
|
|
1883
|
-
const u = (l.get(f.id) || []).map((v) =>
|
|
1866
|
+
const u = (l.get(f.id) || []).map((v) => d.get(v)).filter((v) => v !== void 0);
|
|
1884
1867
|
return u.length ? Math.min(...u) : 1 / 0;
|
|
1885
1868
|
};
|
|
1886
|
-
|
|
1869
|
+
c.sort((f, u) => m(f) - m(u) || oe(f, u));
|
|
1887
1870
|
} else
|
|
1888
|
-
|
|
1889
|
-
|
|
1871
|
+
c.sort(oe);
|
|
1872
|
+
d = new Map(c.map((m, f) => [m.id, f])), h.push({ round: i, games: c });
|
|
1890
1873
|
}
|
|
1891
|
-
return
|
|
1874
|
+
return h;
|
|
1892
1875
|
}
|
|
1893
|
-
function
|
|
1894
|
-
const s = a[`${e}TeamId`] || null,
|
|
1895
|
-
return { teamId: s, seed:
|
|
1876
|
+
function pt(a, e, t) {
|
|
1877
|
+
const s = a[`${e}TeamId`] || null, r = (t || []).find((l) => l.gameId === a.id && l.slot === e), o = a[`${e}Seed`] ?? r?.seed ?? null;
|
|
1878
|
+
return { teamId: s, seed: o, bye: !s && !!r?.isBye };
|
|
1896
1879
|
}
|
|
1897
|
-
function
|
|
1898
|
-
const e =
|
|
1880
|
+
function ye(a) {
|
|
1881
|
+
const e = H(a);
|
|
1899
1882
|
return e === "home" || e === "away" ? e : null;
|
|
1900
1883
|
}
|
|
1901
|
-
function
|
|
1902
|
-
const t =
|
|
1884
|
+
function ft(a, e) {
|
|
1885
|
+
const t = ve(a || [], e || []);
|
|
1903
1886
|
if (!t || Array.isArray(t)) return null;
|
|
1904
|
-
const s =
|
|
1887
|
+
const s = ye(t.game);
|
|
1905
1888
|
return s && t.game[`${s}TeamId`] || null;
|
|
1906
1889
|
}
|
|
1907
1890
|
const ne = { active: 0, setup: 1, complete: 2 };
|
|
1908
|
-
function
|
|
1891
|
+
function ut(a, { id: e, param: t } = {}) {
|
|
1909
1892
|
const s = a || [];
|
|
1910
1893
|
if (!s.length) return null;
|
|
1911
|
-
for (const
|
|
1912
|
-
if (!
|
|
1913
|
-
const
|
|
1914
|
-
if (
|
|
1894
|
+
for (const r of [e, t]) {
|
|
1895
|
+
if (!r) continue;
|
|
1896
|
+
const o = s.find((l) => l.id === r);
|
|
1897
|
+
if (o) return o;
|
|
1915
1898
|
}
|
|
1916
|
-
return [...s].sort((
|
|
1899
|
+
return [...s].sort((r, o) => (ne[r.status] ?? 3) - (ne[o.status] ?? 3) || String(r.name || "").localeCompare(String(o.name || "")))[0];
|
|
1917
1900
|
}
|
|
1918
|
-
const
|
|
1901
|
+
const gt = $`
|
|
1919
1902
|
.bracket { display: flex; gap: 1rem; align-items: stretch; overflow-x: auto; padding-bottom: 0.5rem; }
|
|
1920
1903
|
.round { flex: 0 0 250px; display: flex; flex-direction: column; min-width: 0; }
|
|
1921
1904
|
.roundhead {
|
|
@@ -1961,8 +1944,8 @@ const vt = $`
|
|
|
1961
1944
|
.champ .tname a { color: inherit; text-decoration: none; font-weight: 700; }
|
|
1962
1945
|
@media (max-width: 720px) { .round { flex-basis: 215px; } }
|
|
1963
1946
|
`;
|
|
1964
|
-
class
|
|
1965
|
-
static styles = [P,
|
|
1947
|
+
class vt extends y {
|
|
1948
|
+
static styles = [P, gt];
|
|
1966
1949
|
static properties = {
|
|
1967
1950
|
...y.properties,
|
|
1968
1951
|
sport: { type: String },
|
|
@@ -1975,24 +1958,24 @@ class bt extends y {
|
|
|
1975
1958
|
super(), this.sport = "football", this.season = "", this.tournamentId = "", this.picked = "", this.group = null;
|
|
1976
1959
|
}
|
|
1977
1960
|
async fetchData(e) {
|
|
1978
|
-
const t = this.season ||
|
|
1979
|
-
if (!
|
|
1980
|
-
const [l,
|
|
1981
|
-
e.listSeedings(
|
|
1982
|
-
e.listEdges(
|
|
1983
|
-
e.listGames({ tournamentId:
|
|
1961
|
+
const t = this.season || _(), s = (await e.listTournaments({ sport: this.sport, season: t })).items, r = new URLSearchParams(globalThis.location?.search || "").get("tournament"), o = ut(s, { id: this.picked || this.tournamentId, param: r });
|
|
1962
|
+
if (!o) return { season: t, tournaments: s, tournament: null };
|
|
1963
|
+
const [l, h, d, i, c] = await Promise.all([
|
|
1964
|
+
e.listSeedings(o.id),
|
|
1965
|
+
e.listEdges(o.id),
|
|
1966
|
+
e.listGames({ tournamentId: o.id }),
|
|
1984
1967
|
e.listSchools(),
|
|
1985
1968
|
e.listTeams({ sport: this.sport })
|
|
1986
1969
|
]);
|
|
1987
1970
|
return {
|
|
1988
1971
|
season: t,
|
|
1989
1972
|
tournaments: s,
|
|
1990
|
-
tournament:
|
|
1973
|
+
tournament: o,
|
|
1991
1974
|
seedings: l.items,
|
|
1992
|
-
edges:
|
|
1993
|
-
games:
|
|
1994
|
-
schools:
|
|
1995
|
-
teams:
|
|
1975
|
+
edges: h.items,
|
|
1976
|
+
games: d.items,
|
|
1977
|
+
schools: i.items,
|
|
1978
|
+
teams: c.items
|
|
1996
1979
|
};
|
|
1997
1980
|
}
|
|
1998
1981
|
get ctx() {
|
|
@@ -2018,7 +2001,7 @@ class bt extends y {
|
|
|
2018
2001
|
}
|
|
2019
2002
|
}
|
|
2020
2003
|
renderView() {
|
|
2021
|
-
const e = this.data, t = this.ctx, s =
|
|
2004
|
+
const e = this.data, t = this.ctx, s = j(this, t, {
|
|
2022
2005
|
title: n`${B(this.sport)} playoff brackets`,
|
|
2023
2006
|
sub: e.tournament ? n`${e.tournament.name} · ${e.season} season` : n`${e.season} season`,
|
|
2024
2007
|
teams: e.teams
|
|
@@ -2028,7 +2011,7 @@ class bt extends y {
|
|
|
2028
2011
|
${D(this)}
|
|
2029
2012
|
<div class="card"><div class="empty">No ${this.sport} brackets have been published for the ${e.season} season yet.</div></div>
|
|
2030
2013
|
`)}`;
|
|
2031
|
-
const
|
|
2014
|
+
const r = ct(e.tournament, e.games), o = r.find((m) => m.key === this.group) || r[0], l = (e.tournament.groupNames || []).length >= 2 ? e.tournament.groupNames.length : 1, h = (Number(e.tournament.size) || 0) / l, d = mt(e.games, e.edges, o), i = lt(e.games), c = ft(e.games, e.edges);
|
|
2032
2015
|
return n`
|
|
2033
2016
|
${s}
|
|
2034
2017
|
${C(this, n`
|
|
@@ -2039,25 +2022,25 @@ class bt extends y {
|
|
|
2039
2022
|
${e.tournaments.map((m) => n`<button class="chip ${m.id === e.tournament.id ? "on" : ""}"
|
|
2040
2023
|
@click=${() => this.pick(m.id)}>${m.name}</button>`)}
|
|
2041
2024
|
</div>` : p}
|
|
2042
|
-
${
|
|
2025
|
+
${r.length > 1 ? n`
|
|
2043
2026
|
<div role="tablist" aria-label="Bracket group">
|
|
2044
|
-
${
|
|
2045
|
-
aria-selected=${m.key ===
|
|
2027
|
+
${r.map((m) => n`<button class="chip ${m.key === o.key ? "on" : ""}" role="tab"
|
|
2028
|
+
aria-selected=${m.key === o.key ? "true" : "false"}
|
|
2046
2029
|
@click=${() => {
|
|
2047
2030
|
this.group = m.key;
|
|
2048
2031
|
}}>${m.name}</button>`)}
|
|
2049
2032
|
</div>` : p}
|
|
2050
2033
|
<span class="spacer"></span>
|
|
2051
|
-
<span class="pill ${
|
|
2034
|
+
<span class="pill ${i === "complete" ? "final" : i === "active" ? "class" : "type"}">${i === "complete" ? "Complete" : i === "active" ? "In progress" : "Bracket set"}</span>
|
|
2052
2035
|
<span class="asof">${e.tournament.size}-team ${String(e.tournament.format || "").replace(/_/g, " ")}</span>
|
|
2053
2036
|
</div>
|
|
2054
|
-
${
|
|
2055
|
-
${T(I(t,
|
|
2056
|
-
${
|
|
2057
|
-
<div class="bracket" role="region" aria-label="${
|
|
2058
|
-
${
|
|
2037
|
+
${c ? n`<div class="champ"><span class="pill champ">Champion</span>
|
|
2038
|
+
${T(I(t, c), 26)}<span class="tname">${O(t, c)}</span></div>` : p}
|
|
2039
|
+
${d.length ? n`
|
|
2040
|
+
<div class="bracket" role="region" aria-label="${o.name} bracket">
|
|
2041
|
+
${d.map((m) => n`
|
|
2059
2042
|
<section class="round">
|
|
2060
|
-
<h3 class="roundhead">${
|
|
2043
|
+
<h3 class="roundhead">${it({ round: m.round, perGroup: h, groupCount: l })}</h3>
|
|
2061
2044
|
<div class="games">${m.games.map((f) => this.renderMatchup(t, f))}</div>
|
|
2062
2045
|
</section>`)}
|
|
2063
2046
|
</div>` : n`<div class="card"><div class="empty">This bracket has no games yet.</div></div>`}
|
|
@@ -2071,7 +2054,7 @@ class bt extends y {
|
|
|
2071
2054
|
${this.renderSlot(e, t, "home")}
|
|
2072
2055
|
${this.renderSlot(e, t, "away")}
|
|
2073
2056
|
<footer class="mfoot">
|
|
2074
|
-
${
|
|
2057
|
+
${E(t)}
|
|
2075
2058
|
${t.label ? n`<span class="label">${t.label}</span>` : p}
|
|
2076
2059
|
<span class="spacer"></span>
|
|
2077
2060
|
${s ? n`<a class="box" href=${g(e.hrefs.game, { sport: this.sport, id: t.id })}>Box score</a>` : p}
|
|
@@ -2080,41 +2063,40 @@ class bt extends y {
|
|
|
2080
2063
|
`;
|
|
2081
2064
|
}
|
|
2082
2065
|
renderSlot(e, t, s) {
|
|
2083
|
-
const { teamId:
|
|
2066
|
+
const { teamId: r, seed: o, bye: l } = pt(t, s, this.data.seedings), h = ye(t), d = t.state === "live" || t.state === "final";
|
|
2084
2067
|
return n`
|
|
2085
|
-
<div class="slot ${
|
|
2086
|
-
<span class="seed">${
|
|
2087
|
-
${
|
|
2088
|
-
${
|
|
2068
|
+
<div class="slot ${h ? h === s ? "winner" : "loser" : ""}">
|
|
2069
|
+
<span class="seed">${o ?? ""}</span>
|
|
2070
|
+
${r ? n`${T(I(e, r), 22)}<span class="tname">${O(e, r, t.date)}</span>` : l ? n`<span class="tname bye">Bye</span>` : n`<span class="tname mut">TBD</span>`}
|
|
2071
|
+
${d ? n`<span class="score">${t[`${s}Score`] ?? 0}</span>` : p}
|
|
2089
2072
|
</div>
|
|
2090
2073
|
`;
|
|
2091
2074
|
}
|
|
2092
2075
|
}
|
|
2093
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-brackets") && globalThis.customElements.define("hsot-brackets",
|
|
2076
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-brackets") && globalThis.customElements.define("hsot-brackets", vt);
|
|
2094
2077
|
export {
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2078
|
+
A as D,
|
|
2079
|
+
st as H,
|
|
2080
|
+
vt as a,
|
|
2081
|
+
je as b,
|
|
2082
|
+
We as c,
|
|
2083
|
+
ot as d,
|
|
2084
|
+
Oe as e,
|
|
2085
|
+
He as f,
|
|
2086
|
+
ct as g,
|
|
2087
|
+
ve as h,
|
|
2088
|
+
ft as i,
|
|
2089
|
+
N as j,
|
|
2090
|
+
lt as k,
|
|
2091
|
+
g as l,
|
|
2092
|
+
H as m,
|
|
2093
|
+
$t as n,
|
|
2094
|
+
it as o,
|
|
2095
|
+
Me as p,
|
|
2096
|
+
mt as q,
|
|
2114
2097
|
k as r,
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
ve as w
|
|
2098
|
+
he as s,
|
|
2099
|
+
U as t,
|
|
2100
|
+
K as u,
|
|
2101
|
+
be as v
|
|
2120
2102
|
};
|