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