@wral/hsot-data 0.1.3 → 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,12 +1,12 @@
1
- import { LitElement as Z, html as l, css as $, nothing as p, svg as q } 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) {
@@ -22,8 +22,8 @@ function se({ baseUrl: a, token: e = "", fetchFn: t } = {}) {
22
22
  async function n(i, m = {}) {
23
23
  const d = [];
24
24
  let c = null;
25
- for (let h = 0; h < ee; h += 1) {
26
- const f = te(c ? { ...m, cursor: c } : m), u = await o(`${i}${f}`);
25
+ for (let h = 0; h < te; h += 1) {
26
+ const f = se(c ? { ...m, cursor: c } : m), u = await o(`${i}${f}`);
27
27
  if (d.push(...u.items || []), c = u.nextCursor || null, !c) break;
28
28
  }
29
29
  return { items: d, total: d.length, nextCursor: null };
@@ -44,7 +44,7 @@ function se({ baseUrl: a, token: e = "", fetchFn: t } = {}) {
44
44
  listSports: () => o("/sports")
45
45
  };
46
46
  }
47
- class y 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 y 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 y extends Z {
107
107
  return l``;
108
108
  }
109
109
  }
110
- const g = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ae = $`
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 = $`
141
141
  outline-offset: 1px;
142
142
  }
143
143
  .mut { color: var(--hsot-gray-5); }
144
- `, re = $`
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 = $`
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 = $`
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; }
@@ -204,7 +204,7 @@ const g = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ae = $`
204
204
  .error { padding: 1.2rem 1rem; color: var(--hsot-red-deep); font-size: 0.9rem; }
205
205
  .note { font-size: 0.8125rem; color: var(--hsot-gray-5); margin: 0.6rem 0 0; }
206
206
  .loading { padding: 1.2rem; color: var(--hsot-gray-5); font-family: var(--hsot-heading-font); }
207
- `, ie = $`
207
+ `, ne = y`
208
208
  .pill {
209
209
  display: inline-block; font-family: var(--hsot-heading-font); font-weight: 700;
210
210
  font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.04em;
@@ -219,7 +219,7 @@ const g = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ae = $`
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
- `, ne = $`
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 = $`
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 = $`
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 = $`
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 = $`
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,14 +278,14 @@ const g = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ae = $`
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, ie, ne, 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
290
  const d = m === "home" ? o.homeTeamId : o.awayTeamId;
291
291
  if (!d) continue;
@@ -319,7 +319,7 @@ function K(a, e) {
319
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
325
  function Q(a, e) {
@@ -342,7 +342,7 @@ function C(a) {
342
342
  };
343
343
  }
344
344
  const R = (a) => a ? a.charAt(0).toUpperCase() + a.slice(1) : "";
345
- function b(a, e) {
345
+ function $(a, e) {
346
346
  if (!a) return "TBD";
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" });
@@ -354,7 +354,7 @@ function E(a) {
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
360
  function A(a = /* @__PURE__ */ new Date()) {
@@ -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 j(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: `${b(a.date, { month: "short", day: "numeric" })} · ${E(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 Ce(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));
@@ -407,7 +407,7 @@ function X(a, e, t, s, r) {
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,12 +417,12 @@ 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
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
  }
@@ -439,7 +439,7 @@ function I(a, e = 26) {
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
- >${j(a)}</span>`;
442
+ >${M(a)}</span>`;
443
443
  }
444
444
  function G(a, e, t) {
445
445
  const s = X(a.rankings, a.teamsById, e, a.sport, t);
@@ -460,18 +460,18 @@ function W(a, e, t = 5) {
460
460
  </span>`;
461
461
  }
462
462
  function B(a) {
463
- const e = me(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`${b(e.date, { month: "numeric", day: "numeric" })} `}${r} ${z(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 y {
471
+ class ge extends b {
472
472
  static styles = S;
473
473
  static properties = {
474
- ...y.properties,
474
+ ...b.properties,
475
475
  sport: { type: String },
476
476
  season: { type: String },
477
477
  date: { type: String }
@@ -521,7 +521,7 @@ class ue extends y {
521
521
  <div class="band">
522
522
  <div class="inner">
523
523
  <h1>${R(this.sport)} scores &amp; schedules</h1>
524
- <p class="sub">${b(this.date, { weekday: "long", month: "long", day: "numeric", year: "numeric" })} · ${r.length} games</p>
524
+ <p class="sub">${$(this.date, { weekday: "long", month: "long", day: "numeric", year: "numeric" })} · ${r.length} games</p>
525
525
  </div>
526
526
  </div>
527
527
  <div class="view">
@@ -531,7 +531,7 @@ class ue extends y {
531
531
  this.date = n.target.value;
532
532
  }}>
533
533
  ${s.map((n) => l`<option value=${n} ?selected=${n === this.date}>
534
- ${b(n, { weekday: "short", month: "short", day: "numeric" })}${n === O() ? " · today" : ""}
534
+ ${$(n, { weekday: "short", month: "short", day: "numeric" })}${n === O() ? " · today" : ""}
535
535
  </option>`)}
536
536
  </select>
537
537
  <button class="chip" ?disabled=${s.indexOf(this.date) <= 0}
@@ -569,11 +569,11 @@ class ue extends y {
569
569
  `;
570
570
  }
571
571
  }
572
- globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores", ue);
573
- class ge extends y {
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
- ...y.properties,
576
+ ...b.properties,
577
577
  sport: { type: String },
578
578
  season: { type: String },
579
579
  classFilter: { state: !0 },
@@ -631,7 +631,7 @@ class ge extends y {
631
631
  this.query = r.target.value;
632
632
  }}>
633
633
  <span class="spacer"></span>
634
- <span class="asof">Records through ${b(O(), { month: "long", day: "numeric" })} · conference games count toward both records · scrimmages toward neither</span>
634
+ <span class="asof">Records through ${$(O(), { month: "long", day: "numeric" })} · conference games count toward both records · scrimmages toward neither</span>
635
635
  </div>
636
636
  ${s.map((r) => this.renderConference(e, r))}
637
637
  </div>
@@ -664,7 +664,7 @@ class ge extends y {
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), d = (t.team.championships || []).map((h) => l`
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
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
  };
@@ -686,13 +686,13 @@ class ge extends y {
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 = $`
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,10 +709,10 @@ const ve = $`
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 be extends y {
713
- static styles = [...S, ve];
712
+ class be extends b {
713
+ static styles = [...S, $e];
714
714
  static properties = {
715
- ...y.properties,
715
+ ...b.properties,
716
716
  sport: { type: String },
717
717
  gender: { type: String },
718
718
  season: { type: String },
@@ -772,7 +772,7 @@ class be extends y {
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() {
@@ -793,7 +793,7 @@ class be extends y {
793
793
  this.pollDate = h.target.value;
794
794
  }}>
795
795
  ${t.map((h, f) => l`<option value=${h.effectiveDate} ?selected=${h === r}>
796
- ${b(h.effectiveDate, { month: "long", day: "numeric", year: "numeric" })}${f === 0 ? " · current" : ""}
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}
@@ -842,7 +842,7 @@ class be extends y {
842
842
  renderRow(e, t, s, r, o, n, i, m) {
843
843
  const d = T(e, i);
844
844
  if (!d) return p;
845
- const c = e.records[i], h = Q(e.records, i), f = M(this.data.games, i), u = n[e.teamsById[i]?.conferenceId], x = () => {
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
846
  location.href = v(e.hrefs.school, { id: d.id });
847
847
  };
848
848
  return l`
@@ -858,14 +858,14 @@ class be extends y {
858
858
  <td>${h ? l`<a class="box" style="text-decoration:none" href=${v(e.hrefs.game, { sport: this.sport, id: h.gameId })}>
859
859
  <b style="color:${h.mark === "W" ? "var(--hsot-win)" : h.mark === "L" ? "var(--hsot-loss)" : "var(--hsot-tie)"}">${h.mark}</b>
860
860
  ${h.my}-${h.their} vs ${z(e, h.opp)}</a>` : l`<span class="mut">·</span>`}</td>
861
- <td>${J(e, f, i)}</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
867
  globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings", be);
868
- const ye = $`
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,10 +890,10 @@ const ye = $`
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 $e extends y {
893
+ class we extends b {
894
894
  static styles = [...S, ye];
895
895
  static properties = {
896
- ...y.properties,
896
+ ...b.properties,
897
897
  schoolId: { type: String, attribute: "school-id" },
898
898
  sport: { type: String },
899
899
  season: { type: String },
@@ -953,7 +953,7 @@ class $e extends y {
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
- ${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")}">${j(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">
@@ -986,7 +986,7 @@ class $e extends y {
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>
@@ -1016,13 +1016,13 @@ class $e extends y {
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
1017
  let m = l`<span class="mut">${E(s.time)}</span>`;
1018
1018
  if (s.state === "final") {
1019
- const c = H(s), h = c === "tie" ? "T" : c === (r ? "home" : "away") ? "W" : "L";
1019
+ const c = j(s), h = c === "tie" ? "T" : c === (r ? "home" : "away") ? "W" : "L";
1020
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
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
- <span class="d">${b(s.date)}</span>
1025
+ <span class="d">${$(s.date)}</span>
1026
1026
  ${B(s)}
1027
1027
  <span class="res">${m}</span>
1028
1028
  <span class="opp">${r ? "vs" : "at"} ${U(e, o, s.date)}
@@ -1050,7 +1050,7 @@ class $e extends y {
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,22 +1059,37 @@ class $e extends y {
1059
1059
  `;
1060
1060
  }
1061
1061
  }
1062
- globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school", $e);
1063
- const we = "https://api.wral.com/search";
1064
- function xe(a) {
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
1065
  return a.map((e) => `uri:"${e}"`).join(" OR ");
1066
1066
  }
1067
- function ke(a, e) {
1068
- const t = String(a || we).replace(/\/+$/, ""), s = new URLSearchParams({ query: xe(e), sort: "score", lang: "en" });
1067
+ function Te(a, e) {
1068
+ const t = String(a || xe).replace(/\/+$/, ""), s = new URLSearchParams({ query: ke(e), sort: "score", lang: "en" });
1069
1069
  return `${t}/v1/query?${s}`;
1070
1070
  }
1071
- async function Te(a, e, t) {
1072
- const r = await ((...i) => fetch(...i))(ke(a, e));
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));
1073
1088
  if (!r.ok) throw new Error(`search answered ${r.status}`);
1074
1089
  const o = await r.json(), n = new Map((o.items || []).map((i) => [i.uri, i]));
1075
- return e.map((i) => n.get(i) || { uri: i, title: i });
1090
+ return e.map((i) => n.get(i) || J(i));
1076
1091
  }
1077
- const Ie = $`
1092
+ const Se = y`
1078
1093
  .breadcrumbs { font-size: 0.8125rem; margin: 0.9rem 0 0; color: var(--hsot-gray-5); }
1079
1094
  .breadcrumbs a { text-decoration: none; }
1080
1095
  .scorehead { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center; padding: 1.4rem 1rem; }
@@ -1113,10 +1128,10 @@ const Ie = $`
1113
1128
  .cols { grid-template-columns: 1fr; }
1114
1129
  }
1115
1130
  `;
1116
- class Se extends y {
1117
- static styles = [...S, Ie];
1131
+ class De extends b {
1132
+ static styles = [...S, Se];
1118
1133
  static properties = {
1119
- ...y.properties,
1134
+ ...b.properties,
1120
1135
  gameId: { type: String, attribute: "game-id" },
1121
1136
  // The public site search that resolves Game.coverageUrls into cards
1122
1137
  // (DEV-1236). Shared cross-stage by design — see the studio host's
@@ -1136,7 +1151,7 @@ class Se extends y {
1136
1151
  e.listGames({ sport: t.sport, season: t.season }),
1137
1152
  // A search outage must not blank the box score — degrade to bare
1138
1153
  // links (fetchCoverage already degrades per-URL index misses).
1139
- s.length ? Te(this.searchApi, s).catch(() => s.map((c) => ({ uri: c, title: c }))) : Promise.resolve([])
1154
+ s.length ? Ie(this.searchApi, s).catch(() => s.map(J)) : Promise.resolve([])
1140
1155
  ]);
1141
1156
  return {
1142
1157
  game: t,
@@ -1161,7 +1176,7 @@ class Se extends y {
1161
1176
  renderView() {
1162
1177
  const e = this.data.game;
1163
1178
  if (!e) return l`<div class="view"><p class="empty">Game not found.</p></div>`;
1164
- 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, 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));
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));
1165
1180
  return l`
1166
1181
  <div class="view">
1167
1182
  <p class="breadcrumbs">
@@ -1179,7 +1194,7 @@ class Se extends y {
1179
1194
  <span style=${i("home")}>${e.homeScore}</span>
1180
1195
  </div>
1181
1196
  <div class="status">${B(e)}</div>
1182
- <div class="status">${b(e.date, { weekday: "short", month: "short", day: "numeric", year: "numeric" })}${e.state === "scheduled" && e.time ? l` · ${E(e.time)}` : p} · ${e.venue || "Venue TBD"}
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"}
1183
1198
  ${e.broadcast ? l` · <span class="pill class">${e.broadcast}</span>` : p}</div>
1184
1199
  <div class="status">
1185
1200
  <span class="pill type">${e.gameType === "conference" ? `${m?.name || "Conference"} game` : e.gameType}</span>
@@ -1199,7 +1214,7 @@ class Se extends y {
1199
1214
  <a class="card covcard" href=${c.uri}>
1200
1215
  ${c.image ? l`<img class="covimg" src=${c.image} alt="" loading="lazy" />` : p}
1201
1216
  <div class="covbody">
1202
- <div class="covtitle">${c.videoDuration ? l`<span class="pill live" style="animation:none">Video</span> ` : p}${c.title || c.uri}</div>
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>
1203
1218
  ${c.description ? l`<p class="covdesc">${c.description}</p>` : p}
1204
1219
  ${c.author || c.publishedTime ? l`
1205
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>
@@ -1216,7 +1231,7 @@ class Se extends y {
1216
1231
  <div class="section-title">Head to head this season</div>
1217
1232
  <div class="card"><ul class="gamelist">
1218
1233
  ${d.map((c) => l`<li>
1219
- <span class="d">${b(c.date)}</span>${B(c)}
1234
+ <span class="d">${$(c.date)}</span>${B(c)}
1220
1235
  <span class="opp">${k(t, c.awayTeamId)} ${c.awayScore}, ${k(t, c.homeTeamId)} ${c.homeScore}</span>
1221
1236
  <a class="box" href=${v(t.hrefs.game, { sport: e.sport, id: c.id })}>Box score →</a>
1222
1237
  </li>`)}
@@ -1229,7 +1244,7 @@ class Se extends y {
1229
1244
  const n = e.teamsById[s], i = e.records[s], m = P(r, 58);
1230
1245
  return l`
1231
1246
  <div class="teamblock ${o ? "right" : ""}">
1232
- ${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")}">${j(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>`}
1233
1248
  <div>
1234
1249
  <div class="tname">${G(e, s, t.date)}<a href=${v(e.hrefs.school, { id: r.id })}>${r.name}</a></div>
1235
1250
  <div class="trec">${r.mascot || ""} · ${w(i)}${n?.conferenceId ? l` · ${w(i, !0)} conf` : p}</div>
@@ -1264,7 +1279,7 @@ class Se extends y {
1264
1279
  }
1265
1280
  renderContext(e, t, s) {
1266
1281
  if (!s) return p;
1267
- const r = e.records[t], o = M(this.data.games, t);
1282
+ const r = e.records[t], o = H(this.data.games, t);
1268
1283
  return l`
1269
1284
  <div class="card ctxcard">
1270
1285
  <div class="who">${I(s)}${s.name}</div>
@@ -1272,28 +1287,28 @@ class Se extends y {
1272
1287
  <span>Last 5: ${W(e, t)}</span>
1273
1288
  <span>Streak: <b>${r ? _(r.results) : "·"}</b></span>
1274
1289
  <span>PF/PA: <b>${r ? `${r.pf} / ${r.pa}` : "·"}</b></span>
1275
- <span>Next: ${o ? l`${b(o.date, { month: "numeric", day: "numeric" })}
1290
+ <span>Next: ${o ? l`${$(o.date, { month: "numeric", day: "numeric" })}
1276
1291
  ${o.homeTeamId === t ? "vs" : "at"} ${z(e, o.homeTeamId === t ? o.awayTeamId : o.homeTeamId)}` : "·"}</span>
1277
1292
  </div>
1278
1293
  </div>
1279
1294
  `;
1280
1295
  }
1281
1296
  }
1282
- globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore", Se);
1297
+ globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore", De);
1283
1298
  export {
1284
1299
  N as D,
1285
- Se as H,
1300
+ De as H,
1286
1301
  be as a,
1287
- $e as b,
1288
- ue as c,
1289
- ge as d,
1302
+ we as b,
1303
+ ge as c,
1304
+ ve as d,
1290
1305
  D as e,
1291
- se as f,
1306
+ ae as f,
1292
1307
  v as g,
1293
- H as h,
1294
- Ce as i,
1308
+ j as h,
1309
+ Fe as i,
1295
1310
  _ as j,
1296
- pe as p,
1311
+ fe as p,
1297
1312
  w as r,
1298
1313
  K as s,
1299
1314
  X as t
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { D as o, H as e, a as t, b as r, c as n, d as l, e as c, f as i, g as H, h as g, p as d, r as m, i as R, s as S, j as f, t as p } from "./hsot-boxscore-CY8jCxLh.js";
1
+ import { D as o, H as e, a as t, b as r, c as n, d as l, e as c, f as i, g as H, h as g, p as d, r as m, i as R, s as S, j as f, t as p } from "./hsot-boxscore-HfW4EnqW.js";
2
2
  export {
3
3
  o as DEFAULT_HREFS,
4
4
  e as HsotBoxscore,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wral/hsot-data",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "type": "module",
5
5
  "description": "Lit web components for the HighSchoolOT public data pages: scores/schedules, standings, rankings, school pages, and box scores, rendered from api-hsot v1 read payloads.",
6
6
  "author": "WRAL Digital",