vue-streaming 0.1.4 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +425 -699
  2. package/dist/WebSocketStream.vue_vue_type_script_setup_true_lang-C_F2vNNk.js +1081 -0
  3. package/dist/WebSocketStream.vue_vue_type_script_setup_true_lang-C_F2vNNk.js.map +1 -0
  4. package/dist/WebSocketStream.vue_vue_type_script_setup_true_lang-EzMJEQkx.cjs +2 -0
  5. package/dist/WebSocketStream.vue_vue_type_script_setup_true_lang-EzMJEQkx.cjs.map +1 -0
  6. package/dist/components/index.cjs +2 -0
  7. package/dist/components/index.cjs.map +1 -0
  8. package/dist/components/index.js +15 -0
  9. package/dist/components/index.js.map +1 -0
  10. package/dist/composables/index.cjs +2 -0
  11. package/dist/composables/index.cjs.map +1 -0
  12. package/dist/composables/index.js +15 -0
  13. package/dist/composables/index.js.map +1 -0
  14. package/dist/index.cjs +1 -3
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.js +62 -2
  17. package/dist/index.js.map +1 -1
  18. package/dist/types.cjs +2 -0
  19. package/dist/types.cjs.map +1 -0
  20. package/dist/types.js +2 -0
  21. package/dist/types.js.map +1 -0
  22. package/dist/usePointCloud-D0qcpYFY.js +115 -0
  23. package/dist/usePointCloud-D0qcpYFY.js.map +1 -0
  24. package/dist/usePointCloud-D2csBAs8.cjs +2 -0
  25. package/dist/usePointCloud-D2csBAs8.cjs.map +1 -0
  26. package/dist/useWebSocket-7-qar6to.cjs +4 -0
  27. package/dist/useWebSocket-7-qar6to.cjs.map +1 -0
  28. package/dist/useWebSocket-CrE6QkTW.js +1278 -0
  29. package/dist/useWebSocket-CrE6QkTW.js.map +1 -0
  30. package/dist/utils/index.cjs +2 -0
  31. package/dist/utils/index.cjs.map +1 -0
  32. package/dist/utils/index.js +503 -0
  33. package/dist/utils/index.js.map +1 -0
  34. package/dist/vue-streaming.css +1 -0
  35. package/package.json +126 -69
  36. package/dist/index.d.cts +0 -49
  37. package/dist/index.d.ts +0 -49
  38. package/dist/index.global.js +0 -8
  39. package/dist/index.global.js.map +0 -1
@@ -0,0 +1,1081 @@
1
+ import { defineComponent as T, ref as H, watch as L, computed as O, onMounted as U, createElementBlock as b, openBlock as w, createElementVNode as _, createCommentVNode as E, normalizeClass as G, unref as t, toDisplayString as x, Fragment as J, renderList as Q, onUnmounted as Z, normalizeStyle as ee, renderSlot as M, toRefs as I } from "vue";
2
+ import { a as te, g as ne, u as oe, b as se, c as re, d as ae, f as ie, e as le, h as ce } from "./useWebSocket-CrE6QkTW.js";
3
+ const ue = { class: "hls-player" }, de = { class: "hls-player__video-container" }, pe = ["controls", "muted", "loop", "poster"], me = {
4
+ key: 0,
5
+ class: "hls-player__overlay"
6
+ }, fe = {
7
+ key: 1,
8
+ class: "hls-player__overlay hls-player__overlay--error"
9
+ }, ve = { class: "hls-player__error" }, _e = {
10
+ key: 0,
11
+ class: "hls-player__controls"
12
+ }, ye = { class: "hls-player__quality" }, he = ["value"], ge = ["value"], be = { class: "hls-player__stats" }, we = { key: 0 }, Ce = /* @__PURE__ */ T({
13
+ __name: "HLSPlayer",
14
+ props: {
15
+ src: {},
16
+ autoPlay: { type: Boolean, default: !0 },
17
+ controls: { type: Boolean, default: !0 },
18
+ muted: { type: Boolean, default: !1 },
19
+ loop: { type: Boolean, default: !1 },
20
+ poster: {},
21
+ lowLatency: { type: Boolean, default: !1 },
22
+ startLevel: { default: -1 },
23
+ videoClass: {}
24
+ },
25
+ emits: ["ready", "play", "pause", "ended", "error", "levelChange", "timeUpdate", "stateChange"],
26
+ setup(C, { expose: R, emit: S }) {
27
+ const e = C, o = S, v = H(null), y = {
28
+ url: e.src,
29
+ autoPlay: e.autoPlay,
30
+ lowLatencyMode: e.lowLatency,
31
+ startLevel: e.startLevel
32
+ }, g = {
33
+ onManifestLoaded: (k) => {
34
+ o("ready");
35
+ },
36
+ onLevelSwitched: (k) => {
37
+ o("levelChange", k);
38
+ },
39
+ onPlaybackStarted: () => {
40
+ o("play");
41
+ },
42
+ onPlaybackEnded: () => {
43
+ o("ended");
44
+ },
45
+ onError: (k) => {
46
+ o("error", k);
47
+ }
48
+ }, {
49
+ state: i,
50
+ isPlaying: u,
51
+ isBuffering: f,
52
+ levels: r,
53
+ currentLevel: l,
54
+ autoLevelEnabled: d,
55
+ currentTime: p,
56
+ duration: c,
57
+ buffered: n,
58
+ volume: s,
59
+ muted: a,
60
+ stats: B,
61
+ error: m,
62
+ isSupported: h,
63
+ attach: A,
64
+ play: j,
65
+ pause: P,
66
+ stop: $,
67
+ seek: D,
68
+ setLevel: q,
69
+ setVolume: K,
70
+ toggleMute: X,
71
+ destroy: Y
72
+ } = te(y, g);
73
+ L(i, (k) => {
74
+ o("stateChange", k);
75
+ }), L(p, (k) => {
76
+ o("timeUpdate", k);
77
+ });
78
+ function N(k) {
79
+ if (!isFinite(k)) return "0:00";
80
+ const F = Math.floor(k / 60), z = Math.floor(k % 60);
81
+ return `${F}:${z.toString().padStart(2, "0")}`;
82
+ }
83
+ const V = O(() => l.value < 0 || l.value >= r.value.length ? null : r.value[l.value]);
84
+ return U(async () => {
85
+ if (v.value)
86
+ try {
87
+ await A(v.value);
88
+ } catch (k) {
89
+ console.error("[HLSPlayer] Failed to attach:", k);
90
+ }
91
+ }), L(
92
+ () => e.src,
93
+ async (k) => {
94
+ v.value && k && (Y(), y.url = k, await A(v.value));
95
+ }
96
+ ), R({
97
+ play: j,
98
+ pause: P,
99
+ stop: $,
100
+ seek: D,
101
+ setLevel: q,
102
+ setVolume: K,
103
+ toggleMute: X,
104
+ state: i,
105
+ levels: r,
106
+ currentLevel: l,
107
+ stats: B
108
+ }), (k, F) => (w(), b("div", ue, [
109
+ _("div", de, [
110
+ _("video", {
111
+ ref_key: "videoRef",
112
+ ref: v,
113
+ class: G(["hls-player__video", k.videoClass]),
114
+ controls: k.controls,
115
+ muted: k.muted,
116
+ loop: k.loop,
117
+ poster: k.poster,
118
+ playsinline: ""
119
+ }, null, 10, pe),
120
+ t(f) ? (w(), b("div", me, [...F[1] || (F[1] = [
121
+ _("div", { class: "hls-player__spinner" }, null, -1)
122
+ ])])) : E("", !0),
123
+ t(m) ? (w(), b("div", fe, [
124
+ _("div", ve, [
125
+ _("span", null, "⚠️ " + x(t(m).message), 1)
126
+ ])
127
+ ])) : E("", !0)
128
+ ]),
129
+ t(r).length > 1 ? (w(), b("div", _e, [
130
+ _("div", ye, [
131
+ F[3] || (F[3] = _("label", null, "Quality:", -1)),
132
+ _("select", {
133
+ value: t(l),
134
+ onChange: F[0] || (F[0] = (z) => t(q)(Number(z.target.value)))
135
+ }, [
136
+ F[2] || (F[2] = _("option", { value: -1 }, "Auto", -1)),
137
+ (w(!0), b(J, null, Q(t(r), (z) => (w(), b("option", {
138
+ key: z.index,
139
+ value: z.index
140
+ }, x(z.height) + "p (" + x(Math.round(z.bitrate / 1e3)) + "kbps) ", 9, ge))), 128))
141
+ ], 40, he)
142
+ ]),
143
+ _("div", be, [
144
+ V.value ? (w(), b("span", we, x(V.value.width) + "x" + x(V.value.height), 1)) : E("", !0),
145
+ _("span", null, x(Math.round(t(B).bandwidth / 1e6 * 10) / 10) + " Mbps", 1),
146
+ _("span", null, x(N(t(p))) + " / " + x(N(t(c))), 1)
147
+ ])
148
+ ])) : E("", !0)
149
+ ]));
150
+ }
151
+ }), W = (C, R) => {
152
+ const S = C.__vccOpts || C;
153
+ for (const [e, o] of R)
154
+ S[e] = o;
155
+ return S;
156
+ }, nt = /* @__PURE__ */ W(Ce, [["__scopeId", "data-v-b04c54da"]]), Se = { class: "pointcloud-viewer" }, Re = {
157
+ key: 0,
158
+ class: "pointcloud-viewer__overlay"
159
+ }, ke = {
160
+ key: 1,
161
+ class: "pointcloud-viewer__overlay pointcloud-viewer__overlay--error"
162
+ }, xe = { class: "pointcloud-viewer__stats" }, Pe = { key: 0 }, Be = /* @__PURE__ */ T({
163
+ __name: "PointCloudViewer",
164
+ props: {
165
+ points: {},
166
+ pointSize: { default: 0.02 },
167
+ pointColor: { default: 65280 },
168
+ usePointColors: { type: Boolean, default: !0 },
169
+ cameraPosition: { default: () => ({ x: 5, y: 5, z: 5 }) },
170
+ autoRotate: { type: Boolean, default: !1 },
171
+ autoRotateSpeed: { default: 1 },
172
+ backgroundColor: { default: 1973790 },
173
+ showAxes: { type: Boolean, default: !1 },
174
+ showGrid: { type: Boolean, default: !0 },
175
+ bounds: {}
176
+ },
177
+ emits: ["ready", "click", "error"],
178
+ setup(C, { expose: R, emit: S }) {
179
+ const e = C, o = S, v = H(null), y = H(!0), g = H(null);
180
+ let i = null, u = null, f = null, r = null, l = null, d = null, p = null;
181
+ async function c() {
182
+ if (v.value)
183
+ try {
184
+ i = await import("three");
185
+ const { OrbitControls: m } = await import("three/examples/jsm/controls/OrbitControls.js"), h = v.value, A = h.clientWidth, j = h.clientHeight;
186
+ if (u = new i.Scene(), u.background = new i.Color(e.backgroundColor), f = new i.PerspectiveCamera(75, A / j, 0.1, 1e3), f.position.set(
187
+ e.cameraPosition.x,
188
+ e.cameraPosition.y,
189
+ e.cameraPosition.z
190
+ ), r = new i.WebGLRenderer({ antialias: !0 }), r.setSize(A, j), r.setPixelRatio(window.devicePixelRatio), h.appendChild(r.domElement), l = new m(f, r.domElement), l.autoRotate = e.autoRotate, l.autoRotateSpeed = e.autoRotateSpeed, e.showGrid) {
191
+ const $ = new i.GridHelper(10, 10, 4473924, 3355443);
192
+ u.add($);
193
+ }
194
+ if (e.showAxes) {
195
+ const $ = new i.AxesHelper(5);
196
+ u.add($);
197
+ }
198
+ new ResizeObserver(() => {
199
+ if (!f || !r || !v.value) return;
200
+ const $ = v.value.clientWidth, D = v.value.clientHeight;
201
+ f.aspect = $ / D, f.updateProjectionMatrix(), r.setSize($, D);
202
+ }).observe(h), s(), y.value = !1, o("ready");
203
+ } catch (m) {
204
+ const h = m instanceof Error ? m : new Error(String(m));
205
+ g.value = h, o("error", h), console.error("[PointCloudViewer] Failed to initialize:", m);
206
+ }
207
+ }
208
+ function n() {
209
+ if (!i || !u || (d && (u.remove(d), d.geometry.dispose(), d.material.dispose(), d = null), e.points.length === 0)) return;
210
+ const m = new i.BufferGeometry(), h = new Float32Array(e.points.length * 3), A = new Float32Array(e.points.length * 3);
211
+ for (let P = 0; P < e.points.length; P++) {
212
+ const $ = e.points[P];
213
+ if (h[P * 3] = $.x, h[P * 3 + 1] = $.y, h[P * 3 + 2] = $.z, e.usePointColors && $.r !== void 0)
214
+ A[P * 3] = $.r, A[P * 3 + 1] = $.g ?? 0, A[P * 3 + 2] = $.b ?? 0;
215
+ else {
216
+ const D = new i.Color(e.pointColor);
217
+ A[P * 3] = D.r, A[P * 3 + 1] = D.g, A[P * 3 + 2] = D.b;
218
+ }
219
+ }
220
+ m.setAttribute("position", new i.BufferAttribute(h, 3)), m.setAttribute("color", new i.BufferAttribute(A, 3));
221
+ const j = new i.PointsMaterial({
222
+ size: e.pointSize,
223
+ vertexColors: !0,
224
+ sizeAttenuation: !0
225
+ });
226
+ if (d = new i.Points(m, j), u.add(d), e.bounds && f) {
227
+ const P = {
228
+ x: (e.bounds.min.x + e.bounds.max.x) / 2,
229
+ y: (e.bounds.min.y + e.bounds.max.y) / 2,
230
+ z: (e.bounds.min.z + e.bounds.max.z) / 2
231
+ }, $ = Math.max(
232
+ e.bounds.max.x - e.bounds.min.x,
233
+ e.bounds.max.y - e.bounds.min.y,
234
+ e.bounds.max.z - e.bounds.min.z
235
+ );
236
+ f.position.set(
237
+ P.x + $ * 1.5,
238
+ P.y + $ * 1.5,
239
+ P.z + $ * 1.5
240
+ ), f.lookAt(P.x, P.y, P.z);
241
+ }
242
+ }
243
+ function s() {
244
+ p = requestAnimationFrame(s), l && l.update(), r && u && f && r.render(u, f);
245
+ }
246
+ function a() {
247
+ p && (cancelAnimationFrame(p), p = null), d && u && (u.remove(d), d.geometry.dispose(), d.material.dispose()), l && l.dispose(), r && (r.dispose(), v.value && r.domElement.parentNode && v.value.removeChild(r.domElement)), u = null, f = null, r = null, l = null, d = null;
248
+ }
249
+ L(() => e.points, n, { deep: !0 }), L(
250
+ [() => e.pointSize, () => e.pointColor, () => e.usePointColors],
251
+ n
252
+ ), L(
253
+ () => e.autoRotate,
254
+ (m) => {
255
+ l && (l.autoRotate = m);
256
+ }
257
+ ), L(
258
+ () => e.autoRotateSpeed,
259
+ (m) => {
260
+ l && (l.autoRotateSpeed = m);
261
+ }
262
+ ), U(() => {
263
+ c();
264
+ }), Z(() => {
265
+ a();
266
+ });
267
+ const B = O(() => ({
268
+ pointCount: e.points.length,
269
+ hasColors: e.points.length > 0 && e.points[0].r !== void 0
270
+ }));
271
+ return R({
272
+ updatePointCloud: n,
273
+ stats: B
274
+ }), (m, h) => (w(), b("div", Se, [
275
+ _("div", {
276
+ ref_key: "containerRef",
277
+ ref: v,
278
+ class: "pointcloud-viewer__canvas"
279
+ }, null, 512),
280
+ y.value ? (w(), b("div", Re, [...h[0] || (h[0] = [
281
+ _("div", { class: "pointcloud-viewer__spinner" }, null, -1),
282
+ _("span", null, "Loading viewer...", -1)
283
+ ])])) : E("", !0),
284
+ g.value ? (w(), b("div", ke, [
285
+ _("span", null, "⚠️ " + x(g.value.message), 1),
286
+ h[1] || (h[1] = _("small", null, "Make sure 'three' package is installed", -1))
287
+ ])) : E("", !0),
288
+ _("div", xe, [
289
+ _("span", null, "Points: " + x(B.value.pointCount.toLocaleString()), 1),
290
+ B.value.hasColors ? (w(), b("span", Pe, "🎨 Colored")) : E("", !0)
291
+ ])
292
+ ]));
293
+ }
294
+ }), ot = /* @__PURE__ */ W(Be, [["__scopeId", "data-v-7f487135"]]), $e = { class: "stream-viewer" }, Ae = { class: "stream-viewer__header" }, Ee = { class: "stream-viewer__stats" }, Le = {
295
+ key: 0,
296
+ class: "stream-viewer__errors"
297
+ }, Te = { class: "stream-viewer__actions" }, Fe = {
298
+ key: 0,
299
+ class: "stream-viewer__timestamp"
300
+ }, De = { class: "stream-viewer__data" }, ze = {
301
+ key: 0,
302
+ class: "stream-viewer__empty"
303
+ }, Me = /* @__PURE__ */ T({
304
+ __name: "StreamViewer",
305
+ props: {
306
+ data: {},
307
+ type: { default: "auto" },
308
+ maxLines: { default: 100 },
309
+ autoScroll: { type: Boolean, default: !0 },
310
+ showTimestamps: { type: Boolean, default: !0 },
311
+ paused: { type: Boolean, default: !1 },
312
+ formatter: {}
313
+ },
314
+ emits: ["clear", "pause"],
315
+ setup(C, { expose: R, emit: S }) {
316
+ const e = C, o = S, v = H([]), y = H(null);
317
+ let g = 0;
318
+ function i(n) {
319
+ if (e.formatter)
320
+ return e.formatter(n);
321
+ if (n == null)
322
+ return String(n);
323
+ switch (e.type === "auto" ? u(n) : e.type) {
324
+ case "json":
325
+ try {
326
+ return JSON.stringify(n, null, 2);
327
+ } catch {
328
+ return String(n);
329
+ }
330
+ case "binary":
331
+ return n instanceof ArrayBuffer ? `Binary: ${new Uint8Array(n).length} bytes` : String(n);
332
+ default:
333
+ return String(n);
334
+ }
335
+ }
336
+ function u(n) {
337
+ return n instanceof ArrayBuffer || n instanceof Uint8Array ? "binary" : typeof n == "object" ? "json" : "text";
338
+ }
339
+ function f(n, s = "data") {
340
+ if (e.paused) return;
341
+ const a = {
342
+ id: g++,
343
+ timestamp: /* @__PURE__ */ new Date(),
344
+ data: i(n),
345
+ type: s
346
+ };
347
+ v.value = [...v.value, a].slice(-e.maxLines), e.autoScroll && r();
348
+ }
349
+ function r() {
350
+ requestAnimationFrame(() => {
351
+ y.value && (y.value.scrollTop = y.value.scrollHeight);
352
+ });
353
+ }
354
+ function l() {
355
+ v.value = [], o("clear");
356
+ }
357
+ function d() {
358
+ o("pause", !e.paused);
359
+ }
360
+ function p(n) {
361
+ return n.toLocaleTimeString("en-US", {
362
+ hour12: !1,
363
+ hour: "2-digit",
364
+ minute: "2-digit",
365
+ second: "2-digit",
366
+ fractionalSecondDigits: 3
367
+ });
368
+ }
369
+ L(
370
+ () => e.data,
371
+ (n) => {
372
+ n !== void 0 && f(n);
373
+ }
374
+ );
375
+ const c = O(() => ({
376
+ total: v.value.length,
377
+ errors: v.value.filter((n) => n.type === "error").length
378
+ }));
379
+ return R({
380
+ addLog: f,
381
+ clear: l,
382
+ logs: v,
383
+ stats: c
384
+ }), (n, s) => (w(), b("div", $e, [
385
+ _("div", Ae, [
386
+ _("div", Ee, [
387
+ _("span", null, "Lines: " + x(c.value.total), 1),
388
+ c.value.errors > 0 ? (w(), b("span", Le, " Errors: " + x(c.value.errors), 1)) : E("", !0)
389
+ ]),
390
+ _("div", Te, [
391
+ _("button", {
392
+ onClick: d,
393
+ class: G(["stream-viewer__btn", { "stream-viewer__btn--active": n.paused }])
394
+ }, x(n.paused ? "▶ Resume" : "⏸ Pause"), 3),
395
+ _("button", {
396
+ onClick: l,
397
+ class: "stream-viewer__btn"
398
+ }, "🗑 Clear")
399
+ ])
400
+ ]),
401
+ _("div", {
402
+ ref_key: "containerRef",
403
+ ref: y,
404
+ class: "stream-viewer__content"
405
+ }, [
406
+ (w(!0), b(J, null, Q(v.value, (a) => (w(), b("div", {
407
+ key: a.id,
408
+ class: G(["stream-viewer__entry", `stream-viewer__entry--${a.type}`])
409
+ }, [
410
+ n.showTimestamps ? (w(), b("span", Fe, x(p(a.timestamp)), 1)) : E("", !0),
411
+ _("pre", De, x(a.data), 1)
412
+ ], 2))), 128)),
413
+ v.value.length === 0 ? (w(), b("div", ze, " Waiting for data... ")) : E("", !0)
414
+ ], 512)
415
+ ]));
416
+ }
417
+ }), st = /* @__PURE__ */ W(Me, [["__scopeId", "data-v-06dc8d20"]]), He = { class: "webrtc-viewer" }, Ie = {
418
+ key: 0,
419
+ class: "webrtc-viewer__header"
420
+ }, je = { class: "webrtc-viewer__status" }, Oe = { class: "webrtc-viewer__controls" }, Ue = { class: "webrtc-viewer__content" }, We = { class: "webrtc-viewer__default" }, Ve = {
421
+ key: 0,
422
+ class: "webrtc-viewer__placeholder"
423
+ }, Ge = {
424
+ key: 1,
425
+ class: "webrtc-viewer__loading"
426
+ }, qe = {
427
+ key: 2,
428
+ class: "webrtc-viewer__error"
429
+ }, Ne = {
430
+ key: 3,
431
+ class: "webrtc-viewer__info"
432
+ }, Je = { key: 0 }, Qe = { key: 1 }, Ke = {
433
+ key: 1,
434
+ class: "webrtc-viewer__footer"
435
+ }, Xe = { key: 0 }, Ye = { key: 1 }, Ze = /* @__PURE__ */ T({
436
+ __name: "WebRTCViewer",
437
+ props: {
438
+ signalingUrl: {},
439
+ iceServers: { default: () => [{ urls: "stun:stun.l.google.com:19302" }] },
440
+ enablePointCloud: { type: Boolean, default: !0 },
441
+ enableDetections: { type: Boolean, default: !0 },
442
+ autoConnect: { type: Boolean, default: !0 },
443
+ autoReconnect: { type: Boolean, default: !0 },
444
+ maxReconnectAttempts: { default: 5 },
445
+ showStatus: { type: Boolean, default: !0 },
446
+ showStats: { type: Boolean, default: !0 }
447
+ },
448
+ emits: ["connected", "disconnected", "error", "pointcloud", "detections", "boundingboxes", "status"],
449
+ setup(C, { expose: R, emit: S }) {
450
+ const e = C, o = S, v = H("Idle"), y = {
451
+ signalingUrl: e.signalingUrl,
452
+ iceServers: e.iceServers,
453
+ enablePointCloud: e.enablePointCloud,
454
+ enableDetections: e.enableDetections,
455
+ autoReconnect: e.autoReconnect,
456
+ maxReconnectAttempts: e.maxReconnectAttempts
457
+ }, g = {
458
+ onStatus: (m) => {
459
+ v.value = m, o("status", m);
460
+ },
461
+ onConnectionState: (m) => {
462
+ m === "connected" ? o("connected") : (m === "disconnected" || m === "closed" || m === "failed") && o("disconnected");
463
+ },
464
+ onPointCloudFrame: (m) => {
465
+ o("pointcloud", m);
466
+ },
467
+ onDetectionFrame: (m) => {
468
+ o("detections", m);
469
+ },
470
+ onBoundingBoxData: (m) => {
471
+ o("boundingboxes", m);
472
+ },
473
+ onError: (m) => {
474
+ o("error", m);
475
+ }
476
+ }, {
477
+ isRunning: i,
478
+ connectionState: u,
479
+ dataChannels: f,
480
+ lastPointCloudFrame: r,
481
+ lastDetectionFrame: l,
482
+ lastBoundingBoxes: d,
483
+ error: p,
484
+ start: c,
485
+ stop: n,
486
+ sendControl: s
487
+ } = ne(y, g), a = O(() => {
488
+ var m, h;
489
+ return {
490
+ channels: f.value.size,
491
+ pointCount: ((m = r.value) == null ? void 0 : m.points.length) ?? 0,
492
+ detectionCount: ((h = l.value) == null ? void 0 : h.detections.length) ?? 0,
493
+ bboxCount: d.value.length
494
+ };
495
+ }), B = O(() => {
496
+ switch (u.value) {
497
+ case "connected":
498
+ return "#4caf50";
499
+ case "connecting":
500
+ return "#ff9800";
501
+ case "reconnecting":
502
+ return "#ff9800";
503
+ case "error":
504
+ return "#f44336";
505
+ default:
506
+ return "#9e9e9e";
507
+ }
508
+ });
509
+ return U(() => {
510
+ e.autoConnect && c();
511
+ }), L(
512
+ () => e.signalingUrl,
513
+ () => {
514
+ i.value && (n(), y.signalingUrl = e.signalingUrl, c());
515
+ }
516
+ ), R({
517
+ isRunning: i,
518
+ connectionState: u,
519
+ start: c,
520
+ stop: n,
521
+ sendControl: s,
522
+ lastPointCloudFrame: r,
523
+ lastDetectionFrame: l,
524
+ lastBoundingBoxes: d,
525
+ stats: a
526
+ }), (m, h) => (w(), b("div", He, [
527
+ m.showStatus ? (w(), b("div", Ie, [
528
+ _("div", je, [
529
+ _("span", {
530
+ class: "webrtc-viewer__indicator",
531
+ style: ee({ backgroundColor: B.value })
532
+ }, null, 4),
533
+ _("span", null, x(t(u)), 1)
534
+ ]),
535
+ _("div", Oe, [
536
+ t(i) ? (w(), b("button", {
537
+ key: 1,
538
+ onClick: h[1] || (h[1] = //@ts-ignore
539
+ (...A) => t(n) && t(n)(...A)),
540
+ class: "webrtc-viewer__btn webrtc-viewer__btn--disconnect"
541
+ }, " ⏹ Disconnect ")) : (w(), b("button", {
542
+ key: 0,
543
+ onClick: h[0] || (h[0] = //@ts-ignore
544
+ (...A) => t(c) && t(c)(...A)),
545
+ class: "webrtc-viewer__btn webrtc-viewer__btn--connect"
546
+ }, " ▶ Connect "))
547
+ ])
548
+ ])) : E("", !0),
549
+ _("div", Ue, [
550
+ M(m.$slots, "default", {
551
+ isRunning: t(i),
552
+ connectionState: t(u),
553
+ pointCloudFrame: t(r),
554
+ detectionFrame: t(l),
555
+ boundingBoxes: t(d),
556
+ error: t(p),
557
+ start: t(c),
558
+ stop: t(n),
559
+ sendControl: t(s)
560
+ }, () => [
561
+ _("div", We, [
562
+ t(i) ? t(u) === "connecting" ? (w(), b("div", Ge, [
563
+ h[3] || (h[3] = _("div", { class: "webrtc-viewer__spinner" }, null, -1)),
564
+ _("span", null, x(v.value), 1)
565
+ ])) : t(p) ? (w(), b("div", qe, [
566
+ _("span", null, "⚠️ " + x(t(p).message), 1)
567
+ ])) : (w(), b("div", Ne, [
568
+ h[4] || (h[4] = _("p", null, "WebRTC Connected", -1)),
569
+ a.value.pointCount > 0 ? (w(), b("p", Je, " Points: " + x(a.value.pointCount.toLocaleString()), 1)) : E("", !0),
570
+ a.value.bboxCount > 0 ? (w(), b("p", Qe, " Bounding Boxes: " + x(a.value.bboxCount), 1)) : E("", !0)
571
+ ])) : (w(), b("div", Ve, [...h[2] || (h[2] = [
572
+ _("span", null, "Click Connect to start WebRTC stream", -1)
573
+ ])]))
574
+ ])
575
+ ], !0)
576
+ ]),
577
+ m.showStats && t(i) ? (w(), b("div", Ke, [
578
+ _("span", null, "Channels: " + x(a.value.channels), 1),
579
+ e.enablePointCloud ? (w(), b("span", Xe, " Points: " + x(a.value.pointCount.toLocaleString()), 1)) : E("", !0),
580
+ e.enableDetections ? (w(), b("span", Ye, " Detections: " + x(a.value.detectionCount), 1)) : E("", !0)
581
+ ])) : E("", !0)
582
+ ]));
583
+ }
584
+ }), rt = /* @__PURE__ */ W(Ze, [["__scopeId", "data-v-3f83a728"]]), at = /* @__PURE__ */ T({
585
+ __name: "DataStreamView",
586
+ props: {
587
+ config: { default: () => ({}) },
588
+ autoStart: { type: Boolean, default: !0 }
589
+ },
590
+ emits: ["data", "batch", "error"],
591
+ setup(C, { expose: R, emit: S }) {
592
+ const e = C, o = S, { config: v } = I(e), {
593
+ data: y,
594
+ buffer: g,
595
+ bufferSize: i,
596
+ isStreaming: u,
597
+ itemsPerSecond: f,
598
+ totalItems: r,
599
+ error: l,
600
+ start: d,
601
+ stop: p,
602
+ push: c,
603
+ clear: n,
604
+ getBuffer: s,
605
+ subscribe: a
606
+ } = oe(e.config, {
607
+ onData: (B) => o("data", B),
608
+ onBatch: (B) => o("batch", B),
609
+ onError: (B) => o("error", B)
610
+ });
611
+ return L(
612
+ v,
613
+ () => {
614
+ p(), d();
615
+ },
616
+ { deep: !0 }
617
+ ), R({
618
+ data: y,
619
+ buffer: g,
620
+ bufferSize: i,
621
+ isStreaming: u,
622
+ itemsPerSecond: f,
623
+ totalItems: r,
624
+ error: l,
625
+ start: d,
626
+ stop: p,
627
+ push: c,
628
+ clear: n,
629
+ getBuffer: s,
630
+ subscribe: a
631
+ }), (B, m) => M(B.$slots, "default", {
632
+ data: t(y),
633
+ buffer: t(g),
634
+ bufferSize: t(i),
635
+ isStreaming: t(u),
636
+ itemsPerSecond: t(f),
637
+ totalItems: t(r),
638
+ error: t(l),
639
+ start: t(d),
640
+ stop: t(p),
641
+ push: t(c),
642
+ clear: t(n)
643
+ });
644
+ }
645
+ }), it = /* @__PURE__ */ T({
646
+ __name: "HTTPStream",
647
+ props: {
648
+ url: {},
649
+ method: { default: "GET" },
650
+ headers: { default: () => ({}) },
651
+ body: { default: void 0 },
652
+ credentials: { default: "same-origin" },
653
+ autoConnect: { type: Boolean, default: !0 },
654
+ autoReconnect: { type: Boolean, default: !0 },
655
+ maxReconnectAttempts: { default: 5 },
656
+ reconnectDelay: { default: 1e3 },
657
+ ndjson: { type: Boolean, default: !0 }
658
+ },
659
+ emits: ["open", "chunk", "complete", "error", "progress", "reconnecting", "reconnected", "reconnectFailed"],
660
+ setup(C, { expose: R, emit: S }) {
661
+ const e = C, o = S, { url: v } = I(e), {
662
+ isConnected: y,
663
+ isStreaming: g,
664
+ connectionState: i,
665
+ lastChunk: u,
666
+ chunks: f,
667
+ bytesReceived: r,
668
+ error: l,
669
+ reconnectAttempts: d,
670
+ connect: p,
671
+ disconnect: c,
672
+ clearChunks: n
673
+ } = se(
674
+ {
675
+ url: e.url,
676
+ method: e.method,
677
+ headers: e.headers,
678
+ body: e.body,
679
+ credentials: e.credentials,
680
+ autoConnect: e.autoConnect,
681
+ autoReconnect: e.autoReconnect,
682
+ maxReconnectAttempts: e.maxReconnectAttempts,
683
+ reconnectDelay: e.reconnectDelay,
684
+ ndjson: e.ndjson
685
+ },
686
+ {
687
+ onOpen: () => o("open"),
688
+ onChunk: (s, a) => o("chunk", s, a),
689
+ onComplete: () => o("complete"),
690
+ onError: (s) => o("error", s),
691
+ onProgress: (s) => o("progress", s),
692
+ onReconnecting: (s, a) => o("reconnecting", s, a),
693
+ onReconnected: () => o("reconnected"),
694
+ onReconnectFailed: () => o("reconnectFailed")
695
+ }
696
+ );
697
+ return L(v, () => {
698
+ c(), p();
699
+ }), R({
700
+ isConnected: y,
701
+ isStreaming: g,
702
+ connectionState: i,
703
+ lastChunk: u,
704
+ chunks: f,
705
+ bytesReceived: r,
706
+ error: l,
707
+ reconnectAttempts: d,
708
+ connect: p,
709
+ disconnect: c,
710
+ clearChunks: n
711
+ }), (s, a) => M(s.$slots, "default", {
712
+ isConnected: t(y),
713
+ isStreaming: t(g),
714
+ connectionState: t(i),
715
+ lastChunk: t(u),
716
+ chunks: t(f),
717
+ bytesReceived: t(r),
718
+ error: t(l),
719
+ reconnectAttempts: t(d),
720
+ connect: t(p),
721
+ disconnect: t(c),
722
+ clearChunks: t(n)
723
+ });
724
+ }
725
+ }), lt = /* @__PURE__ */ T({
726
+ __name: "LaravelEchoStream",
727
+ props: {
728
+ config: {},
729
+ channel: { default: void 0 },
730
+ channelType: { default: "public" },
731
+ events: { default: () => [] },
732
+ autoSubscribe: { type: Boolean, default: !0 }
733
+ },
734
+ emits: ["connected", "event", "error", "subscribed", "unsubscribed", "here", "joining", "leaving"],
735
+ setup(C, { expose: R, emit: S }) {
736
+ const e = C, o = S, { channel: v } = I(e), {
737
+ isConnected: y,
738
+ channels: g,
739
+ channel: i,
740
+ privateChannel: u,
741
+ presenceChannel: f,
742
+ leave: r,
743
+ leaveAll: l,
744
+ connect: d
745
+ } = re(e.config, {
746
+ onConnected: (n) => o("connected", n),
747
+ onError: (n) => o("error", n)
748
+ });
749
+ let p = null;
750
+ function c() {
751
+ if (e.channel) {
752
+ if (e.channelType === "private")
753
+ p = u(e.channel);
754
+ else if (e.channelType === "presence") {
755
+ const n = f(e.channel);
756
+ p = n, n.here((s) => o("here", s)), n.joining((s) => o("joining", s)), n.leaving((s) => o("leaving", s));
757
+ } else
758
+ p = i(e.channel);
759
+ e.events.forEach((n) => {
760
+ p == null || p.listen(n, (s) => {
761
+ o("event", n, s);
762
+ });
763
+ }), o("subscribed", e.channel);
764
+ }
765
+ }
766
+ return U(async () => {
767
+ await d(), e.autoSubscribe && e.channel && c();
768
+ }), L(v, (n, s) => {
769
+ s && (r(s), o("unsubscribed", s)), n && e.autoSubscribe && c();
770
+ }), R({
771
+ isConnected: y,
772
+ channels: g,
773
+ subscribePublic: i,
774
+ privateChannel: u,
775
+ presenceChannel: f,
776
+ leave: r,
777
+ leaveAll: l,
778
+ connect: d
779
+ }), (n, s) => M(n.$slots, "default", {
780
+ isConnected: t(y),
781
+ channels: t(g),
782
+ subscribePublic: t(i),
783
+ privateChannel: t(u),
784
+ presenceChannel: t(f),
785
+ leave: t(r),
786
+ leaveAll: t(l)
787
+ });
788
+ }
789
+ }), ct = /* @__PURE__ */ T({
790
+ __name: "LongPollingStream",
791
+ props: {
792
+ url: {},
793
+ method: { default: "GET" },
794
+ headers: { default: () => ({}) },
795
+ body: { default: void 0 },
796
+ credentials: { default: "same-origin" },
797
+ interval: { default: 0 },
798
+ timeout: { default: 3e4 },
799
+ autoStart: { type: Boolean, default: !0 },
800
+ autoRestart: { type: Boolean, default: !0 },
801
+ maxRestartAttempts: { default: 5 },
802
+ restartDelay: { default: 1e3 },
803
+ includeTimestamp: { type: Boolean, default: !1 },
804
+ timestampParam: { default: "since" }
805
+ },
806
+ emits: ["start", "data", "error", "stop", "restarting", "restarted", "restartFailed"],
807
+ setup(C, { expose: R, emit: S }) {
808
+ const e = C, o = S, { url: v } = I(e), {
809
+ isPolling: y,
810
+ connectionState: g,
811
+ lastData: i,
812
+ dataHistory: u,
813
+ requestCount: f,
814
+ error: r,
815
+ restartAttempts: l,
816
+ start: d,
817
+ stop: p,
818
+ poll: c,
819
+ clearHistory: n
820
+ } = ae(
821
+ {
822
+ url: e.url,
823
+ method: e.method,
824
+ headers: e.headers,
825
+ body: e.body,
826
+ credentials: e.credentials,
827
+ interval: e.interval,
828
+ timeout: e.timeout,
829
+ autoStart: e.autoStart,
830
+ autoRestart: e.autoRestart,
831
+ maxRestartAttempts: e.maxRestartAttempts,
832
+ restartDelay: e.restartDelay,
833
+ includeTimestamp: e.includeTimestamp,
834
+ timestampParam: e.timestampParam
835
+ },
836
+ {
837
+ onStart: () => o("start"),
838
+ onData: (s) => o("data", s),
839
+ onError: (s) => o("error", s),
840
+ onStop: () => o("stop"),
841
+ onRestarting: (s, a) => o("restarting", s, a),
842
+ onRestarted: () => o("restarted"),
843
+ onRestartFailed: () => o("restartFailed")
844
+ }
845
+ );
846
+ return L(v, () => {
847
+ p(), d();
848
+ }), R({
849
+ isPolling: y,
850
+ connectionState: g,
851
+ lastData: i,
852
+ dataHistory: u,
853
+ requestCount: f,
854
+ error: r,
855
+ restartAttempts: l,
856
+ start: d,
857
+ stop: p,
858
+ poll: c,
859
+ clearHistory: n
860
+ }), (s, a) => M(s.$slots, "default", {
861
+ isPolling: t(y),
862
+ connectionState: t(g),
863
+ lastData: t(i),
864
+ dataHistory: t(u),
865
+ requestCount: t(f),
866
+ error: t(r),
867
+ restartAttempts: t(l),
868
+ start: t(d),
869
+ stop: t(p),
870
+ poll: t(c),
871
+ clearHistory: t(n)
872
+ });
873
+ }
874
+ }), ut = /* @__PURE__ */ T({
875
+ __name: "SocketIOStream",
876
+ props: {
877
+ config: {},
878
+ autoConnect: { type: Boolean, default: !0 },
879
+ events: { default: () => [] }
880
+ },
881
+ emits: ["connect", "disconnect", "error", "event", "reconnecting", "reconnected", "reconnectFailed"],
882
+ setup(C, { expose: R, emit: S }) {
883
+ const e = C, o = S, { config: v } = I(e), {
884
+ isConnected: y,
885
+ connectionState: g,
886
+ socketId: i,
887
+ rooms: u,
888
+ error: f,
889
+ connect: r,
890
+ disconnect: l,
891
+ emit: d,
892
+ on: p,
893
+ off: c,
894
+ join: n,
895
+ leave: s
896
+ } = ie(e.config, {
897
+ onConnect: (a) => o("connect", a),
898
+ onDisconnect: (a) => o("disconnect", a),
899
+ onError: (a) => o("error", a),
900
+ onReconnecting: (a) => o("reconnecting", a),
901
+ onReconnectFailed: () => o("reconnectFailed")
902
+ });
903
+ return e.events.forEach((a) => {
904
+ p(a, (B) => {
905
+ o("event", a, B);
906
+ });
907
+ }), L(
908
+ () => v.value.url,
909
+ () => {
910
+ l(), r();
911
+ }
912
+ ), R({
913
+ isConnected: y,
914
+ connectionState: g,
915
+ socketId: i,
916
+ rooms: u,
917
+ error: f,
918
+ connect: r,
919
+ disconnect: l,
920
+ emit: d,
921
+ on: p,
922
+ off: c,
923
+ join: n,
924
+ leave: s
925
+ }), (a, B) => M(a.$slots, "default", {
926
+ isConnected: t(y),
927
+ connectionState: t(g),
928
+ socketId: t(i),
929
+ rooms: t(u),
930
+ error: t(f),
931
+ connect: t(r),
932
+ disconnect: t(l),
933
+ emit: t(d),
934
+ on: t(p),
935
+ off: t(c),
936
+ join: t(n),
937
+ leave: t(s)
938
+ });
939
+ }
940
+ }), dt = /* @__PURE__ */ T({
941
+ __name: "SSEStream",
942
+ props: {
943
+ url: {},
944
+ withCredentials: { type: Boolean, default: !1 },
945
+ autoConnect: { type: Boolean, default: !0 },
946
+ autoReconnect: { type: Boolean, default: !0 },
947
+ maxReconnectAttempts: { default: 5 },
948
+ reconnectDelay: { default: 1e3 },
949
+ eventTypes: { default: () => ["message"] }
950
+ },
951
+ emits: ["open", "error", "message", "event", "reconnecting", "reconnected", "reconnectFailed"],
952
+ setup(C, { expose: R, emit: S }) {
953
+ const e = C, o = S, { url: v } = I(e), {
954
+ isConnected: y,
955
+ connectionState: g,
956
+ lastMessage: i,
957
+ lastEventType: u,
958
+ lastEventId: f,
959
+ error: r,
960
+ reconnectAttempts: l,
961
+ connect: d,
962
+ disconnect: p,
963
+ addEventListener: c,
964
+ removeEventListener: n
965
+ } = le(
966
+ {
967
+ url: e.url,
968
+ withCredentials: e.withCredentials,
969
+ autoConnect: e.autoConnect,
970
+ autoReconnect: e.autoReconnect,
971
+ maxReconnectAttempts: e.maxReconnectAttempts,
972
+ reconnectDelay: e.reconnectDelay,
973
+ eventTypes: e.eventTypes
974
+ },
975
+ {
976
+ onOpen: () => o("open"),
977
+ onError: (s) => o("error", s),
978
+ onMessage: (s, a) => o("message", s, a),
979
+ onEvent: (s, a, B) => o("event", s, a, B),
980
+ onReconnecting: (s, a) => o("reconnecting", s, a),
981
+ onReconnected: () => o("reconnected"),
982
+ onReconnectFailed: () => o("reconnectFailed")
983
+ }
984
+ );
985
+ return L(v, () => {
986
+ p(), d();
987
+ }), R({
988
+ isConnected: y,
989
+ connectionState: g,
990
+ lastMessage: i,
991
+ lastEventType: u,
992
+ lastEventId: f,
993
+ error: r,
994
+ reconnectAttempts: l,
995
+ connect: d,
996
+ disconnect: p,
997
+ addEventListener: c,
998
+ removeEventListener: n
999
+ }), (s, a) => M(s.$slots, "default", {
1000
+ isConnected: t(y),
1001
+ connectionState: t(g),
1002
+ lastMessage: t(i),
1003
+ lastEventType: t(u),
1004
+ lastEventId: t(f),
1005
+ error: t(r),
1006
+ reconnectAttempts: t(l),
1007
+ connect: t(d),
1008
+ disconnect: t(p),
1009
+ addEventListener: t(c),
1010
+ removeEventListener: t(n)
1011
+ });
1012
+ }
1013
+ }), pt = /* @__PURE__ */ T({
1014
+ __name: "WebSocketStream",
1015
+ props: {
1016
+ config: {},
1017
+ autoConnect: { type: Boolean, default: !0 }
1018
+ },
1019
+ emits: ["open", "close", "error", "message", "reconnecting", "reconnected", "reconnectFailed"],
1020
+ setup(C, { expose: R, emit: S }) {
1021
+ const e = C, o = S, { config: v } = I(e), {
1022
+ isConnected: y,
1023
+ connectionState: g,
1024
+ lastMessage: i,
1025
+ error: u,
1026
+ reconnectAttempts: f,
1027
+ connect: r,
1028
+ disconnect: l,
1029
+ send: d,
1030
+ sendJSON: p
1031
+ } = ce(e.config, {
1032
+ onOpen: () => o("open"),
1033
+ onClose: (c, n) => o("close", c, n),
1034
+ onError: (c) => o("error", c),
1035
+ onMessage: (c, n) => o("message", c, n),
1036
+ onReconnecting: (c, n) => o("reconnecting", c, n),
1037
+ onReconnected: () => o("reconnected"),
1038
+ onReconnectFailed: () => o("reconnectFailed")
1039
+ });
1040
+ return L(
1041
+ () => v.value.url,
1042
+ () => {
1043
+ l(), r();
1044
+ }
1045
+ ), R({
1046
+ isConnected: y,
1047
+ connectionState: g,
1048
+ lastMessage: i,
1049
+ error: u,
1050
+ reconnectAttempts: f,
1051
+ connect: r,
1052
+ disconnect: l,
1053
+ send: d,
1054
+ sendJSON: p
1055
+ }), (c, n) => M(c.$slots, "default", {
1056
+ isConnected: t(y),
1057
+ connectionState: t(g),
1058
+ lastMessage: t(i),
1059
+ error: t(u),
1060
+ reconnectAttempts: t(f),
1061
+ connect: t(r),
1062
+ disconnect: t(l),
1063
+ send: t(d),
1064
+ sendJson: t(p)
1065
+ });
1066
+ }
1067
+ });
1068
+ export {
1069
+ nt as H,
1070
+ ot as P,
1071
+ st as S,
1072
+ rt as W,
1073
+ at as _,
1074
+ it as a,
1075
+ lt as b,
1076
+ ct as c,
1077
+ dt as d,
1078
+ ut as e,
1079
+ pt as f
1080
+ };
1081
+ //# sourceMappingURL=WebSocketStream.vue_vue_type_script_setup_true_lang-C_F2vNNk.js.map