@wral/hsot-data 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/define.mjs +1 -1
- package/dist/define.standalone.js +571 -549
- package/dist/{hsot-brackets-CfP_Djqm.js → hsot-brackets-DAlf4dVv.js} +501 -479
- 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 de, html as n, css as $, nothing as p, svg as se } from "lit";
|
|
2
|
+
import { createClient as De } from "./client.mjs";
|
|
3
|
+
const E = {
|
|
4
4
|
game: "/{sport}/game/{id}/",
|
|
5
5
|
school: "/school/{id}/",
|
|
6
6
|
section: "/{sport}/{view}/",
|
|
@@ -8,19 +8,19 @@ const P = {
|
|
|
8
8
|
// reportHref() drops the parameter when there is none.
|
|
9
9
|
report: "/report-a-score/?game={id}"
|
|
10
10
|
};
|
|
11
|
-
function
|
|
11
|
+
function v(a, e) {
|
|
12
12
|
return String(a).replace(/\{(\w+)\}/g, (t, s) => e[s] !== void 0 && e[s] !== null ? String(e[s]) : t);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function A(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") || E.game,
|
|
17
|
+
school: a.getAttribute("school-href") || E.school,
|
|
18
|
+
section: a.getAttribute("section-href") || E.section,
|
|
19
|
+
report: a.getAttribute("report-href") || E.report
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
const t =
|
|
22
|
+
function he(a, e = "") {
|
|
23
|
+
const t = v(a.report || E.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) : "";
|
|
@@ -36,13 +36,13 @@ function V(a) {
|
|
|
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 Fe(a) {
|
|
40
40
|
return a ? `${Math.floor(a / 12)}-${a % 12}` : "·";
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function ze(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
|
-
function
|
|
45
|
+
function R(a = /* @__PURE__ */ new Date()) {
|
|
46
46
|
const e = a.getFullYear();
|
|
47
47
|
return a.getMonth() >= 6 ? `${e}-${e + 1}` : `${e - 1}-${e}`;
|
|
48
48
|
}
|
|
@@ -50,7 +50,7 @@ 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 Ae(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);
|
|
@@ -59,12 +59,12 @@ function ze(a, e = Y()) {
|
|
|
59
59
|
function K(a) {
|
|
60
60
|
return a ? (a.abbr || a.name || "?").slice(0, 4).toUpperCase() : "?";
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function M(a) {
|
|
63
63
|
if (!a || !/^#[0-9a-fA-F]{6}$/.test(a)) return "#FFFFFF";
|
|
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 Pe = (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
|
};
|
|
@@ -75,11 +75,11 @@ function q(a, e) {
|
|
|
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 me(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 pe(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" };
|
|
@@ -90,19 +90,19 @@ function me(a) {
|
|
|
90
90
|
}
|
|
91
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 Ee = ["boys", "girls"];
|
|
94
|
+
function fe(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 ue(a, e) {
|
|
98
|
+
return e ? (a || []).filter((t) => fe(t, e)) : a || [];
|
|
99
99
|
}
|
|
100
100
|
function W(a) {
|
|
101
101
|
const e = new Set((a || []).map((t) => t && t.gender));
|
|
102
|
-
return
|
|
102
|
+
return Ee.filter((t) => e.has(t));
|
|
103
103
|
}
|
|
104
|
-
const
|
|
105
|
-
function
|
|
104
|
+
const _e = (a) => W(a).length === 2, Re = /* @__PURE__ */ new Set(["game", "story", "page", "forum", "video", "gallery"]);
|
|
105
|
+
function I(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 S(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 ge() {
|
|
114
114
|
const a = globalThis.location;
|
|
115
115
|
if (!a) return "";
|
|
116
116
|
const e = (a.hash || "").startsWith("#/") ? a.hash : "";
|
|
117
|
-
return
|
|
117
|
+
return I((a.pathname || "") + e);
|
|
118
118
|
}
|
|
119
|
-
function
|
|
119
|
+
function Ne(a, e, t) {
|
|
120
120
|
if (!t) return null;
|
|
121
|
-
const s =
|
|
121
|
+
const s = I(a);
|
|
122
122
|
if (!s) return null;
|
|
123
|
-
const r =
|
|
123
|
+
const r = I(v(e.game, { sport: t, id: "" })), o = I(v(e.school, { id: "" }));
|
|
124
124
|
if (s === r || s.startsWith(`${r}/`) || s === o || s.startsWith(`${o}/`)) return null;
|
|
125
|
-
const i =
|
|
125
|
+
const i = I(v(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 c = s.slice(i.length + 1), h = c.split("/");
|
|
129
|
+
return h.length > 2 || h.some((m) => !/^[a-z][a-z-]*$/.test(m)) || Re.has(h[0]) ? null : c;
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
const s = (o) =>
|
|
131
|
+
function Me(a, e, t) {
|
|
132
|
+
const s = (o) => v(t.section, { sport: a, view: o }).replace(/([^:])\/{2,}/g, "$1/"), r = _e(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 Ne(a, e, t) {
|
|
|
141
141
|
{ label: "Polls & Rankings", href: s("rankings") }
|
|
142
142
|
];
|
|
143
143
|
}
|
|
144
|
-
function Ge(a, e =
|
|
145
|
-
const t =
|
|
144
|
+
function Ge(a, e = ge()) {
|
|
145
|
+
const t = I(e);
|
|
146
146
|
for (const s of a.querySelectorAll(':scope > a[slot="nav"]'))
|
|
147
|
-
t &&
|
|
147
|
+
t && I(s.getAttribute("href")) === t ? s.setAttribute("aria-current", "page") : s.removeAttribute("aria-current");
|
|
148
148
|
}
|
|
149
|
-
class w extends
|
|
149
|
+
class w extends de {
|
|
150
150
|
static properties = {
|
|
151
151
|
api: { type: String },
|
|
152
152
|
refreshInterval: { type: Number, attribute: "refresh-interval" },
|
|
@@ -165,7 +165,7 @@ class w extends ce {
|
|
|
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 ? De({ baseUrl: this.api }) : null;
|
|
169
169
|
}
|
|
170
170
|
connectedCallback() {
|
|
171
171
|
super.connectedCallback(), this._setupInterval();
|
|
@@ -212,7 +212,7 @@ class w extends ce {
|
|
|
212
212
|
return n``;
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
const y = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])),
|
|
215
|
+
const y = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), Le = $`
|
|
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 y = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), Me = $`
|
|
|
250
250
|
outline-offset: 1px;
|
|
251
251
|
}
|
|
252
252
|
.mut { color: var(--hsot-gray-5); }
|
|
253
|
-
`,
|
|
253
|
+
`, Oe = $`
|
|
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 y = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), Me = $`
|
|
|
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
|
+
`, He = $`
|
|
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 y = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), Me = $`
|
|
|
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
|
+
`, Ue = $`
|
|
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 y = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), Me = $`
|
|
|
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
|
+
`, je = $`
|
|
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 y = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), Me = $`
|
|
|
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
|
+
`, qe = $`
|
|
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 y = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), Me = $`
|
|
|
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
|
+
`, We = $`
|
|
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 y = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), Me = $`
|
|
|
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
|
+
`, P = [Le, Oe, He, Ue, je, qe, We];
|
|
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 Ve(a) {
|
|
478
478
|
return a && (a.forfeit === "home" || a.forfeit === "away") ? a.forfeit : null;
|
|
479
479
|
}
|
|
480
|
-
function
|
|
480
|
+
function N(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 m =
|
|
483
|
+
const i = H(o), c = o.gameType === "conference";
|
|
484
|
+
for (const h of ["home", "away"]) {
|
|
485
|
+
const m = h === "home" ? o.homeTeamId : o.awayTeamId;
|
|
486
486
|
if (!m) continue;
|
|
487
|
-
const
|
|
488
|
-
|
|
487
|
+
const d = s(m), l = h === "home" ? o.homeScore : o.awayScore, f = h === "home" ? o.awayScore : o.homeScore;
|
|
488
|
+
d.pf += l, d.pa += f;
|
|
489
489
|
let u = "T";
|
|
490
|
-
i === "tie" ? (
|
|
490
|
+
i === "tie" ? (d.t += 1, c && (d.ct += 1)) : i === h ? (d.w += 1, c && (d.cw += 1), u = "W") : (d.l += 1, c && (d.cl += 1), u = "L"), d.results.push({ gameId: o.id, date: o.date, mark: u, my: l, their: f, opp: h === "home" ? o.awayTeamId : o.homeTeamId, conf: c });
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
493
|
return t;
|
|
@@ -499,29 +499,29 @@ function U(a) {
|
|
|
499
499
|
for (let s = a.length - 1; s >= 0 && a[s].mark === e; s -= 1) t += 1;
|
|
500
500
|
return e + t;
|
|
501
501
|
}
|
|
502
|
-
const
|
|
502
|
+
const ae = (a, e, t) => {
|
|
503
503
|
const s = a + e + t;
|
|
504
504
|
return s ? (a + t / 2) / s : 0;
|
|
505
|
-
},
|
|
506
|
-
function
|
|
505
|
+
}, re = (a) => a.toFixed(3).replace("0.", ".");
|
|
506
|
+
function S(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 ve(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
|
-
return { team: t, rec: s, confPct:
|
|
514
|
+
return { team: t, rec: s, confPct: ae(s.cw, s.cl, s.ct), overallPct: ae(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
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
|
-
function
|
|
520
|
+
function oe(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 Ot(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));
|
|
@@ -531,19 +531,19 @@ 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 m =
|
|
537
|
-
(!
|
|
534
|
+
for (const h of a || []) {
|
|
535
|
+
if (h.sport !== s || r && h.effectiveDate > r || h.gender && o.gender !== h.gender && o.gender !== "coed") continue;
|
|
536
|
+
const m = h.gender || "", d = i.get(m);
|
|
537
|
+
(!d || h.effectiveDate > d.effectiveDate) && i.set(m, h);
|
|
538
538
|
}
|
|
539
|
-
let
|
|
540
|
-
for (const
|
|
541
|
-
const m = (
|
|
542
|
-
m !== -1 && (!
|
|
539
|
+
let c = null;
|
|
540
|
+
for (const h of i.values()) {
|
|
541
|
+
const m = (h.teamIds || []).indexOf(t);
|
|
542
|
+
m !== -1 && (!c || h.effectiveDate > c.effectiveDate) && (c = { poll: h, rank: m + 1 });
|
|
543
543
|
}
|
|
544
|
-
return
|
|
544
|
+
return c ? c.rank : null;
|
|
545
545
|
}
|
|
546
|
-
function
|
|
546
|
+
function Ye(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,54 +553,54 @@ function Ve(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 Ke(a) {
|
|
557
557
|
return /^https?:\/\//i.test(String(a || ""));
|
|
558
558
|
}
|
|
559
|
-
function
|
|
560
|
-
if (!
|
|
559
|
+
function be(a, { w: e, h: t } = {}) {
|
|
560
|
+
if (!Ke(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("?") ? "&" : "?";
|
|
564
564
|
return `${a}${r}${s.join("&")}`;
|
|
565
565
|
}
|
|
566
|
-
function
|
|
566
|
+
function G(a, e) {
|
|
567
567
|
const t = e * 2;
|
|
568
|
-
return
|
|
568
|
+
return be(a?.logoAssetId, { w: t, h: t });
|
|
569
569
|
}
|
|
570
|
-
function
|
|
571
|
-
return
|
|
570
|
+
function Qe(a, e) {
|
|
571
|
+
return be(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 = ge(), c = !!a.querySelector(':scope > a[slot="nav"]') || Ne(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
|
+
${c ? 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
|
+
${Me(e.sport, r, e.hrefs).map((h) => n`<a href=${h.href}
|
|
586
|
+
aria-current=${o && I(h.href) === o ? "page" : p}>${h.label}</a>`)}
|
|
587
587
|
</slot>
|
|
588
588
|
</div>
|
|
589
589
|
</nav>` : p}
|
|
590
590
|
</div>
|
|
591
591
|
`;
|
|
592
592
|
}
|
|
593
|
-
const
|
|
593
|
+
const C = (a, e) => {
|
|
594
594
|
const t = a.teamsById[e];
|
|
595
595
|
return t ? a.schoolsById[t.schoolId] : null;
|
|
596
|
-
},
|
|
597
|
-
function
|
|
596
|
+
}, z = (a, e) => C(a, e)?.name || "TBD", L = (a, e) => C(a, e)?.abbr || "TBD";
|
|
597
|
+
function B(a, e = 26) {
|
|
598
598
|
if (!a) return p;
|
|
599
|
-
const t =
|
|
599
|
+
const t = G(a, e);
|
|
600
600
|
if (t)
|
|
601
601
|
return n`<img class="swatch logo" aria-hidden="true" alt="" loading="lazy"
|
|
602
602
|
src=${t} style="width:${e}px;height:${e}px" />`;
|
|
603
|
-
const s = a.colorPrimary || "#030711", r =
|
|
603
|
+
const s = a.colorPrimary || "#030711", r = M(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>`;
|
|
@@ -610,8 +610,8 @@ function X(a, e, t) {
|
|
|
610
610
|
return s ? n`<span class="rankbadge">#${s}</span>` : p;
|
|
611
611
|
}
|
|
612
612
|
function O(a, e, t) {
|
|
613
|
-
const s =
|
|
614
|
-
return s ? n`${X(a, e, t)}<a href=${
|
|
613
|
+
const s = C(a, e);
|
|
614
|
+
return s ? n`${X(a, e, t)}<a href=${v(a.hrefs.school, { id: s.id })}>${s.name}</a>` : n`<span class="mut">TBD</span>`;
|
|
615
615
|
}
|
|
616
616
|
function J(a, e, t = 5) {
|
|
617
617
|
const s = a.records[e];
|
|
@@ -619,39 +619,39 @@ function J(a, e, t = 5) {
|
|
|
619
619
|
const r = s.results.slice(-1 * t);
|
|
620
620
|
return n`<span class="dots" role="img" aria-label="last ${r.length} results">
|
|
621
621
|
${r.map((o) => n`<a class="dot ${o.mark}"
|
|
622
|
-
title="${o.mark} ${o.my}-${o.their} vs ${
|
|
623
|
-
href=${
|
|
622
|
+
title="${o.mark} ${o.my}-${o.their} vs ${z(a, o.opp)}"
|
|
623
|
+
href=${v(a.hrefs.game, { sport: a.sport, id: o.gameId })}>${o.mark}</a>`)}
|
|
624
624
|
</span>`;
|
|
625
625
|
}
|
|
626
|
-
function
|
|
626
|
+
function D(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 F(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 _(a) {
|
|
638
|
+
const e = pe(a);
|
|
639
639
|
return n`<span class="pill ${e.kind}">${e.label}</span>`;
|
|
640
640
|
}
|
|
641
|
-
function
|
|
641
|
+
function ye(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
|
-
const
|
|
647
|
-
function
|
|
646
|
+
const Ze = "https://api.wral.com/search";
|
|
647
|
+
function Xe(a) {
|
|
648
648
|
return a.map((e) => `uri:"${e}"`).join(" OR ");
|
|
649
649
|
}
|
|
650
|
-
function
|
|
651
|
-
const t = String(a ||
|
|
650
|
+
function Je(a, e) {
|
|
651
|
+
const t = String(a || Ze).replace(/\/+$/, ""), s = new URLSearchParams({ query: Xe(e), sort: "score", lang: "en" });
|
|
652
652
|
return `${t}/v1/query?${s}`;
|
|
653
653
|
}
|
|
654
|
-
function
|
|
654
|
+
function $e(a) {
|
|
655
655
|
try {
|
|
656
656
|
const e = new URL(a);
|
|
657
657
|
if (/(^|\.)smugmug\.com$/i.test(e.hostname)) {
|
|
@@ -666,13 +666,13 @@ function ye(a) {
|
|
|
666
666
|
}
|
|
667
667
|
return { uri: a, title: a };
|
|
668
668
|
}
|
|
669
|
-
async function
|
|
670
|
-
const r = await ((...
|
|
669
|
+
async function et(a, e, t) {
|
|
670
|
+
const r = await ((...c) => fetch(...c))(Je(a, e));
|
|
671
671
|
if (!r.ok) throw new Error(`search answered ${r.status}`);
|
|
672
|
-
const o = await r.json(), i = new Map((o.items || []).map((
|
|
673
|
-
return e.map((
|
|
672
|
+
const o = await r.json(), i = new Map((o.items || []).map((c) => [c.uri, c]));
|
|
673
|
+
return e.map((c) => i.get(c) || $e(c));
|
|
674
674
|
}
|
|
675
|
-
function
|
|
675
|
+
function tt(a) {
|
|
676
676
|
try {
|
|
677
677
|
const e = new URL(a);
|
|
678
678
|
if (/(^|\.)smugmug\.com$/i.test(e.hostname)) return "Photos";
|
|
@@ -683,54 +683,54 @@ function et(a) {
|
|
|
683
683
|
}
|
|
684
684
|
return "Coverage";
|
|
685
685
|
}
|
|
686
|
-
function
|
|
686
|
+
function st(a) {
|
|
687
687
|
const e = /* @__PURE__ */ new Map();
|
|
688
688
|
return (Array.isArray(a) ? a : []).filter((t) => /^https?:\/\//i.test(String(t || ""))).map((t) => {
|
|
689
|
-
const s =
|
|
689
|
+
const s = tt(t), r = (e.get(s) || 0) + 1;
|
|
690
690
|
return e.set(s, r), { href: t, label: r > 1 ? `${s} ${r}` : s };
|
|
691
691
|
});
|
|
692
692
|
}
|
|
693
|
-
const
|
|
693
|
+
const at = ["all", "conferences"], we = "all", ne = (a) => at.includes(a) ? a : we, xe = Number.MAX_SAFE_INTEGER, ke = (a, e, t) => {
|
|
694
694
|
const s = a[t];
|
|
695
695
|
return s && e[s.schoolId] || null;
|
|
696
696
|
};
|
|
697
|
-
function
|
|
697
|
+
function rt(a, e) {
|
|
698
698
|
const t = (a || []).map((s) => e[s.schoolId]?.areaCode).filter(Boolean);
|
|
699
699
|
return [...new Set(t)].sort();
|
|
700
700
|
}
|
|
701
|
-
function rt(a, e, t, s) {
|
|
702
|
-
return e ? [a.awayTeamId, a.homeTeamId].some((r) => xe(t, s, r)?.areaCode === e) : !0;
|
|
703
|
-
}
|
|
704
701
|
function ot(a, e, t, s) {
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
702
|
+
return e ? [a.awayTeamId, a.homeTeamId].some((r) => ke(t, s, r)?.areaCode === e) : !0;
|
|
703
|
+
}
|
|
704
|
+
function nt(a, e, t, s) {
|
|
705
|
+
const r = (c) => ke(t, s, c)?.name || "", o = (c, h) => !c - !h || me(c, h), i = new Map((a || []).map((c) => [c, {
|
|
706
|
+
rank: e(c) || xe,
|
|
707
|
+
away: r(c.awayTeamId),
|
|
708
|
+
home: r(c.homeTeamId)
|
|
709
709
|
}]));
|
|
710
|
-
return [...i.keys()].sort((
|
|
711
|
-
const m = i.get(
|
|
712
|
-
return m.rank -
|
|
710
|
+
return [...i.keys()].sort((c, h) => {
|
|
711
|
+
const m = i.get(c), d = i.get(h);
|
|
712
|
+
return m.rank - d.rank || o(m.away, d.away) || o(m.home, d.home) || String(c.time || "").localeCompare(String(h.time || ""));
|
|
713
713
|
});
|
|
714
714
|
}
|
|
715
|
-
function
|
|
716
|
-
const t = new Map((a || []).map((r) => [r, e(r) ||
|
|
715
|
+
function it(a, e) {
|
|
716
|
+
const t = new Map((a || []).map((r) => [r, e(r) || xe])), s = (r) => r.state === "live" ? 0 : 1;
|
|
717
717
|
return [...t.keys()].sort((r, o) => s(r) - s(o) || t.get(r) - t.get(o));
|
|
718
718
|
}
|
|
719
|
-
function
|
|
719
|
+
function lt(a, e) {
|
|
720
720
|
if (a.gameType === "conference" && a.conferenceId) {
|
|
721
721
|
const t = e[a.conferenceId] || null;
|
|
722
722
|
return { name: t?.name || "Conference", conference: t };
|
|
723
723
|
}
|
|
724
724
|
return a.gameType === "playoff" ? { name: "Playoffs", conference: null } : a.gameType === "scrimmage" ? { name: "Scrimmages", conference: null } : { name: "Nonconference", conference: null };
|
|
725
725
|
}
|
|
726
|
-
function
|
|
726
|
+
function ct(a, e) {
|
|
727
727
|
const t = /* @__PURE__ */ new Map();
|
|
728
728
|
return (a || []).forEach((s) => {
|
|
729
|
-
const { name: r, conference: o } =
|
|
729
|
+
const { name: r, conference: o } = lt(s, e);
|
|
730
730
|
t.has(r) || t.set(r, { name: r, conference: o, games: [] }), t.get(r).games.push(s);
|
|
731
731
|
}), [...t.values()];
|
|
732
732
|
}
|
|
733
|
-
const
|
|
733
|
+
const dt = $`
|
|
734
734
|
.toolbar.filters { gap: 0.5rem 1.1rem; }
|
|
735
735
|
.filters [role="group"] { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
|
|
736
736
|
.filters .asof { margin-right: 0.1rem; }
|
|
@@ -745,8 +745,8 @@ const ct = $`
|
|
|
745
745
|
.gamelist .links { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.6rem; }
|
|
746
746
|
.gamelist .links a { font-size: 0.78rem; }
|
|
747
747
|
`;
|
|
748
|
-
class
|
|
749
|
-
static styles = [...
|
|
748
|
+
class ht extends w {
|
|
749
|
+
static styles = [...P, dt];
|
|
750
750
|
static properties = {
|
|
751
751
|
...w.properties,
|
|
752
752
|
sport: { type: String },
|
|
@@ -764,29 +764,29 @@ class dt extends w {
|
|
|
764
764
|
!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;
|
|
765
765
|
}
|
|
766
766
|
async fetchData(e) {
|
|
767
|
-
const t = this.season ||
|
|
767
|
+
const t = this.season || R(), [s, r, o, i, c] = await Promise.all([
|
|
768
768
|
e.listSchools(),
|
|
769
769
|
e.listTeams({ sport: this.sport }),
|
|
770
770
|
e.listConferences(),
|
|
771
771
|
e.listGames({ sport: this.sport, season: t }),
|
|
772
772
|
e.listRankings({ sport: this.sport })
|
|
773
773
|
]);
|
|
774
|
-
return this._datePinned || (this.date =
|
|
774
|
+
return this._datePinned || (this.date = Ae(i.items.map((h) => h.date)), this._datePinned = !0), {
|
|
775
775
|
season: t,
|
|
776
776
|
schools: s.items,
|
|
777
777
|
teams: r.items,
|
|
778
778
|
conferences: o.items,
|
|
779
779
|
games: i.items,
|
|
780
|
-
rankings:
|
|
780
|
+
rankings: c.items
|
|
781
781
|
};
|
|
782
782
|
}
|
|
783
783
|
get ctx() {
|
|
784
784
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
785
785
|
teamsById: y(this.data.teams),
|
|
786
786
|
schoolsById: y(this.data.schools),
|
|
787
|
-
records:
|
|
787
|
+
records: N(this.data.games),
|
|
788
788
|
rankings: this.data.rankings,
|
|
789
|
-
hrefs:
|
|
789
|
+
hrefs: A(this),
|
|
790
790
|
sport: this.sport
|
|
791
791
|
}, this._ctxData = this.data), this._ctx;
|
|
792
792
|
}
|
|
@@ -794,35 +794,35 @@ class dt extends w {
|
|
|
794
794
|
pick({ view: e = null, area: t = null }) {
|
|
795
795
|
e !== null && (this.view = e), t !== null && (this.areaCode = t);
|
|
796
796
|
try {
|
|
797
|
-
const s = new URL(globalThis.location.href), r = (o, i,
|
|
798
|
-
r("view",
|
|
797
|
+
const s = new URL(globalThis.location.href), r = (o, i, c) => i && i !== c ? s.searchParams.set(o, i) : s.searchParams.delete(o);
|
|
798
|
+
r("view", ne(this.view), we), r("area", this.areaCode, ""), globalThis.history?.replaceState(null, "", s);
|
|
799
799
|
} catch {
|
|
800
800
|
}
|
|
801
801
|
}
|
|
802
802
|
renderView() {
|
|
803
|
-
const e = this.ctx, t = y(this.data.conferences), s = [...new Set(this.data.games.map((
|
|
804
|
-
const f = [
|
|
803
|
+
const e = this.ctx, t = y(this.data.conferences), s = [...new Set(this.data.games.map((l) => l.date).filter(Boolean))].sort(), r = ne(this.view), o = rt(this.data.teams, e.schoolsById), i = o.includes(this.areaCode) ? this.areaCode : "", c = (l) => {
|
|
804
|
+
const f = [l.awayTeamId, l.homeTeamId].map((u) => Z(e.rankings, e.teamsById, u, this.sport, l.date)).filter(Boolean);
|
|
805
805
|
return f.length ? Math.min(...f) : null;
|
|
806
|
-
},
|
|
806
|
+
}, h = this.data.games.filter((l) => l.date === this.date), m = h.filter((l) => ot(l, i, e.teamsById, e.schoolsById)), d = r === "conferences" ? ct(it(m, c), t) : m.length ? [{
|
|
807
807
|
name: i ? `All games · ${i}` : "All games",
|
|
808
808
|
conference: null,
|
|
809
|
-
games:
|
|
809
|
+
games: nt(m, c, e.teamsById, e.schoolsById)
|
|
810
810
|
}] : [];
|
|
811
811
|
return n`
|
|
812
812
|
${j(this, e, {
|
|
813
813
|
title: n`${k(this.sport)} scores & schedules`,
|
|
814
|
-
sub: n`${x(this.date, { weekday: "long", month: "long", day: "numeric", year: "numeric" })} · ${
|
|
814
|
+
sub: n`${x(this.date, { weekday: "long", month: "long", day: "numeric", year: "numeric" })} · ${h.length} games`,
|
|
815
815
|
teams: this.data.teams
|
|
816
816
|
})}
|
|
817
|
-
${
|
|
818
|
-
${
|
|
817
|
+
${D(this, n`
|
|
818
|
+
${F(this)}
|
|
819
819
|
<div class="toolbar">
|
|
820
820
|
<label class="asof" for="datesel">Date</label>
|
|
821
|
-
<select id="datesel" @change=${(
|
|
822
|
-
this.date =
|
|
821
|
+
<select id="datesel" @change=${(l) => {
|
|
822
|
+
this.date = l.target.value;
|
|
823
823
|
}}>
|
|
824
|
-
${(s.includes(this.date) ? s : [...s, this.date].sort()).map((
|
|
825
|
-
${x(
|
|
824
|
+
${(s.includes(this.date) ? s : [...s, this.date].sort()).map((l) => n`<option value=${l} ?selected=${l === this.date}>
|
|
825
|
+
${x(l, { weekday: "short", month: "short", day: "numeric" })}${l === Y() ? " · today" : ""}
|
|
826
826
|
</option>`)}
|
|
827
827
|
</select>
|
|
828
828
|
<button class="chip" ?disabled=${s.indexOf(this.date) <= 0}
|
|
@@ -835,29 +835,29 @@ class dt extends w {
|
|
|
835
835
|
}}>Next →</button>
|
|
836
836
|
<span class="spacer"></span>
|
|
837
837
|
<span class="asof">${r === "conferences" ? "Live games first" : "Ranked matchups first, then A–Z by road team"}
|
|
838
|
-
· <a href=${
|
|
838
|
+
· <a href=${he(e.hrefs)}>report a score</a> to see it update here</span>
|
|
839
839
|
</div>
|
|
840
840
|
<div class="toolbar filters">
|
|
841
841
|
<div role="group" aria-label="Scoreboard view">
|
|
842
|
-
${[["all", "All games"], ["conferences", "Conferences view"]].map(([
|
|
843
|
-
class="chip ${r ===
|
|
844
|
-
@click=${() => this.pick({ view:
|
|
842
|
+
${[["all", "All games"], ["conferences", "Conferences view"]].map(([l, f]) => n`<button
|
|
843
|
+
class="chip ${r === l ? "on" : ""}" aria-pressed=${r === l ? "true" : "false"}
|
|
844
|
+
@click=${() => this.pick({ view: l })}>${f}</button>`)}
|
|
845
845
|
</div>
|
|
846
846
|
${o.length ? n`
|
|
847
847
|
<div role="group" aria-label="Filter by area code">
|
|
848
848
|
<span class="asof">Area code</span>
|
|
849
|
-
${o.map((
|
|
850
|
-
aria-pressed=${i ===
|
|
851
|
-
@click=${() => this.pick({ area: i ===
|
|
849
|
+
${o.map((l) => n`<button class="chip ${i === l ? "on" : ""}"
|
|
850
|
+
aria-pressed=${i === l ? "true" : "false"}
|
|
851
|
+
@click=${() => this.pick({ area: i === l ? "" : l })}>${l}</button>`)}
|
|
852
852
|
</div>` : p}
|
|
853
853
|
</div>
|
|
854
|
-
${
|
|
855
|
-
${
|
|
854
|
+
${h.length ? p : n`<p class="empty">No ${this.sport} games on this date.</p>`}
|
|
855
|
+
${h.length && !m.length ? n`<p class="empty">No ${this.sport} games in the ${i} area code on this date.
|
|
856
856
|
<button class="chip" @click=${() => this.pick({ area: "" })}>Every area</button></p>` : p}
|
|
857
|
-
${
|
|
858
|
-
<div class="section-title">${
|
|
857
|
+
${d.map(({ name: l, conference: f, games: u }) => n`
|
|
858
|
+
<div class="section-title">${l}${[...f?.classifications || []].sort(q).map((g) => n`<span class="pill class">${g}</span>`)}</div>
|
|
859
859
|
<div class="card"><ul class="gamelist">
|
|
860
|
-
${u.map((
|
|
860
|
+
${u.map((g) => this.renderGame(e, g))}
|
|
861
861
|
</ul></div>
|
|
862
862
|
`)}
|
|
863
863
|
`)}
|
|
@@ -871,25 +871,25 @@ class dt extends w {
|
|
|
871
871
|
// from each URL's shape (lib/search.mjs) rather than the site search the
|
|
872
872
|
// box score's coverage cards query.
|
|
873
873
|
renderGame(e, t) {
|
|
874
|
-
const s = t.state === "final" || t.state === "live", r = (i,
|
|
874
|
+
const s = t.state === "final" || t.state === "live", r = (i, c, h = p) => n`<span class="side">${O(e, i, t.date)}${s ? n`<span class="score">${c}</span>` : p}${h}</span>`, o = Ve(t);
|
|
875
875
|
return n`
|
|
876
876
|
<li>
|
|
877
|
-
${
|
|
877
|
+
${_(t)}
|
|
878
878
|
<span class="opp matchup">${r(t.awayTeamId, t.awayScore, n`<span class="at">at</span>`)}${r(t.homeTeamId, t.homeScore)}</span>
|
|
879
|
-
${o ? n`<span class="ff">${
|
|
879
|
+
${o ? n`<span class="ff">${z(e, o === "home" ? t.homeTeamId : t.awayTeamId)} forfeited</span>` : p}
|
|
880
880
|
<span class="where">${t.venue || ""}</span>
|
|
881
881
|
${t.broadcast ? n`<span class="pill class">${t.broadcast}</span>` : p}
|
|
882
882
|
<span class="links">
|
|
883
|
-
${
|
|
884
|
-
<a class="box" href=${
|
|
883
|
+
${st(t.coverageUrls).map((i) => n`<a href=${i.href}>${i.label}</a>`)}
|
|
884
|
+
<a class="box" href=${v(e.hrefs.game, { sport: this.sport, id: t.id })}>Box score →</a>
|
|
885
885
|
</span>
|
|
886
886
|
</li>
|
|
887
887
|
`;
|
|
888
888
|
}
|
|
889
889
|
}
|
|
890
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores",
|
|
891
|
-
class
|
|
892
|
-
static styles =
|
|
890
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores", ht);
|
|
891
|
+
class mt extends w {
|
|
892
|
+
static styles = P;
|
|
893
893
|
static properties = {
|
|
894
894
|
...w.properties,
|
|
895
895
|
sport: { type: String },
|
|
@@ -913,7 +913,7 @@ class ht extends w {
|
|
|
913
913
|
return e.length < 2 ? "" : e.includes(this.pickedGender) ? this.pickedGender : e[0];
|
|
914
914
|
}
|
|
915
915
|
async fetchData(e) {
|
|
916
|
-
const t = this.season ||
|
|
916
|
+
const t = this.season || R(), [s, r, o, i, c] = await Promise.all([
|
|
917
917
|
e.listConferences({ active: !0 }),
|
|
918
918
|
e.listSchools(),
|
|
919
919
|
// Deliberately NOT gender-filtered: the sub-nav decides whether to
|
|
@@ -932,24 +932,24 @@ class ht extends w {
|
|
|
932
932
|
schools: r.items,
|
|
933
933
|
teams: o.items,
|
|
934
934
|
games: i.items,
|
|
935
|
-
rankings:
|
|
935
|
+
rankings: c.items
|
|
936
936
|
};
|
|
937
937
|
}
|
|
938
938
|
get ctx() {
|
|
939
939
|
return (!this._ctx || this._ctxData !== this.data || this._ctxGender !== this.viewGender) && (this._ctx = {
|
|
940
940
|
teamsById: y(this.data.teams),
|
|
941
941
|
schoolsById: y(this.data.schools),
|
|
942
|
-
records:
|
|
942
|
+
records: N(this.data.games),
|
|
943
943
|
rankings: this.data.rankings,
|
|
944
|
-
hrefs:
|
|
944
|
+
hrefs: A(this),
|
|
945
945
|
sport: this.sport,
|
|
946
946
|
// The teams this view stands for — one side of a gendered
|
|
947
947
|
// sport, or all of them when the sport fields only one.
|
|
948
|
-
teams:
|
|
948
|
+
teams: ue(this.data.teams, this.viewGender)
|
|
949
949
|
}, this._ctxData = this.data, this._ctxGender = this.viewGender), this._ctx;
|
|
950
950
|
}
|
|
951
951
|
renderView() {
|
|
952
|
-
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(
|
|
952
|
+
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(me);
|
|
953
953
|
return n`
|
|
954
954
|
${j(this, e, {
|
|
955
955
|
title: n`${t ? `${k(t)} ` : ""}${k(this.sport)} standings`,
|
|
@@ -959,8 +959,8 @@ class ht extends w {
|
|
|
959
959
|
// gender-scoped list would always look like one side.
|
|
960
960
|
teams: this.data.teams
|
|
961
961
|
})}
|
|
962
|
-
${
|
|
963
|
-
${
|
|
962
|
+
${D(this, n`
|
|
963
|
+
${F(this)}
|
|
964
964
|
<div class="toolbar">
|
|
965
965
|
${s.length === 2 ? n`
|
|
966
966
|
<div role="group" aria-label="Boys or girls standings">
|
|
@@ -990,7 +990,7 @@ class ht extends w {
|
|
|
990
990
|
renderConference(e, t) {
|
|
991
991
|
const s = e.teams.filter((i) => i.conferenceId === t.id);
|
|
992
992
|
if (!s.length) return p;
|
|
993
|
-
const r = this.query.trim().toLowerCase(), o =
|
|
993
|
+
const r = this.query.trim().toLowerCase(), o = ve(s, e.records);
|
|
994
994
|
return n`
|
|
995
995
|
<div class="card">
|
|
996
996
|
<div class="card-head">
|
|
@@ -1005,7 +1005,7 @@ class ht extends w {
|
|
|
1005
1005
|
<th>Streak</th><th>Last 5</th><th>Next</th>
|
|
1006
1006
|
</tr></thead>
|
|
1007
1007
|
<tbody>
|
|
1008
|
-
${o.map((i,
|
|
1008
|
+
${o.map((i, c) => this.renderRow(e, i, c, r))}
|
|
1009
1009
|
</tbody>
|
|
1010
1010
|
</table></div>
|
|
1011
1011
|
</div>
|
|
@@ -1014,34 +1014,34 @@ class ht extends w {
|
|
|
1014
1014
|
renderRow(e, t, s, r) {
|
|
1015
1015
|
const o = e.schoolsById[t.team.schoolId], i = o?.name || t.team.name || "TBD";
|
|
1016
1016
|
if (r && !i.toLowerCase().includes(r)) return p;
|
|
1017
|
-
const
|
|
1018
|
-
location.href =
|
|
1017
|
+
const c = t.rec.pf - t.rec.pa, h = Q(this.data.games, t.team.id), m = () => {
|
|
1018
|
+
location.href = v(e.hrefs.school, { id: t.team.schoolId });
|
|
1019
1019
|
};
|
|
1020
1020
|
return n`
|
|
1021
|
-
<tr class="rowlink" @click=${(
|
|
1022
|
-
|
|
1021
|
+
<tr class="rowlink" @click=${(d) => {
|
|
1022
|
+
d.target.closest("a") || m();
|
|
1023
1023
|
}}>
|
|
1024
1024
|
<td class="mut">${s + 1}</td>
|
|
1025
1025
|
<td class="teamcell">
|
|
1026
|
-
${
|
|
1027
|
-
<a href=${
|
|
1026
|
+
${B(o)}${X(e, t.team.id, null)}
|
|
1027
|
+
<a href=${v(e.hrefs.school, { id: t.team.schoolId })}>${i}</a>
|
|
1028
1028
|
</td>
|
|
1029
|
-
<td class="num">${
|
|
1030
|
-
<td class="num">${
|
|
1031
|
-
<td class="num">${
|
|
1032
|
-
<td class="num">${
|
|
1029
|
+
<td class="num">${S(t.rec, !0)}</td>
|
|
1030
|
+
<td class="num">${re(t.confPct)}</td>
|
|
1031
|
+
<td class="num">${S(t.rec)}</td>
|
|
1032
|
+
<td class="num">${re(t.overallPct)}</td>
|
|
1033
1033
|
<td class="num">${t.rec.pf}</td>
|
|
1034
1034
|
<td class="num">${t.rec.pa}</td>
|
|
1035
|
-
<td class="num" style="color:${
|
|
1035
|
+
<td class="num" style="color:${c >= 0 ? "var(--hsot-win)" : "var(--hsot-loss)"}">${c > 0 ? "+" : ""}${c}</td>
|
|
1036
1036
|
<td>${U(t.rec.results) || "·"}</td>
|
|
1037
1037
|
<td>${J(e, t.team.id)}</td>
|
|
1038
|
-
<td>${
|
|
1038
|
+
<td>${ye(e, h, t.team.id)}</td>
|
|
1039
1039
|
</tr>
|
|
1040
1040
|
`;
|
|
1041
1041
|
}
|
|
1042
1042
|
}
|
|
1043
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings",
|
|
1044
|
-
const
|
|
1043
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings", mt);
|
|
1044
|
+
const pt = $`
|
|
1045
1045
|
.hero1 {
|
|
1046
1046
|
border-radius: var(--hsot-radius-md); color: var(--hsot-white);
|
|
1047
1047
|
padding: 1.3rem 1.4rem; display: flex; align-items: center; gap: 1.2rem;
|
|
@@ -1058,8 +1058,8 @@ const mt = $`
|
|
|
1058
1058
|
.delta.new { background: var(--hsot-straw); color: #6b5900; border-radius: var(--hsot-radius-xs); padding: 0.1rem 0.3rem; font-size: 0.7rem; }
|
|
1059
1059
|
.sparkline { vertical-align: middle; }
|
|
1060
1060
|
`;
|
|
1061
|
-
class
|
|
1062
|
-
static styles = [...
|
|
1061
|
+
class ft extends w {
|
|
1062
|
+
static styles = [...P, pt];
|
|
1063
1063
|
static properties = {
|
|
1064
1064
|
...w.properties,
|
|
1065
1065
|
sport: { type: String },
|
|
@@ -1076,73 +1076,73 @@ class pt extends w {
|
|
|
1076
1076
|
e && (this.pollDate = e);
|
|
1077
1077
|
}
|
|
1078
1078
|
async fetchData(e) {
|
|
1079
|
-
const t = this.season ||
|
|
1079
|
+
const t = this.season || R(), [s, r, o, i, c] = await Promise.all([
|
|
1080
1080
|
e.listRankings({ sport: this.sport, ...this.gender ? { gender: this.gender } : {} }),
|
|
1081
1081
|
e.listSchools(),
|
|
1082
1082
|
e.listTeams({ sport: this.sport }),
|
|
1083
1083
|
e.listConferences(),
|
|
1084
1084
|
e.listGames({ sport: this.sport, season: t })
|
|
1085
|
-
]),
|
|
1085
|
+
]), h = s.items.filter((m) => !this.gender || !m.gender || m.gender === this.gender).sort((m, d) => d.effectiveDate.localeCompare(m.effectiveDate));
|
|
1086
1086
|
return {
|
|
1087
1087
|
season: t,
|
|
1088
|
-
polls:
|
|
1088
|
+
polls: h,
|
|
1089
1089
|
schools: r.items,
|
|
1090
1090
|
teams: o.items,
|
|
1091
1091
|
conferences: i.items,
|
|
1092
|
-
games:
|
|
1092
|
+
games: c.items
|
|
1093
1093
|
};
|
|
1094
1094
|
}
|
|
1095
1095
|
get ctx() {
|
|
1096
1096
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
1097
1097
|
teamsById: y(this.data.teams),
|
|
1098
1098
|
schoolsById: y(this.data.schools),
|
|
1099
|
-
records:
|
|
1099
|
+
records: N(this.data.games),
|
|
1100
1100
|
rankings: this.data.polls,
|
|
1101
|
-
hrefs:
|
|
1101
|
+
hrefs: A(this),
|
|
1102
1102
|
sport: this.sport
|
|
1103
1103
|
}, this._ctxData = this.data), this._ctx;
|
|
1104
1104
|
}
|
|
1105
1105
|
sparkline(e, t, s) {
|
|
1106
|
-
const
|
|
1107
|
-
const u = (
|
|
1106
|
+
const c = t.map((l, f) => {
|
|
1107
|
+
const u = (l.teamIds || []).indexOf(e);
|
|
1108
1108
|
if (u === -1) return null;
|
|
1109
|
-
const
|
|
1110
|
-
return { x:
|
|
1111
|
-
}),
|
|
1109
|
+
const g = t.length === 1 ? 96 / 2 : f / (t.length - 1) * 90 + 3, b = 3 + u / 24 * 20;
|
|
1110
|
+
return { x: g, y: b };
|
|
1111
|
+
}), h = [];
|
|
1112
1112
|
let m = [];
|
|
1113
|
-
if (
|
|
1114
|
-
|
|
1115
|
-
}), m.length &&
|
|
1116
|
-
const
|
|
1113
|
+
if (c.forEach((l) => {
|
|
1114
|
+
l ? m.push(l) : m.length && (h.push(m), m = []);
|
|
1115
|
+
}), m.length && h.push(m), !h.length) return p;
|
|
1116
|
+
const d = c[s];
|
|
1117
1117
|
return n`<svg class="sparkline" width=${96} height=${26} viewBox="0 0 ${96} ${26}" role="img" aria-label="rank history">
|
|
1118
|
-
${
|
|
1119
|
-
points=${
|
|
1120
|
-
${
|
|
1118
|
+
${h.map((l) => se`<polyline fill="none" stroke="var(--hsot-red)" stroke-width="2"
|
|
1119
|
+
points=${l.map((f) => `${f.x.toFixed(1)},${f.y.toFixed(1)}`).join(" ")}></polyline>`)}
|
|
1120
|
+
${d ? se`<circle cx=${d.x.toFixed(1)} cy=${d.y.toFixed(1)} r="3" fill="var(--hsot-black)"></circle>` : p}
|
|
1121
1121
|
</svg>`;
|
|
1122
1122
|
}
|
|
1123
1123
|
movement(e, t, s) {
|
|
1124
|
-
const r =
|
|
1124
|
+
const r = Ye(e, t, s);
|
|
1125
1125
|
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>`;
|
|
1126
1126
|
}
|
|
1127
1127
|
renderView() {
|
|
1128
1128
|
const e = this.ctx, t = this.data.polls;
|
|
1129
1129
|
if (!t.length) return n`<div class="view"><p class="empty">No ${this.sport} polls published yet this season.</p></div>`;
|
|
1130
|
-
const s = Math.max(0, t.findIndex((
|
|
1130
|
+
const s = Math.max(0, t.findIndex((l) => l.effectiveDate === this.pollDate)), r = t[s] || t[0], o = t[s + 1] || null, i = t.slice().reverse(), c = i.indexOf(r), h = y(this.data.conferences), m = (r.teamIds || [])[0], d = m ? C(e, m) : null;
|
|
1131
1131
|
return n`
|
|
1132
1132
|
${j(this, e, {
|
|
1133
1133
|
title: n`${k(this.sport)} Top 25`,
|
|
1134
1134
|
sub: n`The HighSchoolOT poll · updated weekly · ${t.length} polls this season`,
|
|
1135
1135
|
teams: this.data.teams
|
|
1136
1136
|
})}
|
|
1137
|
-
${
|
|
1138
|
-
${
|
|
1137
|
+
${D(this, n`
|
|
1138
|
+
${F(this)}
|
|
1139
1139
|
<div class="toolbar">
|
|
1140
1140
|
<label class="asof" for="pollsel">Poll of</label>
|
|
1141
|
-
<select id="pollsel" @change=${(
|
|
1142
|
-
this.pollDate =
|
|
1141
|
+
<select id="pollsel" @change=${(l) => {
|
|
1142
|
+
this.pollDate = l.target.value;
|
|
1143
1143
|
}}>
|
|
1144
|
-
${t.map((
|
|
1145
|
-
${x(
|
|
1144
|
+
${t.map((l, f) => n`<option value=${l.effectiveDate} ?selected=${l === r}>
|
|
1145
|
+
${x(l.effectiveDate, { month: "long", day: "numeric", year: "numeric" })}${f === 0 ? " · current" : ""}
|
|
1146
1146
|
</option>`)}
|
|
1147
1147
|
</select>
|
|
1148
1148
|
<button class="chip" ?disabled=${s >= t.length - 1}
|
|
@@ -1156,14 +1156,14 @@ class pt extends w {
|
|
|
1156
1156
|
<span class="spacer"></span>
|
|
1157
1157
|
<span class="asof">Movement vs. the previous poll · sparkline = season rank history</span>
|
|
1158
1158
|
</div>
|
|
1159
|
-
${
|
|
1159
|
+
${d ? this.renderHero(e, r, o, m, d, h) : p}
|
|
1160
1160
|
<div class="card"><div class="tablewrap"><table class="data">
|
|
1161
1161
|
<thead><tr>
|
|
1162
1162
|
<th class="num">Rk</th><th>Mvmt</th><th>Team</th><th class="num">Record</th>
|
|
1163
1163
|
<th>Conference</th><th>Last result</th><th>Next</th><th>Season</th>
|
|
1164
1164
|
</tr></thead>
|
|
1165
1165
|
<tbody>
|
|
1166
|
-
${(r.teamIds || []).map((
|
|
1166
|
+
${(r.teamIds || []).map((l, f) => f === 0 || !l ? p : this.renderRow(e, r, o, i, c, h, l, f + 1))}
|
|
1167
1167
|
</tbody>
|
|
1168
1168
|
</table></div></div>
|
|
1169
1169
|
<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>
|
|
@@ -1171,50 +1171,50 @@ class pt extends w {
|
|
|
1171
1171
|
`;
|
|
1172
1172
|
}
|
|
1173
1173
|
renderHero(e, t, s, r, o, i) {
|
|
1174
|
-
const
|
|
1174
|
+
const c = e.records[r], h = oe(e.records, r), m = i[e.teamsById[r]?.conferenceId], d = `linear-gradient(120deg, ${o.colorPrimary || "#030711"} 0%, var(--hsot-black) 85%)`;
|
|
1175
1175
|
return n`
|
|
1176
|
-
<div class="hero1" style="background:${
|
|
1176
|
+
<div class="hero1" style="background:${d}">
|
|
1177
1177
|
<div class="bigrank">#1</div>
|
|
1178
|
-
${
|
|
1178
|
+
${B(o, 64)}
|
|
1179
1179
|
<div>
|
|
1180
|
-
<h2><a href=${
|
|
1180
|
+
<h2><a href=${v(e.hrefs.school, { id: o.id })}>${o.name} ${o.mascot || ""}</a></h2>
|
|
1181
1181
|
<div class="facts">
|
|
1182
|
-
${
|
|
1183
|
-
· streak ${U(
|
|
1184
|
-
${
|
|
1182
|
+
${S(c)} overall${m ? n` · ${S(c, !0)} ${m.name}` : p}
|
|
1183
|
+
· streak ${U(c?.results) || "·"}
|
|
1184
|
+
${h ? n` · last: ${h.mark} ${h.my}-${h.their} vs ${L(e, h.opp)}` : p}
|
|
1185
1185
|
${this.movement(t, s, r)}
|
|
1186
1186
|
</div>
|
|
1187
1187
|
</div>
|
|
1188
1188
|
</div>
|
|
1189
1189
|
`;
|
|
1190
1190
|
}
|
|
1191
|
-
renderRow(e, t, s, r, o, i,
|
|
1192
|
-
const m =
|
|
1191
|
+
renderRow(e, t, s, r, o, i, c, h) {
|
|
1192
|
+
const m = C(e, c);
|
|
1193
1193
|
if (!m) return p;
|
|
1194
|
-
const
|
|
1195
|
-
location.href =
|
|
1194
|
+
const d = e.records[c], l = oe(e.records, c), f = Q(this.data.games, c), u = i[e.teamsById[c]?.conferenceId], g = () => {
|
|
1195
|
+
location.href = v(e.hrefs.school, { id: m.id });
|
|
1196
1196
|
};
|
|
1197
1197
|
return n`
|
|
1198
1198
|
<tr class="rowlink" @click=${(b) => {
|
|
1199
|
-
b.target.closest("a") ||
|
|
1199
|
+
b.target.closest("a") || g();
|
|
1200
1200
|
}}>
|
|
1201
|
-
<td class="num" style="font-weight:700">${
|
|
1202
|
-
<td>${this.movement(t, s,
|
|
1203
|
-
<td class="teamcell">${
|
|
1201
|
+
<td class="num" style="font-weight:700">${h}</td>
|
|
1202
|
+
<td>${this.movement(t, s, c)}</td>
|
|
1203
|
+
<td class="teamcell">${B(m)}<a href=${v(e.hrefs.school, { id: m.id })}>${m.name}</a>
|
|
1204
1204
|
<span class="mut" style="font-size:0.78rem">${m.mascot || ""}</span></td>
|
|
1205
|
-
<td class="num">${
|
|
1205
|
+
<td class="num">${S(d)}</td>
|
|
1206
1206
|
<td class="mut">${u?.name || "Independent"}</td>
|
|
1207
|
-
<td>${
|
|
1208
|
-
<b style="color:${
|
|
1209
|
-
${
|
|
1210
|
-
<td>${
|
|
1211
|
-
<td>${this.sparkline(
|
|
1207
|
+
<td>${l ? n`<a class="box" style="text-decoration:none" href=${v(e.hrefs.game, { sport: this.sport, id: l.gameId })}>
|
|
1208
|
+
<b style="color:${l.mark === "W" ? "var(--hsot-win)" : l.mark === "L" ? "var(--hsot-loss)" : "var(--hsot-tie)"}">${l.mark}</b>
|
|
1209
|
+
${l.my}-${l.their} vs ${L(e, l.opp)}</a>` : n`<span class="mut">·</span>`}</td>
|
|
1210
|
+
<td>${ye(e, f, c)}</td>
|
|
1211
|
+
<td>${this.sparkline(c, r, o)}</td>
|
|
1212
1212
|
</tr>
|
|
1213
1213
|
`;
|
|
1214
1214
|
}
|
|
1215
1215
|
}
|
|
1216
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings",
|
|
1217
|
-
const
|
|
1216
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings", ft);
|
|
1217
|
+
const ut = $`
|
|
1218
1218
|
.schoolhero { color: var(--hsot-white); padding: 1.6rem 1.25rem 1.3rem; }
|
|
1219
1219
|
.schoolhero .inner { max-width: 1366px; margin: 0 auto; display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
|
|
1220
1220
|
.schoolhero .crest {
|
|
@@ -1268,8 +1268,8 @@ const ft = $`
|
|
|
1268
1268
|
table.data.roster .sub { display: block; font-weight: 400; font-size: 0.78rem; color: var(--hsot-gray-5); }
|
|
1269
1269
|
}
|
|
1270
1270
|
`;
|
|
1271
|
-
class
|
|
1272
|
-
static styles = [...
|
|
1271
|
+
class gt extends w {
|
|
1272
|
+
static styles = [...P, ut];
|
|
1273
1273
|
static properties = {
|
|
1274
1274
|
...w.properties,
|
|
1275
1275
|
schoolId: { type: String, attribute: "school-id" },
|
|
@@ -1287,38 +1287,38 @@ class ut extends w {
|
|
|
1287
1287
|
t && !this.sport && (this.sport = t), s && !this.gender && (this.gender = s);
|
|
1288
1288
|
}
|
|
1289
1289
|
async fetchData(e) {
|
|
1290
|
-
const t = this.season ||
|
|
1291
|
-
|
|
1292
|
-
|
|
1290
|
+
const t = this.season || R(), s = await e.getSchool(this.schoolId), o = (await e.listTeams({ schoolId: this.schoolId })).items, i = this.sport || "football", c = o.find((b) => b.id === this.activeTeamId) || o.find((b) => b.sport === i && fe(b, this.gender)) || o.find((b) => b.sport === i) || o[0] || null, [h, m, d, l, f, u, g] = await Promise.all([
|
|
1291
|
+
c ? e.listGames({ sport: c.sport, season: t }) : Promise.resolve({ items: [] }),
|
|
1292
|
+
c ? e.listTeams({ sport: c.sport }) : Promise.resolve({ items: [] }),
|
|
1293
1293
|
e.listSchools(),
|
|
1294
1294
|
e.listConferences(),
|
|
1295
|
-
|
|
1296
|
-
|
|
1295
|
+
c ? e.listRankings({ sport: c.sport }) : Promise.resolve({ items: [] }),
|
|
1296
|
+
c ? e.listRosters({ teamId: c.id }) : Promise.resolve({ items: [] }),
|
|
1297
1297
|
// teamId is the public surface's one players filter (roster
|
|
1298
1298
|
// membership) — never fetch the whole collection.
|
|
1299
|
-
|
|
1299
|
+
c ? e.listPlayers({ teamId: c.id }) : Promise.resolve({ items: [] })
|
|
1300
1300
|
]);
|
|
1301
1301
|
return {
|
|
1302
1302
|
season: t,
|
|
1303
1303
|
school: s,
|
|
1304
1304
|
teams: o,
|
|
1305
|
-
active:
|
|
1306
|
-
games:
|
|
1305
|
+
active: c,
|
|
1306
|
+
games: h.items,
|
|
1307
1307
|
allTeams: m.items,
|
|
1308
|
-
schools:
|
|
1309
|
-
conferences:
|
|
1308
|
+
schools: d.items,
|
|
1309
|
+
conferences: l.items,
|
|
1310
1310
|
rankings: f.items,
|
|
1311
1311
|
roster: u.items.find((b) => b.season === t) || null,
|
|
1312
|
-
players:
|
|
1312
|
+
players: g.items
|
|
1313
1313
|
};
|
|
1314
1314
|
}
|
|
1315
1315
|
get ctx() {
|
|
1316
1316
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
1317
1317
|
teamsById: y(this.data.allTeams.length ? this.data.allTeams : this.data.teams),
|
|
1318
1318
|
schoolsById: y(this.data.schools),
|
|
1319
|
-
records:
|
|
1319
|
+
records: N(this.data.games),
|
|
1320
1320
|
rankings: this.data.rankings,
|
|
1321
|
-
hrefs:
|
|
1321
|
+
hrefs: A(this),
|
|
1322
1322
|
sport: this.data.active?.sport || "football"
|
|
1323
1323
|
}, this._ctxData = this.data), this._ctx;
|
|
1324
1324
|
}
|
|
@@ -1333,18 +1333,18 @@ class ut extends w {
|
|
|
1333
1333
|
renderView() {
|
|
1334
1334
|
const { school: e, teams: t, active: s, season: r } = this.data;
|
|
1335
1335
|
if (!e) return n`<div class="view"><p class="empty">School not found.</p></div>`;
|
|
1336
|
-
const o = this.ctx, i =
|
|
1336
|
+
const o = this.ctx, i = M(e.colorPrimary || "#030711"), c = (e.adm || [])[0], h = y(this.data.conferences), m = s ? h[s.conferenceId] : null;
|
|
1337
1337
|
return n`
|
|
1338
1338
|
<div class="schoolhero" style="background:linear-gradient(115deg, ${e.colorPrimary || "#030711"} 0%, ${e.colorPrimary || "#030711"} 55%, var(--hsot-black) 100%);color:${i}">
|
|
1339
1339
|
<div class="inner">
|
|
1340
|
-
${
|
|
1340
|
+
${G(e, 84) ? n`<img class="crest logo" alt="" loading="lazy" src=${G(e, 84)} />` : n`<div class="crest" style="background:${e.colorSecondary || "#7C7C7C"};color:${M(e.colorSecondary || "#7C7C7C")}">${K(e)}</div>`}
|
|
1341
1341
|
<div style="min-width:260px">
|
|
1342
1342
|
<h1>${e.name} <span class="mascot">${e.mascot || ""}</span></h1>
|
|
1343
1343
|
<div class="facts">
|
|
1344
1344
|
${e.location ? n`<span><b>Location</b>${e.location}${e.county ? n` · ${e.county} County` : p}</span>` : p}
|
|
1345
1345
|
${e.association ? n`<span><b>League</b>${e.association}${e.classification ? n` · ${e.classification}` : p}</span>` : p}
|
|
1346
1346
|
${m ? n`<span><b>Conference</b>${m.name}</span>` : p}
|
|
1347
|
-
${
|
|
1347
|
+
${c ? n`<span><b>Enrollment</b>${c.value.toLocaleString()} (${c.season} ADM)</span>` : p}
|
|
1348
1348
|
${e.openingYear ? n`<span><b>Opened</b>${e.openingYear}</span>` : p}
|
|
1349
1349
|
${e.areaCode ? n`<span><b>Area</b>${e.areaCode}</span>` : p}
|
|
1350
1350
|
</div>
|
|
@@ -1353,40 +1353,40 @@ class ut extends w {
|
|
|
1353
1353
|
</div>
|
|
1354
1354
|
<div class="band">
|
|
1355
1355
|
<nav class="tabs" aria-label="Teams">
|
|
1356
|
-
${t.map((
|
|
1357
|
-
|
|
1358
|
-
}}>${
|
|
1356
|
+
${t.map((d) => d.id === s?.id ? n`<a class="on" href="#" aria-current="page" @click=${(l) => l.preventDefault()}>${d.name}</a>` : n`<a href="#" @click=${(l) => {
|
|
1357
|
+
l.preventDefault(), this.switchTeam(d);
|
|
1358
|
+
}}>${d.name}</a>`)}
|
|
1359
1359
|
</nav>
|
|
1360
1360
|
</div>
|
|
1361
|
-
${
|
|
1362
|
-
${
|
|
1361
|
+
${D(this, n`
|
|
1362
|
+
${F(this)}
|
|
1363
1363
|
${s ? this.renderTeam(o, s, m, r) : n`<p class="empty">No teams recorded for this school yet.</p>`}
|
|
1364
1364
|
`)}
|
|
1365
1365
|
`;
|
|
1366
1366
|
}
|
|
1367
1367
|
renderTeam(e, t, s, r) {
|
|
1368
|
-
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,
|
|
1368
|
+
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, c = s ? ue(this.data.allTeams.filter((l) => l.conferenceId === s.id), t.gender) : [], h = s ? ve(c, e.records).findIndex((l) => l.team.id === t.id) + 1 : 0, m = Z(e.rankings, e.teamsById, t.id, t.sport, null), d = this.data.games.filter((l) => l.homeTeamId === t.id || l.awayTeamId === t.id).sort((l, f) => String(l.date).localeCompare(String(f.date)));
|
|
1369
1369
|
return n`
|
|
1370
1370
|
<div class="tiles">
|
|
1371
|
-
<div class="tile"><div class="k">Overall</div><div class="v">${
|
|
1372
|
-
<div class="tile"><div class="k">${s?.name || "Conference"}</div><div class="v">${
|
|
1373
|
-
<div class="s">${
|
|
1371
|
+
<div class="tile"><div class="k">Overall</div><div class="v">${S(o)}</div><div class="s">${i} games played</div></div>
|
|
1372
|
+
<div class="tile"><div class="k">${s?.name || "Conference"}</div><div class="v">${S(o, !0)}</div>
|
|
1373
|
+
<div class="s">${h ? `${Pe(h)} of ${c.length}` : "·"}</div></div>
|
|
1374
1374
|
<div class="tile"><div class="k">Points</div><div class="v">${i ? (o.pf / i).toFixed(1) : "0.0"}</div>
|
|
1375
1375
|
<div class="s">scored per game · ${i ? (o.pa / i).toFixed(1) : "0.0"} allowed</div></div>
|
|
1376
1376
|
<div class="tile"><div class="k">Streak</div><div class="v">${U(o.results) || "·"}</div>
|
|
1377
1377
|
<div class="s">last 5: ${J(e, t.id)}</div></div>
|
|
1378
1378
|
<div class="tile"><div class="k">HSOT Top 25</div><div class="v">${m ? `#${m}` : "NR"}</div>
|
|
1379
|
-
<div class="s"><a href=${
|
|
1379
|
+
<div class="s"><a href=${v(e.hrefs.section, { sport: t.sport, view: "rankings" })}>full poll</a></div></div>
|
|
1380
1380
|
</div>
|
|
1381
1381
|
${(t.championships || []).length ? n`
|
|
1382
1382
|
<div style="margin:-0.2rem 0 1rem;display:flex;gap:0.4rem;flex-wrap:wrap">
|
|
1383
|
-
${t.championships.map((
|
|
1383
|
+
${t.championships.map((l) => n`<span class="pill champ">★ ${l.season} ${l.title} champion${l.classification ? ` · ${l.classification}` : ""}${l.region ? ` · ${l.region}` : ""}</span>`)}
|
|
1384
1384
|
</div>` : p}
|
|
1385
1385
|
<div class="cols">
|
|
1386
1386
|
<div>
|
|
1387
1387
|
<div class="section-title">Schedule & results</div>
|
|
1388
1388
|
<div class="card">
|
|
1389
|
-
${
|
|
1389
|
+
${d.length ? n`<ul class="gamelist">${d.map((l) => this.renderGameRow(e, t, l))}</ul>` : n`<p class="empty">No ${t.sport} games recorded for ${r}.</p>`}
|
|
1390
1390
|
</div>
|
|
1391
1391
|
</div>
|
|
1392
1392
|
<div>
|
|
@@ -1397,24 +1397,24 @@ class ut extends w {
|
|
|
1397
1397
|
`;
|
|
1398
1398
|
}
|
|
1399
1399
|
renderGameRow(e, t, s) {
|
|
1400
|
-
const r = s.homeTeamId === t.id, o = r ? s.awayTeamId : s.homeTeamId, i = r ? s.homeScore : s.awayScore,
|
|
1401
|
-
let
|
|
1400
|
+
const r = s.homeTeamId === t.id, o = r ? s.awayTeamId : s.homeTeamId, i = r ? s.homeScore : s.awayScore, c = r ? s.awayScore : s.homeScore;
|
|
1401
|
+
let h = n`<span class="mut">${V(s.time)}</span>`;
|
|
1402
1402
|
if (s.state === "final") {
|
|
1403
|
-
const
|
|
1404
|
-
|
|
1405
|
-
} else s.state === "live" && (
|
|
1403
|
+
const d = H(s), l = d === "tie" ? "T" : d === (r ? "home" : "away") ? "W" : "L";
|
|
1404
|
+
h = n`<span class=${l}>${l}</span> ${i}-${c}${s.finish === "overtime" ? n` <span class="mut">OT</span>` : p}${s.forfeit && s.forfeit !== "none" ? n` <span class="mut">FF</span>` : p}`;
|
|
1405
|
+
} else s.state === "live" && (h = n`<span style="color:var(--hsot-red)">${i}-${c}</span>`);
|
|
1406
1406
|
const m = s.gameType === "conference" ? "Conf" : s.gameType === "nonconference" ? "Non-conf" : s.gameType === "playoff" ? `Playoff${s.label ? ` · ${s.label}` : ""}` : "Scrimmage";
|
|
1407
1407
|
return n`
|
|
1408
1408
|
<li>
|
|
1409
1409
|
<span class="d">${x(s.date)}</span>
|
|
1410
|
-
${
|
|
1411
|
-
<span class="res">${
|
|
1410
|
+
${pe(s).kind === "sched" ? p : _(s)}
|
|
1411
|
+
<span class="res">${h}</span>
|
|
1412
1412
|
<span class="opp">${r ? "vs" : "at"} ${O(e, o, s.date)}
|
|
1413
1413
|
<span class="pill type">${m}</span>
|
|
1414
1414
|
${s.broadcast ? n`<span class="pill class">${s.broadcast}</span>` : p}
|
|
1415
1415
|
</span>
|
|
1416
1416
|
<span class="where">${s.venue || ""}</span>
|
|
1417
|
-
<a class="box" href=${
|
|
1417
|
+
<a class="box" href=${v(e.hrefs.game, { sport: t.sport, id: s.id })}>Box score →</a>
|
|
1418
1418
|
</li>
|
|
1419
1419
|
`;
|
|
1420
1420
|
}
|
|
@@ -1422,25 +1422,25 @@ class ut extends w {
|
|
|
1422
1422
|
const s = this.data.roster;
|
|
1423
1423
|
if (!s)
|
|
1424
1424
|
return n`<p class="empty">Roster not published for ${t}.</p>`;
|
|
1425
|
-
const r =
|
|
1425
|
+
const r = Qe(s, 560), o = this.data.school?.name || "", i = y(this.data.players), c = s.entries.slice().sort((m, d) => (m.number || 0) - (d.number || 0)), h = c.some((m) => i[m.playerId]?.college);
|
|
1426
1426
|
return n`
|
|
1427
1427
|
${r ? n`<img class="rosterphoto" src=${r} loading="lazy" decoding="async"
|
|
1428
1428
|
alt="${o} ${e.name} ${t} team photo" />` : p}
|
|
1429
1429
|
<div class="tablewrap"><table class="data roster">
|
|
1430
|
-
<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>${
|
|
1430
|
+
<thead><tr><th class="num">No.</th><th>Player</th><th class="pos">Pos</th><th class="cls">Class</th><th class="num">Ht</th><th class="num">Wt</th>${h ? n`<th>College</th>` : p}</tr></thead>
|
|
1431
1431
|
<tbody>
|
|
1432
|
-
${
|
|
1433
|
-
const
|
|
1434
|
-
if (!
|
|
1435
|
-
const
|
|
1432
|
+
${c.map((m) => {
|
|
1433
|
+
const d = i[m.playerId];
|
|
1434
|
+
if (!d) return p;
|
|
1435
|
+
const l = ze(m), f = [l, d.classOf].filter(Boolean).join(" · ") || "·";
|
|
1436
1436
|
return n`<tr>
|
|
1437
1437
|
<td class="num mut">${m.number ?? "·"}</td>
|
|
1438
|
-
<td class="player" style="font-weight:500">${
|
|
1439
|
-
<td class="pos">${
|
|
1440
|
-
<td class="cls mut">${
|
|
1441
|
-
<td class="num">${
|
|
1442
|
-
<td class="num">${
|
|
1443
|
-
${
|
|
1438
|
+
<td class="player" style="font-weight:500">${d.firstName} ${d.lastName}<span class="sub">${f}</span></td>
|
|
1439
|
+
<td class="pos">${l || "·"}</td>
|
|
1440
|
+
<td class="cls mut">${d.classOf || "·"}</td>
|
|
1441
|
+
<td class="num">${Fe(d.heightIn)}</td>
|
|
1442
|
+
<td class="num">${d.weightLb || "·"}</td>
|
|
1443
|
+
${h ? n`<td class="college">${d.college || "·"}</td>` : p}
|
|
1444
1444
|
</tr>`;
|
|
1445
1445
|
})}
|
|
1446
1446
|
</tbody>
|
|
@@ -1448,8 +1448,8 @@ class ut extends w {
|
|
|
1448
1448
|
`;
|
|
1449
1449
|
}
|
|
1450
1450
|
}
|
|
1451
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school",
|
|
1452
|
-
const
|
|
1451
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school", gt);
|
|
1452
|
+
const Se = {
|
|
1453
1453
|
football: ["quarters", 4],
|
|
1454
1454
|
flag_football: ["quarters", 4],
|
|
1455
1455
|
basketball: ["quarters", 4],
|
|
@@ -1460,49 +1460,72 @@ const ke = {
|
|
|
1460
1460
|
softball: ["innings", 7],
|
|
1461
1461
|
volleyball: ["sets", 3]
|
|
1462
1462
|
};
|
|
1463
|
-
function Ie(a) {
|
|
1464
|
-
return (ke[a] || ["quarters", 4])[0];
|
|
1465
|
-
}
|
|
1466
1463
|
function ee(a) {
|
|
1467
|
-
return (
|
|
1464
|
+
return (Se[a] || ["quarters", 4])[0];
|
|
1465
|
+
}
|
|
1466
|
+
function te(a) {
|
|
1467
|
+
return (Se[a] || ["quarters", 4])[1];
|
|
1468
1468
|
}
|
|
1469
|
-
function
|
|
1470
|
-
const t =
|
|
1469
|
+
function vt(a, e) {
|
|
1470
|
+
const t = ee(a), s = te(a);
|
|
1471
1471
|
if (e <= s || t === "innings" || t === "sets") return String(e);
|
|
1472
1472
|
const r = e - s;
|
|
1473
1473
|
return `OT${r > 1 ? r : ""}`;
|
|
1474
1474
|
}
|
|
1475
|
-
function
|
|
1475
|
+
function Ie(a, e) {
|
|
1476
1476
|
const t = String(a ?? "").trim();
|
|
1477
1477
|
let s;
|
|
1478
|
-
return (s = /^(\d+)Q$/i.exec(t)) || (s = /^(\d+)H$/i.exec(t)) ? Number(s[1]) : /^half$/i.test(t) ?
|
|
1478
|
+
return (s = /^(\d+)Q$/i.exec(t)) || (s = /^(\d+)H$/i.exec(t)) ? Number(s[1]) : /^half$/i.test(t) ? ee(e) === "halves" ? 1 : 2 : (s = /^(\d*)OT(\d*)$/i.exec(t)) ? te(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;
|
|
1479
1479
|
}
|
|
1480
|
-
const
|
|
1480
|
+
const T = (a) => Number.isInteger(a) && a >= 0 ? a : null;
|
|
1481
1481
|
function bt(a) {
|
|
1482
1482
|
const e = Array.isArray(a?.scoringPlays) ? a.scoringPlays : [];
|
|
1483
1483
|
if (!e.length) return null;
|
|
1484
|
-
const t = a.sport
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1484
|
+
const t = a.sport;
|
|
1485
|
+
if (ee(t) === "sets") return yt(a, e);
|
|
1486
|
+
const s = /* @__PURE__ */ new Map();
|
|
1487
|
+
for (const l of e) {
|
|
1488
|
+
const f = Ie(l?.period, t), u = T(l?.homeScore), g = T(l?.awayScore);
|
|
1489
|
+
if (!f || u === null || g === null) return null;
|
|
1488
1490
|
const b = s.get(f) || { home: 0, away: 0 };
|
|
1489
|
-
b.home = Math.max(b.home, u), b.away = Math.max(b.away,
|
|
1491
|
+
b.home = Math.max(b.home, u), b.away = Math.max(b.away, g), s.set(f, b);
|
|
1490
1492
|
}
|
|
1491
1493
|
const r = Math.max(...s.keys()), o = [];
|
|
1492
|
-
let i = !0,
|
|
1493
|
-
for (let
|
|
1494
|
-
const f = s.get(
|
|
1495
|
-
(u < 0 ||
|
|
1494
|
+
let i = !0, c = { home: 0, away: 0 };
|
|
1495
|
+
for (let l = 1; l <= r; l += 1) {
|
|
1496
|
+
const f = s.get(l) || c, u = f.home - c.home, g = f.away - c.away;
|
|
1497
|
+
(u < 0 || g < 0) && (i = !1), o.push({ period: l, home: Math.max(u, 0), away: Math.max(g, 0) }), c = { home: Math.max(f.home, c.home), away: Math.max(f.away, c.away) };
|
|
1496
1498
|
}
|
|
1497
|
-
const
|
|
1498
|
-
return i = i &&
|
|
1499
|
+
const h = T(a.homeScore) ?? 0, m = T(a.awayScore) ?? 0, d = i && c.home === h && c.away === m;
|
|
1500
|
+
return i = i && c.home <= h && c.away <= m, { periods: o, reconciled: d, consistent: i };
|
|
1499
1501
|
}
|
|
1500
|
-
function yt(a) {
|
|
1502
|
+
function yt(a, e) {
|
|
1503
|
+
const t = /* @__PURE__ */ new Map();
|
|
1504
|
+
for (const d of e) {
|
|
1505
|
+
const l = Ie(d?.period, a.sport), f = T(d?.homeScore), u = T(d?.awayScore);
|
|
1506
|
+
if (!l || f === null || u === null) return null;
|
|
1507
|
+
const g = t.get(l) || { home: 0, away: 0 };
|
|
1508
|
+
t.set(l, { home: Math.max(g.home, f), away: Math.max(g.away, u) });
|
|
1509
|
+
}
|
|
1510
|
+
const s = Math.max(...t.keys()), r = Array.from({ length: s }, (d, l) => ({ period: l + 1, ...t.get(l + 1) || { home: 0, away: 0 } })), o = (d) => ({
|
|
1511
|
+
home: d.filter((l) => l.home > l.away).length,
|
|
1512
|
+
away: d.filter((l) => l.away > l.home).length
|
|
1513
|
+
}), i = T(a.homeScore) ?? 0, c = T(a.awayScore) ?? 0, h = o(r), m = o(r.slice(0, -1));
|
|
1514
|
+
return {
|
|
1515
|
+
periods: r,
|
|
1516
|
+
reconciled: h.home === i && h.away === c,
|
|
1517
|
+
consistent: m.home <= i && m.away <= c
|
|
1518
|
+
};
|
|
1519
|
+
}
|
|
1520
|
+
function $t(a) {
|
|
1521
|
+
return (Array.isArray(a?.scoringPlays) ? a.scoringPlays : []).some((t) => String(t?.description ?? "").trim() !== "");
|
|
1522
|
+
}
|
|
1523
|
+
function wt(a) {
|
|
1501
1524
|
if (Array.isArray(a?.periodScores) && a.periodScores.length) return a.periodScores;
|
|
1502
1525
|
const e = bt(a);
|
|
1503
1526
|
return e ? a.state === "final" ? e.reconciled ? e.periods : null : e.consistent ? e.periods : null : null;
|
|
1504
1527
|
}
|
|
1505
|
-
const
|
|
1528
|
+
const xt = $`
|
|
1506
1529
|
.breadcrumbs { font-size: 0.8125rem; margin: 0.9rem 0 0; color: var(--hsot-gray-5); }
|
|
1507
1530
|
.breadcrumbs a { text-decoration: none; }
|
|
1508
1531
|
.scorehead { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center; padding: 1.4rem 1rem; }
|
|
@@ -1558,8 +1581,8 @@ const $t = $`
|
|
|
1558
1581
|
.cols { grid-template-columns: 1fr; }
|
|
1559
1582
|
}
|
|
1560
1583
|
`;
|
|
1561
|
-
class
|
|
1562
|
-
static styles = [...
|
|
1584
|
+
class kt extends w {
|
|
1585
|
+
static styles = [...P, xt];
|
|
1563
1586
|
static properties = {
|
|
1564
1587
|
...w.properties,
|
|
1565
1588
|
gameId: { type: String, attribute: "game-id" },
|
|
@@ -1579,7 +1602,7 @@ class wt extends w {
|
|
|
1579
1602
|
super(), this.gameId = "", this.searchApi = "", this.embed = !1;
|
|
1580
1603
|
}
|
|
1581
1604
|
async fetchData(e) {
|
|
1582
|
-
const t = await e.getGame(this.gameId), s = Array.isArray(t.coverageUrls) ? t.coverageUrls : [], [r, o, i,
|
|
1605
|
+
const t = await e.getGame(this.gameId), s = Array.isArray(t.coverageUrls) ? t.coverageUrls : [], [r, o, i, c, h, m] = await Promise.all([
|
|
1583
1606
|
e.listSchools(),
|
|
1584
1607
|
e.listTeams({ sport: t.sport }),
|
|
1585
1608
|
e.listConferences(),
|
|
@@ -1589,15 +1612,15 @@ class wt extends w {
|
|
|
1589
1612
|
// links (fetchCoverage already degrades per-URL index misses).
|
|
1590
1613
|
// The embed drops the Coverage grid, so it skips the search
|
|
1591
1614
|
// round-trip entirely rather than fetching cards it will not render.
|
|
1592
|
-
s.length && !this.embed ?
|
|
1615
|
+
s.length && !this.embed ? et(this.searchApi, s).catch(() => s.map($e)) : Promise.resolve([])
|
|
1593
1616
|
]);
|
|
1594
1617
|
return {
|
|
1595
1618
|
game: t,
|
|
1596
1619
|
schools: r.items,
|
|
1597
1620
|
teams: o.items,
|
|
1598
1621
|
conferences: i.items,
|
|
1599
|
-
rankings:
|
|
1600
|
-
games:
|
|
1622
|
+
rankings: c.items,
|
|
1623
|
+
games: h.items,
|
|
1601
1624
|
coverage: m
|
|
1602
1625
|
};
|
|
1603
1626
|
}
|
|
@@ -1605,45 +1628,45 @@ class wt extends w {
|
|
|
1605
1628
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
1606
1629
|
teamsById: y(this.data.teams),
|
|
1607
1630
|
schoolsById: y(this.data.schools),
|
|
1608
|
-
records:
|
|
1631
|
+
records: N(this.data.games),
|
|
1609
1632
|
rankings: this.data.rankings,
|
|
1610
|
-
hrefs:
|
|
1633
|
+
hrefs: A(this),
|
|
1611
1634
|
sport: this.data.game.sport
|
|
1612
1635
|
}, this._ctxData = this.data), this._ctx;
|
|
1613
1636
|
}
|
|
1614
1637
|
renderView() {
|
|
1615
1638
|
const e = this.data.game;
|
|
1616
1639
|
if (!e) return n`<div class="view"><p class="empty">Game not found.</p></div>`;
|
|
1617
|
-
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),
|
|
1640
|
+
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), c = (d) => e.state === "final" && i !== d && i !== "tie" ? "opacity:0.45" : "", h = e.conferenceId ? s[e.conferenceId] : null, m = this.data.games.filter((d) => d.id !== e.id && d.state === "final" && d.gameType !== "scrimmage" && (d.homeTeamId === e.homeTeamId && d.awayTeamId === e.awayTeamId || d.homeTeamId === e.awayTeamId && d.awayTeamId === e.homeTeamId));
|
|
1618
1641
|
return n`
|
|
1619
|
-
${
|
|
1620
|
-
${
|
|
1642
|
+
${D(this, n`
|
|
1643
|
+
${F(this)}
|
|
1621
1644
|
${this.embed ? p : n`
|
|
1622
1645
|
<p class="breadcrumbs">
|
|
1623
|
-
<a href=${
|
|
1624
|
-
<a href=${
|
|
1625
|
-
${
|
|
1646
|
+
<a href=${v(t.hrefs.section, { sport: e.sport, view: "scores" })}>${k(e.sport)}</a> /
|
|
1647
|
+
<a href=${v(t.hrefs.section, { sport: e.sport, view: "scores" })}>Scores/Schedules</a> /
|
|
1648
|
+
${z(t, e.awayTeamId)} at ${z(t, e.homeTeamId)}
|
|
1626
1649
|
</p>`}
|
|
1627
1650
|
<div class="card">
|
|
1628
1651
|
<div class="scorehead">
|
|
1629
1652
|
${this.teamBlock(t, e, e.awayTeamId, r, !1)}
|
|
1630
1653
|
<div class="mid">
|
|
1631
1654
|
<div class="bigscore">
|
|
1632
|
-
<span style=${
|
|
1655
|
+
<span style=${c("away")}>${e.awayScore}</span>
|
|
1633
1656
|
<span class="mut" style="font-size:1.6rem">–</span>
|
|
1634
|
-
<span style=${
|
|
1657
|
+
<span style=${c("home")}>${e.homeScore}</span>
|
|
1635
1658
|
</div>
|
|
1636
|
-
<div class="status">${
|
|
1659
|
+
<div class="status">${_(e)}</div>
|
|
1637
1660
|
<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"}
|
|
1638
1661
|
${e.broadcast ? n` · <span class="pill class">${e.broadcast}</span>` : p}</div>
|
|
1639
1662
|
<div class="status">
|
|
1640
|
-
<span class="pill type">${e.gameType === "conference" ? `${
|
|
1663
|
+
<span class="pill type">${e.gameType === "conference" ? `${h?.name || "Conference"} game` : e.gameType}</span>
|
|
1641
1664
|
${e.label ? n`<span class="pill type">Bracket ${e.label}</span>` : p}
|
|
1642
|
-
${(e.tags || []).map((
|
|
1665
|
+
${(e.tags || []).map((d) => n`<span class="pill type">${d}</span>`)}
|
|
1643
1666
|
</div>
|
|
1644
1667
|
${this.embed ? p : n`
|
|
1645
1668
|
<div class="status">
|
|
1646
|
-
<a href=${
|
|
1669
|
+
<a href=${he(t.hrefs, e.id)}>Report a score for this game</a>
|
|
1647
1670
|
</div>`}
|
|
1648
1671
|
</div>
|
|
1649
1672
|
${this.teamBlock(t, e, e.homeTeamId, o, !0)}
|
|
@@ -1654,19 +1677,19 @@ class wt extends w {
|
|
|
1654
1677
|
</div>
|
|
1655
1678
|
${this.embed ? n`
|
|
1656
1679
|
<p class="fullbox">
|
|
1657
|
-
<a href=${
|
|
1680
|
+
<a href=${v(t.hrefs.game, { sport: e.sport, id: e.id })}>Full box score →</a>
|
|
1658
1681
|
</p>` : n`
|
|
1659
1682
|
${(this.data.coverage || []).length ? n`
|
|
1660
1683
|
<div class="section-title">Coverage</div>
|
|
1661
1684
|
<div class="covgrid">
|
|
1662
|
-
${this.data.coverage.map((
|
|
1663
|
-
<a class="card covcard" href=${
|
|
1664
|
-
${
|
|
1685
|
+
${this.data.coverage.map((d) => n`
|
|
1686
|
+
<a class="card covcard" href=${d.uri}>
|
|
1687
|
+
${d.image ? n`<img class="covimg" src=${d.image} alt="" loading="lazy" />` : p}
|
|
1665
1688
|
<div class="covbody">
|
|
1666
|
-
<div class="covtitle">${
|
|
1667
|
-
${
|
|
1668
|
-
${
|
|
1669
|
-
<div class="covmeta">${[
|
|
1689
|
+
<div class="covtitle">${d.videoDuration ? n`<span class="pill live" style="animation:none">Video</span> ` : p}${d.photos ? n`<span class="pill live" style="animation:none">Photos</span> ` : p}${d.title || d.uri}</div>
|
|
1690
|
+
${d.description ? n`<p class="covdesc">${d.description}</p>` : p}
|
|
1691
|
+
${d.author || d.publishedTime ? n`
|
|
1692
|
+
<div class="covmeta">${[d.author, d.publishedTime ? new Date(d.publishedTime).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" }) : ""].filter(Boolean).join(" · ")}</div>
|
|
1670
1693
|
` : p}
|
|
1671
1694
|
</div>
|
|
1672
1695
|
</a>
|
|
@@ -1674,15 +1697,15 @@ class wt extends w {
|
|
|
1674
1697
|
</div>` : p}
|
|
1675
1698
|
<div class="section-title">Season context</div>
|
|
1676
1699
|
<div class="cols">
|
|
1677
|
-
${[[e.awayTeamId, r], [e.homeTeamId, o]].map(([
|
|
1700
|
+
${[[e.awayTeamId, r], [e.homeTeamId, o]].map(([d, l]) => this.renderContext(t, d, l))}
|
|
1678
1701
|
</div>
|
|
1679
1702
|
${m.length ? n`
|
|
1680
1703
|
<div class="section-title">Head to head this season</div>
|
|
1681
1704
|
<div class="card"><ul class="gamelist">
|
|
1682
|
-
${m.map((
|
|
1683
|
-
<span class="d">${x(
|
|
1684
|
-
<span class="opp">${
|
|
1685
|
-
<a class="box" href=${
|
|
1705
|
+
${m.map((d) => n`<li>
|
|
1706
|
+
<span class="d">${x(d.date)}</span>${_(d)}
|
|
1707
|
+
<span class="opp">${z(t, d.awayTeamId)} ${d.awayScore}, ${z(t, d.homeTeamId)} ${d.homeScore}</span>
|
|
1708
|
+
<a class="box" href=${v(t.hrefs.game, { sport: e.sport, id: d.id })}>Box score →</a>
|
|
1686
1709
|
</li>`)}
|
|
1687
1710
|
</ul></div>` : p}`}
|
|
1688
1711
|
`)}
|
|
@@ -1690,46 +1713,45 @@ class wt extends w {
|
|
|
1690
1713
|
}
|
|
1691
1714
|
teamBlock(e, t, s, r, o) {
|
|
1692
1715
|
if (!r) return n`<div class="teamblock ${o ? "right" : ""}"><div class="tname">TBD</div></div>`;
|
|
1693
|
-
const i = e.teamsById[s],
|
|
1716
|
+
const i = e.teamsById[s], c = e.records[s], h = G(r, 58);
|
|
1694
1717
|
return n`
|
|
1695
1718
|
<div class="teamblock ${o ? "right" : ""}">
|
|
1696
|
-
${
|
|
1719
|
+
${h ? n`<img class="crest logo" alt="" loading="lazy" src=${h} />` : n`<span class="crest" style="background:${r.colorPrimary || "#030711"};color:${M(r.colorPrimary || "#030711")}">${K(r)}</span>`}
|
|
1697
1720
|
<div>
|
|
1698
|
-
<div class="tname">${X(e, s, t.date)}<a href=${
|
|
1699
|
-
<div class="trec">${r.mascot || ""} · ${
|
|
1721
|
+
<div class="tname">${X(e, s, t.date)}<a href=${v(e.hrefs.school, { id: r.id })}>${r.name}</a></div>
|
|
1722
|
+
<div class="trec">${r.mascot || ""} · ${S(c)}${i?.conferenceId ? n` · ${S(c, !0)} conf` : p}</div>
|
|
1700
1723
|
</div>
|
|
1701
1724
|
</div>
|
|
1702
1725
|
`;
|
|
1703
1726
|
}
|
|
1704
1727
|
renderLineScore(e, t, s) {
|
|
1705
|
-
const r =
|
|
1728
|
+
const r = wt(e);
|
|
1706
1729
|
if (!r)
|
|
1707
1730
|
return e.state === "scheduled" ? n`<p class="empty" style="text-align:center">Period scoring will appear once the game starts.</p>` : p;
|
|
1708
|
-
const o = Math.max(
|
|
1709
|
-
const
|
|
1710
|
-
return
|
|
1711
|
-
},
|
|
1731
|
+
const o = Math.max(te(e.sport), ...r.map((m) => m.period)), i = (m) => vt(e.sport, m), c = (m, d) => {
|
|
1732
|
+
const l = r.find((f) => f.period === d);
|
|
1733
|
+
return l ? l[m] : e.state === "final" ? 0 : "·";
|
|
1734
|
+
}, h = (m, d, l) => n`
|
|
1712
1735
|
<tr>
|
|
1713
|
-
<td class="teamcell">${
|
|
1714
|
-
${Array.from({ length: o }, (f, u) => n`<td class="num">${
|
|
1715
|
-
<td class="num" style="font-weight:700">${
|
|
1736
|
+
<td class="teamcell">${B(m, 20)}${m?.abbr || "TBD"}</td>
|
|
1737
|
+
${Array.from({ length: o }, (f, u) => n`<td class="num">${c(d, u + 1)}</td>`)}
|
|
1738
|
+
<td class="num" style="font-weight:700">${l}</td>
|
|
1716
1739
|
</tr>`;
|
|
1717
1740
|
return n`
|
|
1718
1741
|
<div class="tablewrap" style="border-top:1px solid var(--hsot-gray-2)">
|
|
1719
1742
|
<table class="data" style="max-width:560px;margin:0.6rem auto 0.9rem">
|
|
1720
|
-
<thead><tr><th>Team</th>${Array.from({ length: o }, (m,
|
|
1743
|
+
<thead><tr><th>Team</th>${Array.from({ length: o }, (m, d) => n`<th class="num">${i(d + 1)}</th>`)}<th class="num">T</th></tr></thead>
|
|
1721
1744
|
<tbody>
|
|
1722
|
-
${
|
|
1723
|
-
${
|
|
1745
|
+
${h(t, "away", e.awayScore)}
|
|
1746
|
+
${h(s, "home", e.homeScore)}
|
|
1724
1747
|
</tbody>
|
|
1725
1748
|
</table>
|
|
1726
1749
|
</div>
|
|
1727
1750
|
`;
|
|
1728
1751
|
}
|
|
1729
1752
|
renderScoringPlays(e, t, s) {
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
const o = (i) => [i.period, i.clock].filter(Boolean).join(" ");
|
|
1753
|
+
if (!$t(e)) return p;
|
|
1754
|
+
const r = e.scoringPlays, o = (i) => [i.period, i.clock].filter(Boolean).join(" ");
|
|
1733
1755
|
return n`
|
|
1734
1756
|
<div class="plays">
|
|
1735
1757
|
<div class="plays-title">Scoring plays</div>
|
|
@@ -1757,7 +1779,7 @@ class wt extends w {
|
|
|
1757
1779
|
const r = e.records[t], o = Q(this.data.games, t);
|
|
1758
1780
|
return n`
|
|
1759
1781
|
<div class="card ctxcard">
|
|
1760
|
-
<div class="who">${
|
|
1782
|
+
<div class="who">${B(s)}${s.name}</div>
|
|
1761
1783
|
<div class="row">
|
|
1762
1784
|
<span>Last 5: ${J(e, t)}</span>
|
|
1763
1785
|
<span>Streak: <b>${r ? U(r.results) : "·"}</b></span>
|
|
@@ -1769,9 +1791,9 @@ class wt extends w {
|
|
|
1769
1791
|
`;
|
|
1770
1792
|
}
|
|
1771
1793
|
}
|
|
1772
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore",
|
|
1773
|
-
const
|
|
1774
|
-
class
|
|
1794
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore", kt);
|
|
1795
|
+
const St = 250, It = 2;
|
|
1796
|
+
class Tt extends de {
|
|
1775
1797
|
static properties = {
|
|
1776
1798
|
api: { type: String },
|
|
1777
1799
|
schoolHref: { type: String, attribute: "school-href" },
|
|
@@ -1851,11 +1873,11 @@ class It extends ce {
|
|
|
1851
1873
|
}
|
|
1852
1874
|
onInput(e) {
|
|
1853
1875
|
const t = e.target.value.trim();
|
|
1854
|
-
if (clearTimeout(this.debounceTimer), t.length <
|
|
1876
|
+
if (clearTimeout(this.debounceTimer), t.length < It) {
|
|
1855
1877
|
this.abortController?.abort(), this.results = [], this.open = !1, this.searched = !1;
|
|
1856
1878
|
return;
|
|
1857
1879
|
}
|
|
1858
|
-
this.debounceTimer = setTimeout(() => this.search(t),
|
|
1880
|
+
this.debounceTimer = setTimeout(() => this.search(t), St);
|
|
1859
1881
|
}
|
|
1860
1882
|
async search(e) {
|
|
1861
1883
|
this.abortController?.abort(), this.abortController = new AbortController();
|
|
@@ -1948,37 +1970,37 @@ class It extends ce {
|
|
|
1948
1970
|
`;
|
|
1949
1971
|
}
|
|
1950
1972
|
}
|
|
1951
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-school-search") && globalThis.customElements.define("hsot-school-search",
|
|
1952
|
-
function
|
|
1953
|
-
const t = new Map(a.map((
|
|
1954
|
-
for (const
|
|
1955
|
-
|
|
1956
|
-
const o = a.filter((
|
|
1957
|
-
function
|
|
1958
|
-
const m = t.get(
|
|
1973
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-school-search") && globalThis.customElements.define("hsot-school-search", Tt);
|
|
1974
|
+
function Te(a, e) {
|
|
1975
|
+
const t = new Map(a.map((h) => [h.id, h])), s = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
1976
|
+
for (const h of e || [])
|
|
1977
|
+
h.outcome === "winner" && (s.has(h.targetGameId) || s.set(h.targetGameId, []), s.get(h.targetGameId).push(h), r.has(h.sourceGameId) || r.set(h.sourceGameId, []), r.get(h.sourceGameId).push(h));
|
|
1978
|
+
const o = a.filter((h) => !r.has(h.id)), i = (h) => h.targetSlot === "home" ? 0 : 1;
|
|
1979
|
+
function c(h) {
|
|
1980
|
+
const m = t.get(h);
|
|
1959
1981
|
if (!m) return null;
|
|
1960
|
-
const
|
|
1961
|
-
return { game: m, children:
|
|
1982
|
+
const l = [...s.get(h) || []].sort((f, u) => i(f) - i(u)).map((f) => c(f.sourceGameId)).filter(Boolean);
|
|
1983
|
+
return { game: m, children: l, bracketGroup: m.bracketGroup };
|
|
1962
1984
|
}
|
|
1963
|
-
return o.length === 1 ?
|
|
1985
|
+
return o.length === 1 ? c(o[0].id) : o.map((h) => c(h.id));
|
|
1964
1986
|
}
|
|
1965
|
-
function
|
|
1987
|
+
function Ce(a, e = [], t = 0) {
|
|
1966
1988
|
if (!a) return e;
|
|
1967
1989
|
e[t] || (e[t] = []), e[t].push(a.game);
|
|
1968
|
-
for (const s of a.children || [])
|
|
1990
|
+
for (const s of a.children || []) Ce(s, e, t + 1);
|
|
1969
1991
|
return e;
|
|
1970
1992
|
}
|
|
1971
|
-
const
|
|
1972
|
-
function
|
|
1973
|
-
const s =
|
|
1993
|
+
const Ct = (a) => Math.max(1, Math.round(Math.log2(a || 2)));
|
|
1994
|
+
function Bt({ round: a, perGroup: e, groupCount: t = 1 }) {
|
|
1995
|
+
const s = Ct(e), o = (t === 4 ? s + 2 : t === 2 ? s + 1 : s) - a;
|
|
1974
1996
|
return o === 0 ? t > 1 ? "Championship" : "Final" : o === 1 ? "Semifinal" : `Round ${a}`;
|
|
1975
1997
|
}
|
|
1976
|
-
function
|
|
1998
|
+
function Dt(a) {
|
|
1977
1999
|
if (!a || !a.length) return "setup";
|
|
1978
2000
|
const e = Math.max(...a.map((s) => s.round ?? 0)), t = a.filter((s) => (s.round ?? 0) === e);
|
|
1979
2001
|
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";
|
|
1980
2002
|
}
|
|
1981
|
-
function
|
|
2003
|
+
function Ft(a, e) {
|
|
1982
2004
|
const t = a?.groupNames || [];
|
|
1983
2005
|
if (t.length >= 2) {
|
|
1984
2006
|
const r = t.map((o) => ({ key: o, name: o }));
|
|
@@ -1987,62 +2009,62 @@ function Bt(a, e) {
|
|
|
1987
2009
|
const s = [...new Set((e || []).map((r) => r.bracketGroup).filter(Boolean))];
|
|
1988
2010
|
return [{ key: null, name: s.length === 1 ? s[0] : "Bracket" }];
|
|
1989
2011
|
}
|
|
1990
|
-
const
|
|
2012
|
+
const zt = (a, e) => e?.key == null ? [...a || []] : (a || []).filter((t) => t.bracketGroup === e.key), ie = (a) => {
|
|
1991
2013
|
const e = /(\d+)\s*$/.exec(a.label || "");
|
|
1992
2014
|
return e ? Number(e[1]) : 1 / 0;
|
|
1993
|
-
},
|
|
1994
|
-
function
|
|
2015
|
+
}, le = (a, e) => ie(a) - ie(e) || String(a.id).localeCompare(String(e.id));
|
|
2016
|
+
function At(a, e) {
|
|
1995
2017
|
if (a.every((r) => Number.isInteger(r.round))) return (r) => r.round;
|
|
1996
|
-
const t =
|
|
2018
|
+
const t = Te(a, e), s = /* @__PURE__ */ new Map();
|
|
1997
2019
|
for (const r of Array.isArray(t) ? t : [t]) {
|
|
1998
|
-
const o =
|
|
1999
|
-
o.forEach((
|
|
2020
|
+
const o = Ce(r), i = o.length - 1;
|
|
2021
|
+
o.forEach((c, h) => c.forEach((m) => s.set(m.id, i - h + 1)));
|
|
2000
2022
|
}
|
|
2001
2023
|
return (r) => Number.isInteger(r.round) ? r.round : s.get(r.id) || 1;
|
|
2002
2024
|
}
|
|
2003
|
-
function
|
|
2004
|
-
const s =
|
|
2025
|
+
function Pt(a, e, t) {
|
|
2026
|
+
const s = zt(a, t);
|
|
2005
2027
|
if (!s.length) return [];
|
|
2006
|
-
const r =
|
|
2028
|
+
const r = At(a || [], e || []), o = /* @__PURE__ */ new Map();
|
|
2007
2029
|
for (const m of s) {
|
|
2008
|
-
const
|
|
2009
|
-
o.has(
|
|
2030
|
+
const d = r(m);
|
|
2031
|
+
o.has(d) || o.set(d, []), o.get(d).push(m);
|
|
2010
2032
|
}
|
|
2011
2033
|
const i = /* @__PURE__ */ new Map();
|
|
2012
2034
|
for (const m of e || [])
|
|
2013
2035
|
m.outcome === "winner" && (i.has(m.targetGameId) || i.set(m.targetGameId, []), i.get(m.targetGameId).push(m.sourceGameId));
|
|
2014
|
-
const
|
|
2015
|
-
let
|
|
2016
|
-
for (const m of [...o.keys()].sort((
|
|
2017
|
-
let
|
|
2018
|
-
if (
|
|
2019
|
-
const
|
|
2020
|
-
const u = (i.get(f.id) || []).map((
|
|
2036
|
+
const c = [];
|
|
2037
|
+
let h = null;
|
|
2038
|
+
for (const m of [...o.keys()].sort((d, l) => d - l)) {
|
|
2039
|
+
let d = [...o.get(m)];
|
|
2040
|
+
if (h) {
|
|
2041
|
+
const l = (f) => {
|
|
2042
|
+
const u = (i.get(f.id) || []).map((g) => h.get(g)).filter((g) => g !== void 0);
|
|
2021
2043
|
return u.length ? Math.min(...u) : 1 / 0;
|
|
2022
2044
|
};
|
|
2023
|
-
|
|
2045
|
+
d.sort((f, u) => l(f) - l(u) || le(f, u));
|
|
2024
2046
|
} else
|
|
2025
|
-
|
|
2026
|
-
|
|
2047
|
+
d.sort(le);
|
|
2048
|
+
h = new Map(d.map((l, f) => [l.id, f])), c.push({ round: m, games: d });
|
|
2027
2049
|
}
|
|
2028
|
-
return
|
|
2050
|
+
return c;
|
|
2029
2051
|
}
|
|
2030
|
-
function
|
|
2052
|
+
function Et(a, e, t) {
|
|
2031
2053
|
const s = a[`${e}TeamId`] || null, r = (t || []).find((i) => i.gameId === a.id && i.slot === e), o = a[`${e}Seed`] ?? r?.seed ?? null;
|
|
2032
2054
|
return { teamId: s, seed: o, bye: !s && !!r?.isBye };
|
|
2033
2055
|
}
|
|
2034
|
-
function
|
|
2056
|
+
function Be(a) {
|
|
2035
2057
|
const e = H(a);
|
|
2036
2058
|
return e === "home" || e === "away" ? e : null;
|
|
2037
2059
|
}
|
|
2038
|
-
function
|
|
2039
|
-
const t =
|
|
2060
|
+
function _t(a, e) {
|
|
2061
|
+
const t = Te(a || [], e || []);
|
|
2040
2062
|
if (!t || Array.isArray(t)) return null;
|
|
2041
|
-
const s =
|
|
2063
|
+
const s = Be(t.game);
|
|
2042
2064
|
return s && t.game[`${s}TeamId`] || null;
|
|
2043
2065
|
}
|
|
2044
|
-
const
|
|
2045
|
-
function
|
|
2066
|
+
const ce = { active: 0, setup: 1, complete: 2 };
|
|
2067
|
+
function Rt(a, { id: e, param: t } = {}) {
|
|
2046
2068
|
const s = a || [];
|
|
2047
2069
|
if (!s.length) return null;
|
|
2048
2070
|
for (const r of [e, t]) {
|
|
@@ -2050,9 +2072,9 @@ function Et(a, { id: e, param: t } = {}) {
|
|
|
2050
2072
|
const o = s.find((i) => i.id === r);
|
|
2051
2073
|
if (o) return o;
|
|
2052
2074
|
}
|
|
2053
|
-
return [...s].sort((r, o) => (
|
|
2075
|
+
return [...s].sort((r, o) => (ce[r.status] ?? 3) - (ce[o.status] ?? 3) || String(r.name || "").localeCompare(String(o.name || "")))[0];
|
|
2054
2076
|
}
|
|
2055
|
-
const
|
|
2077
|
+
const Nt = $`
|
|
2056
2078
|
.bracket { display: flex; gap: 1rem; align-items: stretch; overflow-x: auto; padding-bottom: 0.5rem; }
|
|
2057
2079
|
.round { flex: 0 0 250px; display: flex; flex-direction: column; min-width: 0; }
|
|
2058
2080
|
.roundhead {
|
|
@@ -2098,8 +2120,8 @@ const _t = $`
|
|
|
2098
2120
|
.champ .tname a { color: inherit; text-decoration: none; font-weight: 700; }
|
|
2099
2121
|
@media (max-width: 720px) { .round { flex-basis: 215px; } }
|
|
2100
2122
|
`;
|
|
2101
|
-
class
|
|
2102
|
-
static styles = [
|
|
2123
|
+
class Mt extends w {
|
|
2124
|
+
static styles = [P, Nt];
|
|
2103
2125
|
static properties = {
|
|
2104
2126
|
...w.properties,
|
|
2105
2127
|
sport: { type: String },
|
|
@@ -2112,9 +2134,9 @@ class Rt extends w {
|
|
|
2112
2134
|
super(), this.sport = "football", this.season = "", this.tournamentId = "", this.picked = "", this.group = null;
|
|
2113
2135
|
}
|
|
2114
2136
|
async fetchData(e) {
|
|
2115
|
-
const t = this.season ||
|
|
2137
|
+
const t = this.season || R(), s = (await e.listTournaments({ sport: this.sport, season: t })).items, r = new URLSearchParams(globalThis.location?.search || "").get("tournament"), o = Rt(s, { id: this.picked || this.tournamentId, param: r });
|
|
2116
2138
|
if (!o) return { season: t, tournaments: s, tournament: null };
|
|
2117
|
-
const [i,
|
|
2139
|
+
const [i, c, h, m, d] = await Promise.all([
|
|
2118
2140
|
e.listSeedings(o.id),
|
|
2119
2141
|
e.listEdges(o.id),
|
|
2120
2142
|
e.listGames({ tournamentId: o.id }),
|
|
@@ -2126,10 +2148,10 @@ class Rt extends w {
|
|
|
2126
2148
|
tournaments: s,
|
|
2127
2149
|
tournament: o,
|
|
2128
2150
|
seedings: i.items,
|
|
2129
|
-
edges:
|
|
2130
|
-
games:
|
|
2151
|
+
edges: c.items,
|
|
2152
|
+
games: h.items,
|
|
2131
2153
|
schools: m.items,
|
|
2132
|
-
teams:
|
|
2154
|
+
teams: d.items
|
|
2133
2155
|
};
|
|
2134
2156
|
}
|
|
2135
2157
|
get ctx() {
|
|
@@ -2138,7 +2160,7 @@ class Rt extends w {
|
|
|
2138
2160
|
schoolsById: y(this.data.schools),
|
|
2139
2161
|
records: {},
|
|
2140
2162
|
rankings: [],
|
|
2141
|
-
hrefs:
|
|
2163
|
+
hrefs: A(this),
|
|
2142
2164
|
sport: this.sport
|
|
2143
2165
|
}, this._ctxData = this.data), this._ctx;
|
|
2144
2166
|
}
|
|
@@ -2161,41 +2183,41 @@ class Rt extends w {
|
|
|
2161
2183
|
teams: e.teams
|
|
2162
2184
|
});
|
|
2163
2185
|
if (!e.tournament)
|
|
2164
|
-
return n`${s}${
|
|
2165
|
-
${
|
|
2186
|
+
return n`${s}${D(this, n`
|
|
2187
|
+
${F(this)}
|
|
2166
2188
|
<div class="card"><div class="empty">No ${this.sport} brackets have been published for the ${e.season} season yet.</div></div>
|
|
2167
2189
|
`)}`;
|
|
2168
|
-
const r =
|
|
2190
|
+
const r = Ft(e.tournament, e.games), o = r.find((l) => l.key === this.group) || r[0], i = (e.tournament.groupNames || []).length >= 2 ? e.tournament.groupNames.length : 1, c = (Number(e.tournament.size) || 0) / i, h = Pt(e.games, e.edges, o), m = Dt(e.games), d = _t(e.games, e.edges);
|
|
2169
2191
|
return n`
|
|
2170
2192
|
${s}
|
|
2171
|
-
${
|
|
2172
|
-
${
|
|
2193
|
+
${D(this, n`
|
|
2194
|
+
${F(this)}
|
|
2173
2195
|
<div class="toolbar">
|
|
2174
2196
|
${e.tournaments.length > 1 ? n`
|
|
2175
2197
|
<div role="group" aria-label="Tournament">
|
|
2176
|
-
${e.tournaments.map((
|
|
2177
|
-
@click=${() => this.pick(
|
|
2198
|
+
${e.tournaments.map((l) => n`<button class="chip ${l.id === e.tournament.id ? "on" : ""}"
|
|
2199
|
+
@click=${() => this.pick(l.id)}>${l.name}</button>`)}
|
|
2178
2200
|
</div>` : p}
|
|
2179
2201
|
${r.length > 1 ? n`
|
|
2180
2202
|
<div role="tablist" aria-label="Bracket group">
|
|
2181
|
-
${r.map((
|
|
2182
|
-
aria-selected=${
|
|
2203
|
+
${r.map((l) => n`<button class="chip ${l.key === o.key ? "on" : ""}" role="tab"
|
|
2204
|
+
aria-selected=${l.key === o.key ? "true" : "false"}
|
|
2183
2205
|
@click=${() => {
|
|
2184
|
-
this.group =
|
|
2185
|
-
}}>${
|
|
2206
|
+
this.group = l.key;
|
|
2207
|
+
}}>${l.name}</button>`)}
|
|
2186
2208
|
</div>` : p}
|
|
2187
2209
|
<span class="spacer"></span>
|
|
2188
2210
|
<span class="pill ${m === "complete" ? "final" : m === "active" ? "class" : "type"}">${m === "complete" ? "Complete" : m === "active" ? "In progress" : "Bracket set"}</span>
|
|
2189
2211
|
<span class="asof">${e.tournament.size}-team ${String(e.tournament.format || "").replace(/_/g, " ")}</span>
|
|
2190
2212
|
</div>
|
|
2191
|
-
${
|
|
2192
|
-
${C(
|
|
2193
|
-
${
|
|
2213
|
+
${d ? n`<div class="champ"><span class="pill champ">Champion</span>
|
|
2214
|
+
${B(C(t, d), 26)}<span class="tname">${O(t, d)}</span></div>` : p}
|
|
2215
|
+
${h.length ? n`
|
|
2194
2216
|
<div class="bracket" role="region" aria-label="${o.name} bracket">
|
|
2195
|
-
${
|
|
2217
|
+
${h.map((l) => n`
|
|
2196
2218
|
<section class="round">
|
|
2197
|
-
<h3 class="roundhead">${
|
|
2198
|
-
<div class="games">${
|
|
2219
|
+
<h3 class="roundhead">${Bt({ round: l.round, perGroup: c, groupCount: i })}</h3>
|
|
2220
|
+
<div class="games">${l.games.map((f) => this.renderMatchup(t, f))}</div>
|
|
2199
2221
|
</section>`)}
|
|
2200
2222
|
</div>` : n`<div class="card"><div class="empty">This bracket has no games yet.</div></div>`}
|
|
2201
2223
|
`)}
|
|
@@ -2208,49 +2230,49 @@ class Rt extends w {
|
|
|
2208
2230
|
${this.renderSlot(e, t, "home")}
|
|
2209
2231
|
${this.renderSlot(e, t, "away")}
|
|
2210
2232
|
<footer class="mfoot">
|
|
2211
|
-
${
|
|
2233
|
+
${_(t)}
|
|
2212
2234
|
${t.label ? n`<span class="label">${t.label}</span>` : p}
|
|
2213
2235
|
<span class="spacer"></span>
|
|
2214
|
-
${s ? n`<a class="box" href=${
|
|
2236
|
+
${s ? n`<a class="box" href=${v(e.hrefs.game, { sport: this.sport, id: t.id })}>Box score</a>` : p}
|
|
2215
2237
|
</footer>
|
|
2216
2238
|
</article>
|
|
2217
2239
|
`;
|
|
2218
2240
|
}
|
|
2219
2241
|
renderSlot(e, t, s) {
|
|
2220
|
-
const { teamId: r, seed: o, bye: i } =
|
|
2242
|
+
const { teamId: r, seed: o, bye: i } = Et(t, s, this.data.seedings), c = Be(t), h = t.state === "live" || t.state === "final";
|
|
2221
2243
|
return n`
|
|
2222
|
-
<div class="slot ${
|
|
2244
|
+
<div class="slot ${c ? c === s ? "winner" : "loser" : ""}">
|
|
2223
2245
|
<span class="seed">${o ?? ""}</span>
|
|
2224
|
-
${r ? n`${C(
|
|
2225
|
-
${
|
|
2246
|
+
${r ? n`${B(C(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>`}
|
|
2247
|
+
${h ? n`<span class="score">${t[`${s}Score`] ?? 0}</span>` : p}
|
|
2226
2248
|
</div>
|
|
2227
2249
|
`;
|
|
2228
2250
|
}
|
|
2229
2251
|
}
|
|
2230
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-brackets") && globalThis.customElements.define("hsot-brackets",
|
|
2252
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-brackets") && globalThis.customElements.define("hsot-brackets", Mt);
|
|
2231
2253
|
export {
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2254
|
+
E as D,
|
|
2255
|
+
kt as H,
|
|
2256
|
+
Mt as a,
|
|
2257
|
+
ft as b,
|
|
2258
|
+
gt as c,
|
|
2259
|
+
Tt as d,
|
|
2260
|
+
ht as e,
|
|
2261
|
+
mt as f,
|
|
2262
|
+
Ft as g,
|
|
2263
|
+
Te as h,
|
|
2264
|
+
_t as i,
|
|
2265
|
+
N as j,
|
|
2266
|
+
Dt as k,
|
|
2267
|
+
v as l,
|
|
2246
2268
|
H as m,
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2269
|
+
Ot as n,
|
|
2270
|
+
Bt as o,
|
|
2271
|
+
Ye as p,
|
|
2272
|
+
Pt as q,
|
|
2273
|
+
S as r,
|
|
2274
|
+
ve as s,
|
|
2253
2275
|
U as t,
|
|
2254
2276
|
Z as u,
|
|
2255
|
-
|
|
2277
|
+
Ce as v
|
|
2256
2278
|
};
|