@pollen-robotics/reachy-mini-sdk 1.10.0-dev.0.main.9f78da7 → 1.10.0-dev.0.main.c8367cd

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 (121) hide show
  1. package/APP_CREATION_GUIDE.md +98 -0
  2. package/dist/lib/central-listener.d.ts +71 -0
  3. package/dist/lib/central-listener.d.ts.map +1 -0
  4. package/dist/lib/central-listener.js +277 -0
  5. package/dist/lib/central-listener.js.map +1 -0
  6. package/dist/lib/central-listener.test.d.ts +2 -0
  7. package/dist/lib/central-listener.test.d.ts.map +1 -0
  8. package/dist/lib/central-listener.test.js +378 -0
  9. package/dist/lib/central-listener.test.js.map +1 -0
  10. package/dist/lib/dc-watchdog.test.d.ts +2 -0
  11. package/dist/lib/dc-watchdog.test.d.ts.map +1 -0
  12. package/dist/lib/dc-watchdog.test.js +154 -0
  13. package/dist/lib/dc-watchdog.test.js.map +1 -0
  14. package/dist/lib/ensure-awake.test.d.ts +2 -0
  15. package/dist/lib/ensure-awake.test.d.ts.map +1 -0
  16. package/dist/lib/ensure-awake.test.js +117 -0
  17. package/dist/lib/ensure-awake.test.js.map +1 -0
  18. package/dist/lib/ice-grace.test.d.ts +2 -0
  19. package/dist/lib/ice-grace.test.d.ts.map +1 -0
  20. package/dist/lib/ice-grace.test.js +211 -0
  21. package/dist/lib/ice-grace.test.js.map +1 -0
  22. package/dist/lib/imu.test.d.ts +2 -0
  23. package/dist/lib/imu.test.d.ts.map +1 -0
  24. package/dist/lib/imu.test.js +78 -0
  25. package/dist/lib/imu.test.js.map +1 -0
  26. package/dist/lib/logger.d.ts +38 -0
  27. package/dist/lib/logger.d.ts.map +1 -0
  28. package/dist/lib/logger.js +81 -0
  29. package/dist/lib/logger.js.map +1 -0
  30. package/dist/lib/pending-replies.d.ts +127 -0
  31. package/dist/lib/pending-replies.d.ts.map +1 -0
  32. package/dist/lib/pending-replies.js +255 -0
  33. package/dist/lib/pending-replies.js.map +1 -0
  34. package/dist/lib/pending-replies.test.d.ts +2 -0
  35. package/dist/lib/pending-replies.test.d.ts.map +1 -0
  36. package/dist/lib/pending-replies.test.js +217 -0
  37. package/dist/lib/pending-replies.test.js.map +1 -0
  38. package/dist/lib/reachy-mini.d.ts +118 -94
  39. package/dist/lib/reachy-mini.d.ts.map +1 -1
  40. package/dist/lib/reachy-mini.js +427 -690
  41. package/dist/lib/reachy-mini.js.map +1 -1
  42. package/dist/lib/redial.test.d.ts +2 -0
  43. package/dist/lib/redial.test.d.ts.map +1 -0
  44. package/dist/lib/redial.test.js +206 -0
  45. package/dist/lib/redial.test.js.map +1 -0
  46. package/dist/lib/request.test.d.ts +2 -0
  47. package/dist/lib/request.test.d.ts.map +1 -0
  48. package/dist/lib/request.test.js +90 -0
  49. package/dist/lib/request.test.js.map +1 -0
  50. package/dist/lib/session-supervisor.d.ts +201 -0
  51. package/dist/lib/session-supervisor.d.ts.map +1 -0
  52. package/dist/lib/session-supervisor.js +520 -0
  53. package/dist/lib/session-supervisor.js.map +1 -0
  54. package/dist/lib/token-store.d.ts +50 -0
  55. package/dist/lib/token-store.d.ts.map +1 -0
  56. package/dist/lib/token-store.js +120 -0
  57. package/dist/lib/token-store.js.map +1 -0
  58. package/dist/lib/token-store.test.d.ts +2 -0
  59. package/dist/lib/token-store.test.d.ts.map +1 -0
  60. package/dist/lib/token-store.test.js +82 -0
  61. package/dist/lib/token-store.test.js.map +1 -0
  62. package/dist/lib/types.d.ts +261 -6
  63. package/dist/lib/types.d.ts.map +1 -1
  64. package/dist/lib/url-helpers.d.ts.map +1 -1
  65. package/dist/lib/url-helpers.js +3 -1
  66. package/dist/lib/url-helpers.js.map +1 -1
  67. package/dist/lib/version.d.ts +2 -0
  68. package/dist/lib/version.d.ts.map +1 -0
  69. package/dist/lib/version.js +5 -0
  70. package/dist/lib/version.js.map +1 -0
  71. package/dist/reachy-mini-sdk.d.ts +15 -1
  72. package/dist/reachy-mini-sdk.d.ts.map +1 -1
  73. package/dist/reachy-mini-sdk.js +12 -0
  74. package/dist/reachy-mini-sdk.js.map +1 -1
  75. package/host/dist/ReachyHost.d.ts.map +1 -1
  76. package/host/dist/chunks/centralRest-uXNMidlL.js +2315 -0
  77. package/host/dist/chunks/index-Beu4GNzi.js +821 -0
  78. package/host/dist/chunks/{mountHost-DztGlWwu.js → mountHost-BTTF4Uu9.js} +26739 -29305
  79. package/host/dist/components/DaemonUpdateGate.d.ts +65 -0
  80. package/host/dist/components/DaemonUpdateGate.d.ts.map +1 -0
  81. package/host/dist/components/ErrorView.d.ts.map +1 -1
  82. package/host/dist/components/HostErrorBoundary.d.ts +30 -0
  83. package/host/dist/components/HostErrorBoundary.d.ts.map +1 -0
  84. package/host/dist/components/PickerView.d.ts +16 -14
  85. package/host/dist/components/PickerView.d.ts.map +1 -1
  86. package/host/dist/components/PostOAuthSplash.d.ts +14 -9
  87. package/host/dist/components/PostOAuthSplash.d.ts.map +1 -1
  88. package/host/dist/components/ReachyHostShell.d.ts.map +1 -1
  89. package/host/dist/components/SignInView.d.ts.map +1 -1
  90. package/host/dist/components/TopBar.d.ts +5 -6
  91. package/host/dist/components/TopBar.d.ts.map +1 -1
  92. package/host/dist/embed/index.d.ts +8 -5
  93. package/host/dist/embed/index.d.ts.map +1 -1
  94. package/host/dist/entry/auto.js +2 -2
  95. package/host/dist/entry/embed.js +2 -2
  96. package/host/dist/hooks/useHostBridge.d.ts +35 -1
  97. package/host/dist/hooks/useHostBridge.d.ts.map +1 -1
  98. package/host/dist/hooks/useLatestDaemonVersion.d.ts +7 -0
  99. package/host/dist/hooks/useLatestDaemonVersion.d.ts.map +1 -0
  100. package/host/dist/hooks/useOAuth.d.ts +18 -0
  101. package/host/dist/hooks/useOAuth.d.ts.map +1 -1
  102. package/host/dist/hooks/useRobots.d.ts +0 -2
  103. package/host/dist/hooks/useRobots.d.ts.map +1 -1
  104. package/host/dist/index.js +3 -3
  105. package/host/dist/lib/daemonRelease.d.ts +84 -0
  106. package/host/dist/lib/daemonRelease.d.ts.map +1 -0
  107. package/host/dist/lib/protocol.d.ts +141 -7
  108. package/host/dist/lib/protocol.d.ts.map +1 -1
  109. package/host/dist/lib/rebootWatch.d.ts +51 -0
  110. package/host/dist/lib/rebootWatch.d.ts.map +1 -0
  111. package/host/dist/lib/sdk-types.d.ts +1 -1
  112. package/host/dist/lib/sdk-types.d.ts.map +1 -1
  113. package/host/dist/lib/sdkStaleness.d.ts +78 -0
  114. package/host/dist/lib/sdkStaleness.d.ts.map +1 -0
  115. package/host/dist/lib/settings.d.ts +16 -5
  116. package/host/dist/lib/settings.d.ts.map +1 -1
  117. package/package.json +9 -2
  118. package/host/dist/chunks/index-rW7LY0k3.js +0 -530
  119. package/host/dist/chunks/reachy-mini-DblK_lhG.js +0 -1749
  120. package/host/dist/lib/centralListener.d.ts +0 -73
  121. package/host/dist/lib/centralListener.d.ts.map +0 -1
@@ -1,530 +0,0 @@
1
- import { decodeCredsFromHash as M, PROTOCOL_VERSION as g, PROTOCOL_SOURCE as w, isProtocolMessage as O } from "../lib/protocol.js";
2
- const L = 8e3, P = 2e3, U = 900 * 1e3;
3
- let k = null, T = null, S = "*";
4
- function R() {
5
- try {
6
- if (typeof document < "u" && document.referrer)
7
- return new URL(document.referrer).origin;
8
- } catch {
9
- }
10
- return "*";
11
- }
12
- async function B(t = {}) {
13
- return k || (k = A(t)), await k;
14
- }
15
- async function z(t = {}) {
16
- return T || (T = D(t)), await T;
17
- }
18
- async function A(t) {
19
- S = R();
20
- const r = t.expectedOrigin ?? S, n = M(window.location.hash);
21
- if (H(), !n)
22
- throw new Error(
23
- "[reachy-mini-sdk/host/embed] no creds bundle found in URL hash. Was the embed mounted directly without ?embedded=1#creds=...?"
24
- );
25
- if (!await F(L))
26
- throw new Error(
27
- `[reachy-mini-sdk/host/embed] window.ReachyMini did not become available within ${L}ms - check the SDK CDN tag.`
28
- );
29
- const e = n.userName ?? n.username ?? null;
30
- n.hfToken && e && j(n.hfToken, e);
31
- const a = new window.ReachyMini({
32
- appName: n.appName,
33
- signalingUrl: n.signalingUrl,
34
- ...t.sdkOptions
35
- }), d = C(r);
36
- b({
37
- source: w,
38
- type: "embed:ready",
39
- version: g
40
- }), d.start();
41
- const u = await d.awaitHostInit(P, n);
42
- y("connecting", "link"), p("boot:link:start", { robotPeerId: u.robotPeerId }), await a.authenticate(), p("boot:authenticate:ok", { state: a.state }), await a.connect(), p("boot:connect:ok", {
43
- state: a.state,
44
- robots: (a.robots ?? []).length
45
- }), y("connecting", "session"), p("boot:session:start", { robotPeerId: u.robotPeerId }), $(a);
46
- try {
47
- await a.startSession(u.robotPeerId), p("boot:session:ok");
48
- } catch (l) {
49
- throw p("boot:session:error", {
50
- message: l?.message ?? String(l)
51
- }), l;
52
- }
53
- return y("connecting", "wake"), p("boot:wake:start"), await a.ensureAwake(), p("boot:wake:ok"), d.attachPageHide(a), y("live", null), K(a), d.buildHandle(a, u);
54
- }
55
- async function D(t) {
56
- S = R();
57
- const r = t.expectedOrigin ?? S, n = M(window.location.hash);
58
- if (H(), !n)
59
- throw new Error(
60
- "[reachy-mini-sdk/host/embed] no creds bundle found in URL hash. Was the embed mounted directly without ?embedded=1#creds=...?"
61
- );
62
- const c = C(r);
63
- b({
64
- source: w,
65
- type: "embed:ready",
66
- version: g
67
- }), c.start();
68
- const e = await c.awaitHostInit(P, n);
69
- return c.attachPageHideCredsOnly(), y("live", null), c.buildCredsOnlyHandle(e, n);
70
- }
71
- function E(t) {
72
- return {
73
- theme: t.theme,
74
- config: t.config,
75
- appName: t.appName,
76
- hostName: t.hostName,
77
- userName: t.userName ?? null,
78
- robotPeerId: t.robotPeerId
79
- };
80
- }
81
- function _(t) {
82
- return {
83
- theme: t.theme,
84
- config: t.config,
85
- appName: t.appName,
86
- hostName: t.hostName,
87
- userName: t.userName ?? null,
88
- robotPeerId: t.robotPeerId
89
- };
90
- }
91
- function C(t) {
92
- const r = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set();
93
- let e = null, a = !1, d = !1, u = null;
94
- function l(o) {
95
- switch (o.type) {
96
- case "host:init": {
97
- e = _(o), n.forEach((i) => i(e.theme)), c.forEach((i) => i(e.config));
98
- break;
99
- }
100
- case "host:theme-changed": {
101
- e && (e.theme = o.theme), n.forEach((i) => i(o.theme));
102
- break;
103
- }
104
- case "host:config-changed": {
105
- e && (e.config = o.config), c.forEach((i) => i(o.config));
106
- break;
107
- }
108
- case "host:leaving": {
109
- s();
110
- break;
111
- }
112
- }
113
- }
114
- function s() {
115
- a || (a = !0, r.forEach((o) => {
116
- try {
117
- o();
118
- } catch (i) {
119
- console.warn("[reachy-mini-sdk/host/embed] onLeave threw", i);
120
- }
121
- }));
122
- }
123
- return {
124
- start() {
125
- d || (d = !0, u = (o) => {
126
- t !== "*" && o.origin !== t || O(o.data) && l(o.data);
127
- }, window.addEventListener("message", u));
128
- },
129
- async awaitHostInit(o, i) {
130
- return window.parent !== window ? e || new Promise((h) => {
131
- const m = (I) => {
132
- if (t !== "*" && I.origin !== t || !O(I.data)) return;
133
- const N = I.data;
134
- N.type === "host:init" && (window.removeEventListener("message", m), window.clearTimeout(v), e = _(N), h(e));
135
- }, v = window.setTimeout(() => {
136
- window.removeEventListener("message", m), e || (e = E(i)), h(e);
137
- }, o);
138
- window.addEventListener("message", m);
139
- }) : (e = E(i), e);
140
- },
141
- attachPageHide(o) {
142
- const i = () => {
143
- s();
144
- try {
145
- o.stopSession();
146
- } catch {
147
- }
148
- };
149
- window.addEventListener("pagehide", i, { once: !0 });
150
- },
151
- /** Credentials-only variant — no SDK to stop; just fire onLeave. */
152
- attachPageHideCredsOnly() {
153
- window.addEventListener("pagehide", s, { once: !0 });
154
- },
155
- /**
156
- * Build the credentials-only handle. Same lifecycle accessors as
157
- * `buildHandle` but exposes `hfToken` / `robotPeerId` /
158
- * `signalingUrl` (from the creds bundle) instead of a `reachy`
159
- * SDK instance, so the embed app can forward those to its
160
- * backend.
161
- */
162
- buildCredsOnlyHandle(o, i) {
163
- if (e = o, !i.hfToken)
164
- throw new Error(
165
- "[reachy-mini-sdk/host/embed] creds-only handle requires hfToken; the host shell did not provide one (visitor logged out?)."
166
- );
167
- return {
168
- hfToken: i.hfToken,
169
- robotPeerId: o.robotPeerId,
170
- signalingUrl: i.signalingUrl,
171
- get theme() {
172
- return e.theme;
173
- },
174
- get config() {
175
- return e.config;
176
- },
177
- get appName() {
178
- return e.appName;
179
- },
180
- get hostName() {
181
- return e.hostName;
182
- },
183
- get userName() {
184
- return e.userName;
185
- },
186
- onLeave(f) {
187
- return r.add(f), () => r.delete(f);
188
- },
189
- onThemeChange(f) {
190
- return n.add(f), () => n.delete(f);
191
- },
192
- onConfigChange(f) {
193
- const h = (m) => f(m);
194
- return c.add(h), () => c.delete(h);
195
- },
196
- setAppState(f) {
197
- y(
198
- f.phase,
199
- f.connectingStep ?? null,
200
- f.message ?? null
201
- );
202
- },
203
- requestLeave() {
204
- b({
205
- source: w,
206
- type: "embed:request-leave",
207
- version: g
208
- });
209
- },
210
- reportError(f, h) {
211
- b({
212
- source: w,
213
- type: "embed:error",
214
- version: g,
215
- message: f,
216
- fatal: h?.fatal === !0,
217
- detail: h?.detail
218
- });
219
- }
220
- };
221
- },
222
- buildHandle(o, i) {
223
- e = i;
224
- const f = W(o);
225
- return {
226
- reachy: o,
227
- media: f,
228
- get theme() {
229
- return e.theme;
230
- },
231
- get config() {
232
- return e.config;
233
- },
234
- get appName() {
235
- return e.appName;
236
- },
237
- get hostName() {
238
- return e.hostName;
239
- },
240
- get userName() {
241
- return e.userName;
242
- },
243
- onLeave(h) {
244
- return r.add(h), () => r.delete(h);
245
- },
246
- onThemeChange(h) {
247
- return n.add(h), () => n.delete(h);
248
- },
249
- onConfigChange(h) {
250
- const m = (v) => h(v);
251
- return c.add(m), () => c.delete(m);
252
- },
253
- setAppState(h) {
254
- y(
255
- h.phase,
256
- h.connectingStep ?? null,
257
- h.message ?? null
258
- );
259
- },
260
- requestLeave() {
261
- b({
262
- source: w,
263
- type: "embed:request-leave",
264
- version: g
265
- });
266
- },
267
- reportError(h, m) {
268
- b({
269
- source: w,
270
- type: "embed:error",
271
- version: g,
272
- message: h,
273
- fatal: m?.fatal === !0,
274
- detail: m?.detail
275
- });
276
- }
277
- };
278
- }
279
- };
280
- }
281
- function H() {
282
- try {
283
- const t = window.location.pathname + window.location.search;
284
- history.replaceState(history.state, document.title, t);
285
- } catch {
286
- }
287
- }
288
- function j(t, r) {
289
- try {
290
- sessionStorage.setItem("hf_token", t), sessionStorage.setItem("hf_username", r), sessionStorage.setItem(
291
- "hf_token_expires",
292
- new Date(Date.now() + U).toISOString()
293
- );
294
- } catch {
295
- }
296
- }
297
- function F(t) {
298
- return new Promise((r) => {
299
- if (typeof window > "u") {
300
- r(!1);
301
- return;
302
- }
303
- if (window.ReachyMini) {
304
- r(!0);
305
- return;
306
- }
307
- let n = !1;
308
- const c = () => {
309
- n || (n = !0, window.removeEventListener("reachymini:ready", c), window.clearTimeout(e), r(!!window.ReachyMini));
310
- }, e = window.setTimeout(() => {
311
- n || (n = !0, window.removeEventListener("reachymini:ready", c), r(!1));
312
- }, t);
313
- window.addEventListener("reachymini:ready", c);
314
- });
315
- }
316
- function b(t) {
317
- if (!(typeof window > "u"))
318
- try {
319
- window.parent.postMessage(t, S);
320
- } catch (r) {
321
- console.warn("[reachy-mini-sdk/host/embed] postMessage to host failed", r);
322
- }
323
- }
324
- function y(t, r, n = null, c = null) {
325
- b({
326
- source: w,
327
- type: "embed:app-state",
328
- version: g,
329
- phase: t,
330
- connectingStep: r,
331
- message: n,
332
- rttMs: c
333
- });
334
- }
335
- const V = 1500, q = 6;
336
- async function J(t) {
337
- try {
338
- const r = await t.getStats();
339
- let n = null;
340
- return r.forEach((c) => {
341
- const e = c;
342
- e.type !== "candidate-pair" || !(e.selected === !0 || e.nominated === !0 && e.state === "succeeded") || typeof e.currentRoundTripTime == "number" && (n = e.currentRoundTripTime * 1e3);
343
- }), n;
344
- } catch {
345
- return null;
346
- }
347
- }
348
- function K(t) {
349
- if (typeof window > "u") return;
350
- const r = t._pc;
351
- if (!r) return;
352
- const n = [];
353
- let c = !1;
354
- const e = async () => {
355
- if (c) return;
356
- const u = await J(r);
357
- u !== null && (n.push(u), n.length > q && n.shift(), y("live", null, null, Math.min(...n)));
358
- }, a = window.setInterval(() => {
359
- e();
360
- }, V);
361
- window.setTimeout(() => {
362
- e();
363
- }, 600);
364
- const d = () => {
365
- c || (c = !0, window.clearInterval(a));
366
- };
367
- try {
368
- t.addEventListener("sessionStopped", d);
369
- } catch {
370
- }
371
- window.addEventListener("pagehide", d, { once: !0 });
372
- }
373
- function p(t, r = {}) {
374
- if (!(typeof window > "u")) {
375
- try {
376
- window.parent.postMessage(
377
- {
378
- source: w,
379
- type: "embed:debug",
380
- version: g,
381
- tag: t,
382
- payload: r
383
- },
384
- S
385
- );
386
- } catch {
387
- }
388
- try {
389
- let n = "";
390
- try {
391
- n = JSON.stringify(r);
392
- } catch {
393
- n = "<unserializable>";
394
- }
395
- console.info(`[embed-debug] ${t} ${n}`);
396
- } catch {
397
- }
398
- }
399
- }
400
- function W(t) {
401
- let r = null;
402
- const n = t, c = () => {
403
- const d = n._pc;
404
- if (!d) return null;
405
- const u = d.getReceivers().map((l) => l.track).filter(
406
- (l) => l !== null && l.kind !== "" && l.readyState === "live"
407
- );
408
- return u.length === 0 ? null : new MediaStream(u);
409
- }, e = () => r || (r = c(), r && p("media:cache:init", {
410
- videoTracks: r.getVideoTracks().length,
411
- audioTracks: r.getAudioTracks().length
412
- }), r), a = () => {
413
- r && (r = null, p("media:cache:clear"));
414
- };
415
- return t.addEventListener("sessionStopped", a), {
416
- attachVideo(d) {
417
- const u = t.attachVideo(d), l = e();
418
- if (l && d.srcObject !== l)
419
- try {
420
- d.srcObject = l, d.play().catch(() => {
421
- }), p("media:attach:replay", {
422
- videoTracks: l.getVideoTracks().length,
423
- audioTracks: l.getAudioTracks().length
424
- });
425
- } catch (s) {
426
- p("media:attach:replay:error", {
427
- message: s?.message ?? String(s)
428
- });
429
- }
430
- return u;
431
- },
432
- get robotStream() {
433
- return e();
434
- },
435
- get micStream() {
436
- return n._micStream;
437
- }
438
- };
439
- }
440
- function $(t) {
441
- const r = [
442
- "connected",
443
- "disconnected",
444
- "streaming",
445
- "sessionStopped",
446
- "sessionRejected",
447
- "robotsChanged",
448
- "error",
449
- "state",
450
- "log",
451
- "message"
452
- ];
453
- for (const e of r)
454
- try {
455
- t.addEventListener(e, (a) => {
456
- let d = {};
457
- const u = a;
458
- if (u && typeof u == "object" && "detail" in u)
459
- try {
460
- d = JSON.parse(JSON.stringify(u.detail ?? null));
461
- } catch {
462
- d = { _unserializable: !0 };
463
- }
464
- p(`sdk:${e}`, d);
465
- });
466
- } catch {
467
- }
468
- try {
469
- const e = t, a = e._handleSignalingMessage;
470
- if (typeof a == "function") {
471
- const d = e._sendToServer;
472
- typeof d == "function" && (e._sendToServer = async function(l) {
473
- const s = l, o = { type: s?.type ?? "?" };
474
- if (s && "peerId" in s && (o.peerId = String(s.peerId)), s && "sessionId" in s && (o.sessionId = String(s.sessionId)), s && "sdp" in s) {
475
- const i = s.sdp;
476
- o.sdpType = i?.type ?? "?", o.sdpLen = i?.sdp?.length ?? 0;
477
- }
478
- if (s && "ice" in s) {
479
- const i = s.ice;
480
- o.iceCand = (i?.candidate ?? "").slice(0, 60) || "<end-of-candidates>";
481
- }
482
- p("sdk:send", o);
483
- try {
484
- const i = await d.call(this, l), f = i;
485
- return p("sdk:send:res", {
486
- inFor: o.type,
487
- resType: f?.type ?? null,
488
- keys: f ? Object.keys(f) : []
489
- }), i;
490
- } catch (i) {
491
- throw p("sdk:send:err", {
492
- inFor: o.type,
493
- msg: i?.message ?? String(i)
494
- }), i;
495
- }
496
- }), e._handleSignalingMessage = function(l) {
497
- const s = l, o = { type: s?.type ?? "?" };
498
- if ("sessionId" in s && (o.sessionId = String(s.sessionId)), "peerId" in s && (o.peerId = String(s.peerId)), "sdp" in s) {
499
- const i = s.sdp;
500
- o.sdpType = i?.type ?? "?", o.sdpLen = i?.sdp?.length ?? 0;
501
- }
502
- if ("ice" in s) {
503
- const i = s.ice;
504
- o.iceCand = (i?.candidate ?? "").slice(0, 60) || "<end-of-candidates>";
505
- }
506
- return "reason" in s && (o.reason = String(s.reason)), p("sdk:sse", o), a.call(this, l);
507
- };
508
- }
509
- } catch {
510
- }
511
- const n = Date.now(), c = window.setInterval(() => {
512
- const e = t, a = e._pc, d = e._dc;
513
- p("sdk:probe", {
514
- elapsedMs: Date.now() - n,
515
- myPeerId: e._peerId ?? null,
516
- state: e._state ?? null,
517
- sseAborted: e._sseAbortController?.signal?.aborted ?? null,
518
- pcState: a?.connectionState ?? null,
519
- iceState: a?.iceConnectionState ?? null,
520
- iceGather: a?.iceGatheringState ?? null,
521
- signalingState: a?.signalingState ?? null,
522
- dcState: d?.readyState ?? null,
523
- sessionId: e._sessionId ?? null
524
- }), Date.now() - n > 3e4 && window.clearInterval(c);
525
- }, 1500);
526
- }
527
- export {
528
- z as a,
529
- B as c
530
- };