@wral/hsot-data 0.2.0 → 0.3.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 +14 -2
- package/dist/client.mjs +49 -0
- package/dist/define.mjs +1 -1
- package/dist/define.standalone.js +536 -508
- package/dist/{hsot-brackets-D5cwGage.js → hsot-brackets-Cc0zj07F.js} +537 -555
- package/dist/index.mjs +16 -15
- package/package.json +2 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const J = globalThis, dt = J.ShadowRoot && (J.ShadyCSS === void 0 || J.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, pt = /* @__PURE__ */ Symbol(), St = /* @__PURE__ */ new WeakMap();
|
|
2
2
|
let Gt = class {
|
|
3
3
|
constructor(t, e, s) {
|
|
4
4
|
if (this._$cssResult$ = !0, s !== pt) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
@@ -17,28 +17,28 @@ let Gt = class {
|
|
|
17
17
|
return this.cssText;
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
-
const
|
|
20
|
+
const fe = (a) => new Gt(typeof a == "string" ? a : a + "", void 0, pt), y = (a, ...t) => {
|
|
21
21
|
const e = a.length === 1 ? a[0] : t.reduce((s, r, o) => s + ((n) => {
|
|
22
22
|
if (n._$cssResult$ === !0) return n.cssText;
|
|
23
23
|
if (typeof n == "number") return n;
|
|
24
24
|
throw Error("Value passed to 'css' function must be a 'css' function result: " + n + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
25
25
|
})(r) + a[o + 1], a[0]);
|
|
26
26
|
return new Gt(e, a, pt);
|
|
27
|
-
},
|
|
27
|
+
}, ge = (a, t) => {
|
|
28
28
|
if (dt) a.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
|
|
29
29
|
else for (const e of t) {
|
|
30
|
-
const s = document.createElement("style"), r =
|
|
30
|
+
const s = document.createElement("style"), r = J.litNonce;
|
|
31
31
|
r !== void 0 && s.setAttribute("nonce", r), s.textContent = e.cssText, a.appendChild(s);
|
|
32
32
|
}
|
|
33
33
|
}, _t = dt ? (a) => a : (a) => a instanceof CSSStyleSheet ? ((t) => {
|
|
34
34
|
let e = "";
|
|
35
35
|
for (const s of t.cssRules) e += s.cssText;
|
|
36
|
-
return
|
|
36
|
+
return fe(e);
|
|
37
37
|
})(a) : a;
|
|
38
|
-
const { is:
|
|
38
|
+
const { is: ve, defineProperty: $e, getOwnPropertyDescriptor: be, getOwnPropertyNames: ye, getOwnPropertySymbols: we, getPrototypeOf: xe } = Object, rt = globalThis, At = rt.trustedTypes, ke = At ? At.emptyScript : "", Se = rt.reactiveElementPolyfillSupport, G = (a, t) => a, ht = { toAttribute(a, t) {
|
|
39
39
|
switch (t) {
|
|
40
40
|
case Boolean:
|
|
41
|
-
a = a ?
|
|
41
|
+
a = a ? ke : null;
|
|
42
42
|
break;
|
|
43
43
|
case Object:
|
|
44
44
|
case Array:
|
|
@@ -63,8 +63,8 @@ const { is: ge, defineProperty: ve, getOwnPropertyDescriptor: $e, getOwnProperty
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
return e;
|
|
66
|
-
} }, jt = (a, t) => !
|
|
67
|
-
Symbol.metadata ??= /* @__PURE__ */ Symbol("metadata"),
|
|
66
|
+
} }, jt = (a, t) => !ve(a, t), Tt = { attribute: !0, type: String, converter: ht, reflect: !1, useDefault: !1, hasChanged: jt };
|
|
67
|
+
Symbol.metadata ??= /* @__PURE__ */ Symbol("metadata"), rt.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
68
68
|
let z = class extends HTMLElement {
|
|
69
69
|
static addInitializer(t) {
|
|
70
70
|
this._$Ei(), (this.l ??= []).push(t);
|
|
@@ -75,11 +75,11 @@ let z = class extends HTMLElement {
|
|
|
75
75
|
static createProperty(t, e = Tt) {
|
|
76
76
|
if (e.state && (e.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(t) && ((e = Object.create(e)).wrapped = !0), this.elementProperties.set(t, e), !e.noAccessor) {
|
|
77
77
|
const s = /* @__PURE__ */ Symbol(), r = this.getPropertyDescriptor(t, s, e);
|
|
78
|
-
r !== void 0 &&
|
|
78
|
+
r !== void 0 && $e(this.prototype, t, r);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
static getPropertyDescriptor(t, e, s) {
|
|
82
|
-
const { get: r, set: o } =
|
|
82
|
+
const { get: r, set: o } = be(this.prototype, t) ?? { get() {
|
|
83
83
|
return this[e];
|
|
84
84
|
}, set(n) {
|
|
85
85
|
this[e] = n;
|
|
@@ -93,14 +93,14 @@ let z = class extends HTMLElement {
|
|
|
93
93
|
return this.elementProperties.get(t) ?? Tt;
|
|
94
94
|
}
|
|
95
95
|
static _$Ei() {
|
|
96
|
-
if (this.hasOwnProperty(
|
|
97
|
-
const t =
|
|
96
|
+
if (this.hasOwnProperty(G("elementProperties"))) return;
|
|
97
|
+
const t = xe(this);
|
|
98
98
|
t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
|
|
99
99
|
}
|
|
100
100
|
static finalize() {
|
|
101
|
-
if (this.hasOwnProperty(
|
|
102
|
-
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(
|
|
103
|
-
const e = this.properties, s = [...
|
|
101
|
+
if (this.hasOwnProperty(G("finalized"))) return;
|
|
102
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(G("properties"))) {
|
|
103
|
+
const e = this.properties, s = [...ye(e), ...we(e)];
|
|
104
104
|
for (const r of s) this.createProperty(r, e[r]);
|
|
105
105
|
}
|
|
106
106
|
const t = this[Symbol.metadata];
|
|
@@ -146,7 +146,7 @@ let z = class extends HTMLElement {
|
|
|
146
146
|
}
|
|
147
147
|
createRenderRoot() {
|
|
148
148
|
const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
149
|
-
return
|
|
149
|
+
return ge(t, this.constructor.elementStyles), t;
|
|
150
150
|
}
|
|
151
151
|
connectedCallback() {
|
|
152
152
|
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach((t) => t.hostConnected?.());
|
|
@@ -246,54 +246,54 @@ let z = class extends HTMLElement {
|
|
|
246
246
|
firstUpdated(t) {
|
|
247
247
|
}
|
|
248
248
|
};
|
|
249
|
-
z.elementStyles = [], z.shadowRootOptions = { mode: "open" }, z[
|
|
250
|
-
const mt = globalThis, It = (a) => a,
|
|
251
|
-
\f\r]`, H = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Et = /-->/g, Pt = />/g, A = RegExp(`>|${
|
|
252
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"),
|
|
249
|
+
z.elementStyles = [], z.shadowRootOptions = { mode: "open" }, z[G("elementProperties")] = /* @__PURE__ */ new Map(), z[G("finalized")] = /* @__PURE__ */ new Map(), Se?.({ ReactiveElement: z }), (rt.reactiveElementVersions ??= []).push("2.1.2");
|
|
250
|
+
const mt = globalThis, It = (a) => a, X = mt.trustedTypes, Ct = X ? X.createPolicy("lit-html", { createHTML: (a) => a }) : void 0, qt = "$lit$", S = `lit$${Math.random().toFixed(9).slice(2)}$`, Wt = "?" + S, _e = `<${Wt}>`, I = document, j = () => I.createComment(""), q = (a) => a === null || typeof a != "object" && typeof a != "function", ut = Array.isArray, Ae = (a) => ut(a) || typeof a?.[Symbol.iterator] == "function", ct = `[
|
|
251
|
+
\f\r]`, H = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Et = /-->/g, Pt = />/g, A = RegExp(`>|${ct}(?:([^\\s"'>=/]+)(${ct}*=${ct}*(?:[^
|
|
252
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), Bt = /'/g, Dt = /"/g, Vt = /^(?:script|style|textarea|title)$/i, Yt = (a) => (t, ...e) => ({ _$litType$: a, strings: t, values: e }), l = Yt(1), zt = Yt(2), M = /* @__PURE__ */ Symbol.for("lit-noChange"), m = /* @__PURE__ */ Symbol.for("lit-nothing"), Rt = /* @__PURE__ */ new WeakMap(), T = I.createTreeWalker(I, 129);
|
|
253
253
|
function Kt(a, t) {
|
|
254
254
|
if (!ut(a) || !a.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
255
255
|
return Ct !== void 0 ? Ct.createHTML(t) : t;
|
|
256
256
|
}
|
|
257
|
-
const
|
|
257
|
+
const Te = (a, t) => {
|
|
258
258
|
const e = a.length - 1, s = [];
|
|
259
259
|
let r, o = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", n = H;
|
|
260
260
|
for (let i = 0; i < e; i++) {
|
|
261
|
-
const
|
|
262
|
-
let
|
|
263
|
-
for (; u <
|
|
261
|
+
const c = a[i];
|
|
262
|
+
let h, d, p = -1, u = 0;
|
|
263
|
+
for (; u < c.length && (n.lastIndex = u, d = n.exec(c), d !== null); ) u = n.lastIndex, n === H ? d[1] === "!--" ? n = Et : d[1] !== void 0 ? n = Pt : d[2] !== void 0 ? (Vt.test(d[2]) && (r = RegExp("</" + d[2], "g")), n = A) : d[3] !== void 0 && (n = A) : n === A ? d[0] === ">" ? (n = r ?? H, p = -1) : d[1] === void 0 ? p = -2 : (p = n.lastIndex - d[2].length, h = d[1], n = d[3] === void 0 ? A : d[3] === '"' ? Dt : Bt) : n === Dt || n === Bt ? n = A : n === Et || n === Pt ? n = H : (n = A, r = void 0);
|
|
264
264
|
const f = n === A && a[i + 1].startsWith("/>") ? " " : "";
|
|
265
|
-
o += n === H ?
|
|
265
|
+
o += n === H ? c + _e : p >= 0 ? (s.push(h), c.slice(0, p) + qt + c.slice(p) + S + f) : c + S + (p === -2 ? i : f);
|
|
266
266
|
}
|
|
267
267
|
return [Kt(a, o + (a[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), s];
|
|
268
268
|
};
|
|
269
|
-
class
|
|
269
|
+
class W {
|
|
270
270
|
constructor({ strings: t, _$litType$: e }, s) {
|
|
271
271
|
let r;
|
|
272
272
|
this.parts = [];
|
|
273
273
|
let o = 0, n = 0;
|
|
274
|
-
const i = t.length - 1,
|
|
275
|
-
if (this.el =
|
|
274
|
+
const i = t.length - 1, c = this.parts, [h, d] = Te(t, e);
|
|
275
|
+
if (this.el = W.createElement(h, s), T.currentNode = this.el.content, e === 2 || e === 3) {
|
|
276
276
|
const p = this.el.content.firstChild;
|
|
277
277
|
p.replaceWith(...p.childNodes);
|
|
278
278
|
}
|
|
279
|
-
for (; (r = T.nextNode()) !== null &&
|
|
279
|
+
for (; (r = T.nextNode()) !== null && c.length < i; ) {
|
|
280
280
|
if (r.nodeType === 1) {
|
|
281
281
|
if (r.hasAttributes()) for (const p of r.getAttributeNames()) if (p.endsWith(qt)) {
|
|
282
282
|
const u = d[n++], f = r.getAttribute(p).split(S), g = /([.?@])?(.*)/.exec(u);
|
|
283
|
-
|
|
284
|
-
} else p.startsWith(S) && (
|
|
283
|
+
c.push({ type: 1, index: o, name: g[2], strings: f, ctor: g[1] === "." ? Ce : g[1] === "?" ? Ee : g[1] === "@" ? Pe : ot }), r.removeAttribute(p);
|
|
284
|
+
} else p.startsWith(S) && (c.push({ type: 6, index: o }), r.removeAttribute(p));
|
|
285
285
|
if (Vt.test(r.tagName)) {
|
|
286
286
|
const p = r.textContent.split(S), u = p.length - 1;
|
|
287
287
|
if (u > 0) {
|
|
288
|
-
r.textContent =
|
|
289
|
-
for (let f = 0; f < u; f++) r.append(p[f],
|
|
290
|
-
r.append(p[u],
|
|
288
|
+
r.textContent = X ? X.emptyScript : "";
|
|
289
|
+
for (let f = 0; f < u; f++) r.append(p[f], j()), T.nextNode(), c.push({ type: 2, index: ++o });
|
|
290
|
+
r.append(p[u], j());
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
|
-
} else if (r.nodeType === 8) if (r.data === Wt)
|
|
293
|
+
} else if (r.nodeType === 8) if (r.data === Wt) c.push({ type: 2, index: o });
|
|
294
294
|
else {
|
|
295
295
|
let p = -1;
|
|
296
|
-
for (; (p = r.data.indexOf(S, p + 1)) !== -1; )
|
|
296
|
+
for (; (p = r.data.indexOf(S, p + 1)) !== -1; ) c.push({ type: 7, index: o }), p += S.length - 1;
|
|
297
297
|
}
|
|
298
298
|
o++;
|
|
299
299
|
}
|
|
@@ -306,10 +306,10 @@ class q {
|
|
|
306
306
|
function F(a, t, e = a, s) {
|
|
307
307
|
if (t === M) return t;
|
|
308
308
|
let r = s !== void 0 ? e._$Co?.[s] : e._$Cl;
|
|
309
|
-
const o =
|
|
309
|
+
const o = q(t) ? void 0 : t._$litDirective$;
|
|
310
310
|
return r?.constructor !== o && (r?._$AO?.(!1), o === void 0 ? r = void 0 : (r = new o(a), r._$AT(a, e, s)), s !== void 0 ? (e._$Co ??= [])[s] = r : e._$Cl = r), r !== void 0 && (t = F(a, r._$AS(a, t.values), r, s)), t;
|
|
311
311
|
}
|
|
312
|
-
class
|
|
312
|
+
class Ie {
|
|
313
313
|
constructor(t, e) {
|
|
314
314
|
this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
|
|
315
315
|
}
|
|
@@ -322,13 +322,13 @@ class Te {
|
|
|
322
322
|
u(t) {
|
|
323
323
|
const { el: { content: e }, parts: s } = this._$AD, r = (t?.creationScope ?? I).importNode(e, !0);
|
|
324
324
|
T.currentNode = r;
|
|
325
|
-
let o = T.nextNode(), n = 0, i = 0,
|
|
326
|
-
for (;
|
|
327
|
-
if (n ===
|
|
328
|
-
let
|
|
329
|
-
|
|
325
|
+
let o = T.nextNode(), n = 0, i = 0, c = s[0];
|
|
326
|
+
for (; c !== void 0; ) {
|
|
327
|
+
if (n === c.index) {
|
|
328
|
+
let h;
|
|
329
|
+
c.type === 2 ? h = new Y(o, o.nextSibling, this, t) : c.type === 1 ? h = new c.ctor(o, c.name, c.strings, this, t) : c.type === 6 && (h = new Be(o, this, t)), this._$AV.push(h), c = s[++i];
|
|
330
330
|
}
|
|
331
|
-
n !==
|
|
331
|
+
n !== c?.index && (o = T.nextNode(), n++);
|
|
332
332
|
}
|
|
333
333
|
return T.currentNode = I, r;
|
|
334
334
|
}
|
|
@@ -337,7 +337,7 @@ class Te {
|
|
|
337
337
|
for (const s of this._$AV) s !== void 0 && (s.strings !== void 0 ? (s._$AI(t, s, e), e += s.strings.length - 2) : s._$AI(t[e])), e++;
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
|
-
class
|
|
340
|
+
class Y {
|
|
341
341
|
get _$AU() {
|
|
342
342
|
return this._$AM?._$AU ?? this._$Cv;
|
|
343
343
|
}
|
|
@@ -356,7 +356,7 @@ class V {
|
|
|
356
356
|
return this._$AB;
|
|
357
357
|
}
|
|
358
358
|
_$AI(t, e = this) {
|
|
359
|
-
t = F(this, t, e),
|
|
359
|
+
t = F(this, t, e), q(t) ? t === m || t == null || t === "" ? (this._$AH !== m && this._$AR(), this._$AH = m) : t !== this._$AH && t !== M && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : Ae(t) ? this.k(t) : this._(t);
|
|
360
360
|
}
|
|
361
361
|
O(t) {
|
|
362
362
|
return this._$AA.parentNode.insertBefore(t, this._$AB);
|
|
@@ -365,25 +365,25 @@ class V {
|
|
|
365
365
|
this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
|
|
366
366
|
}
|
|
367
367
|
_(t) {
|
|
368
|
-
this._$AH !== m &&
|
|
368
|
+
this._$AH !== m && q(this._$AH) ? this._$AA.nextSibling.data = t : this.T(I.createTextNode(t)), this._$AH = t;
|
|
369
369
|
}
|
|
370
370
|
$(t) {
|
|
371
|
-
const { values: e, _$litType$: s } = t, r = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el =
|
|
371
|
+
const { values: e, _$litType$: s } = t, r = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = W.createElement(Kt(s.h, s.h[0]), this.options)), s);
|
|
372
372
|
if (this._$AH?._$AD === r) this._$AH.p(e);
|
|
373
373
|
else {
|
|
374
|
-
const o = new
|
|
374
|
+
const o = new Ie(r, this), n = o.u(this.options);
|
|
375
375
|
o.p(e), this.T(n), this._$AH = o;
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
378
|
_$AC(t) {
|
|
379
379
|
let e = Rt.get(t.strings);
|
|
380
|
-
return e === void 0 && Rt.set(t.strings, e = new
|
|
380
|
+
return e === void 0 && Rt.set(t.strings, e = new W(t)), e;
|
|
381
381
|
}
|
|
382
382
|
k(t) {
|
|
383
383
|
ut(this._$AH) || (this._$AH = [], this._$AR());
|
|
384
384
|
const e = this._$AH;
|
|
385
385
|
let s, r = 0;
|
|
386
|
-
for (const o of t) r === e.length ? e.push(s = new
|
|
386
|
+
for (const o of t) r === e.length ? e.push(s = new Y(this.O(j()), this.O(j()), this, this.options)) : s = e[r], s._$AI(o), r++;
|
|
387
387
|
r < e.length && (this._$AR(s && s._$AB.nextSibling, r), e.length = r);
|
|
388
388
|
}
|
|
389
389
|
_$AR(t = this._$AA.nextSibling, e) {
|
|
@@ -396,7 +396,7 @@ class V {
|
|
|
396
396
|
this._$AM === void 0 && (this._$Cv = t, this._$AP?.(t));
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
|
-
class
|
|
399
|
+
class ot {
|
|
400
400
|
get tagName() {
|
|
401
401
|
return this.element.tagName;
|
|
402
402
|
}
|
|
@@ -409,11 +409,11 @@ class rt {
|
|
|
409
409
|
_$AI(t, e = this, s, r) {
|
|
410
410
|
const o = this.strings;
|
|
411
411
|
let n = !1;
|
|
412
|
-
if (o === void 0) t = F(this, t, e, 0), n = !
|
|
412
|
+
if (o === void 0) t = F(this, t, e, 0), n = !q(t) || t !== this._$AH && t !== M, n && (this._$AH = t);
|
|
413
413
|
else {
|
|
414
414
|
const i = t;
|
|
415
|
-
let
|
|
416
|
-
for (t = o[0],
|
|
415
|
+
let c, h;
|
|
416
|
+
for (t = o[0], c = 0; c < o.length - 1; c++) h = F(this, i[s + c], e, c), h === M && (h = this._$AH[c]), n ||= !q(h) || h !== this._$AH[c], h === m ? t = m : t !== m && (t += (h ?? "") + o[c + 1]), this._$AH[c] = h;
|
|
417
417
|
}
|
|
418
418
|
n && !r && this.j(t);
|
|
419
419
|
}
|
|
@@ -421,7 +421,7 @@ class rt {
|
|
|
421
421
|
t === m ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
|
-
class
|
|
424
|
+
class Ce extends ot {
|
|
425
425
|
constructor() {
|
|
426
426
|
super(...arguments), this.type = 3;
|
|
427
427
|
}
|
|
@@ -429,7 +429,7 @@ class Ie extends rt {
|
|
|
429
429
|
this.element[this.name] = t === m ? void 0 : t;
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
|
-
class
|
|
432
|
+
class Ee extends ot {
|
|
433
433
|
constructor() {
|
|
434
434
|
super(...arguments), this.type = 4;
|
|
435
435
|
}
|
|
@@ -437,7 +437,7 @@ class Ce extends rt {
|
|
|
437
437
|
this.element.toggleAttribute(this.name, !!t && t !== m);
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
|
-
class
|
|
440
|
+
class Pe extends ot {
|
|
441
441
|
constructor(t, e, s, r, o) {
|
|
442
442
|
super(t, e, s, r, o), this.type = 5;
|
|
443
443
|
}
|
|
@@ -450,7 +450,7 @@ class Ee extends rt {
|
|
|
450
450
|
typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, t) : this._$AH.handleEvent(t);
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
|
-
class
|
|
453
|
+
class Be {
|
|
454
454
|
constructor(t, e, s) {
|
|
455
455
|
this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = s;
|
|
456
456
|
}
|
|
@@ -462,13 +462,13 @@ class Pe {
|
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
464
|
const De = mt.litHtmlPolyfillSupport;
|
|
465
|
-
De?.(
|
|
466
|
-
const
|
|
465
|
+
De?.(W, Y), (mt.litHtmlVersions ??= []).push("3.3.3");
|
|
466
|
+
const ze = (a, t, e) => {
|
|
467
467
|
const s = e?.renderBefore ?? t;
|
|
468
468
|
let r = s._$litPart$;
|
|
469
469
|
if (r === void 0) {
|
|
470
470
|
const o = e?.renderBefore ?? null;
|
|
471
|
-
s._$litPart$ = r = new
|
|
471
|
+
s._$litPart$ = r = new Y(t.insertBefore(j(), o), o, void 0, e ?? {});
|
|
472
472
|
}
|
|
473
473
|
return r._$AI(a), r;
|
|
474
474
|
};
|
|
@@ -483,7 +483,7 @@ class N extends z {
|
|
|
483
483
|
}
|
|
484
484
|
update(t) {
|
|
485
485
|
const e = this.render();
|
|
486
|
-
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do =
|
|
486
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = ze(e, this.renderRoot, this.renderOptions);
|
|
487
487
|
}
|
|
488
488
|
connectedCallback() {
|
|
489
489
|
super.connectedCallback(), this._$Do?.setConnected(!0);
|
|
@@ -496,37 +496,37 @@ class N extends z {
|
|
|
496
496
|
}
|
|
497
497
|
}
|
|
498
498
|
N._$litElement$ = !0, N.finalized = !0, ft.litElementHydrateSupport?.({ LitElement: N });
|
|
499
|
-
const
|
|
500
|
-
|
|
499
|
+
const Re = ft.litElementPolyfillSupport;
|
|
500
|
+
Re?.({ LitElement: N });
|
|
501
501
|
(ft.litElementVersions ??= []).push("4.2.2");
|
|
502
|
-
const
|
|
503
|
-
function
|
|
502
|
+
const Ne = 50;
|
|
503
|
+
function Me(a = {}) {
|
|
504
504
|
const t = Object.entries(a).filter(([, s]) => s != null && s !== "");
|
|
505
505
|
if (!t.length) return "";
|
|
506
506
|
const e = new URLSearchParams();
|
|
507
507
|
return t.forEach(([s, r]) => e.set(s, String(r))), `?${e.toString()}`;
|
|
508
508
|
}
|
|
509
|
-
function
|
|
509
|
+
function Fe({ baseUrl: a, token: t = "", fetchFn: e } = {}) {
|
|
510
510
|
if (!a) throw new Error("createClient requires a baseUrl");
|
|
511
511
|
const s = a.replace(/\/+$/, ""), r = e || ((...i) => fetch(...i));
|
|
512
512
|
async function o(i) {
|
|
513
|
-
const
|
|
514
|
-
t && (
|
|
515
|
-
const
|
|
516
|
-
if (!
|
|
517
|
-
const d = new Error(`api-hsot ${
|
|
518
|
-
throw d.status =
|
|
513
|
+
const c = { Accept: "application/json" };
|
|
514
|
+
t && (c.Authorization = `Bearer ${t}`);
|
|
515
|
+
const h = await r(`${s}${i}`, { headers: c });
|
|
516
|
+
if (!h.ok) {
|
|
517
|
+
const d = new Error(`api-hsot ${h.status} on ${i}`);
|
|
518
|
+
throw d.status = h.status, d;
|
|
519
519
|
}
|
|
520
|
-
return
|
|
520
|
+
return h.json();
|
|
521
521
|
}
|
|
522
|
-
async function n(i,
|
|
523
|
-
const
|
|
522
|
+
async function n(i, c = {}) {
|
|
523
|
+
const h = [];
|
|
524
524
|
let d = null;
|
|
525
|
-
for (let p = 0; p <
|
|
526
|
-
const u =
|
|
527
|
-
if (
|
|
525
|
+
for (let p = 0; p < Ne; p += 1) {
|
|
526
|
+
const u = Me(d ? { ...c, cursor: d } : c), f = await o(`${i}${u}`);
|
|
527
|
+
if (h.push(...f.items || []), d = f.nextCursor || null, !d) break;
|
|
528
528
|
}
|
|
529
|
-
return { items:
|
|
529
|
+
return { items: h, total: h.length, nextCursor: null };
|
|
530
530
|
}
|
|
531
531
|
return {
|
|
532
532
|
listSchools: (i) => n("/schools", i),
|
|
@@ -539,28 +539,36 @@ function Me({ baseUrl: a, token: t = "", fetchFn: e } = {}) {
|
|
|
539
539
|
listGames: (i) => n("/games", i),
|
|
540
540
|
getGame: (i) => o(`/games/${i}`),
|
|
541
541
|
listTournaments: (i) => n("/tournaments", i),
|
|
542
|
-
listSeedings: (i,
|
|
543
|
-
listEdges: (i,
|
|
542
|
+
listSeedings: (i, c) => n(`/tournaments/${i}/seedings`, c),
|
|
543
|
+
listEdges: (i, c) => n(`/tournaments/${i}/edges`, c),
|
|
544
544
|
listRankings: (i) => n("/rankings", i),
|
|
545
545
|
listSports: () => o("/sports")
|
|
546
546
|
};
|
|
547
547
|
}
|
|
548
|
-
const
|
|
548
|
+
const L = {
|
|
549
549
|
game: "/{sport}/game/{id}/",
|
|
550
550
|
school: "/school/{id}/",
|
|
551
|
-
section: "/{sport}/{view}/"
|
|
551
|
+
section: "/{sport}/{view}/",
|
|
552
|
+
// The "Report a Score" page; {id} is the game being reported on, and
|
|
553
|
+
// reportHref() drops the parameter when there is none.
|
|
554
|
+
report: "/report-a-score/?game={id}"
|
|
552
555
|
};
|
|
553
556
|
function v(a, t) {
|
|
554
557
|
return String(a).replace(/\{(\w+)\}/g, (e, s) => t[s] !== void 0 && t[s] !== null ? String(t[s]) : e);
|
|
555
558
|
}
|
|
556
559
|
function O(a) {
|
|
557
560
|
return {
|
|
558
|
-
game: a.getAttribute("game-href") ||
|
|
559
|
-
school: a.getAttribute("school-href") ||
|
|
560
|
-
section: a.getAttribute("section-href") ||
|
|
561
|
+
game: a.getAttribute("game-href") || L.game,
|
|
562
|
+
school: a.getAttribute("school-href") || L.school,
|
|
563
|
+
section: a.getAttribute("section-href") || L.section,
|
|
564
|
+
report: a.getAttribute("report-href") || L.report
|
|
561
565
|
};
|
|
562
566
|
}
|
|
563
|
-
|
|
567
|
+
function Qt(a, t = "") {
|
|
568
|
+
const e = v(a.report || L.report, { id: t || "" });
|
|
569
|
+
return t ? e : e.replace(/([?&])game=(?=&|$)/, "$1").replace(/[?&]$/, "").replace(/\?&/, "?");
|
|
570
|
+
}
|
|
571
|
+
const D = (a) => a ? a.charAt(0).toUpperCase() + a.slice(1) : "";
|
|
564
572
|
function w(a, t) {
|
|
565
573
|
if (!a) return "TBD";
|
|
566
574
|
const [e, s, r] = String(a).split("-").map(Number);
|
|
@@ -573,13 +581,13 @@ function gt(a) {
|
|
|
573
581
|
const s = t >= 12 ? "PM" : "AM";
|
|
574
582
|
return `${(t + 11) % 12 + 1}:${String(e || 0).padStart(2, "0")} ${s}`;
|
|
575
583
|
}
|
|
576
|
-
function
|
|
584
|
+
function Oe(a) {
|
|
577
585
|
return a ? `${Math.floor(a / 12)}-${a % 12}` : "·";
|
|
578
586
|
}
|
|
579
|
-
function
|
|
587
|
+
function Ue(a) {
|
|
580
588
|
return (Array.isArray(a?.positions) ? a.positions : String(a?.position ?? "").split(/[/,]/)).map((e) => String(e ?? "").trim()).filter(Boolean).join("/");
|
|
581
589
|
}
|
|
582
|
-
function
|
|
590
|
+
function K(a = /* @__PURE__ */ new Date()) {
|
|
583
591
|
const t = a.getFullYear();
|
|
584
592
|
return a.getMonth() >= 6 ? `${t}-${t + 1}` : `${t - 1}-${t}`;
|
|
585
593
|
}
|
|
@@ -587,7 +595,7 @@ function vt(a = /* @__PURE__ */ new Date()) {
|
|
|
587
595
|
const t = (e) => String(e).padStart(2, "0");
|
|
588
596
|
return `${a.getFullYear()}-${t(a.getMonth() + 1)}-${t(a.getDate())}`;
|
|
589
597
|
}
|
|
590
|
-
function
|
|
598
|
+
function He(a, t = vt()) {
|
|
591
599
|
const e = [...new Set((a || []).filter(Boolean))].sort();
|
|
592
600
|
if (!e.length || e.includes(t)) return t;
|
|
593
601
|
const s = e.filter((r) => r < t);
|
|
@@ -596,12 +604,12 @@ function Ue(a, t = vt()) {
|
|
|
596
604
|
function $t(a) {
|
|
597
605
|
return a ? (a.abbr || a.name || "?").slice(0, 4).toUpperCase() : "?";
|
|
598
606
|
}
|
|
599
|
-
function
|
|
607
|
+
function tt(a) {
|
|
600
608
|
if (!a || !/^#[0-9a-fA-F]{6}$/.test(a)) return "#FFFFFF";
|
|
601
609
|
const t = parseInt(a.slice(1), 16), e = t >> 16 & 255, s = t >> 8 & 255, r = t & 255;
|
|
602
610
|
return 0.299 * e + 0.587 * s + 0.114 * r > 150 ? "#0F1B33" : "#FFFFFF";
|
|
603
611
|
}
|
|
604
|
-
const
|
|
612
|
+
const Le = (a) => {
|
|
605
613
|
const t = ["th", "st", "nd", "rd"], e = a % 100;
|
|
606
614
|
return a + (t[(e - 20) % 10] || t[e] || t[0]);
|
|
607
615
|
};
|
|
@@ -612,11 +620,11 @@ function Nt(a, t) {
|
|
|
612
620
|
}, s = e(a), r = e(t);
|
|
613
621
|
return s !== null && r !== null && s !== r ? r - s : s !== null && r === null ? -1 : s === null && r !== null ? 1 : String(a ?? "").localeCompare(String(t ?? ""), "en", { sensitivity: "base" });
|
|
614
622
|
}
|
|
615
|
-
function
|
|
623
|
+
function Ge(a, t) {
|
|
616
624
|
const e = (s) => String(s?.name ?? s ?? "");
|
|
617
625
|
return e(a).localeCompare(e(t), "en", { numeric: !0, sensitivity: "base" });
|
|
618
626
|
}
|
|
619
|
-
function
|
|
627
|
+
function Zt(a) {
|
|
620
628
|
if (a.state === "live") {
|
|
621
629
|
const t = [a.period, a.clock].filter(Boolean).join(" ");
|
|
622
630
|
return { kind: "live", label: t ? `Live · ${t}` : "Live" };
|
|
@@ -627,7 +635,7 @@ function Qt(a) {
|
|
|
627
635
|
}
|
|
628
636
|
return a.state === "postponed" ? { kind: "warn", label: "Postponed" } : a.state === "canceled" ? { kind: "warn", label: "Canceled" } : { kind: "sched", label: `${w(a.date, { month: "short", day: "numeric" })} · ${gt(a.time)}`.replace(/ · $/, "") };
|
|
629
637
|
}
|
|
630
|
-
const
|
|
638
|
+
const je = /* @__PURE__ */ new Set(["game", "story", "page", "forum", "video", "gallery"]);
|
|
631
639
|
function _(a) {
|
|
632
640
|
let t = String(a || "").replace(/^[a-z][a-z0-9+.-]*:\/\/[^/#?]*/i, "");
|
|
633
641
|
const e = t.indexOf("#");
|
|
@@ -636,13 +644,13 @@ function _(a) {
|
|
|
636
644
|
let r = t.split("?")[0] + s;
|
|
637
645
|
return r = r.replace(/([^:])\/{2,}/g, "$1/").replace(/^\/{2,}/, "/"), r = r.replace(/^\/(?=#)/, ""), r.length > 1 && (r = r.replace(/\/+$/, "")), r.toLowerCase();
|
|
638
646
|
}
|
|
639
|
-
function
|
|
647
|
+
function Jt() {
|
|
640
648
|
const a = globalThis.location;
|
|
641
649
|
if (!a) return "";
|
|
642
650
|
const t = (a.hash || "").startsWith("#/") ? a.hash : "";
|
|
643
651
|
return _((a.pathname || "") + t);
|
|
644
652
|
}
|
|
645
|
-
function
|
|
653
|
+
function qe(a, t, e) {
|
|
646
654
|
if (!e) return null;
|
|
647
655
|
const s = _(a);
|
|
648
656
|
if (!s) return null;
|
|
@@ -651,23 +659,23 @@ function je(a, t, e) {
|
|
|
651
659
|
const n = _(v(t.section, { sport: e, view: "" }));
|
|
652
660
|
if (s === n) return "";
|
|
653
661
|
if (!s.startsWith(`${n}/`)) return null;
|
|
654
|
-
const i = s.slice(n.length + 1),
|
|
655
|
-
return
|
|
662
|
+
const i = s.slice(n.length + 1), c = i.split("/");
|
|
663
|
+
return c.length > 2 || c.some((h) => !/^[a-z][a-z-]*$/.test(h)) || je.has(c[0]) ? null : i;
|
|
656
664
|
}
|
|
657
|
-
function
|
|
665
|
+
function We(a, t, e) {
|
|
658
666
|
const s = (n) => v(e.section, { sport: a, view: n }).replace(/([^:])\/{2,}/g, "$1/"), o = new Set((t || []).map((n) => n && n.gender).filter((n) => n === "boys" || n === "girls")).size === 2 ? [
|
|
659
667
|
{ label: "Boys Standings", href: s("boys/standings") },
|
|
660
668
|
{ label: "Girls Standings", href: s("girls/standings") }
|
|
661
669
|
] : [{ label: "Standings", href: s("standings") }];
|
|
662
670
|
return [
|
|
663
|
-
{ label: `${
|
|
671
|
+
{ label: `${D(a)} Home`, href: s("") },
|
|
664
672
|
{ label: "Scores/Schedule", href: s("scores") },
|
|
665
673
|
{ label: "Playoff Brackets", href: s("brackets") },
|
|
666
674
|
...o,
|
|
667
675
|
{ label: "Polls & Rankings", href: s("rankings") }
|
|
668
676
|
];
|
|
669
677
|
}
|
|
670
|
-
function
|
|
678
|
+
function Ve(a, t = Jt()) {
|
|
671
679
|
const e = _(t);
|
|
672
680
|
for (const s of a.querySelectorAll(':scope > a[slot="nav"]'))
|
|
673
681
|
e && _(s.getAttribute("href")) === e ? s.setAttribute("aria-current", "page") : s.removeAttribute("aria-current");
|
|
@@ -691,7 +699,7 @@ class b extends N {
|
|
|
691
699
|
this._client = t, this.isConnected && this.load();
|
|
692
700
|
}
|
|
693
701
|
get client() {
|
|
694
|
-
return this._client ? this._client : this.api ?
|
|
702
|
+
return this._client ? this._client : this.api ? Fe({ baseUrl: this.api }) : null;
|
|
695
703
|
}
|
|
696
704
|
connectedCallback() {
|
|
697
705
|
super.connectedCallback(), this._setupInterval();
|
|
@@ -703,7 +711,7 @@ class b extends N {
|
|
|
703
711
|
this.load();
|
|
704
712
|
}
|
|
705
713
|
updated(t) {
|
|
706
|
-
t.has("api") && t.get("api") !== void 0 && t.get("api") !== this.api && this.load(), t.has("refreshInterval") && this._setupInterval(),
|
|
714
|
+
t.has("api") && t.get("api") !== void 0 && t.get("api") !== this.api && this.load(), t.has("refreshInterval") && this._setupInterval(), Ve(this);
|
|
707
715
|
}
|
|
708
716
|
async load() {
|
|
709
717
|
const t = this.client;
|
|
@@ -732,13 +740,13 @@ class b extends N {
|
|
|
732
740
|
this._refreshId && (clearInterval(this._refreshId), this._refreshId = null);
|
|
733
741
|
}
|
|
734
742
|
render() {
|
|
735
|
-
return this.error === "not-configured" ?
|
|
743
|
+
return this.error === "not-configured" ? l`<div class="error">This component needs an <code>api</code> attribute (the api-hsot public read-surface base URL) or an injected client.</div>` : this.error ? l`<div class="error">Unable to load right now. <button class="chip" @click=${() => this.load()}>Retry</button></div>` : this.data ? this.renderView() : l`<div class="loading" role="status">Loading…</div>`;
|
|
736
744
|
}
|
|
737
745
|
renderView() {
|
|
738
|
-
return
|
|
746
|
+
return l``;
|
|
739
747
|
}
|
|
740
748
|
}
|
|
741
|
-
const $ = (a) => Object.fromEntries((a || []).map((t) => [t.id, t])),
|
|
749
|
+
const $ = (a) => Object.fromEntries((a || []).map((t) => [t.id, t])), Ye = y`
|
|
742
750
|
:host {
|
|
743
751
|
--hsot-red: var(--color-red, #D1232A);
|
|
744
752
|
--hsot-red-deep: var(--color-red-dark, #951C21);
|
|
@@ -776,7 +784,7 @@ const $ = (a) => Object.fromEntries((a || []).map((t) => [t.id, t])), Ve = y`
|
|
|
776
784
|
outline-offset: 1px;
|
|
777
785
|
}
|
|
778
786
|
.mut { color: var(--hsot-gray-5); }
|
|
779
|
-
`,
|
|
787
|
+
`, Ke = y`
|
|
780
788
|
.band { background: var(--hsot-white); color: var(--hsot-black); }
|
|
781
789
|
.band .inner { max-width: 1366px; margin: 0 auto; padding: 1.1rem 1.25rem 0; }
|
|
782
790
|
.band h1, .band h2.bandtitle {
|
|
@@ -825,7 +833,7 @@ const $ = (a) => Object.fromEntries((a || []).map((t) => [t.id, t])), Ve = y`
|
|
|
825
833
|
@media (max-width: 720px) {
|
|
826
834
|
.band h1, .band h2.bandtitle, .band.section h1, .band.section h2.bandtitle { font-size: 1.8rem; }
|
|
827
835
|
}
|
|
828
|
-
`,
|
|
836
|
+
`, Qe = y`
|
|
829
837
|
.view { max-width: 1366px; margin: 0 auto; padding: 1.25rem; box-sizing: border-box; }
|
|
830
838
|
/* Optional right rail (slot="rail" light-DOM children): a divided 300px
|
|
831
839
|
column on desktop, stacked under the view content on smaller screens. */
|
|
@@ -889,7 +897,7 @@ const $ = (a) => Object.fromEntries((a || []).map((t) => [t.id, t])), Ve = y`
|
|
|
889
897
|
.error { padding: 1.2rem 1rem; color: var(--hsot-red-deep); font-size: 0.9rem; }
|
|
890
898
|
.note { font-size: 0.8125rem; color: var(--hsot-gray-5); margin: 0.6rem 0 0; }
|
|
891
899
|
.loading { padding: 1.2rem; color: var(--hsot-gray-5); font-family: var(--hsot-heading-font); }
|
|
892
|
-
`,
|
|
900
|
+
`, Ze = y`
|
|
893
901
|
.pill {
|
|
894
902
|
display: inline-block; font-family: var(--hsot-heading-font); font-weight: 700;
|
|
895
903
|
font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.04em;
|
|
@@ -904,7 +912,7 @@ const $ = (a) => Object.fromEntries((a || []).map((t) => [t.id, t])), Ve = y`
|
|
|
904
912
|
.pill.champ { background: var(--hsot-straw); color: #6b5900; }
|
|
905
913
|
@keyframes hsot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
|
|
906
914
|
@media (prefers-reduced-motion: reduce) { .pill.live { animation: none; } }
|
|
907
|
-
`,
|
|
915
|
+
`, Je = y`
|
|
908
916
|
.tablewrap { overflow-x: auto; }
|
|
909
917
|
table.data { font-family: var(--hsot-heading-font); font-size: 14px; border-collapse: collapse; width: 100%; }
|
|
910
918
|
table.data th {
|
|
@@ -922,7 +930,7 @@ const $ = (a) => Object.fromEntries((a || []).map((t) => [t.id, t])), Ve = y`
|
|
|
922
930
|
table.data tbody tr.rowlink:hover { background: var(--hsot-gray-1); }
|
|
923
931
|
table.data td.teamcell a { color: inherit; text-decoration: none; font-weight: 500; }
|
|
924
932
|
table.data td.teamcell a:hover { text-decoration: underline; }
|
|
925
|
-
`,
|
|
933
|
+
`, Xe = y`
|
|
926
934
|
.swatch {
|
|
927
935
|
display: inline-flex; align-items: center; justify-content: center;
|
|
928
936
|
width: 26px; height: 26px; border-radius: 50%;
|
|
@@ -946,7 +954,7 @@ const $ = (a) => Object.fromEntries((a || []).map((t) => [t.id, t])), Ve = y`
|
|
|
946
954
|
.dot.W { background: var(--hsot-win); }
|
|
947
955
|
.dot.L { background: var(--hsot-loss); }
|
|
948
956
|
.dot.T { background: var(--hsot-tie); }
|
|
949
|
-
`,
|
|
957
|
+
`, ts = y`
|
|
950
958
|
ul.gamelist { list-style: none; margin: 0; padding: 0; }
|
|
951
959
|
.gamelist li {
|
|
952
960
|
display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 1rem;
|
|
@@ -996,29 +1004,29 @@ const $ = (a) => Object.fromEntries((a || []).map((t) => [t.id, t])), Ve = y`
|
|
|
996
1004
|
.gamelist .ff { color: var(--hsot-gray-5); font-size: 0.78rem; font-style: italic; }
|
|
997
1005
|
.gamelist .where { color: var(--hsot-gray-5); font-size: 0.78rem; }
|
|
998
1006
|
.gamelist a.box { font-size: 0.78rem; }
|
|
999
|
-
`, U = [
|
|
1000
|
-
function
|
|
1007
|
+
`, U = [Ye, Ke, Qe, Ze, Je, Xe, ts];
|
|
1008
|
+
function nt(a) {
|
|
1001
1009
|
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";
|
|
1002
1010
|
}
|
|
1003
|
-
function
|
|
1011
|
+
function es(a) {
|
|
1004
1012
|
return a && (a.forfeit === "home" || a.forfeit === "away") ? a.forfeit : null;
|
|
1005
1013
|
}
|
|
1006
|
-
function
|
|
1014
|
+
function Q(a, t) {
|
|
1007
1015
|
const e = {}, s = (o) => (e[o] = e[o] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] }, e[o]), r = a.filter((o) => o.state === "final" && o.gameType !== "scrimmage" && !0).sort((o, n) => String(o.date).localeCompare(String(n.date)));
|
|
1008
1016
|
for (const o of r) {
|
|
1009
|
-
const n =
|
|
1010
|
-
for (const
|
|
1011
|
-
const
|
|
1012
|
-
if (!
|
|
1013
|
-
const d = s(
|
|
1017
|
+
const n = nt(o), i = o.gameType === "conference";
|
|
1018
|
+
for (const c of ["home", "away"]) {
|
|
1019
|
+
const h = c === "home" ? o.homeTeamId : o.awayTeamId;
|
|
1020
|
+
if (!h) continue;
|
|
1021
|
+
const d = s(h), p = c === "home" ? o.homeScore : o.awayScore, u = c === "home" ? o.awayScore : o.homeScore;
|
|
1014
1022
|
d.pf += p, d.pa += u;
|
|
1015
1023
|
let f = "T";
|
|
1016
|
-
n === "tie" ? (d.t += 1, i && (d.ct += 1)) : n ===
|
|
1024
|
+
n === "tie" ? (d.t += 1, i && (d.ct += 1)) : n === c ? (d.w += 1, i && (d.cw += 1), f = "W") : (d.l += 1, i && (d.cl += 1), f = "L"), d.results.push({ gameId: o.id, date: o.date, mark: f, my: p, their: u, opp: c === "home" ? o.awayTeamId : o.homeTeamId, conf: i });
|
|
1017
1025
|
}
|
|
1018
1026
|
}
|
|
1019
1027
|
return e;
|
|
1020
1028
|
}
|
|
1021
|
-
function
|
|
1029
|
+
function it(a) {
|
|
1022
1030
|
if (!a || !a.length) return "";
|
|
1023
1031
|
const t = a[a.length - 1].mark;
|
|
1024
1032
|
let e = 0;
|
|
@@ -1034,7 +1042,7 @@ function k(a, t = !1) {
|
|
|
1034
1042
|
const e = t ? a.cw : a.w, s = t ? a.cl : a.l, r = t ? a.ct : a.t;
|
|
1035
1043
|
return `${e}-${s}${r ? `-${r}` : ""}`;
|
|
1036
1044
|
}
|
|
1037
|
-
function
|
|
1045
|
+
function Xt(a, t) {
|
|
1038
1046
|
return a.map((e) => {
|
|
1039
1047
|
const s = t[e.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] };
|
|
1040
1048
|
return { team: e, rec: s, confPct: Mt(s.cw, s.cl, s.ct), overallPct: Mt(s.w, s.l, s.t) };
|
|
@@ -1051,19 +1059,19 @@ function yt(a, t, e, s, r) {
|
|
|
1051
1059
|
const o = t[e];
|
|
1052
1060
|
if (!o) return null;
|
|
1053
1061
|
const n = /* @__PURE__ */ new Map();
|
|
1054
|
-
for (const
|
|
1055
|
-
if (
|
|
1056
|
-
const
|
|
1057
|
-
(!d ||
|
|
1062
|
+
for (const c of a || []) {
|
|
1063
|
+
if (c.sport !== s || r && c.effectiveDate > r || c.gender && o.gender !== c.gender && o.gender !== "coed") continue;
|
|
1064
|
+
const h = c.gender || "", d = n.get(h);
|
|
1065
|
+
(!d || c.effectiveDate > d.effectiveDate) && n.set(h, c);
|
|
1058
1066
|
}
|
|
1059
1067
|
let i = null;
|
|
1060
|
-
for (const
|
|
1061
|
-
const
|
|
1062
|
-
|
|
1068
|
+
for (const c of n.values()) {
|
|
1069
|
+
const h = (c.teamIds || []).indexOf(e);
|
|
1070
|
+
h !== -1 && (!i || c.effectiveDate > i.effectiveDate) && (i = { poll: c, rank: h + 1 });
|
|
1063
1071
|
}
|
|
1064
1072
|
return i ? i.rank : null;
|
|
1065
1073
|
}
|
|
1066
|
-
function
|
|
1074
|
+
function ss(a, t, e) {
|
|
1067
1075
|
if (!a) return { kind: "none", delta: 0 };
|
|
1068
1076
|
const s = (a.teamIds || []).indexOf(e) + 1;
|
|
1069
1077
|
if (!s) return { kind: "none", delta: 0 };
|
|
@@ -1073,37 +1081,37 @@ function es(a, t, e) {
|
|
|
1073
1081
|
const o = r - s;
|
|
1074
1082
|
return o > 0 ? { kind: "up", delta: o } : o < 0 ? { kind: "down", delta: -o } : { kind: "same", delta: 0 };
|
|
1075
1083
|
}
|
|
1076
|
-
function
|
|
1084
|
+
function as(a) {
|
|
1077
1085
|
return /^https?:\/\//i.test(String(a || ""));
|
|
1078
1086
|
}
|
|
1079
|
-
function
|
|
1080
|
-
if (!
|
|
1087
|
+
function te(a, { w: t, h: e } = {}) {
|
|
1088
|
+
if (!as(a)) return "";
|
|
1081
1089
|
const s = [];
|
|
1082
1090
|
t && s.push(`w=${Math.max(1, Math.round(t))}`), e && s.push(`h=${Math.max(1, Math.round(e))}`), s.push("f=webp");
|
|
1083
1091
|
const r = a.includes("?") ? "&" : "?";
|
|
1084
1092
|
return `${a}${r}${s.join("&")}`;
|
|
1085
1093
|
}
|
|
1086
|
-
function
|
|
1094
|
+
function et(a, t) {
|
|
1087
1095
|
const e = t * 2;
|
|
1088
|
-
return
|
|
1096
|
+
return te(a?.logoAssetId, { w: e, h: e });
|
|
1089
1097
|
}
|
|
1090
|
-
function
|
|
1091
|
-
return
|
|
1098
|
+
function rs(a, t) {
|
|
1099
|
+
return te(a?.photoAssetId, { w: t * 2 });
|
|
1092
1100
|
}
|
|
1093
|
-
function
|
|
1094
|
-
const o =
|
|
1095
|
-
return
|
|
1101
|
+
function lt(a, t, { title: e, sub: s, teams: r }) {
|
|
1102
|
+
const o = Jt(), i = !!a.querySelector(':scope > a[slot="nav"]') || qe(o, t.hrefs, t.sport) !== null;
|
|
1103
|
+
return l`
|
|
1096
1104
|
<div class="band section">
|
|
1097
1105
|
<div class="inner">
|
|
1098
1106
|
<h1>${e}</h1>
|
|
1099
|
-
${s ?
|
|
1107
|
+
${s ? l`<p class="sub">${s}</p>` : m}
|
|
1100
1108
|
</div>
|
|
1101
|
-
${i ?
|
|
1102
|
-
<nav class="sectionnav" aria-label="${
|
|
1109
|
+
${i ? l`
|
|
1110
|
+
<nav class="sectionnav" aria-label="${D(t.sport)} section">
|
|
1103
1111
|
<div class="navrow">
|
|
1104
1112
|
<slot name="nav">
|
|
1105
|
-
${
|
|
1106
|
-
aria-current=${o && _(
|
|
1113
|
+
${We(t.sport, r, t.hrefs).map((c) => l`<a href=${c.href}
|
|
1114
|
+
aria-current=${o && _(c.href) === o ? "page" : m}>${c.label}</a>`)}
|
|
1107
1115
|
</slot>
|
|
1108
1116
|
</div>
|
|
1109
1117
|
</nav>` : m}
|
|
@@ -1113,57 +1121,57 @@ function it(a, t, { title: e, sub: s, teams: r }) {
|
|
|
1113
1121
|
const C = (a, t) => {
|
|
1114
1122
|
const e = a.teamsById[t];
|
|
1115
1123
|
return e ? a.schoolsById[e.schoolId] : null;
|
|
1116
|
-
}, R = (a, t) => C(a, t)?.name || "TBD",
|
|
1124
|
+
}, R = (a, t) => C(a, t)?.name || "TBD", st = (a, t) => C(a, t)?.abbr || "TBD";
|
|
1117
1125
|
function E(a, t = 26) {
|
|
1118
1126
|
if (!a) return m;
|
|
1119
|
-
const e =
|
|
1127
|
+
const e = et(a, t);
|
|
1120
1128
|
if (e)
|
|
1121
|
-
return
|
|
1129
|
+
return l`<img class="swatch logo" aria-hidden="true" alt="" loading="lazy"
|
|
1122
1130
|
src=${e} style="width:${t}px;height:${t}px" />`;
|
|
1123
|
-
const s = a.colorPrimary || "#030711", r =
|
|
1124
|
-
return
|
|
1131
|
+
const s = a.colorPrimary || "#030711", r = tt(s);
|
|
1132
|
+
return l`<span class="swatch" aria-hidden="true"
|
|
1125
1133
|
style="width:${t}px;height:${t}px;background:${s};color:${r};font-size:${Math.max(8, t * 0.28)}px"
|
|
1126
1134
|
>${$t(a)}</span>`;
|
|
1127
1135
|
}
|
|
1128
1136
|
function wt(a, t, e) {
|
|
1129
1137
|
const s = yt(a.rankings, a.teamsById, t, a.sport, e);
|
|
1130
|
-
return s ?
|
|
1138
|
+
return s ? l`<span class="rankbadge">#${s}</span>` : m;
|
|
1131
1139
|
}
|
|
1132
|
-
function
|
|
1140
|
+
function at(a, t, e) {
|
|
1133
1141
|
const s = C(a, t);
|
|
1134
|
-
return s ?
|
|
1142
|
+
return s ? l`${wt(a, t, e)}<a href=${v(a.hrefs.school, { id: s.id })}>${s.name}</a>` : l`<span class="mut">TBD</span>`;
|
|
1135
1143
|
}
|
|
1136
1144
|
function xt(a, t, e = 5) {
|
|
1137
1145
|
const s = a.records[t];
|
|
1138
|
-
if (!s || !s.results.length) return
|
|
1146
|
+
if (!s || !s.results.length) return l`<span class="mut">·</span>`;
|
|
1139
1147
|
const r = s.results.slice(-1 * e);
|
|
1140
|
-
return
|
|
1141
|
-
${r.map((o) =>
|
|
1148
|
+
return l`<span class="dots" role="img" aria-label="last ${r.length} results">
|
|
1149
|
+
${r.map((o) => l`<a class="dot ${o.mark}"
|
|
1142
1150
|
title="${o.mark} ${o.my}-${o.their} vs ${R(a, o.opp)}"
|
|
1143
1151
|
href=${v(a.hrefs.game, { sport: a.sport, id: o.gameId })}>${o.mark}</a>`)}
|
|
1144
1152
|
</span>`;
|
|
1145
1153
|
}
|
|
1146
1154
|
function P(a, t) {
|
|
1147
|
-
return a.querySelector(':scope > [slot="rail"]') ?
|
|
1155
|
+
return a.querySelector(':scope > [slot="rail"]') ? l`<div class="view withrail">
|
|
1148
1156
|
<div class="viewmain">${t}</div>
|
|
1149
1157
|
<aside class="viewrail"><slot name="rail"></slot></aside>
|
|
1150
|
-
</div>` :
|
|
1158
|
+
</div>` : l`<div class="view">${t}</div>`;
|
|
1151
1159
|
}
|
|
1152
|
-
function
|
|
1160
|
+
function B(a) {
|
|
1153
1161
|
if (!a.promoImage) return m;
|
|
1154
|
-
const t =
|
|
1155
|
-
return
|
|
1162
|
+
const t = l`<img src=${a.promoImage} alt=${a.promoAlt || "Sponsor"}>`;
|
|
1163
|
+
return l`<div class="promo">${a.promoHref ? l`<a href=${a.promoHref} target="_blank" rel="sponsored noopener">${t}</a>` : t}</div>`;
|
|
1156
1164
|
}
|
|
1157
|
-
function
|
|
1158
|
-
const t =
|
|
1159
|
-
return
|
|
1165
|
+
function V(a) {
|
|
1166
|
+
const t = Zt(a);
|
|
1167
|
+
return l`<span class="pill ${t.kind}">${t.label}</span>`;
|
|
1160
1168
|
}
|
|
1161
|
-
function
|
|
1162
|
-
if (!t) return
|
|
1169
|
+
function ee(a, t, e) {
|
|
1170
|
+
if (!t) return l`<span class="mut">·</span>`;
|
|
1163
1171
|
const s = t.homeTeamId === e ? t.awayTeamId : t.homeTeamId, r = t.homeTeamId === e ? "vs" : "at";
|
|
1164
|
-
return
|
|
1172
|
+
return l`${t.state === "live" ? l`<span class="pill live">Live</span> ` : l`${w(t.date, { month: "numeric", day: "numeric" })} `}${r} ${st(a, s)}`;
|
|
1165
1173
|
}
|
|
1166
|
-
class
|
|
1174
|
+
class se extends b {
|
|
1167
1175
|
static styles = U;
|
|
1168
1176
|
static properties = {
|
|
1169
1177
|
...b.properties,
|
|
@@ -1182,14 +1190,14 @@ class ee extends b {
|
|
|
1182
1190
|
this._datePinned = !!this.date;
|
|
1183
1191
|
}
|
|
1184
1192
|
async fetchData(t) {
|
|
1185
|
-
const e = this.season ||
|
|
1193
|
+
const e = this.season || K(), [s, r, o, n, i] = await Promise.all([
|
|
1186
1194
|
t.listSchools(),
|
|
1187
1195
|
t.listTeams({ sport: this.sport }),
|
|
1188
1196
|
t.listConferences(),
|
|
1189
1197
|
t.listGames({ sport: this.sport, season: e }),
|
|
1190
1198
|
t.listRankings({ sport: this.sport })
|
|
1191
1199
|
]);
|
|
1192
|
-
return this._datePinned || (this.date =
|
|
1200
|
+
return this._datePinned || (this.date = He(n.items.map((c) => c.date)), this._datePinned = !0), {
|
|
1193
1201
|
season: e,
|
|
1194
1202
|
schools: s.items,
|
|
1195
1203
|
teams: r.items,
|
|
@@ -1202,37 +1210,37 @@ class ee extends b {
|
|
|
1202
1210
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
1203
1211
|
teamsById: $(this.data.teams),
|
|
1204
1212
|
schoolsById: $(this.data.schools),
|
|
1205
|
-
records:
|
|
1213
|
+
records: Q(this.data.games),
|
|
1206
1214
|
rankings: this.data.rankings,
|
|
1207
1215
|
hrefs: O(this),
|
|
1208
1216
|
sport: this.sport
|
|
1209
1217
|
}, this._ctxData = this.data), this._ctx;
|
|
1210
1218
|
}
|
|
1211
1219
|
renderView() {
|
|
1212
|
-
const t = this.ctx, e = $(this.data.conferences), s = [...new Set(this.data.games.map((
|
|
1213
|
-
const d = [
|
|
1220
|
+
const t = this.ctx, e = $(this.data.conferences), s = [...new Set(this.data.games.map((h) => h.date).filter(Boolean))].sort(), r = Number.MAX_SAFE_INTEGER, o = (h) => {
|
|
1221
|
+
const d = [h.awayTeamId, h.homeTeamId].map((p) => yt(t.rankings, t.teamsById, p, this.sport, h.date)).filter(Boolean);
|
|
1214
1222
|
return d.length ? Math.min(...d) : r;
|
|
1215
|
-
}, n = this.data.games.filter((
|
|
1216
|
-
n.sort((
|
|
1217
|
-
const
|
|
1218
|
-
return n.forEach((
|
|
1219
|
-
const d =
|
|
1220
|
-
|
|
1221
|
-
}),
|
|
1222
|
-
${
|
|
1223
|
-
title:
|
|
1224
|
-
sub:
|
|
1223
|
+
}, n = this.data.games.filter((h) => h.date === this.date), i = new Map(n.map((h) => [h, o(h)]));
|
|
1224
|
+
n.sort((h, d) => (h.state === "live" ? 0 : 1) - (d.state === "live" ? 0 : 1) || i.get(h) - i.get(d));
|
|
1225
|
+
const c = /* @__PURE__ */ new Map();
|
|
1226
|
+
return n.forEach((h) => {
|
|
1227
|
+
const d = h.gameType === "conference" && h.conferenceId ? e[h.conferenceId]?.name || "Conference" : h.gameType === "playoff" ? "Playoffs" : h.gameType === "scrimmage" ? "Scrimmages" : "Nonconference";
|
|
1228
|
+
c.has(d) || c.set(d, []), c.get(d).push(h);
|
|
1229
|
+
}), l`
|
|
1230
|
+
${lt(this, t, {
|
|
1231
|
+
title: l`${D(this.sport)} scores & schedules`,
|
|
1232
|
+
sub: l`${w(this.date, { weekday: "long", month: "long", day: "numeric", year: "numeric" })} · ${n.length} games`,
|
|
1225
1233
|
teams: this.data.teams
|
|
1226
1234
|
})}
|
|
1227
|
-
${P(this,
|
|
1228
|
-
${
|
|
1235
|
+
${P(this, l`
|
|
1236
|
+
${B(this)}
|
|
1229
1237
|
<div class="toolbar">
|
|
1230
1238
|
<label class="asof" for="datesel">Date</label>
|
|
1231
|
-
<select id="datesel" @change=${(
|
|
1232
|
-
this.date =
|
|
1239
|
+
<select id="datesel" @change=${(h) => {
|
|
1240
|
+
this.date = h.target.value;
|
|
1233
1241
|
}}>
|
|
1234
|
-
${(s.includes(this.date) ? s : [...s, this.date].sort()).map((
|
|
1235
|
-
${w(
|
|
1242
|
+
${(s.includes(this.date) ? s : [...s, this.date].sort()).map((h) => l`<option value=${h} ?selected=${h === this.date}>
|
|
1243
|
+
${w(h, { weekday: "short", month: "short", day: "numeric" })}${h === vt() ? " · today" : ""}
|
|
1236
1244
|
</option>`)}
|
|
1237
1245
|
</select>
|
|
1238
1246
|
<button class="chip" ?disabled=${s.indexOf(this.date) <= 0}
|
|
@@ -1244,11 +1252,11 @@ class ee extends b {
|
|
|
1244
1252
|
this.date = s[s.indexOf(this.date) + 1];
|
|
1245
1253
|
}}>Next →</button>
|
|
1246
1254
|
<span class="spacer"></span>
|
|
1247
|
-
<span class="asof">Live games first · report a score to see it update here</span>
|
|
1255
|
+
<span class="asof">Live games first · <a href=${Qt(t.hrefs)}>report a score</a> to see it update here</span>
|
|
1248
1256
|
</div>
|
|
1249
|
-
${n.length ? m :
|
|
1250
|
-
${[...
|
|
1251
|
-
<div class="section-title">${
|
|
1257
|
+
${n.length ? m : l`<p class="empty">No ${this.sport} games on this date.</p>`}
|
|
1258
|
+
${[...c.entries()].map(([h, d]) => l`
|
|
1259
|
+
<div class="section-title">${h}</div>
|
|
1252
1260
|
<div class="card"><ul class="gamelist">
|
|
1253
1261
|
${d.map((p) => this.renderGame(t, p))}
|
|
1254
1262
|
</ul></div>
|
|
@@ -1260,21 +1268,21 @@ class ee extends b {
|
|
|
1260
1268
|
// a lone score column on the far right read as detached from the teams).
|
|
1261
1269
|
// Scheduled games carry their start time on the status pill alone.
|
|
1262
1270
|
renderGame(t, e) {
|
|
1263
|
-
const s = e.state === "final" || e.state === "live", r = (n, i,
|
|
1264
|
-
return
|
|
1271
|
+
const s = e.state === "final" || e.state === "live", r = (n, i, c = m) => l`<span class="side">${at(t, n, e.date)}${s ? l`<span class="score">${i}</span>` : m}${c}</span>`, o = es(e);
|
|
1272
|
+
return l`
|
|
1265
1273
|
<li>
|
|
1266
|
-
${
|
|
1267
|
-
<span class="opp matchup">${r(e.awayTeamId, e.awayScore,
|
|
1268
|
-
${o ?
|
|
1274
|
+
${V(e)}
|
|
1275
|
+
<span class="opp matchup">${r(e.awayTeamId, e.awayScore, l`<span class="at">at</span>`)}${r(e.homeTeamId, e.homeScore)}</span>
|
|
1276
|
+
${o ? l`<span class="ff">${R(t, o === "home" ? e.homeTeamId : e.awayTeamId)} forfeited</span>` : m}
|
|
1269
1277
|
<span class="where">${e.venue || ""}</span>
|
|
1270
|
-
${e.broadcast ?
|
|
1278
|
+
${e.broadcast ? l`<span class="pill class">${e.broadcast}</span>` : m}
|
|
1271
1279
|
<a class="box" href=${v(t.hrefs.game, { sport: this.sport, id: e.id })}>Box score →</a>
|
|
1272
1280
|
</li>
|
|
1273
1281
|
`;
|
|
1274
1282
|
}
|
|
1275
1283
|
}
|
|
1276
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores",
|
|
1277
|
-
class
|
|
1284
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores", se);
|
|
1285
|
+
class ae extends b {
|
|
1278
1286
|
static styles = U;
|
|
1279
1287
|
static properties = {
|
|
1280
1288
|
...b.properties,
|
|
@@ -1287,7 +1295,7 @@ class se extends b {
|
|
|
1287
1295
|
super(), this.sport = "football", this.season = "", this.classFilter = "All", this.query = "";
|
|
1288
1296
|
}
|
|
1289
1297
|
async fetchData(t) {
|
|
1290
|
-
const e = this.season ||
|
|
1298
|
+
const e = this.season || K(), [s, r, o, n, i] = await Promise.all([
|
|
1291
1299
|
t.listConferences({ active: !0 }),
|
|
1292
1300
|
t.listSchools(),
|
|
1293
1301
|
t.listTeams({ sport: this.sport }),
|
|
@@ -1307,25 +1315,25 @@ class se extends b {
|
|
|
1307
1315
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
1308
1316
|
teamsById: $(this.data.teams),
|
|
1309
1317
|
schoolsById: $(this.data.schools),
|
|
1310
|
-
records:
|
|
1318
|
+
records: Q(this.data.games),
|
|
1311
1319
|
rankings: this.data.rankings,
|
|
1312
1320
|
hrefs: O(this),
|
|
1313
1321
|
sport: this.sport
|
|
1314
1322
|
}, this._ctxData = this.data), this._ctx;
|
|
1315
1323
|
}
|
|
1316
1324
|
renderView() {
|
|
1317
|
-
const t = this.ctx, e = ["All", ...[...new Set(this.data.conferences.flatMap((r) => r.classifications || []))].sort(Nt)].slice(0, 9), s = this.data.conferences.filter((r) => r.active !== !1).filter((r) => this.classFilter === "All" || (r.classifications || []).includes(this.classFilter)).sort(
|
|
1318
|
-
return
|
|
1319
|
-
${
|
|
1320
|
-
title:
|
|
1321
|
-
sub:
|
|
1325
|
+
const t = this.ctx, e = ["All", ...[...new Set(this.data.conferences.flatMap((r) => r.classifications || []))].sort(Nt)].slice(0, 9), s = this.data.conferences.filter((r) => r.active !== !1).filter((r) => this.classFilter === "All" || (r.classifications || []).includes(this.classFilter)).sort(Ge);
|
|
1326
|
+
return l`
|
|
1327
|
+
${lt(this, t, {
|
|
1328
|
+
title: l`${D(this.sport)} standings`,
|
|
1329
|
+
sub: l`${this.data.season} season · every conference, computed live from reported results`,
|
|
1322
1330
|
teams: this.data.teams
|
|
1323
1331
|
})}
|
|
1324
|
-
${P(this,
|
|
1325
|
-
${
|
|
1332
|
+
${P(this, l`
|
|
1333
|
+
${B(this)}
|
|
1326
1334
|
<div class="toolbar">
|
|
1327
1335
|
<div role="group" aria-label="Classification filter">
|
|
1328
|
-
${e.map((r) =>
|
|
1336
|
+
${e.map((r) => l`<button class="chip ${this.classFilter === r ? "on" : ""}"
|
|
1329
1337
|
@click=${() => {
|
|
1330
1338
|
this.classFilter = r;
|
|
1331
1339
|
}}>${r}</button>`)}
|
|
@@ -1344,12 +1352,12 @@ class se extends b {
|
|
|
1344
1352
|
renderConference(t, e) {
|
|
1345
1353
|
const s = this.data.teams.filter((n) => n.conferenceId === e.id);
|
|
1346
1354
|
if (!s.length) return m;
|
|
1347
|
-
const r = this.query.trim().toLowerCase(), o =
|
|
1348
|
-
return
|
|
1355
|
+
const r = this.query.trim().toLowerCase(), o = Xt(s, t.records);
|
|
1356
|
+
return l`
|
|
1349
1357
|
<div class="card">
|
|
1350
1358
|
<div class="card-head">
|
|
1351
1359
|
<h2>${e.name}</h2>
|
|
1352
|
-
${[...e.classifications || []].sort(Nt).map((n) =>
|
|
1360
|
+
${[...e.classifications || []].sort(Nt).map((n) => l`<span class="pill class">${n}</span>`)}
|
|
1353
1361
|
<span class="meta">${o.length} teams · membership derives from teams</span>
|
|
1354
1362
|
</div>
|
|
1355
1363
|
<div class="tablewrap"><table class="data">
|
|
@@ -1368,12 +1376,12 @@ class se extends b {
|
|
|
1368
1376
|
renderRow(t, e, s, r) {
|
|
1369
1377
|
const o = t.schoolsById[e.team.schoolId], n = o?.name || e.team.name || "TBD";
|
|
1370
1378
|
if (r && !n.toLowerCase().includes(r)) return m;
|
|
1371
|
-
const i = e.rec.pf - e.rec.pa,
|
|
1379
|
+
const i = e.rec.pf - e.rec.pa, c = bt(this.data.games, e.team.id), h = () => {
|
|
1372
1380
|
location.href = v(t.hrefs.school, { id: e.team.schoolId });
|
|
1373
1381
|
};
|
|
1374
|
-
return
|
|
1382
|
+
return l`
|
|
1375
1383
|
<tr class="rowlink" @click=${(d) => {
|
|
1376
|
-
d.target.closest("a") ||
|
|
1384
|
+
d.target.closest("a") || h();
|
|
1377
1385
|
}}>
|
|
1378
1386
|
<td class="mut">${s + 1}</td>
|
|
1379
1387
|
<td class="teamcell">
|
|
@@ -1387,15 +1395,15 @@ class se extends b {
|
|
|
1387
1395
|
<td class="num">${e.rec.pf}</td>
|
|
1388
1396
|
<td class="num">${e.rec.pa}</td>
|
|
1389
1397
|
<td class="num" style="color:${i >= 0 ? "var(--hsot-win)" : "var(--hsot-loss)"}">${i > 0 ? "+" : ""}${i}</td>
|
|
1390
|
-
<td>${
|
|
1398
|
+
<td>${it(e.rec.results) || "·"}</td>
|
|
1391
1399
|
<td>${xt(t, e.team.id)}</td>
|
|
1392
|
-
<td>${
|
|
1400
|
+
<td>${ee(t, c, e.team.id)}</td>
|
|
1393
1401
|
</tr>
|
|
1394
1402
|
`;
|
|
1395
1403
|
}
|
|
1396
1404
|
}
|
|
1397
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings",
|
|
1398
|
-
const
|
|
1405
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings", ae);
|
|
1406
|
+
const os = y`
|
|
1399
1407
|
.hero1 {
|
|
1400
1408
|
border-radius: var(--hsot-radius-md); color: var(--hsot-white);
|
|
1401
1409
|
padding: 1.3rem 1.4rem; display: flex; align-items: center; gap: 1.2rem;
|
|
@@ -1412,8 +1420,8 @@ const rs = y`
|
|
|
1412
1420
|
.delta.new { background: var(--hsot-straw); color: #6b5900; border-radius: var(--hsot-radius-xs); padding: 0.1rem 0.3rem; font-size: 0.7rem; }
|
|
1413
1421
|
.sparkline { vertical-align: middle; }
|
|
1414
1422
|
`;
|
|
1415
|
-
class
|
|
1416
|
-
static styles = [...U,
|
|
1423
|
+
class re extends b {
|
|
1424
|
+
static styles = [...U, os];
|
|
1417
1425
|
static properties = {
|
|
1418
1426
|
...b.properties,
|
|
1419
1427
|
sport: { type: String },
|
|
@@ -1430,16 +1438,16 @@ class ae extends b {
|
|
|
1430
1438
|
t && (this.pollDate = t);
|
|
1431
1439
|
}
|
|
1432
1440
|
async fetchData(t) {
|
|
1433
|
-
const e = this.season ||
|
|
1441
|
+
const e = this.season || K(), [s, r, o, n, i] = await Promise.all([
|
|
1434
1442
|
t.listRankings({ sport: this.sport, ...this.gender ? { gender: this.gender } : {} }),
|
|
1435
1443
|
t.listSchools(),
|
|
1436
1444
|
t.listTeams({ sport: this.sport }),
|
|
1437
1445
|
t.listConferences(),
|
|
1438
1446
|
t.listGames({ sport: this.sport, season: e })
|
|
1439
|
-
]),
|
|
1447
|
+
]), c = s.items.filter((h) => !this.gender || !h.gender || h.gender === this.gender).sort((h, d) => d.effectiveDate.localeCompare(h.effectiveDate));
|
|
1440
1448
|
return {
|
|
1441
1449
|
season: e,
|
|
1442
|
-
polls:
|
|
1450
|
+
polls: c,
|
|
1443
1451
|
schools: r.items,
|
|
1444
1452
|
teams: o.items,
|
|
1445
1453
|
conferences: n.items,
|
|
@@ -1450,7 +1458,7 @@ class ae extends b {
|
|
|
1450
1458
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
1451
1459
|
teamsById: $(this.data.teams),
|
|
1452
1460
|
schoolsById: $(this.data.schools),
|
|
1453
|
-
records:
|
|
1461
|
+
records: Q(this.data.games),
|
|
1454
1462
|
rankings: this.data.polls,
|
|
1455
1463
|
hrefs: O(this),
|
|
1456
1464
|
sport: this.sport
|
|
@@ -1462,40 +1470,40 @@ class ae extends b {
|
|
|
1462
1470
|
if (f === -1) return null;
|
|
1463
1471
|
const g = e.length === 1 ? 96 / 2 : u / (e.length - 1) * 90 + 3, x = 3 + f / 24 * 20;
|
|
1464
1472
|
return { x: g, y: x };
|
|
1465
|
-
}),
|
|
1466
|
-
let
|
|
1473
|
+
}), c = [];
|
|
1474
|
+
let h = [];
|
|
1467
1475
|
if (i.forEach((p) => {
|
|
1468
|
-
p ?
|
|
1469
|
-
}),
|
|
1476
|
+
p ? h.push(p) : h.length && (c.push(h), h = []);
|
|
1477
|
+
}), h.length && c.push(h), !c.length) return m;
|
|
1470
1478
|
const d = i[s];
|
|
1471
|
-
return
|
|
1472
|
-
${
|
|
1479
|
+
return l`<svg class="sparkline" width=${96} height=${26} viewBox="0 0 ${96} ${26}" role="img" aria-label="rank history">
|
|
1480
|
+
${c.map((p) => zt`<polyline fill="none" stroke="var(--hsot-red)" stroke-width="2"
|
|
1473
1481
|
points=${p.map((u) => `${u.x.toFixed(1)},${u.y.toFixed(1)}`).join(" ")}></polyline>`)}
|
|
1474
1482
|
${d ? zt`<circle cx=${d.x.toFixed(1)} cy=${d.y.toFixed(1)} r="3" fill="var(--hsot-black)"></circle>` : m}
|
|
1475
1483
|
</svg>`;
|
|
1476
1484
|
}
|
|
1477
1485
|
movement(t, e, s) {
|
|
1478
|
-
const r =
|
|
1479
|
-
return r.kind === "up" ?
|
|
1486
|
+
const r = ss(t, e, s);
|
|
1487
|
+
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>`;
|
|
1480
1488
|
}
|
|
1481
1489
|
renderView() {
|
|
1482
1490
|
const t = this.ctx, e = this.data.polls;
|
|
1483
|
-
if (!e.length) return
|
|
1484
|
-
const s = Math.max(0, e.findIndex((p) => p.effectiveDate === this.pollDate)), r = e[s] || e[0], o = e[s + 1] || null, n = e.slice().reverse(), i = n.indexOf(r),
|
|
1485
|
-
return
|
|
1486
|
-
${
|
|
1487
|
-
title:
|
|
1488
|
-
sub:
|
|
1491
|
+
if (!e.length) return l`<div class="view"><p class="empty">No ${this.sport} polls published yet this season.</p></div>`;
|
|
1492
|
+
const s = Math.max(0, e.findIndex((p) => p.effectiveDate === this.pollDate)), r = e[s] || e[0], o = e[s + 1] || null, n = e.slice().reverse(), i = n.indexOf(r), c = $(this.data.conferences), h = (r.teamIds || [])[0], d = h ? C(t, h) : null;
|
|
1493
|
+
return l`
|
|
1494
|
+
${lt(this, t, {
|
|
1495
|
+
title: l`${D(this.sport)} Top 25`,
|
|
1496
|
+
sub: l`The HighSchoolOT poll · updated weekly · ${e.length} polls this season`,
|
|
1489
1497
|
teams: this.data.teams
|
|
1490
1498
|
})}
|
|
1491
|
-
${P(this,
|
|
1492
|
-
${
|
|
1499
|
+
${P(this, l`
|
|
1500
|
+
${B(this)}
|
|
1493
1501
|
<div class="toolbar">
|
|
1494
1502
|
<label class="asof" for="pollsel">Poll of</label>
|
|
1495
1503
|
<select id="pollsel" @change=${(p) => {
|
|
1496
1504
|
this.pollDate = p.target.value;
|
|
1497
1505
|
}}>
|
|
1498
|
-
${e.map((p, u) =>
|
|
1506
|
+
${e.map((p, u) => l`<option value=${p.effectiveDate} ?selected=${p === r}>
|
|
1499
1507
|
${w(p.effectiveDate, { month: "long", day: "numeric", year: "numeric" })}${u === 0 ? " · current" : ""}
|
|
1500
1508
|
</option>`)}
|
|
1501
1509
|
</select>
|
|
@@ -1510,14 +1518,14 @@ class ae extends b {
|
|
|
1510
1518
|
<span class="spacer"></span>
|
|
1511
1519
|
<span class="asof">Movement vs. the previous poll · sparkline = season rank history</span>
|
|
1512
1520
|
</div>
|
|
1513
|
-
${d ? this.renderHero(t, r, o,
|
|
1521
|
+
${d ? this.renderHero(t, r, o, h, d, c) : m}
|
|
1514
1522
|
<div class="card"><div class="tablewrap"><table class="data">
|
|
1515
1523
|
<thead><tr>
|
|
1516
1524
|
<th class="num">Rk</th><th>Mvmt</th><th>Team</th><th class="num">Record</th>
|
|
1517
1525
|
<th>Conference</th><th>Last result</th><th>Next</th><th>Season</th>
|
|
1518
1526
|
</tr></thead>
|
|
1519
1527
|
<tbody>
|
|
1520
|
-
${(r.teamIds || []).map((p, u) => u === 0 || !p ? m : this.renderRow(t, r, o, n, i,
|
|
1528
|
+
${(r.teamIds || []).map((p, u) => u === 0 || !p ? m : this.renderRow(t, r, o, n, i, c, p, u + 1))}
|
|
1521
1529
|
</tbody>
|
|
1522
1530
|
</table></div></div>
|
|
1523
1531
|
<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>
|
|
@@ -1525,50 +1533,50 @@ class ae extends b {
|
|
|
1525
1533
|
`;
|
|
1526
1534
|
}
|
|
1527
1535
|
renderHero(t, e, s, r, o, n) {
|
|
1528
|
-
const i = t.records[r],
|
|
1529
|
-
return
|
|
1536
|
+
const i = t.records[r], c = Ot(t.records, r), h = n[t.teamsById[r]?.conferenceId], d = `linear-gradient(120deg, ${o.colorPrimary || "#030711"} 0%, var(--hsot-black) 85%)`;
|
|
1537
|
+
return l`
|
|
1530
1538
|
<div class="hero1" style="background:${d}">
|
|
1531
1539
|
<div class="bigrank">#1</div>
|
|
1532
1540
|
${E(o, 64)}
|
|
1533
1541
|
<div>
|
|
1534
1542
|
<h2><a href=${v(t.hrefs.school, { id: o.id })}>${o.name} ${o.mascot || ""}</a></h2>
|
|
1535
1543
|
<div class="facts">
|
|
1536
|
-
${k(i)} overall${
|
|
1537
|
-
· streak ${
|
|
1538
|
-
${
|
|
1544
|
+
${k(i)} overall${h ? l` · ${k(i, !0)} ${h.name}` : m}
|
|
1545
|
+
· streak ${it(i?.results) || "·"}
|
|
1546
|
+
${c ? l` · last: ${c.mark} ${c.my}-${c.their} vs ${st(t, c.opp)}` : m}
|
|
1539
1547
|
${this.movement(e, s, r)}
|
|
1540
1548
|
</div>
|
|
1541
1549
|
</div>
|
|
1542
1550
|
</div>
|
|
1543
1551
|
`;
|
|
1544
1552
|
}
|
|
1545
|
-
renderRow(t, e, s, r, o, n, i,
|
|
1546
|
-
const
|
|
1547
|
-
if (!
|
|
1553
|
+
renderRow(t, e, s, r, o, n, i, c) {
|
|
1554
|
+
const h = C(t, i);
|
|
1555
|
+
if (!h) return m;
|
|
1548
1556
|
const d = t.records[i], p = Ot(t.records, i), u = bt(this.data.games, i), f = n[t.teamsById[i]?.conferenceId], g = () => {
|
|
1549
|
-
location.href = v(t.hrefs.school, { id:
|
|
1557
|
+
location.href = v(t.hrefs.school, { id: h.id });
|
|
1550
1558
|
};
|
|
1551
|
-
return
|
|
1559
|
+
return l`
|
|
1552
1560
|
<tr class="rowlink" @click=${(x) => {
|
|
1553
1561
|
x.target.closest("a") || g();
|
|
1554
1562
|
}}>
|
|
1555
|
-
<td class="num" style="font-weight:700">${
|
|
1563
|
+
<td class="num" style="font-weight:700">${c}</td>
|
|
1556
1564
|
<td>${this.movement(e, s, i)}</td>
|
|
1557
|
-
<td class="teamcell">${E(
|
|
1558
|
-
<span class="mut" style="font-size:0.78rem">${
|
|
1565
|
+
<td class="teamcell">${E(h)}<a href=${v(t.hrefs.school, { id: h.id })}>${h.name}</a>
|
|
1566
|
+
<span class="mut" style="font-size:0.78rem">${h.mascot || ""}</span></td>
|
|
1559
1567
|
<td class="num">${k(d)}</td>
|
|
1560
1568
|
<td class="mut">${f?.name || "Independent"}</td>
|
|
1561
|
-
<td>${p ?
|
|
1569
|
+
<td>${p ? l`<a class="box" style="text-decoration:none" href=${v(t.hrefs.game, { sport: this.sport, id: p.gameId })}>
|
|
1562
1570
|
<b style="color:${p.mark === "W" ? "var(--hsot-win)" : p.mark === "L" ? "var(--hsot-loss)" : "var(--hsot-tie)"}">${p.mark}</b>
|
|
1563
|
-
${p.my}-${p.their} vs ${
|
|
1564
|
-
<td>${
|
|
1571
|
+
${p.my}-${p.their} vs ${st(t, p.opp)}</a>` : l`<span class="mut">·</span>`}</td>
|
|
1572
|
+
<td>${ee(t, u, i)}</td>
|
|
1565
1573
|
<td>${this.sparkline(i, r, o)}</td>
|
|
1566
1574
|
</tr>
|
|
1567
1575
|
`;
|
|
1568
1576
|
}
|
|
1569
1577
|
}
|
|
1570
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings",
|
|
1571
|
-
const
|
|
1578
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings", re);
|
|
1579
|
+
const ns = y`
|
|
1572
1580
|
.schoolhero { color: var(--hsot-white); padding: 1.6rem 1.25rem 1.3rem; }
|
|
1573
1581
|
.schoolhero .inner { max-width: 1366px; margin: 0 auto; display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
|
|
1574
1582
|
.schoolhero .crest {
|
|
@@ -1622,8 +1630,8 @@ const os = y`
|
|
|
1622
1630
|
table.data.roster .sub { display: block; font-weight: 400; font-size: 0.78rem; color: var(--hsot-gray-5); }
|
|
1623
1631
|
}
|
|
1624
1632
|
`;
|
|
1625
|
-
class
|
|
1626
|
-
static styles = [...U,
|
|
1633
|
+
class oe extends b {
|
|
1634
|
+
static styles = [...U, ns];
|
|
1627
1635
|
static properties = {
|
|
1628
1636
|
...b.properties,
|
|
1629
1637
|
schoolId: { type: String, attribute: "school-id" },
|
|
@@ -1640,7 +1648,7 @@ class re extends b {
|
|
|
1640
1648
|
t && !this.sport && (this.sport = t);
|
|
1641
1649
|
}
|
|
1642
1650
|
async fetchData(t) {
|
|
1643
|
-
const e = this.season ||
|
|
1651
|
+
const e = this.season || K(), s = await t.getSchool(this.schoolId), o = (await t.listTeams({ schoolId: this.schoolId })).items, n = o.find((g) => g.sport === (this.sport || "football")) || o[0] || null, [i, c, h, d, p, u, f] = await Promise.all([
|
|
1644
1652
|
n ? t.listGames({ sport: n.sport, season: e }) : Promise.resolve({ items: [] }),
|
|
1645
1653
|
n ? t.listTeams({ sport: n.sport }) : Promise.resolve({ items: [] }),
|
|
1646
1654
|
t.listSchools(),
|
|
@@ -1657,8 +1665,8 @@ class re extends b {
|
|
|
1657
1665
|
teams: o,
|
|
1658
1666
|
active: n,
|
|
1659
1667
|
games: i.items,
|
|
1660
|
-
allTeams:
|
|
1661
|
-
schools:
|
|
1668
|
+
allTeams: c.items,
|
|
1669
|
+
schools: h.items,
|
|
1662
1670
|
conferences: d.items,
|
|
1663
1671
|
rankings: p.items,
|
|
1664
1672
|
roster: u.items.find((g) => g.season === e) || null,
|
|
@@ -1669,7 +1677,7 @@ class re extends b {
|
|
|
1669
1677
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
1670
1678
|
teamsById: $(this.data.allTeams.length ? this.data.allTeams : this.data.teams),
|
|
1671
1679
|
schoolsById: $(this.data.schools),
|
|
1672
|
-
records:
|
|
1680
|
+
records: Q(this.data.games),
|
|
1673
1681
|
rankings: this.data.rankings,
|
|
1674
1682
|
hrefs: O(this),
|
|
1675
1683
|
sport: this.data.active?.sport || "football"
|
|
@@ -1680,61 +1688,61 @@ class re extends b {
|
|
|
1680
1688
|
}
|
|
1681
1689
|
renderView() {
|
|
1682
1690
|
const { school: t, teams: e, active: s, season: r } = this.data;
|
|
1683
|
-
if (!t) return
|
|
1684
|
-
const o = this.ctx, n =
|
|
1685
|
-
return
|
|
1691
|
+
if (!t) return l`<div class="view"><p class="empty">School not found.</p></div>`;
|
|
1692
|
+
const o = this.ctx, n = tt(t.colorPrimary || "#030711"), i = (t.adm || [])[0], c = $(this.data.conferences), h = s ? c[s.conferenceId] : null;
|
|
1693
|
+
return l`
|
|
1686
1694
|
<div class="schoolhero" style="background:linear-gradient(115deg, ${t.colorPrimary || "#030711"} 0%, ${t.colorPrimary || "#030711"} 55%, var(--hsot-black) 100%);color:${n}">
|
|
1687
1695
|
<div class="inner">
|
|
1688
|
-
${
|
|
1696
|
+
${et(t, 84) ? l`<img class="crest logo" alt="" loading="lazy" src=${et(t, 84)} />` : l`<div class="crest" style="background:${t.colorSecondary || "#7C7C7C"};color:${tt(t.colorSecondary || "#7C7C7C")}">${$t(t)}</div>`}
|
|
1689
1697
|
<div style="min-width:260px">
|
|
1690
1698
|
<h1>${t.name} <span class="mascot">${t.mascot || ""}</span></h1>
|
|
1691
1699
|
<div class="facts">
|
|
1692
|
-
${t.location ?
|
|
1693
|
-
${t.association ?
|
|
1694
|
-
${
|
|
1695
|
-
${i ?
|
|
1696
|
-
${t.openingYear ?
|
|
1697
|
-
${t.areaCode ?
|
|
1700
|
+
${t.location ? l`<span><b>Location</b>${t.location}${t.county ? l` · ${t.county} County` : m}</span>` : m}
|
|
1701
|
+
${t.association ? l`<span><b>League</b>${t.association}${t.classification ? l` · ${t.classification}` : m}</span>` : m}
|
|
1702
|
+
${h ? l`<span><b>Conference</b>${h.name}</span>` : m}
|
|
1703
|
+
${i ? l`<span><b>Enrollment</b>${i.value.toLocaleString()} (${i.season} ADM)</span>` : m}
|
|
1704
|
+
${t.openingYear ? l`<span><b>Opened</b>${t.openingYear}</span>` : m}
|
|
1705
|
+
${t.areaCode ? l`<span><b>Area</b>${t.areaCode}</span>` : m}
|
|
1698
1706
|
</div>
|
|
1699
1707
|
</div>
|
|
1700
1708
|
</div>
|
|
1701
1709
|
</div>
|
|
1702
1710
|
<div class="band">
|
|
1703
1711
|
<nav class="tabs" aria-label="Teams">
|
|
1704
|
-
${e.map((d) => d.id === s?.id ?
|
|
1712
|
+
${e.map((d) => d.id === s?.id ? l`<a class="on" href="#" @click=${(p) => p.preventDefault()}>${d.name}</a>` : l`<a href="#" @click=${(p) => {
|
|
1705
1713
|
p.preventDefault(), this.switchSport(d.sport);
|
|
1706
1714
|
}}>${d.name}</a>`)}
|
|
1707
1715
|
</nav>
|
|
1708
1716
|
</div>
|
|
1709
|
-
${P(this,
|
|
1710
|
-
${
|
|
1711
|
-
${s ? this.renderTeam(o, s,
|
|
1717
|
+
${P(this, l`
|
|
1718
|
+
${B(this)}
|
|
1719
|
+
${s ? this.renderTeam(o, s, h, r) : l`<p class="empty">No teams recorded for this school yet.</p>`}
|
|
1712
1720
|
`)}
|
|
1713
1721
|
`;
|
|
1714
1722
|
}
|
|
1715
1723
|
renderTeam(t, e, s, r) {
|
|
1716
|
-
const o = t.records[e.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((p) => p.conferenceId === s.id) : [],
|
|
1717
|
-
return
|
|
1724
|
+
const o = t.records[e.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((p) => p.conferenceId === s.id) : [], c = s ? Xt(i, t.records).findIndex((p) => p.team.id === e.id) + 1 : 0, h = yt(t.rankings, t.teamsById, e.id, e.sport, null), d = this.data.games.filter((p) => p.homeTeamId === e.id || p.awayTeamId === e.id).sort((p, u) => String(p.date).localeCompare(String(u.date)));
|
|
1725
|
+
return l`
|
|
1718
1726
|
<div class="tiles">
|
|
1719
1727
|
<div class="tile"><div class="k">Overall</div><div class="v">${k(o)}</div><div class="s">${n} games played</div></div>
|
|
1720
1728
|
<div class="tile"><div class="k">${s?.name || "Conference"}</div><div class="v">${k(o, !0)}</div>
|
|
1721
|
-
<div class="s">${
|
|
1729
|
+
<div class="s">${c ? `${Le(c)} of ${i.length}` : "·"}</div></div>
|
|
1722
1730
|
<div class="tile"><div class="k">Points</div><div class="v">${n ? (o.pf / n).toFixed(1) : "0.0"}</div>
|
|
1723
1731
|
<div class="s">scored per game · ${n ? (o.pa / n).toFixed(1) : "0.0"} allowed</div></div>
|
|
1724
|
-
<div class="tile"><div class="k">Streak</div><div class="v">${
|
|
1732
|
+
<div class="tile"><div class="k">Streak</div><div class="v">${it(o.results) || "·"}</div>
|
|
1725
1733
|
<div class="s">last 5: ${xt(t, e.id)}</div></div>
|
|
1726
|
-
<div class="tile"><div class="k">HSOT Top 25</div><div class="v">${
|
|
1734
|
+
<div class="tile"><div class="k">HSOT Top 25</div><div class="v">${h ? `#${h}` : "NR"}</div>
|
|
1727
1735
|
<div class="s"><a href=${v(t.hrefs.section, { sport: e.sport, view: "rankings" })}>full poll</a></div></div>
|
|
1728
1736
|
</div>
|
|
1729
|
-
${(e.championships || []).length ?
|
|
1737
|
+
${(e.championships || []).length ? l`
|
|
1730
1738
|
<div style="margin:-0.2rem 0 1rem;display:flex;gap:0.4rem;flex-wrap:wrap">
|
|
1731
|
-
${e.championships.map((p) =>
|
|
1739
|
+
${e.championships.map((p) => l`<span class="pill champ">★ ${p.season} ${p.title} champion${p.classification ? ` · ${p.classification}` : ""}${p.region ? ` · ${p.region}` : ""}</span>`)}
|
|
1732
1740
|
</div>` : m}
|
|
1733
1741
|
<div class="cols">
|
|
1734
1742
|
<div>
|
|
1735
1743
|
<div class="section-title">Schedule & results</div>
|
|
1736
1744
|
<div class="card">
|
|
1737
|
-
${d.length ?
|
|
1745
|
+
${d.length ? l`<ul class="gamelist">${d.map((p) => this.renderGameRow(t, e, p))}</ul>` : l`<p class="empty">No ${e.sport} games recorded for ${r}.</p>`}
|
|
1738
1746
|
</div>
|
|
1739
1747
|
</div>
|
|
1740
1748
|
<div>
|
|
@@ -1746,20 +1754,20 @@ class re extends b {
|
|
|
1746
1754
|
}
|
|
1747
1755
|
renderGameRow(t, e, s) {
|
|
1748
1756
|
const r = s.homeTeamId === e.id, o = r ? s.awayTeamId : s.homeTeamId, n = r ? s.homeScore : s.awayScore, i = r ? s.awayScore : s.homeScore;
|
|
1749
|
-
let
|
|
1757
|
+
let c = l`<span class="mut">${gt(s.time)}</span>`;
|
|
1750
1758
|
if (s.state === "final") {
|
|
1751
|
-
const d =
|
|
1752
|
-
|
|
1753
|
-
} else s.state === "live" && (
|
|
1754
|
-
const
|
|
1755
|
-
return
|
|
1759
|
+
const d = nt(s), p = d === "tie" ? "T" : d === (r ? "home" : "away") ? "W" : "L";
|
|
1760
|
+
c = l`<span class=${p}>${p}</span> ${n}-${i}${s.finish === "overtime" ? l` <span class="mut">OT</span>` : m}${s.forfeit && s.forfeit !== "none" ? l` <span class="mut">FF</span>` : m}`;
|
|
1761
|
+
} else s.state === "live" && (c = l`<span style="color:var(--hsot-red)">${n}-${i}</span>`);
|
|
1762
|
+
const h = s.gameType === "conference" ? "Conf" : s.gameType === "nonconference" ? "Non-conf" : s.gameType === "playoff" ? `Playoff${s.label ? ` · ${s.label}` : ""}` : "Scrimmage";
|
|
1763
|
+
return l`
|
|
1756
1764
|
<li>
|
|
1757
1765
|
<span class="d">${w(s.date)}</span>
|
|
1758
|
-
${
|
|
1759
|
-
<span class="res">${
|
|
1760
|
-
<span class="opp">${r ? "vs" : "at"} ${
|
|
1761
|
-
<span class="pill type">${
|
|
1762
|
-
${s.broadcast ?
|
|
1766
|
+
${Zt(s).kind === "sched" ? m : V(s)}
|
|
1767
|
+
<span class="res">${c}</span>
|
|
1768
|
+
<span class="opp">${r ? "vs" : "at"} ${at(t, o, s.date)}
|
|
1769
|
+
<span class="pill type">${h}</span>
|
|
1770
|
+
${s.broadcast ? l`<span class="pill class">${s.broadcast}</span>` : m}
|
|
1763
1771
|
</span>
|
|
1764
1772
|
<span class="where">${s.venue || ""}</span>
|
|
1765
1773
|
<a class="box" href=${v(t.hrefs.game, { sport: e.sport, id: s.id })}>Box score →</a>
|
|
@@ -1769,26 +1777,26 @@ class re extends b {
|
|
|
1769
1777
|
renderRoster(t, e) {
|
|
1770
1778
|
const s = this.data.roster;
|
|
1771
1779
|
if (!s)
|
|
1772
|
-
return
|
|
1773
|
-
const r =
|
|
1774
|
-
return
|
|
1775
|
-
${r ?
|
|
1780
|
+
return l`<p class="empty">Roster not published for ${e}.</p>`;
|
|
1781
|
+
const r = rs(s, 560), o = this.data.school?.name || "", n = $(this.data.players), i = s.entries.slice().sort((h, d) => (h.number || 0) - (d.number || 0)), c = i.some((h) => n[h.playerId]?.college);
|
|
1782
|
+
return l`
|
|
1783
|
+
${r ? l`<img class="rosterphoto" src=${r} loading="lazy" decoding="async"
|
|
1776
1784
|
alt="${o} ${t.name} ${e} team photo" />` : m}
|
|
1777
1785
|
<div class="tablewrap"><table class="data roster">
|
|
1778
|
-
<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>${
|
|
1786
|
+
<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>${c ? l`<th>College</th>` : m}</tr></thead>
|
|
1779
1787
|
<tbody>
|
|
1780
|
-
${i.map((
|
|
1781
|
-
const d = n[
|
|
1788
|
+
${i.map((h) => {
|
|
1789
|
+
const d = n[h.playerId];
|
|
1782
1790
|
if (!d) return m;
|
|
1783
|
-
const p =
|
|
1784
|
-
return
|
|
1785
|
-
<td class="num mut">${
|
|
1791
|
+
const p = Ue(h), u = [p, d.classOf].filter(Boolean).join(" · ") || "·";
|
|
1792
|
+
return l`<tr>
|
|
1793
|
+
<td class="num mut">${h.number ?? "·"}</td>
|
|
1786
1794
|
<td class="player" style="font-weight:500">${d.firstName} ${d.lastName}<span class="sub">${u}</span></td>
|
|
1787
1795
|
<td class="pos">${p || "·"}</td>
|
|
1788
1796
|
<td class="cls mut">${d.classOf || "·"}</td>
|
|
1789
|
-
<td class="num">${
|
|
1797
|
+
<td class="num">${Oe(d.heightIn)}</td>
|
|
1790
1798
|
<td class="num">${d.weightLb || "·"}</td>
|
|
1791
|
-
${
|
|
1799
|
+
${c ? l`<td class="college">${d.college || "·"}</td>` : m}
|
|
1792
1800
|
</tr>`;
|
|
1793
1801
|
})}
|
|
1794
1802
|
</tbody>
|
|
@@ -1796,8 +1804,8 @@ class re extends b {
|
|
|
1796
1804
|
`;
|
|
1797
1805
|
}
|
|
1798
1806
|
}
|
|
1799
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school",
|
|
1800
|
-
const
|
|
1807
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school", oe);
|
|
1808
|
+
const ne = {
|
|
1801
1809
|
football: ["quarters", 4],
|
|
1802
1810
|
flag_football: ["quarters", 4],
|
|
1803
1811
|
basketball: ["quarters", 4],
|
|
@@ -1808,30 +1816,30 @@ const oe = {
|
|
|
1808
1816
|
softball: ["innings", 7],
|
|
1809
1817
|
volleyball: ["sets", 3]
|
|
1810
1818
|
};
|
|
1811
|
-
function
|
|
1812
|
-
return (
|
|
1819
|
+
function ie(a) {
|
|
1820
|
+
return (ne[a] || ["quarters", 4])[0];
|
|
1813
1821
|
}
|
|
1814
1822
|
function kt(a) {
|
|
1815
|
-
return (
|
|
1823
|
+
return (ne[a] || ["quarters", 4])[1];
|
|
1816
1824
|
}
|
|
1817
|
-
function
|
|
1818
|
-
const e =
|
|
1825
|
+
function is(a, t) {
|
|
1826
|
+
const e = ie(a), s = kt(a);
|
|
1819
1827
|
if (t <= s || e === "innings" || e === "sets") return String(t);
|
|
1820
1828
|
const r = t - s;
|
|
1821
1829
|
return `OT${r > 1 ? r : ""}`;
|
|
1822
1830
|
}
|
|
1823
|
-
function
|
|
1831
|
+
function ls(a, t) {
|
|
1824
1832
|
const e = String(a ?? "").trim();
|
|
1825
1833
|
let s;
|
|
1826
|
-
return (s = /^(\d+)Q$/i.exec(e)) || (s = /^(\d+)H$/i.exec(e)) ? Number(s[1]) : /^half$/i.test(e) ?
|
|
1834
|
+
return (s = /^(\d+)Q$/i.exec(e)) || (s = /^(\d+)H$/i.exec(e)) ? Number(s[1]) : /^half$/i.test(e) ? ie(t) === "halves" ? 1 : 2 : (s = /^(\d*)OT(\d*)$/i.exec(e)) ? kt(t) + Number(s[1] || s[2] || 1) : (s = /^[TB](\d+)$/i.exec(e)) || (s = /^(\d+)(?:st|nd|rd|th)\s*set$/i.exec(e)) || (s = /^set\s*(\d+)$/i.exec(e)) ? Number(s[1]) : null;
|
|
1827
1835
|
}
|
|
1828
|
-
const
|
|
1829
|
-
function
|
|
1836
|
+
const Z = (a) => Number.isInteger(a) && a >= 0 ? a : null;
|
|
1837
|
+
function cs(a) {
|
|
1830
1838
|
const t = Array.isArray(a?.scoringPlays) ? a.scoringPlays : [];
|
|
1831
1839
|
if (!t.length) return null;
|
|
1832
1840
|
const e = a.sport, s = /* @__PURE__ */ new Map();
|
|
1833
1841
|
for (const p of t) {
|
|
1834
|
-
const u =
|
|
1842
|
+
const u = ls(p?.period, e), f = Z(p?.homeScore), g = Z(p?.awayScore);
|
|
1835
1843
|
if (!u || f === null || g === null) return null;
|
|
1836
1844
|
const x = s.get(u) || { home: 0, away: 0 };
|
|
1837
1845
|
x.home = Math.max(x.home, f), x.away = Math.max(x.away, g), s.set(u, x);
|
|
@@ -1842,23 +1850,23 @@ function ls(a) {
|
|
|
1842
1850
|
const u = s.get(p) || i, f = u.home - i.home, g = u.away - i.away;
|
|
1843
1851
|
(f < 0 || g < 0) && (n = !1), o.push({ period: p, home: Math.max(f, 0), away: Math.max(g, 0) }), i = { home: Math.max(u.home, i.home), away: Math.max(u.away, i.away) };
|
|
1844
1852
|
}
|
|
1845
|
-
const
|
|
1846
|
-
return n = n && i.home <=
|
|
1853
|
+
const c = Z(a.homeScore) ?? 0, h = Z(a.awayScore) ?? 0, d = n && i.home === c && i.away === h;
|
|
1854
|
+
return n = n && i.home <= c && i.away <= h, { periods: o, reconciled: d, consistent: n };
|
|
1847
1855
|
}
|
|
1848
|
-
function
|
|
1856
|
+
function hs(a) {
|
|
1849
1857
|
if (Array.isArray(a?.periodScores) && a.periodScores.length) return a.periodScores;
|
|
1850
|
-
const t =
|
|
1858
|
+
const t = cs(a);
|
|
1851
1859
|
return t ? a.state === "final" ? t.reconciled ? t.periods : null : t.consistent ? t.periods : null : null;
|
|
1852
1860
|
}
|
|
1853
|
-
const
|
|
1854
|
-
function
|
|
1861
|
+
const ds = "https://api.wral.com/search";
|
|
1862
|
+
function ps(a) {
|
|
1855
1863
|
return a.map((t) => `uri:"${t}"`).join(" OR ");
|
|
1856
1864
|
}
|
|
1857
|
-
function
|
|
1858
|
-
const e = String(a ||
|
|
1865
|
+
function ms(a, t) {
|
|
1866
|
+
const e = String(a || ds).replace(/\/+$/, ""), s = new URLSearchParams({ query: ps(t), sort: "score", lang: "en" });
|
|
1859
1867
|
return `${e}/v1/query?${s}`;
|
|
1860
1868
|
}
|
|
1861
|
-
function
|
|
1869
|
+
function le(a) {
|
|
1862
1870
|
try {
|
|
1863
1871
|
const t = new URL(a);
|
|
1864
1872
|
if (/(^|\.)smugmug\.com$/i.test(t.hostname)) {
|
|
@@ -1873,13 +1881,13 @@ function ie(a) {
|
|
|
1873
1881
|
}
|
|
1874
1882
|
return { uri: a, title: a };
|
|
1875
1883
|
}
|
|
1876
|
-
async function
|
|
1877
|
-
const r = await ((...i) => fetch(...i))(
|
|
1884
|
+
async function us(a, t, e) {
|
|
1885
|
+
const r = await ((...i) => fetch(...i))(ms(a, t));
|
|
1878
1886
|
if (!r.ok) throw new Error(`search answered ${r.status}`);
|
|
1879
1887
|
const o = await r.json(), n = new Map((o.items || []).map((i) => [i.uri, i]));
|
|
1880
|
-
return t.map((i) => n.get(i) ||
|
|
1888
|
+
return t.map((i) => n.get(i) || le(i));
|
|
1881
1889
|
}
|
|
1882
|
-
const
|
|
1890
|
+
const fs = y`
|
|
1883
1891
|
.breadcrumbs { font-size: 0.8125rem; margin: 0.9rem 0 0; color: var(--hsot-gray-5); }
|
|
1884
1892
|
.breadcrumbs a { text-decoration: none; }
|
|
1885
1893
|
.scorehead { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center; padding: 1.4rem 1rem; }
|
|
@@ -1922,6 +1930,9 @@ const us = y`
|
|
|
1922
1930
|
table.plays-table td.play { white-space: normal; min-width: 12rem; }
|
|
1923
1931
|
/* Game notes are typed with line breaks the desk means to keep. */
|
|
1924
1932
|
.gamenote { padding: 0 1rem 0.9rem; text-align: center; white-space: pre-line; }
|
|
1933
|
+
/* The embed's way out to everything it drops (Coverage, season context,
|
|
1934
|
+
head to head) — the data page still renders all of it. */
|
|
1935
|
+
.fullbox { margin: 0.9rem 0 0; text-align: center; font-size: 0.875rem; }
|
|
1925
1936
|
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
|
|
1926
1937
|
.ctxcard { padding: 0.85rem 1rem; }
|
|
1927
1938
|
.ctxcard .who { font-family: var(--hsot-heading-font); font-weight: 700; margin-bottom: 0.4rem; }
|
|
@@ -1932,8 +1943,8 @@ const us = y`
|
|
|
1932
1943
|
.cols { grid-template-columns: 1fr; }
|
|
1933
1944
|
}
|
|
1934
1945
|
`;
|
|
1935
|
-
class
|
|
1936
|
-
static styles = [...U,
|
|
1946
|
+
class ce extends b {
|
|
1947
|
+
static styles = [...U, fs];
|
|
1937
1948
|
static properties = {
|
|
1938
1949
|
...b.properties,
|
|
1939
1950
|
gameId: { type: String, attribute: "game-id" },
|
|
@@ -1941,13 +1952,19 @@ class le extends b {
|
|
|
1941
1952
|
// (DEV-1236). Shared cross-stage by design — see the studio host's
|
|
1942
1953
|
// registry — so the prod default is right everywhere; the attribute
|
|
1943
1954
|
// exists for the same reason the href templates do.
|
|
1944
|
-
searchApi: { type: String, attribute: "search-api" }
|
|
1955
|
+
searchApi: { type: String, attribute: "search-api" },
|
|
1956
|
+
// Story pages embed the box score in the article column, where the page
|
|
1957
|
+
// chrome (breadcrumbs, the report-a-score line) and the cross-links
|
|
1958
|
+
// (Coverage, Season context, head-to-head) belong to the data page, not
|
|
1959
|
+
// the recap. `embed` keeps the score head, line score and scoring plays,
|
|
1960
|
+
// and links out to the full box score for the rest.
|
|
1961
|
+
embed: { type: Boolean }
|
|
1945
1962
|
};
|
|
1946
1963
|
constructor() {
|
|
1947
|
-
super(), this.gameId = "", this.searchApi = "";
|
|
1964
|
+
super(), this.gameId = "", this.searchApi = "", this.embed = !1;
|
|
1948
1965
|
}
|
|
1949
1966
|
async fetchData(t) {
|
|
1950
|
-
const e = await t.getGame(this.gameId), s = Array.isArray(e.coverageUrls) ? e.coverageUrls : [], [r, o, n, i,
|
|
1967
|
+
const e = await t.getGame(this.gameId), s = Array.isArray(e.coverageUrls) ? e.coverageUrls : [], [r, o, n, i, c, h] = await Promise.all([
|
|
1951
1968
|
t.listSchools(),
|
|
1952
1969
|
t.listTeams({ sport: e.sport }),
|
|
1953
1970
|
t.listConferences(),
|
|
@@ -1955,7 +1972,9 @@ class le extends b {
|
|
|
1955
1972
|
t.listGames({ sport: e.sport, season: e.season }),
|
|
1956
1973
|
// A search outage must not blank the box score — degrade to bare
|
|
1957
1974
|
// links (fetchCoverage already degrades per-URL index misses).
|
|
1958
|
-
|
|
1975
|
+
// The embed drops the Coverage grid, so it skips the search
|
|
1976
|
+
// round-trip entirely rather than fetching cards it will not render.
|
|
1977
|
+
s.length && !this.embed ? us(this.searchApi, s).catch(() => s.map(le)) : Promise.resolve([])
|
|
1959
1978
|
]);
|
|
1960
1979
|
return {
|
|
1961
1980
|
game: e,
|
|
@@ -1963,15 +1982,15 @@ class le extends b {
|
|
|
1963
1982
|
teams: o.items,
|
|
1964
1983
|
conferences: n.items,
|
|
1965
1984
|
rankings: i.items,
|
|
1966
|
-
games:
|
|
1967
|
-
coverage:
|
|
1985
|
+
games: c.items,
|
|
1986
|
+
coverage: h
|
|
1968
1987
|
};
|
|
1969
1988
|
}
|
|
1970
1989
|
get ctx() {
|
|
1971
1990
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
1972
1991
|
teamsById: $(this.data.teams),
|
|
1973
1992
|
schoolsById: $(this.data.schools),
|
|
1974
|
-
records:
|
|
1993
|
+
records: Q(this.data.games),
|
|
1975
1994
|
rankings: this.data.rankings,
|
|
1976
1995
|
hrefs: O(this),
|
|
1977
1996
|
sport: this.data.game.sport
|
|
@@ -1979,16 +1998,17 @@ class le extends b {
|
|
|
1979
1998
|
}
|
|
1980
1999
|
renderView() {
|
|
1981
2000
|
const t = this.data.game;
|
|
1982
|
-
if (!t) return
|
|
1983
|
-
const e = this.ctx, s = $(this.data.conferences), r = e.teamsById[t.awayTeamId] ? e.schoolsById[e.teamsById[t.awayTeamId].schoolId] : null, o = e.teamsById[t.homeTeamId] ? e.schoolsById[e.teamsById[t.homeTeamId].schoolId] : null, n =
|
|
1984
|
-
return
|
|
1985
|
-
${P(this,
|
|
1986
|
-
${
|
|
1987
|
-
|
|
1988
|
-
<
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
2001
|
+
if (!t) return l`<div class="view"><p class="empty">Game not found.</p></div>`;
|
|
2002
|
+
const e = this.ctx, s = $(this.data.conferences), r = e.teamsById[t.awayTeamId] ? e.schoolsById[e.teamsById[t.awayTeamId].schoolId] : null, o = e.teamsById[t.homeTeamId] ? e.schoolsById[e.teamsById[t.homeTeamId].schoolId] : null, n = nt(t), i = (d) => t.state === "final" && n !== d && n !== "tie" ? "opacity:0.45" : "", c = t.conferenceId ? s[t.conferenceId] : null, h = this.data.games.filter((d) => d.id !== t.id && d.state === "final" && d.gameType !== "scrimmage" && (d.homeTeamId === t.homeTeamId && d.awayTeamId === t.awayTeamId || d.homeTeamId === t.awayTeamId && d.awayTeamId === t.homeTeamId));
|
|
2003
|
+
return l`
|
|
2004
|
+
${P(this, l`
|
|
2005
|
+
${B(this)}
|
|
2006
|
+
${this.embed ? m : l`
|
|
2007
|
+
<p class="breadcrumbs">
|
|
2008
|
+
<a href=${v(e.hrefs.section, { sport: t.sport, view: "scores" })}>${D(t.sport)}</a> /
|
|
2009
|
+
<a href=${v(e.hrefs.section, { sport: t.sport, view: "scores" })}>Scores/Schedules</a> /
|
|
2010
|
+
${R(e, t.awayTeamId)} at ${R(e, t.homeTeamId)}
|
|
2011
|
+
</p>`}
|
|
1992
2012
|
<div class="card">
|
|
1993
2013
|
<div class="scorehead">
|
|
1994
2014
|
${this.teamBlock(e, t, t.awayTeamId, r, !1)}
|
|
@@ -1998,31 +2018,39 @@ class le extends b {
|
|
|
1998
2018
|
<span class="mut" style="font-size:1.6rem">–</span>
|
|
1999
2019
|
<span style=${i("home")}>${t.homeScore}</span>
|
|
2000
2020
|
</div>
|
|
2001
|
-
<div class="status">${
|
|
2002
|
-
<div class="status">${w(t.date, { weekday: "short", month: "short", day: "numeric", year: "numeric" })}${t.state === "scheduled" && t.time ?
|
|
2003
|
-
${t.broadcast ?
|
|
2021
|
+
<div class="status">${V(t)}</div>
|
|
2022
|
+
<div class="status">${w(t.date, { weekday: "short", month: "short", day: "numeric", year: "numeric" })}${t.state === "scheduled" && t.time ? l` · ${gt(t.time)}` : m} · ${t.venue || "Venue TBD"}
|
|
2023
|
+
${t.broadcast ? l` · <span class="pill class">${t.broadcast}</span>` : m}</div>
|
|
2004
2024
|
<div class="status">
|
|
2005
|
-
<span class="pill type">${t.gameType === "conference" ? `${
|
|
2006
|
-
${t.label ?
|
|
2007
|
-
${(t.tags || []).map((d) =>
|
|
2025
|
+
<span class="pill type">${t.gameType === "conference" ? `${c?.name || "Conference"} game` : t.gameType}</span>
|
|
2026
|
+
${t.label ? l`<span class="pill type">Bracket ${t.label}</span>` : m}
|
|
2027
|
+
${(t.tags || []).map((d) => l`<span class="pill type">${d}</span>`)}
|
|
2008
2028
|
</div>
|
|
2029
|
+
${this.embed ? m : l`
|
|
2030
|
+
<div class="status">
|
|
2031
|
+
<a href=${Qt(e.hrefs, t.id)}>Report a score for this game</a>
|
|
2032
|
+
</div>`}
|
|
2009
2033
|
</div>
|
|
2010
2034
|
${this.teamBlock(e, t, t.homeTeamId, o, !0)}
|
|
2011
2035
|
</div>
|
|
2012
2036
|
${this.renderLineScore(t, r, o)}
|
|
2013
2037
|
${this.renderScoringPlays(t, r, o)}
|
|
2014
|
-
${t.notes ?
|
|
2038
|
+
${t.notes ? l`<p class="note gamenote">${t.notes}</p>` : m}
|
|
2015
2039
|
</div>
|
|
2016
|
-
${
|
|
2040
|
+
${this.embed ? l`
|
|
2041
|
+
<p class="fullbox">
|
|
2042
|
+
<a href=${v(e.hrefs.game, { sport: t.sport, id: t.id })}>Full box score →</a>
|
|
2043
|
+
</p>` : l`
|
|
2044
|
+
${(this.data.coverage || []).length ? l`
|
|
2017
2045
|
<div class="section-title">Coverage</div>
|
|
2018
2046
|
<div class="covgrid">
|
|
2019
|
-
${this.data.coverage.map((d) =>
|
|
2047
|
+
${this.data.coverage.map((d) => l`
|
|
2020
2048
|
<a class="card covcard" href=${d.uri}>
|
|
2021
|
-
${d.image ?
|
|
2049
|
+
${d.image ? l`<img class="covimg" src=${d.image} alt="" loading="lazy" />` : m}
|
|
2022
2050
|
<div class="covbody">
|
|
2023
|
-
<div class="covtitle">${d.videoDuration ?
|
|
2024
|
-
${d.description ?
|
|
2025
|
-
${d.author || d.publishedTime ?
|
|
2051
|
+
<div class="covtitle">${d.videoDuration ? l`<span class="pill live" style="animation:none">Video</span> ` : m}${d.photos ? l`<span class="pill live" style="animation:none">Photos</span> ` : m}${d.title || d.uri}</div>
|
|
2052
|
+
${d.description ? l`<p class="covdesc">${d.description}</p>` : m}
|
|
2053
|
+
${d.author || d.publishedTime ? l`
|
|
2026
2054
|
<div class="covmeta">${[d.author, d.publishedTime ? new Date(d.publishedTime).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" }) : ""].filter(Boolean).join(" · ")}</div>
|
|
2027
2055
|
` : m}
|
|
2028
2056
|
</div>
|
|
@@ -2033,51 +2061,51 @@ class le extends b {
|
|
|
2033
2061
|
<div class="cols">
|
|
2034
2062
|
${[[t.awayTeamId, r], [t.homeTeamId, o]].map(([d, p]) => this.renderContext(e, d, p))}
|
|
2035
2063
|
</div>
|
|
2036
|
-
${
|
|
2064
|
+
${h.length ? l`
|
|
2037
2065
|
<div class="section-title">Head to head this season</div>
|
|
2038
2066
|
<div class="card"><ul class="gamelist">
|
|
2039
|
-
${
|
|
2040
|
-
<span class="d">${w(d.date)}</span>${
|
|
2067
|
+
${h.map((d) => l`<li>
|
|
2068
|
+
<span class="d">${w(d.date)}</span>${V(d)}
|
|
2041
2069
|
<span class="opp">${R(e, d.awayTeamId)} ${d.awayScore}, ${R(e, d.homeTeamId)} ${d.homeScore}</span>
|
|
2042
2070
|
<a class="box" href=${v(e.hrefs.game, { sport: t.sport, id: d.id })}>Box score →</a>
|
|
2043
2071
|
</li>`)}
|
|
2044
|
-
</ul></div>` : m}
|
|
2072
|
+
</ul></div>` : m}`}
|
|
2045
2073
|
`)}
|
|
2046
2074
|
`;
|
|
2047
2075
|
}
|
|
2048
2076
|
teamBlock(t, e, s, r, o) {
|
|
2049
|
-
if (!r) return
|
|
2050
|
-
const n = t.teamsById[s], i = t.records[s],
|
|
2051
|
-
return
|
|
2077
|
+
if (!r) return l`<div class="teamblock ${o ? "right" : ""}"><div class="tname">TBD</div></div>`;
|
|
2078
|
+
const n = t.teamsById[s], i = t.records[s], c = et(r, 58);
|
|
2079
|
+
return l`
|
|
2052
2080
|
<div class="teamblock ${o ? "right" : ""}">
|
|
2053
|
-
${
|
|
2081
|
+
${c ? l`<img class="crest logo" alt="" loading="lazy" src=${c} />` : l`<span class="crest" style="background:${r.colorPrimary || "#030711"};color:${tt(r.colorPrimary || "#030711")}">${$t(r)}</span>`}
|
|
2054
2082
|
<div>
|
|
2055
2083
|
<div class="tname">${wt(t, s, e.date)}<a href=${v(t.hrefs.school, { id: r.id })}>${r.name}</a></div>
|
|
2056
|
-
<div class="trec">${r.mascot || ""} · ${k(i)}${n?.conferenceId ?
|
|
2084
|
+
<div class="trec">${r.mascot || ""} · ${k(i)}${n?.conferenceId ? l` · ${k(i, !0)} conf` : m}</div>
|
|
2057
2085
|
</div>
|
|
2058
2086
|
</div>
|
|
2059
2087
|
`;
|
|
2060
2088
|
}
|
|
2061
2089
|
renderLineScore(t, e, s) {
|
|
2062
|
-
const r =
|
|
2090
|
+
const r = hs(t);
|
|
2063
2091
|
if (!r)
|
|
2064
|
-
return t.state === "scheduled" ?
|
|
2065
|
-
const o = Math.max(kt(t.sport), ...r.map((
|
|
2092
|
+
return t.state === "scheduled" ? l`<p class="empty" style="text-align:center">Period scoring will appear once the game starts.</p>` : m;
|
|
2093
|
+
const o = Math.max(kt(t.sport), ...r.map((h) => h.period)), n = (h) => is(t.sport, h), i = (h, d) => {
|
|
2066
2094
|
const p = r.find((u) => u.period === d);
|
|
2067
|
-
return p ? p[
|
|
2068
|
-
},
|
|
2095
|
+
return p ? p[h] : t.state === "final" ? 0 : "·";
|
|
2096
|
+
}, c = (h, d, p) => l`
|
|
2069
2097
|
<tr>
|
|
2070
|
-
<td class="teamcell">${E(
|
|
2071
|
-
${Array.from({ length: o }, (u, f) =>
|
|
2098
|
+
<td class="teamcell">${E(h, 20)}${h?.abbr || "TBD"}</td>
|
|
2099
|
+
${Array.from({ length: o }, (u, f) => l`<td class="num">${i(d, f + 1)}</td>`)}
|
|
2072
2100
|
<td class="num" style="font-weight:700">${p}</td>
|
|
2073
2101
|
</tr>`;
|
|
2074
|
-
return
|
|
2102
|
+
return l`
|
|
2075
2103
|
<div class="tablewrap" style="border-top:1px solid var(--hsot-gray-2)">
|
|
2076
2104
|
<table class="data" style="max-width:560px;margin:0.6rem auto 0.9rem">
|
|
2077
|
-
<thead><tr><th>Team</th>${Array.from({ length: o }, (
|
|
2105
|
+
<thead><tr><th>Team</th>${Array.from({ length: o }, (h, d) => l`<th class="num">${n(d + 1)}</th>`)}<th class="num">T</th></tr></thead>
|
|
2078
2106
|
<tbody>
|
|
2079
|
-
${
|
|
2080
|
-
${
|
|
2107
|
+
${c(e, "away", t.awayScore)}
|
|
2108
|
+
${c(s, "home", t.homeScore)}
|
|
2081
2109
|
</tbody>
|
|
2082
2110
|
</table>
|
|
2083
2111
|
</div>
|
|
@@ -2087,7 +2115,7 @@ class le extends b {
|
|
|
2087
2115
|
const r = Array.isArray(t.scoringPlays) ? t.scoringPlays : [];
|
|
2088
2116
|
if (!r.length) return m;
|
|
2089
2117
|
const o = (n) => [n.period, n.clock].filter(Boolean).join(" ");
|
|
2090
|
-
return
|
|
2118
|
+
return l`
|
|
2091
2119
|
<div class="plays">
|
|
2092
2120
|
<div class="plays-title">Scoring plays</div>
|
|
2093
2121
|
<div class="tablewrap">
|
|
@@ -2097,7 +2125,7 @@ class le extends b {
|
|
|
2097
2125
|
<th class="num">${e?.abbr || "Away"}</th><th class="num">${s?.abbr || "Home"}</th>
|
|
2098
2126
|
</tr></thead>
|
|
2099
2127
|
<tbody>
|
|
2100
|
-
${r.map((n) =>
|
|
2128
|
+
${r.map((n) => l`<tr>
|
|
2101
2129
|
<td class="when">${o(n) || "·"}</td>
|
|
2102
2130
|
<td class="play">${n.description || "·"}</td>
|
|
2103
2131
|
<td class="num">${n.awayScore}</td>
|
|
@@ -2112,23 +2140,23 @@ class le extends b {
|
|
|
2112
2140
|
renderContext(t, e, s) {
|
|
2113
2141
|
if (!s) return m;
|
|
2114
2142
|
const r = t.records[e], o = bt(this.data.games, e);
|
|
2115
|
-
return
|
|
2143
|
+
return l`
|
|
2116
2144
|
<div class="card ctxcard">
|
|
2117
2145
|
<div class="who">${E(s)}${s.name}</div>
|
|
2118
2146
|
<div class="row">
|
|
2119
2147
|
<span>Last 5: ${xt(t, e)}</span>
|
|
2120
|
-
<span>Streak: <b>${r ?
|
|
2148
|
+
<span>Streak: <b>${r ? it(r.results) : "·"}</b></span>
|
|
2121
2149
|
<span>PF/PA: <b>${r ? `${r.pf} / ${r.pa}` : "·"}</b></span>
|
|
2122
|
-
<span>Next: ${o ?
|
|
2123
|
-
${o.homeTeamId === e ? "vs" : "at"} ${
|
|
2150
|
+
<span>Next: ${o ? l`${w(o.date, { month: "numeric", day: "numeric" })}
|
|
2151
|
+
${o.homeTeamId === e ? "vs" : "at"} ${st(t, o.homeTeamId === e ? o.awayTeamId : o.homeTeamId)}` : "·"}</span>
|
|
2124
2152
|
</div>
|
|
2125
2153
|
</div>
|
|
2126
2154
|
`;
|
|
2127
2155
|
}
|
|
2128
2156
|
}
|
|
2129
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore",
|
|
2130
|
-
const
|
|
2131
|
-
class
|
|
2157
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore", ce);
|
|
2158
|
+
const gs = 250, vs = 2;
|
|
2159
|
+
class he extends N {
|
|
2132
2160
|
static properties = {
|
|
2133
2161
|
api: { type: String },
|
|
2134
2162
|
schoolHref: { type: String, attribute: "school-href" },
|
|
@@ -2208,11 +2236,11 @@ class ce extends N {
|
|
|
2208
2236
|
}
|
|
2209
2237
|
onInput(t) {
|
|
2210
2238
|
const e = t.target.value.trim();
|
|
2211
|
-
if (clearTimeout(this.debounceTimer), e.length <
|
|
2239
|
+
if (clearTimeout(this.debounceTimer), e.length < vs) {
|
|
2212
2240
|
this.abortController?.abort(), this.results = [], this.open = !1, this.searched = !1;
|
|
2213
2241
|
return;
|
|
2214
2242
|
}
|
|
2215
|
-
this.debounceTimer = setTimeout(() => this.search(e),
|
|
2243
|
+
this.debounceTimer = setTimeout(() => this.search(e), gs);
|
|
2216
2244
|
}
|
|
2217
2245
|
async search(t) {
|
|
2218
2246
|
this.abortController?.abort(), this.abortController = new AbortController();
|
|
@@ -2260,7 +2288,7 @@ class ce extends N {
|
|
|
2260
2288
|
const s = this.where(t), r = (o) => {
|
|
2261
2289
|
o.preventDefault(), this.go(t);
|
|
2262
2290
|
};
|
|
2263
|
-
return
|
|
2291
|
+
return l`
|
|
2264
2292
|
<li
|
|
2265
2293
|
id="school-option-${e}"
|
|
2266
2294
|
role="option"
|
|
@@ -2271,13 +2299,13 @@ class ce extends N {
|
|
|
2271
2299
|
}}"
|
|
2272
2300
|
>
|
|
2273
2301
|
<span class="name">${t.name}</span>
|
|
2274
|
-
${s ?
|
|
2302
|
+
${s ? l`<span class="where">${s}</span>` : m}
|
|
2275
2303
|
</li>
|
|
2276
2304
|
`;
|
|
2277
2305
|
}
|
|
2278
2306
|
renderListbox() {
|
|
2279
|
-
const t = this.searched && !this.results.length, e =
|
|
2280
|
-
return
|
|
2307
|
+
const t = this.searched && !this.results.length, e = l`<li class="empty">No schools found</li>`;
|
|
2308
|
+
return l`
|
|
2281
2309
|
<ul id="school-search-listbox" role="listbox" aria-label="Schools">
|
|
2282
2310
|
${this.results.map((s, r) => this.renderOption(s, r))}
|
|
2283
2311
|
${t ? e : m}
|
|
@@ -2286,7 +2314,7 @@ class ce extends N {
|
|
|
2286
2314
|
}
|
|
2287
2315
|
render() {
|
|
2288
2316
|
const t = this.activeIndex >= 0 ? `school-option-${this.activeIndex}` : "";
|
|
2289
|
-
return
|
|
2317
|
+
return l`
|
|
2290
2318
|
<input
|
|
2291
2319
|
type="text"
|
|
2292
2320
|
role="combobox"
|
|
@@ -2305,37 +2333,37 @@ class ce extends N {
|
|
|
2305
2333
|
`;
|
|
2306
2334
|
}
|
|
2307
2335
|
}
|
|
2308
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-school-search") && globalThis.customElements.define("hsot-school-search",
|
|
2309
|
-
function
|
|
2310
|
-
const e = new Map(a.map((
|
|
2311
|
-
for (const
|
|
2312
|
-
|
|
2313
|
-
const o = a.filter((
|
|
2314
|
-
function i(
|
|
2315
|
-
const
|
|
2316
|
-
if (!
|
|
2317
|
-
const p = [...s.get(
|
|
2318
|
-
return { game:
|
|
2336
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-school-search") && globalThis.customElements.define("hsot-school-search", he);
|
|
2337
|
+
function de(a, t) {
|
|
2338
|
+
const e = new Map(a.map((c) => [c.id, c])), s = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
2339
|
+
for (const c of t || [])
|
|
2340
|
+
c.outcome === "winner" && (s.has(c.targetGameId) || s.set(c.targetGameId, []), s.get(c.targetGameId).push(c), r.has(c.sourceGameId) || r.set(c.sourceGameId, []), r.get(c.sourceGameId).push(c));
|
|
2341
|
+
const o = a.filter((c) => !r.has(c.id)), n = (c) => c.targetSlot === "home" ? 0 : 1;
|
|
2342
|
+
function i(c) {
|
|
2343
|
+
const h = e.get(c);
|
|
2344
|
+
if (!h) return null;
|
|
2345
|
+
const p = [...s.get(c) || []].sort((u, f) => n(u) - n(f)).map((u) => i(u.sourceGameId)).filter(Boolean);
|
|
2346
|
+
return { game: h, children: p, bracketGroup: h.bracketGroup };
|
|
2319
2347
|
}
|
|
2320
|
-
return o.length === 1 ? i(o[0].id) : o.map((
|
|
2348
|
+
return o.length === 1 ? i(o[0].id) : o.map((c) => i(c.id));
|
|
2321
2349
|
}
|
|
2322
|
-
function
|
|
2350
|
+
function pe(a, t = [], e = 0) {
|
|
2323
2351
|
if (!a) return t;
|
|
2324
2352
|
t[e] || (t[e] = []), t[e].push(a.game);
|
|
2325
|
-
for (const s of a.children || [])
|
|
2353
|
+
for (const s of a.children || []) pe(s, t, e + 1);
|
|
2326
2354
|
return t;
|
|
2327
2355
|
}
|
|
2328
|
-
const
|
|
2329
|
-
function
|
|
2330
|
-
const s =
|
|
2356
|
+
const $s = (a) => Math.max(1, Math.round(Math.log2(a || 2)));
|
|
2357
|
+
function bs({ round: a, perGroup: t, groupCount: e = 1 }) {
|
|
2358
|
+
const s = $s(t), o = (e === 4 ? s + 2 : e === 2 ? s + 1 : s) - a;
|
|
2331
2359
|
return o === 0 ? e > 1 ? "Championship" : "Final" : o === 1 ? "Semifinal" : `Round ${a}`;
|
|
2332
2360
|
}
|
|
2333
|
-
function
|
|
2361
|
+
function ys(a) {
|
|
2334
2362
|
if (!a || !a.length) return "setup";
|
|
2335
2363
|
const t = Math.max(...a.map((s) => s.round ?? 0)), e = a.filter((s) => (s.round ?? 0) === t);
|
|
2336
2364
|
return e.length && e.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";
|
|
2337
2365
|
}
|
|
2338
|
-
function
|
|
2366
|
+
function ws(a, t) {
|
|
2339
2367
|
const e = a?.groupNames || [];
|
|
2340
2368
|
if (e.length >= 2) {
|
|
2341
2369
|
const r = e.map((o) => ({ key: o, name: o }));
|
|
@@ -2344,62 +2372,62 @@ function ys(a, t) {
|
|
|
2344
2372
|
const s = [...new Set((t || []).map((r) => r.bracketGroup).filter(Boolean))];
|
|
2345
2373
|
return [{ key: null, name: s.length === 1 ? s[0] : "Bracket" }];
|
|
2346
2374
|
}
|
|
2347
|
-
const
|
|
2375
|
+
const xs = (a, t) => t?.key == null ? [...a || []] : (a || []).filter((e) => e.bracketGroup === t.key), Ut = (a) => {
|
|
2348
2376
|
const t = /(\d+)\s*$/.exec(a.label || "");
|
|
2349
2377
|
return t ? Number(t[1]) : 1 / 0;
|
|
2350
2378
|
}, Ht = (a, t) => Ut(a) - Ut(t) || String(a.id).localeCompare(String(t.id));
|
|
2351
|
-
function
|
|
2379
|
+
function ks(a, t) {
|
|
2352
2380
|
if (a.every((r) => Number.isInteger(r.round))) return (r) => r.round;
|
|
2353
|
-
const e =
|
|
2381
|
+
const e = de(a, t), s = /* @__PURE__ */ new Map();
|
|
2354
2382
|
for (const r of Array.isArray(e) ? e : [e]) {
|
|
2355
|
-
const o =
|
|
2356
|
-
o.forEach((i,
|
|
2383
|
+
const o = pe(r), n = o.length - 1;
|
|
2384
|
+
o.forEach((i, c) => i.forEach((h) => s.set(h.id, n - c + 1)));
|
|
2357
2385
|
}
|
|
2358
2386
|
return (r) => Number.isInteger(r.round) ? r.round : s.get(r.id) || 1;
|
|
2359
2387
|
}
|
|
2360
|
-
function
|
|
2361
|
-
const s =
|
|
2388
|
+
function Ss(a, t, e) {
|
|
2389
|
+
const s = xs(a, e);
|
|
2362
2390
|
if (!s.length) return [];
|
|
2363
|
-
const r =
|
|
2364
|
-
for (const
|
|
2365
|
-
const d = r(
|
|
2366
|
-
o.has(d) || o.set(d, []), o.get(d).push(
|
|
2391
|
+
const r = ks(a || [], t || []), o = /* @__PURE__ */ new Map();
|
|
2392
|
+
for (const h of s) {
|
|
2393
|
+
const d = r(h);
|
|
2394
|
+
o.has(d) || o.set(d, []), o.get(d).push(h);
|
|
2367
2395
|
}
|
|
2368
2396
|
const n = /* @__PURE__ */ new Map();
|
|
2369
|
-
for (const
|
|
2370
|
-
|
|
2397
|
+
for (const h of t || [])
|
|
2398
|
+
h.outcome === "winner" && (n.has(h.targetGameId) || n.set(h.targetGameId, []), n.get(h.targetGameId).push(h.sourceGameId));
|
|
2371
2399
|
const i = [];
|
|
2372
|
-
let
|
|
2373
|
-
for (const
|
|
2374
|
-
let d = [...o.get(
|
|
2375
|
-
if (
|
|
2400
|
+
let c = null;
|
|
2401
|
+
for (const h of [...o.keys()].sort((d, p) => d - p)) {
|
|
2402
|
+
let d = [...o.get(h)];
|
|
2403
|
+
if (c) {
|
|
2376
2404
|
const p = (u) => {
|
|
2377
|
-
const f = (n.get(u.id) || []).map((g) =>
|
|
2405
|
+
const f = (n.get(u.id) || []).map((g) => c.get(g)).filter((g) => g !== void 0);
|
|
2378
2406
|
return f.length ? Math.min(...f) : 1 / 0;
|
|
2379
2407
|
};
|
|
2380
2408
|
d.sort((u, f) => p(u) - p(f) || Ht(u, f));
|
|
2381
2409
|
} else
|
|
2382
2410
|
d.sort(Ht);
|
|
2383
|
-
|
|
2411
|
+
c = new Map(d.map((p, u) => [p.id, u])), i.push({ round: h, games: d });
|
|
2384
2412
|
}
|
|
2385
2413
|
return i;
|
|
2386
2414
|
}
|
|
2387
|
-
function
|
|
2415
|
+
function _s(a, t, e) {
|
|
2388
2416
|
const s = a[`${t}TeamId`] || null, r = (e || []).find((n) => n.gameId === a.id && n.slot === t), o = a[`${t}Seed`] ?? r?.seed ?? null;
|
|
2389
2417
|
return { teamId: s, seed: o, bye: !s && !!r?.isBye };
|
|
2390
2418
|
}
|
|
2391
|
-
function
|
|
2392
|
-
const t =
|
|
2419
|
+
function me(a) {
|
|
2420
|
+
const t = nt(a);
|
|
2393
2421
|
return t === "home" || t === "away" ? t : null;
|
|
2394
2422
|
}
|
|
2395
|
-
function
|
|
2396
|
-
const e =
|
|
2423
|
+
function As(a, t) {
|
|
2424
|
+
const e = de(a || [], t || []);
|
|
2397
2425
|
if (!e || Array.isArray(e)) return null;
|
|
2398
|
-
const s =
|
|
2426
|
+
const s = me(e.game);
|
|
2399
2427
|
return s && e.game[`${s}TeamId`] || null;
|
|
2400
2428
|
}
|
|
2401
2429
|
const Lt = { active: 0, setup: 1, complete: 2 };
|
|
2402
|
-
function
|
|
2430
|
+
function Ts(a, { id: t, param: e } = {}) {
|
|
2403
2431
|
const s = a || [];
|
|
2404
2432
|
if (!s.length) return null;
|
|
2405
2433
|
for (const r of [t, e]) {
|
|
@@ -2409,7 +2437,7 @@ function As(a, { id: t, param: e } = {}) {
|
|
|
2409
2437
|
}
|
|
2410
2438
|
return [...s].sort((r, o) => (Lt[r.status] ?? 3) - (Lt[o.status] ?? 3) || String(r.name || "").localeCompare(String(o.name || "")))[0];
|
|
2411
2439
|
}
|
|
2412
|
-
const
|
|
2440
|
+
const Is = y`
|
|
2413
2441
|
.bracket { display: flex; gap: 1rem; align-items: stretch; overflow-x: auto; padding-bottom: 0.5rem; }
|
|
2414
2442
|
.round { flex: 0 0 250px; display: flex; flex-direction: column; min-width: 0; }
|
|
2415
2443
|
.roundhead {
|
|
@@ -2455,8 +2483,8 @@ const Ts = y`
|
|
|
2455
2483
|
.champ .tname a { color: inherit; text-decoration: none; font-weight: 700; }
|
|
2456
2484
|
@media (max-width: 720px) { .round { flex-basis: 215px; } }
|
|
2457
2485
|
`;
|
|
2458
|
-
class
|
|
2459
|
-
static styles = [U,
|
|
2486
|
+
class ue extends b {
|
|
2487
|
+
static styles = [U, Is];
|
|
2460
2488
|
static properties = {
|
|
2461
2489
|
...b.properties,
|
|
2462
2490
|
sport: { type: String },
|
|
@@ -2469,9 +2497,9 @@ class me extends b {
|
|
|
2469
2497
|
super(), this.sport = "football", this.season = "", this.tournamentId = "", this.picked = "", this.group = null;
|
|
2470
2498
|
}
|
|
2471
2499
|
async fetchData(t) {
|
|
2472
|
-
const e = this.season ||
|
|
2500
|
+
const e = this.season || K(), s = (await t.listTournaments({ sport: this.sport, season: e })).items, r = new URLSearchParams(globalThis.location?.search || "").get("tournament"), o = Ts(s, { id: this.picked || this.tournamentId, param: r });
|
|
2473
2501
|
if (!o) return { season: e, tournaments: s, tournament: null };
|
|
2474
|
-
const [n, i,
|
|
2502
|
+
const [n, i, c, h, d] = await Promise.all([
|
|
2475
2503
|
t.listSeedings(o.id),
|
|
2476
2504
|
t.listEdges(o.id),
|
|
2477
2505
|
t.listGames({ tournamentId: o.id }),
|
|
@@ -2484,8 +2512,8 @@ class me extends b {
|
|
|
2484
2512
|
tournament: o,
|
|
2485
2513
|
seedings: n.items,
|
|
2486
2514
|
edges: i.items,
|
|
2487
|
-
games:
|
|
2488
|
-
schools:
|
|
2515
|
+
games: c.items,
|
|
2516
|
+
schools: h.items,
|
|
2489
2517
|
teams: d.items
|
|
2490
2518
|
};
|
|
2491
2519
|
}
|
|
@@ -2512,95 +2540,95 @@ class me extends b {
|
|
|
2512
2540
|
}
|
|
2513
2541
|
}
|
|
2514
2542
|
renderView() {
|
|
2515
|
-
const t = this.data, e = this.ctx, s =
|
|
2516
|
-
title:
|
|
2517
|
-
sub: t.tournament ?
|
|
2543
|
+
const t = this.data, e = this.ctx, s = lt(this, e, {
|
|
2544
|
+
title: l`${D(this.sport)} playoff brackets`,
|
|
2545
|
+
sub: t.tournament ? l`${t.tournament.name} · ${t.season} season` : l`${t.season} season`,
|
|
2518
2546
|
teams: t.teams
|
|
2519
2547
|
});
|
|
2520
2548
|
if (!t.tournament)
|
|
2521
|
-
return
|
|
2522
|
-
${
|
|
2549
|
+
return l`${s}${P(this, l`
|
|
2550
|
+
${B(this)}
|
|
2523
2551
|
<div class="card"><div class="empty">No ${this.sport} brackets have been published for the ${t.season} season yet.</div></div>
|
|
2524
2552
|
`)}`;
|
|
2525
|
-
const r =
|
|
2526
|
-
return
|
|
2553
|
+
const r = ws(t.tournament, t.games), o = r.find((p) => p.key === this.group) || r[0], n = (t.tournament.groupNames || []).length >= 2 ? t.tournament.groupNames.length : 1, i = (Number(t.tournament.size) || 0) / n, c = Ss(t.games, t.edges, o), h = ys(t.games), d = As(t.games, t.edges);
|
|
2554
|
+
return l`
|
|
2527
2555
|
${s}
|
|
2528
|
-
${P(this,
|
|
2529
|
-
${
|
|
2556
|
+
${P(this, l`
|
|
2557
|
+
${B(this)}
|
|
2530
2558
|
<div class="toolbar">
|
|
2531
|
-
${t.tournaments.length > 1 ?
|
|
2559
|
+
${t.tournaments.length > 1 ? l`
|
|
2532
2560
|
<div role="group" aria-label="Tournament">
|
|
2533
|
-
${t.tournaments.map((p) =>
|
|
2561
|
+
${t.tournaments.map((p) => l`<button class="chip ${p.id === t.tournament.id ? "on" : ""}"
|
|
2534
2562
|
@click=${() => this.pick(p.id)}>${p.name}</button>`)}
|
|
2535
2563
|
</div>` : m}
|
|
2536
|
-
${r.length > 1 ?
|
|
2564
|
+
${r.length > 1 ? l`
|
|
2537
2565
|
<div role="tablist" aria-label="Bracket group">
|
|
2538
|
-
${r.map((p) =>
|
|
2566
|
+
${r.map((p) => l`<button class="chip ${p.key === o.key ? "on" : ""}" role="tab"
|
|
2539
2567
|
aria-selected=${p.key === o.key ? "true" : "false"}
|
|
2540
2568
|
@click=${() => {
|
|
2541
2569
|
this.group = p.key;
|
|
2542
2570
|
}}>${p.name}</button>`)}
|
|
2543
2571
|
</div>` : m}
|
|
2544
2572
|
<span class="spacer"></span>
|
|
2545
|
-
<span class="pill ${
|
|
2573
|
+
<span class="pill ${h === "complete" ? "final" : h === "active" ? "class" : "type"}">${h === "complete" ? "Complete" : h === "active" ? "In progress" : "Bracket set"}</span>
|
|
2546
2574
|
<span class="asof">${t.tournament.size}-team ${String(t.tournament.format || "").replace(/_/g, " ")}</span>
|
|
2547
2575
|
</div>
|
|
2548
|
-
${d ?
|
|
2549
|
-
${E(C(e, d), 26)}<span class="tname">${
|
|
2550
|
-
${
|
|
2576
|
+
${d ? l`<div class="champ"><span class="pill champ">Champion</span>
|
|
2577
|
+
${E(C(e, d), 26)}<span class="tname">${at(e, d)}</span></div>` : m}
|
|
2578
|
+
${c.length ? l`
|
|
2551
2579
|
<div class="bracket" role="region" aria-label="${o.name} bracket">
|
|
2552
|
-
${
|
|
2580
|
+
${c.map((p) => l`
|
|
2553
2581
|
<section class="round">
|
|
2554
|
-
<h3 class="roundhead">${
|
|
2582
|
+
<h3 class="roundhead">${bs({ round: p.round, perGroup: i, groupCount: n })}</h3>
|
|
2555
2583
|
<div class="games">${p.games.map((u) => this.renderMatchup(e, u))}</div>
|
|
2556
2584
|
</section>`)}
|
|
2557
|
-
</div>` :
|
|
2585
|
+
</div>` : l`<div class="card"><div class="empty">This bracket has no games yet.</div></div>`}
|
|
2558
2586
|
`)}
|
|
2559
2587
|
`;
|
|
2560
2588
|
}
|
|
2561
2589
|
renderMatchup(t, e) {
|
|
2562
2590
|
const s = e.homeTeamId && e.awayTeamId || e.state === "final" || e.state === "live";
|
|
2563
|
-
return
|
|
2591
|
+
return l`
|
|
2564
2592
|
<article class="matchup ${e.state}" aria-label="${e.label || "Matchup"}">
|
|
2565
2593
|
${this.renderSlot(t, e, "home")}
|
|
2566
2594
|
${this.renderSlot(t, e, "away")}
|
|
2567
2595
|
<footer class="mfoot">
|
|
2568
|
-
${
|
|
2569
|
-
${e.label ?
|
|
2596
|
+
${V(e)}
|
|
2597
|
+
${e.label ? l`<span class="label">${e.label}</span>` : m}
|
|
2570
2598
|
<span class="spacer"></span>
|
|
2571
|
-
${s ?
|
|
2599
|
+
${s ? l`<a class="box" href=${v(t.hrefs.game, { sport: this.sport, id: e.id })}>Box score</a>` : m}
|
|
2572
2600
|
</footer>
|
|
2573
2601
|
</article>
|
|
2574
2602
|
`;
|
|
2575
2603
|
}
|
|
2576
2604
|
renderSlot(t, e, s) {
|
|
2577
|
-
const { teamId: r, seed: o, bye: n } =
|
|
2578
|
-
return
|
|
2605
|
+
const { teamId: r, seed: o, bye: n } = _s(e, s, this.data.seedings), i = me(e), c = e.state === "live" || e.state === "final";
|
|
2606
|
+
return l`
|
|
2579
2607
|
<div class="slot ${i ? i === s ? "winner" : "loser" : ""}">
|
|
2580
2608
|
<span class="seed">${o ?? ""}</span>
|
|
2581
|
-
${r ?
|
|
2582
|
-
${
|
|
2609
|
+
${r ? l`${E(C(t, r), 22)}<span class="tname">${at(t, r, e.date)}</span>` : n ? l`<span class="tname bye">Bye</span>` : l`<span class="tname mut">TBD</span>`}
|
|
2610
|
+
${c ? l`<span class="score">${e[`${s}Score`] ?? 0}</span>` : m}
|
|
2583
2611
|
</div>
|
|
2584
2612
|
`;
|
|
2585
2613
|
}
|
|
2586
2614
|
}
|
|
2587
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-brackets") && globalThis.customElements.define("hsot-brackets",
|
|
2588
|
-
const
|
|
2589
|
-
"hsot-scores":
|
|
2590
|
-
"hsot-standings":
|
|
2591
|
-
"hsot-rankings":
|
|
2592
|
-
"hsot-school":
|
|
2593
|
-
"hsot-boxscore":
|
|
2594
|
-
"hsot-school-search":
|
|
2595
|
-
"hsot-brackets":
|
|
2615
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-brackets") && globalThis.customElements.define("hsot-brackets", ue);
|
|
2616
|
+
const Cs = {
|
|
2617
|
+
"hsot-scores": se,
|
|
2618
|
+
"hsot-standings": ae,
|
|
2619
|
+
"hsot-rankings": re,
|
|
2620
|
+
"hsot-school": oe,
|
|
2621
|
+
"hsot-boxscore": ce,
|
|
2622
|
+
"hsot-school-search": he,
|
|
2623
|
+
"hsot-brackets": ue
|
|
2596
2624
|
};
|
|
2597
|
-
function
|
|
2625
|
+
function Es() {
|
|
2598
2626
|
const a = globalThis?.customElements;
|
|
2599
2627
|
if (a)
|
|
2600
|
-
for (const [t, e] of Object.entries(
|
|
2628
|
+
for (const [t, e] of Object.entries(Cs))
|
|
2601
2629
|
a.get(t) || a.define(t, e);
|
|
2602
2630
|
}
|
|
2603
|
-
typeof window < "u" && globalThis.customElements &&
|
|
2631
|
+
typeof window < "u" && globalThis.customElements && Es();
|
|
2604
2632
|
export {
|
|
2605
|
-
|
|
2633
|
+
Es as defineAll
|
|
2606
2634
|
};
|