@moq/watch 0.2.14 → 0.2.16

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.
Files changed (84) hide show
  1. package/README.md +10 -9
  2. package/audio/source.d.ts.map +1 -1
  3. package/broadcast-CG8jZRfA.js +1651 -0
  4. package/broadcast-CG8jZRfA.js.map +1 -0
  5. package/broadcast.d.ts.map +1 -1
  6. package/element.js +162 -178
  7. package/element.js.map +1 -1
  8. package/index.d.ts +0 -4
  9. package/index.d.ts.map +1 -1
  10. package/index.js +5 -289
  11. package/package.json +5 -4
  12. package/support/element.js +122 -172
  13. package/support/element.js.map +1 -1
  14. package/support/index.js +52 -53
  15. package/support/index.js.map +1 -1
  16. package/ui/components/button.d.ts +3 -0
  17. package/ui/components/button.d.ts.map +1 -0
  18. package/ui/components/center-play.d.ts +5 -0
  19. package/ui/components/center-play.d.ts.map +1 -0
  20. package/ui/components/control-bar.d.ts +6 -0
  21. package/ui/components/control-bar.d.ts.map +1 -0
  22. package/ui/components/fullscreen-button.d.ts +2 -1
  23. package/ui/components/fullscreen-button.d.ts.map +1 -1
  24. package/ui/components/latency.d.ts +5 -0
  25. package/ui/components/latency.d.ts.map +1 -0
  26. package/ui/components/live-badge.d.ts +9 -0
  27. package/ui/components/live-badge.d.ts.map +1 -0
  28. package/ui/components/play-pause.d.ts +1 -0
  29. package/ui/components/play-pause.d.ts.map +1 -1
  30. package/ui/components/quality.d.ts +5 -0
  31. package/ui/components/quality.d.ts.map +1 -0
  32. package/ui/components/settings-button.d.ts +5 -0
  33. package/ui/components/settings-button.d.ts.map +1 -0
  34. package/ui/components/settings-panel.d.ts +6 -0
  35. package/ui/components/settings-panel.d.ts.map +1 -0
  36. package/ui/components/volume-slider.d.ts +1 -0
  37. package/ui/components/volume-slider.d.ts.map +1 -1
  38. package/ui/element.d.ts.map +1 -1
  39. package/ui/element.js +674 -381
  40. package/ui/element.js.map +1 -1
  41. package/ui/format.d.ts +11 -0
  42. package/ui/format.d.ts.map +1 -0
  43. package/ui/fullscreen.d.ts +16 -0
  44. package/ui/fullscreen.d.ts.map +1 -0
  45. package/ui/graph.d.ts +18 -0
  46. package/ui/graph.d.ts.map +1 -0
  47. package/ui/icons.d.ts +5 -1
  48. package/ui/icons.d.ts.map +1 -1
  49. package/ui/state.d.ts +9 -0
  50. package/ui/state.d.ts.map +1 -0
  51. package/ui/stats.d.ts +3 -2
  52. package/ui/stats.d.ts.map +1 -1
  53. package/video/source.d.ts.map +1 -1
  54. package/broadcast-CLjMphZS.js +0 -5000
  55. package/broadcast-CLjMphZS.js.map +0 -1
  56. package/chat/index.d.ts +0 -17
  57. package/chat/index.d.ts.map +0 -1
  58. package/chat/message.d.ts +0 -16
  59. package/chat/message.d.ts.map +0 -1
  60. package/chat/typing.d.ts +0 -16
  61. package/chat/typing.d.ts.map +0 -1
  62. package/dom-BsFrLb_F.js +0 -35
  63. package/dom-BsFrLb_F.js.map +0 -1
  64. package/index.js.map +0 -1
  65. package/libav-opus-af-BlMWboA7.js +0 -368
  66. package/libav-opus-af-BlMWboA7.js.map +0 -1
  67. package/location/index.d.ts +0 -17
  68. package/location/index.d.ts.map +0 -1
  69. package/location/peers.d.ts +0 -16
  70. package/location/peers.d.ts.map +0 -1
  71. package/location/window.d.ts +0 -17
  72. package/location/window.d.ts.map +0 -1
  73. package/main-DGBFe0O7.js +0 -2301
  74. package/main-DGBFe0O7.js.map +0 -1
  75. package/preview.d.ts +0 -23
  76. package/preview.d.ts.map +0 -1
  77. package/ui/components/quality-selector.d.ts +0 -4
  78. package/ui/components/quality-selector.d.ts.map +0 -1
  79. package/ui/components/stats-button.d.ts +0 -3
  80. package/ui/components/stats-button.d.ts.map +0 -1
  81. package/ui/components/watch-status-indicator.d.ts +0 -4
  82. package/ui/components/watch-status-indicator.d.ts.map +0 -1
  83. package/user.d.ts +0 -17
  84. package/user.d.ts.map +0 -1
package/ui/element.js CHANGED
@@ -1,382 +1,675 @@
1
- import { Signal as R, Effect as T } from "@moq/signals";
2
- import { c as v, r as C } from "../dom-BsFrLb_F.js";
3
- const j = 0, E = 10, P = 4e3, F = 48;
4
- function S(o, t, e, r, a) {
5
- const n = o.getContext("2d");
6
- if (!n) return;
7
- const i = window.devicePixelRatio || 1, s = o.getBoundingClientRect(), l = s.width, c = s.height, p = Math.round(l * i), d = Math.round(c * i);
8
- if ((o.width !== p || o.height !== d) && (o.width = p, o.height = d), n.setTransform(i, 0, 0, i, 0, 0), n.clearRect(0, 0, l, c), e === void 0) return;
9
- const h = 2, f = c - h * 2, b = 2;
10
- for (let m = 0; m < t.length; m++) {
11
- const x = t[m], A = x.start - e, k = x.end - e, y = Math.max(0, A), N = Math.min(k, r);
12
- if (N <= y) continue;
13
- const u = y / r * l, g = Math.max(2, (N - y) / r * l);
14
- if (n.globalAlpha = 0.85, n.fillStyle = a ? "#f87171" : m > 0 ? "#facc15" : "#4ade80", typeof n.roundRect == "function" ? (n.beginPath(), n.roundRect(u, h, g, f, b), n.fill()) : n.fillRect(u, h, g, f), k > r) {
15
- const w = ((k - r) / 1e3).toFixed(1);
16
- n.globalAlpha = 0.7, n.fillStyle = "black", n.font = "500 9px system-ui, sans-serif", n.textAlign = "right", n.textBaseline = "middle", n.fillText(`+${w}s`, u + g - 4, c / 2);
17
- }
18
- }
19
- }
20
- function V(o, t, e = P) {
21
- const r = document.createElement("div");
22
- r.className = "buffer";
23
- const a = document.createElement("div");
24
- a.className = "buffer-visualization", a.setAttribute("role", "slider"), a.tabIndex = 0, a.setAttribute("aria-valuemin", j.toString()), a.setAttribute("aria-valuemax", e.toString()), a.setAttribute("aria-label", "Buffer jitter");
25
- const n = document.createElement("div");
26
- n.className = "buffer-playhead";
27
- const i = document.createElement("div");
28
- i.className = "buffer-track buffer-track--video";
29
- const s = document.createElement("span");
30
- s.className = "buffer-track-label", s.textContent = "Video";
31
- const l = document.createElement("canvas");
32
- l.className = "buffer-canvas", i.append(s, l);
33
- const c = document.createElement("div");
34
- c.className = "buffer-track buffer-track--audio";
35
- const p = document.createElement("span");
36
- p.className = "buffer-track-label", p.textContent = "Audio";
37
- const d = document.createElement("canvas");
38
- d.className = "buffer-canvas", c.append(p, d);
39
- const h = document.createElement("div");
40
- h.className = "buffer-target-area";
41
- const f = document.createElement("div");
42
- f.className = "buffer-target-line";
43
- const b = document.createElement("span");
44
- b.className = "buffer-target-label", f.appendChild(b), h.appendChild(f);
45
- const m = document.createElement("span");
46
- m.className = "buffer-help", m.textContent = "click to change latency", a.append(n, i, c, h, m), r.appendChild(a);
47
- let x = !1, A = !1;
48
- o.run((u) => {
49
- const g = u.get(t.backend.jitter), w = g / e * 100;
50
- f.style.left = `${w}%`, b.textContent = `${Math.round(g)}ms`, a.setAttribute("aria-valuenow", g.toString());
51
- });
52
- const k = (u) => {
53
- const g = a.getBoundingClientRect(), w = g.width - F, H = Math.max(0, Math.min(u - g.left - F, w)) / w * e, I = Math.round(H / E) * E, W = Math.max(j, Math.min(e, I));
54
- t.backend.latency.set(W);
55
- }, y = () => {
56
- A || (A = !0, m.style.display = "none");
57
- };
58
- o.event(a, "mousedown", (u) => {
59
- x = !0, a.classList.add("buffer-visualization--dragging"), y(), k(u.clientX);
60
- }), o.event(document, "mousemove", (u) => {
61
- x && k(u.clientX);
62
- }), o.event(document, "mouseup", () => {
63
- x && (x = !1, a.classList.remove("buffer-visualization--dragging"));
64
- }), o.event(a, "keydown", (u) => {
65
- let g = 0;
66
- if (u.key === "ArrowRight" || u.key === "ArrowUp")
67
- g = E;
68
- else if (u.key === "ArrowLeft" || u.key === "ArrowDown")
69
- g = -E;
70
- else
71
- return;
72
- u.preventDefault(), y();
73
- const w = t.backend.jitter.peek(), L = Math.max(j, Math.min(e, w + g));
74
- t.backend.latency.set(L);
75
- });
76
- const N = () => {
77
- const u = t.backend.sync.now(), g = t.backend.video.stalled.peek();
78
- S(l, t.backend.video.buffered.peek(), u, e, g), S(d, t.backend.audio.buffered.peek(), u, e, g), o.animate(N);
79
- };
80
- return o.animate(N), r;
81
- }
82
- function O(o, t) {
83
- const e = document.createElement("div");
84
- e.className = "buffering";
85
- const r = document.createElement("div");
86
- return r.className = "buffering-spinner", e.appendChild(r), o.run((a) => {
87
- const n = a.get(t.backend.video.stalled), i = a.get(t.broadcast.status) === "offline";
88
- e.style.display = n && !i ? "" : "none";
89
- }), e;
90
- }
91
- const U = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
92
- <path d="M9 18V5l12-2v13" />
93
- <circle cx="6" cy="18" r="3" />
94
- <circle cx="18" cy="16" r="3" />
95
- </svg>`, D = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
96
- <path d="M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2" />
97
- </svg>`, _ = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
98
- <path d="M8 3H5a2 2 0 0 0-2 2v3" />
99
- <path d="M21 8V5a2 2 0 0 0-2-2h-3" />
100
- <path d="M3 16v3a2 2 0 0 0 2 2h3" />
101
- <path d="M16 21h3a2 2 0 0 0 2-2v-3" />
102
- </svg>`, X = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
103
- <path d="M8 3v3a2 2 0 0 1-2 2H3" />
104
- <path d="M21 8h-3a2 2 0 0 1-2-2V3" />
105
- <path d="M3 16h3a2 2 0 0 1 2 2v3" />
106
- <path d="M16 21v-3a2 2 0 0 1 2-2h3" />
107
- </svg>`, G = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="var(--color-white)" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
108
- <path d="M16 9a5 5 0 0 1 .95 2.293" />
109
- <path d="M19.364 5.636a9 9 0 0 1 1.889 9.96" />
110
- <path d="m2 2 20 20" />
111
- <path d="m7 7-.587.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298V11" />
112
- <path d="M9.828 4.172A.686.686 0 0 1 11 4.657v.686" />
113
- </svg>`, Q = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
114
- <path d="M16.247 7.761a6 6 0 0 1 0 8.478" />
115
- <path d="M19.075 4.933a10 10 0 0 1 0 14.134" />
116
- <path d="M4.925 19.067a10 10 0 0 1 0-14.134" />
117
- <path d="M7.753 16.239a6 6 0 0 1 0-8.478" />
118
- <circle cx="12" cy="12" r="2" />
119
- </svg>`, J = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="var(--color-white)" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
120
- <rect x="14" y="3" width="5" height="18" rx="1" />
121
- <rect x="5" y="3" width="5" height="18" rx="1" />
122
- </svg>`, K = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="var(--color-white)" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
123
- <path d="M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z" />
124
- </svg>`, Y = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
125
- <path d="M5 21v-6" />
126
- <path d="M12 21V3" />
127
- <path d="M19 21V9" />
128
- </svg>`, Z = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
129
- <path d="m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5" />
130
- <rect x="2" y="6" width="14" height="12" rx="2" />
131
- </svg>`, tt = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="var(--color-white)" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
132
- <path d="M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z" />
133
- <path d="M16 9a5 5 0 0 1 0 6" />
134
- <path d="M19.364 18.364a9 9 0 0 0 0-12.728" />
135
- </svg>`, et = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="var(--color-white)" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
136
- <path d="M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z" />
137
- </svg>`, at = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="var(--color-white)" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
138
- <path d="M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z" />
139
- <path d="M16 9a5 5 0 0 1 0 6" />
140
- </svg>`;
141
- function M(o) {
142
- const t = document.createElement("span");
143
- return t.className = "flex-center", t.setAttribute("role", "img"), t.setAttribute("aria-hidden", "true"), t.innerHTML = o, t;
144
- }
145
- function ot(o, t) {
146
- const e = document.createElement("button");
147
- e.type = "button", e.className = "button flex-center", e.title = "Fullscreen", e.setAttribute("aria-label", "Fullscreen"), e.replaceChildren(M(_));
148
- const r = () => {
149
- const a = !!document.fullscreenElement;
150
- e.replaceChildren(M(a ? X : _));
151
- };
152
- return o.event(document, "fullscreenchange", r), o.event(e, "click", () => {
153
- document.fullscreenElement ? document.exitFullscreen() : t.requestFullscreen();
154
- }), e;
155
- }
156
- function nt(o, t) {
157
- const e = document.createElement("div");
158
- e.className = "watch-ui__offline-indicator", e.setAttribute("role", "status"), e.setAttribute("aria-live", "polite");
159
- const r = document.createElement("span");
160
- return r.className = "watch-ui__offline-text", r.textContent = "OFFLINE", e.appendChild(r), o.run((a) => {
161
- const n = a.get(t.broadcast.status) === "offline";
162
- e.style.display = n ? "" : "none";
163
- }), e;
164
- }
165
- function rt(o, t) {
166
- const e = document.createElement("button");
167
- return e.type = "button", e.className = "button button--playback flex-center", o.run((r) => {
168
- const a = r.get(t.backend.paused);
169
- e.title = a ? "Play" : "Pause", e.setAttribute("aria-label", a ? "Play" : "Pause"), e.replaceChildren(M(a ? K : J));
170
- }), o.event(e, "click", () => {
171
- t.paused = !t.paused;
172
- }), e;
173
- }
174
- function it(o) {
175
- return o >= 1e6 ? `${(o / 1e6).toFixed(1)} Mbps` : o >= 1e3 ? `${(o / 1e3).toFixed(0)} kbps` : `${o} bps`;
176
- }
177
- function st(o, t) {
178
- const e = document.createElement("div");
179
- e.className = "quality-selector";
180
- const r = document.createElement("label");
181
- r.htmlFor = "moq-watch-quality-select", r.className = "quality-label", r.textContent = "Quality: ";
182
- const a = document.createElement("select");
183
- return a.id = "moq-watch-quality-select", a.className = "quality-select", e.append(r, a), o.run((n) => {
184
- const i = n.get(t.backend.video.source.catalog), s = n.get(t.backend.video.source.track), l = i?.renditions ?? {};
185
- a.replaceChildren();
186
- const c = document.createElement("option");
187
- c.value = "", c.textContent = "Auto", a.appendChild(c);
188
- for (const [p, d] of Object.entries(l)) {
189
- const h = document.createElement("option");
190
- h.value = p;
191
- const f = d.codedWidth && d.codedHeight ? ` (${d.codedWidth}x${d.codedHeight})` : "", b = d.bitrate ? ` ${it(d.bitrate)}` : "";
192
- h.textContent = `${p}${f}${b}`, a.appendChild(h);
193
- }
194
- a.value = s ?? "";
195
- }), o.event(a, "change", () => {
196
- const n = a.value || void 0;
197
- t.backend.video.source.target.update((i) => ({ ...i, name: n }));
198
- }), e;
199
- }
200
- function lt(o, t) {
201
- const e = document.createElement("button");
202
- return e.type = "button", e.className = "button flex-center", e.replaceChildren(M(Y)), o.run((r) => {
203
- const a = r.get(t);
204
- e.title = a ? "Hide stats" : "Show stats", e.setAttribute("aria-label", e.title);
205
- }), o.event(e, "click", () => {
206
- t.update((r) => !r);
207
- }), e;
208
- }
209
- function ct(o, t) {
210
- return t || o === 0 ? G : o <= 33 ? et : o <= 66 ? at : tt;
211
- }
212
- function dt(o, t) {
213
- const e = document.createElement("div");
214
- e.className = "volume-slider flex-center";
215
- const r = document.createElement("button");
216
- r.type = "button", r.className = "button flex-center";
217
- const a = document.createElement("input");
218
- a.type = "range", a.min = "0", a.max = "100";
219
- const n = document.createElement("span");
220
- return n.className = "volume-label", e.append(r, a, n), o.run((i) => {
221
- const s = i.get(t.backend.audio.volume), l = i.get(t.backend.audio.muted), c = Math.round(s * 100);
222
- a.value = c.toString(), n.textContent = c.toString(), r.title = l ? "Unmute" : "Mute", r.setAttribute("aria-label", r.title), r.replaceChildren(M(ct(c, l)));
223
- }), o.event(a, "input", () => {
224
- t.backend.audio.volume.set(Number.parseFloat(a.value) / 100);
225
- }), o.event(r, "click", () => {
226
- t.backend.audio.muted.update((i) => !i);
227
- }), e;
228
- }
229
- function ut(o, t, e) {
230
- return o ? t === "disconnected" ? { variant: "error", text: "Disconnected" } : t === "connecting" ? { variant: "connecting", text: "Connecting..." } : e === "offline" ? { variant: "error", text: "Offline" } : e === "loading" ? { variant: "loading", text: "Loading..." } : e === "live" ? { variant: "live", text: "Live" } : { variant: "connected", text: "Connected" } : { variant: "error", text: "No URL" };
231
- }
232
- function pt(o, t) {
233
- const e = document.createElement("div");
234
- e.className = "status-indicator flex-center";
235
- const r = document.createElement("span"), a = document.createElement("span");
236
- return e.append(r, a), o.run((n) => {
237
- const i = n.get(t.connection.url), s = n.get(t.connection.status), l = n.get(t.broadcast.status), { variant: c, text: p } = ut(i, s, l);
238
- r.className = `status-indicator-dot status-indicator-dot--${c}`, a.className = `status-indicator-text status-indicator-text--${c}`, a.textContent = p;
239
- }), e;
240
- }
241
- const $ = 250;
242
- function z(o, t, e) {
243
- const r = v("div", { className: `stats-item stats-item--${o}` }), a = v("div", { className: "stats-icon-wrapper" });
244
- a.appendChild(M(e));
245
- const n = v("span", { className: "stats-item-title" }, t), i = v("span", { className: "stats-item-data" }, "N/A"), s = v("div", { className: "stats-item-detail" });
246
- return s.append(n, i), r.append(a, s), { el: r, data: i };
247
- }
248
- function B(o) {
249
- return o >= 1e6 ? `${(o / 1e6).toFixed(1)}Mbps` : o >= 1e3 ? `${(o / 1e3).toFixed(0)}kbps` : `${o.toFixed(0)}bps`;
250
- }
251
- function q(o, t) {
252
- if (o === void 0 || o <= 0) return null;
253
- const e = t === "down" ? "↓" : "↑";
254
- return o >= 1e9 ? `${e} ${(o / 1e9).toFixed(1)}Gbps` : `${e} ${B(o)}`;
255
- }
256
- function ht(o, t) {
257
- const { el: e, data: r } = z("network", "network", Q);
258
- return o.interval(() => {
259
- const a = t.connection.established.peek();
260
- if (!a) {
261
- r.textContent = "N/A";
262
- return;
263
- }
264
- const n = a.rtt?.peek(), i = [
265
- q(a.recvBandwidth?.peek(), "down"),
266
- q(a.sendBandwidth?.peek(), "up"),
267
- n !== void 0 && n > 0 ? `${n.toFixed(0)}ms` : null
268
- ].filter((s) => s !== null);
269
- r.textContent = i.length > 0 ? i.join(`
270
- `) : "N/A";
271
- }, $), e;
272
- }
273
- function gt(o, t) {
274
- const { el: e, data: r } = z("video", "video", Z);
275
- let a = 0, n = 0, i = performance.now();
276
- return o.interval(() => {
277
- const s = t.backend.video.source.catalog.peek(), l = t.backend.video.stats.peek(), c = performance.now(), p = c - i;
278
- let d;
279
- if (l && a > 0 && p > 0) {
280
- const m = l.frameCount - a;
281
- m > 0 && (d = m / (p / 1e3));
282
- }
283
- let h;
284
- if (l && n > 0 && p > 0) {
285
- const m = l.bytesReceived - n;
286
- m > 0 && (h = B(m * 8 * (1e3 / p)));
287
- }
288
- l && (a = l.frameCount, n = l.bytesReceived, i = c);
289
- const { width: f, height: b } = s?.display ?? {};
290
- r.textContent = [
291
- f && b ? `${f}x${b}` : "N/A",
292
- d !== void 0 ? `@${d.toFixed(1)} fps` : "N/A",
293
- h ?? "N/A"
294
- ].join(`
295
- `);
296
- }, $), e;
297
- }
298
- function ft(o, t) {
299
- const { el: e, data: r } = z("audio", "audio", U);
300
- let a = 0, n = performance.now();
301
- return o.interval(() => {
302
- const i = t.backend.audio.source.track.peek(), s = t.backend.audio.source.config.peek(), l = t.backend.audio.stats.peek();
303
- if (!i || !s) {
304
- r.textContent = "N/A";
305
- return;
306
- }
307
- const c = performance.now();
308
- let p;
309
- if (l && a > 0) {
310
- const h = l.bytesReceived - a, f = c - n;
311
- h > 0 && f > 0 && (p = B(h * 8 * (1e3 / f)));
312
- }
313
- l && (a = l.bytesReceived, n = c);
314
- const d = [];
315
- s.sampleRate && d.push(`${(s.sampleRate / 1e3).toFixed(1)}kHz`), s.numberOfChannels && d.push(`${s.numberOfChannels}ch`), d.push(p ?? "N/A"), s.codec && d.push(s.codec), r.textContent = d.length > 0 ? d.join(`
316
- `) : "N/A";
317
- }, $), e;
318
- }
319
- function mt(o, t) {
320
- const { el: e, data: r } = z("buffer", "buffer", D);
321
- return o.run((a) => {
322
- const n = a.get(t.backend.jitter);
323
- r.textContent = `${Math.round(n)}ms`;
324
- }), e;
325
- }
326
- function vt(o, t, e) {
327
- const r = v("div", { className: "stats" }), a = v("div", { className: "stats-panel" });
328
- return r.appendChild(a), o.run((n) => {
329
- const i = n.get(e);
330
- r.style.display = i ? "" : "none", i && (C(n, a, ht(n, t)), C(n, a, gt(n, t)), C(n, a, ft(n, t)), C(n, a, mt(n, t)));
331
- }), r;
332
- }
333
- const bt = ':host{--color-white: #ffffff;--color-white-alpha-05: rgba(255, 255, 255, .05);--color-white-alpha-10: rgba(255, 255, 255, .1);--color-white-alpha-15: rgba(255, 255, 255, .15);--color-white-alpha-20: rgba(255, 255, 255, .2);--color-white-alpha-25: rgba(255, 255, 255, .25);--color-white-alpha-30: rgba(255, 255, 255, .3);--color-white-alpha-40: rgba(255, 255, 255, .4);--color-white-alpha-70: rgba(255, 255, 255, .7);--color-white-alpha-90: rgba(255, 255, 255, .9);--color-gray-100: #9ca3af;--color-gray-950: #1a1a1a;--color-blue-400: #00dfff;--color-blue-500: #52a1ff;--color-blue-900: #1b3243;--color-purple-400: #a855f7;--color-purple-900: #31144a;--color-green-400: #65ee2e;--color-green-900: #3d4928;--color-yellow-400: #facc15;--color-orange-400: #ff9900;--color-orange-450: #fb923c;--color-orange-500: #f97316;--color-orange-900: #4d301b;--color-amber-600: #d97706;--color-orange-500-alpha-60: rgba(249, 115, 22, .6);--color-orange-500-alpha-80: rgba(249, 115, 22, .8);--color-black-alpha-08: rgba(0, 0, 0, .08);--color-black-alpha-10: rgba(0, 0, 0, .1);--color-black-alpha-40: rgba(0, 0, 0, .4);--color-black-alpha-85: rgba(0, 0, 0, .85);--spacing-1: .0625rem;--spacing-2: .125rem;--spacing-4: .25rem;--spacing-8: .5rem;--spacing-12: .75rem;--spacing-16: 1rem;--spacing-24: 1.5rem;--spacing-32: 2rem;--spacing-48: 3rem;--border-radius-sm: .5rem;--border-radius-md: .75rem;--border-radius-lg: 1rem}.flex-center{display:flex;justify-content:center;align-items:center}.flex-align-center{align-items:center}.button{color:var(--color-white);cursor:pointer;background-color:var(--color-white-alpha-10);border:var(--spacing-1) solid var(--color-white-alpha-20);border-radius:50%;width:2.25rem;height:2.25rem;transform-origin:center;transition:transform .1s cubic-bezier(.4,0,.2,1)}.button:hover:not(:disabled){transform:scale(1.02);background-color:var(--color-white-alpha-20);box-shadow:0 var(--spacing-2) var(--spacing-8) var(--color-black-alpha-10)}.button:active:not(:disabled){transform:scale(.98);box-shadow:0 var(--spacing-1) var(--spacing-4) var(--color-black-alpha-08)}.button:disabled{opacity:.5;cursor:default;color:var(--color-gray-100)}.stats{display:flex;align-items:center;justify-content:center;position:absolute;inset:0;pointer-events:none;z-index:2;width:100%;height:inherit;container-type:inline-size}.stats .stats-panel{position:absolute;display:flex;align-items:flex-start;justify-content:center;flex-direction:row;flex-wrap:wrap;gap:var(--spacing-12);max-width:240px;width:100%;background-color:var(--color-black-alpha-85);border:1px solid var(--color-white-alpha-25);border-radius:8px;padding:var(--spacing-12);pointer-events:auto;top:8px}@container (width > 480px) and (width <= 768px){.stats .stats-panel{max-width:360px;padding:var(--spacing-24)}}@container (width > 768px){.stats .stats-panel{max-width:600px;padding:var(--spacing-24)}}.stats .stats-panel .stats-item{display:flex;align-items:flex-start;justify-content:flex-start;flex-direction:row;height:auto;column-gap:var(--spacing-8);flex-basis:calc(50% - var(--spacing-12));flex-grow:1;flex-shrink:1}@container (width > 480px){.stats .stats-panel .stats-item{flex-basis:calc(25% - var(--spacing-12))}}.stats .stats-panel .stats-item .stats-icon-wrapper{display:none;padding:var(--spacing-8);border-radius:8px;width:fit-content;height:fit-content;flex-shrink:0}@container (width > 480px){.stats .stats-panel .stats-item .stats-icon-wrapper{width:24px;height:24px;display:flex;align-items:center;justify-content:center;flex-direction:row}}.stats .stats-panel .stats-item .stats-icon-wrapper svg{width:100%;height:100%}.stats .stats-panel .stats-item.stats-item--network .stats-icon-wrapper{background-color:var(--color-blue-900)}.stats .stats-panel .stats-item.stats-item--network,.stats .stats-panel .stats-item.stats-item--network .stats-item-data{color:var(--color-blue-400)}.stats .stats-panel .stats-item.stats-item--video .stats-icon-wrapper{background-color:var(--color-purple-900)}.stats .stats-panel .stats-item.stats-item--video,.stats .stats-panel .stats-item.stats-item--video .stats-item-data{color:var(--color-purple-400)}.stats .stats-panel .stats-item.stats-item--audio .stats-icon-wrapper{background-color:var(--color-green-900)}.stats .stats-panel .stats-item.stats-item--audio,.stats .stats-panel .stats-item.stats-item--audio .stats-item-data{color:var(--color-green-400)}.stats .stats-panel .stats-item.stats-item--buffer .stats-icon-wrapper{background-color:var(--color-orange-900)}.stats .stats-panel .stats-item.stats-item--buffer,.stats .stats-panel .stats-item.stats-item--buffer .stats-item-data{color:var(--color-orange-400)}.stats .stats-panel .stats-item .stats-item-detail{display:flex;align-items:flex-start;justify-content:space-evenly;flex-direction:column;gap:var(--spacing-4)}.stats .stats-panel .stats-item .stats-item-detail .stats-item-title{font-size:12px;font-weight:500;text-transform:capitalize;color:var(--color-gray-100);font-family:Segoe UI,Roboto,sans-serif;letter-spacing:1px;line-height:12px}.stats .stats-panel .stats-item .stats-item-detail .stats-item-data{font-size:16px;font-weight:700;font-family:Segoe UI,Roboto,sans-serif;white-space:pre-wrap;line-height:1.5}.video-container{display:block;position:relative;width:100%;height:auto;border-radius:var(--spacing-4);margin:0 auto;pointer-events:none}.controls{display:flex;flex-direction:column;gap:var(--spacing-24)}.button.button--playback{width:3rem;height:3rem;background:linear-gradient(to bottom right,var(--color-orange-400),var(--color-orange-500),var(--color-amber-600));box-shadow:0 0 var(--spacing-16) var(--color-orange-500-alpha-60);transition:box-shadow .15s cubic-bezier(.4,0,.2,1);position:relative;overflow:hidden}.button.button--playback:hover:not(:disabled){box-shadow:0 0 var(--spacing-24) var(--color-orange-500-alpha-80);transform:scale(1.02)}.button.button--playback:active:not(:disabled){transform:scale(.98)}.button.button--playback:before{content:"";position:absolute;inset:0;background:linear-gradient(to bottom right,var(--color-white-alpha-30),transparent);opacity:0;transition:opacity .15s cubic-bezier(.4,0,.2,1);pointer-events:none}.button.button--playback:hover:before{opacity:1}.button.button--playback:after{content:"";position:absolute;inset:0;background-color:var(--color-white-alpha-20);border-radius:50%;filter:blur(var(--spacing-24));pointer-events:none}.playback-controls{display:flex;place-content:center space-around;gap:var(--spacing-8);padding:var(--spacing-8) 0}.latency-controls{display:flex;flex-direction:column;gap:var(--spacing-16)}.volume-slider{gap:var(--spacing-4)}.volume-label{width:var(--spacing-16);text-align:right}.quality-selector{display:flex;align-items:center;gap:var(--spacing-8);background:transparent;border-radius:var(--spacing-8)}.quality-label{font-size:1.25rem;font-weight:500;color:var(--color-white);white-space:nowrap}.quality-select{flex:0 1 auto;font-size:1rem;padding:var(--spacing-8);border-radius:var(--spacing-4);background:var(--color-white-alpha-10);color:var(--color-white);border:var(--spacing-1) solid var(--color-white-alpha-20);cursor:pointer;transition:background .2s ease}.quality-select:hover{background:var(--color-white-alpha-15)}.quality-select:focus{outline:var(--spacing-2) solid var(--color-white-alpha-30);outline-offset:var(--spacing-2)}.quality-select option{background:var(--color-gray-950);color:var(--color-white)}.buffer{width:100%}.buffer-visualization{position:relative;width:100%;height:3.75rem;background:var(--color-white-alpha-10);border-radius:var(--spacing-4);cursor:pointer;user-select:none;padding-left:var(--spacing-48);box-sizing:border-box}.buffer-playhead{position:absolute;left:var(--spacing-48);top:0;bottom:0;width:var(--spacing-2);background:var(--color-white);z-index:3}.buffer-track{display:flex;align-items:center;position:absolute;left:var(--spacing-48);right:0;height:var(--spacing-24)}.buffer-track--video{top:var(--spacing-4)}.buffer-track--audio{top:var(--spacing-32)}.buffer-track-label{position:absolute;left:-2.875rem;width:2.5rem;font-size:.625rem;color:var(--color-white-alpha-70);text-align:right;padding-right:var(--spacing-4);pointer-events:none;box-sizing:border-box}.buffer-canvas{position:absolute;top:0;left:0;width:100%;height:100%}.buffer-target-area{position:absolute;top:0;bottom:0;left:var(--spacing-48);right:0;pointer-events:none}.buffer-target-line{position:absolute;top:0;bottom:0;width:.1875rem;background:var(--color-orange-400, var(--color-orange-450));z-index:2;cursor:ew-resize;border-radius:var(--spacing-1);pointer-events:auto}.buffer-target-label{position:absolute;bottom:100%;left:50%;transform:translate(-50%);font-size:.6875rem;font-weight:500;color:var(--color-orange-400, var(--color-orange-450));white-space:nowrap;margin-bottom:var(--spacing-2);opacity:0;transition:opacity .15s ease;pointer-events:none}.buffer-visualization:hover .buffer-target-label,.buffer-visualization--dragging .buffer-target-label{opacity:1}.buffer-help{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:.75rem;color:var(--color-white-alpha-30, rgba(255, 255, 255, .3));pointer-events:none;white-space:nowrap}.buffering{position:absolute;display:flex;align-items:center;justify-content:center;width:100%;height:100%;top:0;left:0;z-index:1;background-color:var(--color-black-alpha-40);backdrop-filter:blur(var(--spacing-2));pointer-events:auto}.buffering-spinner{width:2.5rem;height:2.5rem;border:var(--spacing-4) solid var(--color-white-alpha-20);border-top:var(--spacing-4) solid var(--color-white);border-radius:50%;animation:buffer-spin 1s linear infinite}@keyframes buffer-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.watch-ui__offline-indicator{position:absolute;bottom:1rem;right:1rem;padding:.5rem 1rem;display:flex;align-items:center;justify-content:center;background-color:#000;z-index:4;pointer-events:auto;border-radius:.25rem}.watch-ui__offline-text{font-size:.875rem;font-weight:700;color:#fff;letter-spacing:.08em;text-shadow:none}@media(max-width:768px){.watch-ui__offline-indicator{bottom:.75rem;right:.75rem;padding:.375rem .75rem}.watch-ui__offline-text{font-size:.75rem}}@media(max-width:480px){.watch-ui__offline-indicator{bottom:.5rem;right:.5rem;padding:.25rem .5rem}.watch-ui__offline-text{font-size:.75rem}}.status-indicator{gap:var(--spacing-12);backdrop-filter:blur(var(--spacing-16))}.status-indicator-dot{position:relative;width:.75rem;height:.75rem;border-radius:50%;flex-shrink:0;z-index:1}.status-indicator-dot:after{content:"";position:absolute;inset:0;border-radius:50%;background:currentcolor;transform:scale(1);opacity:.5;animation:status-pulse 1.5s ease-out infinite;z-index:-1}.status-indicator-dot:after{display:none}.status-indicator-dot--live:after,.status-indicator-dot--connected:after,.status-indicator-dot--loading:after,.status-indicator-dot--connecting:after{display:block}.status-indicator-dot--error{background:var(--color-gray-100);color:var(--color-gray-100)}.status-indicator-text--error{color:var(--color-gray-100)}.status-indicator-dot--connecting{background:var(--color-yellow-400);color:var(--color-yellow-400)}.status-indicator-text--connecting{color:var(--color-yellow-400)}.status-indicator-dot--loading{background:var(--color-yellow-400);color:var(--color-yellow-400)}.status-indicator-text--loading{color:var(--color-yellow-400)}.status-indicator-dot--live{background:var(--color-green-400);color:var(--color-green-400)}.status-indicator-text--live{color:var(--color-green-400)}.status-indicator-dot--connected{background:var(--color-blue-500);color:var(--color-blue-500)}.status-indicator-text--connected{color:var(--color-blue-500)}.status-indicator-text{font-size:1rem;letter-spacing:.1rem}@keyframes status-pulse{0%{transform:scale(1);opacity:.5}70%{opacity:.25}to{transform:scale(2.5);opacity:0}}';
334
- class wt extends HTMLElement {
335
- #e;
336
- #t;
337
- #o = new R(void 0);
338
- #a;
339
- constructor() {
340
- super(), this.#t = this.attachShadow({ mode: "open" });
341
- const t = document.createElement("style");
342
- t.textContent = bt, this.#t.appendChild(t), this.#a = new MutationObserver(() => this.#n());
343
- }
344
- connectedCallback() {
345
- this.#n(), this.#a.observe(this, { childList: !0 });
346
- const t = new T();
347
- this.#e = t, t.run(this.#r.bind(this));
348
- }
349
- disconnectedCallback() {
350
- this.#a.disconnect(), this.#e?.close(), this.#e = void 0;
351
- }
352
- #n() {
353
- const t = this.querySelector("moq-watch");
354
- this.#o.set(t ?? void 0);
355
- }
356
- #r(t) {
357
- const e = t.get(this.#o);
358
- if (!e) return;
359
- const r = new R(!1), a = v("div", { className: "video-container" });
360
- a.append(
361
- v("slot"),
362
- vt(t, e, r),
363
- O(t, e),
364
- nt(t, e)
365
- );
366
- const n = v("div", { className: "controls" }), i = v("div", { className: "playback-controls flex-align-center" });
367
- i.append(
368
- rt(t, e),
369
- dt(t, e),
370
- pt(t, e),
371
- lt(t, r),
372
- ot(t, e)
373
- );
374
- const s = v("div", { className: "latency-controls" });
375
- s.append(V(t, e), st(t, e)), n.append(i, s), C(t, this.#t, a), C(t, this.#t, n);
376
- }
377
- }
378
- customElements.define("moq-watch-ui", wt);
379
- export {
380
- wt as default
1
+ import { Effect as e, Signal as t } from "@moq/signals";
2
+ import * as n from "@moq/signals/dom";
3
+ //#region src/ui/components/buffering-indicator.ts
4
+ function r(e, t) {
5
+ let n = document.createElement("div");
6
+ n.className = "buffering";
7
+ let r = document.createElement("div");
8
+ return r.className = "buffering-spinner", n.appendChild(r), e.run((e) => {
9
+ let r = e.get(t.backend.video.stalled), i = e.get(t.broadcast.status) === "offline";
10
+ n.style.display = r && !i ? "" : "none";
11
+ }), n;
12
+ }
13
+ //#endregion
14
+ //#region src/ui/icons/audio.svg?raw
15
+ var i = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"M9 18V5l12-2v13\" />\n <circle cx=\"6\" cy=\"18\" r=\"3\" />\n <circle cx=\"18\" cy=\"16\" r=\"3\" />\n</svg>", a = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"M20 6 9 17l-5-5\" />\n</svg>\n", o = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n</svg>\n", s = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"M8 3H5a2 2 0 0 0-2 2v3\" />\n <path d=\"M21 8V5a2 2 0 0 0-2-2h-3\" />\n <path d=\"M3 16v3a2 2 0 0 0 2 2h3\" />\n <path d=\"M16 21h3a2 2 0 0 0 2-2v-3\" />\n</svg>", c = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"M8 3v3a2 2 0 0 1-2 2H3\" />\n <path d=\"M21 8h-3a2 2 0 0 1-2-2V3\" />\n <path d=\"M3 16h3a2 2 0 0 1 2 2v3\" />\n <path d=\"M16 21v-3a2 2 0 0 1 2-2h3\" />\n</svg>", l = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"m12 14 4-4\" />\n <path d=\"M3.34 19a10 10 0 1 1 17.32 0\" />\n</svg>\n", u = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"var(--color-white)\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"M16 9a5 5 0 0 1 .95 2.293\" />\n <path d=\"M19.364 5.636a9 9 0 0 1 1.889 9.96\" />\n <path d=\"m2 2 20 20\" />\n <path d=\"m7 7-.587.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298V11\" />\n <path d=\"M9.828 4.172A.686.686 0 0 1 11 4.657v.686\" />\n</svg>", d = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"M16.247 7.761a6 6 0 0 1 0 8.478\" />\n <path d=\"M19.075 4.933a10 10 0 0 1 0 14.134\" />\n <path d=\"M4.925 19.067a10 10 0 0 1 0-14.134\" />\n <path d=\"M7.753 16.239a6 6 0 0 1 0-8.478\" />\n <circle cx=\"12\" cy=\"12\" r=\"2\" />\n</svg>", f = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"var(--color-white)\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <rect x=\"14\" y=\"3\" width=\"5\" height=\"18\" rx=\"1\" />\n <rect x=\"5\" y=\"3\" width=\"5\" height=\"18\" rx=\"1\" />\n</svg>", p = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"var(--color-white)\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z\" />\n</svg>", m = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <line x1=\"21\" x2=\"14\" y1=\"4\" y2=\"4\" />\n <line x1=\"10\" x2=\"3\" y1=\"4\" y2=\"4\" />\n <line x1=\"21\" x2=\"12\" y1=\"12\" y2=\"12\" />\n <line x1=\"8\" x2=\"3\" y1=\"12\" y2=\"12\" />\n <line x1=\"21\" x2=\"16\" y1=\"20\" y2=\"20\" />\n <line x1=\"12\" x2=\"3\" y1=\"20\" y2=\"20\" />\n <line x1=\"14\" x2=\"14\" y1=\"2\" y2=\"6\" />\n <line x1=\"8\" x2=\"8\" y1=\"10\" y2=\"14\" />\n <line x1=\"16\" x2=\"16\" y1=\"18\" y2=\"22\" />\n</svg>\n", h = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"M5 21v-6\" />\n <path d=\"M12 21V3\" />\n <path d=\"M19 21V9\" />\n</svg>", g = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5\" />\n <rect x=\"2\" y=\"6\" width=\"14\" height=\"12\" rx=\"2\" />\n</svg>", _ = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"var(--color-white)\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z\" />\n <path d=\"M16 9a5 5 0 0 1 0 6\" />\n <path d=\"M19.364 18.364a9 9 0 0 0 0-12.728\" />\n</svg>", v = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"var(--color-white)\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z\" />\n</svg>", y = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"var(--color-white)\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z\" />\n <path d=\"M16 9a5 5 0 0 1 0 6\" />\n</svg>";
16
+ //#endregion
17
+ //#region src/ui/icons.ts
18
+ function b(e) {
19
+ let t = document.createElement("span");
20
+ return t.className = "flex-center", t.setAttribute("role", "img"), t.setAttribute("aria-hidden", "true"), t.innerHTML = e, t;
21
+ }
22
+ //#endregion
23
+ //#region src/ui/components/center-play.ts
24
+ function x(e, t) {
25
+ let n = document.createElement("button");
26
+ return n.type = "button", n.className = "center-play flex-center", n.title = "Play", n.setAttribute("aria-label", "Play"), n.replaceChildren(b(p)), e.run((e) => {
27
+ let r = e.get(t.backend.paused);
28
+ n.style.display = r ? "" : "none";
29
+ }), e.event(n, "click", () => {
30
+ t.paused = !1;
31
+ }), n;
32
+ }
33
+ //#endregion
34
+ //#region src/ui/fullscreen.ts
35
+ var S = "player--pseudo-fullscreen";
36
+ function C(e, t, n) {
37
+ let r = document, i = /* @__PURE__ */ new Set(), a = () => {
38
+ for (let e of i) e();
39
+ };
40
+ e.event(document, "fullscreenchange", a), e.event(document, "webkitfullscreenchange", a);
41
+ let o, s = () => !!(document.fullscreenElement || r.webkitFullscreenElement || o?.webkitDisplayingFullscreen), c = () => t.classList.contains(S), l = () => s() || c(), u = () => {
42
+ let r = t;
43
+ if (r.requestFullscreen) {
44
+ r.requestFullscreen().catch(() => f());
45
+ return;
46
+ }
47
+ if (r.webkitRequestFullscreen) {
48
+ r.webkitRequestFullscreen();
49
+ return;
50
+ }
51
+ let i = n();
52
+ if (i?.webkitEnterFullscreen && i.webkitSupportsFullscreen !== !1) {
53
+ o !== i && (o = i, e.event(i, "webkitbeginfullscreen", a), e.event(i, "webkitendfullscreen", a)), i.webkitEnterFullscreen();
54
+ return;
55
+ }
56
+ f();
57
+ }, d = () => {
58
+ if (c()) {
59
+ p();
60
+ return;
61
+ }
62
+ if (document.exitFullscreen) {
63
+ document.exitFullscreen().catch(() => {});
64
+ return;
65
+ }
66
+ r.webkitExitFullscreen?.();
67
+ }, f = () => {
68
+ t.classList.add(S), a();
69
+ }, p = () => {
70
+ t.classList.remove(S), a();
71
+ };
72
+ return {
73
+ active: l,
74
+ toggle: () => l() ? d() : u(),
75
+ onChange: (e) => (i.add(e), () => i.delete(e))
76
+ };
77
+ }
78
+ //#endregion
79
+ //#region src/ui/components/button.ts
80
+ function w(e, t) {
81
+ let n = document.createElement("button");
82
+ return n.type = "button", n.className = "control flex-center", n.title = t, n.setAttribute("aria-label", t), n.replaceChildren(b(e)), n;
83
+ }
84
+ //#endregion
85
+ //#region src/ui/components/fullscreen-button.ts
86
+ function T(e, t, n) {
87
+ let r = w(s, "Fullscreen"), i = C(e, t, () => n.querySelector("video") ?? n.querySelector("canvas")), a = () => {
88
+ let e = i.active();
89
+ r.replaceChildren(b(e ? c : s)), r.title = e ? "Exit fullscreen" : "Fullscreen", r.setAttribute("aria-label", r.title);
90
+ };
91
+ return a(), e.cleanup(i.onChange(a)), e.event(r, "click", () => i.toggle()), r;
92
+ }
93
+ //#endregion
94
+ //#region src/ui/format.ts
95
+ function E(e) {
96
+ return e >= 1e6 ? `${(e / 1e6).toFixed(1)} Mbps` : e >= 1e3 ? `${(e / 1e3).toFixed(0)} kbps` : `${Math.round(e)} bps`;
97
+ }
98
+ function D(e) {
99
+ return e < 1e3 ? `${Math.round(e)} ms` : `${(e / 1e3).toFixed(2)} s`;
100
+ }
101
+ function O(e) {
102
+ return `${(e / 1e3).toFixed(1)} kHz`;
103
+ }
104
+ function k(e) {
105
+ return `${e.toFixed(1)} fps`;
106
+ }
107
+ //#endregion
108
+ //#region src/ui/components/live-badge.ts
109
+ function A(e, t, n) {
110
+ return e ? t === "disconnected" ? {
111
+ variant: "error",
112
+ text: "Disconnected"
113
+ } : t === "connecting" ? {
114
+ variant: "connecting",
115
+ text: "Connecting"
116
+ } : n === "offline" ? {
117
+ variant: "error",
118
+ text: "Offline"
119
+ } : n === "loading" ? {
120
+ variant: "loading",
121
+ text: "Loading"
122
+ } : n === "live" ? {
123
+ variant: "live",
124
+ text: "Live"
125
+ } : {
126
+ variant: "loading",
127
+ text: "Connected"
128
+ } : {
129
+ variant: "error",
130
+ text: "No URL"
131
+ };
132
+ }
133
+ function ee(e, t, n) {
134
+ let r = document.createElement("button");
135
+ r.type = "button", r.className = "badge flex-align-center", r.title = "Latency settings";
136
+ let i = document.createElement("span");
137
+ i.className = "badge-dot";
138
+ let a = document.createElement("span");
139
+ a.className = "badge-text";
140
+ let o = document.createElement("span");
141
+ return o.className = "badge-latency", r.append(i, a, o), e.run((e) => {
142
+ let n = e.get(t.connection.url), i = e.get(t.connection.status), o = e.get(t.broadcast.status), { variant: s, text: c } = A(n, i, o);
143
+ r.style.display = o === "offline" ? "none" : "", r.dataset.variant = s, a.textContent = c.toUpperCase();
144
+ }), e.run((e) => {
145
+ o.textContent = `+${D(e.get(t.backend.sync.buffer))} latency`;
146
+ }), e.event(r, "click", () => {
147
+ n.tab.set("latency"), n.panel.set(!0);
148
+ }), r;
149
+ }
150
+ //#endregion
151
+ //#region src/ui/components/play-pause.ts
152
+ function te(e, t) {
153
+ let n = w(p, "Play");
154
+ return e.run((e) => {
155
+ let r = e.get(t.backend.paused);
156
+ n.title = r ? "Play" : "Pause", n.setAttribute("aria-label", n.title), n.replaceChildren(b(r ? p : f));
157
+ }), e.event(n, "click", () => {
158
+ t.paused = !t.paused;
159
+ }), n;
160
+ }
161
+ //#endregion
162
+ //#region src/ui/components/settings-button.ts
163
+ function j(e, t) {
164
+ let n = w(m, "Settings");
165
+ return e.run((e) => {
166
+ let r = e.get(t.panel);
167
+ n.classList.toggle("control--active", r), n.title = r ? "Close settings" : "Settings", n.setAttribute("aria-label", n.title), n.setAttribute("aria-expanded", String(r));
168
+ }), e.event(n, "click", () => {
169
+ t.panel.update((e) => !e);
170
+ }), n;
171
+ }
172
+ //#endregion
173
+ //#region src/ui/components/volume-slider.ts
174
+ function M(e, t) {
175
+ return t || e === 0 ? u : e <= 33 ? v : e <= 66 ? y : _;
176
+ }
177
+ function N(e, t) {
178
+ let n = document.createElement("div");
179
+ n.className = "volume flex-align-center";
180
+ let r = document.createElement("button");
181
+ r.type = "button", r.className = "control flex-center";
182
+ let i = document.createElement("input");
183
+ return i.type = "range", i.className = "volume-track", i.min = "0", i.max = "100", i.setAttribute("aria-label", "Volume"), n.append(r, i), e.run((e) => {
184
+ let n = e.get(t.backend.audio.volume), a = e.get(t.backend.audio.muted), o = Math.round(n * 100), s = a ? 0 : o;
185
+ i.value = s.toString(), i.style.setProperty("--fill", `${s}%`), r.title = a ? "Unmute" : "Mute", r.setAttribute("aria-label", r.title), r.replaceChildren(b(M(o, a)));
186
+ }), e.event(i, "input", () => {
187
+ let e = Number.parseFloat(i.value) / 100;
188
+ t.backend.audio.volume.set(e), e > 0 && t.backend.audio.muted.set(!1);
189
+ }), e.event(r, "click", () => {
190
+ t.backend.audio.muted.update((e) => !e);
191
+ }), n;
192
+ }
193
+ //#endregion
194
+ //#region src/ui/components/control-bar.ts
195
+ function P(e, t, r, i) {
196
+ let a = n.create("div", { className: "controls" }), o = n.create("div", { className: "controls-group" });
197
+ o.append(te(e, t), N(e, t), ee(e, t, r));
198
+ let s = n.create("div", { className: "controls-spacer" }), c = n.create("div", { className: "controls-group" });
199
+ return c.append(j(e, r), T(e, i, t)), a.append(o, s, c), a;
200
+ }
201
+ //#endregion
202
+ //#region src/ui/components/offline-indicator.ts
203
+ function F(e, t) {
204
+ let n = document.createElement("div");
205
+ n.className = "watch-ui__offline-indicator", n.setAttribute("role", "status"), n.setAttribute("aria-live", "polite");
206
+ let r = document.createElement("span");
207
+ return r.className = "watch-ui__offline-text", r.textContent = "OFFLINE", n.appendChild(r), e.run((e) => {
208
+ let r = e.get(t.broadcast.status) === "offline";
209
+ n.style.display = r ? "" : "none";
210
+ }), n;
211
+ }
212
+ //#endregion
213
+ //#region src/ui/graph.ts
214
+ var I = 120;
215
+ function L(e, t) {
216
+ let n = document.createElement("canvas").getContext("2d");
217
+ if (!n) return e;
218
+ n.fillStyle = e;
219
+ let r = n.fillStyle;
220
+ if (r.startsWith("#")) {
221
+ let e = Number.parseInt(r.slice(1), 16);
222
+ return `rgba(${e >> 16 & 255}, ${e >> 8 & 255}, ${e & 255}, ${t})`;
223
+ }
224
+ let i = r.match(/[\d.]+/g);
225
+ return i && i.length >= 3 ? `rgba(${i[0]}, ${i[1]}, ${i[2]}, ${t})` : e;
226
+ }
227
+ function R(e, t, n) {
228
+ let r = n?.color ?? "#4ade80", i = L(r, .33), a = L(r, 0), o = Number.isFinite(n?.samples) ? Math.max(1, Math.floor(n?.samples)) : I, s = document.createElement("div");
229
+ s.className = "graph";
230
+ let c = document.createElement("div");
231
+ c.className = "graph-header";
232
+ let l = document.createElement("span");
233
+ l.className = "graph-label", l.textContent = t;
234
+ let u = document.createElement("span");
235
+ u.className = "graph-value", u.style.color = r, c.append(l, u);
236
+ let d = document.createElement("canvas");
237
+ d.className = "graph-canvas", s.append(c, d);
238
+ let f = [], p = n?.max ?? 1, m = () => {
239
+ let e = d.getContext("2d");
240
+ if (e) {
241
+ let t = window.devicePixelRatio || 1, s = d.getBoundingClientRect(), c = s.width, l = s.height, u = Math.round(c * t), m = Math.round(l * t);
242
+ if ((d.width !== u || d.height !== m) && (d.width = u, d.height = m), e.setTransform(t, 0, 0, t, 0, 0), e.clearRect(0, 0, c, l), c > 0 && l > 0) {
243
+ let t = f.length ? Math.max(...f) : 0, s = n?.max ?? Math.max(1, t * 1.2);
244
+ p += (s - p) * .1;
245
+ let u = l - 2, d = (e) => o <= 1 ? c : e / (o - 1) * c, m = (e) => 1 + u - Math.min(e, p) / p * u, h = o - f.length;
246
+ if (f.length > 1) {
247
+ e.beginPath(), e.moveTo(d(h), m(f[0]));
248
+ for (let t = 1; t < f.length; t++) e.lineTo(d(h + t), m(f[t]));
249
+ let t = e.createLinearGradient(0, 0, 0, l);
250
+ t.addColorStop(0, i), t.addColorStop(1, a), e.save(), e.lineTo(d(h + f.length - 1), l), e.lineTo(d(h), l), e.closePath(), e.fillStyle = t, e.fill(), e.restore(), e.beginPath(), e.moveTo(d(h), m(f[0]));
251
+ for (let t = 1; t < f.length; t++) e.lineTo(d(h + t), m(f[t]));
252
+ e.strokeStyle = r, e.lineWidth = 1.5, e.lineJoin = "round", e.stroke();
253
+ }
254
+ }
255
+ }
256
+ }, h = (e) => {
257
+ for (f.push(e !== void 0 && Number.isFinite(e) ? Math.max(0, e) : 0); f.length > o;) f.shift();
258
+ u.textContent = e !== void 0 && Number.isFinite(e) ? n?.format?.(e) ?? e.toFixed(0) : "—", m();
259
+ };
260
+ if (typeof ResizeObserver < "u") {
261
+ let t = new ResizeObserver(() => m());
262
+ t.observe(d), e.cleanup(() => t.disconnect());
263
+ }
264
+ return {
265
+ el: s,
266
+ push: h
267
+ };
268
+ }
269
+ //#endregion
270
+ //#region src/ui/stats.ts
271
+ var ne = 250;
272
+ function z(e, t, r) {
273
+ let i = n.create("div", { className: `stat-card stat-card--${e}` }), a = n.create("div", { className: "stat-head" }), o = n.create("div", { className: "stat-icon" });
274
+ o.appendChild(b(r));
275
+ let s = n.create("span", {
276
+ className: "stat-status",
277
+ style: { display: "none" }
278
+ });
279
+ a.append(o, n.create("span", { className: "stat-title" }, t), s);
280
+ let c = n.create("div", { className: "stat-grid" });
281
+ return i.append(a, c), {
282
+ el: i,
283
+ grid: c,
284
+ status: s
285
+ };
286
+ }
287
+ function B(e, t) {
288
+ let r = n.create("div", { className: "stat-line" }), i = n.create("span", { className: "stat-value" }, "—");
289
+ return r.append(n.create("span", { className: "stat-key" }, t), i), e.appendChild(r), i;
290
+ }
291
+ function V(e, t, n) {
292
+ if (e.bytes <= 0) return;
293
+ let r = n - e.when, i = t - e.bytes;
294
+ if (!(i <= 0 || r <= 0)) return i * 8 * (1e3 / r);
295
+ }
296
+ function H(e) {
297
+ return Object.keys(e?.renditions ?? {}).length > 0;
298
+ }
299
+ function U(e, t, n) {
300
+ t.status.textContent = n.label, e.run((e) => {
301
+ let r = H(e.get(n.catalog));
302
+ t.el.style.display = r ? "" : "none", t.status.style.display = r && e.get(n.flag) ? "" : "none";
303
+ });
304
+ }
305
+ function W(e, t) {
306
+ let r = n.create("div", { className: "tab-body stats" }), a = z("video", "Video", g), o = B(a.grid, "Resolution"), s = B(a.grid, "Codec"), c = R(e, "Bitrate", {
307
+ color: "#a855f7",
308
+ format: E
309
+ }), l = R(e, "Frame rate", {
310
+ color: "#facc15",
311
+ format: k
312
+ });
313
+ a.el.append(c.el, l.el), U(e, a, {
314
+ catalog: t.backend.video.source.catalog,
315
+ flag: t.backend.paused,
316
+ label: "paused"
317
+ });
318
+ let u = z("audio", "Audio", i), f = B(u.grid, "Codec"), p = B(u.grid, "Sample rate"), m = B(u.grid, "Channels"), h = B(u.grid, "Bitrate");
319
+ U(e, u, {
320
+ catalog: t.backend.audio.source.catalog,
321
+ flag: t.backend.audio.muted,
322
+ label: "muted"
323
+ });
324
+ let _ = z("network", "Network", d), v = B(_.grid, "Estimated max"), y = B(_.grid, "Actual"), b = R(e, "Round trip", {
325
+ color: "#00dfff",
326
+ format: (e) => D(e)
327
+ });
328
+ _.el.append(b.el), r.append(a.el, u.el, _.el);
329
+ let x = {
330
+ frames: 0,
331
+ bytes: 0,
332
+ when: performance.now()
333
+ }, S = {
334
+ bytes: 0,
335
+ when: performance.now()
336
+ };
337
+ return e.interval(() => {
338
+ let e = performance.now(), n = t.backend.video.source.config.peek(), r = t.backend.video.source.catalog.peek(), i = t.backend.video.stats.peek(), a = n?.codedWidth ?? r?.display?.width, u = n?.codedHeight ?? r?.display?.height;
339
+ o.textContent = a && u ? `${a}×${u}` : "—", s.textContent = n?.codec ?? "—";
340
+ let d;
341
+ if (i && x.frames > 0) {
342
+ let t = e - x.when, n = i.frameCount - x.frames;
343
+ n > 0 && t > 0 && (d = n / (t / 1e3));
344
+ }
345
+ let g = i ? V(x, i.bytesReceived, e) : void 0;
346
+ c.push(g), l.push(d), i && (x = {
347
+ frames: i.frameCount,
348
+ bytes: i.bytesReceived,
349
+ when: e
350
+ });
351
+ let _ = t.backend.audio.source.config.peek(), C = t.backend.audio.stats.peek();
352
+ f.textContent = _?.codec ?? "—", p.textContent = _?.sampleRate ? O(_.sampleRate) : "—", m.textContent = _?.numberOfChannels ? `${_.numberOfChannels}` : "—";
353
+ let w = C ? V(S, C.bytesReceived, e) : void 0;
354
+ h.textContent = w === void 0 ? "—" : E(w), C && (S = {
355
+ bytes: C.bytesReceived,
356
+ when: e
357
+ });
358
+ let T = t.connection.established.peek(), D = T?.recvBandwidth?.peek();
359
+ v.textContent = D ? E(D) : "";
360
+ let k = g !== void 0 || w !== void 0 ? (g ?? 0) + (w ?? 0) : void 0;
361
+ y.textContent = k === void 0 ? "" : E(k);
362
+ let A = T?.rtt?.peek();
363
+ b.push(A !== void 0 && A > 0 ? A : void 0);
364
+ }, ne), r;
365
+ }
366
+ //#endregion
367
+ //#region src/ui/components/buffer-control.ts
368
+ var G = 0, K = 10, q = 4e3, J = 48;
369
+ function Y(e, t, n, r, i) {
370
+ let a = e.getContext("2d");
371
+ if (!a) return;
372
+ let o = window.devicePixelRatio || 1, s = e.getBoundingClientRect(), c = s.width, l = s.height, u = Math.round(c * o), d = Math.round(l * o);
373
+ if ((e.width !== u || e.height !== d) && (e.width = u, e.height = d), a.setTransform(o, 0, 0, o, 0, 0), a.clearRect(0, 0, c, l), n === void 0) return;
374
+ let f = l - 4;
375
+ for (let e = 0; e < t.length; e++) {
376
+ let o = t[e], s = o.start - n, u = o.end - n, d = Math.max(0, s), p = Math.min(u, r);
377
+ if (p <= d) continue;
378
+ let m = d / r * c, h = Math.max(2, (p - d) / r * c);
379
+ if (a.globalAlpha = .85, a.fillStyle = i ? "#f87171" : e > 0 ? "#facc15" : "#4ade80", typeof a.roundRect == "function" ? (a.beginPath(), a.roundRect(m, 2, h, f, 2), a.fill()) : a.fillRect(m, 2, h, f), u > r) {
380
+ let e = ((u - r) / 1e3).toFixed(1);
381
+ a.globalAlpha = .7, a.fillStyle = "black", a.font = "500 9px system-ui, sans-serif", a.textAlign = "right", a.textBaseline = "middle", a.fillText(`+${e}s`, m + h - 4, l / 2);
382
+ }
383
+ }
384
+ }
385
+ function X(e, t, n = q) {
386
+ let r = document.createElement("div");
387
+ r.className = "buffer";
388
+ let i = document.createElement("div");
389
+ i.className = "buffer-visualization", i.setAttribute("role", "slider"), i.tabIndex = 0, i.setAttribute("aria-valuemin", G.toString()), i.setAttribute("aria-valuemax", n.toString()), i.setAttribute("aria-label", "Buffer jitter");
390
+ let a = document.createElement("div");
391
+ a.className = "buffer-playhead";
392
+ let o = document.createElement("div");
393
+ o.className = "buffer-track buffer-track--video";
394
+ let s = document.createElement("span");
395
+ s.className = "buffer-track-label", s.textContent = "Video";
396
+ let c = document.createElement("canvas");
397
+ c.className = "buffer-canvas", o.append(s, c);
398
+ let l = document.createElement("div");
399
+ l.className = "buffer-track buffer-track--audio";
400
+ let u = document.createElement("span");
401
+ u.className = "buffer-track-label", u.textContent = "Audio";
402
+ let d = document.createElement("canvas");
403
+ d.className = "buffer-canvas", l.append(u, d);
404
+ let f = document.createElement("div");
405
+ f.className = "buffer-target-area";
406
+ let p = document.createElement("div");
407
+ p.className = "buffer-target-line";
408
+ let m = document.createElement("span");
409
+ m.className = "buffer-target-label", p.appendChild(m), f.appendChild(p);
410
+ let h = document.createElement("span");
411
+ h.className = "buffer-help", h.textContent = "click to change latency", i.append(a, o, l, f, h), r.appendChild(i);
412
+ let g = !1, _ = !1;
413
+ e.run((e) => {
414
+ let r = e.get(t.backend.jitter), a = r / n * 100;
415
+ p.style.left = `${a}%`, m.textContent = `${Math.round(r)}ms`, i.setAttribute("aria-valuenow", r.toString());
416
+ });
417
+ let v = (e) => {
418
+ let r = i.getBoundingClientRect(), a = r.width - J, o = Math.max(0, Math.min(e - r.left - J, a)) / a * n, s = Math.round(o / K) * K, c = Math.max(G, Math.min(n, s));
419
+ t.backend.latency.set(c);
420
+ }, y = () => {
421
+ _ || (_ = !0, h.style.display = "none");
422
+ };
423
+ e.event(i, "mousedown", (e) => {
424
+ g = !0, i.classList.add("buffer-visualization--dragging"), y(), v(e.clientX);
425
+ }), e.event(document, "mousemove", (e) => {
426
+ g && v(e.clientX);
427
+ }), e.event(document, "mouseup", () => {
428
+ g && (g = !1, i.classList.remove("buffer-visualization--dragging"));
429
+ }), e.event(i, "keydown", (e) => {
430
+ let r = 0;
431
+ if (e.key === "ArrowRight" || e.key === "ArrowUp") r = K;
432
+ else if (e.key === "ArrowLeft" || e.key === "ArrowDown") r = -10;
433
+ else return;
434
+ e.preventDefault(), y();
435
+ let i = t.backend.jitter.peek(), a = Math.max(G, Math.min(n, i + r));
436
+ t.backend.latency.set(a);
437
+ });
438
+ let b = () => {
439
+ let r = t.backend.sync.now(), i = t.backend.video.stalled.peek();
440
+ Y(c, t.backend.video.buffered.peek(), r, n, i), Y(d, t.backend.audio.buffered.peek(), r, n, i), e.animate(b);
441
+ };
442
+ return e.animate(b), r;
443
+ }
444
+ //#endregion
445
+ //#region src/ui/components/latency.ts
446
+ var re = [
447
+ {
448
+ label: "Real-time",
449
+ value: "real-time"
450
+ },
451
+ {
452
+ label: "100ms",
453
+ value: 100
454
+ },
455
+ {
456
+ label: "250ms",
457
+ value: 250
458
+ },
459
+ {
460
+ label: "500ms",
461
+ value: 500
462
+ },
463
+ {
464
+ label: "1s",
465
+ value: 1e3
466
+ },
467
+ {
468
+ label: "2s",
469
+ value: 2e3
470
+ }
471
+ ];
472
+ function ie(e, t) {
473
+ let r = n.create("div", { className: "tab-body latency" }), i = n.create("div", { className: "latency-presets" }), a = re.map((r) => {
474
+ let a = n.create("button", {
475
+ className: "chip",
476
+ type: "button"
477
+ }, r.label);
478
+ return e.event(a, "click", () => {
479
+ t.backend.latency.set(r.value === "real-time" ? "real-time" : r.value);
480
+ }), i.appendChild(a), {
481
+ preset: r,
482
+ chip: a
483
+ };
484
+ });
485
+ e.run((e) => {
486
+ let n = e.get(t.backend.latency);
487
+ for (let { preset: e, chip: t } of a) {
488
+ let r = e.value === "real-time" ? n === "real-time" : n === e.value;
489
+ t.classList.toggle("chip--active", r);
490
+ }
491
+ });
492
+ let o = X(e, t), s = n.create("div", { className: "latency-readout" }), c = n.create("div", { className: "latency-stat" }), l = n.create("span", { className: "latency-stat-value" }, "—");
493
+ c.append(n.create("span", { className: "latency-stat-label" }, "Jitter buffer"), l);
494
+ let u = n.create("div", { className: "latency-stat" }), d = n.create("span", { className: "latency-stat-value" }, "—");
495
+ u.append(n.create("span", { className: "latency-stat-label" }, "Total buffer"), d), s.append(c, u), e.run((e) => {
496
+ let n = e.get(t.backend.latency), r = e.get(t.backend.jitter), i = e.get(t.backend.sync.buffer);
497
+ l.textContent = `${D(r)}${n === "real-time" ? " (auto)" : ""}`, d.textContent = D(i);
498
+ });
499
+ let f = n.create("div", { className: "tab-hint" }, "A larger buffer smooths over network jitter at the cost of latency. Real-time tracks the connection RTT automatically. Drag the timeline to fine-tune.");
500
+ return r.append(i, o, s, f), r;
501
+ }
502
+ //#endregion
503
+ //#region src/ui/components/quality.ts
504
+ function ae(e) {
505
+ if (e.codedWidth && e.codedHeight) return `${e.codedWidth}×${e.codedHeight}`;
506
+ }
507
+ function oe(e) {
508
+ let t = [];
509
+ return e.framerate && t.push(`${Math.round(e.framerate)}fps`), e.bitrate && t.push(E(e.bitrate)), e.codec && t.push(e.codec), t.join(" · ");
510
+ }
511
+ function Z(e, t, r, i, o, s) {
512
+ let c = n.create("button", {
513
+ className: "q-row",
514
+ type: "button"
515
+ });
516
+ i && c.classList.add("q-row--selected");
517
+ let l = n.create("span", { className: "q-row-check" });
518
+ i && l.appendChild(b(a));
519
+ let u = n.create("div", { className: "q-row-body" }), d = n.create("span", { className: "q-row-title" }, t);
520
+ if (o) {
521
+ let e = n.create("span", { className: "q-row-playing" }, "playing");
522
+ d.appendChild(e);
523
+ }
524
+ let f = n.create("span", { className: "q-row-sub" }, r);
525
+ return u.append(d, f), c.append(l, u), e.event(c, "click", s), c;
526
+ }
527
+ function se(e, t) {
528
+ let r = n.create("div", { className: "tab-body q-list" });
529
+ return e.run((e) => {
530
+ let i = t.backend.video.source, a = e.get(i.catalog), o = e.get(i.target), s = e.get(i.track), c = a?.renditions ?? {}, l = Object.entries(c);
531
+ if (r.replaceChildren(), l.length === 0) {
532
+ r.appendChild(n.create("div", { className: "tab-empty" }, "No video renditions"));
533
+ return;
534
+ }
535
+ let u = o?.name, d = s && !u ? `auto · currently ${s}` : "adapts to bandwidth";
536
+ r.appendChild(Z(e, "Auto", d, !u, !1, () => {
537
+ i.target.update((e) => ({
538
+ ...e,
539
+ name: void 0
540
+ }));
541
+ })), l.sort((e, t) => {
542
+ let n = (e[1].codedWidth ?? 0) * (e[1].codedHeight ?? 0);
543
+ return (t[1].codedWidth ?? 0) * (t[1].codedHeight ?? 0) - n;
544
+ });
545
+ for (let [t, n] of l) {
546
+ let a = ae(n) ?? t;
547
+ r.appendChild(Z(e, a, oe(n), u === t, s === t, () => {
548
+ i.target.update((e) => ({
549
+ ...e,
550
+ name: t
551
+ }));
552
+ }));
553
+ }
554
+ }), r;
555
+ }
556
+ //#endregion
557
+ //#region src/ui/components/settings-panel.ts
558
+ var Q = [
559
+ {
560
+ id: "quality",
561
+ label: "Quality",
562
+ svg: g
563
+ },
564
+ {
565
+ id: "latency",
566
+ label: "Latency",
567
+ svg: l
568
+ },
569
+ {
570
+ id: "stats",
571
+ label: "Stats",
572
+ svg: h
573
+ }
574
+ ];
575
+ function ce(e, t, r) {
576
+ let i = n.create("div", { className: "panel" });
577
+ i.setAttribute("role", "dialog"), i.setAttribute("aria-label", "Player settings");
578
+ let a = n.create("div", { className: "panel-head" }), s = n.create("div", { className: "panel-head-title flex-align-center" });
579
+ s.append(b(m), n.create("span", {}, "Settings"));
580
+ let c = n.create("button", {
581
+ className: "control flex-center",
582
+ type: "button"
583
+ });
584
+ c.title = "Close", c.setAttribute("aria-label", "Close settings"), c.appendChild(b(o)), e.event(c, "click", () => r.panel.set(!1)), a.append(s, c);
585
+ let l = "panel-body", u = n.create("div", { className: "panel-tabs" });
586
+ u.setAttribute("role", "tablist");
587
+ let d = Q.map((t) => {
588
+ let i = n.create("button", {
589
+ className: "panel-tab",
590
+ type: "button",
591
+ id: `tab-${t.id}`
592
+ });
593
+ return i.setAttribute("role", "tab"), i.setAttribute("aria-controls", l), i.append(b(t.svg), n.create("span", {}, t.label)), e.event(i, "click", () => r.tab.set(t.id)), u.appendChild(i), {
594
+ tab: t,
595
+ btn: i
596
+ };
597
+ }), f = n.create("div", {
598
+ className: "panel-body",
599
+ id: l
600
+ });
601
+ return f.setAttribute("role", "tabpanel"), e.run((e) => {
602
+ let t = e.get(r.tab);
603
+ f.setAttribute("aria-labelledby", `tab-${t}`);
604
+ for (let { tab: e, btn: n } of d) {
605
+ let r = e.id === t;
606
+ n.classList.toggle("panel-tab--active", r), n.setAttribute("aria-selected", String(r)), n.tabIndex = r ? 0 : -1;
607
+ }
608
+ }), e.run((e) => {
609
+ if (!e.get(r.panel)) return;
610
+ let i = e.get(r.tab), a = i === "quality" ? se(e, t) : i === "latency" ? ie(e, t) : W(e, t);
611
+ n.render(e, f, a);
612
+ }), i.append(a, u, f), e.run((e) => {
613
+ let t = e.get(r.panel);
614
+ i.classList.toggle("panel--open", t), i.setAttribute("aria-hidden", String(!t));
615
+ }), i;
616
+ }
617
+ //#endregion
618
+ //#region src/ui/styles/index.css?inline
619
+ var le = "*,:before,:after{box-sizing:border-box}:host{--color-white:#fff;--color-white-alpha-05:#ffffff0d;--color-white-alpha-10:#ffffff1a;--color-white-alpha-15:#ffffff26;--color-white-alpha-20:#fff3;--color-white-alpha-25:#ffffff40;--color-white-alpha-30:#ffffff4d;--color-white-alpha-40:#fff6;--color-white-alpha-60:#fff9;--color-white-alpha-70:#ffffffb3;--color-white-alpha-90:#ffffffe6;--color-gray-100:#9ca3af;--color-gray-400:#6b7280;--color-gray-950:#1a1a1a;--color-blue-400:#00dfff;--color-blue-500:#52a1ff;--color-blue-900:#1b3243;--color-purple-400:#a855f7;--color-purple-900:#31144a;--color-green-400:#65ee2e;--color-green-500:#22c55e;--color-green-900:#3d4928;--color-yellow-400:#facc15;--color-orange-400:#f90;--color-orange-450:#fb923c;--color-orange-500:#f97316;--color-orange-900:#4d301b;--color-red-400:#f87171;--color-amber-600:#d97706;--color-orange-500-alpha-60:#f9731699;--color-orange-500-alpha-80:#f97316cc;--color-black-alpha-08:#00000014;--color-black-alpha-10:#0000001a;--color-black-alpha-40:#0006;--color-black-alpha-60:#0009;--color-black-alpha-85:#000000d9;--color-panel:#121214eb;--spacing-1:.0625rem;--spacing-2:.125rem;--spacing-4:.25rem;--spacing-8:.5rem;--spacing-12:.75rem;--spacing-16:1rem;--spacing-24:1.5rem;--spacing-32:2rem;--spacing-48:3rem;--border-radius-sm:.375rem;--border-radius-md:.5rem;--border-radius-lg:.75rem;--accent:var(--color-orange-400);--ease:cubic-bezier(.4, 0, .2, 1);font-family:system-ui,Segoe UI,Roboto,sans-serif}.flex-center{justify-content:center;align-items:center;display:flex}.flex-align-center{align-items:center;display:flex}.control{width:2.25rem;height:2.25rem;color:var(--color-white);cursor:pointer;transition:background-color .12s var(--ease), transform .12s var(--ease), color .12s var(--ease);background:0 0;border:none;border-radius:50%;flex-shrink:0;justify-content:center;align-items:center;padding:0;display:inline-flex}.control svg{width:1.25rem;height:1.25rem}.control:hover:not(:disabled){background-color:var(--color-white-alpha-15)}.control:active:not(:disabled){transform:scale(.92)}.control--active{color:var(--accent)}.control:disabled{opacity:.4;cursor:default}.chip{padding:var(--spacing-4) var(--spacing-12);color:var(--color-white-alpha-70);background-color:var(--color-white-alpha-10);border:var(--spacing-1) solid transparent;cursor:pointer;transition:background-color .12s var(--ease), color .12s var(--ease), border-color .12s var(--ease);border-radius:999px;font-size:.75rem;font-weight:500}.chip:hover{background-color:var(--color-white-alpha-20);color:var(--color-white)}.chip--active{color:var(--color-gray-950);background-color:var(--accent);border-color:var(--accent)}:host{display:block;position:relative}.player{border-radius:var(--spacing-8);background:#000;width:100%;line-height:0;position:relative;overflow:hidden}.player ::slotted(moq-watch){width:100%;display:block}.player:not(.player--chrome){cursor:none}.player:fullscreen,.player--pseudo-fullscreen{border-radius:0;justify-content:center;align-items:center;display:flex}.player:-webkit-full-screen{border-radius:0;justify-content:center;align-items:center;display:flex}.player--pseudo-fullscreen{z-index:2147483647;width:100vw;height:100vh;position:fixed;inset:0}.player:fullscreen ::slotted(moq-watch),.player--pseudo-fullscreen ::slotted(moq-watch){max-height:100%}.player:-webkit-full-screen ::slotted(moq-watch){max-height:100%}.scrim{pointer-events:none;opacity:0;transition:opacity .2s var(--ease);position:absolute;left:0;right:0}.scrim--top{background:linear-gradient(to bottom, var(--color-black-alpha-40), transparent);height:25%;top:0}.scrim--bottom{background:linear-gradient(to top, var(--color-black-alpha-60), transparent 60%);height:100%;bottom:0}.player--chrome .scrim{opacity:1}.center{pointer-events:none;justify-content:center;align-items:center;line-height:1;display:flex;position:absolute;inset:0}.center-play{pointer-events:auto;width:4.5rem;height:4.5rem;color:var(--color-white);background:linear-gradient(to bottom right, var(--color-orange-400), var(--color-orange-500), var(--color-amber-600));cursor:pointer;box-shadow:0 var(--spacing-8) var(--spacing-24) var(--color-black-alpha-40);transition:transform .15s var(--ease), box-shadow .15s var(--ease);border:none;border-radius:50%}.center-play svg{width:2rem;height:2rem}.center-play:hover{box-shadow:0 var(--spacing-8) var(--spacing-32) var(--color-orange-500-alpha-60);transform:scale(1.06)}.center-play:active{transform:scale(.97)}.chrome{opacity:0;pointer-events:none;transition:opacity .2s var(--ease), transform .2s var(--ease);flex-direction:column;justify-content:flex-end;line-height:1.4;display:flex;position:absolute;bottom:0;left:0;right:0;transform:translateY(.5rem)}.player--chrome .chrome{opacity:1;pointer-events:auto;transform:translateY(0)}.controls{align-items:center;gap:var(--spacing-4);padding:var(--spacing-8) var(--spacing-12) var(--spacing-12);display:flex;position:relative}.controls-group{align-items:center;gap:var(--spacing-4);display:flex}.controls-spacer{flex:1}.volume{gap:var(--spacing-4)}.volume-track{appearance:none;background:linear-gradient(to right, var(--color-white) 0%, var(--color-white) var(--fill,50%), var(--color-white-alpha-30) var(--fill,50%));cursor:pointer;opacity:0;width:0;max-width:0;height:.25rem;transition:width .16s var(--ease), max-width .16s var(--ease), opacity .16s var(--ease);border-radius:999px;outline:none;margin:0}.volume:hover .volume-track,.volume:focus-within .volume-track{opacity:1;width:4.5rem;max-width:4.5rem}.volume-track::-webkit-slider-thumb{appearance:none;background:var(--color-white);cursor:pointer;border:none;border-radius:50%;width:.75rem;height:.75rem}.volume-track::-moz-range-thumb{background:var(--color-white);cursor:pointer;border:none;border-radius:50%;width:.75rem;height:.75rem}.badge{gap:var(--spacing-8);height:2.25rem;padding:0 var(--spacing-12);margin-left:var(--spacing-4);color:var(--color-white);border-radius:var(--border-radius-sm);cursor:pointer;transition:background-color .12s var(--ease);background:0 0;border:none;font-size:.8125rem}.badge:hover{background-color:var(--color-white-alpha-10)}.badge-dot{background:var(--color-gray-400);border-radius:50%;flex-shrink:0;width:.5rem;height:.5rem}.badge-text{letter-spacing:.04em;font-weight:600}.badge-latency{max-width:0;margin-left:calc(-1 * var(--spacing-8));opacity:0;white-space:nowrap;font-variant-numeric:tabular-nums;color:var(--color-white-alpha-60);transition:max-width .16s var(--ease), margin-left .16s var(--ease), opacity .16s var(--ease);overflow:hidden}.badge:hover .badge-latency,.badge:focus-visible .badge-latency{opacity:1;max-width:9rem;margin-left:0}.badge[data-variant=live] .badge-dot{background:var(--color-red-400);animation:badge-pulse 2s var(--ease) infinite;box-shadow:0 0 #f87171b3}.badge[data-variant=live] .badge-text{color:var(--color-red-400)}.badge[data-variant=loading] .badge-dot,.badge[data-variant=connecting] .badge-dot{background:var(--color-yellow-400)}.badge[data-variant=error] .badge-dot{background:var(--color-gray-400)}.badge[data-variant=error] .badge-text{color:var(--color-gray-100)}@keyframes badge-pulse{0%{box-shadow:0 0 #f8717199}70%{box-shadow:0 0 0 .4rem #f8717100}to{box-shadow:0 0 #f8717100}}.panel{top:var(--spacing-8);right:var(--spacing-8);bottom:var(--spacing-8);width:20rem;max-width:calc(100% - var(--spacing-16));background:var(--color-panel);backdrop-filter:blur(12px);border:var(--spacing-1) solid var(--color-white-alpha-15);border-radius:var(--border-radius-lg);box-shadow:0 var(--spacing-8) var(--spacing-32) var(--color-black-alpha-60);color:var(--color-white);z-index:4;opacity:0;pointer-events:none;transition:opacity .2s var(--ease), transform .2s var(--ease);flex-direction:column;line-height:1.4;display:flex;position:absolute;overflow:hidden;transform:translate(.75rem)}.panel--open{opacity:1;pointer-events:auto;transform:translate(0)}.panel-head{padding:var(--spacing-8) var(--spacing-8) var(--spacing-8) var(--spacing-16);border-bottom:var(--spacing-1) solid var(--color-white-alpha-10);justify-content:space-between;align-items:center;display:flex}.panel-head-title{gap:var(--spacing-8);font-size:.875rem;font-weight:600}.panel-head-title svg{width:1.125rem;height:1.125rem}.panel-head .control{width:2rem;height:2rem}.panel-tabs{padding:var(--spacing-8);gap:var(--spacing-4);display:flex}.panel-tab{align-items:center;gap:var(--spacing-4);padding:var(--spacing-8) var(--spacing-4);color:var(--color-white-alpha-60);border-radius:var(--border-radius-md);cursor:pointer;transition:background-color .12s var(--ease), color .12s var(--ease);background:0 0;border:none;flex-direction:column;flex:1;font-size:.6875rem;font-weight:500;display:flex}.panel-tab svg{width:1.125rem;height:1.125rem}.panel-tab:hover{background-color:var(--color-white-alpha-05);color:var(--color-white)}.panel-tab--active{background-color:var(--color-white-alpha-10);color:var(--color-white)}.panel-body{scrollbar-width:thin;scrollbar-color:var(--color-white-alpha-20) transparent;flex:1;min-height:0;overflow-y:auto}.panel-body::-webkit-scrollbar{width:.375rem}.panel-body::-webkit-scrollbar-thumb{background:var(--color-white-alpha-20);border-radius:999px}.tab-body{gap:var(--spacing-12);padding:var(--spacing-12) var(--spacing-16) var(--spacing-16);flex-direction:column;display:flex}.tab-empty{padding:var(--spacing-24) 0;text-align:center;color:var(--color-white-alpha-40);font-size:.8125rem}.tab-hint{color:var(--color-white-alpha-40);font-size:.6875rem;line-height:1.5}.q-list{gap:var(--spacing-2)}.q-row{align-items:center;gap:var(--spacing-8);width:100%;padding:var(--spacing-8);text-align:left;color:var(--color-white);border-radius:var(--border-radius-md);cursor:pointer;transition:background-color .12s var(--ease);background:0 0;border:none;display:flex}.q-row:hover{background-color:var(--color-white-alpha-05)}.q-row--selected{background-color:var(--color-white-alpha-10)}.q-row-check{width:1rem;color:var(--accent);flex-shrink:0;justify-content:center;align-items:center;display:flex}.q-row-check svg{width:1rem;height:1rem}.q-row-body{flex-direction:column;gap:.1rem;min-width:0;display:flex}.q-row-title{align-items:center;gap:var(--spacing-8);font-size:.8125rem;font-weight:600;display:flex}.q-row-playing{letter-spacing:.06em;text-transform:uppercase;color:var(--color-green-500);background:var(--color-green-900);padding:.05rem var(--spacing-4);border-radius:var(--border-radius-sm);font-size:.5625rem;font-weight:600}.q-row-sub{color:var(--color-white-alpha-60);text-overflow:ellipsis;white-space:nowrap;font-size:.6875rem;overflow:hidden}.latency-presets{gap:var(--spacing-4);flex-wrap:wrap;display:flex}.latency-readout{gap:var(--spacing-8);display:flex}.latency-stat{gap:var(--spacing-2);padding:var(--spacing-8) var(--spacing-12);background:var(--color-white-alpha-05);border-radius:var(--border-radius-md);flex-direction:column;flex:1;display:flex}.latency-stat-label{text-transform:uppercase;letter-spacing:.05em;color:var(--color-white-alpha-40);font-size:.625rem}.latency-stat-value{font-variant-numeric:tabular-nums;color:var(--accent);font-size:.9375rem;font-weight:600}.stat-card{gap:var(--spacing-8);padding:var(--spacing-12);background:var(--color-white-alpha-05);border-radius:var(--border-radius-md);flex-direction:column;display:flex}.stat-head{align-items:center;gap:var(--spacing-8);display:flex}.stat-icon{border-radius:var(--border-radius-sm);justify-content:center;align-items:center;width:1.5rem;height:1.5rem;display:flex}.stat-icon svg{width:.875rem;height:.875rem}.stat-title{text-transform:uppercase;letter-spacing:.05em;font-size:.75rem;font-weight:600}.stat-status{letter-spacing:.06em;text-transform:uppercase;color:var(--color-gray-100);background:var(--color-white-alpha-10);padding:.05rem var(--spacing-8);border-radius:var(--border-radius-sm);margin-left:auto;font-size:.5625rem;font-weight:600}.stat-card--video .stat-icon{background:var(--color-purple-900);color:var(--color-purple-400)}.stat-card--video .stat-title{color:var(--color-purple-400)}.stat-card--audio .stat-icon{background:var(--color-green-900);color:var(--color-green-400)}.stat-card--audio .stat-title{color:var(--color-green-400)}.stat-card--network .stat-icon{background:var(--color-blue-900);color:var(--color-blue-400)}.stat-card--network .stat-title{color:var(--color-blue-400)}.stat-grid{gap:var(--spacing-2) var(--spacing-12);grid-template-columns:auto 1fr;display:grid}.stat-line{display:contents}.stat-key{color:var(--color-white-alpha-60);font-size:.75rem}.stat-value{text-align:right;font-variant-numeric:tabular-nums;text-overflow:ellipsis;white-space:nowrap;font-size:.75rem;font-weight:600;overflow:hidden}.graph{gap:var(--spacing-2);margin-top:var(--spacing-4);flex-direction:column;display:flex}.graph-header{justify-content:space-between;align-items:baseline;display:flex}.graph-label{text-transform:uppercase;letter-spacing:.05em;color:var(--color-white-alpha-40);font-size:.625rem}.graph-value{font-variant-numeric:tabular-nums;font-size:.6875rem;font-weight:600}.graph-canvas{width:100%;height:2.5rem;display:block}.buffer{width:100%}.buffer-visualization{background:var(--color-white-alpha-10);border-radius:var(--spacing-4);cursor:pointer;user-select:none;width:100%;height:3.75rem;padding-left:var(--spacing-48);box-sizing:border-box;position:relative}.buffer-playhead{left:var(--spacing-48);width:var(--spacing-2);background:var(--color-white);z-index:3;position:absolute;top:0;bottom:0}.buffer-track{left:var(--spacing-48);height:var(--spacing-24);align-items:center;display:flex;position:absolute;right:0}.buffer-track--video{top:var(--spacing-4)}.buffer-track--audio{top:var(--spacing-32)}.buffer-track-label{width:2.5rem;color:var(--color-white-alpha-70);text-align:right;padding-right:var(--spacing-4);pointer-events:none;box-sizing:border-box;font-size:.625rem;position:absolute;left:-2.875rem}.buffer-canvas{width:100%;height:100%;position:absolute;top:0;left:0}.buffer-target-area{top:0;bottom:0;left:var(--spacing-48);pointer-events:none;position:absolute;right:0}.buffer-target-line{background:var(--color-orange-400,var(--color-orange-450));z-index:2;cursor:ew-resize;border-radius:var(--spacing-1);pointer-events:auto;width:.1875rem;position:absolute;top:0;bottom:0}.buffer-target-label{color:var(--color-orange-400,var(--color-orange-450));white-space:nowrap;margin-bottom:var(--spacing-2);opacity:0;pointer-events:none;font-size:.6875rem;font-weight:500;transition:opacity .15s;position:absolute;bottom:100%;left:50%;transform:translate(-50%)}.buffer-visualization:hover .buffer-target-label,.buffer-visualization--dragging .buffer-target-label{opacity:1}.buffer-help{color:var(--color-white-alpha-30,#ffffff4d);pointer-events:none;white-space:nowrap;font-size:.75rem;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.buffering{z-index:1;background-color:var(--color-black-alpha-40);width:100%;height:100%;backdrop-filter:blur(var(--spacing-2));pointer-events:auto;justify-content:center;align-items:center;display:flex;position:absolute;top:0;left:0}.buffering-spinner{border:var(--spacing-4) solid var(--color-white-alpha-20);border-top:var(--spacing-4) solid var(--color-white);border-radius:50%;width:2.5rem;height:2.5rem;animation:1s linear infinite buffer-spin}@keyframes buffer-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.watch-ui__offline-indicator{z-index:4;pointer-events:auto;background-color:#000;border-radius:.25rem;justify-content:center;align-items:center;padding:.5rem 1rem;display:flex;position:absolute;bottom:1rem;right:1rem}.watch-ui__offline-text{color:#fff;letter-spacing:.08em;text-shadow:none;font-size:.875rem;font-weight:700}@media (width<=768px){.watch-ui__offline-indicator{padding:.375rem .75rem;bottom:.75rem;right:.75rem}.watch-ui__offline-text{font-size:.75rem}}@media (width<=480px){.watch-ui__offline-indicator{padding:.25rem .5rem;bottom:.5rem;right:.5rem}.watch-ui__offline-text{font-size:.75rem}}", ue = 2800, $ = class extends HTMLElement {
620
+ #e;
621
+ #t;
622
+ #n = new t(void 0);
623
+ #r;
624
+ constructor() {
625
+ super(), this.#t = this.attachShadow({ mode: "open" });
626
+ let e = document.createElement("style");
627
+ e.textContent = le, this.#t.appendChild(e), this.#r = new MutationObserver(() => this.#i());
628
+ }
629
+ connectedCallback() {
630
+ this.#i(), this.#r.observe(this, { childList: !0 });
631
+ let t = new e();
632
+ this.#e = t, t.run(this.#a.bind(this));
633
+ }
634
+ disconnectedCallback() {
635
+ this.#r.disconnect(), this.#e?.close(), this.#e = void 0;
636
+ }
637
+ #i() {
638
+ let e = this.querySelector("moq-watch");
639
+ this.#n.set(e ?? void 0);
640
+ }
641
+ #a(e) {
642
+ let i = e.get(this.#n);
643
+ if (!i) return;
644
+ let a = {
645
+ chrome: new t(!0),
646
+ panel: new t(!1),
647
+ tab: new t("quality")
648
+ }, o = n.create("div", { className: "player" });
649
+ o.appendChild(n.create("slot"));
650
+ let s = n.create("div", { className: "center" });
651
+ s.append(x(e, i), r(e, i), F(e, i));
652
+ let c = n.create("div", { className: "scrim scrim--top" }), l = n.create("div", { className: "chrome" });
653
+ l.append(n.create("div", { className: "scrim scrim--bottom" }), P(e, i, a, o));
654
+ let u = ce(e, i, a);
655
+ o.append(c, s, l, u), n.render(e, this.#t, o), this.#o(e, i, a, o);
656
+ }
657
+ #o(e, n, r, i) {
658
+ let a = new t(0), o = () => a.update((e) => e + 1);
659
+ e.event(this, "pointermove", o), e.event(this, "pointerdown", o), e.event(this, "focusin", o);
660
+ let s = () => n.backend.paused.peek() || r.panel.peek();
661
+ e.run((e) => {
662
+ let t = e.get(n.backend.paused) || e.get(r.panel);
663
+ e.get(a), r.chrome.set(!0), !t && e.timer(() => r.chrome.set(!1), ue);
664
+ }), e.event(this, "pointerleave", () => {
665
+ s() || r.chrome.set(!1);
666
+ }), e.run((e) => {
667
+ i.classList.toggle("player--chrome", e.get(r.chrome));
668
+ });
669
+ }
381
670
  };
382
- //# sourceMappingURL=element.js.map
671
+ customElements.define("moq-watch-ui", $);
672
+ //#endregion
673
+ export { $ as default };
674
+
675
+ //# sourceMappingURL=element.js.map