@wral/hsot-data 0.4.0 → 0.5.1
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 +21 -4
- package/dist/define.mjs +1 -1
- package/dist/define.standalone.js +807 -732
- package/dist/{hsot-brackets-Bqk0gI3J.js → hsot-brackets-ClfXvdcH.js} +552 -477
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { LitElement as
|
|
2
|
-
import { createClient as
|
|
3
|
-
const
|
|
1
|
+
import { LitElement as ce, html as n, css as $, nothing as p, svg as te } from "lit";
|
|
2
|
+
import { createClient as Be } from "./client.mjs";
|
|
3
|
+
const P = {
|
|
4
4
|
game: "/{sport}/game/{id}/",
|
|
5
5
|
school: "/school/{id}/",
|
|
6
6
|
section: "/{sport}/{view}/",
|
|
@@ -13,14 +13,14 @@ function g(a, e) {
|
|
|
13
13
|
}
|
|
14
14
|
function z(a) {
|
|
15
15
|
return {
|
|
16
|
-
game: a.getAttribute("game-href") ||
|
|
17
|
-
school: a.getAttribute("school-href") ||
|
|
18
|
-
section: a.getAttribute("section-href") ||
|
|
19
|
-
report: a.getAttribute("report-href") ||
|
|
16
|
+
game: a.getAttribute("game-href") || P.game,
|
|
17
|
+
school: a.getAttribute("school-href") || P.school,
|
|
18
|
+
section: a.getAttribute("section-href") || P.section,
|
|
19
|
+
report: a.getAttribute("report-href") || P.report
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
const t = g(a.report ||
|
|
22
|
+
function de(a, e = "") {
|
|
23
|
+
const t = g(a.report || P.report, { id: e || "" });
|
|
24
24
|
return e ? t : t.replace(/([?&])game=(?=&|$)/, "$1").replace(/[?&]$/, "").replace(/\?&/, "?");
|
|
25
25
|
}
|
|
26
26
|
const k = (a) => a ? a.charAt(0).toUpperCase() + a.slice(1) : "";
|
|
@@ -29,34 +29,34 @@ function x(a, e) {
|
|
|
29
29
|
const [t, s, r] = String(a).split("-").map(Number);
|
|
30
30
|
return !t || !s || !r ? "TBD" : new Date(t, s - 1, r).toLocaleDateString("en-US", e || { weekday: "short", month: "short", day: "numeric" });
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function V(a) {
|
|
33
33
|
if (!a) return "";
|
|
34
34
|
const [e, t] = String(a).split(":").map(Number);
|
|
35
35
|
if (Number.isNaN(e)) return "";
|
|
36
36
|
const s = e >= 12 ? "PM" : "AM";
|
|
37
37
|
return `${(e + 11) % 12 + 1}:${String(t || 0).padStart(2, "0")} ${s}`;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function De(a) {
|
|
40
40
|
return a ? `${Math.floor(a / 12)}-${a % 12}` : "·";
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function Fe(a) {
|
|
43
43
|
return (Array.isArray(a?.positions) ? a.positions : String(a?.position ?? "").split(/[/,]/)).map((t) => String(t ?? "").trim()).filter(Boolean).join("/");
|
|
44
44
|
}
|
|
45
45
|
function _(a = /* @__PURE__ */ new Date()) {
|
|
46
46
|
const e = a.getFullYear();
|
|
47
47
|
return a.getMonth() >= 6 ? `${e}-${e + 1}` : `${e - 1}-${e}`;
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function Y(a = /* @__PURE__ */ new Date()) {
|
|
50
50
|
const e = (t) => String(t).padStart(2, "0");
|
|
51
51
|
return `${a.getFullYear()}-${e(a.getMonth() + 1)}-${e(a.getDate())}`;
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function ze(a, e = Y()) {
|
|
54
54
|
const t = [...new Set((a || []).filter(Boolean))].sort();
|
|
55
55
|
if (!t.length || t.includes(e)) return e;
|
|
56
56
|
const s = t.filter((r) => r < e);
|
|
57
57
|
return s.length ? s[s.length - 1] : t[0];
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function K(a) {
|
|
60
60
|
return a ? (a.abbr || a.name || "?").slice(0, 4).toUpperCase() : "?";
|
|
61
61
|
}
|
|
62
62
|
function G(a) {
|
|
@@ -64,22 +64,22 @@ function G(a) {
|
|
|
64
64
|
const e = parseInt(a.slice(1), 16), t = e >> 16 & 255, s = e >> 8 & 255, r = e & 255;
|
|
65
65
|
return 0.299 * t + 0.587 * s + 0.114 * r > 150 ? "#0F1B33" : "#FFFFFF";
|
|
66
66
|
}
|
|
67
|
-
const
|
|
67
|
+
const Ae = (a) => {
|
|
68
68
|
const e = ["th", "st", "nd", "rd"], t = a % 100;
|
|
69
69
|
return a + (e[(t - 20) % 10] || e[t] || e[0]);
|
|
70
70
|
};
|
|
71
|
-
function
|
|
71
|
+
function q(a, e) {
|
|
72
72
|
const t = (o) => {
|
|
73
73
|
const i = /^\d+/.exec(String(o ?? ""));
|
|
74
74
|
return i ? Number(i[0]) : null;
|
|
75
75
|
}, s = t(a), r = t(e);
|
|
76
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" });
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function he(a, e) {
|
|
79
79
|
const t = (s) => String(s?.name ?? s ?? "");
|
|
80
80
|
return t(a).localeCompare(t(e), "en", { numeric: !0, sensitivity: "base" });
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function me(a) {
|
|
83
83
|
if (a.state === "live") {
|
|
84
84
|
const e = [a.period, a.clock].filter(Boolean).join(" ");
|
|
85
85
|
return { kind: "live", label: e ? `Live · ${e}` : "Live" };
|
|
@@ -88,21 +88,21 @@ function de(a) {
|
|
|
88
88
|
const e = [];
|
|
89
89
|
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(" · ")}` : ""}` };
|
|
90
90
|
}
|
|
91
|
-
return a.state === "postponed" ? { kind: "warn", label: "Postponed" } : a.state === "canceled" ? { kind: "warn", label: "Canceled" } : { kind: "sched", label: `${x(a.date, { month: "short", day: "numeric" })} · ${
|
|
91
|
+
return a.state === "postponed" ? { kind: "warn", label: "Postponed" } : a.state === "canceled" ? { kind: "warn", label: "Canceled" } : { kind: "sched", label: `${x(a.date, { month: "short", day: "numeric" })} · ${V(a.time)}`.replace(/ · $/, "") };
|
|
92
92
|
}
|
|
93
|
-
const
|
|
94
|
-
function
|
|
93
|
+
const Pe = ["boys", "girls"];
|
|
94
|
+
function pe(a, e) {
|
|
95
95
|
return e ? a ? a.gender === e || a.gender === "coed" : !1 : !0;
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
return e ? (a || []).filter((t) =>
|
|
97
|
+
function fe(a, e) {
|
|
98
|
+
return e ? (a || []).filter((t) => pe(t, e)) : a || [];
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function W(a) {
|
|
101
101
|
const e = new Set((a || []).map((t) => t && t.gender));
|
|
102
|
-
return
|
|
102
|
+
return Pe.filter((t) => e.has(t));
|
|
103
103
|
}
|
|
104
|
-
const
|
|
105
|
-
function
|
|
104
|
+
const Ee = (a) => W(a).length === 2, _e = /* @__PURE__ */ new Set(["game", "story", "page", "forum", "video", "gallery"]);
|
|
105
|
+
function S(a) {
|
|
106
106
|
let e = String(a || "").replace(/^[a-z][a-z0-9+.-]*:\/\/[^/#?]*/i, "");
|
|
107
107
|
const t = e.indexOf("#");
|
|
108
108
|
let s = "";
|
|
@@ -110,26 +110,26 @@ function I(a) {
|
|
|
110
110
|
let r = e.split("?")[0] + s;
|
|
111
111
|
return r = r.replace(/([^:])\/{2,}/g, "$1/").replace(/^\/{2,}/, "/"), r = r.replace(/^\/(?=#)/, ""), r.length > 1 && (r = r.replace(/\/+$/, "")), r.toLowerCase();
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function ue() {
|
|
114
114
|
const a = globalThis.location;
|
|
115
115
|
if (!a) return "";
|
|
116
116
|
const e = (a.hash || "").startsWith("#/") ? a.hash : "";
|
|
117
|
-
return
|
|
117
|
+
return S((a.pathname || "") + e);
|
|
118
118
|
}
|
|
119
|
-
function
|
|
119
|
+
function Re(a, e, t) {
|
|
120
120
|
if (!t) return null;
|
|
121
|
-
const s =
|
|
121
|
+
const s = S(a);
|
|
122
122
|
if (!s) return null;
|
|
123
|
-
const r =
|
|
123
|
+
const r = S(g(e.game, { sport: t, id: "" })), o = S(g(e.school, { id: "" }));
|
|
124
124
|
if (s === r || s.startsWith(`${r}/`) || s === o || s.startsWith(`${o}/`)) return null;
|
|
125
|
-
const i =
|
|
125
|
+
const i = S(g(e.section, { sport: t, view: "" }));
|
|
126
126
|
if (s === i) return "";
|
|
127
127
|
if (!s.startsWith(`${i}/`)) return null;
|
|
128
|
-
const
|
|
129
|
-
return
|
|
128
|
+
const l = s.slice(i.length + 1), d = l.split("/");
|
|
129
|
+
return d.length > 2 || d.some((m) => !/^[a-z][a-z-]*$/.test(m)) || _e.has(d[0]) ? null : l;
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
const s = (o) => g(t.section, { sport: a, view: o }).replace(/([^:])\/{2,}/g, "$1/"), r =
|
|
131
|
+
function Ne(a, e, t) {
|
|
132
|
+
const s = (o) => g(t.section, { sport: a, view: o }).replace(/([^:])\/{2,}/g, "$1/"), r = Ee(e) ? [
|
|
133
133
|
{ label: "Boys Standings", href: s("boys/standings") },
|
|
134
134
|
{ label: "Girls Standings", href: s("girls/standings") }
|
|
135
135
|
] : [{ label: "Standings", href: s("standings") }];
|
|
@@ -141,12 +141,12 @@ function Ee(a, e, t) {
|
|
|
141
141
|
{ label: "Polls & Rankings", href: s("rankings") }
|
|
142
142
|
];
|
|
143
143
|
}
|
|
144
|
-
function
|
|
145
|
-
const t =
|
|
144
|
+
function Ge(a, e = ue()) {
|
|
145
|
+
const t = S(e);
|
|
146
146
|
for (const s of a.querySelectorAll(':scope > a[slot="nav"]'))
|
|
147
|
-
t &&
|
|
147
|
+
t && S(s.getAttribute("href")) === t ? s.setAttribute("aria-current", "page") : s.removeAttribute("aria-current");
|
|
148
148
|
}
|
|
149
|
-
class
|
|
149
|
+
class w extends ce {
|
|
150
150
|
static properties = {
|
|
151
151
|
api: { type: String },
|
|
152
152
|
refreshInterval: { type: Number, attribute: "refresh-interval" },
|
|
@@ -165,7 +165,7 @@ class $ extends le {
|
|
|
165
165
|
this._client = e, this.isConnected && this.load();
|
|
166
166
|
}
|
|
167
167
|
get client() {
|
|
168
|
-
return this._client ? this._client : this.api ?
|
|
168
|
+
return this._client ? this._client : this.api ? Be({ baseUrl: this.api }) : null;
|
|
169
169
|
}
|
|
170
170
|
connectedCallback() {
|
|
171
171
|
super.connectedCallback(), this._setupInterval();
|
|
@@ -177,7 +177,7 @@ class $ extends le {
|
|
|
177
177
|
this.load();
|
|
178
178
|
}
|
|
179
179
|
updated(e) {
|
|
180
|
-
e.has("api") && e.get("api") !== void 0 && e.get("api") !== this.api && this.load(), e.has("refreshInterval") && this._setupInterval(),
|
|
180
|
+
e.has("api") && e.get("api") !== void 0 && e.get("api") !== this.api && this.load(), e.has("refreshInterval") && this._setupInterval(), Ge(this);
|
|
181
181
|
}
|
|
182
182
|
async load() {
|
|
183
183
|
const e = this.client;
|
|
@@ -212,7 +212,7 @@ class $ extends le {
|
|
|
212
212
|
return n``;
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
const
|
|
215
|
+
const y = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), Me = $`
|
|
216
216
|
:host {
|
|
217
217
|
--hsot-red: var(--color-red, #D1232A);
|
|
218
218
|
--hsot-red-deep: var(--color-red-dark, #951C21);
|
|
@@ -250,7 +250,7 @@ const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), _e = w`
|
|
|
250
250
|
outline-offset: 1px;
|
|
251
251
|
}
|
|
252
252
|
.mut { color: var(--hsot-gray-5); }
|
|
253
|
-
`,
|
|
253
|
+
`, Le = $`
|
|
254
254
|
.band { background: var(--hsot-white); color: var(--hsot-black); }
|
|
255
255
|
.band .inner { max-width: 1366px; margin: 0 auto; padding: 1.1rem 1.25rem 0; }
|
|
256
256
|
.band h1, .band h2.bandtitle {
|
|
@@ -299,7 +299,7 @@ const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), _e = w`
|
|
|
299
299
|
@media (max-width: 720px) {
|
|
300
300
|
.band h1, .band h2.bandtitle, .band.section h1, .band.section h2.bandtitle { font-size: 1.8rem; }
|
|
301
301
|
}
|
|
302
|
-
`,
|
|
302
|
+
`, Oe = $`
|
|
303
303
|
.view { max-width: 1366px; margin: 0 auto; padding: 1.25rem; box-sizing: border-box; }
|
|
304
304
|
/* Optional right rail (slot="rail" light-DOM children): a divided 300px
|
|
305
305
|
column on desktop, stacked under the view content on smaller screens. */
|
|
@@ -363,7 +363,7 @@ const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), _e = w`
|
|
|
363
363
|
.error { padding: 1.2rem 1rem; color: var(--hsot-red-deep); font-size: 0.9rem; }
|
|
364
364
|
.note { font-size: 0.8125rem; color: var(--hsot-gray-5); margin: 0.6rem 0 0; }
|
|
365
365
|
.loading { padding: 1.2rem; color: var(--hsot-gray-5); font-family: var(--hsot-heading-font); }
|
|
366
|
-
`,
|
|
366
|
+
`, He = $`
|
|
367
367
|
.pill {
|
|
368
368
|
display: inline-block; font-family: var(--hsot-heading-font); font-weight: 700;
|
|
369
369
|
font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.04em;
|
|
@@ -378,7 +378,7 @@ const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), _e = w`
|
|
|
378
378
|
.pill.champ { background: var(--hsot-straw); color: #6b5900; }
|
|
379
379
|
@keyframes hsot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
|
|
380
380
|
@media (prefers-reduced-motion: reduce) { .pill.live { animation: none; } }
|
|
381
|
-
`,
|
|
381
|
+
`, Ue = $`
|
|
382
382
|
.tablewrap { overflow-x: auto; }
|
|
383
383
|
table.data { font-family: var(--hsot-heading-font); font-size: 14px; border-collapse: collapse; width: 100%; }
|
|
384
384
|
table.data th {
|
|
@@ -396,7 +396,7 @@ const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), _e = w`
|
|
|
396
396
|
table.data tbody tr.rowlink:hover { background: var(--hsot-gray-1); }
|
|
397
397
|
table.data td.teamcell a { color: inherit; text-decoration: none; font-weight: 500; }
|
|
398
398
|
table.data td.teamcell a:hover { text-decoration: underline; }
|
|
399
|
-
`,
|
|
399
|
+
`, je = $`
|
|
400
400
|
.swatch {
|
|
401
401
|
display: inline-flex; align-items: center; justify-content: center;
|
|
402
402
|
width: 26px; height: 26px; border-radius: 50%;
|
|
@@ -420,7 +420,7 @@ const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), _e = w`
|
|
|
420
420
|
.dot.W { background: var(--hsot-win); }
|
|
421
421
|
.dot.L { background: var(--hsot-loss); }
|
|
422
422
|
.dot.T { background: var(--hsot-tie); }
|
|
423
|
-
`,
|
|
423
|
+
`, qe = $`
|
|
424
424
|
ul.gamelist { list-style: none; margin: 0; padding: 0; }
|
|
425
425
|
.gamelist li {
|
|
426
426
|
display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 1rem;
|
|
@@ -470,24 +470,24 @@ const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), _e = w`
|
|
|
470
470
|
.gamelist .ff { color: var(--hsot-gray-5); font-size: 0.78rem; font-style: italic; }
|
|
471
471
|
.gamelist .where { color: var(--hsot-gray-5); font-size: 0.78rem; }
|
|
472
472
|
.gamelist a.box { font-size: 0.78rem; }
|
|
473
|
-
`,
|
|
473
|
+
`, A = [Me, Le, Oe, He, Ue, je, qe];
|
|
474
474
|
function H(a) {
|
|
475
475
|
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";
|
|
476
476
|
}
|
|
477
|
-
function
|
|
477
|
+
function We(a) {
|
|
478
478
|
return a && (a.forfeit === "home" || a.forfeit === "away") ? a.forfeit : null;
|
|
479
479
|
}
|
|
480
|
-
function
|
|
480
|
+
function R(a, e) {
|
|
481
481
|
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, i) => String(o.date).localeCompare(String(i.date)));
|
|
482
482
|
for (const o of r) {
|
|
483
|
-
const i = H(o),
|
|
484
|
-
for (const
|
|
485
|
-
const
|
|
486
|
-
if (!
|
|
487
|
-
const
|
|
488
|
-
|
|
483
|
+
const i = H(o), l = o.gameType === "conference";
|
|
484
|
+
for (const d of ["home", "away"]) {
|
|
485
|
+
const m = d === "home" ? o.homeTeamId : o.awayTeamId;
|
|
486
|
+
if (!m) continue;
|
|
487
|
+
const h = s(m), c = d === "home" ? o.homeScore : o.awayScore, f = d === "home" ? o.awayScore : o.homeScore;
|
|
488
|
+
h.pf += c, h.pa += f;
|
|
489
489
|
let u = "T";
|
|
490
|
-
i === "tie" ? (
|
|
490
|
+
i === "tie" ? (h.t += 1, l && (h.ct += 1)) : i === d ? (h.w += 1, l && (h.cw += 1), u = "W") : (h.l += 1, l && (h.cl += 1), u = "L"), h.results.push({ gameId: o.id, date: o.date, mark: u, my: c, their: f, opp: d === "home" ? o.awayTeamId : o.homeTeamId, conf: l });
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
493
|
return t;
|
|
@@ -503,47 +503,47 @@ const se = (a, e, t) => {
|
|
|
503
503
|
const s = a + e + t;
|
|
504
504
|
return s ? (a + t / 2) / s : 0;
|
|
505
505
|
}, ae = (a) => a.toFixed(3).replace("0.", ".");
|
|
506
|
-
function
|
|
506
|
+
function I(a, e = !1) {
|
|
507
507
|
if (!a) return "0-0";
|
|
508
508
|
const t = e ? a.cw : a.w, s = e ? a.cl : a.l, r = e ? a.ct : a.t;
|
|
509
509
|
return `${t}-${s}${r ? `-${r}` : ""}`;
|
|
510
510
|
}
|
|
511
|
-
function
|
|
511
|
+
function ge(a, e) {
|
|
512
512
|
return a.map((t) => {
|
|
513
513
|
const s = e[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] };
|
|
514
514
|
return { team: t, rec: s, confPct: se(s.cw, s.cl, s.ct), overallPct: se(s.w, s.l, s.t) };
|
|
515
515
|
}).sort((t, s) => s.confPct - t.confPct || s.overallPct - t.overallPct || s.rec.pf - s.rec.pa - (t.rec.pf - t.rec.pa));
|
|
516
516
|
}
|
|
517
|
-
function
|
|
517
|
+
function Q(a, e) {
|
|
518
518
|
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;
|
|
519
519
|
}
|
|
520
520
|
function re(a, e) {
|
|
521
521
|
const t = a[e];
|
|
522
522
|
return t && t.results.length ? t.results[t.results.length - 1] : null;
|
|
523
523
|
}
|
|
524
|
-
function
|
|
524
|
+
function Nt(a, e, t, s = "") {
|
|
525
525
|
let r = null;
|
|
526
526
|
for (const o of a || [])
|
|
527
527
|
o.sport === e && (t && o.effectiveDate > t || s && o.gender && o.gender !== s || (!r || o.effectiveDate > r.effectiveDate) && (r = o));
|
|
528
528
|
return r;
|
|
529
529
|
}
|
|
530
|
-
function
|
|
530
|
+
function Z(a, e, t, s, r) {
|
|
531
531
|
const o = e[t];
|
|
532
532
|
if (!o) return null;
|
|
533
533
|
const i = /* @__PURE__ */ new Map();
|
|
534
|
-
for (const
|
|
535
|
-
if (
|
|
536
|
-
const
|
|
537
|
-
(!
|
|
534
|
+
for (const d of a || []) {
|
|
535
|
+
if (d.sport !== s || r && d.effectiveDate > r || d.gender && o.gender !== d.gender && o.gender !== "coed") continue;
|
|
536
|
+
const m = d.gender || "", h = i.get(m);
|
|
537
|
+
(!h || d.effectiveDate > h.effectiveDate) && i.set(m, d);
|
|
538
538
|
}
|
|
539
|
-
let
|
|
540
|
-
for (const
|
|
541
|
-
const
|
|
542
|
-
|
|
539
|
+
let l = null;
|
|
540
|
+
for (const d of i.values()) {
|
|
541
|
+
const m = (d.teamIds || []).indexOf(t);
|
|
542
|
+
m !== -1 && (!l || d.effectiveDate > l.effectiveDate) && (l = { poll: d, rank: m + 1 });
|
|
543
543
|
}
|
|
544
|
-
return
|
|
544
|
+
return l ? l.rank : null;
|
|
545
545
|
}
|
|
546
|
-
function
|
|
546
|
+
function Ve(a, e, t) {
|
|
547
547
|
if (!a) return { kind: "none", delta: 0 };
|
|
548
548
|
const s = (a.teamIds || []).indexOf(t) + 1;
|
|
549
549
|
if (!s) return { kind: "none", delta: 0 };
|
|
@@ -553,11 +553,11 @@ function Ue(a, e, t) {
|
|
|
553
553
|
const o = r - s;
|
|
554
554
|
return o > 0 ? { kind: "up", delta: o } : o < 0 ? { kind: "down", delta: -o } : { kind: "same", delta: 0 };
|
|
555
555
|
}
|
|
556
|
-
function
|
|
556
|
+
function Ye(a) {
|
|
557
557
|
return /^https?:\/\//i.test(String(a || ""));
|
|
558
558
|
}
|
|
559
|
-
function
|
|
560
|
-
if (!
|
|
559
|
+
function ve(a, { w: e, h: t } = {}) {
|
|
560
|
+
if (!Ye(a)) return "";
|
|
561
561
|
const s = [];
|
|
562
562
|
e && s.push(`w=${Math.max(1, Math.round(e))}`), t && s.push(`h=${Math.max(1, Math.round(t))}`), s.push("f=webp");
|
|
563
563
|
const r = a.includes("?") ? "&" : "?";
|
|
@@ -565,25 +565,25 @@ function ue(a, { w: e, h: t } = {}) {
|
|
|
565
565
|
}
|
|
566
566
|
function M(a, e) {
|
|
567
567
|
const t = e * 2;
|
|
568
|
-
return
|
|
568
|
+
return ve(a?.logoAssetId, { w: t, h: t });
|
|
569
569
|
}
|
|
570
|
-
function
|
|
571
|
-
return
|
|
570
|
+
function Ke(a, e) {
|
|
571
|
+
return ve(a?.photoAssetId, { w: e * 2 });
|
|
572
572
|
}
|
|
573
573
|
function j(a, e, { title: t, sub: s, teams: r }) {
|
|
574
|
-
const o =
|
|
574
|
+
const o = ue(), l = !!a.querySelector(':scope > a[slot="nav"]') || Re(o, e.hrefs, e.sport) !== null;
|
|
575
575
|
return n`
|
|
576
576
|
<div class="band section">
|
|
577
577
|
<div class="inner">
|
|
578
578
|
<h1>${t}</h1>
|
|
579
579
|
${s ? n`<p class="sub">${s}</p>` : p}
|
|
580
580
|
</div>
|
|
581
|
-
${
|
|
581
|
+
${l ? n`
|
|
582
582
|
<nav class="sectionnav" aria-label="${k(e.sport)} section">
|
|
583
583
|
<div class="navrow">
|
|
584
584
|
<slot name="nav">
|
|
585
|
-
${
|
|
586
|
-
aria-current=${o &&
|
|
585
|
+
${Ne(e.sport, r, e.hrefs).map((d) => n`<a href=${d.href}
|
|
586
|
+
aria-current=${o && S(d.href) === o ? "page" : p}>${d.label}</a>`)}
|
|
587
587
|
</slot>
|
|
588
588
|
</div>
|
|
589
589
|
</nav>` : p}
|
|
@@ -603,17 +603,17 @@ function C(a, e = 26) {
|
|
|
603
603
|
const s = a.colorPrimary || "#030711", r = G(s);
|
|
604
604
|
return n`<span class="swatch" aria-hidden="true"
|
|
605
605
|
style="width:${e}px;height:${e}px;background:${s};color:${r};font-size:${Math.max(8, e * 0.28)}px"
|
|
606
|
-
>${
|
|
606
|
+
>${K(a)}</span>`;
|
|
607
607
|
}
|
|
608
608
|
function X(a, e, t) {
|
|
609
|
-
const s =
|
|
609
|
+
const s = Z(a.rankings, a.teamsById, e, a.sport, t);
|
|
610
610
|
return s ? n`<span class="rankbadge">#${s}</span>` : p;
|
|
611
611
|
}
|
|
612
612
|
function O(a, e, t) {
|
|
613
613
|
const s = T(a, e);
|
|
614
614
|
return s ? n`${X(a, e, t)}<a href=${g(a.hrefs.school, { id: s.id })}>${s.name}</a>` : n`<span class="mut">TBD</span>`;
|
|
615
615
|
}
|
|
616
|
-
function
|
|
616
|
+
function J(a, e, t = 5) {
|
|
617
617
|
const s = a.records[e];
|
|
618
618
|
if (!s || !s.results.length) return n`<span class="mut">·</span>`;
|
|
619
619
|
const r = s.results.slice(-1 * t);
|
|
@@ -623,96 +623,154 @@ function Z(a, e, t = 5) {
|
|
|
623
623
|
href=${g(a.hrefs.game, { sport: a.sport, id: o.gameId })}>${o.mark}</a>`)}
|
|
624
624
|
</span>`;
|
|
625
625
|
}
|
|
626
|
-
function
|
|
626
|
+
function B(a, e) {
|
|
627
627
|
return a.querySelector(':scope > [slot="rail"]') ? n`<div class="view withrail">
|
|
628
628
|
<div class="viewmain">${e}</div>
|
|
629
629
|
<aside class="viewrail"><slot name="rail"></slot></aside>
|
|
630
630
|
</div>` : n`<div class="view">${e}</div>`;
|
|
631
631
|
}
|
|
632
|
-
function
|
|
632
|
+
function D(a) {
|
|
633
633
|
if (!a.promoImage) return p;
|
|
634
634
|
const e = n`<img src=${a.promoImage} alt=${a.promoAlt || "Sponsor"}>`;
|
|
635
635
|
return n`<div class="promo">${a.promoHref ? n`<a href=${a.promoHref} target="_blank" rel="sponsored noopener">${e}</a>` : e}</div>`;
|
|
636
636
|
}
|
|
637
|
-
function
|
|
638
|
-
const e =
|
|
637
|
+
function E(a) {
|
|
638
|
+
const e = me(a);
|
|
639
639
|
return n`<span class="pill ${e.kind}">${e.label}</span>`;
|
|
640
640
|
}
|
|
641
|
-
function
|
|
641
|
+
function be(a, e, t) {
|
|
642
642
|
if (!e) return n`<span class="mut">·</span>`;
|
|
643
643
|
const s = e.homeTeamId === t ? e.awayTeamId : e.homeTeamId, r = e.homeTeamId === t ? "vs" : "at";
|
|
644
644
|
return n`${e.state === "live" ? n`<span class="pill live">Live</span> ` : n`${x(e.date, { month: "numeric", day: "numeric" })} `}${r} ${L(a, s)}`;
|
|
645
645
|
}
|
|
646
|
-
|
|
647
|
-
|
|
646
|
+
const Qe = ["all", "conferences"], ye = "all", oe = (a) => Qe.includes(a) ? a : ye, $e = Number.MAX_SAFE_INTEGER, we = (a, e, t) => {
|
|
647
|
+
const s = a[t];
|
|
648
|
+
return s && e[s.schoolId] || null;
|
|
649
|
+
};
|
|
650
|
+
function Ze(a, e) {
|
|
651
|
+
const t = (a || []).map((s) => e[s.schoolId]?.areaCode).filter(Boolean);
|
|
652
|
+
return [...new Set(t)].sort();
|
|
653
|
+
}
|
|
654
|
+
function Xe(a, e, t, s) {
|
|
655
|
+
return e ? [a.awayTeamId, a.homeTeamId].some((r) => we(t, s, r)?.areaCode === e) : !0;
|
|
656
|
+
}
|
|
657
|
+
function Je(a, e, t, s) {
|
|
658
|
+
const r = (l) => we(t, s, l)?.name || "", o = (l, d) => !l - !d || he(l, d), i = new Map((a || []).map((l) => [l, {
|
|
659
|
+
rank: e(l) || $e,
|
|
660
|
+
away: r(l.awayTeamId),
|
|
661
|
+
home: r(l.homeTeamId)
|
|
662
|
+
}]));
|
|
663
|
+
return [...i.keys()].sort((l, d) => {
|
|
664
|
+
const m = i.get(l), h = i.get(d);
|
|
665
|
+
return m.rank - h.rank || o(m.away, h.away) || o(m.home, h.home) || String(l.time || "").localeCompare(String(d.time || ""));
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
function et(a, e) {
|
|
669
|
+
const t = new Map((a || []).map((r) => [r, e(r) || $e])), s = (r) => r.state === "live" ? 0 : 1;
|
|
670
|
+
return [...t.keys()].sort((r, o) => s(r) - s(o) || t.get(r) - t.get(o));
|
|
671
|
+
}
|
|
672
|
+
function tt(a, e) {
|
|
673
|
+
if (a.gameType === "conference" && a.conferenceId) {
|
|
674
|
+
const t = e[a.conferenceId] || null;
|
|
675
|
+
return { name: t?.name || "Conference", conference: t };
|
|
676
|
+
}
|
|
677
|
+
return a.gameType === "playoff" ? { name: "Playoffs", conference: null } : a.gameType === "scrimmage" ? { name: "Scrimmages", conference: null } : { name: "Nonconference", conference: null };
|
|
678
|
+
}
|
|
679
|
+
function st(a, e) {
|
|
680
|
+
const t = /* @__PURE__ */ new Map();
|
|
681
|
+
return (a || []).forEach((s) => {
|
|
682
|
+
const { name: r, conference: o } = tt(s, e);
|
|
683
|
+
t.has(r) || t.set(r, { name: r, conference: o, games: [] }), t.get(r).games.push(s);
|
|
684
|
+
}), [...t.values()];
|
|
685
|
+
}
|
|
686
|
+
const at = $`
|
|
687
|
+
.toolbar.filters { gap: 0.5rem 1.1rem; }
|
|
688
|
+
.filters [role="group"] { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
|
|
689
|
+
.filters .asof { margin-right: 0.1rem; }
|
|
690
|
+
/* A phone can't fit the label and six chips on one line; the label takes
|
|
691
|
+
its own row so the chips stay together instead of stranding the last. */
|
|
692
|
+
@media (max-width: 480px) { .filters .asof { flex-basis: 100%; } }
|
|
693
|
+
/* Conference headings carry the standings cards' classification pills. */
|
|
694
|
+
.section-title .pill { margin-left: 0.3rem; vertical-align: 0.1em; }
|
|
695
|
+
`;
|
|
696
|
+
class rt extends w {
|
|
697
|
+
static styles = [...A, at];
|
|
648
698
|
static properties = {
|
|
649
|
-
|
|
699
|
+
...w.properties,
|
|
650
700
|
sport: { type: String },
|
|
651
701
|
season: { type: String },
|
|
652
|
-
date: { type: String }
|
|
702
|
+
date: { type: String },
|
|
703
|
+
view: { type: String },
|
|
704
|
+
areaCode: { type: String, attribute: "area-code" }
|
|
653
705
|
};
|
|
654
706
|
constructor() {
|
|
655
|
-
super(), this.sport = "football", this.season = "", this.date = "", this._datePinned = !1;
|
|
707
|
+
super(), this.sport = "football", this.season = "", this.date = "", this.view = "", this.areaCode = "", this._datePinned = !1;
|
|
656
708
|
}
|
|
657
709
|
connectedCallback() {
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
}
|
|
662
|
-
this._datePinned = !!this.date;
|
|
710
|
+
super.connectedCallback();
|
|
711
|
+
const e = new URLSearchParams(globalThis.location?.search || "");
|
|
712
|
+
!this.date && e.get("date") && (this.date = e.get("date")), !this.view && e.get("view") && (this.view = e.get("view")), !this.areaCode && e.get("area") && (this.areaCode = e.get("area")), this._datePinned = !!this.date;
|
|
663
713
|
}
|
|
664
714
|
async fetchData(e) {
|
|
665
|
-
const t = this.season || _(), [s, r, o, i,
|
|
715
|
+
const t = this.season || _(), [s, r, o, i, l] = await Promise.all([
|
|
666
716
|
e.listSchools(),
|
|
667
717
|
e.listTeams({ sport: this.sport }),
|
|
668
718
|
e.listConferences(),
|
|
669
719
|
e.listGames({ sport: this.sport, season: t }),
|
|
670
720
|
e.listRankings({ sport: this.sport })
|
|
671
721
|
]);
|
|
672
|
-
return this._datePinned || (this.date =
|
|
722
|
+
return this._datePinned || (this.date = ze(i.items.map((d) => d.date)), this._datePinned = !0), {
|
|
673
723
|
season: t,
|
|
674
724
|
schools: s.items,
|
|
675
725
|
teams: r.items,
|
|
676
726
|
conferences: o.items,
|
|
677
727
|
games: i.items,
|
|
678
|
-
rankings:
|
|
728
|
+
rankings: l.items
|
|
679
729
|
};
|
|
680
730
|
}
|
|
681
731
|
get ctx() {
|
|
682
732
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
683
|
-
teamsById:
|
|
684
|
-
schoolsById:
|
|
685
|
-
records:
|
|
733
|
+
teamsById: y(this.data.teams),
|
|
734
|
+
schoolsById: y(this.data.schools),
|
|
735
|
+
records: R(this.data.games),
|
|
686
736
|
rankings: this.data.rankings,
|
|
687
737
|
hrefs: z(this),
|
|
688
738
|
sport: this.sport
|
|
689
739
|
}, this._ctxData = this.data), this._ctx;
|
|
690
740
|
}
|
|
741
|
+
/** Pick a view or an area (null leaves it alone) and deep-link the result. */
|
|
742
|
+
pick({ view: e = null, area: t = null }) {
|
|
743
|
+
e !== null && (this.view = e), t !== null && (this.areaCode = t);
|
|
744
|
+
try {
|
|
745
|
+
const s = new URL(globalThis.location.href), r = (o, i, l) => i && i !== l ? s.searchParams.set(o, i) : s.searchParams.delete(o);
|
|
746
|
+
r("view", oe(this.view), ye), r("area", this.areaCode, ""), globalThis.history?.replaceState(null, "", s);
|
|
747
|
+
} catch {
|
|
748
|
+
}
|
|
749
|
+
}
|
|
691
750
|
renderView() {
|
|
692
|
-
const e = this.ctx, t =
|
|
693
|
-
const
|
|
694
|
-
return
|
|
695
|
-
},
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
}), n`
|
|
751
|
+
const e = this.ctx, t = y(this.data.conferences), s = [...new Set(this.data.games.map((c) => c.date).filter(Boolean))].sort(), r = oe(this.view), o = Ze(this.data.teams, e.schoolsById), i = o.includes(this.areaCode) ? this.areaCode : "", l = (c) => {
|
|
752
|
+
const f = [c.awayTeamId, c.homeTeamId].map((u) => Z(e.rankings, e.teamsById, u, this.sport, c.date)).filter(Boolean);
|
|
753
|
+
return f.length ? Math.min(...f) : null;
|
|
754
|
+
}, d = this.data.games.filter((c) => c.date === this.date), m = d.filter((c) => Xe(c, i, e.teamsById, e.schoolsById)), h = r === "conferences" ? st(et(m, l), t) : m.length ? [{
|
|
755
|
+
name: i ? `All games · ${i}` : "All games",
|
|
756
|
+
conference: null,
|
|
757
|
+
games: Je(m, l, e.teamsById, e.schoolsById)
|
|
758
|
+
}] : [];
|
|
759
|
+
return n`
|
|
702
760
|
${j(this, e, {
|
|
703
761
|
title: n`${k(this.sport)} scores & schedules`,
|
|
704
|
-
sub: n`${x(this.date, { weekday: "long", month: "long", day: "numeric", year: "numeric" })} · ${
|
|
762
|
+
sub: n`${x(this.date, { weekday: "long", month: "long", day: "numeric", year: "numeric" })} · ${d.length} games`,
|
|
705
763
|
teams: this.data.teams
|
|
706
764
|
})}
|
|
707
|
-
${
|
|
708
|
-
${
|
|
765
|
+
${B(this, n`
|
|
766
|
+
${D(this)}
|
|
709
767
|
<div class="toolbar">
|
|
710
768
|
<label class="asof" for="datesel">Date</label>
|
|
711
|
-
<select id="datesel" @change=${(
|
|
712
|
-
this.date =
|
|
769
|
+
<select id="datesel" @change=${(c) => {
|
|
770
|
+
this.date = c.target.value;
|
|
713
771
|
}}>
|
|
714
|
-
${(s.includes(this.date) ? s : [...s, this.date].sort()).map((
|
|
715
|
-
${x(
|
|
772
|
+
${(s.includes(this.date) ? s : [...s, this.date].sort()).map((c) => n`<option value=${c} ?selected=${c === this.date}>
|
|
773
|
+
${x(c, { weekday: "short", month: "short", day: "numeric" })}${c === Y() ? " · today" : ""}
|
|
716
774
|
</option>`)}
|
|
717
775
|
</select>
|
|
718
776
|
<button class="chip" ?disabled=${s.indexOf(this.date) <= 0}
|
|
@@ -724,13 +782,30 @@ class We extends $ {
|
|
|
724
782
|
this.date = s[s.indexOf(this.date) + 1];
|
|
725
783
|
}}>Next →</button>
|
|
726
784
|
<span class="spacer"></span>
|
|
727
|
-
<span class="asof"
|
|
785
|
+
<span class="asof">${r === "conferences" ? "Live games first" : "Ranked matchups first, then A–Z by road team"}
|
|
786
|
+
· <a href=${de(e.hrefs)}>report a score</a> to see it update here</span>
|
|
728
787
|
</div>
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
788
|
+
<div class="toolbar filters">
|
|
789
|
+
<div role="group" aria-label="Scoreboard view">
|
|
790
|
+
${[["all", "All games"], ["conferences", "Conferences view"]].map(([c, f]) => n`<button
|
|
791
|
+
class="chip ${r === c ? "on" : ""}" aria-pressed=${r === c ? "true" : "false"}
|
|
792
|
+
@click=${() => this.pick({ view: c })}>${f}</button>`)}
|
|
793
|
+
</div>
|
|
794
|
+
${o.length ? n`
|
|
795
|
+
<div role="group" aria-label="Filter by area code">
|
|
796
|
+
<span class="asof">Area code</span>
|
|
797
|
+
${o.map((c) => n`<button class="chip ${i === c ? "on" : ""}"
|
|
798
|
+
aria-pressed=${i === c ? "true" : "false"}
|
|
799
|
+
@click=${() => this.pick({ area: i === c ? "" : c })}>${c}</button>`)}
|
|
800
|
+
</div>` : p}
|
|
801
|
+
</div>
|
|
802
|
+
${d.length ? p : n`<p class="empty">No ${this.sport} games on this date.</p>`}
|
|
803
|
+
${d.length && !m.length ? n`<p class="empty">No ${this.sport} games in the ${i} area code on this date.
|
|
804
|
+
<button class="chip" @click=${() => this.pick({ area: "" })}>Every area</button></p>` : p}
|
|
805
|
+
${h.map(({ name: c, conference: f, games: u }) => n`
|
|
806
|
+
<div class="section-title">${c}${[...f?.classifications || []].sort(q).map((v) => n`<span class="pill class">${v}</span>`)}</div>
|
|
732
807
|
<div class="card"><ul class="gamelist">
|
|
733
|
-
${
|
|
808
|
+
${u.map((v) => this.renderGame(e, v))}
|
|
734
809
|
</ul></div>
|
|
735
810
|
`)}
|
|
736
811
|
`)}
|
|
@@ -740,10 +815,10 @@ class We extends $ {
|
|
|
740
815
|
// a lone score column on the far right read as detached from the teams).
|
|
741
816
|
// Scheduled games carry their start time on the status pill alone.
|
|
742
817
|
renderGame(e, t) {
|
|
743
|
-
const s = t.state === "final" || t.state === "live", r = (i,
|
|
818
|
+
const s = t.state === "final" || t.state === "live", r = (i, l, d = p) => n`<span class="side">${O(e, i, t.date)}${s ? n`<span class="score">${l}</span>` : p}${d}</span>`, o = We(t);
|
|
744
819
|
return n`
|
|
745
820
|
<li>
|
|
746
|
-
${
|
|
821
|
+
${E(t)}
|
|
747
822
|
<span class="opp matchup">${r(t.awayTeamId, t.awayScore, n`<span class="at">at</span>`)}${r(t.homeTeamId, t.homeScore)}</span>
|
|
748
823
|
${o ? n`<span class="ff">${F(e, o === "home" ? t.homeTeamId : t.awayTeamId)} forfeited</span>` : p}
|
|
749
824
|
<span class="where">${t.venue || ""}</span>
|
|
@@ -753,11 +828,11 @@ class We extends $ {
|
|
|
753
828
|
`;
|
|
754
829
|
}
|
|
755
830
|
}
|
|
756
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores",
|
|
757
|
-
class
|
|
758
|
-
static styles =
|
|
831
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores", rt);
|
|
832
|
+
class ot extends w {
|
|
833
|
+
static styles = A;
|
|
759
834
|
static properties = {
|
|
760
|
-
|
|
835
|
+
...w.properties,
|
|
761
836
|
sport: { type: String },
|
|
762
837
|
gender: { type: String },
|
|
763
838
|
season: { type: String },
|
|
@@ -775,11 +850,11 @@ class Ve extends $ {
|
|
|
775
850
|
*/
|
|
776
851
|
get viewGender() {
|
|
777
852
|
if (this.gender) return this.gender;
|
|
778
|
-
const e =
|
|
853
|
+
const e = W(this.data?.teams);
|
|
779
854
|
return e.length < 2 ? "" : e.includes(this.pickedGender) ? this.pickedGender : e[0];
|
|
780
855
|
}
|
|
781
856
|
async fetchData(e) {
|
|
782
|
-
const t = this.season || _(), [s, r, o, i,
|
|
857
|
+
const t = this.season || _(), [s, r, o, i, l] = await Promise.all([
|
|
783
858
|
e.listConferences({ active: !0 }),
|
|
784
859
|
e.listSchools(),
|
|
785
860
|
// Deliberately NOT gender-filtered: the sub-nav decides whether to
|
|
@@ -798,24 +873,24 @@ class Ve extends $ {
|
|
|
798
873
|
schools: r.items,
|
|
799
874
|
teams: o.items,
|
|
800
875
|
games: i.items,
|
|
801
|
-
rankings:
|
|
876
|
+
rankings: l.items
|
|
802
877
|
};
|
|
803
878
|
}
|
|
804
879
|
get ctx() {
|
|
805
880
|
return (!this._ctx || this._ctxData !== this.data || this._ctxGender !== this.viewGender) && (this._ctx = {
|
|
806
|
-
teamsById:
|
|
807
|
-
schoolsById:
|
|
808
|
-
records:
|
|
881
|
+
teamsById: y(this.data.teams),
|
|
882
|
+
schoolsById: y(this.data.schools),
|
|
883
|
+
records: R(this.data.games),
|
|
809
884
|
rankings: this.data.rankings,
|
|
810
885
|
hrefs: z(this),
|
|
811
886
|
sport: this.sport,
|
|
812
887
|
// The teams this view stands for — one side of a gendered
|
|
813
888
|
// sport, or all of them when the sport fields only one.
|
|
814
|
-
teams:
|
|
889
|
+
teams: fe(this.data.teams, this.viewGender)
|
|
815
890
|
}, this._ctxData = this.data, this._ctxGender = this.viewGender), this._ctx;
|
|
816
891
|
}
|
|
817
892
|
renderView() {
|
|
818
|
-
const e = this.ctx, t = this.viewGender, s = this.gender ? [] :
|
|
893
|
+
const e = this.ctx, t = this.viewGender, s = this.gender ? [] : W(this.data.teams), r = ["All", ...[...new Set(this.data.conferences.flatMap((i) => i.classifications || []))].sort(q)].slice(0, 9), o = this.data.conferences.filter((i) => i.active !== !1).filter((i) => this.classFilter === "All" || (i.classifications || []).includes(this.classFilter)).sort(he);
|
|
819
894
|
return n`
|
|
820
895
|
${j(this, e, {
|
|
821
896
|
title: n`${t ? `${k(t)} ` : ""}${k(this.sport)} standings`,
|
|
@@ -825,8 +900,8 @@ class Ve extends $ {
|
|
|
825
900
|
// gender-scoped list would always look like one side.
|
|
826
901
|
teams: this.data.teams
|
|
827
902
|
})}
|
|
828
|
-
${
|
|
829
|
-
${
|
|
903
|
+
${B(this, n`
|
|
904
|
+
${D(this)}
|
|
830
905
|
<div class="toolbar">
|
|
831
906
|
${s.length === 2 ? n`
|
|
832
907
|
<div role="group" aria-label="Boys or girls standings">
|
|
@@ -847,7 +922,7 @@ class Ve extends $ {
|
|
|
847
922
|
this.query = i.target.value;
|
|
848
923
|
}}>
|
|
849
924
|
<span class="spacer"></span>
|
|
850
|
-
<span class="asof">Records through ${x(
|
|
925
|
+
<span class="asof">Records through ${x(Y(), { month: "long", day: "numeric" })} · conference games count toward both records · scrimmages toward neither</span>
|
|
851
926
|
</div>
|
|
852
927
|
${o.map((i) => this.renderConference(e, i))}
|
|
853
928
|
`)}
|
|
@@ -856,12 +931,12 @@ class Ve extends $ {
|
|
|
856
931
|
renderConference(e, t) {
|
|
857
932
|
const s = e.teams.filter((i) => i.conferenceId === t.id);
|
|
858
933
|
if (!s.length) return p;
|
|
859
|
-
const r = this.query.trim().toLowerCase(), o =
|
|
934
|
+
const r = this.query.trim().toLowerCase(), o = ge(s, e.records);
|
|
860
935
|
return n`
|
|
861
936
|
<div class="card">
|
|
862
937
|
<div class="card-head">
|
|
863
938
|
<h2>${t.name}</h2>
|
|
864
|
-
${[...t.classifications || []].sort(
|
|
939
|
+
${[...t.classifications || []].sort(q).map((i) => n`<span class="pill class">${i}</span>`)}
|
|
865
940
|
<span class="meta">${o.length} teams · membership derives from teams</span>
|
|
866
941
|
</div>
|
|
867
942
|
<div class="tablewrap"><table class="data">
|
|
@@ -871,7 +946,7 @@ class Ve extends $ {
|
|
|
871
946
|
<th>Streak</th><th>Last 5</th><th>Next</th>
|
|
872
947
|
</tr></thead>
|
|
873
948
|
<tbody>
|
|
874
|
-
${o.map((i,
|
|
949
|
+
${o.map((i, l) => this.renderRow(e, i, l, r))}
|
|
875
950
|
</tbody>
|
|
876
951
|
</table></div>
|
|
877
952
|
</div>
|
|
@@ -880,34 +955,34 @@ class Ve extends $ {
|
|
|
880
955
|
renderRow(e, t, s, r) {
|
|
881
956
|
const o = e.schoolsById[t.team.schoolId], i = o?.name || t.team.name || "TBD";
|
|
882
957
|
if (r && !i.toLowerCase().includes(r)) return p;
|
|
883
|
-
const
|
|
958
|
+
const l = t.rec.pf - t.rec.pa, d = Q(this.data.games, t.team.id), m = () => {
|
|
884
959
|
location.href = g(e.hrefs.school, { id: t.team.schoolId });
|
|
885
960
|
};
|
|
886
961
|
return n`
|
|
887
|
-
<tr class="rowlink" @click=${(
|
|
888
|
-
|
|
962
|
+
<tr class="rowlink" @click=${(h) => {
|
|
963
|
+
h.target.closest("a") || m();
|
|
889
964
|
}}>
|
|
890
965
|
<td class="mut">${s + 1}</td>
|
|
891
966
|
<td class="teamcell">
|
|
892
967
|
${C(o)}${X(e, t.team.id, null)}
|
|
893
968
|
<a href=${g(e.hrefs.school, { id: t.team.schoolId })}>${i}</a>
|
|
894
969
|
</td>
|
|
895
|
-
<td class="num">${
|
|
970
|
+
<td class="num">${I(t.rec, !0)}</td>
|
|
896
971
|
<td class="num">${ae(t.confPct)}</td>
|
|
897
|
-
<td class="num">${
|
|
972
|
+
<td class="num">${I(t.rec)}</td>
|
|
898
973
|
<td class="num">${ae(t.overallPct)}</td>
|
|
899
974
|
<td class="num">${t.rec.pf}</td>
|
|
900
975
|
<td class="num">${t.rec.pa}</td>
|
|
901
|
-
<td class="num" style="color:${
|
|
976
|
+
<td class="num" style="color:${l >= 0 ? "var(--hsot-win)" : "var(--hsot-loss)"}">${l > 0 ? "+" : ""}${l}</td>
|
|
902
977
|
<td>${U(t.rec.results) || "·"}</td>
|
|
903
|
-
<td>${
|
|
904
|
-
<td>${
|
|
978
|
+
<td>${J(e, t.team.id)}</td>
|
|
979
|
+
<td>${be(e, d, t.team.id)}</td>
|
|
905
980
|
</tr>
|
|
906
981
|
`;
|
|
907
982
|
}
|
|
908
983
|
}
|
|
909
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings",
|
|
910
|
-
const
|
|
984
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings", ot);
|
|
985
|
+
const nt = $`
|
|
911
986
|
.hero1 {
|
|
912
987
|
border-radius: var(--hsot-radius-md); color: var(--hsot-white);
|
|
913
988
|
padding: 1.3rem 1.4rem; display: flex; align-items: center; gap: 1.2rem;
|
|
@@ -924,10 +999,10 @@ const Ye = w`
|
|
|
924
999
|
.delta.new { background: var(--hsot-straw); color: #6b5900; border-radius: var(--hsot-radius-xs); padding: 0.1rem 0.3rem; font-size: 0.7rem; }
|
|
925
1000
|
.sparkline { vertical-align: middle; }
|
|
926
1001
|
`;
|
|
927
|
-
class
|
|
928
|
-
static styles = [...
|
|
1002
|
+
class it extends w {
|
|
1003
|
+
static styles = [...A, nt];
|
|
929
1004
|
static properties = {
|
|
930
|
-
|
|
1005
|
+
...w.properties,
|
|
931
1006
|
sport: { type: String },
|
|
932
1007
|
gender: { type: String },
|
|
933
1008
|
season: { type: String },
|
|
@@ -942,73 +1017,73 @@ class Ke extends $ {
|
|
|
942
1017
|
e && (this.pollDate = e);
|
|
943
1018
|
}
|
|
944
1019
|
async fetchData(e) {
|
|
945
|
-
const t = this.season || _(), [s, r, o, i,
|
|
1020
|
+
const t = this.season || _(), [s, r, o, i, l] = await Promise.all([
|
|
946
1021
|
e.listRankings({ sport: this.sport, ...this.gender ? { gender: this.gender } : {} }),
|
|
947
1022
|
e.listSchools(),
|
|
948
1023
|
e.listTeams({ sport: this.sport }),
|
|
949
1024
|
e.listConferences(),
|
|
950
1025
|
e.listGames({ sport: this.sport, season: t })
|
|
951
|
-
]),
|
|
1026
|
+
]), d = s.items.filter((m) => !this.gender || !m.gender || m.gender === this.gender).sort((m, h) => h.effectiveDate.localeCompare(m.effectiveDate));
|
|
952
1027
|
return {
|
|
953
1028
|
season: t,
|
|
954
|
-
polls:
|
|
1029
|
+
polls: d,
|
|
955
1030
|
schools: r.items,
|
|
956
1031
|
teams: o.items,
|
|
957
1032
|
conferences: i.items,
|
|
958
|
-
games:
|
|
1033
|
+
games: l.items
|
|
959
1034
|
};
|
|
960
1035
|
}
|
|
961
1036
|
get ctx() {
|
|
962
1037
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
963
|
-
teamsById:
|
|
964
|
-
schoolsById:
|
|
965
|
-
records:
|
|
1038
|
+
teamsById: y(this.data.teams),
|
|
1039
|
+
schoolsById: y(this.data.schools),
|
|
1040
|
+
records: R(this.data.games),
|
|
966
1041
|
rankings: this.data.polls,
|
|
967
1042
|
hrefs: z(this),
|
|
968
1043
|
sport: this.sport
|
|
969
1044
|
}, this._ctxData = this.data), this._ctx;
|
|
970
1045
|
}
|
|
971
1046
|
sparkline(e, t, s) {
|
|
972
|
-
const
|
|
973
|
-
const u = (
|
|
1047
|
+
const l = t.map((c, f) => {
|
|
1048
|
+
const u = (c.teamIds || []).indexOf(e);
|
|
974
1049
|
if (u === -1) return null;
|
|
975
|
-
const
|
|
976
|
-
return { x:
|
|
977
|
-
}),
|
|
978
|
-
let
|
|
979
|
-
if (
|
|
980
|
-
|
|
981
|
-
}),
|
|
982
|
-
const
|
|
1050
|
+
const v = t.length === 1 ? 96 / 2 : f / (t.length - 1) * 90 + 3, b = 3 + u / 24 * 20;
|
|
1051
|
+
return { x: v, y: b };
|
|
1052
|
+
}), d = [];
|
|
1053
|
+
let m = [];
|
|
1054
|
+
if (l.forEach((c) => {
|
|
1055
|
+
c ? m.push(c) : m.length && (d.push(m), m = []);
|
|
1056
|
+
}), m.length && d.push(m), !d.length) return p;
|
|
1057
|
+
const h = l[s];
|
|
983
1058
|
return n`<svg class="sparkline" width=${96} height=${26} viewBox="0 0 ${96} ${26}" role="img" aria-label="rank history">
|
|
984
|
-
${
|
|
985
|
-
points=${
|
|
986
|
-
${
|
|
1059
|
+
${d.map((c) => te`<polyline fill="none" stroke="var(--hsot-red)" stroke-width="2"
|
|
1060
|
+
points=${c.map((f) => `${f.x.toFixed(1)},${f.y.toFixed(1)}`).join(" ")}></polyline>`)}
|
|
1061
|
+
${h ? te`<circle cx=${h.x.toFixed(1)} cy=${h.y.toFixed(1)} r="3" fill="var(--hsot-black)"></circle>` : p}
|
|
987
1062
|
</svg>`;
|
|
988
1063
|
}
|
|
989
1064
|
movement(e, t, s) {
|
|
990
|
-
const r =
|
|
1065
|
+
const r = Ve(e, t, s);
|
|
991
1066
|
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>`;
|
|
992
1067
|
}
|
|
993
1068
|
renderView() {
|
|
994
1069
|
const e = this.ctx, t = this.data.polls;
|
|
995
1070
|
if (!t.length) return n`<div class="view"><p class="empty">No ${this.sport} polls published yet this season.</p></div>`;
|
|
996
|
-
const s = Math.max(0, t.findIndex((
|
|
1071
|
+
const s = Math.max(0, t.findIndex((c) => c.effectiveDate === this.pollDate)), r = t[s] || t[0], o = t[s + 1] || null, i = t.slice().reverse(), l = i.indexOf(r), d = y(this.data.conferences), m = (r.teamIds || [])[0], h = m ? T(e, m) : null;
|
|
997
1072
|
return n`
|
|
998
1073
|
${j(this, e, {
|
|
999
1074
|
title: n`${k(this.sport)} Top 25`,
|
|
1000
1075
|
sub: n`The HighSchoolOT poll · updated weekly · ${t.length} polls this season`,
|
|
1001
1076
|
teams: this.data.teams
|
|
1002
1077
|
})}
|
|
1003
|
-
${
|
|
1004
|
-
${
|
|
1078
|
+
${B(this, n`
|
|
1079
|
+
${D(this)}
|
|
1005
1080
|
<div class="toolbar">
|
|
1006
1081
|
<label class="asof" for="pollsel">Poll of</label>
|
|
1007
|
-
<select id="pollsel" @change=${(
|
|
1008
|
-
this.pollDate =
|
|
1082
|
+
<select id="pollsel" @change=${(c) => {
|
|
1083
|
+
this.pollDate = c.target.value;
|
|
1009
1084
|
}}>
|
|
1010
|
-
${t.map((
|
|
1011
|
-
${x(
|
|
1085
|
+
${t.map((c, f) => n`<option value=${c.effectiveDate} ?selected=${c === r}>
|
|
1086
|
+
${x(c.effectiveDate, { month: "long", day: "numeric", year: "numeric" })}${f === 0 ? " · current" : ""}
|
|
1012
1087
|
</option>`)}
|
|
1013
1088
|
</select>
|
|
1014
1089
|
<button class="chip" ?disabled=${s >= t.length - 1}
|
|
@@ -1022,14 +1097,14 @@ class Ke extends $ {
|
|
|
1022
1097
|
<span class="spacer"></span>
|
|
1023
1098
|
<span class="asof">Movement vs. the previous poll · sparkline = season rank history</span>
|
|
1024
1099
|
</div>
|
|
1025
|
-
${
|
|
1100
|
+
${h ? this.renderHero(e, r, o, m, h, d) : p}
|
|
1026
1101
|
<div class="card"><div class="tablewrap"><table class="data">
|
|
1027
1102
|
<thead><tr>
|
|
1028
1103
|
<th class="num">Rk</th><th>Mvmt</th><th>Team</th><th class="num">Record</th>
|
|
1029
1104
|
<th>Conference</th><th>Last result</th><th>Next</th><th>Season</th>
|
|
1030
1105
|
</tr></thead>
|
|
1031
1106
|
<tbody>
|
|
1032
|
-
${(r.teamIds || []).map((
|
|
1107
|
+
${(r.teamIds || []).map((c, f) => f === 0 || !c ? p : this.renderRow(e, r, o, i, l, d, c, f + 1))}
|
|
1033
1108
|
</tbody>
|
|
1034
1109
|
</table></div></div>
|
|
1035
1110
|
<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>
|
|
@@ -1037,50 +1112,50 @@ class Ke extends $ {
|
|
|
1037
1112
|
`;
|
|
1038
1113
|
}
|
|
1039
1114
|
renderHero(e, t, s, r, o, i) {
|
|
1040
|
-
const
|
|
1115
|
+
const l = e.records[r], d = re(e.records, r), m = i[e.teamsById[r]?.conferenceId], h = `linear-gradient(120deg, ${o.colorPrimary || "#030711"} 0%, var(--hsot-black) 85%)`;
|
|
1041
1116
|
return n`
|
|
1042
|
-
<div class="hero1" style="background:${
|
|
1117
|
+
<div class="hero1" style="background:${h}">
|
|
1043
1118
|
<div class="bigrank">#1</div>
|
|
1044
1119
|
${C(o, 64)}
|
|
1045
1120
|
<div>
|
|
1046
1121
|
<h2><a href=${g(e.hrefs.school, { id: o.id })}>${o.name} ${o.mascot || ""}</a></h2>
|
|
1047
1122
|
<div class="facts">
|
|
1048
|
-
${
|
|
1049
|
-
· streak ${U(
|
|
1050
|
-
${
|
|
1123
|
+
${I(l)} overall${m ? n` · ${I(l, !0)} ${m.name}` : p}
|
|
1124
|
+
· streak ${U(l?.results) || "·"}
|
|
1125
|
+
${d ? n` · last: ${d.mark} ${d.my}-${d.their} vs ${L(e, d.opp)}` : p}
|
|
1051
1126
|
${this.movement(t, s, r)}
|
|
1052
1127
|
</div>
|
|
1053
1128
|
</div>
|
|
1054
1129
|
</div>
|
|
1055
1130
|
`;
|
|
1056
1131
|
}
|
|
1057
|
-
renderRow(e, t, s, r, o, i,
|
|
1058
|
-
const
|
|
1059
|
-
if (!
|
|
1060
|
-
const
|
|
1061
|
-
location.href = g(e.hrefs.school, { id:
|
|
1132
|
+
renderRow(e, t, s, r, o, i, l, d) {
|
|
1133
|
+
const m = T(e, l);
|
|
1134
|
+
if (!m) return p;
|
|
1135
|
+
const h = e.records[l], c = re(e.records, l), f = Q(this.data.games, l), u = i[e.teamsById[l]?.conferenceId], v = () => {
|
|
1136
|
+
location.href = g(e.hrefs.school, { id: m.id });
|
|
1062
1137
|
};
|
|
1063
1138
|
return n`
|
|
1064
|
-
<tr class="rowlink" @click=${(
|
|
1065
|
-
|
|
1139
|
+
<tr class="rowlink" @click=${(b) => {
|
|
1140
|
+
b.target.closest("a") || v();
|
|
1066
1141
|
}}>
|
|
1067
|
-
<td class="num" style="font-weight:700">${
|
|
1068
|
-
<td>${this.movement(t, s,
|
|
1069
|
-
<td class="teamcell">${C(
|
|
1070
|
-
<span class="mut" style="font-size:0.78rem">${
|
|
1071
|
-
<td class="num">${
|
|
1142
|
+
<td class="num" style="font-weight:700">${d}</td>
|
|
1143
|
+
<td>${this.movement(t, s, l)}</td>
|
|
1144
|
+
<td class="teamcell">${C(m)}<a href=${g(e.hrefs.school, { id: m.id })}>${m.name}</a>
|
|
1145
|
+
<span class="mut" style="font-size:0.78rem">${m.mascot || ""}</span></td>
|
|
1146
|
+
<td class="num">${I(h)}</td>
|
|
1072
1147
|
<td class="mut">${u?.name || "Independent"}</td>
|
|
1073
|
-
<td>${
|
|
1074
|
-
<b style="color:${
|
|
1075
|
-
${
|
|
1076
|
-
<td>${
|
|
1077
|
-
<td>${this.sparkline(
|
|
1148
|
+
<td>${c ? n`<a class="box" style="text-decoration:none" href=${g(e.hrefs.game, { sport: this.sport, id: c.gameId })}>
|
|
1149
|
+
<b style="color:${c.mark === "W" ? "var(--hsot-win)" : c.mark === "L" ? "var(--hsot-loss)" : "var(--hsot-tie)"}">${c.mark}</b>
|
|
1150
|
+
${c.my}-${c.their} vs ${L(e, c.opp)}</a>` : n`<span class="mut">·</span>`}</td>
|
|
1151
|
+
<td>${be(e, f, l)}</td>
|
|
1152
|
+
<td>${this.sparkline(l, r, o)}</td>
|
|
1078
1153
|
</tr>
|
|
1079
1154
|
`;
|
|
1080
1155
|
}
|
|
1081
1156
|
}
|
|
1082
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings",
|
|
1083
|
-
const
|
|
1157
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings", it);
|
|
1158
|
+
const lt = $`
|
|
1084
1159
|
.schoolhero { color: var(--hsot-white); padding: 1.6rem 1.25rem 1.3rem; }
|
|
1085
1160
|
.schoolhero .inner { max-width: 1366px; margin: 0 auto; display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
|
|
1086
1161
|
.schoolhero .crest {
|
|
@@ -1134,10 +1209,10 @@ const Qe = w`
|
|
|
1134
1209
|
table.data.roster .sub { display: block; font-weight: 400; font-size: 0.78rem; color: var(--hsot-gray-5); }
|
|
1135
1210
|
}
|
|
1136
1211
|
`;
|
|
1137
|
-
class
|
|
1138
|
-
static styles = [...
|
|
1212
|
+
class ct extends w {
|
|
1213
|
+
static styles = [...A, lt];
|
|
1139
1214
|
static properties = {
|
|
1140
|
-
|
|
1215
|
+
...w.properties,
|
|
1141
1216
|
schoolId: { type: String, attribute: "school-id" },
|
|
1142
1217
|
sport: { type: String },
|
|
1143
1218
|
gender: { type: String },
|
|
@@ -1153,36 +1228,36 @@ class Xe extends $ {
|
|
|
1153
1228
|
t && !this.sport && (this.sport = t), s && !this.gender && (this.gender = s);
|
|
1154
1229
|
}
|
|
1155
1230
|
async fetchData(e) {
|
|
1156
|
-
const t = this.season || _(), s = await e.getSchool(this.schoolId), o = (await e.listTeams({ schoolId: this.schoolId })).items, i = this.sport || "football",
|
|
1157
|
-
|
|
1158
|
-
|
|
1231
|
+
const t = this.season || _(), s = await e.getSchool(this.schoolId), o = (await e.listTeams({ schoolId: this.schoolId })).items, i = this.sport || "football", l = o.find((b) => b.id === this.activeTeamId) || o.find((b) => b.sport === i && pe(b, this.gender)) || o.find((b) => b.sport === i) || o[0] || null, [d, m, h, c, f, u, v] = await Promise.all([
|
|
1232
|
+
l ? e.listGames({ sport: l.sport, season: t }) : Promise.resolve({ items: [] }),
|
|
1233
|
+
l ? e.listTeams({ sport: l.sport }) : Promise.resolve({ items: [] }),
|
|
1159
1234
|
e.listSchools(),
|
|
1160
1235
|
e.listConferences(),
|
|
1161
|
-
|
|
1162
|
-
|
|
1236
|
+
l ? e.listRankings({ sport: l.sport }) : Promise.resolve({ items: [] }),
|
|
1237
|
+
l ? e.listRosters({ teamId: l.id }) : Promise.resolve({ items: [] }),
|
|
1163
1238
|
// teamId is the public surface's one players filter (roster
|
|
1164
1239
|
// membership) — never fetch the whole collection.
|
|
1165
|
-
|
|
1240
|
+
l ? e.listPlayers({ teamId: l.id }) : Promise.resolve({ items: [] })
|
|
1166
1241
|
]);
|
|
1167
1242
|
return {
|
|
1168
1243
|
season: t,
|
|
1169
1244
|
school: s,
|
|
1170
1245
|
teams: o,
|
|
1171
|
-
active:
|
|
1172
|
-
games:
|
|
1173
|
-
allTeams:
|
|
1174
|
-
schools:
|
|
1175
|
-
conferences:
|
|
1246
|
+
active: l,
|
|
1247
|
+
games: d.items,
|
|
1248
|
+
allTeams: m.items,
|
|
1249
|
+
schools: h.items,
|
|
1250
|
+
conferences: c.items,
|
|
1176
1251
|
rankings: f.items,
|
|
1177
|
-
roster: u.items.find((
|
|
1178
|
-
players:
|
|
1252
|
+
roster: u.items.find((b) => b.season === t) || null,
|
|
1253
|
+
players: v.items
|
|
1179
1254
|
};
|
|
1180
1255
|
}
|
|
1181
1256
|
get ctx() {
|
|
1182
1257
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
1183
|
-
teamsById:
|
|
1184
|
-
schoolsById:
|
|
1185
|
-
records:
|
|
1258
|
+
teamsById: y(this.data.allTeams.length ? this.data.allTeams : this.data.teams),
|
|
1259
|
+
schoolsById: y(this.data.schools),
|
|
1260
|
+
records: R(this.data.games),
|
|
1186
1261
|
rankings: this.data.rankings,
|
|
1187
1262
|
hrefs: z(this),
|
|
1188
1263
|
sport: this.data.active?.sport || "football"
|
|
@@ -1199,18 +1274,18 @@ class Xe extends $ {
|
|
|
1199
1274
|
renderView() {
|
|
1200
1275
|
const { school: e, teams: t, active: s, season: r } = this.data;
|
|
1201
1276
|
if (!e) return n`<div class="view"><p class="empty">School not found.</p></div>`;
|
|
1202
|
-
const o = this.ctx, i = G(e.colorPrimary || "#030711"),
|
|
1277
|
+
const o = this.ctx, i = G(e.colorPrimary || "#030711"), l = (e.adm || [])[0], d = y(this.data.conferences), m = s ? d[s.conferenceId] : null;
|
|
1203
1278
|
return n`
|
|
1204
1279
|
<div class="schoolhero" style="background:linear-gradient(115deg, ${e.colorPrimary || "#030711"} 0%, ${e.colorPrimary || "#030711"} 55%, var(--hsot-black) 100%);color:${i}">
|
|
1205
1280
|
<div class="inner">
|
|
1206
|
-
${M(e, 84) ? n`<img class="crest logo" alt="" loading="lazy" src=${M(e, 84)} />` : n`<div class="crest" style="background:${e.colorSecondary || "#7C7C7C"};color:${G(e.colorSecondary || "#7C7C7C")}">${
|
|
1281
|
+
${M(e, 84) ? n`<img class="crest logo" alt="" loading="lazy" src=${M(e, 84)} />` : n`<div class="crest" style="background:${e.colorSecondary || "#7C7C7C"};color:${G(e.colorSecondary || "#7C7C7C")}">${K(e)}</div>`}
|
|
1207
1282
|
<div style="min-width:260px">
|
|
1208
1283
|
<h1>${e.name} <span class="mascot">${e.mascot || ""}</span></h1>
|
|
1209
1284
|
<div class="facts">
|
|
1210
1285
|
${e.location ? n`<span><b>Location</b>${e.location}${e.county ? n` · ${e.county} County` : p}</span>` : p}
|
|
1211
1286
|
${e.association ? n`<span><b>League</b>${e.association}${e.classification ? n` · ${e.classification}` : p}</span>` : p}
|
|
1212
|
-
${
|
|
1213
|
-
${
|
|
1287
|
+
${m ? n`<span><b>Conference</b>${m.name}</span>` : p}
|
|
1288
|
+
${l ? n`<span><b>Enrollment</b>${l.value.toLocaleString()} (${l.season} ADM)</span>` : p}
|
|
1214
1289
|
${e.openingYear ? n`<span><b>Opened</b>${e.openingYear}</span>` : p}
|
|
1215
1290
|
${e.areaCode ? n`<span><b>Area</b>${e.areaCode}</span>` : p}
|
|
1216
1291
|
</div>
|
|
@@ -1219,40 +1294,40 @@ class Xe extends $ {
|
|
|
1219
1294
|
</div>
|
|
1220
1295
|
<div class="band">
|
|
1221
1296
|
<nav class="tabs" aria-label="Teams">
|
|
1222
|
-
${t.map((
|
|
1223
|
-
|
|
1224
|
-
}}>${
|
|
1297
|
+
${t.map((h) => h.id === s?.id ? n`<a class="on" href="#" aria-current="page" @click=${(c) => c.preventDefault()}>${h.name}</a>` : n`<a href="#" @click=${(c) => {
|
|
1298
|
+
c.preventDefault(), this.switchTeam(h);
|
|
1299
|
+
}}>${h.name}</a>`)}
|
|
1225
1300
|
</nav>
|
|
1226
1301
|
</div>
|
|
1227
|
-
${
|
|
1228
|
-
${
|
|
1229
|
-
${s ? this.renderTeam(o, s,
|
|
1302
|
+
${B(this, n`
|
|
1303
|
+
${D(this)}
|
|
1304
|
+
${s ? this.renderTeam(o, s, m, r) : n`<p class="empty">No teams recorded for this school yet.</p>`}
|
|
1230
1305
|
`)}
|
|
1231
1306
|
`;
|
|
1232
1307
|
}
|
|
1233
1308
|
renderTeam(e, t, s, r) {
|
|
1234
|
-
const o = e.records[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] }, i = o.w + o.l + o.t,
|
|
1309
|
+
const o = e.records[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] }, i = o.w + o.l + o.t, l = s ? fe(this.data.allTeams.filter((c) => c.conferenceId === s.id), t.gender) : [], d = s ? ge(l, e.records).findIndex((c) => c.team.id === t.id) + 1 : 0, m = Z(e.rankings, e.teamsById, t.id, t.sport, null), h = this.data.games.filter((c) => c.homeTeamId === t.id || c.awayTeamId === t.id).sort((c, f) => String(c.date).localeCompare(String(f.date)));
|
|
1235
1310
|
return n`
|
|
1236
1311
|
<div class="tiles">
|
|
1237
|
-
<div class="tile"><div class="k">Overall</div><div class="v">${
|
|
1238
|
-
<div class="tile"><div class="k">${s?.name || "Conference"}</div><div class="v">${
|
|
1239
|
-
<div class="s">${
|
|
1312
|
+
<div class="tile"><div class="k">Overall</div><div class="v">${I(o)}</div><div class="s">${i} games played</div></div>
|
|
1313
|
+
<div class="tile"><div class="k">${s?.name || "Conference"}</div><div class="v">${I(o, !0)}</div>
|
|
1314
|
+
<div class="s">${d ? `${Ae(d)} of ${l.length}` : "·"}</div></div>
|
|
1240
1315
|
<div class="tile"><div class="k">Points</div><div class="v">${i ? (o.pf / i).toFixed(1) : "0.0"}</div>
|
|
1241
1316
|
<div class="s">scored per game · ${i ? (o.pa / i).toFixed(1) : "0.0"} allowed</div></div>
|
|
1242
1317
|
<div class="tile"><div class="k">Streak</div><div class="v">${U(o.results) || "·"}</div>
|
|
1243
|
-
<div class="s">last 5: ${
|
|
1244
|
-
<div class="tile"><div class="k">HSOT Top 25</div><div class="v">${
|
|
1318
|
+
<div class="s">last 5: ${J(e, t.id)}</div></div>
|
|
1319
|
+
<div class="tile"><div class="k">HSOT Top 25</div><div class="v">${m ? `#${m}` : "NR"}</div>
|
|
1245
1320
|
<div class="s"><a href=${g(e.hrefs.section, { sport: t.sport, view: "rankings" })}>full poll</a></div></div>
|
|
1246
1321
|
</div>
|
|
1247
1322
|
${(t.championships || []).length ? n`
|
|
1248
1323
|
<div style="margin:-0.2rem 0 1rem;display:flex;gap:0.4rem;flex-wrap:wrap">
|
|
1249
|
-
${t.championships.map((
|
|
1324
|
+
${t.championships.map((c) => n`<span class="pill champ">★ ${c.season} ${c.title} champion${c.classification ? ` · ${c.classification}` : ""}${c.region ? ` · ${c.region}` : ""}</span>`)}
|
|
1250
1325
|
</div>` : p}
|
|
1251
1326
|
<div class="cols">
|
|
1252
1327
|
<div>
|
|
1253
1328
|
<div class="section-title">Schedule & results</div>
|
|
1254
1329
|
<div class="card">
|
|
1255
|
-
${
|
|
1330
|
+
${h.length ? n`<ul class="gamelist">${h.map((c) => this.renderGameRow(e, t, c))}</ul>` : n`<p class="empty">No ${t.sport} games recorded for ${r}.</p>`}
|
|
1256
1331
|
</div>
|
|
1257
1332
|
</div>
|
|
1258
1333
|
<div>
|
|
@@ -1263,20 +1338,20 @@ class Xe extends $ {
|
|
|
1263
1338
|
`;
|
|
1264
1339
|
}
|
|
1265
1340
|
renderGameRow(e, t, s) {
|
|
1266
|
-
const r = s.homeTeamId === t.id, o = r ? s.awayTeamId : s.homeTeamId, i = r ? s.homeScore : s.awayScore,
|
|
1267
|
-
let
|
|
1341
|
+
const r = s.homeTeamId === t.id, o = r ? s.awayTeamId : s.homeTeamId, i = r ? s.homeScore : s.awayScore, l = r ? s.awayScore : s.homeScore;
|
|
1342
|
+
let d = n`<span class="mut">${V(s.time)}</span>`;
|
|
1268
1343
|
if (s.state === "final") {
|
|
1269
|
-
const
|
|
1270
|
-
|
|
1271
|
-
} else s.state === "live" && (
|
|
1272
|
-
const
|
|
1344
|
+
const h = H(s), c = h === "tie" ? "T" : h === (r ? "home" : "away") ? "W" : "L";
|
|
1345
|
+
d = n`<span class=${c}>${c}</span> ${i}-${l}${s.finish === "overtime" ? n` <span class="mut">OT</span>` : p}${s.forfeit && s.forfeit !== "none" ? n` <span class="mut">FF</span>` : p}`;
|
|
1346
|
+
} else s.state === "live" && (d = n`<span style="color:var(--hsot-red)">${i}-${l}</span>`);
|
|
1347
|
+
const m = s.gameType === "conference" ? "Conf" : s.gameType === "nonconference" ? "Non-conf" : s.gameType === "playoff" ? `Playoff${s.label ? ` · ${s.label}` : ""}` : "Scrimmage";
|
|
1273
1348
|
return n`
|
|
1274
1349
|
<li>
|
|
1275
1350
|
<span class="d">${x(s.date)}</span>
|
|
1276
|
-
${
|
|
1277
|
-
<span class="res">${
|
|
1351
|
+
${me(s).kind === "sched" ? p : E(s)}
|
|
1352
|
+
<span class="res">${d}</span>
|
|
1278
1353
|
<span class="opp">${r ? "vs" : "at"} ${O(e, o, s.date)}
|
|
1279
|
-
<span class="pill type">${
|
|
1354
|
+
<span class="pill type">${m}</span>
|
|
1280
1355
|
${s.broadcast ? n`<span class="pill class">${s.broadcast}</span>` : p}
|
|
1281
1356
|
</span>
|
|
1282
1357
|
<span class="where">${s.venue || ""}</span>
|
|
@@ -1288,25 +1363,25 @@ class Xe extends $ {
|
|
|
1288
1363
|
const s = this.data.roster;
|
|
1289
1364
|
if (!s)
|
|
1290
1365
|
return n`<p class="empty">Roster not published for ${t}.</p>`;
|
|
1291
|
-
const r =
|
|
1366
|
+
const r = Ke(s, 560), o = this.data.school?.name || "", i = y(this.data.players), l = s.entries.slice().sort((m, h) => (m.number || 0) - (h.number || 0)), d = l.some((m) => i[m.playerId]?.college);
|
|
1292
1367
|
return n`
|
|
1293
1368
|
${r ? n`<img class="rosterphoto" src=${r} loading="lazy" decoding="async"
|
|
1294
1369
|
alt="${o} ${e.name} ${t} team photo" />` : p}
|
|
1295
1370
|
<div class="tablewrap"><table class="data roster">
|
|
1296
|
-
<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>${
|
|
1371
|
+
<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>
|
|
1297
1372
|
<tbody>
|
|
1298
|
-
${
|
|
1299
|
-
const
|
|
1300
|
-
if (!
|
|
1301
|
-
const
|
|
1373
|
+
${l.map((m) => {
|
|
1374
|
+
const h = i[m.playerId];
|
|
1375
|
+
if (!h) return p;
|
|
1376
|
+
const c = Fe(m), f = [c, h.classOf].filter(Boolean).join(" · ") || "·";
|
|
1302
1377
|
return n`<tr>
|
|
1303
|
-
<td class="num mut">${
|
|
1304
|
-
<td class="player" style="font-weight:500">${
|
|
1305
|
-
<td class="pos">${
|
|
1306
|
-
<td class="cls mut">${
|
|
1307
|
-
<td class="num">${
|
|
1308
|
-
<td class="num">${
|
|
1309
|
-
${
|
|
1378
|
+
<td class="num mut">${m.number ?? "·"}</td>
|
|
1379
|
+
<td class="player" style="font-weight:500">${h.firstName} ${h.lastName}<span class="sub">${f}</span></td>
|
|
1380
|
+
<td class="pos">${c || "·"}</td>
|
|
1381
|
+
<td class="cls mut">${h.classOf || "·"}</td>
|
|
1382
|
+
<td class="num">${De(h.heightIn)}</td>
|
|
1383
|
+
<td class="num">${h.weightLb || "·"}</td>
|
|
1384
|
+
${d ? n`<td class="college">${h.college || "·"}</td>` : p}
|
|
1310
1385
|
</tr>`;
|
|
1311
1386
|
})}
|
|
1312
1387
|
</tbody>
|
|
@@ -1314,8 +1389,8 @@ class Xe extends $ {
|
|
|
1314
1389
|
`;
|
|
1315
1390
|
}
|
|
1316
1391
|
}
|
|
1317
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school",
|
|
1318
|
-
const
|
|
1392
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school", ct);
|
|
1393
|
+
const xe = {
|
|
1319
1394
|
football: ["quarters", 4],
|
|
1320
1395
|
flag_football: ["quarters", 4],
|
|
1321
1396
|
basketball: ["quarters", 4],
|
|
@@ -1326,57 +1401,57 @@ const ve = {
|
|
|
1326
1401
|
softball: ["innings", 7],
|
|
1327
1402
|
volleyball: ["sets", 3]
|
|
1328
1403
|
};
|
|
1329
|
-
function
|
|
1330
|
-
return (
|
|
1404
|
+
function ke(a) {
|
|
1405
|
+
return (xe[a] || ["quarters", 4])[0];
|
|
1331
1406
|
}
|
|
1332
|
-
function
|
|
1333
|
-
return (
|
|
1407
|
+
function ee(a) {
|
|
1408
|
+
return (xe[a] || ["quarters", 4])[1];
|
|
1334
1409
|
}
|
|
1335
|
-
function
|
|
1336
|
-
const t =
|
|
1410
|
+
function dt(a, e) {
|
|
1411
|
+
const t = ke(a), s = ee(a);
|
|
1337
1412
|
if (e <= s || t === "innings" || t === "sets") return String(e);
|
|
1338
1413
|
const r = e - s;
|
|
1339
1414
|
return `OT${r > 1 ? r : ""}`;
|
|
1340
1415
|
}
|
|
1341
|
-
function
|
|
1416
|
+
function ht(a, e) {
|
|
1342
1417
|
const t = String(a ?? "").trim();
|
|
1343
1418
|
let s;
|
|
1344
|
-
return (s = /^(\d+)Q$/i.exec(t)) || (s = /^(\d+)H$/i.exec(t)) ? Number(s[1]) : /^half$/i.test(t) ?
|
|
1419
|
+
return (s = /^(\d+)Q$/i.exec(t)) || (s = /^(\d+)H$/i.exec(t)) ? Number(s[1]) : /^half$/i.test(t) ? ke(e) === "halves" ? 1 : 2 : (s = /^(\d*)OT(\d*)$/i.exec(t)) ? ee(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;
|
|
1345
1420
|
}
|
|
1346
|
-
const
|
|
1347
|
-
function
|
|
1421
|
+
const N = (a) => Number.isInteger(a) && a >= 0 ? a : null;
|
|
1422
|
+
function mt(a) {
|
|
1348
1423
|
const e = Array.isArray(a?.scoringPlays) ? a.scoringPlays : [];
|
|
1349
1424
|
if (!e.length) return null;
|
|
1350
1425
|
const t = a.sport, s = /* @__PURE__ */ new Map();
|
|
1351
|
-
for (const
|
|
1352
|
-
const f =
|
|
1353
|
-
if (!f || u === null ||
|
|
1354
|
-
const
|
|
1355
|
-
|
|
1426
|
+
for (const c of e) {
|
|
1427
|
+
const f = ht(c?.period, t), u = N(c?.homeScore), v = N(c?.awayScore);
|
|
1428
|
+
if (!f || u === null || v === null) return null;
|
|
1429
|
+
const b = s.get(f) || { home: 0, away: 0 };
|
|
1430
|
+
b.home = Math.max(b.home, u), b.away = Math.max(b.away, v), s.set(f, b);
|
|
1356
1431
|
}
|
|
1357
1432
|
const r = Math.max(...s.keys()), o = [];
|
|
1358
|
-
let i = !0,
|
|
1359
|
-
for (let
|
|
1360
|
-
const f = s.get(
|
|
1361
|
-
(u < 0 ||
|
|
1433
|
+
let i = !0, l = { home: 0, away: 0 };
|
|
1434
|
+
for (let c = 1; c <= r; c += 1) {
|
|
1435
|
+
const f = s.get(c) || l, u = f.home - l.home, v = f.away - l.away;
|
|
1436
|
+
(u < 0 || v < 0) && (i = !1), o.push({ period: c, home: Math.max(u, 0), away: Math.max(v, 0) }), l = { home: Math.max(f.home, l.home), away: Math.max(f.away, l.away) };
|
|
1362
1437
|
}
|
|
1363
|
-
const
|
|
1364
|
-
return i = i &&
|
|
1438
|
+
const d = N(a.homeScore) ?? 0, m = N(a.awayScore) ?? 0, h = i && l.home === d && l.away === m;
|
|
1439
|
+
return i = i && l.home <= d && l.away <= m, { periods: o, reconciled: h, consistent: i };
|
|
1365
1440
|
}
|
|
1366
|
-
function
|
|
1441
|
+
function pt(a) {
|
|
1367
1442
|
if (Array.isArray(a?.periodScores) && a.periodScores.length) return a.periodScores;
|
|
1368
|
-
const e =
|
|
1443
|
+
const e = mt(a);
|
|
1369
1444
|
return e ? a.state === "final" ? e.reconciled ? e.periods : null : e.consistent ? e.periods : null : null;
|
|
1370
1445
|
}
|
|
1371
|
-
const
|
|
1372
|
-
function
|
|
1446
|
+
const ft = "https://api.wral.com/search";
|
|
1447
|
+
function ut(a) {
|
|
1373
1448
|
return a.map((e) => `uri:"${e}"`).join(" OR ");
|
|
1374
1449
|
}
|
|
1375
|
-
function
|
|
1376
|
-
const t = String(a ||
|
|
1450
|
+
function gt(a, e) {
|
|
1451
|
+
const t = String(a || ft).replace(/\/+$/, ""), s = new URLSearchParams({ query: ut(e), sort: "score", lang: "en" });
|
|
1377
1452
|
return `${t}/v1/query?${s}`;
|
|
1378
1453
|
}
|
|
1379
|
-
function
|
|
1454
|
+
function Ie(a) {
|
|
1380
1455
|
try {
|
|
1381
1456
|
const e = new URL(a);
|
|
1382
1457
|
if (/(^|\.)smugmug\.com$/i.test(e.hostname)) {
|
|
@@ -1391,13 +1466,13 @@ function ye(a) {
|
|
|
1391
1466
|
}
|
|
1392
1467
|
return { uri: a, title: a };
|
|
1393
1468
|
}
|
|
1394
|
-
async function
|
|
1395
|
-
const r = await ((...
|
|
1469
|
+
async function vt(a, e, t) {
|
|
1470
|
+
const r = await ((...l) => fetch(...l))(gt(a, e));
|
|
1396
1471
|
if (!r.ok) throw new Error(`search answered ${r.status}`);
|
|
1397
|
-
const o = await r.json(), i = new Map((o.items || []).map((
|
|
1398
|
-
return e.map((
|
|
1472
|
+
const o = await r.json(), i = new Map((o.items || []).map((l) => [l.uri, l]));
|
|
1473
|
+
return e.map((l) => i.get(l) || Ie(l));
|
|
1399
1474
|
}
|
|
1400
|
-
const
|
|
1475
|
+
const bt = $`
|
|
1401
1476
|
.breadcrumbs { font-size: 0.8125rem; margin: 0.9rem 0 0; color: var(--hsot-gray-5); }
|
|
1402
1477
|
.breadcrumbs a { text-decoration: none; }
|
|
1403
1478
|
.scorehead { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center; padding: 1.4rem 1rem; }
|
|
@@ -1453,10 +1528,10 @@ const nt = w`
|
|
|
1453
1528
|
.cols { grid-template-columns: 1fr; }
|
|
1454
1529
|
}
|
|
1455
1530
|
`;
|
|
1456
|
-
class
|
|
1457
|
-
static styles = [...
|
|
1531
|
+
class yt extends w {
|
|
1532
|
+
static styles = [...A, bt];
|
|
1458
1533
|
static properties = {
|
|
1459
|
-
|
|
1534
|
+
...w.properties,
|
|
1460
1535
|
gameId: { type: String, attribute: "game-id" },
|
|
1461
1536
|
// The public site search that resolves Game.coverageUrls into cards
|
|
1462
1537
|
// (DEV-1236). Shared cross-stage by design — see the studio host's
|
|
@@ -1474,7 +1549,7 @@ class it extends $ {
|
|
|
1474
1549
|
super(), this.gameId = "", this.searchApi = "", this.embed = !1;
|
|
1475
1550
|
}
|
|
1476
1551
|
async fetchData(e) {
|
|
1477
|
-
const t = await e.getGame(this.gameId), s = Array.isArray(t.coverageUrls) ? t.coverageUrls : [], [r, o, i,
|
|
1552
|
+
const t = await e.getGame(this.gameId), s = Array.isArray(t.coverageUrls) ? t.coverageUrls : [], [r, o, i, l, d, m] = await Promise.all([
|
|
1478
1553
|
e.listSchools(),
|
|
1479
1554
|
e.listTeams({ sport: t.sport }),
|
|
1480
1555
|
e.listConferences(),
|
|
@@ -1484,23 +1559,23 @@ class it extends $ {
|
|
|
1484
1559
|
// links (fetchCoverage already degrades per-URL index misses).
|
|
1485
1560
|
// The embed drops the Coverage grid, so it skips the search
|
|
1486
1561
|
// round-trip entirely rather than fetching cards it will not render.
|
|
1487
|
-
s.length && !this.embed ?
|
|
1562
|
+
s.length && !this.embed ? vt(this.searchApi, s).catch(() => s.map(Ie)) : Promise.resolve([])
|
|
1488
1563
|
]);
|
|
1489
1564
|
return {
|
|
1490
1565
|
game: t,
|
|
1491
1566
|
schools: r.items,
|
|
1492
1567
|
teams: o.items,
|
|
1493
1568
|
conferences: i.items,
|
|
1494
|
-
rankings:
|
|
1495
|
-
games:
|
|
1496
|
-
coverage:
|
|
1569
|
+
rankings: l.items,
|
|
1570
|
+
games: d.items,
|
|
1571
|
+
coverage: m
|
|
1497
1572
|
};
|
|
1498
1573
|
}
|
|
1499
1574
|
get ctx() {
|
|
1500
1575
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
1501
|
-
teamsById:
|
|
1502
|
-
schoolsById:
|
|
1503
|
-
records:
|
|
1576
|
+
teamsById: y(this.data.teams),
|
|
1577
|
+
schoolsById: y(this.data.schools),
|
|
1578
|
+
records: R(this.data.games),
|
|
1504
1579
|
rankings: this.data.rankings,
|
|
1505
1580
|
hrefs: z(this),
|
|
1506
1581
|
sport: this.data.game.sport
|
|
@@ -1509,10 +1584,10 @@ class it extends $ {
|
|
|
1509
1584
|
renderView() {
|
|
1510
1585
|
const e = this.data.game;
|
|
1511
1586
|
if (!e) return n`<div class="view"><p class="empty">Game not found.</p></div>`;
|
|
1512
|
-
const t = this.ctx, s =
|
|
1587
|
+
const t = this.ctx, s = y(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, i = H(e), l = (h) => e.state === "final" && i !== h && i !== "tie" ? "opacity:0.45" : "", d = e.conferenceId ? s[e.conferenceId] : null, m = this.data.games.filter((h) => h.id !== e.id && h.state === "final" && h.gameType !== "scrimmage" && (h.homeTeamId === e.homeTeamId && h.awayTeamId === e.awayTeamId || h.homeTeamId === e.awayTeamId && h.awayTeamId === e.homeTeamId));
|
|
1513
1588
|
return n`
|
|
1514
|
-
${
|
|
1515
|
-
${
|
|
1589
|
+
${B(this, n`
|
|
1590
|
+
${D(this)}
|
|
1516
1591
|
${this.embed ? p : n`
|
|
1517
1592
|
<p class="breadcrumbs">
|
|
1518
1593
|
<a href=${g(t.hrefs.section, { sport: e.sport, view: "scores" })}>${k(e.sport)}</a> /
|
|
@@ -1524,21 +1599,21 @@ class it extends $ {
|
|
|
1524
1599
|
${this.teamBlock(t, e, e.awayTeamId, r, !1)}
|
|
1525
1600
|
<div class="mid">
|
|
1526
1601
|
<div class="bigscore">
|
|
1527
|
-
<span style=${
|
|
1602
|
+
<span style=${l("away")}>${e.awayScore}</span>
|
|
1528
1603
|
<span class="mut" style="font-size:1.6rem">–</span>
|
|
1529
|
-
<span style=${
|
|
1604
|
+
<span style=${l("home")}>${e.homeScore}</span>
|
|
1530
1605
|
</div>
|
|
1531
|
-
<div class="status">${
|
|
1532
|
-
<div class="status">${x(e.date, { weekday: "short", month: "short", day: "numeric", year: "numeric" })}${e.state === "scheduled" && e.time ? n` · ${
|
|
1606
|
+
<div class="status">${E(e)}</div>
|
|
1607
|
+
<div class="status">${x(e.date, { weekday: "short", month: "short", day: "numeric", year: "numeric" })}${e.state === "scheduled" && e.time ? n` · ${V(e.time)}` : p} · ${e.venue || "Venue TBD"}
|
|
1533
1608
|
${e.broadcast ? n` · <span class="pill class">${e.broadcast}</span>` : p}</div>
|
|
1534
1609
|
<div class="status">
|
|
1535
|
-
<span class="pill type">${e.gameType === "conference" ? `${
|
|
1610
|
+
<span class="pill type">${e.gameType === "conference" ? `${d?.name || "Conference"} game` : e.gameType}</span>
|
|
1536
1611
|
${e.label ? n`<span class="pill type">Bracket ${e.label}</span>` : p}
|
|
1537
|
-
${(e.tags || []).map((
|
|
1612
|
+
${(e.tags || []).map((h) => n`<span class="pill type">${h}</span>`)}
|
|
1538
1613
|
</div>
|
|
1539
1614
|
${this.embed ? p : n`
|
|
1540
1615
|
<div class="status">
|
|
1541
|
-
<a href=${
|
|
1616
|
+
<a href=${de(t.hrefs, e.id)}>Report a score for this game</a>
|
|
1542
1617
|
</div>`}
|
|
1543
1618
|
</div>
|
|
1544
1619
|
${this.teamBlock(t, e, e.homeTeamId, o, !0)}
|
|
@@ -1554,14 +1629,14 @@ class it extends $ {
|
|
|
1554
1629
|
${(this.data.coverage || []).length ? n`
|
|
1555
1630
|
<div class="section-title">Coverage</div>
|
|
1556
1631
|
<div class="covgrid">
|
|
1557
|
-
${this.data.coverage.map((
|
|
1558
|
-
<a class="card covcard" href=${
|
|
1559
|
-
${
|
|
1632
|
+
${this.data.coverage.map((h) => n`
|
|
1633
|
+
<a class="card covcard" href=${h.uri}>
|
|
1634
|
+
${h.image ? n`<img class="covimg" src=${h.image} alt="" loading="lazy" />` : p}
|
|
1560
1635
|
<div class="covbody">
|
|
1561
|
-
<div class="covtitle">${
|
|
1562
|
-
${
|
|
1563
|
-
${
|
|
1564
|
-
<div class="covmeta">${[
|
|
1636
|
+
<div class="covtitle">${h.videoDuration ? n`<span class="pill live" style="animation:none">Video</span> ` : p}${h.photos ? n`<span class="pill live" style="animation:none">Photos</span> ` : p}${h.title || h.uri}</div>
|
|
1637
|
+
${h.description ? n`<p class="covdesc">${h.description}</p>` : p}
|
|
1638
|
+
${h.author || h.publishedTime ? n`
|
|
1639
|
+
<div class="covmeta">${[h.author, h.publishedTime ? new Date(h.publishedTime).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" }) : ""].filter(Boolean).join(" · ")}</div>
|
|
1565
1640
|
` : p}
|
|
1566
1641
|
</div>
|
|
1567
1642
|
</a>
|
|
@@ -1569,15 +1644,15 @@ class it extends $ {
|
|
|
1569
1644
|
</div>` : p}
|
|
1570
1645
|
<div class="section-title">Season context</div>
|
|
1571
1646
|
<div class="cols">
|
|
1572
|
-
${[[e.awayTeamId, r], [e.homeTeamId, o]].map(([
|
|
1647
|
+
${[[e.awayTeamId, r], [e.homeTeamId, o]].map(([h, c]) => this.renderContext(t, h, c))}
|
|
1573
1648
|
</div>
|
|
1574
|
-
${
|
|
1649
|
+
${m.length ? n`
|
|
1575
1650
|
<div class="section-title">Head to head this season</div>
|
|
1576
1651
|
<div class="card"><ul class="gamelist">
|
|
1577
|
-
${
|
|
1578
|
-
<span class="d">${x(
|
|
1579
|
-
<span class="opp">${F(t,
|
|
1580
|
-
<a class="box" href=${g(t.hrefs.game, { sport: e.sport, id:
|
|
1652
|
+
${m.map((h) => n`<li>
|
|
1653
|
+
<span class="d">${x(h.date)}</span>${E(h)}
|
|
1654
|
+
<span class="opp">${F(t, h.awayTeamId)} ${h.awayScore}, ${F(t, h.homeTeamId)} ${h.homeScore}</span>
|
|
1655
|
+
<a class="box" href=${g(t.hrefs.game, { sport: e.sport, id: h.id })}>Box score →</a>
|
|
1581
1656
|
</li>`)}
|
|
1582
1657
|
</ul></div>` : p}`}
|
|
1583
1658
|
`)}
|
|
@@ -1585,37 +1660,37 @@ class it extends $ {
|
|
|
1585
1660
|
}
|
|
1586
1661
|
teamBlock(e, t, s, r, o) {
|
|
1587
1662
|
if (!r) return n`<div class="teamblock ${o ? "right" : ""}"><div class="tname">TBD</div></div>`;
|
|
1588
|
-
const i = e.teamsById[s],
|
|
1663
|
+
const i = e.teamsById[s], l = e.records[s], d = M(r, 58);
|
|
1589
1664
|
return n`
|
|
1590
1665
|
<div class="teamblock ${o ? "right" : ""}">
|
|
1591
|
-
${
|
|
1666
|
+
${d ? n`<img class="crest logo" alt="" loading="lazy" src=${d} />` : n`<span class="crest" style="background:${r.colorPrimary || "#030711"};color:${G(r.colorPrimary || "#030711")}">${K(r)}</span>`}
|
|
1592
1667
|
<div>
|
|
1593
1668
|
<div class="tname">${X(e, s, t.date)}<a href=${g(e.hrefs.school, { id: r.id })}>${r.name}</a></div>
|
|
1594
|
-
<div class="trec">${r.mascot || ""} · ${
|
|
1669
|
+
<div class="trec">${r.mascot || ""} · ${I(l)}${i?.conferenceId ? n` · ${I(l, !0)} conf` : p}</div>
|
|
1595
1670
|
</div>
|
|
1596
1671
|
</div>
|
|
1597
1672
|
`;
|
|
1598
1673
|
}
|
|
1599
1674
|
renderLineScore(e, t, s) {
|
|
1600
|
-
const r =
|
|
1675
|
+
const r = pt(e);
|
|
1601
1676
|
if (!r)
|
|
1602
1677
|
return e.state === "scheduled" ? n`<p class="empty" style="text-align:center">Period scoring will appear once the game starts.</p>` : p;
|
|
1603
|
-
const o = Math.max(
|
|
1604
|
-
const
|
|
1605
|
-
return
|
|
1606
|
-
},
|
|
1678
|
+
const o = Math.max(ee(e.sport), ...r.map((m) => m.period)), i = (m) => dt(e.sport, m), l = (m, h) => {
|
|
1679
|
+
const c = r.find((f) => f.period === h);
|
|
1680
|
+
return c ? c[m] : e.state === "final" ? 0 : "·";
|
|
1681
|
+
}, d = (m, h, c) => n`
|
|
1607
1682
|
<tr>
|
|
1608
|
-
<td class="teamcell">${C(
|
|
1609
|
-
${Array.from({ length: o }, (f, u) => n`<td class="num">${
|
|
1610
|
-
<td class="num" style="font-weight:700">${
|
|
1683
|
+
<td class="teamcell">${C(m, 20)}${m?.abbr || "TBD"}</td>
|
|
1684
|
+
${Array.from({ length: o }, (f, u) => n`<td class="num">${l(h, u + 1)}</td>`)}
|
|
1685
|
+
<td class="num" style="font-weight:700">${c}</td>
|
|
1611
1686
|
</tr>`;
|
|
1612
1687
|
return n`
|
|
1613
1688
|
<div class="tablewrap" style="border-top:1px solid var(--hsot-gray-2)">
|
|
1614
1689
|
<table class="data" style="max-width:560px;margin:0.6rem auto 0.9rem">
|
|
1615
|
-
<thead><tr><th>Team</th>${Array.from({ length: o }, (
|
|
1690
|
+
<thead><tr><th>Team</th>${Array.from({ length: o }, (m, h) => n`<th class="num">${i(h + 1)}</th>`)}<th class="num">T</th></tr></thead>
|
|
1616
1691
|
<tbody>
|
|
1617
|
-
${
|
|
1618
|
-
${
|
|
1692
|
+
${d(t, "away", e.awayScore)}
|
|
1693
|
+
${d(s, "home", e.homeScore)}
|
|
1619
1694
|
</tbody>
|
|
1620
1695
|
</table>
|
|
1621
1696
|
</div>
|
|
@@ -1649,12 +1724,12 @@ class it extends $ {
|
|
|
1649
1724
|
}
|
|
1650
1725
|
renderContext(e, t, s) {
|
|
1651
1726
|
if (!s) return p;
|
|
1652
|
-
const r = e.records[t], o =
|
|
1727
|
+
const r = e.records[t], o = Q(this.data.games, t);
|
|
1653
1728
|
return n`
|
|
1654
1729
|
<div class="card ctxcard">
|
|
1655
1730
|
<div class="who">${C(s)}${s.name}</div>
|
|
1656
1731
|
<div class="row">
|
|
1657
|
-
<span>Last 5: ${
|
|
1732
|
+
<span>Last 5: ${J(e, t)}</span>
|
|
1658
1733
|
<span>Streak: <b>${r ? U(r.results) : "·"}</b></span>
|
|
1659
1734
|
<span>PF/PA: <b>${r ? `${r.pf} / ${r.pa}` : "·"}</b></span>
|
|
1660
1735
|
<span>Next: ${o ? n`${x(o.date, { month: "numeric", day: "numeric" })}
|
|
@@ -1664,9 +1739,9 @@ class it extends $ {
|
|
|
1664
1739
|
`;
|
|
1665
1740
|
}
|
|
1666
1741
|
}
|
|
1667
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore",
|
|
1668
|
-
const
|
|
1669
|
-
class
|
|
1742
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore", yt);
|
|
1743
|
+
const $t = 250, wt = 2;
|
|
1744
|
+
class xt extends ce {
|
|
1670
1745
|
static properties = {
|
|
1671
1746
|
api: { type: String },
|
|
1672
1747
|
schoolHref: { type: String, attribute: "school-href" },
|
|
@@ -1677,7 +1752,7 @@ class dt extends le {
|
|
|
1677
1752
|
activeIndex: { state: !0 },
|
|
1678
1753
|
searched: { state: !0 }
|
|
1679
1754
|
};
|
|
1680
|
-
static styles =
|
|
1755
|
+
static styles = $`
|
|
1681
1756
|
:host {
|
|
1682
1757
|
display: block;
|
|
1683
1758
|
position: relative;
|
|
@@ -1746,11 +1821,11 @@ class dt extends le {
|
|
|
1746
1821
|
}
|
|
1747
1822
|
onInput(e) {
|
|
1748
1823
|
const t = e.target.value.trim();
|
|
1749
|
-
if (clearTimeout(this.debounceTimer), t.length <
|
|
1824
|
+
if (clearTimeout(this.debounceTimer), t.length < wt) {
|
|
1750
1825
|
this.abortController?.abort(), this.results = [], this.open = !1, this.searched = !1;
|
|
1751
1826
|
return;
|
|
1752
1827
|
}
|
|
1753
|
-
this.debounceTimer = setTimeout(() => this.search(t),
|
|
1828
|
+
this.debounceTimer = setTimeout(() => this.search(t), $t);
|
|
1754
1829
|
}
|
|
1755
1830
|
async search(e) {
|
|
1756
1831
|
this.abortController?.abort(), this.abortController = new AbortController();
|
|
@@ -1843,37 +1918,37 @@ class dt extends le {
|
|
|
1843
1918
|
`;
|
|
1844
1919
|
}
|
|
1845
1920
|
}
|
|
1846
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-school-search") && globalThis.customElements.define("hsot-school-search",
|
|
1847
|
-
function
|
|
1848
|
-
const t = new Map(a.map((
|
|
1849
|
-
for (const
|
|
1850
|
-
|
|
1851
|
-
const o = a.filter((
|
|
1852
|
-
function d
|
|
1853
|
-
const
|
|
1854
|
-
if (!
|
|
1855
|
-
const
|
|
1856
|
-
return { game:
|
|
1921
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-school-search") && globalThis.customElements.define("hsot-school-search", xt);
|
|
1922
|
+
function Se(a, e) {
|
|
1923
|
+
const t = new Map(a.map((d) => [d.id, d])), s = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
1924
|
+
for (const d of e || [])
|
|
1925
|
+
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));
|
|
1926
|
+
const o = a.filter((d) => !r.has(d.id)), i = (d) => d.targetSlot === "home" ? 0 : 1;
|
|
1927
|
+
function l(d) {
|
|
1928
|
+
const m = t.get(d);
|
|
1929
|
+
if (!m) return null;
|
|
1930
|
+
const c = [...s.get(d) || []].sort((f, u) => i(f) - i(u)).map((f) => l(f.sourceGameId)).filter(Boolean);
|
|
1931
|
+
return { game: m, children: c, bracketGroup: m.bracketGroup };
|
|
1857
1932
|
}
|
|
1858
|
-
return o.length === 1 ?
|
|
1933
|
+
return o.length === 1 ? l(o[0].id) : o.map((d) => l(d.id));
|
|
1859
1934
|
}
|
|
1860
|
-
function
|
|
1935
|
+
function Te(a, e = [], t = 0) {
|
|
1861
1936
|
if (!a) return e;
|
|
1862
1937
|
e[t] || (e[t] = []), e[t].push(a.game);
|
|
1863
|
-
for (const s of a.children || [])
|
|
1938
|
+
for (const s of a.children || []) Te(s, e, t + 1);
|
|
1864
1939
|
return e;
|
|
1865
1940
|
}
|
|
1866
|
-
const
|
|
1867
|
-
function
|
|
1868
|
-
const s =
|
|
1941
|
+
const kt = (a) => Math.max(1, Math.round(Math.log2(a || 2)));
|
|
1942
|
+
function It({ round: a, perGroup: e, groupCount: t = 1 }) {
|
|
1943
|
+
const s = kt(e), o = (t === 4 ? s + 2 : t === 2 ? s + 1 : s) - a;
|
|
1869
1944
|
return o === 0 ? t > 1 ? "Championship" : "Final" : o === 1 ? "Semifinal" : `Round ${a}`;
|
|
1870
1945
|
}
|
|
1871
|
-
function
|
|
1946
|
+
function St(a) {
|
|
1872
1947
|
if (!a || !a.length) return "setup";
|
|
1873
1948
|
const e = Math.max(...a.map((s) => s.round ?? 0)), t = a.filter((s) => (s.round ?? 0) === e);
|
|
1874
1949
|
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";
|
|
1875
1950
|
}
|
|
1876
|
-
function
|
|
1951
|
+
function Tt(a, e) {
|
|
1877
1952
|
const t = a?.groupNames || [];
|
|
1878
1953
|
if (t.length >= 2) {
|
|
1879
1954
|
const r = t.map((o) => ({ key: o, name: o }));
|
|
@@ -1882,62 +1957,62 @@ function ft(a, e) {
|
|
|
1882
1957
|
const s = [...new Set((e || []).map((r) => r.bracketGroup).filter(Boolean))];
|
|
1883
1958
|
return [{ key: null, name: s.length === 1 ? s[0] : "Bracket" }];
|
|
1884
1959
|
}
|
|
1885
|
-
const
|
|
1960
|
+
const Ct = (a, e) => e?.key == null ? [...a || []] : (a || []).filter((t) => t.bracketGroup === e.key), ne = (a) => {
|
|
1886
1961
|
const e = /(\d+)\s*$/.exec(a.label || "");
|
|
1887
1962
|
return e ? Number(e[1]) : 1 / 0;
|
|
1888
|
-
},
|
|
1889
|
-
function
|
|
1963
|
+
}, ie = (a, e) => ne(a) - ne(e) || String(a.id).localeCompare(String(e.id));
|
|
1964
|
+
function Bt(a, e) {
|
|
1890
1965
|
if (a.every((r) => Number.isInteger(r.round))) return (r) => r.round;
|
|
1891
|
-
const t =
|
|
1966
|
+
const t = Se(a, e), s = /* @__PURE__ */ new Map();
|
|
1892
1967
|
for (const r of Array.isArray(t) ? t : [t]) {
|
|
1893
|
-
const o =
|
|
1894
|
-
o.forEach((
|
|
1968
|
+
const o = Te(r), i = o.length - 1;
|
|
1969
|
+
o.forEach((l, d) => l.forEach((m) => s.set(m.id, i - d + 1)));
|
|
1895
1970
|
}
|
|
1896
1971
|
return (r) => Number.isInteger(r.round) ? r.round : s.get(r.id) || 1;
|
|
1897
1972
|
}
|
|
1898
|
-
function
|
|
1899
|
-
const s =
|
|
1973
|
+
function Dt(a, e, t) {
|
|
1974
|
+
const s = Ct(a, t);
|
|
1900
1975
|
if (!s.length) return [];
|
|
1901
|
-
const r =
|
|
1902
|
-
for (const
|
|
1903
|
-
const
|
|
1904
|
-
o.has(
|
|
1976
|
+
const r = Bt(a || [], e || []), o = /* @__PURE__ */ new Map();
|
|
1977
|
+
for (const m of s) {
|
|
1978
|
+
const h = r(m);
|
|
1979
|
+
o.has(h) || o.set(h, []), o.get(h).push(m);
|
|
1905
1980
|
}
|
|
1906
1981
|
const i = /* @__PURE__ */ new Map();
|
|
1907
|
-
for (const
|
|
1908
|
-
|
|
1909
|
-
const
|
|
1910
|
-
let
|
|
1911
|
-
for (const
|
|
1912
|
-
let
|
|
1913
|
-
if (
|
|
1914
|
-
const
|
|
1915
|
-
const u = (i.get(f.id) || []).map((
|
|
1982
|
+
for (const m of e || [])
|
|
1983
|
+
m.outcome === "winner" && (i.has(m.targetGameId) || i.set(m.targetGameId, []), i.get(m.targetGameId).push(m.sourceGameId));
|
|
1984
|
+
const l = [];
|
|
1985
|
+
let d = null;
|
|
1986
|
+
for (const m of [...o.keys()].sort((h, c) => h - c)) {
|
|
1987
|
+
let h = [...o.get(m)];
|
|
1988
|
+
if (d) {
|
|
1989
|
+
const c = (f) => {
|
|
1990
|
+
const u = (i.get(f.id) || []).map((v) => d.get(v)).filter((v) => v !== void 0);
|
|
1916
1991
|
return u.length ? Math.min(...u) : 1 / 0;
|
|
1917
1992
|
};
|
|
1918
|
-
|
|
1993
|
+
h.sort((f, u) => c(f) - c(u) || ie(f, u));
|
|
1919
1994
|
} else
|
|
1920
|
-
|
|
1921
|
-
|
|
1995
|
+
h.sort(ie);
|
|
1996
|
+
d = new Map(h.map((c, f) => [c.id, f])), l.push({ round: m, games: h });
|
|
1922
1997
|
}
|
|
1923
|
-
return
|
|
1998
|
+
return l;
|
|
1924
1999
|
}
|
|
1925
|
-
function
|
|
2000
|
+
function Ft(a, e, t) {
|
|
1926
2001
|
const s = a[`${e}TeamId`] || null, r = (t || []).find((i) => i.gameId === a.id && i.slot === e), o = a[`${e}Seed`] ?? r?.seed ?? null;
|
|
1927
2002
|
return { teamId: s, seed: o, bye: !s && !!r?.isBye };
|
|
1928
2003
|
}
|
|
1929
|
-
function
|
|
2004
|
+
function Ce(a) {
|
|
1930
2005
|
const e = H(a);
|
|
1931
2006
|
return e === "home" || e === "away" ? e : null;
|
|
1932
2007
|
}
|
|
1933
|
-
function
|
|
1934
|
-
const t =
|
|
2008
|
+
function zt(a, e) {
|
|
2009
|
+
const t = Se(a || [], e || []);
|
|
1935
2010
|
if (!t || Array.isArray(t)) return null;
|
|
1936
|
-
const s =
|
|
2011
|
+
const s = Ce(t.game);
|
|
1937
2012
|
return s && t.game[`${s}TeamId`] || null;
|
|
1938
2013
|
}
|
|
1939
|
-
const
|
|
1940
|
-
function
|
|
2014
|
+
const le = { active: 0, setup: 1, complete: 2 };
|
|
2015
|
+
function At(a, { id: e, param: t } = {}) {
|
|
1941
2016
|
const s = a || [];
|
|
1942
2017
|
if (!s.length) return null;
|
|
1943
2018
|
for (const r of [e, t]) {
|
|
@@ -1945,9 +2020,9 @@ function $t(a, { id: e, param: t } = {}) {
|
|
|
1945
2020
|
const o = s.find((i) => i.id === r);
|
|
1946
2021
|
if (o) return o;
|
|
1947
2022
|
}
|
|
1948
|
-
return [...s].sort((r, o) => (
|
|
2023
|
+
return [...s].sort((r, o) => (le[r.status] ?? 3) - (le[o.status] ?? 3) || String(r.name || "").localeCompare(String(o.name || "")))[0];
|
|
1949
2024
|
}
|
|
1950
|
-
const
|
|
2025
|
+
const Pt = $`
|
|
1951
2026
|
.bracket { display: flex; gap: 1rem; align-items: stretch; overflow-x: auto; padding-bottom: 0.5rem; }
|
|
1952
2027
|
.round { flex: 0 0 250px; display: flex; flex-direction: column; min-width: 0; }
|
|
1953
2028
|
.roundhead {
|
|
@@ -1993,10 +2068,10 @@ const wt = w`
|
|
|
1993
2068
|
.champ .tname a { color: inherit; text-decoration: none; font-weight: 700; }
|
|
1994
2069
|
@media (max-width: 720px) { .round { flex-basis: 215px; } }
|
|
1995
2070
|
`;
|
|
1996
|
-
class
|
|
1997
|
-
static styles = [
|
|
2071
|
+
class Et extends w {
|
|
2072
|
+
static styles = [A, Pt];
|
|
1998
2073
|
static properties = {
|
|
1999
|
-
|
|
2074
|
+
...w.properties,
|
|
2000
2075
|
sport: { type: String },
|
|
2001
2076
|
season: { type: String },
|
|
2002
2077
|
tournamentId: { type: String, attribute: "tournament-id" },
|
|
@@ -2007,9 +2082,9 @@ class xt extends $ {
|
|
|
2007
2082
|
super(), this.sport = "football", this.season = "", this.tournamentId = "", this.picked = "", this.group = null;
|
|
2008
2083
|
}
|
|
2009
2084
|
async fetchData(e) {
|
|
2010
|
-
const t = this.season || _(), s = (await e.listTournaments({ sport: this.sport, season: t })).items, r = new URLSearchParams(globalThis.location?.search || "").get("tournament"), o =
|
|
2085
|
+
const t = this.season || _(), s = (await e.listTournaments({ sport: this.sport, season: t })).items, r = new URLSearchParams(globalThis.location?.search || "").get("tournament"), o = At(s, { id: this.picked || this.tournamentId, param: r });
|
|
2011
2086
|
if (!o) return { season: t, tournaments: s, tournament: null };
|
|
2012
|
-
const [i,
|
|
2087
|
+
const [i, l, d, m, h] = await Promise.all([
|
|
2013
2088
|
e.listSeedings(o.id),
|
|
2014
2089
|
e.listEdges(o.id),
|
|
2015
2090
|
e.listGames({ tournamentId: o.id }),
|
|
@@ -2021,16 +2096,16 @@ class xt extends $ {
|
|
|
2021
2096
|
tournaments: s,
|
|
2022
2097
|
tournament: o,
|
|
2023
2098
|
seedings: i.items,
|
|
2024
|
-
edges:
|
|
2025
|
-
games:
|
|
2026
|
-
schools:
|
|
2027
|
-
teams:
|
|
2099
|
+
edges: l.items,
|
|
2100
|
+
games: d.items,
|
|
2101
|
+
schools: m.items,
|
|
2102
|
+
teams: h.items
|
|
2028
2103
|
};
|
|
2029
2104
|
}
|
|
2030
2105
|
get ctx() {
|
|
2031
2106
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
2032
|
-
teamsById:
|
|
2033
|
-
schoolsById:
|
|
2107
|
+
teamsById: y(this.data.teams),
|
|
2108
|
+
schoolsById: y(this.data.schools),
|
|
2034
2109
|
records: {},
|
|
2035
2110
|
rankings: [],
|
|
2036
2111
|
hrefs: z(this),
|
|
@@ -2056,41 +2131,41 @@ class xt extends $ {
|
|
|
2056
2131
|
teams: e.teams
|
|
2057
2132
|
});
|
|
2058
2133
|
if (!e.tournament)
|
|
2059
|
-
return n`${s}${
|
|
2060
|
-
${
|
|
2134
|
+
return n`${s}${B(this, n`
|
|
2135
|
+
${D(this)}
|
|
2061
2136
|
<div class="card"><div class="empty">No ${this.sport} brackets have been published for the ${e.season} season yet.</div></div>
|
|
2062
2137
|
`)}`;
|
|
2063
|
-
const r =
|
|
2138
|
+
const r = Tt(e.tournament, e.games), o = r.find((c) => c.key === this.group) || r[0], i = (e.tournament.groupNames || []).length >= 2 ? e.tournament.groupNames.length : 1, l = (Number(e.tournament.size) || 0) / i, d = Dt(e.games, e.edges, o), m = St(e.games), h = zt(e.games, e.edges);
|
|
2064
2139
|
return n`
|
|
2065
2140
|
${s}
|
|
2066
|
-
${
|
|
2067
|
-
${
|
|
2141
|
+
${B(this, n`
|
|
2142
|
+
${D(this)}
|
|
2068
2143
|
<div class="toolbar">
|
|
2069
2144
|
${e.tournaments.length > 1 ? n`
|
|
2070
2145
|
<div role="group" aria-label="Tournament">
|
|
2071
|
-
${e.tournaments.map((
|
|
2072
|
-
@click=${() => this.pick(
|
|
2146
|
+
${e.tournaments.map((c) => n`<button class="chip ${c.id === e.tournament.id ? "on" : ""}"
|
|
2147
|
+
@click=${() => this.pick(c.id)}>${c.name}</button>`)}
|
|
2073
2148
|
</div>` : p}
|
|
2074
2149
|
${r.length > 1 ? n`
|
|
2075
2150
|
<div role="tablist" aria-label="Bracket group">
|
|
2076
|
-
${r.map((
|
|
2077
|
-
aria-selected=${
|
|
2151
|
+
${r.map((c) => n`<button class="chip ${c.key === o.key ? "on" : ""}" role="tab"
|
|
2152
|
+
aria-selected=${c.key === o.key ? "true" : "false"}
|
|
2078
2153
|
@click=${() => {
|
|
2079
|
-
this.group =
|
|
2080
|
-
}}>${
|
|
2154
|
+
this.group = c.key;
|
|
2155
|
+
}}>${c.name}</button>`)}
|
|
2081
2156
|
</div>` : p}
|
|
2082
2157
|
<span class="spacer"></span>
|
|
2083
|
-
<span class="pill ${
|
|
2158
|
+
<span class="pill ${m === "complete" ? "final" : m === "active" ? "class" : "type"}">${m === "complete" ? "Complete" : m === "active" ? "In progress" : "Bracket set"}</span>
|
|
2084
2159
|
<span class="asof">${e.tournament.size}-team ${String(e.tournament.format || "").replace(/_/g, " ")}</span>
|
|
2085
2160
|
</div>
|
|
2086
|
-
${
|
|
2087
|
-
${C(T(t,
|
|
2088
|
-
${
|
|
2161
|
+
${h ? n`<div class="champ"><span class="pill champ">Champion</span>
|
|
2162
|
+
${C(T(t, h), 26)}<span class="tname">${O(t, h)}</span></div>` : p}
|
|
2163
|
+
${d.length ? n`
|
|
2089
2164
|
<div class="bracket" role="region" aria-label="${o.name} bracket">
|
|
2090
|
-
${
|
|
2165
|
+
${d.map((c) => n`
|
|
2091
2166
|
<section class="round">
|
|
2092
|
-
<h3 class="roundhead">${
|
|
2093
|
-
<div class="games">${
|
|
2167
|
+
<h3 class="roundhead">${It({ round: c.round, perGroup: l, groupCount: i })}</h3>
|
|
2168
|
+
<div class="games">${c.games.map((f) => this.renderMatchup(t, f))}</div>
|
|
2094
2169
|
</section>`)}
|
|
2095
2170
|
</div>` : n`<div class="card"><div class="empty">This bracket has no games yet.</div></div>`}
|
|
2096
2171
|
`)}
|
|
@@ -2103,7 +2178,7 @@ class xt extends $ {
|
|
|
2103
2178
|
${this.renderSlot(e, t, "home")}
|
|
2104
2179
|
${this.renderSlot(e, t, "away")}
|
|
2105
2180
|
<footer class="mfoot">
|
|
2106
|
-
${
|
|
2181
|
+
${E(t)}
|
|
2107
2182
|
${t.label ? n`<span class="label">${t.label}</span>` : p}
|
|
2108
2183
|
<span class="spacer"></span>
|
|
2109
2184
|
${s ? n`<a class="box" href=${g(e.hrefs.game, { sport: this.sport, id: t.id })}>Box score</a>` : p}
|
|
@@ -2112,40 +2187,40 @@ class xt extends $ {
|
|
|
2112
2187
|
`;
|
|
2113
2188
|
}
|
|
2114
2189
|
renderSlot(e, t, s) {
|
|
2115
|
-
const { teamId: r, seed: o, bye: i } =
|
|
2190
|
+
const { teamId: r, seed: o, bye: i } = Ft(t, s, this.data.seedings), l = Ce(t), d = t.state === "live" || t.state === "final";
|
|
2116
2191
|
return n`
|
|
2117
|
-
<div class="slot ${
|
|
2192
|
+
<div class="slot ${l ? l === s ? "winner" : "loser" : ""}">
|
|
2118
2193
|
<span class="seed">${o ?? ""}</span>
|
|
2119
2194
|
${r ? n`${C(T(e, r), 22)}<span class="tname">${O(e, r, t.date)}</span>` : i ? n`<span class="tname bye">Bye</span>` : n`<span class="tname mut">TBD</span>`}
|
|
2120
|
-
${
|
|
2195
|
+
${d ? n`<span class="score">${t[`${s}Score`] ?? 0}</span>` : p}
|
|
2121
2196
|
</div>
|
|
2122
2197
|
`;
|
|
2123
2198
|
}
|
|
2124
2199
|
}
|
|
2125
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-brackets") && globalThis.customElements.define("hsot-brackets",
|
|
2200
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-brackets") && globalThis.customElements.define("hsot-brackets", Et);
|
|
2126
2201
|
export {
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2202
|
+
P as D,
|
|
2203
|
+
yt as H,
|
|
2204
|
+
Et as a,
|
|
2205
|
+
it as b,
|
|
2206
|
+
ct as c,
|
|
2207
|
+
xt as d,
|
|
2208
|
+
rt as e,
|
|
2209
|
+
ot as f,
|
|
2210
|
+
Tt as g,
|
|
2211
|
+
Se as h,
|
|
2212
|
+
zt as i,
|
|
2213
|
+
R as j,
|
|
2214
|
+
St as k,
|
|
2140
2215
|
g as l,
|
|
2141
2216
|
H as m,
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2217
|
+
Nt as n,
|
|
2218
|
+
It as o,
|
|
2219
|
+
Ve as p,
|
|
2220
|
+
Dt as q,
|
|
2221
|
+
I as r,
|
|
2222
|
+
ge as s,
|
|
2148
2223
|
U as t,
|
|
2149
|
-
|
|
2150
|
-
|
|
2224
|
+
Z as u,
|
|
2225
|
+
Te as v
|
|
2151
2226
|
};
|