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