@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/index.js CHANGED
@@ -1,289 +1,5 @@
1
- import * as E from "@moq/hang";
2
- import * as F from "@moq/net";
3
- import { Signal as i, Effect as c } from "@moq/signals";
4
- import * as L from "@moq/signals";
5
- import { o as m, a as h, b as d, s as w, D as y, M as _, R as S, S as M, c as O, E as P, d as T, e as f, P as g, f as j, g as k } from "./broadcast-CLjMphZS.js";
6
- import { B as K, C as Q, m as X, h as Z, i as ss, p as ts, t as es } from "./broadcast-CLjMphZS.js";
7
- const x = m({
8
- name: h(w()),
9
- // name
10
- avatar: h(w()),
11
- // avatar
12
- audio: h(d()),
13
- // audio enabled
14
- video: h(d()),
15
- // video enabled
16
- typing: h(d()),
17
- // actively typing
18
- chat: h(d()),
19
- // chatted recently
20
- screen: h(d())
21
- // screen sharing
22
- }), N = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
23
- __proto__: null,
24
- Decoder: y,
25
- Mse: _,
26
- Renderer: S,
27
- Source: M
28
- }, Symbol.toStringTag, { value: "Module" })), q = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
29
- __proto__: null,
30
- Decoder: O,
31
- Emitter: P,
32
- Mse: T,
33
- Source: f
34
- }, Symbol.toStringTag, { value: "Module" }));
35
- class A {
36
- broadcast;
37
- enabled;
38
- // Empty string is a valid message.
39
- #t = new i(void 0);
40
- latest = this.#t;
41
- #s = new i(void 0);
42
- catalog = this.#s;
43
- #e = new c();
44
- constructor(s, e, a) {
45
- this.broadcast = s, this.enabled = i.from(a?.enabled ?? !1), this.#e.run((t) => {
46
- t.get(this.enabled) && this.#s.set(t.get(e)?.chat?.message);
47
- }), this.#e.run(this.#a.bind(this));
48
- }
49
- #a(s) {
50
- const e = s.getAll([this.enabled, this.#s, this.broadcast]);
51
- if (!e) return;
52
- const [a, t, o] = e, n = o.subscribe(t.name, g.chat);
53
- s.cleanup(() => n.close()), s.set(this.#t, ""), s.cleanup(() => this.#t.set(void 0)), s.spawn(async () => {
54
- for (; ; ) {
55
- const r = await n.readString();
56
- if (r === void 0) break;
57
- this.#t.set(r);
58
- }
59
- });
60
- }
61
- close() {
62
- this.#e.close();
63
- }
64
- }
65
- class R {
66
- broadcast;
67
- enabled;
68
- active;
69
- #t = new i(void 0);
70
- catalog = this.#t;
71
- #s = new c();
72
- constructor(s, e, a) {
73
- this.broadcast = s, this.active = new i(void 0), this.enabled = i.from(a?.enabled ?? !1), this.#s.run((t) => {
74
- t.get(this.enabled) && this.#t.set(t.get(e)?.chat?.typing);
75
- }), this.#s.run(this.#e.bind(this));
76
- }
77
- #e(s) {
78
- const e = s.getAll([this.enabled, this.#t, this.broadcast]);
79
- if (!e) return;
80
- const [a, t, o] = e, n = o.subscribe(t.name, g.typing);
81
- s.cleanup(() => n.close()), s.spawn(async () => {
82
- for (; ; ) {
83
- const r = await n.readBool();
84
- if (r === void 0) break;
85
- this.active.set(r);
86
- }
87
- }), s.cleanup(() => this.active.set(void 0));
88
- }
89
- close() {
90
- this.#s.close();
91
- }
92
- }
93
- class $ {
94
- message;
95
- typing;
96
- #t = new i(void 0);
97
- #s = new c();
98
- constructor(s, e, a) {
99
- this.message = new A(s, e, a?.message), this.typing = new R(s, e, a?.typing), this.#s.run((t) => {
100
- const o = t.get(this.message.catalog), n = t.get(this.typing.catalog);
101
- !o && !n || t.set(this.#t, {
102
- message: o,
103
- typing: n
104
- });
105
- });
106
- }
107
- close() {
108
- this.#s.close(), this.message.close(), this.typing.close();
109
- }
110
- }
111
- const G = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
112
- __proto__: null,
113
- Chat: $
114
- }, Symbol.toStringTag, { value: "Module" }));
115
- async function b(l, s) {
116
- const e = await l.readJson();
117
- if (e !== void 0)
118
- return s.parse(e);
119
- }
120
- class z {
121
- enabled;
122
- broadcast;
123
- #t = new i(void 0);
124
- #s = new i(void 0);
125
- signals = new c();
126
- constructor(s, e, a) {
127
- this.broadcast = s, this.enabled = i.from(a?.enabled ?? !1), this.signals.run((t) => {
128
- this.#t.set(t.get(e)?.location?.peers);
129
- }), this.signals.run(this.#e.bind(this));
130
- }
131
- #e(s) {
132
- const e = s.getAll([this.enabled, this.#t, this.broadcast]);
133
- if (!e) return;
134
- const [a, t, o] = e, n = o.subscribe(t.name, g.location);
135
- s.cleanup(() => n.close()), s.spawn(this.#a.bind(this, n));
136
- }
137
- async #a(s) {
138
- try {
139
- for (; ; ) {
140
- const e = await b(s, j);
141
- if (!e) break;
142
- this.#s.set(e);
143
- }
144
- } finally {
145
- this.#s.set(void 0), s.close();
146
- }
147
- }
148
- get positions() {
149
- return this.#s;
150
- }
151
- close() {
152
- this.signals.close();
153
- }
154
- }
155
- class C {
156
- broadcast;
157
- enabled;
158
- #t = new i(void 0);
159
- handle = this.#t;
160
- #s = new i(void 0);
161
- #e = new i(void 0);
162
- position = this.#e;
163
- signals = new c();
164
- constructor(s, e, a) {
165
- this.broadcast = s, this.enabled = i.from(a?.enabled ?? !1), this.signals.run((t) => {
166
- this.#s.set(t.get(e)?.location);
167
- }), this.signals.run((t) => {
168
- t.get(this.enabled) && this.#e.set(t.get(this.#s)?.initial);
169
- }), this.signals.run((t) => {
170
- this.#t.set(t.get(this.#s)?.handle);
171
- }), this.signals.run((t) => {
172
- const o = t.get(this.broadcast);
173
- if (!o) return;
174
- const n = t.get(this.#s)?.track;
175
- if (!n) return;
176
- const r = o.subscribe(n.name, g.location);
177
- t.cleanup(() => r.close()), t.spawn(this.#a.bind(this, r));
178
- });
179
- }
180
- async #a(s) {
181
- try {
182
- for (; ; ) {
183
- const e = await b(s, k);
184
- if (!e) break;
185
- this.#e.set(e);
186
- }
187
- } finally {
188
- this.#e.set(void 0), s.close();
189
- }
190
- }
191
- close() {
192
- this.signals.close();
193
- }
194
- }
195
- class B {
196
- window;
197
- peers;
198
- signals = new c();
199
- constructor(s, e, a) {
200
- this.window = new C(s, e, a?.window), this.peers = new z(s, e, a?.peers);
201
- }
202
- close() {
203
- this.signals.close(), this.window.close(), this.peers.close();
204
- }
205
- }
206
- const H = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
207
- __proto__: null,
208
- Root: B
209
- }, Symbol.toStringTag, { value: "Module" }));
210
- class U {
211
- broadcast;
212
- enabled;
213
- preview = new i(void 0);
214
- #t = new i(void 0);
215
- #s = new c();
216
- constructor(s, e, a) {
217
- this.broadcast = s, this.enabled = i.from(a?.enabled ?? !1), this.#s.run((t) => {
218
- this.#t.set(t.get(e)?.preview);
219
- }), this.#s.run((t) => {
220
- const o = t.getAll([this.enabled, this.broadcast, this.#t]);
221
- if (!o) return;
222
- const [n, r, v] = o, p = r.subscribe(v.name, g.preview);
223
- t.cleanup(() => p.close()), t.spawn(async () => {
224
- try {
225
- const u = await b(p, x);
226
- if (!u) return;
227
- this.preview.set(u);
228
- } catch (u) {
229
- console.warn("Failed to parse preview JSON:", u);
230
- }
231
- }), t.cleanup(() => this.preview.set(void 0));
232
- });
233
- }
234
- close() {
235
- this.#s.close();
236
- }
237
- }
238
- class D {
239
- enabled;
240
- #t = new i(void 0);
241
- #s = new i(void 0);
242
- #e = new i(void 0);
243
- #a = new i(void 0);
244
- signals = new c();
245
- constructor(s, e) {
246
- this.enabled = i.from(e?.enabled ?? !1), this.signals.run((a) => {
247
- a.get(this.enabled) && (this.#t.set(a.get(s)?.user?.id), this.#s.set(a.get(s)?.user?.name), this.#e.set(a.get(s)?.user?.avatar), this.#a.set(a.get(s)?.user?.color));
248
- });
249
- }
250
- get id() {
251
- return this.#t;
252
- }
253
- get name() {
254
- return this.#s;
255
- }
256
- get avatar() {
257
- return this.#e;
258
- }
259
- get color() {
260
- return this.#a;
261
- }
262
- close() {
263
- this.signals.close();
264
- }
265
- }
266
- const V = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
267
- __proto__: null,
268
- Info: D
269
- }, Symbol.toStringTag, { value: "Module" }));
270
- export {
271
- q as Audio,
272
- K as Broadcast,
273
- Q as CATALOG_FORMATS,
274
- G as Chat,
275
- E as Hang,
276
- F as Lite,
277
- H as Location,
278
- X as Mse,
279
- Z as MultiBackend,
280
- F as Net,
281
- U as Preview,
282
- L as Signals,
283
- ss as Sync,
284
- V as User,
285
- N as Video,
286
- ts as parseCatalogFormat,
287
- es as timeRangesToArray
288
- };
289
- //# sourceMappingURL=index.js.map
1
+ import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "./broadcast-CG8jZRfA.js";
2
+ import * as l from "@moq/hang";
3
+ import * as u from "@moq/net";
4
+ import * as d from "@moq/signals";
5
+ export { n as Audio, c as Broadcast, i as CATALOG_FORMATS, l as Hang, u as Lite, u as Net, r as Mse, e as MultiBackend, d as Signals, t as Sync, s as Video, o as parseCatalogFormat, a as timeRangesToArray };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@moq/watch",
3
3
  "type": "module",
4
- "version": "0.2.14",
4
+ "version": "0.2.16",
5
5
  "description": "Watch Media over QUIC broadcasts",
6
6
  "license": "(MIT OR Apache-2.0)",
7
7
  "repository": "github:moq-dev/moq",
@@ -33,9 +33,10 @@
33
33
  "./support/element.js"
34
34
  ],
35
35
  "dependencies": {
36
- "@moq/hang": "^0.2.7",
37
- "@moq/net": "^0.1.2",
36
+ "@moq/hang": "^0.2.9",
37
+ "@moq/json": "^0.0.2",
38
+ "@moq/net": "^0.1.4",
38
39
  "@moq/msf": "^0.1.1",
39
- "@moq/signals": "^0.1.7"
40
+ "@moq/signals": "^0.1.8"
40
41
  }
41
42
  }
@@ -1,173 +1,123 @@
1
- import { Signal as c, Effect as v } from "@moq/signals";
2
- import { c as a } from "../dom-BsFrLb_F.js";
3
- import { isSupported as m } from "./index.js";
4
- const h = navigator.userAgent.toLowerCase().includes("firefox"), C = ["show", "details"];
5
- class b extends HTMLElement {
6
- #i = new c("warning");
7
- #e = new c(!1);
8
- #n = new c(void 0);
9
- #o = new c(!1);
10
- #t;
11
- static observedAttributes = C;
12
- constructor() {
13
- super(), m().then((e) => this.#n.set(e)).catch((e) => console.error("Failed to detect watch support:", e));
14
- }
15
- connectedCallback() {
16
- this.#t = new v(), this.#t.run(this.#d.bind(this));
17
- }
18
- disconnectedCallback() {
19
- this.#t?.close(), this.#t = void 0;
20
- }
21
- attributeChangedCallback(e, t, s) {
22
- if (e === "show") {
23
- const i = s ?? "warning";
24
- if (i === "always" || i === "warning" || i === "error" || i === "never")
25
- this.show = i;
26
- else
27
- throw new Error(`Invalid show: ${i}`);
28
- } else if (e === "details")
29
- this.details = s !== null;
30
- else {
31
- const i = e;
32
- throw new Error(`Invalid attribute: ${i}`);
33
- }
34
- }
35
- get show() {
36
- return this.#i.peek();
37
- }
38
- set show(e) {
39
- this.#i.set(e);
40
- }
41
- get details() {
42
- return this.#e.peek();
43
- }
44
- set details(e) {
45
- this.#e.set(e);
46
- }
47
- #r(e) {
48
- return e.webtransport === "none" || !e.audio.decoding || !e.video.decoding || !e.audio.render || !e.video.render || !Object.values(e.audio.decoding).some((t) => t === !0 || t === "full" || t === "partial") || !Object.values(e.video.decoding).some((t) => t.software || t.hardware) ? "none" : !Object.values(e.audio.decoding).every((t) => t === !0 || t === "full") || !Object.values(e.video.decoding).every((t) => t.software || t.hardware) ? "partial" : "full";
49
- }
50
- #d(e) {
51
- const t = e.get(this.#n);
52
- if (!t || e.get(this.#o)) return;
53
- const i = e.get(this.#i);
54
- if (i === "never") return;
55
- const r = this.#r(t);
56
- if (i === "warning" && r === "full" || i === "error" && r !== "none") return;
57
- const n = a("div", {
58
- style: {
59
- margin: "0 auto",
60
- maxWidth: "28rem",
61
- padding: "1rem"
62
- }
63
- });
64
- this.appendChild(n), e.cleanup(() => this.removeChild(n)), this.#a(n, r, e), e.get(this.#e) && this.#s(n, t, e);
65
- }
66
- #a(e, t, s) {
67
- const i = a("div", {
68
- style: {
69
- display: "flex",
70
- flexDirection: "row",
71
- gap: "1rem",
72
- flexWrap: "wrap",
73
- justifyContent: "space-between",
74
- alignItems: "center"
75
- }
76
- }), r = a("div", {
77
- style: { fontWeight: "bold" }
78
- });
79
- t === "full" ? r.textContent = "🟢 Full Browser Support" : t === "partial" ? r.textContent = "🟡 Partial Browser Support" : t === "none" && (r.textContent = "🔴 No Browser Support");
80
- const n = a("button", {
81
- type: "button",
82
- style: { fontSize: "14px" }
83
- });
84
- s.event(n, "click", () => {
85
- this.#e.update((o) => !o);
86
- }), s.run((o) => {
87
- n.textContent = o.get(this.#e) ? "Details ➖" : "Details ➕";
88
- });
89
- const l = a(
90
- "button",
91
- {
92
- type: "button",
93
- style: { fontSize: "14px" }
94
- },
95
- "Close "
96
- );
97
- s.event(l, "click", () => {
98
- this.#o.set(!0);
99
- }), i.appendChild(r), i.appendChild(n), i.appendChild(l), e.appendChild(i), s.cleanup(() => e.removeChild(i));
100
- }
101
- #s(e, t, s) {
102
- const i = a("div", {
103
- style: {
104
- display: "grid",
105
- gridTemplateColumns: "1fr 1fr 1fr",
106
- columnGap: "0.5rem",
107
- rowGap: "0.2rem",
108
- backgroundColor: "rgba(0, 0, 0, 0.6)",
109
- borderRadius: "0.5rem",
110
- padding: "1rem",
111
- fontSize: "0.875rem"
112
- }
113
- }), r = (d) => d ? "🟢 Yes" : "🔴 No", n = (d) => d?.hardware ? "🟢 Hardware" : d?.software ? `🟡 Software${h ? "*" : ""}` : "🔴 No", l = (d) => d === "full" ? "🟢 Full" : d === "partial" ? "🟡 Polyfill" : "🔴 None", o = (d, u, g) => {
114
- const w = a(
115
- "div",
116
- {
117
- style: {
118
- gridColumnStart: "1",
119
- fontWeight: "bold",
120
- textAlign: "right"
121
- }
122
- },
123
- d
124
- ), p = a(
125
- "div",
126
- {
127
- style: {
128
- gridColumnStart: "2",
129
- textAlign: "center"
130
- }
131
- },
132
- u
133
- ), f = a(
134
- "div",
135
- {
136
- style: { gridColumnStart: "3" }
137
- },
138
- g
139
- );
140
- i.appendChild(w), i.appendChild(p), i.appendChild(f);
141
- };
142
- if (o("WebTransport", "", l(t.webtransport)), o("Rendering", "Audio", r(t.audio.render)), o("", "Video", r(t.video.render)), o("Decoding", "Opus", l(t.audio.decoding.opus)), o("", "AAC", r(t.audio.decoding.aac)), o("", "AV1", n(t.video.decoding?.av1)), o("", "H.265", n(t.video.decoding?.h265)), o("", "H.264", n(t.video.decoding?.h264)), o("", "VP9", n(t.video.decoding?.vp9)), o("", "VP8", n(t.video.decoding?.vp8)), h) {
143
- const d = a(
144
- "div",
145
- {
146
- style: {
147
- gridColumnStart: "1",
148
- gridColumnEnd: "4",
149
- textAlign: "center",
150
- fontSize: "0.875rem",
151
- fontStyle: "italic"
152
- }
153
- },
154
- "Hardware acceleration is ",
155
- a(
156
- "a",
157
- {
158
- href: "https://github.com/w3c/webcodecs/issues/896"
159
- },
160
- "undetectable"
161
- ),
162
- " on Firefox."
163
- );
164
- i.appendChild(d);
165
- }
166
- e.appendChild(i), s.cleanup(() => e.removeChild(i));
167
- }
168
- }
169
- customElements.define("moq-watch-support", b);
170
- export {
171
- b as default
1
+ import { isSupported as e } from "./index.js";
2
+ import { Effect as t, Signal as n } from "@moq/signals";
3
+ import * as r from "@moq/signals/dom";
4
+ //#region src/support/element.ts
5
+ var i = navigator.userAgent.toLowerCase().includes("firefox"), a = ["show", "details"], o = class extends HTMLElement {
6
+ #e = new n("warning");
7
+ #t = new n(!1);
8
+ #n = new n(void 0);
9
+ #r = new n(!1);
10
+ #i;
11
+ static observedAttributes = a;
12
+ constructor() {
13
+ super(), e().then((e) => this.#n.set(e)).catch((e) => console.error("Failed to detect watch support:", e));
14
+ }
15
+ connectedCallback() {
16
+ this.#i = new t(), this.#i.run(this.#o.bind(this));
17
+ }
18
+ disconnectedCallback() {
19
+ this.#i?.close(), this.#i = void 0;
20
+ }
21
+ attributeChangedCallback(e, t, n) {
22
+ if (e === "show") {
23
+ let e = n ?? "warning";
24
+ if (e === "always" || e === "warning" || e === "error" || e === "never") this.show = e;
25
+ else throw Error(`Invalid show: ${e}`);
26
+ } else if (e === "details") this.details = n !== null;
27
+ else throw Error(`Invalid attribute: ${e}`);
28
+ }
29
+ get show() {
30
+ return this.#e.peek();
31
+ }
32
+ set show(e) {
33
+ this.#e.set(e);
34
+ }
35
+ get details() {
36
+ return this.#t.peek();
37
+ }
38
+ set details(e) {
39
+ this.#t.set(e);
40
+ }
41
+ #a(e) {
42
+ return e.webtransport === "none" || !e.audio.decoding || !e.video.decoding || !e.audio.render || !e.video.render || !Object.values(e.audio.decoding).some((e) => e === !0 || e === "full" || e === "partial") || !Object.values(e.video.decoding).some((e) => e.software || e.hardware) ? "none" : !Object.values(e.audio.decoding).every((e) => e === !0 || e === "full") || !Object.values(e.video.decoding).every((e) => e.software || e.hardware) ? "partial" : "full";
43
+ }
44
+ #o(e) {
45
+ let t = e.get(this.#n);
46
+ if (!t || e.get(this.#r)) return;
47
+ let n = e.get(this.#e);
48
+ if (n === "never") return;
49
+ let i = this.#a(t);
50
+ if (n === "warning" && i === "full" || n === "error" && i !== "none") return;
51
+ let a = r.create("div", { style: {
52
+ margin: "0 auto",
53
+ maxWidth: "28rem",
54
+ padding: "1rem"
55
+ } });
56
+ this.appendChild(a), e.cleanup(() => this.removeChild(a)), this.#s(a, i, e), e.get(this.#t) && this.#c(a, t, e);
57
+ }
58
+ #s(e, t, n) {
59
+ let i = r.create("div", { style: {
60
+ display: "flex",
61
+ flexDirection: "row",
62
+ gap: "1rem",
63
+ flexWrap: "wrap",
64
+ justifyContent: "space-between",
65
+ alignItems: "center"
66
+ } }), a = r.create("div", { style: { fontWeight: "bold" } });
67
+ t === "full" ? a.textContent = "🟢 Full Browser Support" : t === "partial" ? a.textContent = "🟡 Partial Browser Support" : t === "none" && (a.textContent = "🔴 No Browser Support");
68
+ let o = r.create("button", {
69
+ type: "button",
70
+ style: { fontSize: "14px" }
71
+ });
72
+ n.event(o, "click", () => {
73
+ this.#t.update((e) => !e);
74
+ }), n.run((e) => {
75
+ o.textContent = e.get(this.#t) ? "Details ➖" : "Details ➕";
76
+ });
77
+ let s = r.create("button", {
78
+ type: "button",
79
+ style: { fontSize: "14px" }
80
+ }, "Close ");
81
+ n.event(s, "click", () => {
82
+ this.#r.set(!0);
83
+ }), i.appendChild(a), i.appendChild(o), i.appendChild(s), e.appendChild(i), n.cleanup(() => e.removeChild(i));
84
+ }
85
+ #c(e, t, n) {
86
+ let a = r.create("div", { style: {
87
+ display: "grid",
88
+ gridTemplateColumns: "1fr 1fr 1fr",
89
+ columnGap: "0.5rem",
90
+ rowGap: "0.2rem",
91
+ backgroundColor: "rgba(0, 0, 0, 0.6)",
92
+ borderRadius: "0.5rem",
93
+ padding: "1rem",
94
+ fontSize: "0.875rem"
95
+ } }), o = (e) => e ? "🟢 Yes" : "🔴 No", s = (e) => e?.hardware ? "🟢 Hardware" : e?.software ? `🟡 Software${i ? "*" : ""}` : "🔴 No", c = (e) => e === "full" ? "🟢 Full" : e === "partial" ? "🟡 Polyfill" : "🔴 None", l = (e, t, n) => {
96
+ let i = r.create("div", { style: {
97
+ gridColumnStart: "1",
98
+ fontWeight: "bold",
99
+ textAlign: "right"
100
+ } }, e), o = r.create("div", { style: {
101
+ gridColumnStart: "2",
102
+ textAlign: "center"
103
+ } }, t), s = r.create("div", { style: { gridColumnStart: "3" } }, n);
104
+ a.appendChild(i), a.appendChild(o), a.appendChild(s);
105
+ };
106
+ if (l("WebTransport", "", c(t.webtransport)), l("Rendering", "Audio", o(t.audio.render)), l("", "Video", o(t.video.render)), l("Decoding", "Opus", c(t.audio.decoding.opus)), l("", "AAC", o(t.audio.decoding.aac)), l("", "AV1", s(t.video.decoding?.av1)), l("", "H.265", s(t.video.decoding?.h265)), l("", "H.264", s(t.video.decoding?.h264)), l("", "VP9", s(t.video.decoding?.vp9)), l("", "VP8", s(t.video.decoding?.vp8)), i) {
107
+ let e = r.create("div", { style: {
108
+ gridColumnStart: "1",
109
+ gridColumnEnd: "4",
110
+ textAlign: "center",
111
+ fontSize: "0.875rem",
112
+ fontStyle: "italic"
113
+ } }, "Hardware acceleration is ", r.create("a", { href: "https://github.com/w3c/webcodecs/issues/896" }, "undetectable"), " on Firefox.");
114
+ a.appendChild(e);
115
+ }
116
+ e.appendChild(a), n.cleanup(() => e.removeChild(a));
117
+ }
172
118
  };
173
- //# sourceMappingURL=element.js.map
119
+ customElements.define("moq-watch-support", o);
120
+ //#endregion
121
+ export { o as default };
122
+
123
+ //# sourceMappingURL=element.js.map