@lumencast/runtime 0.11.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/{broadcast-DtHoU_fS.js → broadcast-Dg77Br5j.js} +3 -3
- package/dist/{broadcast-DtHoU_fS.js.map → broadcast-Dg77Br5j.js.map} +1 -1
- package/dist/{control-B9frEbNG.js → control-iPqpFp80.js} +4 -4
- package/dist/{control-B9frEbNG.js.map → control-iPqpFp80.js.map} +1 -1
- package/dist/{index-Dz27r92m.js → index-C4r-fG1q.js} +361 -326
- package/dist/index-C4r-fG1q.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.html +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lumencast.js +1 -1
- package/dist/mount.d.ts.map +1 -1
- package/dist/mount.js +52 -0
- package/dist/mount.js.map +1 -1
- package/dist/render/primitives/capture-stream-cache.d.ts +26 -0
- package/dist/render/primitives/capture-stream-cache.d.ts.map +1 -0
- package/dist/render/primitives/capture-stream-cache.js +141 -0
- package/dist/render/primitives/capture-stream-cache.js.map +1 -0
- package/dist/render/primitives/capture.d.ts +1 -1
- package/dist/render/primitives/capture.d.ts.map +1 -1
- package/dist/render/primitives/capture.js +20 -87
- package/dist/render/primitives/capture.js.map +1 -1
- package/dist/{status-pill-B2vBTwRC.js → status-pill-nls_2xkN.js} +2 -2
- package/dist/{status-pill-B2vBTwRC.js.map → status-pill-nls_2xkN.js.map} +1 -1
- package/dist/{test-DD2SBDku.js → test-d8HW2LcF.js} +4 -4
- package/dist/{test-DD2SBDku.js.map → test-d8HW2LcF.js.map} +1 -1
- package/dist/transport/ws.d.ts +4 -1
- package/dist/transport/ws.d.ts.map +1 -1
- package/dist/transport/ws.js +7 -0
- package/dist/transport/ws.js.map +1 -1
- package/dist/{tree-CgU_sUwI.js → tree-BME9ba3m.js} +589 -567
- package/dist/tree-BME9ba3m.js.map +1 -0
- package/dist/types.d.ts +18 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/webrtc/index.d.ts +1 -1
- package/dist/webrtc/index.d.ts.map +1 -1
- package/dist/webrtc/index.js.map +1 -1
- package/dist/webrtc/peer-stream-registry.d.ts +17 -0
- package/dist/webrtc/peer-stream-registry.d.ts.map +1 -1
- package/dist/webrtc/peer-stream-registry.js +22 -0
- package/dist/webrtc/peer-stream-registry.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +1 -0
- package/src/mount.ts +54 -0
- package/src/render/primitives/capture-stream-cache.ts +164 -0
- package/src/render/primitives/capture.tsx +19 -93
- package/src/transport/ws.ts +11 -0
- package/src/types.ts +18 -2
- package/src/webrtc/index.ts +1 -0
- package/src/webrtc/peer-stream-registry.ts +38 -0
- package/dist/index-Dz27r92m.js.map +0 -1
- package/dist/tree-CgU_sUwI.js.map +0 -1
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { batch as
|
|
2
|
-
import { createRoot as
|
|
3
|
-
import { createContext as
|
|
4
|
-
import { jsx as
|
|
5
|
-
import { useSignals as
|
|
6
|
-
import { AnimatePresence as
|
|
7
|
-
import { SequenceTracker as
|
|
8
|
-
const
|
|
9
|
-
function
|
|
1
|
+
import { batch as I, signal as S } from "@preact/signals-react";
|
|
2
|
+
import { createRoot as X } from "react-dom/client";
|
|
3
|
+
import { createContext as ce, useContext as K, lazy as O, Suspense as le, createElement as ue, StrictMode as de } from "react";
|
|
4
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
5
|
+
import { useSignals as fe } from "@preact/signals-react/runtime";
|
|
6
|
+
import { AnimatePresence as he, motion as me } from "framer-motion";
|
|
7
|
+
import { SequenceTracker as pe, encodeFrame as x, input as ge, WS_SUBPROTOCOLS as ve, WS_SUBPROTOCOL_V1_1 as we, subscribe as ye, decodeServerFrame as be, LumencastError as j } from "@lumencast/protocol";
|
|
8
|
+
const P = ce(null);
|
|
9
|
+
function J({
|
|
10
10
|
value: t,
|
|
11
11
|
children: e
|
|
12
12
|
}) {
|
|
13
|
-
return /* @__PURE__ */
|
|
13
|
+
return /* @__PURE__ */ p(P.Provider, { value: t, children: e });
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
const t =
|
|
15
|
+
function gt() {
|
|
16
|
+
const t = K(P);
|
|
17
17
|
if (!t)
|
|
18
18
|
throw new Error(
|
|
19
19
|
"Lumencast overlay components must be rendered inside LumencastRuntimeProvider"
|
|
20
20
|
);
|
|
21
21
|
return t;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
return
|
|
23
|
+
function vt() {
|
|
24
|
+
return K(P);
|
|
25
25
|
}
|
|
26
|
-
const
|
|
27
|
-
() => import("./broadcast-
|
|
28
|
-
),
|
|
29
|
-
() => import("./control-
|
|
30
|
-
),
|
|
31
|
-
function
|
|
26
|
+
const Se = O(
|
|
27
|
+
() => import("./broadcast-Dg77Br5j.js").then((t) => ({ default: t.BroadcastMode }))
|
|
28
|
+
), ke = O(
|
|
29
|
+
() => import("./control-iPqpFp80.js").then((t) => ({ default: t.ControlMode }))
|
|
30
|
+
), Te = O(() => import("./test-d8HW2LcF.js").then((t) => ({ default: t.TestMode })));
|
|
31
|
+
function _e({
|
|
32
32
|
mode: t,
|
|
33
33
|
store: e,
|
|
34
34
|
bundleSignal: s,
|
|
@@ -37,50 +37,50 @@ function ke({
|
|
|
37
37
|
sendInput: i,
|
|
38
38
|
resolveCaptureDevice: a,
|
|
39
39
|
resolvePeerStream: o,
|
|
40
|
-
subscribePeerStream:
|
|
40
|
+
subscribePeerStream: c
|
|
41
41
|
}) {
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
if (!
|
|
45
|
-
const
|
|
46
|
-
return /* @__PURE__ */
|
|
47
|
-
|
|
42
|
+
fe();
|
|
43
|
+
const l = s.value, d = n.value, h = r.value;
|
|
44
|
+
if (!l) return null;
|
|
45
|
+
const _ = t === "broadcast" ? Se : t === "control" ? ke : Te;
|
|
46
|
+
return /* @__PURE__ */ p(he, { mode: "sync", children: /* @__PURE__ */ p(
|
|
47
|
+
me.div,
|
|
48
48
|
{
|
|
49
49
|
initial: { opacity: 0 },
|
|
50
50
|
animate: { opacity: 1 },
|
|
51
51
|
exit: { opacity: 0 },
|
|
52
52
|
transition: { duration: 0.4, ease: "easeInOut" },
|
|
53
53
|
style: { position: "absolute", inset: 0 },
|
|
54
|
-
children: /* @__PURE__ */
|
|
55
|
-
|
|
54
|
+
children: /* @__PURE__ */ p(
|
|
55
|
+
J,
|
|
56
56
|
{
|
|
57
57
|
value: {
|
|
58
58
|
mode: t,
|
|
59
59
|
store: e,
|
|
60
|
-
bundle:
|
|
60
|
+
bundle: l,
|
|
61
61
|
status: d,
|
|
62
62
|
sendInput: i,
|
|
63
63
|
...a !== void 0 ? { resolveCaptureDevice: a } : {},
|
|
64
64
|
...o !== void 0 ? { resolvePeerStream: o } : {},
|
|
65
|
-
...
|
|
65
|
+
...c !== void 0 ? { subscribePeerStream: c } : {}
|
|
66
66
|
},
|
|
67
|
-
children: /* @__PURE__ */
|
|
67
|
+
children: /* @__PURE__ */ p(le, { fallback: null, children: /* @__PURE__ */ p(_, {}) })
|
|
68
68
|
}
|
|
69
69
|
)
|
|
70
70
|
},
|
|
71
|
-
|
|
71
|
+
h
|
|
72
72
|
) });
|
|
73
73
|
}
|
|
74
|
-
const
|
|
75
|
-
function
|
|
76
|
-
return
|
|
77
|
-
|
|
74
|
+
const Ee = "<anon>", T = /* @__PURE__ */ new Set();
|
|
75
|
+
function Y(t) {
|
|
76
|
+
return T.add(t), () => {
|
|
77
|
+
T.delete(t);
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
|
-
function
|
|
81
|
-
const n = { nodeId: t ??
|
|
82
|
-
if (
|
|
83
|
-
for (const r of
|
|
80
|
+
function Z(t, e, s) {
|
|
81
|
+
const n = { nodeId: t ?? Ee, field: e, reason: s };
|
|
82
|
+
if (T.size > 0) {
|
|
83
|
+
for (const r of T)
|
|
84
84
|
try {
|
|
85
85
|
r(n);
|
|
86
86
|
} catch {
|
|
@@ -88,41 +88,41 @@ function K(t, e, s) {
|
|
|
88
88
|
return;
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
const
|
|
92
|
-
blur:
|
|
93
|
-
brightness:
|
|
91
|
+
const Re = 100, Ie = 4, Ae = 64, Oe = {
|
|
92
|
+
blur: Re,
|
|
93
|
+
brightness: Ie
|
|
94
94
|
};
|
|
95
|
-
function
|
|
95
|
+
function D(t, e) {
|
|
96
96
|
if (typeof e != "number" || !Number.isFinite(e) || e < 0 || Object.is(e, -0)) return null;
|
|
97
|
-
const s =
|
|
97
|
+
const s = Oe[t];
|
|
98
98
|
return e > s ? s : e;
|
|
99
99
|
}
|
|
100
|
-
const
|
|
101
|
-
function
|
|
102
|
-
if (typeof t != "string" || t.length === 0 || t.length >
|
|
103
|
-
const e =
|
|
100
|
+
const Pe = /^blur\((\d{1,7}(?:\.\d{1,4})?)px\) brightness\((\d{1,7}(?:\.\d{1,4})?)\)$/, wt = "blur(0px) brightness(1)";
|
|
101
|
+
function Le(t) {
|
|
102
|
+
if (typeof t != "string" || t.length === 0 || t.length > Ae) return null;
|
|
103
|
+
const e = Pe.exec(t);
|
|
104
104
|
if (!e) return null;
|
|
105
|
-
const s =
|
|
105
|
+
const s = D("blur", Number(e[1])), n = D("brightness", Number(e[2]));
|
|
106
106
|
return s === null || n === null ? null : `blur(${s}px) brightness(${n})`;
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
|
|
108
|
+
function Me(t, e) {
|
|
109
|
+
Z(
|
|
110
110
|
e,
|
|
111
111
|
t,
|
|
112
112
|
"rejected unsafe filter value : outside the R8 caps or not a finite number >= 0"
|
|
113
113
|
);
|
|
114
114
|
}
|
|
115
|
-
const
|
|
115
|
+
const Ce = { duration: 0 }, Ne = {
|
|
116
116
|
linear: "linear",
|
|
117
117
|
"cubic-in": "easeIn",
|
|
118
118
|
"cubic-out": "easeOut",
|
|
119
119
|
"cubic-in-out": "easeInOut"
|
|
120
120
|
};
|
|
121
|
-
function
|
|
122
|
-
return !t || t.kind === "none" ?
|
|
121
|
+
function yt(t) {
|
|
122
|
+
return !t || t.kind === "none" ? Ce : t.kind === "tween" ? {
|
|
123
123
|
type: "tween",
|
|
124
124
|
duration: (t.duration_ms ?? 0) / 1e3,
|
|
125
|
-
ease: t.ease ?
|
|
125
|
+
ease: t.ease ? Ne[t.ease] ?? "easeOut" : "easeOut"
|
|
126
126
|
} : t.kind === "spring" ? {
|
|
127
127
|
type: "spring",
|
|
128
128
|
...t.stiffness !== void 0 ? { stiffness: t.stiffness } : {},
|
|
@@ -134,7 +134,7 @@ function vt(t) {
|
|
|
134
134
|
ease: "easeInOut"
|
|
135
135
|
};
|
|
136
136
|
}
|
|
137
|
-
const
|
|
137
|
+
const xe = {
|
|
138
138
|
opacity: 1,
|
|
139
139
|
scale: 1,
|
|
140
140
|
scaleX: 1,
|
|
@@ -146,12 +146,12 @@ const Me = {
|
|
|
146
146
|
// framer interpolates between structurally-identical filter lists
|
|
147
147
|
// (the compiler emits the same two-function form, clamped per R8).
|
|
148
148
|
filter: "blur(0px) brightness(1)"
|
|
149
|
-
},
|
|
149
|
+
}, je = {
|
|
150
150
|
kind: "tween",
|
|
151
151
|
duration_ms: 400,
|
|
152
152
|
ease: "cubic-out"
|
|
153
153
|
};
|
|
154
|
-
function
|
|
154
|
+
function bt(t, e, s) {
|
|
155
155
|
for (const n of e) {
|
|
156
156
|
const r = t(n);
|
|
157
157
|
if (r !== void 0) return r;
|
|
@@ -161,29 +161,29 @@ function wt(t, e, s) {
|
|
|
161
161
|
const r = t(n);
|
|
162
162
|
if (r !== void 0) return r;
|
|
163
163
|
}
|
|
164
|
-
return
|
|
164
|
+
return je;
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
function
|
|
167
|
+
function St(t, e, s) {
|
|
168
168
|
if (!e || Object.keys(e).length === 0)
|
|
169
169
|
return { initial: t, animate: t };
|
|
170
170
|
let n = e;
|
|
171
171
|
if (e.filter !== void 0) {
|
|
172
|
-
const i =
|
|
173
|
-
n = { ...e }, i === null ? (
|
|
172
|
+
const i = Le(e.filter);
|
|
173
|
+
n = { ...e }, i === null ? (Me("animate_initial.filter", s), delete n.filter) : n.filter = i;
|
|
174
174
|
}
|
|
175
175
|
const r = { ...t };
|
|
176
176
|
for (const i of Object.keys(n))
|
|
177
|
-
i in r || (r[i] =
|
|
177
|
+
i in r || (r[i] = xe[i] ?? 0);
|
|
178
178
|
return { initial: n, animate: r };
|
|
179
179
|
}
|
|
180
|
-
function
|
|
180
|
+
function De(t) {
|
|
181
181
|
if (typeof t != "object" || t === null) return;
|
|
182
182
|
const e = t, s = e.kind;
|
|
183
183
|
if (s === "snap")
|
|
184
184
|
return { kind: "none" };
|
|
185
185
|
if (s === "tween") {
|
|
186
|
-
const n = typeof e.duration_ms == "number" ? e.duration_ms : 0, r =
|
|
186
|
+
const n = typeof e.duration_ms == "number" ? e.duration_ms : 0, r = Ue[e.easing] ?? "cubic-out";
|
|
187
187
|
return { kind: "tween", duration_ms: n, ease: r };
|
|
188
188
|
}
|
|
189
189
|
if (s === "spring") {
|
|
@@ -191,95 +191,95 @@ function xe(t) {
|
|
|
191
191
|
return typeof e.stiffness == "number" && (n.stiffness = e.stiffness), typeof e.damping == "number" && (n.damping = e.damping), typeof e.mass == "number" && (n.mass = e.mass), n;
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
|
-
const
|
|
194
|
+
const Ue = {
|
|
195
195
|
linear: "linear",
|
|
196
196
|
"ease-in": "cubic-in",
|
|
197
197
|
"ease-out": "cubic-out",
|
|
198
198
|
"ease-in-out": "cubic-in-out"
|
|
199
199
|
};
|
|
200
|
-
function
|
|
201
|
-
|
|
200
|
+
function $e(t, e) {
|
|
201
|
+
I(() => {
|
|
202
202
|
for (const s of e.patches) {
|
|
203
|
-
const n =
|
|
203
|
+
const n = De(s.transition);
|
|
204
204
|
n !== void 0 ? t.setWithTransition(s.path, s.value, n) : t.set(s.path, s.value);
|
|
205
205
|
}
|
|
206
206
|
});
|
|
207
207
|
}
|
|
208
|
-
function
|
|
208
|
+
function Fe(t, e) {
|
|
209
209
|
t.reset(e.state);
|
|
210
210
|
}
|
|
211
|
-
const
|
|
212
|
-
function
|
|
213
|
-
return t ===
|
|
211
|
+
const kt = "__cam.", A = "__cam.slots.", Q = "__cam.viewer";
|
|
212
|
+
function U(t) {
|
|
213
|
+
return t === Q || t.startsWith(A);
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function We(t) {
|
|
216
216
|
const e = {};
|
|
217
217
|
let s;
|
|
218
218
|
for (const [n, r] of t)
|
|
219
|
-
if (n ===
|
|
219
|
+
if (n === Q)
|
|
220
220
|
r != null && (s = r);
|
|
221
|
-
else if (n.startsWith(
|
|
222
|
-
const i = n.slice(
|
|
221
|
+
else if (n.startsWith(A)) {
|
|
222
|
+
const i = n.slice(A.length);
|
|
223
223
|
i !== "" && typeof r == "string" && r !== "" && (e[i] = r);
|
|
224
224
|
}
|
|
225
225
|
return s !== void 0 ? { viewer: s, slots: e } : { slots: e };
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function $(t) {
|
|
228
228
|
const e = Object.keys(t.slots).sort().map((n) => `${n}=${t.slots[n]}`).join("&"), s = t.viewer === void 0 ? "" : JSON.stringify(t.viewer);
|
|
229
229
|
return `${e}|${s}`;
|
|
230
230
|
}
|
|
231
|
-
function
|
|
231
|
+
function qe(t) {
|
|
232
232
|
const e = /* @__PURE__ */ new Map();
|
|
233
|
-
let s =
|
|
233
|
+
let s = $({ slots: {} });
|
|
234
234
|
const n = () => {
|
|
235
|
-
const r =
|
|
235
|
+
const r = We(e), i = $(r);
|
|
236
236
|
i !== s && (s = i, t(r));
|
|
237
237
|
};
|
|
238
238
|
return {
|
|
239
239
|
onSnapshot(r) {
|
|
240
240
|
e.clear();
|
|
241
241
|
for (const [i, a] of Object.entries(r))
|
|
242
|
-
|
|
242
|
+
U(i) && e.set(i, a);
|
|
243
243
|
n();
|
|
244
244
|
},
|
|
245
245
|
onDelta(r) {
|
|
246
246
|
let i = !1;
|
|
247
247
|
for (const a of r)
|
|
248
|
-
|
|
248
|
+
U(a.path) && (e.set(a.path, a.value), i = !0);
|
|
249
249
|
i && n();
|
|
250
250
|
}
|
|
251
251
|
};
|
|
252
252
|
}
|
|
253
|
-
class
|
|
253
|
+
class ze {
|
|
254
254
|
signals = /* @__PURE__ */ new Map();
|
|
255
255
|
transitions = /* @__PURE__ */ new Map();
|
|
256
256
|
signal(e) {
|
|
257
257
|
let s = this.signals.get(e);
|
|
258
|
-
return s || (s =
|
|
258
|
+
return s || (s = S(void 0), this.signals.set(e, s)), s;
|
|
259
259
|
}
|
|
260
260
|
transitionSignal(e) {
|
|
261
261
|
let s = this.transitions.get(e);
|
|
262
|
-
return s || (s =
|
|
262
|
+
return s || (s = S(void 0), this.transitions.set(e, s)), s;
|
|
263
263
|
}
|
|
264
264
|
set(e, s) {
|
|
265
265
|
const n = this.signal(e);
|
|
266
|
-
|
|
266
|
+
R(n.peek(), s) || (n.value = s);
|
|
267
267
|
}
|
|
268
268
|
setWithTransition(e, s, n) {
|
|
269
|
-
|
|
269
|
+
I(() => {
|
|
270
270
|
const r = this.transitionSignal(e);
|
|
271
271
|
r.peek() !== n && (r.value = n);
|
|
272
272
|
const i = this.signal(e);
|
|
273
|
-
|
|
273
|
+
R(i.peek(), s) || (i.value = s);
|
|
274
274
|
});
|
|
275
275
|
}
|
|
276
276
|
reset(e) {
|
|
277
|
-
|
|
277
|
+
I(() => {
|
|
278
278
|
const s = /* @__PURE__ */ new Set();
|
|
279
279
|
for (const [n, r] of Object.entries(e)) {
|
|
280
280
|
s.add(n);
|
|
281
281
|
const i = this.signal(n);
|
|
282
|
-
|
|
282
|
+
R(i.peek(), r) || (i.value = r);
|
|
283
283
|
const a = this.transitions.get(n);
|
|
284
284
|
a && a.peek() !== void 0 && (a.value = void 0);
|
|
285
285
|
}
|
|
@@ -297,10 +297,10 @@ class We {
|
|
|
297
297
|
return e;
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
|
-
function
|
|
301
|
-
return new
|
|
300
|
+
function ee() {
|
|
301
|
+
return new ze();
|
|
302
302
|
}
|
|
303
|
-
function
|
|
303
|
+
function R(t, e) {
|
|
304
304
|
if (t === e) return !0;
|
|
305
305
|
if (t === null || e === null || typeof t != typeof e || typeof t != "object" || Array.isArray(t) !== Array.isArray(e)) return !1;
|
|
306
306
|
if (Array.isArray(t) && Array.isArray(e)) {
|
|
@@ -315,20 +315,20 @@ function k(t, e) {
|
|
|
315
315
|
if (s[a] !== n[a]) return !1;
|
|
316
316
|
return !0;
|
|
317
317
|
}
|
|
318
|
-
const
|
|
318
|
+
const Be = /* @__PURE__ */ new Set([
|
|
319
319
|
"x-lumencast.color-srgb-1.0",
|
|
320
320
|
// RFC-0001 / ADR 004 — this runtime ships the Zab capture plugin, so a
|
|
321
321
|
// bundle declaring `x-zab.capture/1` in `profiles[]` is compatible (it is
|
|
322
322
|
// NOT rejected as BUNDLE_INCOMPATIBLE, §17.3.1).
|
|
323
323
|
"x-zab.capture/1"
|
|
324
|
-
]),
|
|
325
|
-
function
|
|
324
|
+
]), He = /^x-[a-z0-9-]+(?:\.[a-z0-9-]+)*$/, Ge = /^(?:0|[1-9][0-9]*)$/, F = ".authoring";
|
|
325
|
+
function Ve(t) {
|
|
326
326
|
const e = t.indexOf("/");
|
|
327
327
|
if (e < 0) return !1;
|
|
328
328
|
const s = t.slice(0, e), n = t.slice(e + 1);
|
|
329
|
-
return !
|
|
329
|
+
return !Ge.test(n) || !s.endsWith(F) ? !1 : He.test(s.slice(0, -F.length));
|
|
330
330
|
}
|
|
331
|
-
class
|
|
331
|
+
class W extends Error {
|
|
332
332
|
code = "BUNDLE_INCOMPATIBLE";
|
|
333
333
|
unsupportedProfiles;
|
|
334
334
|
constructor(e) {
|
|
@@ -339,17 +339,17 @@ class U extends Error {
|
|
|
339
339
|
), this.name = "BundleIncompatibleError", this.unsupportedProfiles = e;
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
|
-
function
|
|
342
|
+
function q(t, e = Be) {
|
|
343
343
|
const s = t.profiles;
|
|
344
344
|
if (!s) return;
|
|
345
345
|
if (!Array.isArray(s))
|
|
346
|
-
throw new
|
|
346
|
+
throw new W(["<malformed: profiles is not an array>"]);
|
|
347
347
|
if (s.length === 0) return;
|
|
348
|
-
const n = s.filter((r) => typeof r != "string" || !
|
|
348
|
+
const n = s.filter((r) => typeof r != "string" || !Ve(r) && !e.has(r)).map((r) => typeof r == "string" ? r : "<malformed: non-string profile entry>");
|
|
349
349
|
if (n.length > 0)
|
|
350
|
-
throw new
|
|
350
|
+
throw new W(n);
|
|
351
351
|
}
|
|
352
|
-
class
|
|
352
|
+
class Xe {
|
|
353
353
|
cache = /* @__PURE__ */ new Map();
|
|
354
354
|
baseUrl;
|
|
355
355
|
pathPrefix;
|
|
@@ -372,7 +372,7 @@ class Ge {
|
|
|
372
372
|
return this.resolveUrl ? this.resolveUrl(e, s) : `${this.baseUrl}${this.pathPrefix}/${encodeURIComponent(e)}/bundle?v=${encodeURIComponent(s)}`;
|
|
373
373
|
}
|
|
374
374
|
preload(e) {
|
|
375
|
-
|
|
375
|
+
q(e), this.cache.set(e.scene_version, e);
|
|
376
376
|
}
|
|
377
377
|
async get(e, s) {
|
|
378
378
|
const n = this.cache.get(s);
|
|
@@ -385,19 +385,19 @@ class Ge {
|
|
|
385
385
|
throw new Error(
|
|
386
386
|
`bundle scene_version mismatch: expected ${s}, got ${o.scene_version}`
|
|
387
387
|
);
|
|
388
|
-
return
|
|
388
|
+
return q(o), this.cache.set(s, o), o;
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
|
-
function
|
|
392
|
-
return new
|
|
391
|
+
function Ke(t) {
|
|
392
|
+
return new Xe(t);
|
|
393
393
|
}
|
|
394
|
-
const
|
|
394
|
+
const k = {
|
|
395
395
|
initial: 200,
|
|
396
396
|
max: 5e3,
|
|
397
397
|
factor: 2,
|
|
398
398
|
jitter: 0.2
|
|
399
399
|
};
|
|
400
|
-
class
|
|
400
|
+
class Je {
|
|
401
401
|
constructor(e, s) {
|
|
402
402
|
this.opts = e, this.random = s;
|
|
403
403
|
}
|
|
@@ -421,18 +421,18 @@ class Ve {
|
|
|
421
421
|
this._attempt = 0;
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
|
-
function
|
|
424
|
+
function Ye(t = {}) {
|
|
425
425
|
const e = {
|
|
426
|
-
initial: t.initial ??
|
|
427
|
-
max: t.max ??
|
|
428
|
-
factor: t.factor ??
|
|
429
|
-
jitter: t.jitter ??
|
|
426
|
+
initial: t.initial ?? k.initial,
|
|
427
|
+
max: t.max ?? k.max,
|
|
428
|
+
factor: t.factor ?? k.factor,
|
|
429
|
+
jitter: t.jitter ?? k.jitter
|
|
430
430
|
};
|
|
431
431
|
if (e.initial <= 0) throw new RangeError("initial must be > 0");
|
|
432
432
|
if (e.max < e.initial) throw new RangeError("max must be >= initial");
|
|
433
433
|
if (e.factor < 1) throw new RangeError("factor must be >= 1");
|
|
434
434
|
if (e.jitter < 0 || e.jitter > 1) throw new RangeError("jitter must be within [0, 1]");
|
|
435
|
-
return new
|
|
435
|
+
return new Je(e, t.random ?? Math.random);
|
|
436
436
|
}
|
|
437
437
|
class g extends Error {
|
|
438
438
|
recoverable;
|
|
@@ -442,14 +442,14 @@ class g extends Error {
|
|
|
442
442
|
super(e), this.name = "TransportError", this.recoverable = s, this.code = n, this.cause = r;
|
|
443
443
|
}
|
|
444
444
|
}
|
|
445
|
-
class
|
|
445
|
+
class Ze {
|
|
446
446
|
status = "disconnected";
|
|
447
447
|
socket = null;
|
|
448
448
|
token;
|
|
449
449
|
url;
|
|
450
450
|
WebSocketCtor;
|
|
451
451
|
schedule;
|
|
452
|
-
seq = new
|
|
452
|
+
seq = new pe();
|
|
453
453
|
opts;
|
|
454
454
|
scheduler;
|
|
455
455
|
reconnectTimer = null;
|
|
@@ -461,7 +461,7 @@ class Je {
|
|
|
461
461
|
throw new TypeError(
|
|
462
462
|
"Lumencast WsClient: no WebSocket implementation found in this environment"
|
|
463
463
|
);
|
|
464
|
-
this.WebSocketCtor = s, this.schedule =
|
|
464
|
+
this.WebSocketCtor = s, this.schedule = Ye(e.reconnect), this.scheduler = e.scheduler ?? {
|
|
465
465
|
setTimeout: globalThis.setTimeout.bind(globalThis),
|
|
466
466
|
clearTimeout: globalThis.clearTimeout.bind(globalThis)
|
|
467
467
|
};
|
|
@@ -475,11 +475,11 @@ class Je {
|
|
|
475
475
|
* authenticate the render-bundle GET with the same credential. A
|
|
476
476
|
* `LumencastTokenProvider` is awaited. */
|
|
477
477
|
resolveCurrentToken() {
|
|
478
|
-
return
|
|
478
|
+
return z(this.token);
|
|
479
479
|
}
|
|
480
480
|
/** Send `input` patches to the server. No-op if not connected. */
|
|
481
481
|
sendInput(e) {
|
|
482
|
-
!this.socket || this.socket.readyState !== this.WebSocketCtor.OPEN || e.length !== 0 && this.socket.send(
|
|
482
|
+
!this.socket || this.socket.readyState !== this.WebSocketCtor.OPEN || e.length !== 0 && this.socket.send(x(ge(e)));
|
|
483
483
|
}
|
|
484
484
|
/** Replace the auth token. Closes and reopens with the new token. */
|
|
485
485
|
setToken(e) {
|
|
@@ -495,7 +495,7 @@ class Je {
|
|
|
495
495
|
this.setStatus("connecting");
|
|
496
496
|
let e;
|
|
497
497
|
try {
|
|
498
|
-
e = await
|
|
498
|
+
e = await z(this.token);
|
|
499
499
|
} catch (n) {
|
|
500
500
|
this.opts.onTransportError?.(
|
|
501
501
|
new g(
|
|
@@ -510,7 +510,7 @@ class Je {
|
|
|
510
510
|
if (!this.active) return;
|
|
511
511
|
let s;
|
|
512
512
|
try {
|
|
513
|
-
s = new this.WebSocketCtor(this.url, [...
|
|
513
|
+
s = new this.WebSocketCtor(this.url, [...ve]);
|
|
514
514
|
} catch (n) {
|
|
515
515
|
this.opts.onTransportError?.(
|
|
516
516
|
new g(
|
|
@@ -526,24 +526,24 @@ class Je {
|
|
|
526
526
|
}
|
|
527
527
|
handleOpen(e) {
|
|
528
528
|
if (!this.socket) return;
|
|
529
|
-
const n = this.socket.protocol ===
|
|
529
|
+
const n = this.socket.protocol === we && this.seq.last > 0, r = n ? this.seq.last : void 0;
|
|
530
530
|
n || this.seq.reset();
|
|
531
|
-
const i =
|
|
531
|
+
const i = ye({
|
|
532
532
|
token: e,
|
|
533
533
|
...this.opts.scene !== void 0 ? { scene: this.opts.scene } : {},
|
|
534
534
|
...this.opts.session !== void 0 ? { session: this.opts.session } : {},
|
|
535
535
|
...r !== void 0 ? { since_sequence: r } : {}
|
|
536
536
|
});
|
|
537
|
-
this.socket.send(
|
|
537
|
+
this.socket.send(x(i));
|
|
538
538
|
}
|
|
539
539
|
handleMessage(e) {
|
|
540
540
|
const s = typeof e.data == "string" ? e.data : "";
|
|
541
541
|
if (!s) return;
|
|
542
542
|
let n;
|
|
543
543
|
try {
|
|
544
|
-
n =
|
|
544
|
+
n = be(s);
|
|
545
545
|
} catch (r) {
|
|
546
|
-
const i = (r instanceof
|
|
546
|
+
const i = (r instanceof j, r.message), a = r instanceof j ? r.code : "INTERNAL";
|
|
547
547
|
this.opts.onTransportError?.(new g(`codec: ${i}`, !0, a, r)), this.closeSocket(), this.scheduleReconnect();
|
|
548
548
|
return;
|
|
549
549
|
}
|
|
@@ -583,6 +583,10 @@ class Je {
|
|
|
583
583
|
this.opts.onServerError?.(n), n.recoverable || this.close();
|
|
584
584
|
return;
|
|
585
585
|
}
|
|
586
|
+
case "scene_roster": {
|
|
587
|
+
this.opts.onSceneRoster?.(n);
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
586
590
|
case "pong":
|
|
587
591
|
return;
|
|
588
592
|
}
|
|
@@ -626,10 +630,10 @@ class Je {
|
|
|
626
630
|
this.status !== e && (this.status = e, this.opts.onStatus?.(e));
|
|
627
631
|
}
|
|
628
632
|
}
|
|
629
|
-
async function
|
|
633
|
+
async function z(t) {
|
|
630
634
|
return typeof t == "string" ? t : await t.fetch();
|
|
631
635
|
}
|
|
632
|
-
function
|
|
636
|
+
function Qe(t) {
|
|
633
637
|
if (!(t.target instanceof HTMLElement))
|
|
634
638
|
throw new TypeError("mount: `target` must be an HTMLElement");
|
|
635
639
|
if (typeof t.serverUrl != "string" || t.serverUrl.length === 0)
|
|
@@ -641,75 +645,78 @@ function Ye(t) {
|
|
|
641
645
|
throw new TypeError("mount: `scene` is required when mode === 'test'");
|
|
642
646
|
}
|
|
643
647
|
}
|
|
644
|
-
function
|
|
645
|
-
|
|
646
|
-
const e =
|
|
648
|
+
function Tt(t) {
|
|
649
|
+
Qe(t), t.onStatus?.("disconnected");
|
|
650
|
+
const e = ee(), s = tt(t.serverUrl), n = Ke({
|
|
647
651
|
baseUrl: s,
|
|
648
652
|
...t.resolveBundleUrl !== void 0 ? { resolveUrl: t.resolveBundleUrl } : {},
|
|
649
|
-
getAuthToken: () =>
|
|
650
|
-
}), r =
|
|
651
|
-
i.value =
|
|
652
|
-
},
|
|
653
|
-
t.onError?.(
|
|
653
|
+
getAuthToken: () => w.resolveCurrentToken()
|
|
654
|
+
}), r = S(null), i = S("disconnected"), a = S("__initial__"), o = (u) => {
|
|
655
|
+
i.value = u, t.onStatus?.(u);
|
|
656
|
+
}, c = (u) => {
|
|
657
|
+
t.onError?.(u);
|
|
654
658
|
};
|
|
655
|
-
let
|
|
656
|
-
const d = t.onReservedLeaves ?
|
|
659
|
+
let l = !0;
|
|
660
|
+
const d = /* @__PURE__ */ new Set(), h = t.onReservedLeaves ? qe(t.onReservedLeaves) : void 0, _ = t.onDiagnostic ? Y(t.onDiagnostic) : void 0, w = new Ze({
|
|
657
661
|
url: t.serverUrl,
|
|
658
662
|
token: t.token,
|
|
659
663
|
...t.scene !== void 0 ? { scene: t.scene } : {},
|
|
660
664
|
...t.testSession !== void 0 ? { session: t.testSession } : {},
|
|
661
665
|
onStatus: o,
|
|
662
|
-
onSnapshot: (
|
|
663
|
-
|
|
666
|
+
onSnapshot: (u) => {
|
|
667
|
+
l && (h?.onSnapshot(u.state), ie(
|
|
664
668
|
n,
|
|
665
669
|
r,
|
|
666
670
|
a,
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
() =>
|
|
670
|
-
|
|
671
|
+
u.scene_id,
|
|
672
|
+
u.scene_version,
|
|
673
|
+
() => Fe(e, u),
|
|
674
|
+
c
|
|
671
675
|
), t.onMetric?.({
|
|
672
676
|
name: "snapshot_received",
|
|
673
|
-
scene_id:
|
|
674
|
-
path_count: Object.keys(
|
|
677
|
+
scene_id: u.scene_id,
|
|
678
|
+
path_count: Object.keys(u.state).length
|
|
675
679
|
}));
|
|
676
680
|
},
|
|
677
|
-
onDelta: (
|
|
678
|
-
if (!
|
|
679
|
-
const
|
|
680
|
-
|
|
681
|
+
onDelta: (u) => {
|
|
682
|
+
if (!l) return;
|
|
683
|
+
const y = performance.now();
|
|
684
|
+
$e(e, u), h?.onDelta(u.patches), t.onMetric?.({
|
|
681
685
|
name: "delta_applied",
|
|
682
|
-
duration_ms: performance.now() -
|
|
683
|
-
}), t.onMetric?.({ name: "delta_received", count: 1, path_count:
|
|
686
|
+
duration_ms: performance.now() - y
|
|
687
|
+
}), t.onMetric?.({ name: "delta_received", count: 1, path_count: u.patches.length });
|
|
684
688
|
},
|
|
685
|
-
onSceneChanged: (
|
|
686
|
-
|
|
689
|
+
onSceneChanged: (u) => {
|
|
690
|
+
l && t.onMetric?.({
|
|
687
691
|
name: "scene_changed",
|
|
688
692
|
from: r.value?.scene_version ?? null,
|
|
689
|
-
to:
|
|
693
|
+
to: u.scene_version
|
|
690
694
|
});
|
|
691
695
|
},
|
|
692
|
-
|
|
693
|
-
u
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
696
|
+
onSceneRoster: (u) => {
|
|
697
|
+
l && M(u.entries, "frame");
|
|
698
|
+
},
|
|
699
|
+
onServerError: (u) => {
|
|
700
|
+
c({
|
|
701
|
+
code: u.code,
|
|
702
|
+
message: u.message,
|
|
703
|
+
recoverable: u.recoverable
|
|
697
704
|
});
|
|
698
705
|
},
|
|
699
|
-
onTransportError: (
|
|
700
|
-
|
|
706
|
+
onTransportError: (u) => {
|
|
707
|
+
c(et(u));
|
|
701
708
|
}
|
|
702
709
|
});
|
|
703
|
-
|
|
704
|
-
const
|
|
705
|
-
return
|
|
706
|
-
|
|
710
|
+
w.start(), t.preloadRoster !== void 0 && t.preloadRoster.length > 0 && M(t.preloadRoster, "option");
|
|
711
|
+
const L = X(t.target);
|
|
712
|
+
return L.render(
|
|
713
|
+
ue(_e, {
|
|
707
714
|
mode: t.mode,
|
|
708
715
|
store: e,
|
|
709
716
|
bundleSignal: r,
|
|
710
717
|
statusSignal: i,
|
|
711
718
|
crossfadeKeySignal: a,
|
|
712
|
-
sendInput: (
|
|
719
|
+
sendInput: (u) => w.sendInput(u),
|
|
713
720
|
// ADR 004 §A1.3 — thread the host capture resolver to the runtime context
|
|
714
721
|
// so the `x-zab.capture` primitive's ACQUIRE mode can pin a device.
|
|
715
722
|
...t.resolveCaptureDevice !== void 0 ? { resolveCaptureDevice: t.resolveCaptureDevice } : {},
|
|
@@ -723,35 +730,49 @@ function St(t) {
|
|
|
723
730
|
})
|
|
724
731
|
), {
|
|
725
732
|
disconnect() {
|
|
726
|
-
|
|
733
|
+
l && (l = !1, _?.(), w.close(), L.unmount());
|
|
727
734
|
},
|
|
728
|
-
setToken(
|
|
729
|
-
|
|
735
|
+
setToken(u) {
|
|
736
|
+
l && w.setToken(u);
|
|
730
737
|
}
|
|
731
738
|
};
|
|
732
|
-
|
|
733
|
-
|
|
739
|
+
function M(u, y) {
|
|
740
|
+
const E = r.value?.scene_version;
|
|
741
|
+
for (const { scene_id: b, scene_version: m } of u)
|
|
742
|
+
m !== E && (d.has(m) || (d.add(m), n.get(b, m).then(() => {
|
|
743
|
+
l && t.onMetric?.({
|
|
744
|
+
name: "roster_preloaded",
|
|
745
|
+
scene_id: b,
|
|
746
|
+
scene_version: m,
|
|
747
|
+
source: y
|
|
748
|
+
});
|
|
749
|
+
}).catch(() => {
|
|
750
|
+
d.delete(m);
|
|
751
|
+
})));
|
|
752
|
+
}
|
|
753
|
+
async function ie(u, y, E, b, m, oe, ae) {
|
|
754
|
+
let C;
|
|
734
755
|
try {
|
|
735
|
-
|
|
736
|
-
} catch (
|
|
737
|
-
|
|
756
|
+
C = await u.get(b, m);
|
|
757
|
+
} catch (N) {
|
|
758
|
+
ae({
|
|
738
759
|
code: "BUNDLE_FETCH_FAILED",
|
|
739
|
-
message:
|
|
760
|
+
message: N instanceof Error ? N.message : "render bundle fetch failed",
|
|
740
761
|
recoverable: !0
|
|
741
762
|
});
|
|
742
763
|
return;
|
|
743
764
|
}
|
|
744
|
-
|
|
765
|
+
l && (oe(), y.value = C, E.value = `${b}::${m}`);
|
|
745
766
|
}
|
|
746
767
|
}
|
|
747
|
-
function
|
|
768
|
+
function et(t) {
|
|
748
769
|
return {
|
|
749
770
|
code: t.code,
|
|
750
771
|
message: t.message,
|
|
751
772
|
recoverable: t.recoverable
|
|
752
773
|
};
|
|
753
774
|
}
|
|
754
|
-
function
|
|
775
|
+
function tt(t) {
|
|
755
776
|
try {
|
|
756
777
|
const e = new URL(t);
|
|
757
778
|
return `${e.protocol === "wss:" ? "https:" : "http:"}//${e.host}`;
|
|
@@ -759,7 +780,7 @@ function Qe(t) {
|
|
|
759
780
|
return "";
|
|
760
781
|
}
|
|
761
782
|
}
|
|
762
|
-
const
|
|
783
|
+
const st = [
|
|
763
784
|
"visible",
|
|
764
785
|
"opacity",
|
|
765
786
|
"universal_opacity",
|
|
@@ -776,13 +797,13 @@ const et = [
|
|
|
776
797
|
// compiler and consumed by the Tree (built into a `<mask>` SVG element).
|
|
777
798
|
"mask"
|
|
778
799
|
];
|
|
779
|
-
function
|
|
780
|
-
return /* @__PURE__ */ new Set([...
|
|
800
|
+
function f(t) {
|
|
801
|
+
return /* @__PURE__ */ new Set([...st, ...t]);
|
|
781
802
|
}
|
|
782
|
-
const
|
|
783
|
-
stack:
|
|
784
|
-
grid:
|
|
785
|
-
frame:
|
|
803
|
+
const nt = {
|
|
804
|
+
stack: f(["direction", "gap", "wrap", "crossGap", "align", "justify"]),
|
|
805
|
+
grid: f(["cols", "rows", "gap"]),
|
|
806
|
+
frame: f([
|
|
786
807
|
"x",
|
|
787
808
|
"y",
|
|
788
809
|
"width",
|
|
@@ -793,7 +814,7 @@ const tt = {
|
|
|
793
814
|
"backgrounds",
|
|
794
815
|
"clipsContent"
|
|
795
816
|
]),
|
|
796
|
-
text:
|
|
817
|
+
text: f([
|
|
797
818
|
"value",
|
|
798
819
|
"size",
|
|
799
820
|
"font",
|
|
@@ -807,8 +828,8 @@ const tt = {
|
|
|
807
828
|
"fontStyle",
|
|
808
829
|
"maxLines"
|
|
809
830
|
]),
|
|
810
|
-
image:
|
|
811
|
-
shape:
|
|
831
|
+
image: f(["src", "alt", "fit", "position", "width", "height"]),
|
|
832
|
+
shape: f([
|
|
812
833
|
"geometry",
|
|
813
834
|
"kind",
|
|
814
835
|
"width",
|
|
@@ -827,7 +848,7 @@ const tt = {
|
|
|
827
848
|
// source is a `meet.peer.peer_label` is rendered in `srcObject` from a host
|
|
828
849
|
// resolver instead of `<video src>`. Listed so it is NOT flagged as a silent
|
|
829
850
|
// drop by the anti-drop audit when a scene carries a live source.
|
|
830
|
-
media:
|
|
851
|
+
media: f(["src", "peerLabel", "loop", "mute", "autoplay", "fit"]),
|
|
831
852
|
// ADR 006 §3.3/§3.5 — the unified source kind. `peer_label` is the stream
|
|
832
853
|
// reference (resolved to a MediaStream → srcObject) ; `object_fit`/`muted`
|
|
833
854
|
// drive the video ; `x-zab.sourceKind` is advisory ; `metadata` carries the
|
|
@@ -835,7 +856,7 @@ const tt = {
|
|
|
835
856
|
// but an UNCOMPILED from-scene node carries the NESTED `position`/`size` shape
|
|
836
857
|
// (the Tree flattens it as a fallback) — listed so neither form is flagged as
|
|
837
858
|
// a silent drop by the anti-drop audit.
|
|
838
|
-
"meet.peer":
|
|
859
|
+
"meet.peer": f([
|
|
839
860
|
"peer_label",
|
|
840
861
|
"object_fit",
|
|
841
862
|
"muted",
|
|
@@ -844,42 +865,42 @@ const tt = {
|
|
|
844
865
|
"position",
|
|
845
866
|
"size"
|
|
846
867
|
]),
|
|
847
|
-
instance:
|
|
868
|
+
instance: f(["scene_id", "scene_version", "size", "position"]),
|
|
848
869
|
// RFC-0001 / ADR 004 — vendor capture placeholder. `width`/`height` are the
|
|
849
870
|
// flattened geometry (universal) ; the `x-zab.*` props are carried as
|
|
850
871
|
// metadata (the renderer reserves the box, ignores deviceRef). Listed so
|
|
851
872
|
// they are NOT flagged as silent drops by the anti-drop audit.
|
|
852
|
-
"x-zab.capture":
|
|
873
|
+
"x-zab.capture": f(["x-zab.sourceKind", "x-zab.deviceRef", "width", "height"]),
|
|
853
874
|
// ADR Blue 009 §3.1 (Amendment 2) — vendor meet-peer SLOT placeholder.
|
|
854
875
|
// `width`/`height` are the flattened geometry (universal) ; `x-zab.slotRef`
|
|
855
876
|
// is the logical slot identity carried as metadata (the runtime resolves
|
|
856
877
|
// `slotRef → peer_label` from stream-level ZabCam state). NO cam/peer
|
|
857
878
|
// identity is carried. Listed so they are NOT flagged as silent drops.
|
|
858
|
-
"x-zab.meet-peer":
|
|
879
|
+
"x-zab.meet-peer": f(["x-zab.slotRef", "width", "height"]),
|
|
859
880
|
// `repeat` is dispatched specially by the tree ; its only consumed
|
|
860
881
|
// binding is `items`.
|
|
861
882
|
repeat: /* @__PURE__ */ new Set(["items"])
|
|
862
883
|
};
|
|
863
|
-
function
|
|
864
|
-
const s =
|
|
884
|
+
function rt(t, e) {
|
|
885
|
+
const s = nt[t];
|
|
865
886
|
return !!(s === void 0 || s.has(e) || t === "instance" && (e === "params" || e.startsWith("params.")));
|
|
866
887
|
}
|
|
867
|
-
const
|
|
868
|
-
function
|
|
869
|
-
if (
|
|
870
|
-
|
|
888
|
+
const B = /* @__PURE__ */ new WeakSet();
|
|
889
|
+
function _t(t) {
|
|
890
|
+
if (B.has(t)) return;
|
|
891
|
+
B.add(t);
|
|
871
892
|
const e = /* @__PURE__ */ new Set([
|
|
872
893
|
...Object.keys(t.props ?? {}),
|
|
873
894
|
...Object.keys(t.bindings ?? {})
|
|
874
895
|
]);
|
|
875
896
|
for (const s of e)
|
|
876
|
-
|
|
897
|
+
rt(t.kind, s) || Z(
|
|
877
898
|
t.id,
|
|
878
899
|
`${t.kind}.${s}`,
|
|
879
900
|
"is not consumed by this primitive's renderer ; the prop is ignored (anti-silent-drop, ADR 001 §3.4)"
|
|
880
901
|
);
|
|
881
902
|
}
|
|
882
|
-
class
|
|
903
|
+
class te {
|
|
883
904
|
constructor(e) {
|
|
884
905
|
this.options = e, this.deps = {
|
|
885
906
|
WebSocket: e.deps?.WebSocket ?? globalThis.WebSocket,
|
|
@@ -1009,7 +1030,7 @@ class Z {
|
|
|
1009
1030
|
iceServers: this.iceServers,
|
|
1010
1031
|
iceTransportPolicy: "relay"
|
|
1011
1032
|
}), r = new this.deps.MediaStream(), i = n.addTransceiver("audio", { direction: "recvonly" }), a = n.addTransceiver("video", { direction: "recvonly" });
|
|
1012
|
-
|
|
1033
|
+
it(i, a);
|
|
1013
1034
|
const o = {
|
|
1014
1035
|
info: e,
|
|
1015
1036
|
pc: n,
|
|
@@ -1033,21 +1054,21 @@ class Z {
|
|
|
1033
1054
|
o.makingOffer = !1;
|
|
1034
1055
|
}
|
|
1035
1056
|
})();
|
|
1036
|
-
}), n.addEventListener("icecandidate", (
|
|
1037
|
-
const
|
|
1038
|
-
|
|
1057
|
+
}), n.addEventListener("icecandidate", (c) => {
|
|
1058
|
+
const l = c.candidate;
|
|
1059
|
+
l && this.sendSignal(e.id, {
|
|
1039
1060
|
kind: "ice",
|
|
1040
1061
|
candidate: {
|
|
1041
|
-
candidate:
|
|
1042
|
-
sdpMid:
|
|
1043
|
-
sdpMLineIndex:
|
|
1044
|
-
usernameFragment:
|
|
1062
|
+
candidate: l.candidate,
|
|
1063
|
+
sdpMid: l.sdpMid,
|
|
1064
|
+
sdpMLineIndex: l.sdpMLineIndex,
|
|
1065
|
+
usernameFragment: l.usernameFragment
|
|
1045
1066
|
}
|
|
1046
1067
|
});
|
|
1047
|
-
}), n.addEventListener("track", (
|
|
1048
|
-
const
|
|
1049
|
-
o.stream.getTracks().includes(
|
|
1050
|
-
o.stream.removeTrack(
|
|
1068
|
+
}), n.addEventListener("track", (c) => {
|
|
1069
|
+
const l = c.track;
|
|
1070
|
+
o.stream.getTracks().includes(l) || o.stream.addTrack(l), l.addEventListener("ended", () => {
|
|
1071
|
+
o.stream.removeTrack(l);
|
|
1051
1072
|
}), this.emit("remote-track", {
|
|
1052
1073
|
peerId: e.id,
|
|
1053
1074
|
peerName: e.name,
|
|
@@ -1070,17 +1091,17 @@ class Z {
|
|
|
1070
1091
|
for (const r of n) r(s);
|
|
1071
1092
|
}
|
|
1072
1093
|
}
|
|
1073
|
-
function
|
|
1094
|
+
function it(t, e) {
|
|
1074
1095
|
const s = globalThis.RTCRtpReceiver?.getCapabilities;
|
|
1075
|
-
typeof s == "function" && (
|
|
1096
|
+
typeof s == "function" && (H(e, s("video"), (n) => {
|
|
1076
1097
|
const r = n.toLowerCase();
|
|
1077
1098
|
return r === "video/h264" || r === "video/rtx";
|
|
1078
|
-
}),
|
|
1099
|
+
}), H(t, s("audio"), (n) => {
|
|
1079
1100
|
const r = n.toLowerCase();
|
|
1080
1101
|
return r === "audio/opus" || r === "audio/telephone-event";
|
|
1081
1102
|
}));
|
|
1082
1103
|
}
|
|
1083
|
-
function
|
|
1104
|
+
function H(t, e, s) {
|
|
1084
1105
|
const n = t?.setCodecPreferences;
|
|
1085
1106
|
if (typeof n != "function" || !e) return;
|
|
1086
1107
|
const r = e.codecs.filter((i) => s(i.mimeType));
|
|
@@ -1090,42 +1111,56 @@ function q(t, e, s) {
|
|
|
1090
1111
|
} catch {
|
|
1091
1112
|
}
|
|
1092
1113
|
}
|
|
1093
|
-
function
|
|
1094
|
-
const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map();
|
|
1095
|
-
function
|
|
1096
|
-
const
|
|
1097
|
-
if (
|
|
1098
|
-
const
|
|
1099
|
-
for (const
|
|
1114
|
+
function se() {
|
|
1115
|
+
const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set();
|
|
1116
|
+
function n(i) {
|
|
1117
|
+
const a = e.get(i);
|
|
1118
|
+
if (a === void 0) return;
|
|
1119
|
+
const o = t.get(i) ?? null;
|
|
1120
|
+
for (const c of a) c(o);
|
|
1121
|
+
}
|
|
1122
|
+
function r() {
|
|
1123
|
+
for (const i of [...s]) i();
|
|
1100
1124
|
}
|
|
1101
1125
|
return {
|
|
1102
|
-
resolve(
|
|
1103
|
-
return t.get(
|
|
1126
|
+
resolve(i) {
|
|
1127
|
+
return t.get(i) ?? null;
|
|
1128
|
+
},
|
|
1129
|
+
orderedLabels() {
|
|
1130
|
+
return [...t.keys()];
|
|
1131
|
+
},
|
|
1132
|
+
subscribeRoster(i) {
|
|
1133
|
+
return s.add(i), () => {
|
|
1134
|
+
s.delete(i);
|
|
1135
|
+
};
|
|
1104
1136
|
},
|
|
1105
|
-
subscribe(
|
|
1106
|
-
let
|
|
1107
|
-
return
|
|
1108
|
-
const
|
|
1109
|
-
|
|
1137
|
+
subscribe(i, a) {
|
|
1138
|
+
let o = e.get(i);
|
|
1139
|
+
return o === void 0 && (o = /* @__PURE__ */ new Set(), e.set(i, o)), o.add(a), a(t.get(i) ?? null), () => {
|
|
1140
|
+
const c = e.get(i);
|
|
1141
|
+
c !== void 0 && (c.delete(a), c.size === 0 && e.delete(i));
|
|
1110
1142
|
};
|
|
1111
1143
|
},
|
|
1112
|
-
set(
|
|
1113
|
-
t.get(
|
|
1144
|
+
set(i, a) {
|
|
1145
|
+
if (t.get(i) === a) return;
|
|
1146
|
+
const o = !t.has(i);
|
|
1147
|
+
t.set(i, a), n(i), o && r();
|
|
1114
1148
|
},
|
|
1115
|
-
remove(
|
|
1116
|
-
t.has(
|
|
1149
|
+
remove(i) {
|
|
1150
|
+
t.has(i) && (t.delete(i), n(i), r());
|
|
1117
1151
|
},
|
|
1118
1152
|
clear() {
|
|
1119
|
-
const
|
|
1153
|
+
const i = [...t.keys()];
|
|
1120
1154
|
t.clear();
|
|
1121
|
-
for (const
|
|
1155
|
+
for (const a of i) n(a);
|
|
1156
|
+
i.length > 0 && r();
|
|
1122
1157
|
}
|
|
1123
1158
|
};
|
|
1124
1159
|
}
|
|
1125
1160
|
function v(t) {
|
|
1126
1161
|
return t.toLowerCase().replace(/[^a-z0-9_-]+/g, "_").replace(/^[_-]+|[_-]+$/g, "");
|
|
1127
1162
|
}
|
|
1128
|
-
function
|
|
1163
|
+
function ne(t, e, s) {
|
|
1129
1164
|
t.on("remote-track", (n) => {
|
|
1130
1165
|
const r = v(n.peerName);
|
|
1131
1166
|
s.acquire(r, t) && e.set(r, n.stream);
|
|
@@ -1134,14 +1169,14 @@ function ee(t, e, s) {
|
|
|
1134
1169
|
s.acquire(r, t) && (e.remove(r), s.release(r, t));
|
|
1135
1170
|
});
|
|
1136
1171
|
}
|
|
1137
|
-
const
|
|
1172
|
+
const ot = {
|
|
1138
1173
|
acquire: () => !0,
|
|
1139
1174
|
release: () => {
|
|
1140
1175
|
}
|
|
1141
1176
|
};
|
|
1142
|
-
function
|
|
1143
|
-
const e =
|
|
1144
|
-
return
|
|
1177
|
+
function Et(t) {
|
|
1178
|
+
const e = se(), s = new te(t);
|
|
1179
|
+
return ne(s, e, ot), {
|
|
1145
1180
|
join: () => s.join(),
|
|
1146
1181
|
leave: () => {
|
|
1147
1182
|
s.leave(), e.clear();
|
|
@@ -1152,31 +1187,31 @@ function Tt(t) {
|
|
|
1152
1187
|
viewer: s
|
|
1153
1188
|
};
|
|
1154
1189
|
}
|
|
1155
|
-
function
|
|
1156
|
-
const e =
|
|
1157
|
-
acquire: (o,
|
|
1158
|
-
const
|
|
1159
|
-
return
|
|
1190
|
+
function G(t) {
|
|
1191
|
+
const e = se(), s = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = {
|
|
1192
|
+
acquire: (o, c) => {
|
|
1193
|
+
const l = n.get(o);
|
|
1194
|
+
return l === void 0 ? (n.set(o, c), !0) : l === c;
|
|
1160
1195
|
},
|
|
1161
|
-
release: (o,
|
|
1162
|
-
n.get(o) ===
|
|
1196
|
+
release: (o, c) => {
|
|
1197
|
+
n.get(o) === c && n.delete(o);
|
|
1163
1198
|
}
|
|
1164
1199
|
};
|
|
1165
1200
|
function i(o) {
|
|
1166
1201
|
if (s.has(o.roomId)) return;
|
|
1167
|
-
const
|
|
1202
|
+
const c = new te({
|
|
1168
1203
|
name: o.name ?? "solar-viewer",
|
|
1169
1204
|
...o,
|
|
1170
1205
|
...t.deps !== void 0 && o.deps === void 0 ? { deps: t.deps } : {}
|
|
1171
1206
|
});
|
|
1172
|
-
|
|
1207
|
+
ne(c, e, r), s.set(o.roomId, { viewer: c });
|
|
1173
1208
|
}
|
|
1174
1209
|
function a(o) {
|
|
1175
|
-
const
|
|
1176
|
-
if (
|
|
1177
|
-
for (const [
|
|
1178
|
-
d ===
|
|
1179
|
-
|
|
1210
|
+
const c = s.get(o);
|
|
1211
|
+
if (c !== void 0) {
|
|
1212
|
+
for (const [l, d] of [...n.entries()])
|
|
1213
|
+
d === c.viewer && (e.remove(l), n.delete(l));
|
|
1214
|
+
c.viewer.leave(), s.delete(o);
|
|
1180
1215
|
}
|
|
1181
1216
|
}
|
|
1182
1217
|
for (const o of t.rooms) i(o);
|
|
@@ -1189,63 +1224,63 @@ function z(t) {
|
|
|
1189
1224
|
e.clear();
|
|
1190
1225
|
},
|
|
1191
1226
|
setRooms: async (o) => {
|
|
1192
|
-
const
|
|
1227
|
+
const c = new Set(o.map((d) => d.roomId));
|
|
1193
1228
|
for (const d of [...s.keys()])
|
|
1194
|
-
|
|
1195
|
-
const
|
|
1229
|
+
c.has(d) || a(d);
|
|
1230
|
+
const l = [];
|
|
1196
1231
|
for (const d of o)
|
|
1197
1232
|
if (!s.has(d.roomId)) {
|
|
1198
1233
|
i(d);
|
|
1199
|
-
const
|
|
1200
|
-
|
|
1234
|
+
const h = s.get(d.roomId);
|
|
1235
|
+
h && l.push(h.viewer);
|
|
1201
1236
|
}
|
|
1202
|
-
await Promise.all(
|
|
1237
|
+
await Promise.all(l.map((d) => d.join()));
|
|
1203
1238
|
},
|
|
1204
1239
|
resolvePeerStream: (o) => e.resolve(v(o)),
|
|
1205
|
-
subscribePeerStream: (o,
|
|
1240
|
+
subscribePeerStream: (o, c) => e.subscribe(v(o), c),
|
|
1206
1241
|
registry: e
|
|
1207
1242
|
};
|
|
1208
1243
|
}
|
|
1209
|
-
function
|
|
1244
|
+
function Rt(t) {
|
|
1210
1245
|
if ("rooms" in t && Array.isArray(t.rooms))
|
|
1211
|
-
return
|
|
1246
|
+
return G(t);
|
|
1212
1247
|
const { name: e, deps: s, ...n } = t;
|
|
1213
|
-
return
|
|
1248
|
+
return G({
|
|
1214
1249
|
rooms: [{ ...n, ...e !== void 0 ? { name: e } : {} }],
|
|
1215
1250
|
...s !== void 0 ? { deps: s } : {}
|
|
1216
1251
|
});
|
|
1217
1252
|
}
|
|
1218
|
-
const
|
|
1253
|
+
const at = { width: 1920, height: 1080 }, ct = () => {
|
|
1219
1254
|
};
|
|
1220
|
-
function
|
|
1221
|
-
const e = t.stage ??
|
|
1255
|
+
function It(t) {
|
|
1256
|
+
const e = t.stage ?? at, s = t.target;
|
|
1222
1257
|
s.style.position ||= "relative", s.style.width = `${e.width}px`, s.style.height = `${e.height}px`, s.style.overflow = "hidden";
|
|
1223
|
-
const n = t.onDiagnostic ?
|
|
1258
|
+
const n = t.onDiagnostic ? Y(t.onDiagnostic) : void 0, r = ee();
|
|
1224
1259
|
r.reset(t.defaults ?? {});
|
|
1225
|
-
const i =
|
|
1260
|
+
const i = X(s);
|
|
1226
1261
|
return {
|
|
1227
1262
|
ready: new Promise((o) => {
|
|
1228
|
-
import("./broadcast-
|
|
1263
|
+
import("./broadcast-Dg77Br5j.js").then(({ BroadcastMode: c }) => {
|
|
1229
1264
|
i.render(
|
|
1230
|
-
/* @__PURE__ */
|
|
1231
|
-
|
|
1265
|
+
/* @__PURE__ */ p(de, { children: /* @__PURE__ */ p(
|
|
1266
|
+
J,
|
|
1232
1267
|
{
|
|
1233
1268
|
value: {
|
|
1234
1269
|
mode: "broadcast",
|
|
1235
1270
|
store: r,
|
|
1236
1271
|
bundle: t.bundle,
|
|
1237
1272
|
status: "live",
|
|
1238
|
-
sendInput:
|
|
1273
|
+
sendInput: ct
|
|
1239
1274
|
},
|
|
1240
|
-
children: /* @__PURE__ */
|
|
1275
|
+
children: /* @__PURE__ */ p(c, {})
|
|
1241
1276
|
}
|
|
1242
1277
|
) })
|
|
1243
1278
|
);
|
|
1244
|
-
const
|
|
1245
|
-
requestAnimationFrame(() => requestAnimationFrame(() =>
|
|
1279
|
+
const l = new Promise((h) => {
|
|
1280
|
+
requestAnimationFrame(() => requestAnimationFrame(() => h()));
|
|
1246
1281
|
}), d = typeof document < "u" && document.fonts ? document.fonts.ready.then(() => {
|
|
1247
1282
|
}) : Promise.resolve();
|
|
1248
|
-
Promise.all([
|
|
1283
|
+
Promise.all([l, d]).then(() => o());
|
|
1249
1284
|
});
|
|
1250
1285
|
}),
|
|
1251
1286
|
unmount() {
|
|
@@ -1253,30 +1288,30 @@ function _t(t) {
|
|
|
1253
1288
|
}
|
|
1254
1289
|
};
|
|
1255
1290
|
}
|
|
1256
|
-
function
|
|
1291
|
+
function re(t, e) {
|
|
1257
1292
|
if (typeof t != "string") return t;
|
|
1258
1293
|
if (e[t]) return e[t];
|
|
1259
1294
|
const s = /^assets\/([A-Za-z0-9]+)\.[A-Za-z0-9]+$/.exec(t);
|
|
1260
1295
|
return s && s[1] !== void 0 && e[s[1]] ? e[s[1]] : t;
|
|
1261
1296
|
}
|
|
1262
|
-
function
|
|
1297
|
+
function V(t, e) {
|
|
1263
1298
|
if (t === null || typeof t != "object") return;
|
|
1264
1299
|
if (Array.isArray(t)) {
|
|
1265
|
-
for (const n of t)
|
|
1300
|
+
for (const n of t) V(n, e);
|
|
1266
1301
|
return;
|
|
1267
1302
|
}
|
|
1268
1303
|
const s = t;
|
|
1269
|
-
"src" in s && (s.src =
|
|
1304
|
+
"src" in s && (s.src = re(s.src, e));
|
|
1270
1305
|
for (const n of Object.values(s))
|
|
1271
|
-
n && typeof n == "object" &&
|
|
1306
|
+
n && typeof n == "object" && V(n, e);
|
|
1272
1307
|
}
|
|
1273
|
-
function
|
|
1308
|
+
function At(t, e) {
|
|
1274
1309
|
const s = { ...t };
|
|
1275
1310
|
for (const [n, r] of Object.entries(s))
|
|
1276
|
-
n.startsWith("__lit.image.") && (s[n] =
|
|
1311
|
+
n.startsWith("__lit.image.") && (s[n] = re(r, e));
|
|
1277
1312
|
return s;
|
|
1278
1313
|
}
|
|
1279
|
-
async function
|
|
1314
|
+
async function Ot(t) {
|
|
1280
1315
|
const e = [];
|
|
1281
1316
|
for (const s of t)
|
|
1282
1317
|
try {
|
|
@@ -1290,38 +1325,38 @@ async function Rt(t) {
|
|
|
1290
1325
|
return e;
|
|
1291
1326
|
}
|
|
1292
1327
|
export {
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1328
|
+
Ee as A,
|
|
1329
|
+
W as B,
|
|
1330
|
+
kt as C,
|
|
1331
|
+
wt as F,
|
|
1332
|
+
te as M,
|
|
1333
|
+
nt as P,
|
|
1334
|
+
Be as S,
|
|
1335
|
+
vt as a,
|
|
1336
|
+
_t as b,
|
|
1337
|
+
D as c,
|
|
1338
|
+
A as d,
|
|
1339
|
+
Z as e,
|
|
1340
|
+
Q as f,
|
|
1341
|
+
Y as g,
|
|
1342
|
+
G as h,
|
|
1343
|
+
se as i,
|
|
1344
|
+
Et as j,
|
|
1345
|
+
Rt as k,
|
|
1346
|
+
Ot as l,
|
|
1347
|
+
St as m,
|
|
1348
|
+
Ve as n,
|
|
1349
|
+
U as o,
|
|
1350
|
+
Tt as p,
|
|
1351
|
+
It as q,
|
|
1352
|
+
bt as r,
|
|
1353
|
+
Le as s,
|
|
1354
|
+
yt as t,
|
|
1355
|
+
gt as u,
|
|
1356
|
+
re as v,
|
|
1357
|
+
Me as w,
|
|
1358
|
+
At as x,
|
|
1359
|
+
V as y,
|
|
1360
|
+
q as z
|
|
1326
1361
|
};
|
|
1327
|
-
//# sourceMappingURL=index-
|
|
1362
|
+
//# sourceMappingURL=index-C4r-fG1q.js.map
|