@wral/hsot-data 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,32 +1,32 @@
1
- import { LitElement as Z, html as l, css as y, nothing as p, svg as V } from "lit";
2
- const ee = 50;
3
- function te(a = {}) {
1
+ import { LitElement as ee, html as l, css as y, nothing as p, svg as q } from "lit";
2
+ const te = 50;
3
+ function se(a = {}) {
4
4
  const e = Object.entries(a).filter(([, s]) => s != null && s !== "");
5
5
  if (!e.length) return "";
6
6
  const t = new URLSearchParams();
7
7
  return e.forEach(([s, r]) => t.set(s, String(r))), `?${t.toString()}`;
8
8
  }
9
- function se({ baseUrl: a, token: e = "", fetchFn: t } = {}) {
9
+ function ae({ baseUrl: a, token: e = "", fetchFn: t } = {}) {
10
10
  if (!a) throw new Error("createClient requires a baseUrl");
11
11
  const s = a.replace(/\/+$/, ""), r = t || ((...i) => fetch(...i));
12
12
  async function o(i) {
13
13
  const m = { Accept: "application/json" };
14
14
  e && (m.Authorization = `Bearer ${e}`);
15
- const h = await r(`${s}${i}`, { headers: m });
16
- if (!h.ok) {
17
- const c = new Error(`api-hsot ${h.status} on ${i}`);
18
- throw c.status = h.status, c;
15
+ const d = await r(`${s}${i}`, { headers: m });
16
+ if (!d.ok) {
17
+ const c = new Error(`api-hsot ${d.status} on ${i}`);
18
+ throw c.status = d.status, c;
19
19
  }
20
- return h.json();
20
+ return d.json();
21
21
  }
22
22
  async function n(i, m = {}) {
23
- const h = [];
23
+ const d = [];
24
24
  let c = null;
25
- for (let d = 0; d < ee; d += 1) {
26
- const f = te(c ? { ...m, cursor: c } : m), u = await o(`${i}${f}`);
27
- if (h.push(...u.items || []), c = u.nextCursor || null, !c) break;
25
+ for (let h = 0; h < te; h += 1) {
26
+ const f = se(c ? { ...m, cursor: c } : m), u = await o(`${i}${f}`);
27
+ if (d.push(...u.items || []), c = u.nextCursor || null, !c) break;
28
28
  }
29
- return { items: h, total: h.length, nextCursor: null };
29
+ return { items: d, total: d.length, nextCursor: null };
30
30
  }
31
31
  return {
32
32
  listSchools: (i) => n("/schools", i),
@@ -44,7 +44,7 @@ function se({ baseUrl: a, token: e = "", fetchFn: t } = {}) {
44
44
  listSports: () => o("/sports")
45
45
  };
46
46
  }
47
- class b extends Z {
47
+ class b extends ee {
48
48
  static properties = {
49
49
  api: { type: String },
50
50
  refreshInterval: { type: Number, attribute: "refresh-interval" },
@@ -60,7 +60,7 @@ class b extends Z {
60
60
  this._client = e, this.isConnected && this.load();
61
61
  }
62
62
  get client() {
63
- return this._client ? this._client : this.api ? se({ baseUrl: this.api }) : null;
63
+ return this._client ? this._client : this.api ? ae({ baseUrl: this.api }) : null;
64
64
  }
65
65
  connectedCallback() {
66
66
  super.connectedCallback(), this._setupInterval();
@@ -107,7 +107,7 @@ class b extends Z {
107
107
  return l``;
108
108
  }
109
109
  }
110
- const g = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ae = y`
110
+ const g = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), re = y`
111
111
  :host {
112
112
  --hsot-red: var(--color-red, #D1232A);
113
113
  --hsot-red-deep: var(--color-red-dark, #951C21);
@@ -141,7 +141,7 @@ const g = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ae = y`
141
141
  outline-offset: 1px;
142
142
  }
143
143
  .mut { color: var(--hsot-gray-5); }
144
- `, re = y`
144
+ `, oe = y`
145
145
  .band { background: var(--hsot-white); color: var(--hsot-black); }
146
146
  .band .inner { max-width: 1366px; margin: 0 auto; padding: 1.1rem 1.25rem 0; }
147
147
  .band h1, .band h2.bandtitle {
@@ -161,7 +161,7 @@ const g = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ae = y`
161
161
  .band nav.tabs a.on { border-bottom-color: var(--hsot-red); }
162
162
  .band nav.tabs span.off { color: var(--hsot-gray-4); cursor: not-allowed; }
163
163
  @media (max-width: 720px) { .band h1, .band h2.bandtitle { font-size: 1.8rem; } }
164
- `, oe = y`
164
+ `, ie = y`
165
165
  .view { max-width: 1366px; margin: 0 auto; padding: 1.25rem; box-sizing: border-box; }
166
166
  .toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin: 0 0 1.1rem; }
167
167
  .toolbar .spacer { flex: 1; }
@@ -219,7 +219,7 @@ const g = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ae = y`
219
219
  .pill.champ { background: var(--hsot-straw); color: #6b5900; }
220
220
  @keyframes hsot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
221
221
  @media (prefers-reduced-motion: reduce) { .pill.live { animation: none; } }
222
- `, ie = y`
222
+ `, le = y`
223
223
  .tablewrap { overflow-x: auto; }
224
224
  table.data { font-family: var(--hsot-heading-font); font-size: 14px; border-collapse: collapse; width: 100%; }
225
225
  table.data th {
@@ -237,7 +237,7 @@ const g = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ae = y`
237
237
  table.data tbody tr.rowlink:hover { background: var(--hsot-gray-1); }
238
238
  table.data td.teamcell a { color: inherit; text-decoration: none; font-weight: 500; }
239
239
  table.data td.teamcell a:hover { text-decoration: underline; }
240
- `, le = y`
240
+ `, ce = y`
241
241
  .swatch {
242
242
  display: inline-flex; align-items: center; justify-content: center;
243
243
  width: 26px; height: 26px; border-radius: 50%;
@@ -261,7 +261,7 @@ const g = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ae = y`
261
261
  .dot.W { background: var(--hsot-win); }
262
262
  .dot.L { background: var(--hsot-loss); }
263
263
  .dot.T { background: var(--hsot-tie); }
264
- `, ce = y`
264
+ `, de = y`
265
265
  ul.gamelist { list-style: none; margin: 0; padding: 0; }
266
266
  .gamelist li {
267
267
  display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 1rem;
@@ -278,21 +278,21 @@ const g = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ae = y`
278
278
  .gamelist .opp a:hover { text-decoration: underline; }
279
279
  .gamelist .where { color: var(--hsot-gray-5); font-size: 0.78rem; }
280
280
  .gamelist a.box { font-size: 0.78rem; }
281
- `, S = [ae, re, oe, ne, ie, le, ce];
282
- function H(a) {
281
+ `, S = [re, oe, ie, ne, le, ce, de];
282
+ function j(a) {
283
283
  return a.state !== "final" ? null : a.forfeit && a.forfeit !== "none" ? a.forfeit : a.homeScore > a.awayScore ? "home" : a.awayScore > a.homeScore ? "away" : a.tiebreakWinner && a.tiebreakWinner !== "none" ? a.tiebreakWinner : "tie";
284
284
  }
285
285
  function D(a, e) {
286
286
  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, n) => String(o.date).localeCompare(String(n.date)));
287
287
  for (const o of r) {
288
- const n = H(o), i = o.gameType === "conference";
288
+ const n = j(o), i = o.gameType === "conference";
289
289
  for (const m of ["home", "away"]) {
290
- const h = m === "home" ? o.homeTeamId : o.awayTeamId;
291
- if (!h) continue;
292
- const c = s(h), d = m === "home" ? o.homeScore : o.awayScore, f = m === "home" ? o.awayScore : o.homeScore;
293
- c.pf += d, c.pa += f;
290
+ const d = m === "home" ? o.homeTeamId : o.awayTeamId;
291
+ if (!d) continue;
292
+ const c = s(d), h = m === "home" ? o.homeScore : o.awayScore, f = m === "home" ? o.awayScore : o.homeScore;
293
+ c.pf += h, c.pa += f;
294
294
  let u = "T";
295
- n === "tie" ? (c.t += 1, i && (c.ct += 1)) : n === m ? (c.w += 1, i && (c.cw += 1), u = "W") : (c.l += 1, i && (c.cl += 1), u = "L"), c.results.push({ gameId: o.id, date: o.date, mark: u, my: d, their: f, opp: m === "home" ? o.awayTeamId : o.homeTeamId, conf: i });
295
+ n === "tie" ? (c.t += 1, i && (c.ct += 1)) : n === m ? (c.w += 1, i && (c.cw += 1), u = "W") : (c.l += 1, i && (c.cl += 1), u = "L"), c.results.push({ gameId: o.id, date: o.date, mark: u, my: h, their: f, opp: m === "home" ? o.awayTeamId : o.homeTeamId, conf: i });
296
296
  }
297
297
  }
298
298
  return t;
@@ -304,7 +304,7 @@ function _(a) {
304
304
  for (let s = a.length - 1; s >= 0 && a[s].mark === e; s -= 1) t += 1;
305
305
  return e + t;
306
306
  }
307
- const q = (a, e, t) => {
307
+ const V = (a, e, t) => {
308
308
  const s = a + e + t;
309
309
  return s ? (a + t / 2) / s : 0;
310
310
  }, Y = (a) => a.toFixed(3).replace("0.", ".");
@@ -313,16 +313,16 @@ function w(a, e = !1) {
313
313
  const t = e ? a.cw : a.w, s = e ? a.cl : a.l, r = e ? a.ct : a.t;
314
314
  return `${t}-${s}${r ? `-${r}` : ""}`;
315
315
  }
316
- function Q(a, e) {
316
+ function K(a, e) {
317
317
  return a.map((t) => {
318
318
  const s = e[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] };
319
- return { team: t, rec: s, confPct: q(s.cw, s.cl, s.ct), overallPct: q(s.w, s.l, s.t) };
319
+ return { team: t, rec: s, confPct: V(s.cw, s.cl, s.ct), overallPct: V(s.w, s.l, s.t) };
320
320
  }).sort((t, s) => s.confPct - t.confPct || s.overallPct - t.overallPct || s.rec.pf - s.rec.pa - (t.rec.pf - t.rec.pa));
321
321
  }
322
- function M(a, e) {
322
+ function H(a, e) {
323
323
  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;
324
324
  }
325
- function K(a, e) {
325
+ function Q(a, e) {
326
326
  const t = a[e];
327
327
  return t && t.results.length ? t.results[t.results.length - 1] : null;
328
328
  }
@@ -347,17 +347,17 @@ function $(a, e) {
347
347
  const [t, s, r] = String(a).split("-").map(Number);
348
348
  return !t || !s || !r ? "TBD" : new Date(t, s - 1, r).toLocaleDateString("en-US", e || { weekday: "short", month: "short", day: "numeric" });
349
349
  }
350
- function A(a) {
350
+ function E(a) {
351
351
  if (!a) return "";
352
352
  const [e, t] = String(a).split(":").map(Number);
353
353
  if (Number.isNaN(e)) return "";
354
354
  const s = e >= 12 ? "PM" : "AM";
355
355
  return `${(e + 11) % 12 + 1}:${String(t || 0).padStart(2, "0")} ${s}`;
356
356
  }
357
- function de(a) {
357
+ function he(a) {
358
358
  return a ? `${Math.floor(a / 12)}-${a % 12}` : "·";
359
359
  }
360
- function E(a = /* @__PURE__ */ new Date()) {
360
+ function A(a = /* @__PURE__ */ new Date()) {
361
361
  const e = a.getFullYear();
362
362
  return a.getMonth() >= 6 ? `${e}-${e + 1}` : `${e - 1}-${e}`;
363
363
  }
@@ -365,7 +365,7 @@ function O(a = /* @__PURE__ */ new Date()) {
365
365
  const e = (t) => String(t).padStart(2, "0");
366
366
  return `${a.getFullYear()}-${e(a.getMonth() + 1)}-${e(a.getDate())}`;
367
367
  }
368
- function U(a) {
368
+ function M(a) {
369
369
  return a ? (a.abbr || a.name || "?").slice(0, 4).toUpperCase() : "?";
370
370
  }
371
371
  function F(a) {
@@ -373,19 +373,19 @@ function F(a) {
373
373
  const e = parseInt(a.slice(1), 16), t = e >> 16 & 255, s = e >> 8 & 255, r = e & 255;
374
374
  return 0.299 * t + 0.587 * s + 0.114 * r > 150 ? "#0F1B33" : "#FFFFFF";
375
375
  }
376
- const he = (a) => {
376
+ const me = (a) => {
377
377
  const e = ["th", "st", "nd", "rd"], t = a % 100;
378
378
  return a + (e[(t - 20) % 10] || e[t] || e[0]);
379
379
  };
380
- function me(a) {
380
+ function pe(a) {
381
381
  if (a.state === "live") return { kind: "live", label: `Live · ${a.period || ""}`.replace(/ · $/, "") };
382
382
  if (a.state === "final") {
383
383
  const e = [];
384
384
  return a.finish === "overtime" && e.push("OT"), a.finish === "shootout" && e.push("PK-SO"), a.forfeit && a.forfeit !== "none" && e.push("Forfeit"), { kind: "final", label: `Final${e.length ? ` · ${e.join(" · ")}` : ""}` };
385
385
  }
386
- return a.state === "postponed" ? { kind: "warn", label: "Postponed" } : a.state === "canceled" ? { kind: "warn", label: "Canceled" } : { kind: "sched", label: `${$(a.date, { month: "short", day: "numeric" })} · ${A(a.time)}`.replace(/ · $/, "") };
386
+ return a.state === "postponed" ? { kind: "warn", label: "Postponed" } : a.state === "canceled" ? { kind: "warn", label: "Canceled" } : { kind: "sched", label: `${$(a.date, { month: "short", day: "numeric" })} · ${E(a.time)}`.replace(/ · $/, "") };
387
387
  }
388
- function Te(a, e, t, s = "") {
388
+ function Fe(a, e, t, s = "") {
389
389
  let r = null;
390
390
  for (const o of a || [])
391
391
  o.sport === e && (t && o.effectiveDate > t || s && o.gender && o.gender !== s || (!r || o.effectiveDate > r.effectiveDate) && (r = o));
@@ -397,17 +397,17 @@ function X(a, e, t, s, r) {
397
397
  const n = /* @__PURE__ */ new Map();
398
398
  for (const m of a || []) {
399
399
  if (m.sport !== s || r && m.effectiveDate > r || m.gender && o.gender !== m.gender && o.gender !== "coed") continue;
400
- const h = m.gender || "", c = n.get(h);
401
- (!c || m.effectiveDate > c.effectiveDate) && n.set(h, m);
400
+ const d = m.gender || "", c = n.get(d);
401
+ (!c || m.effectiveDate > c.effectiveDate) && n.set(d, m);
402
402
  }
403
403
  let i = null;
404
404
  for (const m of n.values()) {
405
- const h = (m.teamIds || []).indexOf(t);
406
- h !== -1 && (!i || m.effectiveDate > i.effectiveDate) && (i = { poll: m, rank: h + 1 });
405
+ const d = (m.teamIds || []).indexOf(t);
406
+ d !== -1 && (!i || m.effectiveDate > i.effectiveDate) && (i = { poll: m, rank: d + 1 });
407
407
  }
408
408
  return i ? i.rank : null;
409
409
  }
410
- function pe(a, e, t) {
410
+ function fe(a, e, t) {
411
411
  if (!a) return { kind: "none", delta: 0 };
412
412
  const s = (a.teamIds || []).indexOf(t) + 1;
413
413
  if (!s) return { kind: "none", delta: 0 };
@@ -417,37 +417,37 @@ function pe(a, e, t) {
417
417
  const o = r - s;
418
418
  return o > 0 ? { kind: "up", delta: o } : o < 0 ? { kind: "down", delta: -o } : { kind: "same", delta: 0 };
419
419
  }
420
- function fe(a) {
420
+ function ue(a) {
421
421
  return /^https?:\/\//i.test(String(a || ""));
422
422
  }
423
- function B(a, e) {
423
+ function P(a, e) {
424
424
  const t = a?.logoAssetId;
425
- if (!fe(t)) return "";
425
+ if (!ue(t)) return "";
426
426
  const s = Math.max(1, Math.round(e * 2)), r = t.includes("?") ? "&" : "?";
427
427
  return `${t}${r}w=${s}&h=${s}&f=webp`;
428
428
  }
429
429
  const T = (a, e) => {
430
430
  const t = a.teamsById[e];
431
431
  return t ? a.schoolsById[t.schoolId] : null;
432
- }, k = (a, e) => T(a, e)?.name || "TBD", P = (a, e) => T(a, e)?.abbr || "TBD";
432
+ }, k = (a, e) => T(a, e)?.name || "TBD", z = (a, e) => T(a, e)?.abbr || "TBD";
433
433
  function I(a, e = 26) {
434
434
  if (!a) return p;
435
- const t = B(a, e);
435
+ const t = P(a, e);
436
436
  if (t)
437
437
  return l`<img class="swatch logo" aria-hidden="true" alt="" loading="lazy"
438
438
  src=${t} style="width:${e}px;height:${e}px" />`;
439
439
  const s = a.colorPrimary || "#030711", r = F(s);
440
440
  return l`<span class="swatch" aria-hidden="true"
441
441
  style="width:${e}px;height:${e}px;background:${s};color:${r};font-size:${Math.max(8, e * 0.28)}px"
442
- >${U(a)}</span>`;
442
+ >${M(a)}</span>`;
443
443
  }
444
- function j(a, e, t) {
444
+ function G(a, e, t) {
445
445
  const s = X(a.rankings, a.teamsById, e, a.sport, t);
446
446
  return s ? l`<span class="rankbadge">#${s}</span>` : p;
447
447
  }
448
- function G(a, e, t) {
448
+ function U(a, e, t) {
449
449
  const s = T(a, e);
450
- return s ? l`${j(a, e, t)}<a href=${v(a.hrefs.school, { id: s.id })}>${s.name}</a>` : l`<span class="mut">TBD</span>`;
450
+ return s ? l`${G(a, e, t)}<a href=${v(a.hrefs.school, { id: s.id })}>${s.name}</a>` : l`<span class="mut">TBD</span>`;
451
451
  }
452
452
  function W(a, e, t = 5) {
453
453
  const s = a.records[e];
@@ -459,16 +459,16 @@ function W(a, e, t = 5) {
459
459
  href=${v(a.hrefs.game, { sport: a.sport, id: o.gameId })}>${o.mark}</a>`)}
460
460
  </span>`;
461
461
  }
462
- function z(a) {
463
- const e = me(a);
462
+ function B(a) {
463
+ const e = pe(a);
464
464
  return l`<span class="pill ${e.kind}">${e.label}</span>`;
465
465
  }
466
- function J(a, e, t) {
466
+ function Z(a, e, t) {
467
467
  if (!e) return l`<span class="mut">·</span>`;
468
468
  const s = e.homeTeamId === t ? e.awayTeamId : e.homeTeamId, r = e.homeTeamId === t ? "vs" : "at";
469
- return l`${e.state === "live" ? l`<span class="pill live">Live</span> ` : l`${$(e.date, { month: "numeric", day: "numeric" })} `}${r} ${P(a, s)}`;
469
+ return l`${e.state === "live" ? l`<span class="pill live">Live</span> ` : l`${$(e.date, { month: "numeric", day: "numeric" })} `}${r} ${z(a, s)}`;
470
470
  }
471
- class ue extends b {
471
+ class ge extends b {
472
472
  static styles = S;
473
473
  static properties = {
474
474
  ...b.properties,
@@ -486,7 +486,7 @@ class ue extends b {
486
486
  }
487
487
  }
488
488
  async fetchData(e) {
489
- const t = this.season || E(), [s, r, o, n, i] = await Promise.all([
489
+ const t = this.season || A(), [s, r, o, n, i] = await Promise.all([
490
490
  e.listSchools(),
491
491
  e.listTeams({ sport: this.sport }),
492
492
  e.listConferences(),
@@ -556,11 +556,11 @@ class ue extends b {
556
556
  `;
557
557
  }
558
558
  renderGame(e, t) {
559
- const s = t.state === "final" || t.state === "live" ? `${t.awayScore}-${t.homeScore}` : A(t.time);
559
+ const s = t.state === "final" || t.state === "live" ? `${t.awayScore}-${t.homeScore}` : E(t.time);
560
560
  return l`
561
561
  <li>
562
- ${z(t)}
563
- <span class="opp">${G(e, t.awayTeamId, t.date)} at ${G(e, t.homeTeamId, t.date)}</span>
562
+ ${B(t)}
563
+ <span class="opp">${U(e, t.awayTeamId, t.date)} at ${U(e, t.homeTeamId, t.date)}</span>
564
564
  <span class="res" style="width:auto">${s}</span>
565
565
  <span class="where">${t.venue || ""}</span>
566
566
  ${t.broadcast ? l`<span class="pill class">${t.broadcast}</span>` : p}
@@ -569,8 +569,8 @@ class ue extends b {
569
569
  `;
570
570
  }
571
571
  }
572
- globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores", ue);
573
- class ge extends b {
572
+ globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores", ge);
573
+ class ve extends b {
574
574
  static styles = S;
575
575
  static properties = {
576
576
  ...b.properties,
@@ -583,7 +583,7 @@ class ge extends b {
583
583
  super(), this.sport = "football", this.season = "", this.classFilter = "All", this.query = "";
584
584
  }
585
585
  async fetchData(e) {
586
- const t = this.season || E(), [s, r, o, n, i] = await Promise.all([
586
+ const t = this.season || A(), [s, r, o, n, i] = await Promise.all([
587
587
  e.listConferences({ active: !0 }),
588
588
  e.listSchools(),
589
589
  e.listTeams({ sport: this.sport }),
@@ -640,7 +640,7 @@ class ge extends b {
640
640
  renderConference(e, t) {
641
641
  const s = this.data.teams.filter((n) => n.conferenceId === t.id);
642
642
  if (!s.length) return p;
643
- const r = this.query.trim().toLowerCase(), o = Q(s, e.records);
643
+ const r = this.query.trim().toLowerCase(), o = K(s, e.records);
644
644
  return l`
645
645
  <div class="card">
646
646
  <div class="card-head">
@@ -664,18 +664,18 @@ class ge extends b {
664
664
  renderRow(e, t, s, r) {
665
665
  const o = e.schoolsById[t.team.schoolId], n = o?.name || t.team.name || "TBD";
666
666
  if (r && !n.toLowerCase().includes(r)) return p;
667
- const i = t.rec.pf - t.rec.pa, m = M(this.data.games, t.team.id), h = (t.team.championships || []).map((d) => l`
668
- <span class="pill champ" title="${d.season} ${d.title} champion">★ ${d.season} ${d.title}</span>`), c = () => {
667
+ const i = t.rec.pf - t.rec.pa, m = H(this.data.games, t.team.id), d = (t.team.championships || []).map((h) => l`
668
+ <span class="pill champ" title="${h.season} ${h.title} champion">★ ${h.season} ${h.title}</span>`), c = () => {
669
669
  location.href = v(e.hrefs.school, { id: t.team.schoolId });
670
670
  };
671
671
  return l`
672
- <tr class="rowlink" @click=${(d) => {
673
- d.target.closest("a") || c();
672
+ <tr class="rowlink" @click=${(h) => {
673
+ h.target.closest("a") || c();
674
674
  }}>
675
675
  <td class="mut">${s + 1}</td>
676
676
  <td class="teamcell">
677
- ${I(o)}${j(e, t.team.id, null)}
678
- <a href=${v(e.hrefs.school, { id: t.team.schoolId })}>${n}</a> ${h}
677
+ ${I(o)}${G(e, t.team.id, null)}
678
+ <a href=${v(e.hrefs.school, { id: t.team.schoolId })}>${n}</a> ${d}
679
679
  </td>
680
680
  <td class="num">${w(t.rec, !0)}</td>
681
681
  <td class="num">${Y(t.confPct)}</td>
@@ -686,13 +686,13 @@ class ge extends b {
686
686
  <td class="num" style="color:${i >= 0 ? "var(--hsot-win)" : "var(--hsot-loss)"}">${i > 0 ? "+" : ""}${i}</td>
687
687
  <td>${_(t.rec.results) || "·"}</td>
688
688
  <td>${W(e, t.team.id)}</td>
689
- <td>${J(e, m, t.team.id)}</td>
689
+ <td>${Z(e, m, t.team.id)}</td>
690
690
  </tr>
691
691
  `;
692
692
  }
693
693
  }
694
- globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings", ge);
695
- const ve = y`
694
+ globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings", ve);
695
+ const $e = y`
696
696
  .hero1 {
697
697
  border-radius: var(--hsot-radius-md); color: var(--hsot-white);
698
698
  padding: 1.3rem 1.4rem; display: flex; align-items: center; gap: 1.2rem;
@@ -709,8 +709,8 @@ const ve = y`
709
709
  .delta.new { background: var(--hsot-straw); color: #6b5900; border-radius: var(--hsot-radius-xs); padding: 0.1rem 0.3rem; font-size: 0.7rem; }
710
710
  .sparkline { vertical-align: middle; }
711
711
  `;
712
- class $e extends b {
713
- static styles = [...S, ve];
712
+ class be extends b {
713
+ static styles = [...S, $e];
714
714
  static properties = {
715
715
  ...b.properties,
716
716
  sport: { type: String },
@@ -727,13 +727,13 @@ class $e extends b {
727
727
  e && (this.pollDate = e);
728
728
  }
729
729
  async fetchData(e) {
730
- const t = this.season || E(), [s, r, o, n, i] = await Promise.all([
730
+ const t = this.season || A(), [s, r, o, n, i] = await Promise.all([
731
731
  e.listRankings({ sport: this.sport, ...this.gender ? { gender: this.gender } : {} }),
732
732
  e.listSchools(),
733
733
  e.listTeams({ sport: this.sport }),
734
734
  e.listConferences(),
735
735
  e.listGames({ sport: this.sport, season: t })
736
- ]), m = s.items.filter((h) => !this.gender || !h.gender || h.gender === this.gender).sort((h, c) => c.effectiveDate.localeCompare(h.effectiveDate));
736
+ ]), m = s.items.filter((d) => !this.gender || !d.gender || d.gender === this.gender).sort((d, c) => c.effectiveDate.localeCompare(d.effectiveDate));
737
737
  return {
738
738
  season: t,
739
739
  polls: m,
@@ -754,31 +754,31 @@ class $e extends b {
754
754
  }, this._ctxData = this.data), this._ctx;
755
755
  }
756
756
  sparkline(e, t, s) {
757
- const i = t.map((d, f) => {
758
- const u = (d.teamIds || []).indexOf(e);
757
+ const i = t.map((h, f) => {
758
+ const u = (h.teamIds || []).indexOf(e);
759
759
  if (u === -1) return null;
760
760
  const x = t.length === 1 ? 96 / 2 : f / (t.length - 1) * 90 + 3, L = 3 + u / 24 * 20;
761
761
  return { x, y: L };
762
762
  }), m = [];
763
- let h = [];
764
- if (i.forEach((d) => {
765
- d ? h.push(d) : h.length && (m.push(h), h = []);
766
- }), h.length && m.push(h), !m.length) return p;
763
+ let d = [];
764
+ if (i.forEach((h) => {
765
+ h ? d.push(h) : d.length && (m.push(d), d = []);
766
+ }), d.length && m.push(d), !m.length) return p;
767
767
  const c = i[s];
768
768
  return l`<svg class="sparkline" width=${96} height=${26} viewBox="0 0 ${96} ${26}" role="img" aria-label="rank history">
769
- ${m.map((d) => V`<polyline fill="none" stroke="var(--hsot-red)" stroke-width="2"
770
- points=${d.map((f) => `${f.x.toFixed(1)},${f.y.toFixed(1)}`).join(" ")}></polyline>`)}
771
- ${c ? V`<circle cx=${c.x.toFixed(1)} cy=${c.y.toFixed(1)} r="3" fill="var(--hsot-black)"></circle>` : p}
769
+ ${m.map((h) => q`<polyline fill="none" stroke="var(--hsot-red)" stroke-width="2"
770
+ points=${h.map((f) => `${f.x.toFixed(1)},${f.y.toFixed(1)}`).join(" ")}></polyline>`)}
771
+ ${c ? q`<circle cx=${c.x.toFixed(1)} cy=${c.y.toFixed(1)} r="3" fill="var(--hsot-black)"></circle>` : p}
772
772
  </svg>`;
773
773
  }
774
774
  movement(e, t, s) {
775
- const r = pe(e, t, s);
775
+ const r = fe(e, t, s);
776
776
  return r.kind === "up" ? l`<span class="delta up">▲ ${r.delta}</span>` : r.kind === "down" ? l`<span class="delta down">▼ ${r.delta}</span>` : r.kind === "new" ? l`<span class="delta new">NEW</span>` : r.kind === "same" ? l`<span class="delta same">—</span>` : l`<span class="delta same">·</span>`;
777
777
  }
778
778
  renderView() {
779
779
  const e = this.ctx, t = this.data.polls;
780
780
  if (!t.length) return l`<div class="view"><p class="empty">No ${this.sport} polls published yet this season.</p></div>`;
781
- const s = Math.max(0, t.findIndex((d) => d.effectiveDate === this.pollDate)), r = t[s] || t[0], o = t[s + 1] || null, n = t.slice().reverse(), i = n.indexOf(r), m = g(this.data.conferences), h = (r.teamIds || [])[0], c = h ? T(e, h) : null;
781
+ const s = Math.max(0, t.findIndex((h) => h.effectiveDate === this.pollDate)), r = t[s] || t[0], o = t[s + 1] || null, n = t.slice().reverse(), i = n.indexOf(r), m = g(this.data.conferences), d = (r.teamIds || [])[0], c = d ? T(e, d) : null;
782
782
  return l`
783
783
  <div class="band">
784
784
  <div class="inner">
@@ -789,11 +789,11 @@ class $e extends b {
789
789
  <div class="view">
790
790
  <div class="toolbar">
791
791
  <label class="asof" for="pollsel">Poll of</label>
792
- <select id="pollsel" @change=${(d) => {
793
- this.pollDate = d.target.value;
792
+ <select id="pollsel" @change=${(h) => {
793
+ this.pollDate = h.target.value;
794
794
  }}>
795
- ${t.map((d, f) => l`<option value=${d.effectiveDate} ?selected=${d === r}>
796
- ${$(d.effectiveDate, { month: "long", day: "numeric", year: "numeric" })}${f === 0 ? " · current" : ""}
795
+ ${t.map((h, f) => l`<option value=${h.effectiveDate} ?selected=${h === r}>
796
+ ${$(h.effectiveDate, { month: "long", day: "numeric", year: "numeric" })}${f === 0 ? " · current" : ""}
797
797
  </option>`)}
798
798
  </select>
799
799
  <button class="chip" ?disabled=${s >= t.length - 1}
@@ -807,14 +807,14 @@ class $e extends b {
807
807
  <span class="spacer"></span>
808
808
  <span class="asof">Movement vs. the previous poll · sparkline = season rank history</span>
809
809
  </div>
810
- ${c ? this.renderHero(e, r, o, h, c, m) : p}
810
+ ${c ? this.renderHero(e, r, o, d, c, m) : p}
811
811
  <div class="card"><div class="tablewrap"><table class="data">
812
812
  <thead><tr>
813
813
  <th class="num">Rk</th><th>Mvmt</th><th>Team</th><th class="num">Record</th>
814
814
  <th>Conference</th><th>Last result</th><th>Next</th><th>Season</th>
815
815
  </tr></thead>
816
816
  <tbody>
817
- ${(r.teamIds || []).map((d, f) => f === 0 || !d ? p : this.renderRow(e, r, o, n, i, m, d, f + 1))}
817
+ ${(r.teamIds || []).map((h, f) => f === 0 || !h ? p : this.renderRow(e, r, o, n, i, m, h, f + 1))}
818
818
  </tbody>
819
819
  </table></div></div>
820
820
  <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>
@@ -822,7 +822,7 @@ class $e extends b {
822
822
  `;
823
823
  }
824
824
  renderHero(e, t, s, r, o, n) {
825
- const i = e.records[r], m = K(e.records, r), h = n[e.teamsById[r]?.conferenceId], c = `linear-gradient(120deg, ${o.colorPrimary || "#030711"} 0%, var(--hsot-black) 85%)`;
825
+ const i = e.records[r], m = Q(e.records, r), d = n[e.teamsById[r]?.conferenceId], c = `linear-gradient(120deg, ${o.colorPrimary || "#030711"} 0%, var(--hsot-black) 85%)`;
826
826
  return l`
827
827
  <div class="hero1" style="background:${c}">
828
828
  <div class="bigrank">#1</div>
@@ -830,9 +830,9 @@ class $e extends b {
830
830
  <div>
831
831
  <h2><a href=${v(e.hrefs.school, { id: o.id })}>${o.name} ${o.mascot || ""}</a></h2>
832
832
  <div class="facts">
833
- ${w(i)} overall${h ? l` · ${w(i, !0)} ${h.name}` : p}
833
+ ${w(i)} overall${d ? l` · ${w(i, !0)} ${d.name}` : p}
834
834
  · streak ${_(i?.results) || "·"}
835
- ${m ? l` · last: ${m.mark} ${m.my}-${m.their} vs ${P(e, m.opp)}` : p}
835
+ ${m ? l` · last: ${m.mark} ${m.my}-${m.their} vs ${z(e, m.opp)}` : p}
836
836
  &nbsp;${this.movement(t, s, r)}
837
837
  </div>
838
838
  </div>
@@ -840,10 +840,10 @@ class $e extends b {
840
840
  `;
841
841
  }
842
842
  renderRow(e, t, s, r, o, n, i, m) {
843
- const h = T(e, i);
844
- if (!h) return p;
845
- const c = e.records[i], d = K(e.records, i), f = M(this.data.games, i), u = n[e.teamsById[i]?.conferenceId], x = () => {
846
- location.href = v(e.hrefs.school, { id: h.id });
843
+ const d = T(e, i);
844
+ if (!d) return p;
845
+ const c = e.records[i], h = Q(e.records, i), f = H(this.data.games, i), u = n[e.teamsById[i]?.conferenceId], x = () => {
846
+ location.href = v(e.hrefs.school, { id: d.id });
847
847
  };
848
848
  return l`
849
849
  <tr class="rowlink" @click=${(L) => {
@@ -851,21 +851,21 @@ class $e extends b {
851
851
  }}>
852
852
  <td class="num" style="font-weight:700">${m}</td>
853
853
  <td>${this.movement(t, s, i)}</td>
854
- <td class="teamcell">${I(h)}<a href=${v(e.hrefs.school, { id: h.id })}>${h.name}</a>
855
- <span class="mut" style="font-size:0.78rem">${h.mascot || ""}</span></td>
854
+ <td class="teamcell">${I(d)}<a href=${v(e.hrefs.school, { id: d.id })}>${d.name}</a>
855
+ <span class="mut" style="font-size:0.78rem">${d.mascot || ""}</span></td>
856
856
  <td class="num">${w(c)}</td>
857
857
  <td class="mut">${u?.name || "Independent"}</td>
858
- <td>${d ? l`<a class="box" style="text-decoration:none" href=${v(e.hrefs.game, { sport: this.sport, id: d.gameId })}>
859
- <b style="color:${d.mark === "W" ? "var(--hsot-win)" : d.mark === "L" ? "var(--hsot-loss)" : "var(--hsot-tie)"}">${d.mark}</b>
860
- ${d.my}-${d.their} vs ${P(e, d.opp)}</a>` : l`<span class="mut">·</span>`}</td>
861
- <td>${J(e, f, i)}</td>
858
+ <td>${h ? l`<a class="box" style="text-decoration:none" href=${v(e.hrefs.game, { sport: this.sport, id: h.gameId })}>
859
+ <b style="color:${h.mark === "W" ? "var(--hsot-win)" : h.mark === "L" ? "var(--hsot-loss)" : "var(--hsot-tie)"}">${h.mark}</b>
860
+ ${h.my}-${h.their} vs ${z(e, h.opp)}</a>` : l`<span class="mut">·</span>`}</td>
861
+ <td>${Z(e, f, i)}</td>
862
862
  <td>${this.sparkline(i, r, o)}</td>
863
863
  </tr>
864
864
  `;
865
865
  }
866
866
  }
867
- globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings", $e);
868
- const be = y`
867
+ globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings", be);
868
+ const ye = y`
869
869
  .schoolhero { color: var(--hsot-white); padding: 1.6rem 1.25rem 1.3rem; }
870
870
  .schoolhero .inner { max-width: 1366px; margin: 0 auto; display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
871
871
  .schoolhero .crest {
@@ -890,8 +890,8 @@ const be = y`
890
890
  .cols { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 1.25rem; }
891
891
  @media (max-width: 900px) { .cols { grid-template-columns: 1fr; } .schoolhero h1 { font-size: 1.9rem; } }
892
892
  `;
893
- class ye extends b {
894
- static styles = [...S, be];
893
+ class we extends b {
894
+ static styles = [...S, ye];
895
895
  static properties = {
896
896
  ...b.properties,
897
897
  schoolId: { type: String, attribute: "school-id" },
@@ -908,7 +908,7 @@ class ye extends b {
908
908
  e && !this.sport && (this.sport = e);
909
909
  }
910
910
  async fetchData(e) {
911
- const t = this.season || E(), s = await e.getSchool(this.schoolId), o = (await e.listTeams({ schoolId: this.schoolId })).items, n = o.find((x) => x.sport === (this.sport || "football")) || o[0] || null, [i, m, h, c, d, f, u] = await Promise.all([
911
+ const t = this.season || A(), s = await e.getSchool(this.schoolId), o = (await e.listTeams({ schoolId: this.schoolId })).items, n = o.find((x) => x.sport === (this.sport || "football")) || o[0] || null, [i, m, d, c, h, f, u] = await Promise.all([
912
912
  n ? e.listGames({ sport: n.sport, season: t }) : Promise.resolve({ items: [] }),
913
913
  n ? e.listTeams({ sport: n.sport }) : Promise.resolve({ items: [] }),
914
914
  e.listSchools(),
@@ -926,9 +926,9 @@ class ye extends b {
926
926
  active: n,
927
927
  games: i.items,
928
928
  allTeams: m.items,
929
- schools: h.items,
929
+ schools: d.items,
930
930
  conferences: c.items,
931
- rankings: d.items,
931
+ rankings: h.items,
932
932
  roster: f.items.find((x) => x.season === t) || null,
933
933
  players: u.items
934
934
  };
@@ -949,17 +949,17 @@ class ye extends b {
949
949
  renderView() {
950
950
  const { school: e, teams: t, active: s, season: r } = this.data;
951
951
  if (!e) return l`<div class="view"><p class="empty">School not found.</p></div>`;
952
- const o = this.ctx, n = F(e.colorPrimary || "#030711"), i = (e.adm || [])[0], m = g(this.data.conferences), h = s ? m[s.conferenceId] : null;
952
+ const o = this.ctx, n = F(e.colorPrimary || "#030711"), i = (e.adm || [])[0], m = g(this.data.conferences), d = s ? m[s.conferenceId] : null;
953
953
  return l`
954
954
  <div class="schoolhero" style="background:linear-gradient(115deg, ${e.colorPrimary || "#030711"} 0%, ${e.colorPrimary || "#030711"} 55%, var(--hsot-black) 100%);color:${n}">
955
955
  <div class="inner">
956
- ${B(e, 84) ? l`<img class="crest logo" alt="" loading="lazy" src=${B(e, 84)} />` : l`<div class="crest" style="background:${e.colorSecondary || "#7C7C7C"};color:${F(e.colorSecondary || "#7C7C7C")}">${U(e)}</div>`}
956
+ ${P(e, 84) ? l`<img class="crest logo" alt="" loading="lazy" src=${P(e, 84)} />` : l`<div class="crest" style="background:${e.colorSecondary || "#7C7C7C"};color:${F(e.colorSecondary || "#7C7C7C")}">${M(e)}</div>`}
957
957
  <div style="min-width:260px">
958
958
  <h1>${e.name} <span class="mascot">${e.mascot || ""}</span></h1>
959
959
  <div class="facts">
960
960
  ${e.location ? l`<span><b>Location</b>${e.location}${e.county ? l` · ${e.county} County` : p}</span>` : p}
961
961
  ${e.association ? l`<span><b>League</b>${e.association}${e.classification ? l` · ${e.classification}` : p}</span>` : p}
962
- ${h ? l`<span><b>Conference</b>${h.name}</span>` : p}
962
+ ${d ? l`<span><b>Conference</b>${d.name}</span>` : p}
963
963
  ${i ? l`<span><b>Enrollment</b>${i.value.toLocaleString()} (${i.season} ADM)</span>` : p}
964
964
  ${e.openingYear ? l`<span><b>Opened</b>${e.openingYear}</span>` : p}
965
965
  ${e.areaCode ? l`<span><b>Area</b>${e.areaCode}</span>` : p}
@@ -970,39 +970,39 @@ class ye extends b {
970
970
  </div>
971
971
  <div class="band">
972
972
  <nav class="tabs" aria-label="Teams">
973
- ${t.map((c) => c.id === s?.id ? l`<a class="on" href="#" @click=${(d) => d.preventDefault()}>${c.name}</a>` : l`<a href="#" @click=${(d) => {
974
- d.preventDefault(), this.switchSport(c.sport);
973
+ ${t.map((c) => c.id === s?.id ? l`<a class="on" href="#" @click=${(h) => h.preventDefault()}>${c.name}</a>` : l`<a href="#" @click=${(h) => {
974
+ h.preventDefault(), this.switchSport(c.sport);
975
975
  }}>${c.name}</a>`)}
976
976
  </nav>
977
977
  </div>
978
978
  <div class="view">
979
- ${s ? this.renderTeam(o, s, h, r) : l`<p class="empty">No teams recorded for this school yet.</p>`}
979
+ ${s ? this.renderTeam(o, s, d, r) : l`<p class="empty">No teams recorded for this school yet.</p>`}
980
980
  </div>
981
981
  `;
982
982
  }
983
983
  renderTeam(e, t, s, r) {
984
- const o = e.records[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] }, n = o.w + o.l + o.t, i = s ? this.data.allTeams.filter((d) => d.conferenceId === s.id) : [], m = s ? Q(i, e.records).findIndex((d) => d.team.id === t.id) + 1 : 0, h = X(e.rankings, e.teamsById, t.id, t.sport, null), c = this.data.games.filter((d) => d.homeTeamId === t.id || d.awayTeamId === t.id).sort((d, f) => String(d.date).localeCompare(String(f.date)));
984
+ const o = e.records[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] }, n = o.w + o.l + o.t, i = s ? this.data.allTeams.filter((h) => h.conferenceId === s.id) : [], m = s ? K(i, e.records).findIndex((h) => h.team.id === t.id) + 1 : 0, d = X(e.rankings, e.teamsById, t.id, t.sport, null), c = this.data.games.filter((h) => h.homeTeamId === t.id || h.awayTeamId === t.id).sort((h, f) => String(h.date).localeCompare(String(f.date)));
985
985
  return l`
986
986
  <div class="tiles">
987
987
  <div class="tile"><div class="k">Overall</div><div class="v">${w(o)}</div><div class="s">${n} games played</div></div>
988
988
  <div class="tile"><div class="k">${s?.name || "Conference"}</div><div class="v">${w(o, !0)}</div>
989
- <div class="s">${m ? `${he(m)} of ${i.length}` : "·"}</div></div>
989
+ <div class="s">${m ? `${me(m)} of ${i.length}` : "·"}</div></div>
990
990
  <div class="tile"><div class="k">Points</div><div class="v">${n ? (o.pf / n).toFixed(1) : "0.0"}</div>
991
991
  <div class="s">scored per game · ${n ? (o.pa / n).toFixed(1) : "0.0"} allowed</div></div>
992
992
  <div class="tile"><div class="k">Streak</div><div class="v">${_(o.results) || "·"}</div>
993
993
  <div class="s">last 5: ${W(e, t.id)}</div></div>
994
- <div class="tile"><div class="k">HSOT Top 25</div><div class="v">${h ? `#${h}` : "NR"}</div>
994
+ <div class="tile"><div class="k">HSOT Top 25</div><div class="v">${d ? `#${d}` : "NR"}</div>
995
995
  <div class="s"><a href=${v(e.hrefs.section, { sport: t.sport, view: "rankings" })}>full poll</a></div></div>
996
996
  </div>
997
997
  ${(t.championships || []).length ? l`
998
998
  <div style="margin:-0.2rem 0 1rem;display:flex;gap:0.4rem;flex-wrap:wrap">
999
- ${t.championships.map((d) => l`<span class="pill champ">★ ${d.season} ${d.title} champion${d.classification ? ` · ${d.classification}` : ""}${d.region ? ` · ${d.region}` : ""}</span>`)}
999
+ ${t.championships.map((h) => l`<span class="pill champ">★ ${h.season} ${h.title} champion${h.classification ? ` · ${h.classification}` : ""}${h.region ? ` · ${h.region}` : ""}</span>`)}
1000
1000
  </div>` : p}
1001
1001
  <div class="cols">
1002
1002
  <div>
1003
1003
  <div class="section-title">Schedule &amp; results</div>
1004
1004
  <div class="card">
1005
- ${c.length ? l`<ul class="gamelist">${c.map((d) => this.renderGameRow(e, t, d))}</ul>` : l`<p class="empty">No ${t.sport} games recorded for ${r}.</p>`}
1005
+ ${c.length ? l`<ul class="gamelist">${c.map((h) => this.renderGameRow(e, t, h))}</ul>` : l`<p class="empty">No ${t.sport} games recorded for ${r}.</p>`}
1006
1006
  </div>
1007
1007
  </div>
1008
1008
  <div>
@@ -1014,19 +1014,19 @@ class ye extends b {
1014
1014
  }
1015
1015
  renderGameRow(e, t, s) {
1016
1016
  const r = s.homeTeamId === t.id, o = r ? s.awayTeamId : s.homeTeamId, n = r ? s.homeScore : s.awayScore, i = r ? s.awayScore : s.homeScore;
1017
- let m = l`<span class="mut">${A(s.time)}</span>`;
1017
+ let m = l`<span class="mut">${E(s.time)}</span>`;
1018
1018
  if (s.state === "final") {
1019
- const c = H(s), d = c === "tie" ? "T" : c === (r ? "home" : "away") ? "W" : "L";
1020
- m = l`<span class=${d}>${d}</span> ${n}-${i}${s.finish === "overtime" ? l` <span class="mut">OT</span>` : p}${s.forfeit && s.forfeit !== "none" ? l` <span class="mut">FF</span>` : p}`;
1019
+ const c = j(s), h = c === "tie" ? "T" : c === (r ? "home" : "away") ? "W" : "L";
1020
+ m = l`<span class=${h}>${h}</span> ${n}-${i}${s.finish === "overtime" ? l` <span class="mut">OT</span>` : p}${s.forfeit && s.forfeit !== "none" ? l` <span class="mut">FF</span>` : p}`;
1021
1021
  } else s.state === "live" && (m = l`<span style="color:var(--hsot-red)">${n}-${i}</span>`);
1022
- const h = s.gameType === "conference" ? "Conf" : s.gameType === "nonconference" ? "Non-conf" : s.gameType === "playoff" ? `Playoff${s.label ? ` · ${s.label}` : ""}` : "Scrimmage";
1022
+ const d = s.gameType === "conference" ? "Conf" : s.gameType === "nonconference" ? "Non-conf" : s.gameType === "playoff" ? `Playoff${s.label ? ` · ${s.label}` : ""}` : "Scrimmage";
1023
1023
  return l`
1024
1024
  <li>
1025
1025
  <span class="d">${$(s.date)}</span>
1026
- ${z(s)}
1026
+ ${B(s)}
1027
1027
  <span class="res">${m}</span>
1028
- <span class="opp">${r ? "vs" : "at"} ${G(e, o, s.date)}
1029
- <span class="pill type">${h}</span>
1028
+ <span class="opp">${r ? "vs" : "at"} ${U(e, o, s.date)}
1029
+ <span class="pill type">${d}</span>
1030
1030
  ${s.broadcast ? l`<span class="pill class">${s.broadcast}</span>` : p}
1031
1031
  </span>
1032
1032
  <span class="where">${s.venue || ""}</span>
@@ -1050,7 +1050,7 @@ class ye extends b {
1050
1050
  <td style="font-weight:500">${n.firstName} ${n.lastName}</td>
1051
1051
  <td>${o.position || "·"}</td>
1052
1052
  <td class="mut">${n.classOf || "·"}</td>
1053
- <td class="num">${de(n.heightIn)}</td>
1053
+ <td class="num">${he(n.heightIn)}</td>
1054
1054
  <td class="num">${n.weightLb || "·"}</td>
1055
1055
  </tr>` : p;
1056
1056
  })}
@@ -1059,8 +1059,37 @@ class ye extends b {
1059
1059
  `;
1060
1060
  }
1061
1061
  }
1062
- globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school", ye);
1063
- const we = y`
1062
+ globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school", we);
1063
+ const xe = "https://api.wral.com/search";
1064
+ function ke(a) {
1065
+ return a.map((e) => `uri:"${e}"`).join(" OR ");
1066
+ }
1067
+ function Te(a, e) {
1068
+ const t = String(a || xe).replace(/\/+$/, ""), s = new URLSearchParams({ query: ke(e), sort: "score", lang: "en" });
1069
+ return `${t}/v1/query?${s}`;
1070
+ }
1071
+ function J(a) {
1072
+ try {
1073
+ const e = new URL(a);
1074
+ if (/(^|\.)smugmug\.com$/i.test(e.hostname)) {
1075
+ const t = e.pathname.split("/").filter(Boolean).pop() || "", s = !t || /^[ni]-[A-Za-z0-9]+$/.test(t);
1076
+ return {
1077
+ uri: a,
1078
+ title: s ? a : decodeURIComponent(t).replace(/-/g, " "),
1079
+ photos: !0
1080
+ };
1081
+ }
1082
+ } catch {
1083
+ }
1084
+ return { uri: a, title: a };
1085
+ }
1086
+ async function Ie(a, e, t) {
1087
+ const r = await ((...i) => fetch(...i))(Te(a, e));
1088
+ if (!r.ok) throw new Error(`search answered ${r.status}`);
1089
+ const o = await r.json(), n = new Map((o.items || []).map((i) => [i.uri, i]));
1090
+ return e.map((i) => n.get(i) || J(i));
1091
+ }
1092
+ const Se = y`
1064
1093
  .breadcrumbs { font-size: 0.8125rem; margin: 0.9rem 0 0; color: var(--hsot-gray-5); }
1065
1094
  .breadcrumbs a { text-decoration: none; }
1066
1095
  .scorehead { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center; padding: 1.4rem 1rem; }
@@ -1081,6 +1110,14 @@ const we = y`
1081
1110
  .scorehead .mid { text-align: center; }
1082
1111
  .scorehead .bigscore { font-family: var(--hsot-heading-font); font-weight: 700; font-size: 3rem; line-height: 1; color: var(--hsot-black); white-space: nowrap; }
1083
1112
  .scorehead .status { margin-top: 0.3rem; font-size: 0.8rem; color: var(--hsot-gray-5); }
1113
+ .covgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
1114
+ .covcard { display: flex; flex-direction: column; text-decoration: none; color: inherit; margin-bottom: 0; }
1115
+ .covcard:hover .covtitle { color: var(--hsot-red-deep); }
1116
+ .covimg { width: 100%; aspect-ratio: 1.91; object-fit: cover; display: block; background: var(--hsot-gray-1); }
1117
+ .covbody { padding: 0.75rem 0.9rem 0.85rem; }
1118
+ .covtitle { font-family: var(--hsot-heading-font); font-weight: 700; font-size: 1.05rem; line-height: 1.25; overflow-wrap: anywhere; }
1119
+ .covdesc { margin: 0.35rem 0 0; font-size: 0.85rem; color: var(--hsot-gray-5); line-height: 1.4; }
1120
+ .covmeta { margin-top: 0.45rem; font-size: 0.78rem; color: var(--hsot-gray-5); }
1084
1121
  .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
1085
1122
  .ctxcard { padding: 0.85rem 1rem; }
1086
1123
  .ctxcard .who { font-family: var(--hsot-heading-font); font-weight: 700; margin-bottom: 0.4rem; }
@@ -1091,30 +1128,39 @@ const we = y`
1091
1128
  .cols { grid-template-columns: 1fr; }
1092
1129
  }
1093
1130
  `;
1094
- class xe extends b {
1095
- static styles = [...S, we];
1131
+ class De extends b {
1132
+ static styles = [...S, Se];
1096
1133
  static properties = {
1097
1134
  ...b.properties,
1098
- gameId: { type: String, attribute: "game-id" }
1135
+ gameId: { type: String, attribute: "game-id" },
1136
+ // The public site search that resolves Game.coverageUrls into cards
1137
+ // (DEV-1236). Shared cross-stage by design — see the studio host's
1138
+ // registry — so the prod default is right everywhere; the attribute
1139
+ // exists for the same reason the href templates do.
1140
+ searchApi: { type: String, attribute: "search-api" }
1099
1141
  };
1100
1142
  constructor() {
1101
- super(), this.gameId = "";
1143
+ super(), this.gameId = "", this.searchApi = "";
1102
1144
  }
1103
1145
  async fetchData(e) {
1104
- const t = await e.getGame(this.gameId), [s, r, o, n, i] = await Promise.all([
1146
+ const t = await e.getGame(this.gameId), s = Array.isArray(t.coverageUrls) ? t.coverageUrls : [], [r, o, n, i, m, d] = await Promise.all([
1105
1147
  e.listSchools(),
1106
1148
  e.listTeams({ sport: t.sport }),
1107
1149
  e.listConferences(),
1108
1150
  e.listRankings({ sport: t.sport }),
1109
- e.listGames({ sport: t.sport, season: t.season })
1151
+ e.listGames({ sport: t.sport, season: t.season }),
1152
+ // A search outage must not blank the box score — degrade to bare
1153
+ // links (fetchCoverage already degrades per-URL index misses).
1154
+ s.length ? Ie(this.searchApi, s).catch(() => s.map(J)) : Promise.resolve([])
1110
1155
  ]);
1111
1156
  return {
1112
1157
  game: t,
1113
- schools: s.items,
1114
- teams: r.items,
1115
- conferences: o.items,
1116
- rankings: n.items,
1117
- games: i.items
1158
+ schools: r.items,
1159
+ teams: o.items,
1160
+ conferences: n.items,
1161
+ rankings: i.items,
1162
+ games: m.items,
1163
+ coverage: d
1118
1164
  };
1119
1165
  }
1120
1166
  get ctx() {
@@ -1130,7 +1176,7 @@ class xe extends b {
1130
1176
  renderView() {
1131
1177
  const e = this.data.game;
1132
1178
  if (!e) return l`<div class="view"><p class="empty">Game not found.</p></div>`;
1133
- const t = this.ctx, s = g(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, n = H(e), i = (c) => e.state === "final" && n !== c && n !== "tie" ? "opacity:0.45" : "", m = e.conferenceId ? s[e.conferenceId] : null, h = this.data.games.filter((c) => c.id !== e.id && c.state === "final" && c.gameType !== "scrimmage" && (c.homeTeamId === e.homeTeamId && c.awayTeamId === e.awayTeamId || c.homeTeamId === e.awayTeamId && c.awayTeamId === e.homeTeamId));
1179
+ const t = this.ctx, s = g(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, n = j(e), i = (c) => e.state === "final" && n !== c && n !== "tie" ? "opacity:0.45" : "", m = e.conferenceId ? s[e.conferenceId] : null, d = this.data.games.filter((c) => c.id !== e.id && c.state === "final" && c.gameType !== "scrimmage" && (c.homeTeamId === e.homeTeamId && c.awayTeamId === e.awayTeamId || c.homeTeamId === e.awayTeamId && c.awayTeamId === e.homeTeamId));
1134
1180
  return l`
1135
1181
  <div class="view">
1136
1182
  <p class="breadcrumbs">
@@ -1147,8 +1193,8 @@ class xe extends b {
1147
1193
  <span class="mut" style="font-size:1.6rem">–</span>
1148
1194
  <span style=${i("home")}>${e.homeScore}</span>
1149
1195
  </div>
1150
- <div class="status">${z(e)}</div>
1151
- <div class="status">${$(e.date, { weekday: "short", month: "short", day: "numeric", year: "numeric" })}${e.state === "scheduled" && e.time ? l` · ${A(e.time)}` : p} · ${e.venue || "Venue TBD"}
1196
+ <div class="status">${B(e)}</div>
1197
+ <div class="status">${$(e.date, { weekday: "short", month: "short", day: "numeric", year: "numeric" })}${e.state === "scheduled" && e.time ? l` · ${E(e.time)}` : p} · ${e.venue || "Venue TBD"}
1152
1198
  ${e.broadcast ? l` · <span class="pill class">${e.broadcast}</span>` : p}</div>
1153
1199
  <div class="status">
1154
1200
  <span class="pill type">${e.gameType === "conference" ? `${m?.name || "Conference"} game` : e.gameType}</span>
@@ -1161,22 +1207,31 @@ class xe extends b {
1161
1207
  ${this.renderLineScore(e, r, o)}
1162
1208
  ${e.notes ? l`<p class="note" style="padding:0 1rem 0.9rem;text-align:center">${e.notes}</p>` : p}
1163
1209
  </div>
1164
- ${e.storyAssetId || e.videoAssetId ? l`
1210
+ ${(this.data.coverage || []).length ? l`
1165
1211
  <div class="section-title">Coverage</div>
1166
- <div class="card" style="padding:0.8rem 1rem;display:flex;gap:0.5rem;flex-wrap:wrap;align-items:center">
1167
- ${e.storyAssetId ? l`<span class="pill class" title="Game.storyAssetId">Game story · ${e.storyAssetId}</span>` : p}
1168
- ${e.videoAssetId ? l`<span class="pill class" title="Game.videoAssetId">Highlights · ${e.videoAssetId}</span>` : p}
1169
- <span class="asof">Story and video ride the Game resource as Studio asset references.</span>
1212
+ <div class="covgrid">
1213
+ ${this.data.coverage.map((c) => l`
1214
+ <a class="card covcard" href=${c.uri}>
1215
+ ${c.image ? l`<img class="covimg" src=${c.image} alt="" loading="lazy" />` : p}
1216
+ <div class="covbody">
1217
+ <div class="covtitle">${c.videoDuration ? l`<span class="pill live" style="animation:none">Video</span> ` : p}${c.photos ? l`<span class="pill live" style="animation:none">Photos</span> ` : p}${c.title || c.uri}</div>
1218
+ ${c.description ? l`<p class="covdesc">${c.description}</p>` : p}
1219
+ ${c.author || c.publishedTime ? l`
1220
+ <div class="covmeta">${[c.author, c.publishedTime ? new Date(c.publishedTime).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" }) : ""].filter(Boolean).join(" · ")}</div>
1221
+ ` : p}
1222
+ </div>
1223
+ </a>
1224
+ `)}
1170
1225
  </div>` : p}
1171
1226
  <div class="section-title">Season context</div>
1172
1227
  <div class="cols">
1173
- ${[[e.awayTeamId, r], [e.homeTeamId, o]].map(([c, d]) => this.renderContext(t, c, d))}
1228
+ ${[[e.awayTeamId, r], [e.homeTeamId, o]].map(([c, h]) => this.renderContext(t, c, h))}
1174
1229
  </div>
1175
- ${h.length ? l`
1230
+ ${d.length ? l`
1176
1231
  <div class="section-title">Head to head this season</div>
1177
1232
  <div class="card"><ul class="gamelist">
1178
- ${h.map((c) => l`<li>
1179
- <span class="d">${$(c.date)}</span>${z(c)}
1233
+ ${d.map((c) => l`<li>
1234
+ <span class="d">${$(c.date)}</span>${B(c)}
1180
1235
  <span class="opp">${k(t, c.awayTeamId)} ${c.awayScore}, ${k(t, c.homeTeamId)} ${c.homeScore}</span>
1181
1236
  <a class="box" href=${v(t.hrefs.game, { sport: e.sport, id: c.id })}>Box score →</a>
1182
1237
  </li>`)}
@@ -1186,12 +1241,12 @@ class xe extends b {
1186
1241
  }
1187
1242
  teamBlock(e, t, s, r, o) {
1188
1243
  if (!r) return l`<div class="teamblock ${o ? "right" : ""}"><div class="tname">TBD</div></div>`;
1189
- const n = e.teamsById[s], i = e.records[s], m = B(r, 58);
1244
+ const n = e.teamsById[s], i = e.records[s], m = P(r, 58);
1190
1245
  return l`
1191
1246
  <div class="teamblock ${o ? "right" : ""}">
1192
- ${m ? l`<img class="crest logo" alt="" loading="lazy" src=${m} />` : l`<span class="crest" style="background:${r.colorPrimary || "#030711"};color:${F(r.colorPrimary || "#030711")}">${U(r)}</span>`}
1247
+ ${m ? l`<img class="crest logo" alt="" loading="lazy" src=${m} />` : l`<span class="crest" style="background:${r.colorPrimary || "#030711"};color:${F(r.colorPrimary || "#030711")}">${M(r)}</span>`}
1193
1248
  <div>
1194
- <div class="tname">${j(e, s, t.date)}<a href=${v(e.hrefs.school, { id: r.id })}>${r.name}</a></div>
1249
+ <div class="tname">${G(e, s, t.date)}<a href=${v(e.hrefs.school, { id: r.id })}>${r.name}</a></div>
1195
1250
  <div class="trec">${r.mascot || ""} · ${w(i)}${n?.conferenceId ? l` · ${w(i, !0)} conf` : p}</div>
1196
1251
  </div>
1197
1252
  </div>
@@ -1201,19 +1256,19 @@ class xe extends b {
1201
1256
  const r = e.periodScores || [];
1202
1257
  if (!r.length)
1203
1258
  return l`<p class="empty" style="text-align:center">Period scoring will appear once the game starts.</p>`;
1204
- const o = Math.max(4, ...r.map((h) => h.period)), n = (h) => h <= 4 ? String(h) : `OT${h > 5 ? h - 4 : ""}`, i = (h, c) => {
1205
- const d = r.find((f) => f.period === c);
1206
- return d ? d[h] : e.state === "final" ? 0 : "·";
1207
- }, m = (h, c, d) => l`
1259
+ const o = Math.max(4, ...r.map((d) => d.period)), n = (d) => d <= 4 ? String(d) : `OT${d > 5 ? d - 4 : ""}`, i = (d, c) => {
1260
+ const h = r.find((f) => f.period === c);
1261
+ return h ? h[d] : e.state === "final" ? 0 : "·";
1262
+ }, m = (d, c, h) => l`
1208
1263
  <tr>
1209
- <td class="teamcell">${I(h, 20)}${h?.abbr || "TBD"}</td>
1264
+ <td class="teamcell">${I(d, 20)}${d?.abbr || "TBD"}</td>
1210
1265
  ${Array.from({ length: o }, (f, u) => l`<td class="num">${i(c, u + 1)}</td>`)}
1211
- <td class="num" style="font-weight:700">${d}</td>
1266
+ <td class="num" style="font-weight:700">${h}</td>
1212
1267
  </tr>`;
1213
1268
  return l`
1214
1269
  <div class="tablewrap" style="border-top:1px solid var(--hsot-gray-2)">
1215
1270
  <table class="data" style="max-width:560px;margin:0.6rem auto 0.9rem">
1216
- <thead><tr><th>Team</th>${Array.from({ length: o }, (h, c) => l`<th class="num">${n(c + 1)}</th>`)}<th class="num">T</th></tr></thead>
1271
+ <thead><tr><th>Team</th>${Array.from({ length: o }, (d, c) => l`<th class="num">${n(c + 1)}</th>`)}<th class="num">T</th></tr></thead>
1217
1272
  <tbody>
1218
1273
  ${m(t, "away", e.awayScore)}
1219
1274
  ${m(s, "home", e.homeScore)}
@@ -1224,7 +1279,7 @@ class xe extends b {
1224
1279
  }
1225
1280
  renderContext(e, t, s) {
1226
1281
  if (!s) return p;
1227
- const r = e.records[t], o = M(this.data.games, t);
1282
+ const r = e.records[t], o = H(this.data.games, t);
1228
1283
  return l`
1229
1284
  <div class="card ctxcard">
1230
1285
  <div class="who">${I(s)}${s.name}</div>
@@ -1233,28 +1288,28 @@ class xe extends b {
1233
1288
  <span>Streak: <b>${r ? _(r.results) : "·"}</b></span>
1234
1289
  <span>PF/PA: <b>${r ? `${r.pf} / ${r.pa}` : "·"}</b></span>
1235
1290
  <span>Next: ${o ? l`${$(o.date, { month: "numeric", day: "numeric" })}
1236
- ${o.homeTeamId === t ? "vs" : "at"} ${P(e, o.homeTeamId === t ? o.awayTeamId : o.homeTeamId)}` : "·"}</span>
1291
+ ${o.homeTeamId === t ? "vs" : "at"} ${z(e, o.homeTeamId === t ? o.awayTeamId : o.homeTeamId)}` : "·"}</span>
1237
1292
  </div>
1238
1293
  </div>
1239
1294
  `;
1240
1295
  }
1241
1296
  }
1242
- globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore", xe);
1297
+ globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore", De);
1243
1298
  export {
1244
1299
  N as D,
1245
- xe as H,
1246
- $e as a,
1247
- ye as b,
1248
- ue as c,
1249
- ge as d,
1300
+ De as H,
1301
+ be as a,
1302
+ we as b,
1303
+ ge as c,
1304
+ ve as d,
1250
1305
  D as e,
1251
- se as f,
1306
+ ae as f,
1252
1307
  v as g,
1253
- H as h,
1254
- Te as i,
1308
+ j as h,
1309
+ Fe as i,
1255
1310
  _ as j,
1256
- pe as p,
1311
+ fe as p,
1257
1312
  w as r,
1258
- Q as s,
1313
+ K as s,
1259
1314
  X as t
1260
1315
  };