@camstack/addon-pipeline 0.1.8

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 (107) hide show
  1. package/dist/audio-analyzer/index.js +723 -0
  2. package/dist/audio-analyzer/index.js.map +1 -0
  3. package/dist/audio-analyzer/index.mjs +683 -0
  4. package/dist/audio-analyzer/index.mjs.map +1 -0
  5. package/dist/audio-codec-nodeav/index.js +467 -0
  6. package/dist/audio-codec-nodeav/index.js.map +1 -0
  7. package/dist/audio-codec-nodeav/index.mjs +467 -0
  8. package/dist/audio-codec-nodeav/index.mjs.map +1 -0
  9. package/dist/decoder-nodeav/index.js +929 -0
  10. package/dist/decoder-nodeav/index.js.map +1 -0
  11. package/dist/decoder-nodeav/index.mjs +907 -0
  12. package/dist/decoder-nodeav/index.mjs.map +1 -0
  13. package/dist/detection-pipeline/index.js +5766 -0
  14. package/dist/detection-pipeline/index.js.map +1 -0
  15. package/dist/detection-pipeline/index.mjs +5725 -0
  16. package/dist/detection-pipeline/index.mjs.map +1 -0
  17. package/dist/index-D_cl0Qqb.js +5791 -0
  18. package/dist/index-D_cl0Qqb.js.map +1 -0
  19. package/dist/index-UbcdLS7a.mjs +5790 -0
  20. package/dist/index-UbcdLS7a.mjs.map +1 -0
  21. package/dist/motion-wasm/index.js +476 -0
  22. package/dist/motion-wasm/index.js.map +1 -0
  23. package/dist/motion-wasm/index.mjs +454 -0
  24. package/dist/motion-wasm/index.mjs.map +1 -0
  25. package/dist/pipeline-runner/index.js +1669 -0
  26. package/dist/pipeline-runner/index.js.map +1 -0
  27. package/dist/pipeline-runner/index.mjs +1647 -0
  28. package/dist/pipeline-runner/index.mjs.map +1 -0
  29. package/dist/stream-broker/@mf-types/compiled-types/stream-broker/widgets/StreamBrokerPanel.d.ts +21 -0
  30. package/dist/stream-broker/@mf-types/compiled-types/stream-broker/widgets/index.d.ts +13 -0
  31. package/dist/stream-broker/@mf-types/widgets.d.ts +2 -0
  32. package/dist/stream-broker/@mf-types.d.ts +3 -0
  33. package/dist/stream-broker/@mf-types.zip +0 -0
  34. package/dist/stream-broker/__mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_sdk__loadShare__.mjs-h5aXOPSA.mjs +12 -0
  35. package/dist/stream-broker/__mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.mjs-C-URP6DW.mjs +17 -0
  36. package/dist/stream-broker/__mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.mjs-69eEmXwl.mjs +20 -0
  37. package/dist/stream-broker/__mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.mjs-U1EUeEPs.mjs +104 -0
  38. package/dist/stream-broker/__mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_trpc_mf_1_client__loadShare__.mjs-DeouEaSs.mjs +85 -0
  39. package/dist/stream-broker/__mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.mjs-DHUwjbb9.mjs +62 -0
  40. package/dist/stream-broker/__mfe_internal__addon_stream_broker_widgets__loadShare__react__loadShare__.mjs-DePVYdid.mjs +85 -0
  41. package/dist/stream-broker/__mfe_internal__addon_stream_broker_widgets__loadShare__react__loadShare__.mjs_commonjs-proxy-CBlCGyx5.mjs +29 -0
  42. package/dist/stream-broker/__mfe_internal__addon_stream_broker_widgets__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.mjs-gBEZsQrp.mjs +36 -0
  43. package/dist/stream-broker/__mfe_internal__addon_stream_broker_widgets__loadShare__react_mf_2_dom__loadShare__.mjs-DYEKzzY-.mjs +45 -0
  44. package/dist/stream-broker/__mfe_internal__addon_stream_broker_widgets__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy-DZchZKbW.mjs +6 -0
  45. package/dist/stream-broker/__mfe_internal__addon_stream_broker_widgets__loadShare__react_mf_2_dom_mf_1_client__loadShare__.mjs-DICOtMTl.mjs +34 -0
  46. package/dist/stream-broker/_stub.js +752 -0
  47. package/dist/stream-broker/_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-D6o1e2ed.mjs +156 -0
  48. package/dist/stream-broker/client-BK73l2KT.mjs +10063 -0
  49. package/dist/stream-broker/getErrorShape-BPSzUA7W-TlK8ipWe.mjs +211 -0
  50. package/dist/stream-broker/hostInit-RCeroTVY.mjs +168 -0
  51. package/dist/stream-broker/index-BYclbfM0.mjs +15806 -0
  52. package/dist/stream-broker/index-BhXZh4lQ.mjs +1617 -0
  53. package/dist/stream-broker/index-BxHaCH3N.mjs +725 -0
  54. package/dist/stream-broker/index-D2-K2YJ7.mjs +19268 -0
  55. package/dist/stream-broker/index-IUYKHbxX.mjs +185 -0
  56. package/dist/stream-broker/index-Ss9m7Jum.mjs +2603 -0
  57. package/dist/stream-broker/index-ns1fRD30.mjs +435 -0
  58. package/dist/stream-broker/index-xncRG7-x.mjs +2713 -0
  59. package/dist/stream-broker/index.js +11171 -0
  60. package/dist/stream-broker/index.js.map +1 -0
  61. package/dist/stream-broker/index.mjs +11130 -0
  62. package/dist/stream-broker/index.mjs.map +1 -0
  63. package/dist/stream-broker/jsx-runtime-ZdY5pIZz.mjs +55 -0
  64. package/dist/stream-broker/remoteEntry.js +2973 -0
  65. package/dist/stream-broker/virtualExposes-pCd777Rp.mjs +42 -0
  66. package/package.json +258 -0
  67. package/python/__pycache__/inference_pool.cpython-313.pyc +0 -0
  68. package/python/inference_pool.py +1088 -0
  69. package/python/postprocessors/__init__.py +24 -0
  70. package/python/postprocessors/__pycache__/__init__.cpython-312.pyc +0 -0
  71. package/python/postprocessors/__pycache__/__init__.cpython-313.pyc +0 -0
  72. package/python/postprocessors/__pycache__/_safety.cpython-313.pyc +0 -0
  73. package/python/postprocessors/__pycache__/arcface.cpython-312.pyc +0 -0
  74. package/python/postprocessors/__pycache__/arcface.cpython-313.pyc +0 -0
  75. package/python/postprocessors/__pycache__/ctc.cpython-312.pyc +0 -0
  76. package/python/postprocessors/__pycache__/ctc.cpython-313.pyc +0 -0
  77. package/python/postprocessors/__pycache__/saliency.cpython-312.pyc +0 -0
  78. package/python/postprocessors/__pycache__/saliency.cpython-313.pyc +0 -0
  79. package/python/postprocessors/__pycache__/scrfd.cpython-312.pyc +0 -0
  80. package/python/postprocessors/__pycache__/scrfd.cpython-313.pyc +0 -0
  81. package/python/postprocessors/__pycache__/softmax.cpython-312.pyc +0 -0
  82. package/python/postprocessors/__pycache__/softmax.cpython-313.pyc +0 -0
  83. package/python/postprocessors/__pycache__/yamnet.cpython-312.pyc +0 -0
  84. package/python/postprocessors/__pycache__/yamnet.cpython-313.pyc +0 -0
  85. package/python/postprocessors/__pycache__/yolo.cpython-312.pyc +0 -0
  86. package/python/postprocessors/__pycache__/yolo.cpython-313.pyc +0 -0
  87. package/python/postprocessors/__pycache__/yolo_seg.cpython-312.pyc +0 -0
  88. package/python/postprocessors/__pycache__/yolo_seg.cpython-313.pyc +0 -0
  89. package/python/postprocessors/arcface.py +31 -0
  90. package/python/postprocessors/ctc.py +68 -0
  91. package/python/postprocessors/saliency.py +44 -0
  92. package/python/postprocessors/scrfd.py +212 -0
  93. package/python/postprocessors/softmax.py +43 -0
  94. package/python/postprocessors/yamnet.py +41 -0
  95. package/python/postprocessors/yolo.py +278 -0
  96. package/python/postprocessors/yolo_seg.py +247 -0
  97. package/python/requirements-coreml.txt +4 -0
  98. package/python/requirements-onnxruntime.txt +3 -0
  99. package/python/requirements-openvino.txt +3 -0
  100. package/python/requirements.txt +9 -0
  101. package/swift/audio-analyzer/apple-sound-classifier +0 -0
  102. package/swift/audio-analyzer/apple-sound-classifier.swift +213 -0
  103. package/swift/detection-pipeline/apple-sound-classifier +0 -0
  104. package/swift/detection-pipeline/apple-sound-classifier.swift +196 -0
  105. package/wasm/assembly/index.ts +290 -0
  106. package/wasm/assembly/tsconfig.json +4 -0
  107. package/wasm/motion.wasm +0 -0
@@ -0,0 +1,752 @@
1
+ import { _ as e, a as r, b as B } from "./__mfe_internal__addon_stream_broker_widgets__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.mjs-gBEZsQrp.mjs";
2
+ import { _ as z, a as G } from "./__mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.mjs-U1EUeEPs.mjs";
3
+ import { a as R, b as S, c as k, d as y, e as I } from "./__mfe_internal__addon_stream_broker_widgets__loadShare__react__loadShare__.mjs-DePVYdid.mjs";
4
+ import { _ as E, a as Q, b as W, c as X, d as T, e as Z, f as V, g as J, h as Y } from "./__mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.mjs-69eEmXwl.mjs";
5
+ /**
6
+ * @license lucide-react v0.511.0 - ISC
7
+ *
8
+ * This source code is licensed under the ISC license.
9
+ * See the LICENSE file in the root directory of this source tree.
10
+ */
11
+ const ee = (s) => s.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), te = (s) => s.replace(
12
+ /^([A-Z])|[\s-_]+(\w)/g,
13
+ (n, o, i) => i ? i.toUpperCase() : o.toLowerCase()
14
+ ), A = (s) => {
15
+ const n = te(s);
16
+ return n.charAt(0).toUpperCase() + n.slice(1);
17
+ }, L = (...s) => s.filter((n, o, i) => !!n && n.trim() !== "" && i.indexOf(n) === o).join(" ").trim(), se = (s) => {
18
+ for (const n in s)
19
+ if (n.startsWith("aria-") || n === "role" || n === "title")
20
+ return !0;
21
+ };
22
+ /**
23
+ * @license lucide-react v0.511.0 - ISC
24
+ *
25
+ * This source code is licensed under the ISC license.
26
+ * See the LICENSE file in the root directory of this source tree.
27
+ */
28
+ var re = {
29
+ xmlns: "http://www.w3.org/2000/svg",
30
+ width: 24,
31
+ height: 24,
32
+ viewBox: "0 0 24 24",
33
+ fill: "none",
34
+ stroke: "currentColor",
35
+ strokeWidth: 2,
36
+ strokeLinecap: "round",
37
+ strokeLinejoin: "round"
38
+ };
39
+ /**
40
+ * @license lucide-react v0.511.0 - ISC
41
+ *
42
+ * This source code is licensed under the ISC license.
43
+ * See the LICENSE file in the root directory of this source tree.
44
+ */
45
+ const ne = R(
46
+ ({
47
+ color: s = "currentColor",
48
+ size: n = 24,
49
+ strokeWidth: o = 2,
50
+ absoluteStrokeWidth: i,
51
+ className: c = "",
52
+ children: t,
53
+ iconNode: l,
54
+ ...d
55
+ }, u) => S(
56
+ "svg",
57
+ {
58
+ ref: u,
59
+ ...re,
60
+ width: n,
61
+ height: n,
62
+ stroke: s,
63
+ strokeWidth: i ? Number(o) * 24 / Number(n) : o,
64
+ className: L("lucide", c),
65
+ ...!t && !se(d) && { "aria-hidden": "true" },
66
+ ...d
67
+ },
68
+ [
69
+ ...l.map(([a, m]) => S(a, m)),
70
+ ...Array.isArray(t) ? t : [t]
71
+ ]
72
+ )
73
+ );
74
+ /**
75
+ * @license lucide-react v0.511.0 - ISC
76
+ *
77
+ * This source code is licensed under the ISC license.
78
+ * See the LICENSE file in the root directory of this source tree.
79
+ */
80
+ const _ = (s, n) => {
81
+ const o = R(
82
+ ({ className: i, ...c }, t) => S(ne, {
83
+ ref: t,
84
+ iconNode: n,
85
+ className: L(
86
+ `lucide-${ee(A(s))}`,
87
+ `lucide-${s}`,
88
+ i
89
+ ),
90
+ ...c
91
+ })
92
+ );
93
+ return o.displayName = A(s), o;
94
+ };
95
+ /**
96
+ * @license lucide-react v0.511.0 - ISC
97
+ *
98
+ * This source code is licensed under the ISC license.
99
+ * See the LICENSE file in the root directory of this source tree.
100
+ */
101
+ const ae = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], O = _("chevron-down", ae);
102
+ /**
103
+ * @license lucide-react v0.511.0 - ISC
104
+ *
105
+ * This source code is licensed under the ISC license.
106
+ * See the LICENSE file in the root directory of this source tree.
107
+ */
108
+ const oe = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]], j = _("chevron-right", oe);
109
+ /**
110
+ * @license lucide-react v0.511.0 - ISC
111
+ *
112
+ * This source code is licensed under the ISC license.
113
+ * See the LICENSE file in the root directory of this source tree.
114
+ */
115
+ const ie = [
116
+ ["path", { d: "M4.9 19.1C1 15.2 1 8.8 4.9 4.9", key: "1vaf9d" }],
117
+ ["path", { d: "M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5", key: "u1ii0m" }],
118
+ ["circle", { cx: "12", cy: "12", r: "2", key: "1c9p78" }],
119
+ ["path", { d: "M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5", key: "1j5fej" }],
120
+ ["path", { d: "M19.1 4.9C23 8.8 23 15.1 19.1 19", key: "10b0cb" }]
121
+ ], ce = _("radio", ie);
122
+ /**
123
+ * @license lucide-react v0.511.0 - ISC
124
+ *
125
+ * This source code is licensed under the ISC license.
126
+ * See the LICENSE file in the root directory of this source tree.
127
+ */
128
+ const de = [
129
+ ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
130
+ ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
131
+ ], le = _("x", de);
132
+ function pe(s) {
133
+ const n = Math.floor(s / 1e3);
134
+ if (n < 60) return `${n}s`;
135
+ const o = Math.floor(n / 60);
136
+ return o < 60 ? `${o}m` : `${Math.floor(o / 60)}h ${o % 60}m`;
137
+ }
138
+ const F = {
139
+ high: "High",
140
+ mid: "Mid",
141
+ low: "Low"
142
+ }, D = ["high", "mid", "low"];
143
+ function ue(s) {
144
+ const n = s.config ?? {};
145
+ return s.deviceId === void 0 ? /* @__PURE__ */ e("div", { className: "rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning", children: "StreamBrokerPanel requires a deviceId" }) : /* @__PURE__ */ e(
146
+ me,
147
+ {
148
+ deviceId: s.deviceId,
149
+ title: n.title,
150
+ variant: n.variant,
151
+ hideEmpty: n.hideEmpty
152
+ }
153
+ );
154
+ }
155
+ function me({
156
+ deviceId: s,
157
+ title: n = "Stream Brokers",
158
+ variant: o = "full",
159
+ hideEmpty: i = !1
160
+ }) {
161
+ E(
162
+ ["streamBroker", "listAllProfileSlots"],
163
+ [
164
+ "device.streams-registered",
165
+ "device.streams-unregistered",
166
+ "device.registered",
167
+ "device.unregistered"
168
+ ]
169
+ );
170
+ const { data: c } = Q(
171
+ void 0,
172
+ { staleTime: 3e4 }
173
+ ), t = (c ?? []).filter((p) => p.deviceId === s && p.sourceCamStreamId !== null).slice().sort((p, N) => D.indexOf(p.profile) - D.indexOf(N.profile)), l = W(), d = X(l.trpcClient, s), { data: u } = z({
174
+ queryKey: ["device", s, "cameraStreams.getCameraStreams"],
175
+ queryFn: () => d?.cameraStreams?.getCameraStreams({}) ?? [],
176
+ enabled: !!d,
177
+ staleTime: 3e4
178
+ }), a = /* @__PURE__ */ new Map();
179
+ for (const p of u ?? []) a.set(p.camStreamId, p);
180
+ const m = new Set(
181
+ t.map((p) => p.sourceCamStreamId).filter((p) => p !== null)
182
+ ), f = (u ?? []).filter(
183
+ (p) => !m.has(p.camStreamId)
184
+ ), x = t.length > 0, h = f.length > 0;
185
+ return i && !x && !h ? null : o === "compact" ? x ? /* @__PURE__ */ e("div", { className: "divide-y divide-border/30", children: t.map((p) => /* @__PURE__ */ e(
186
+ P,
187
+ {
188
+ slot: p,
189
+ camStreams: a,
190
+ compact: !0
191
+ },
192
+ p.brokerId
193
+ )) }) : /* @__PURE__ */ e("div", { className: "text-[11px] text-foreground-subtle italic px-2 py-1", children: "No active profile slots" }) : /* @__PURE__ */ r("div", { className: "rounded-lg border border-border bg-surface overflow-hidden", children: [
194
+ /* @__PURE__ */ r("div", { className: "border-b border-border px-4 py-2 flex items-center justify-between", children: [
195
+ /* @__PURE__ */ e("h2", { className: "text-xs font-semibold text-foreground uppercase tracking-wider", children: n }),
196
+ x && /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[10px] font-medium bg-foreground-subtle/10 text-foreground-subtle border border-border", children: [
197
+ t.length,
198
+ " assigned"
199
+ ] })
200
+ ] }),
201
+ x ? /* @__PURE__ */ e("div", { className: "divide-y divide-border/30", children: t.map((p) => /* @__PURE__ */ e(
202
+ P,
203
+ {
204
+ slot: p,
205
+ camStreams: a,
206
+ compact: !1
207
+ },
208
+ p.brokerId
209
+ )) }) : /* @__PURE__ */ r("div", { className: "px-4 py-6 flex flex-col items-center text-center text-foreground-subtle", children: [
210
+ /* @__PURE__ */ e(ce, { className: "h-5 w-5 mb-2 opacity-30" }),
211
+ /* @__PURE__ */ e("p", { className: "text-xs", children: "No profile slots assigned for this device" })
212
+ ] }),
213
+ h && /* @__PURE__ */ e(
214
+ fe,
215
+ {
216
+ deviceId: s,
217
+ camStreamIds: f.map((p) => p.camStreamId),
218
+ camStreams: a
219
+ }
220
+ )
221
+ ] });
222
+ }
223
+ function fe({
224
+ deviceId: s,
225
+ camStreamIds: n,
226
+ camStreams: o
227
+ }) {
228
+ const [i, c] = y(!1);
229
+ return /* @__PURE__ */ r("div", { className: "border-t border-border/50", children: [
230
+ /* @__PURE__ */ r(
231
+ "button",
232
+ {
233
+ type: "button",
234
+ onClick: () => c((t) => !t),
235
+ className: "w-full px-4 py-1.5 flex items-center justify-between bg-surface-hover/30 hover:bg-surface-hover transition-colors",
236
+ children: [
237
+ /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1.5 text-[11px] uppercase tracking-wider text-foreground-subtle", children: [
238
+ i ? /* @__PURE__ */ e(O, { className: "h-3 w-3" }) : /* @__PURE__ */ e(j, { className: "h-3 w-3" }),
239
+ "Other active streams"
240
+ ] }),
241
+ /* @__PURE__ */ e("span", { className: "rounded-full px-2 py-0.5 text-[10px] font-medium bg-foreground-subtle/10 text-foreground-subtle border border-border", children: n.length })
242
+ ]
243
+ }
244
+ ),
245
+ i && /* @__PURE__ */ e("div", { className: "divide-y divide-border/30", children: n.map((t) => /* @__PURE__ */ e(
246
+ he,
247
+ {
248
+ deviceId: s,
249
+ camStreamId: t,
250
+ camStreams: o
251
+ },
252
+ t
253
+ )) })
254
+ ] });
255
+ }
256
+ function he({ deviceId: s, camStreamId: n, camStreams: o }) {
257
+ const i = `${s}/${n}`, t = T("stream-broker.metrics-snapshot", (u) => u.brokerId === i)?.stats, l = o.get(n), d = t?.status === "streaming";
258
+ return /* @__PURE__ */ r("div", { className: "px-4 py-2", children: [
259
+ /* @__PURE__ */ e("div", { className: "flex items-center justify-between mb-1", children: /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5", children: [
260
+ /* @__PURE__ */ e(
261
+ "span",
262
+ {
263
+ className: `h-1.5 w-1.5 rounded-full ${d ? "bg-success" : "bg-foreground-subtle/40"}`
264
+ }
265
+ ),
266
+ /* @__PURE__ */ e("span", { className: "text-[11px] font-medium text-foreground", children: l?.label ?? n }),
267
+ l?.resolution && /* @__PURE__ */ r("span", { className: "text-[10px] text-foreground-subtle", children: [
268
+ l.resolution.width,
269
+ "×",
270
+ l.resolution.height
271
+ ] }),
272
+ /* @__PURE__ */ e("span", { className: `text-[10px] ${d ? "text-success" : "text-foreground-subtle"}`, children: t?.status ?? "idle" })
273
+ ] }) }),
274
+ t && d && /* @__PURE__ */ r("div", { className: "flex flex-wrap gap-x-3 gap-y-1 text-[10px]", children: [
275
+ /* @__PURE__ */ r("span", { className: "inline-flex whitespace-nowrap gap-1", children: [
276
+ /* @__PURE__ */ e("span", { className: "text-foreground-subtle", children: "FPS:" }),
277
+ /* @__PURE__ */ e("span", { className: "text-foreground", children: t.inputFps.toFixed(1) })
278
+ ] }),
279
+ /* @__PURE__ */ r("span", { className: "inline-flex whitespace-nowrap gap-1", children: [
280
+ /* @__PURE__ */ e("span", { className: "text-foreground-subtle", children: "Bitrate:" }),
281
+ /* @__PURE__ */ e("span", { className: "text-foreground", children: t.bitrateKbps >= 1e3 ? `${(t.bitrateKbps / 1e3).toFixed(1)} Mbps` : `${t.bitrateKbps} kbps` })
282
+ ] }),
283
+ /* @__PURE__ */ r("span", { className: "inline-flex whitespace-nowrap gap-1", children: [
284
+ /* @__PURE__ */ e("span", { className: "text-foreground-subtle", children: "Codec:" }),
285
+ /* @__PURE__ */ e("span", { className: "text-foreground", children: t.codec?.toUpperCase() ?? "—" })
286
+ ] }),
287
+ /* @__PURE__ */ r("span", { className: "inline-flex whitespace-nowrap gap-1", children: [
288
+ /* @__PURE__ */ e("span", { className: "text-foreground-subtle", children: "Pkts:" }),
289
+ /* @__PURE__ */ e("span", { className: "text-foreground", children: t.packetCount > 1e3 ? `${(t.packetCount / 1e3).toFixed(1)}k` : t.packetCount })
290
+ ] })
291
+ ] })
292
+ ] });
293
+ }
294
+ function M(s, n) {
295
+ const o = (i) => {
296
+ if (!i || typeof i != "object") return;
297
+ const c = i;
298
+ if (typeof c.key == "string" && c.key === n && "value" in c) return c.value;
299
+ if (c.type === "group" && Array.isArray(c.fields))
300
+ for (const t of c.fields) {
301
+ const l = o(t);
302
+ if (l !== void 0) return l;
303
+ }
304
+ else if (c.type === "sub-tabs" && Array.isArray(c.tabs)) {
305
+ for (const t of c.tabs)
306
+ if (Array.isArray(t.fields))
307
+ for (const l of t.fields) {
308
+ const d = o(l);
309
+ if (d !== void 0) return d;
310
+ }
311
+ }
312
+ };
313
+ for (const i of s?.sections ?? [])
314
+ if (Array.isArray(i.fields))
315
+ for (const c of i.fields) {
316
+ const t = o(c);
317
+ if (t !== void 0) return t;
318
+ }
319
+ }
320
+ function P({ slot: s, camStreams: n, compact: o }) {
321
+ const i = G(), t = T("stream-broker.metrics-snapshot", (b) => b.brokerId === s.brokerId)?.stats;
322
+ E(["streamBroker", "listClients"], ["stream-broker.metrics-snapshot"]);
323
+ const { data: l } = Z(
324
+ { brokerId: s.brokerId },
325
+ { enabled: t?.status === "streaming", staleTime: 2e3 }
326
+ ), { data: d } = V(
327
+ { deviceId: s.deviceId },
328
+ { staleTime: 15e3 }
329
+ ), u = s.sourceCamStreamId ?? s.profile, a = !!(M(d, `preBufferEnabled:${u}`) ?? !0), m = M(d, `preBufferSec:${u}`), f = J({
330
+ onSuccess: () => {
331
+ i.invalidateQueries({ queryKey: [["streamBroker", "getDeviceSettingsContribution"]] });
332
+ }
333
+ }), x = (b) => {
334
+ f.mutate({
335
+ deviceId: s.deviceId,
336
+ patch: { [`preBufferEnabled:${u}`]: b }
337
+ });
338
+ }, h = Y({
339
+ onSuccess: () => {
340
+ i.invalidateQueries({ queryKey: [["streamBroker", "listClients"]] });
341
+ }
342
+ }), p = k(
343
+ (b) => {
344
+ h.mutate({ brokerId: s.brokerId, ...b });
345
+ },
346
+ [h, s.brokerId]
347
+ ), w = (s.sourceCamStreamId ? n.get(s.sourceCamStreamId) : void 0)?.resolution ?? s.resolution, v = t?.status === "streaming", q = w ? `${F[s.profile]} (${w.width}×${w.height})` : F[s.profile], H = t ? t.encodedSubscribers + t.decodedSubscribers + (t.rtspClients ?? 0) + (t.pipeClients ?? 0) : 0;
348
+ return /* @__PURE__ */ r(
349
+ "div",
350
+ {
351
+ className: `@container ${o ? "px-3 py-1.5" : "px-4 py-2"}`,
352
+ style: { containerType: "inline-size" },
353
+ children: [
354
+ /* @__PURE__ */ r("div", { className: "flex items-center justify-between mb-1.5", children: [
355
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5", children: [
356
+ /* @__PURE__ */ e(
357
+ "span",
358
+ {
359
+ className: `h-1.5 w-1.5 rounded-full ${v ? s.profile === "high" ? "bg-success" : s.profile === "mid" ? "bg-warning" : "bg-foreground-subtle" : "bg-foreground-subtle/40"}`
360
+ }
361
+ ),
362
+ /* @__PURE__ */ e("span", { className: "text-[11px] font-medium text-foreground", children: q }),
363
+ /* @__PURE__ */ e("span", { className: `text-[10px] ${v ? "text-success" : "text-foreground-subtle"}`, children: t?.status ?? "loading" }),
364
+ s.sourceCamStreamId && /* @__PURE__ */ r("span", { className: "text-[10px] text-foreground-subtle", children: [
365
+ "← ",
366
+ s.sourceCamStreamId
367
+ ] })
368
+ ] }),
369
+ /* @__PURE__ */ e("span", { className: "text-[10px] text-foreground-subtle", children: t && t.uptimeMs > 0 ? pe(t.uptimeMs) : "—" })
370
+ ] }),
371
+ t && v ? o ? /* @__PURE__ */ r("div", { className: "flex flex-wrap gap-x-3 gap-y-0.5 text-[10px]", children: [
372
+ /* @__PURE__ */ r("span", { className: "inline-flex whitespace-nowrap gap-1", children: [
373
+ /* @__PURE__ */ e("span", { className: "text-foreground-subtle", children: "FPS:" }),
374
+ /* @__PURE__ */ r("span", { className: "text-foreground", children: [
375
+ t.inputFps.toFixed(1),
376
+ "/",
377
+ t.decodeFps.toFixed(1)
378
+ ] })
379
+ ] }),
380
+ /* @__PURE__ */ r("span", { className: "inline-flex whitespace-nowrap gap-1", children: [
381
+ /* @__PURE__ */ e("span", { className: "text-foreground-subtle", children: "Bitrate:" }),
382
+ /* @__PURE__ */ e("span", { className: "text-foreground", children: t.bitrateKbps >= 1e3 ? `${(t.bitrateKbps / 1e3).toFixed(1)} Mbps` : `${t.bitrateKbps} kbps` })
383
+ ] }),
384
+ /* @__PURE__ */ r("span", { className: "inline-flex whitespace-nowrap gap-1", children: [
385
+ /* @__PURE__ */ e("span", { className: "text-foreground-subtle", children: "Codec:" }),
386
+ /* @__PURE__ */ e("span", { className: "text-foreground", children: t.codec?.toUpperCase() ?? "—" })
387
+ ] }),
388
+ /* @__PURE__ */ r("span", { className: "inline-flex items-center whitespace-nowrap gap-1", children: [
389
+ /* @__PURE__ */ e("span", { className: "text-foreground-subtle", children: "Clients:" }),
390
+ /* @__PURE__ */ e("span", { className: "text-foreground font-semibold", children: H }),
391
+ /* @__PURE__ */ e("span", { className: "text-foreground-subtle/70", children: "(" }),
392
+ /* @__PURE__ */ e(Ne, { count: t.encodedSubscribers + t.decodedSubscribers, clients: l, onKill: p }),
393
+ /* @__PURE__ */ e("span", { className: "text-foreground-subtle/70", children: "·" }),
394
+ /* @__PURE__ */ e(ve, { count: t.rtspClients ?? 0, clients: l, onKill: p }),
395
+ /* @__PURE__ */ r("span", { className: "text-foreground-subtle/70", children: [
396
+ "· pipe ",
397
+ t.pipeClients ?? 0,
398
+ ")"
399
+ ] })
400
+ ] })
401
+ ] }) : /* @__PURE__ */ r(B, { children: [
402
+ /* @__PURE__ */ r("div", { className: "flex flex-wrap gap-x-3 gap-y-1 text-[10px]", children: [
403
+ /* @__PURE__ */ r("span", { className: "inline-flex whitespace-nowrap gap-1", children: [
404
+ /* @__PURE__ */ e("span", { className: "text-foreground-subtle", children: "In:" }),
405
+ /* @__PURE__ */ r("span", { className: "text-foreground", children: [
406
+ t.inputFps.toFixed(1),
407
+ " fps"
408
+ ] })
409
+ ] }),
410
+ /* @__PURE__ */ r("span", { className: "inline-flex whitespace-nowrap gap-1", children: [
411
+ /* @__PURE__ */ e("span", { className: "text-foreground-subtle", children: "Dec:" }),
412
+ /* @__PURE__ */ r("span", { className: "text-foreground", children: [
413
+ t.decodeFps.toFixed(1),
414
+ " fps"
415
+ ] })
416
+ ] }),
417
+ /* @__PURE__ */ r("span", { className: "inline-flex whitespace-nowrap gap-1", children: [
418
+ /* @__PURE__ */ e("span", { className: "text-foreground-subtle", children: "Bitrate:" }),
419
+ /* @__PURE__ */ e("span", { className: "text-foreground", children: t.bitrateKbps >= 1e3 ? `${(t.bitrateKbps / 1e3).toFixed(1)} Mbps` : `${t.bitrateKbps} kbps` })
420
+ ] }),
421
+ /* @__PURE__ */ r("span", { className: "hidden @[480px]:inline-flex whitespace-nowrap gap-1", children: [
422
+ /* @__PURE__ */ e("span", { className: "text-foreground-subtle", children: "IDR:" }),
423
+ /* @__PURE__ */ e("span", { className: "text-foreground", children: t.idrIntervalMs > 0 ? `${(t.idrIntervalMs / 1e3).toFixed(1)}s` : "—" })
424
+ ] }),
425
+ /* @__PURE__ */ r("span", { className: "inline-flex whitespace-nowrap gap-1", children: [
426
+ /* @__PURE__ */ e("span", { className: "text-foreground-subtle", children: "Codec:" }),
427
+ /* @__PURE__ */ e("span", { className: "text-foreground", children: t.codec?.toUpperCase() ?? "—" })
428
+ ] }),
429
+ /* @__PURE__ */ r("span", { className: "hidden @[480px]:inline-flex whitespace-nowrap gap-1 max-w-full overflow-hidden", children: [
430
+ /* @__PURE__ */ e("span", { className: "text-foreground-subtle", children: "Decoder:" }),
431
+ /* @__PURE__ */ e("span", { className: "text-foreground font-mono truncate", children: t.decoderNodeId ?? /* @__PURE__ */ e("span", { className: "text-foreground-subtle italic", children: "deferred" }) })
432
+ ] }),
433
+ /* @__PURE__ */ r("span", { className: "hidden @[640px]:inline-flex whitespace-nowrap gap-1", children: [
434
+ /* @__PURE__ */ e("span", { className: "text-foreground-subtle", children: "Pipe:" }),
435
+ /* @__PURE__ */ e("span", { className: "text-foreground", children: t.pipeClients ?? 0 })
436
+ ] }),
437
+ /* @__PURE__ */ r("span", { className: "hidden @[640px]:inline-flex whitespace-nowrap gap-1", children: [
438
+ /* @__PURE__ */ e("span", { className: "text-foreground-subtle", children: "Packets:" }),
439
+ /* @__PURE__ */ e("span", { className: "text-foreground", children: t.packetCount > 1e3 ? `${(t.packetCount / 1e3).toFixed(1)}k` : t.packetCount })
440
+ ] }),
441
+ /* @__PURE__ */ r("span", { className: "hidden @[640px]:inline-flex whitespace-nowrap gap-1", children: [
442
+ /* @__PURE__ */ e("span", { className: "text-foreground-subtle", children: "Data:" }),
443
+ /* @__PURE__ */ e("span", { className: "text-foreground", children: t.totalBytes > 1048576 ? `${(t.totalBytes / 1048576).toFixed(1)} MB` : `${(t.totalBytes / 1024).toFixed(0)} KB` })
444
+ ] }),
445
+ t.audio && /* @__PURE__ */ r("div", { className: "basis-full flex flex-wrap items-center gap-x-1.5 gap-y-0.5", children: [
446
+ /* @__PURE__ */ e("span", { className: "text-foreground-subtle whitespace-nowrap", children: "Audio:" }),
447
+ /* @__PURE__ */ r("span", { className: "inline-flex whitespace-nowrap items-center gap-1.5", children: [
448
+ /* @__PURE__ */ e("span", { className: "text-foreground", children: t.audio.codec.toUpperCase() }),
449
+ /* @__PURE__ */ e("span", { className: "text-foreground-subtle", children: "·" }),
450
+ /* @__PURE__ */ e("span", { className: "text-foreground", children: t.audio.sampleRate >= 1e3 ? `${(t.audio.sampleRate / 1e3).toFixed(t.audio.sampleRate % 1e3 === 0 ? 0 : 1)}kHz` : `${t.audio.sampleRate}Hz` }),
451
+ /* @__PURE__ */ e("span", { className: "text-foreground-subtle", children: "·" }),
452
+ /* @__PURE__ */ e("span", { className: "text-foreground", children: t.audio.channels === 1 ? "mono" : t.audio.channels === 2 ? "stereo" : `${t.audio.channels}ch` })
453
+ ] }),
454
+ /* @__PURE__ */ e("span", { className: `px-1 py-px rounded text-[8px] font-medium whitespace-nowrap ${t.audio.supported ? "bg-success/15 text-success" : "bg-amber-500/15 text-amber-500"}`, children: t.audio.supported ? "decoded" : "no decoder" })
455
+ ] })
456
+ ] }),
457
+ /* @__PURE__ */ e(ge, { clients: l, encodedCount: t.encodedSubscribers, onKill: p })
458
+ ] }) : /* @__PURE__ */ e("p", { className: "text-[10px] text-foreground-subtle italic", children: "No demand — stream suspended" }),
459
+ /* @__PURE__ */ r("div", { className: "mt-1.5 flex items-center gap-1.5 text-[10px]", children: [
460
+ /* @__PURE__ */ e("span", { className: "text-foreground-subtle", children: "Buffer:" }),
461
+ /* @__PURE__ */ e(
462
+ we,
463
+ {
464
+ enabled: a,
465
+ onToggle: (b) => x(b),
466
+ disabled: f.isPending
467
+ }
468
+ ),
469
+ /* @__PURE__ */ r("span", { className: "text-foreground", children: [
470
+ m ?? t?.preBufferSec ?? 0,
471
+ "s",
472
+ t && v ? ` (${t.preBufferPackets}p)` : ""
473
+ ] })
474
+ ] })
475
+ ]
476
+ }
477
+ );
478
+ }
479
+ const xe = 280, be = 120;
480
+ function K({ trigger: s, content: n, widthClass: o }) {
481
+ const i = I(null), c = I(null), [t, l] = y(!1), [d, u] = y(!1), a = k(() => {
482
+ c.current && (clearTimeout(c.current), c.current = null);
483
+ }, []), m = k(() => {
484
+ a(), c.current = setTimeout(() => l(!1), be);
485
+ }, [a]), f = k(() => {
486
+ a();
487
+ const h = i.current;
488
+ if (h) {
489
+ const p = h.getBoundingClientRect(), N = window.innerHeight - p.bottom, w = p.top;
490
+ u(N < xe && w > N);
491
+ }
492
+ l(!0);
493
+ }, [a]);
494
+ return /* @__PURE__ */ r(
495
+ "span",
496
+ {
497
+ ref: i,
498
+ className: "relative inline-block",
499
+ onMouseEnter: f,
500
+ onMouseLeave: m,
501
+ children: [
502
+ s,
503
+ t && /* @__PURE__ */ e(
504
+ "div",
505
+ {
506
+ className: `absolute left-0 ${d ? "bottom-full mb-1" : "top-full mt-1"} z-50 ${o} rounded-md border border-border bg-surface shadow-xl p-2 text-[10px] normal-case`,
507
+ onMouseEnter: a,
508
+ onMouseLeave: m,
509
+ children: n
510
+ }
511
+ )
512
+ ]
513
+ }
514
+ );
515
+ }
516
+ function g(s) {
517
+ if (s < 1e3) return `${s}ms`;
518
+ const n = Math.floor(s / 1e3);
519
+ if (n < 60) return `${n}s`;
520
+ const o = Math.floor(n / 60);
521
+ return o < 60 ? `${o}m ${n % 60}s` : `${Math.floor(o / 60)}h ${o % 60}m`;
522
+ }
523
+ function U(s) {
524
+ return s < 1024 ? `${s} B` : s < 1048576 ? `${(s / 1024).toFixed(1)} KB` : s < 1073741824 ? `${(s / 1048576).toFixed(1)} MB` : `${(s / 1073741824).toFixed(2)} GB`;
525
+ }
526
+ function ge({ clients: s, encodedCount: n, onKill: o }) {
527
+ const i = s?.decoded ?? [], c = s?.audio ?? [], t = s?.rtsp ?? [], l = i.length + c.length + t.length + n, [d, u] = y(!0);
528
+ return l === 0 ? /* @__PURE__ */ e("div", { className: "mt-1.5 text-[10px] text-foreground-subtle italic", children: "No active subscribers" }) : /* @__PURE__ */ r("div", { className: "mt-1.5 border-t border-border/30 pt-1.5", children: [
529
+ /* @__PURE__ */ r(
530
+ "button",
531
+ {
532
+ type: "button",
533
+ onClick: () => u((a) => !a),
534
+ className: "flex items-center gap-1 text-[10px] text-foreground-subtle hover:text-foreground transition-colors",
535
+ children: [
536
+ d ? /* @__PURE__ */ e(O, { className: "h-3 w-3" }) : /* @__PURE__ */ e(j, { className: "h-3 w-3" }),
537
+ /* @__PURE__ */ r("span", { className: "uppercase tracking-wider", children: [
538
+ "Subscribers (",
539
+ l,
540
+ ")"
541
+ ] })
542
+ ]
543
+ }
544
+ ),
545
+ d && /* @__PURE__ */ r("div", { className: "mt-1 divide-y divide-border/20", children: [
546
+ i.map((a, m) => /* @__PURE__ */ e(
547
+ $,
548
+ {
549
+ kind: "DECODED",
550
+ kindClass: "bg-success/10 text-success",
551
+ tag: a.tag || "unknown",
552
+ metrics: [
553
+ `${a.maxFps.toFixed(0)}fps`,
554
+ `${a.framesDelivered} del`,
555
+ ...a.framesDropped > 0 ? [{ text: `${a.framesDropped} drop`, warn: !0 }] : []
556
+ ],
557
+ age: Date.now() - a.subscribedAt,
558
+ onKill: o && a.tag ? () => o({ channel: "decoded", handle: a.tag }) : void 0
559
+ },
560
+ `d-${m}`
561
+ )),
562
+ c.map((a, m) => /* @__PURE__ */ e(
563
+ $,
564
+ {
565
+ kind: "AUDIO",
566
+ kindClass: "bg-info/10 text-info",
567
+ tag: a.tag || "unknown",
568
+ metrics: [`${a.chunksDelivered} chunks`],
569
+ age: Date.now() - a.subscribedAt,
570
+ onKill: o && a.tag ? () => o({ channel: "audio", handle: a.tag }) : void 0
571
+ },
572
+ `a-${m}`
573
+ )),
574
+ t.map((a) => {
575
+ const m = Date.now() - a.lastRtpAt, f = m > 5e3, x = a.playing ? f ? "stalled" : "playing" : "paused", h = a.playing ? f ? "bg-amber-400/10 text-amber-400" : "bg-success/10 text-success" : "bg-foreground-subtle/10 text-foreground-subtle";
576
+ return /* @__PURE__ */ e(
577
+ $,
578
+ {
579
+ kind: "RTSP",
580
+ kindClass: "bg-warning/10 text-warning",
581
+ tag: a.remoteAddr,
582
+ state: { text: x + (a.muted ? " · muted" : ""), className: h },
583
+ metrics: [U(a.bytesSent), `last rtp ${g(m)} ago`],
584
+ age: Date.now() - a.connectedAt,
585
+ onKill: o ? () => o({ channel: "rtsp", handle: a.sessionId }) : void 0
586
+ },
587
+ `r-${a.sessionId}`
588
+ );
589
+ }),
590
+ n > 0 && /* @__PURE__ */ r("div", { className: "py-0.5 text-[10px] text-foreground-subtle", children: [
591
+ /* @__PURE__ */ e("span", { className: "inline-block px-1 rounded text-[9px] font-bold bg-foreground-subtle/10 text-foreground-subtle mr-2", children: "ENCODED" }),
592
+ n,
593
+ " callback subscriber(s)"
594
+ ] })
595
+ ] })
596
+ ] });
597
+ }
598
+ function $({ kind: s, kindClass: n, tag: o, state: i, metrics: c, age: t, onKill: l }) {
599
+ return /* @__PURE__ */ r("div", { className: "flex items-center gap-2 py-0.5 text-[10px]", children: [
600
+ /* @__PURE__ */ e("span", { className: `inline-block px-1 rounded text-[9px] font-bold shrink-0 w-14 text-center ${n}`, children: s }),
601
+ /* @__PURE__ */ e("span", { className: "text-foreground font-medium truncate flex-1", children: o }),
602
+ i && /* @__PURE__ */ e("span", { className: `text-[9px] px-1 rounded shrink-0 ${i.className}`, children: i.text }),
603
+ /* @__PURE__ */ r("span", { className: "text-foreground-subtle flex items-center gap-1.5 shrink-0", children: [
604
+ c.map((d, u) => /* @__PURE__ */ r("span", { children: [
605
+ u > 0 && /* @__PURE__ */ e("span", { className: "mr-1.5 text-foreground-subtle/50", children: "·" }),
606
+ typeof d == "string" ? d : /* @__PURE__ */ e("span", { className: d.warn ? "text-amber-400" : "", children: d.text })
607
+ ] }, u)),
608
+ /* @__PURE__ */ r("span", { className: "text-foreground-subtle/70", children: [
609
+ "· ",
610
+ g(t)
611
+ ] })
612
+ ] }),
613
+ /* @__PURE__ */ e("div", { className: "w-5 flex-shrink-0 flex items-center justify-end", children: l ? /* @__PURE__ */ e(C, { onClick: l }) : null })
614
+ ] });
615
+ }
616
+ function Ne({ count: s, clients: n, onKill: o }) {
617
+ const i = n?.decoded ?? [], c = n?.audio ?? [], t = n ? n.encodedSubscribers : 0, l = i.length > 0 || c.length > 0 || t > 0, d = /* @__PURE__ */ e("span", { className: `text-foreground ${l ? "underline decoration-dotted decoration-foreground-subtle/50 underline-offset-2 cursor-help" : ""}`, children: s });
618
+ if (!l) return d;
619
+ const u = /* @__PURE__ */ r(B, { children: [
620
+ i.length > 0 && /* @__PURE__ */ r("div", { className: "mb-2", children: [
621
+ /* @__PURE__ */ e("div", { className: "text-foreground-subtle uppercase text-[9px] tracking-wider mb-1", children: "Decoded subscribers" }),
622
+ i.map((a, m) => /* @__PURE__ */ r("div", { className: "flex items-center justify-between gap-2 py-0.5", children: [
623
+ /* @__PURE__ */ e("span", { className: "text-foreground font-medium truncate", children: a.tag || "unknown" }),
624
+ /* @__PURE__ */ r("span", { className: "text-foreground-subtle text-[9px] flex items-center gap-1.5 shrink-0", children: [
625
+ /* @__PURE__ */ r("span", { children: [
626
+ a.maxFps.toFixed(0),
627
+ "fps"
628
+ ] }),
629
+ /* @__PURE__ */ e("span", { children: "·" }),
630
+ /* @__PURE__ */ r("span", { children: [
631
+ a.framesDelivered,
632
+ " del"
633
+ ] }),
634
+ a.framesDropped > 0 && /* @__PURE__ */ r("span", { className: "text-amber-400", children: [
635
+ "· ",
636
+ a.framesDropped,
637
+ " drop"
638
+ ] }),
639
+ /* @__PURE__ */ e("span", { children: "·" }),
640
+ /* @__PURE__ */ e("span", { children: g(Date.now() - a.subscribedAt) }),
641
+ o && a.tag && /* @__PURE__ */ e(C, { onClick: () => o({ channel: "decoded", handle: a.tag }) })
642
+ ] })
643
+ ] }, `d-${m}`))
644
+ ] }),
645
+ c.length > 0 && /* @__PURE__ */ r("div", { className: "mb-2", children: [
646
+ /* @__PURE__ */ e("div", { className: "text-foreground-subtle uppercase text-[9px] tracking-wider mb-1", children: "Audio subscribers" }),
647
+ c.map((a, m) => /* @__PURE__ */ r("div", { className: "flex items-center justify-between gap-2 py-0.5", children: [
648
+ /* @__PURE__ */ e("span", { className: "text-foreground font-medium truncate", children: a.tag || "unknown" }),
649
+ /* @__PURE__ */ r("span", { className: "text-foreground-subtle text-[9px] flex items-center gap-1.5 shrink-0", children: [
650
+ /* @__PURE__ */ r("span", { children: [
651
+ a.chunksDelivered,
652
+ " chunks"
653
+ ] }),
654
+ /* @__PURE__ */ e("span", { children: "·" }),
655
+ /* @__PURE__ */ e("span", { children: g(Date.now() - a.subscribedAt) }),
656
+ o && a.tag && /* @__PURE__ */ e(C, { onClick: () => o({ channel: "audio", handle: a.tag }) })
657
+ ] })
658
+ ] }, `a-${m}`))
659
+ ] }),
660
+ t > 0 && /* @__PURE__ */ r("div", { children: [
661
+ /* @__PURE__ */ e("div", { className: "text-foreground-subtle uppercase text-[9px] tracking-wider mb-1", children: "Encoded" }),
662
+ /* @__PURE__ */ r("div", { className: "text-foreground", children: [
663
+ t,
664
+ " callback subscriber(s)"
665
+ ] })
666
+ ] })
667
+ ] });
668
+ return /* @__PURE__ */ e(K, { trigger: d, content: u, widthClass: "min-w-[260px] max-w-[360px]" });
669
+ }
670
+ function we({
671
+ enabled: s,
672
+ onToggle: n,
673
+ disabled: o
674
+ }) {
675
+ return /* @__PURE__ */ e(
676
+ "button",
677
+ {
678
+ type: "button",
679
+ role: "switch",
680
+ "aria-checked": s,
681
+ disabled: o,
682
+ onClick: () => n(!s),
683
+ className: `relative inline-flex h-3 w-6 shrink-0 items-center rounded-full transition-colors ${s ? "bg-success/60" : "bg-foreground-subtle/30"} ${o ? "opacity-50 cursor-wait" : "cursor-pointer"}`,
684
+ title: s ? "Pre-buffer enabled — click to disable" : "Pre-buffer disabled — click to enable",
685
+ children: /* @__PURE__ */ e(
686
+ "span",
687
+ {
688
+ className: `inline-block h-2.5 w-2.5 rounded-full bg-white shadow transition-transform ${s ? "translate-x-3" : "translate-x-0.5"}`
689
+ }
690
+ )
691
+ }
692
+ );
693
+ }
694
+ function C({ onClick: s }) {
695
+ return /* @__PURE__ */ e(
696
+ "button",
697
+ {
698
+ type: "button",
699
+ title: "Force-disconnect this client",
700
+ onClick: (n) => {
701
+ n.stopPropagation(), s();
702
+ },
703
+ className: "inline-flex items-center justify-center h-4 w-4 rounded-sm border border-border/60 text-foreground-subtle hover:bg-red-500/10 hover:text-red-400 hover:border-red-500/40 transition-colors",
704
+ children: /* @__PURE__ */ e(le, { className: "h-2.5 w-2.5" })
705
+ }
706
+ );
707
+ }
708
+ function ve({ count: s, clients: n, onKill: o }) {
709
+ const i = n?.rtsp ?? [], c = i.length > 0, t = /* @__PURE__ */ e("span", { className: `text-foreground ${c ? "underline decoration-dotted decoration-foreground-subtle/50 underline-offset-2 cursor-help" : ""}`, children: s });
710
+ if (!c) return t;
711
+ const l = /* @__PURE__ */ r(B, { children: [
712
+ /* @__PURE__ */ e("div", { className: "text-foreground-subtle uppercase text-[9px] tracking-wider mb-1", children: "RTSP sessions" }),
713
+ i.map((d) => {
714
+ const u = Date.now() - d.lastRtpAt, a = u > 5e3;
715
+ return /* @__PURE__ */ r("div", { className: "py-1 border-b border-border/40 last:border-b-0", children: [
716
+ /* @__PURE__ */ r("div", { className: "flex items-center justify-between gap-2", children: [
717
+ /* @__PURE__ */ e("span", { className: "text-foreground font-mono", children: d.remoteAddr }),
718
+ /* @__PURE__ */ r("span", { className: "flex items-center gap-1 shrink-0", children: [
719
+ /* @__PURE__ */ r("span", { className: `text-[9px] px-1 rounded ${d.playing ? a ? "bg-amber-400/10 text-amber-400" : "bg-success/10 text-success" : "bg-foreground-subtle/10 text-foreground-subtle"}`, children: [
720
+ d.playing ? a ? "stalled" : "playing" : "paused",
721
+ d.muted && " · muted"
722
+ ] }),
723
+ o && /* @__PURE__ */ e(C, { onClick: () => o({ channel: "rtsp", handle: d.sessionId }) })
724
+ ] })
725
+ ] }),
726
+ /* @__PURE__ */ r("div", { className: "flex items-center justify-between gap-2 text-foreground-subtle text-[9px] mt-0.5", children: [
727
+ /* @__PURE__ */ r("span", { children: [
728
+ U(d.bytesSent),
729
+ " sent"
730
+ ] }),
731
+ /* @__PURE__ */ r("span", { children: [
732
+ "connected ",
733
+ g(Date.now() - d.connectedAt),
734
+ " ago"
735
+ ] }),
736
+ /* @__PURE__ */ r("span", { children: [
737
+ "last rtp ",
738
+ g(u),
739
+ " ago"
740
+ ] })
741
+ ] })
742
+ ] }, d.sessionId);
743
+ })
744
+ ] });
745
+ return /* @__PURE__ */ e(K, { trigger: t, content: l, widthClass: "min-w-[300px] max-w-[420px]" });
746
+ }
747
+ const $e = {
748
+ "stream-broker-panel": ue
749
+ };
750
+ export {
751
+ $e as default
752
+ };