@arbidocs/blocks 0.5.177 → 0.5.178

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 (70) hide show
  1. package/dist/{ConnectedCallDock-KD5LWW2E.cjs → ConnectedCallDock-53JEGRVT.cjs} +13 -13
  2. package/dist/{ConnectedCallDock-KD5LWW2E.cjs.map → ConnectedCallDock-53JEGRVT.cjs.map} +1 -1
  3. package/dist/{ConnectedCallRoom-GSMF7ZUE.cjs → ConnectedCallRoom-DRIDU6Q6.cjs} +6 -6
  4. package/dist/{ConnectedCallRoom-GSMF7ZUE.cjs.map → ConnectedCallRoom-DRIDU6Q6.cjs.map} +1 -1
  5. package/dist/{FilesViewerDialog-JIV4VGYQ.cjs → FilesViewerDialog-PZ5H435S.cjs} +7 -7
  6. package/dist/{FilesViewerDialog-JIV4VGYQ.cjs.map → FilesViewerDialog-PZ5H435S.cjs.map} +1 -1
  7. package/dist/agents/definitions/AgentCreator.d.ts +8 -1
  8. package/dist/agents/definitions/AgentCreator.js +30 -0
  9. package/dist/agents/definitions/AgentCreator.js.map +2 -2
  10. package/dist/agents/index.cjs +162 -162
  11. package/dist/avatar-renderer-4OYU4ZD2.cjs +309 -0
  12. package/dist/avatar-renderer-4OYU4ZD2.cjs.map +1 -0
  13. package/dist/calls/composite-canvas.js +7 -3
  14. package/dist/calls/composite-canvas.js.map +2 -2
  15. package/dist/calls/connected/CallAvatarMedia.d.ts +12 -0
  16. package/dist/calls/connected/CallAvatarMedia.js +105 -0
  17. package/dist/calls/connected/CallAvatarMedia.js.map +7 -0
  18. package/dist/calls/connected/CallRecording.js +7 -2
  19. package/dist/calls/connected/CallRecording.js.map +2 -2
  20. package/dist/calls/connected/ConnectedCallRoom.js +29 -14
  21. package/dist/calls/connected/ConnectedCallRoom.js.map +2 -2
  22. package/dist/calls/connected/avatar-framing.d.ts +21 -0
  23. package/dist/calls/connected/avatar-framing.js +67 -0
  24. package/dist/calls/connected/avatar-framing.js.map +7 -0
  25. package/dist/calls/connected/avatar-renderer.d.ts +14 -0
  26. package/dist/calls/connected/avatar-renderer.js +200 -0
  27. package/dist/calls/connected/avatar-renderer.js.map +7 -0
  28. package/dist/calls/connected/avatar-wireframe.d.ts +6 -0
  29. package/dist/calls/connected/avatar-wireframe.js +31 -0
  30. package/dist/calls/connected/avatar-wireframe.js.map +7 -0
  31. package/dist/calls/connected/call-media-state.d.ts +8 -0
  32. package/dist/calls/connected/call-media-state.js +24 -0
  33. package/dist/calls/connected/call-media-state.js.map +7 -0
  34. package/dist/calls/index.cjs +69 -69
  35. package/dist/chat/index.cjs +5 -5
  36. package/dist/{chunk-TH3G7FZE.cjs → chunk-4H5DPHZ2.cjs} +33 -3
  37. package/dist/chunk-4H5DPHZ2.cjs.map +1 -0
  38. package/dist/{chunk-3YUC23EC.cjs → chunk-A4HOEGDI.cjs} +4 -4
  39. package/dist/{chunk-3YUC23EC.cjs.map → chunk-A4HOEGDI.cjs.map} +1 -1
  40. package/dist/{chunk-GAHGZBBM.cjs → chunk-KQYFJXR5.cjs} +256 -135
  41. package/dist/chunk-KQYFJXR5.cjs.map +1 -0
  42. package/dist/{chunk-RMRJ5KVE.cjs → chunk-S4KKJX3G.cjs} +4 -4
  43. package/dist/{chunk-RMRJ5KVE.cjs.map → chunk-S4KKJX3G.cjs.map} +1 -1
  44. package/dist/{chunk-BCU65RJM.cjs → chunk-XQPJWPWE.cjs} +9 -5
  45. package/dist/chunk-XQPJWPWE.cjs.map +1 -0
  46. package/dist/{chunk-63D67ZGG.cjs → chunk-YBDHWNFZ.cjs} +6 -6
  47. package/dist/{chunk-63D67ZGG.cjs.map → chunk-YBDHWNFZ.cjs.map} +1 -1
  48. package/dist/{chunk-VSX4CD7P.cjs → chunk-YC72ZCV4.cjs} +3 -3
  49. package/dist/{chunk-VSX4CD7P.cjs.map → chunk-YC72ZCV4.cjs.map} +1 -1
  50. package/dist/{chunk-SMGUXRO5.cjs → chunk-YHABS4UE.cjs} +19 -19
  51. package/dist/{chunk-SMGUXRO5.cjs.map → chunk-YHABS4UE.cjs.map} +1 -1
  52. package/dist/connect/index.cjs +360 -332
  53. package/dist/connect/index.cjs.map +1 -1
  54. package/dist/connect/viewer.cjs +5 -5
  55. package/dist/connection/ConnectedAgentCreator.js +25 -2
  56. package/dist/connection/ConnectedAgentCreator.js.map +2 -2
  57. package/dist/connection/settings-page/featuresSection.js +7 -0
  58. package/dist/connection/settings-page/featuresSection.js.map +2 -2
  59. package/dist/embed/index.cjs +11 -11
  60. package/dist/home/index.cjs +9 -9
  61. package/dist/index.cjs +300 -300
  62. package/dist/studio/index.cjs +1 -1
  63. package/dist/styles.css +1 -1
  64. package/dist/workflow-canvas/index.cjs +13 -13
  65. package/dist/workspaces/index.cjs +5 -5
  66. package/node_modules/@arbidocs/coedit/package.json +1 -1
  67. package/package.json +8 -5
  68. package/dist/chunk-BCU65RJM.cjs.map +0 -1
  69. package/dist/chunk-GAHGZBBM.cjs.map +0 -1
  70. package/dist/chunk-TH3G7FZE.cjs.map +0 -1
@@ -3,17 +3,17 @@
3
3
 
4
4
  var chunkZHLBTIJJ_cjs = require('./chunk-ZHLBTIJJ.cjs');
5
5
  var chunkVZOOGA47_cjs = require('./chunk-VZOOGA47.cjs');
6
- var chunkBCU65RJM_cjs = require('./chunk-BCU65RJM.cjs');
6
+ var chunkXQPJWPWE_cjs = require('./chunk-XQPJWPWE.cjs');
7
7
  var chunkOAIOOVFN_cjs = require('./chunk-OAIOOVFN.cjs');
8
8
  var chunkZ574BY3H_cjs = require('./chunk-Z574BY3H.cjs');
9
9
  var chunkZBP4ZSAJ_cjs = require('./chunk-ZBP4ZSAJ.cjs');
10
10
  var chunkHN56WWBR_cjs = require('./chunk-HN56WWBR.cjs');
11
11
  var chunkCVPV4I7Z_cjs = require('./chunk-CVPV4I7Z.cjs');
12
- var react$1 = require('react');
12
+ var react = require('react');
13
13
  var livekitClient = require('livekit-client');
14
14
  var componentsReact = require('@livekit/components-react');
15
15
  var lucideReact = require('lucide-react');
16
- var react = require('@arbidocs/react');
16
+ var react$1 = require('@arbidocs/react');
17
17
  var ui = require('@arbidocs/react/ui');
18
18
  var calls = require('@arbidocs/react/calls');
19
19
  var jsxRuntime = require('react/jsx-runtime');
@@ -25,7 +25,7 @@ function TranscriptionToggle({
25
25
  if (!available || !canToggle) return null;
26
26
  const label = on ? "Stop transcription" : "Transcribe the call";
27
27
  return /* @__PURE__ */ jsxRuntime.jsxs(
28
- chunkBCU65RJM_cjs.CallControlButton,
28
+ chunkXQPJWPWE_cjs.CallControlButton,
29
29
  {
30
30
  label,
31
31
  shortcut: "C",
@@ -50,13 +50,13 @@ function TranscriptionIndicator({
50
50
  className
51
51
  }) {
52
52
  const { setIndicatorShown, startedByName, startedByMe, muted, setMuted } = transcription;
53
- react$1.useEffect(() => {
53
+ react.useEffect(() => {
54
54
  setIndicatorShown(true);
55
55
  return () => setIndicatorShown(false);
56
56
  }, [setIndicatorShown]);
57
57
  const by = startedByMe ? "you" : startedByName || "a participant";
58
58
  return /* @__PURE__ */ jsxRuntime.jsx(
59
- chunkBCU65RJM_cjs.TranscriptionStatusChip,
59
+ chunkXQPJWPWE_cjs.TranscriptionStatusChip,
60
60
  {
61
61
  sentence: `Transcription on \u2014 started by ${by}`,
62
62
  short: muted ? "Transcribing \xB7 you are muted" : "Transcribing",
@@ -78,7 +78,7 @@ function CaptionsOverlay({
78
78
  reserve = false,
79
79
  className
80
80
  }) {
81
- const entries = react$1.useMemo(
81
+ const entries = react.useMemo(
82
82
  () => captions.map((c) => ({
83
83
  id: c.segmentId,
84
84
  speakerId: c.identity,
@@ -89,33 +89,117 @@ function CaptionsOverlay({
89
89
  })),
90
90
  [captions]
91
91
  );
92
- return /* @__PURE__ */ jsxRuntime.jsx(chunkBCU65RJM_cjs.CaptionsStrip, { captions: entries, reserve, className });
92
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkXQPJWPWE_cjs.CaptionsStrip, { captions: entries, reserve, className });
93
93
  }
94
94
  function TranscriptionSender({ transcription }) {
95
95
  const { isMicrophoneEnabled, microphoneTrack } = componentsReact.useLocalParticipant();
96
96
  const track = microphoneTrack?.track?.mediaStreamTrack ?? null;
97
97
  const active = transcription.shouldSend && isMicrophoneEnabled && !!track;
98
98
  const { handleSegment } = transcription;
99
- const onSegment = react$1.useCallback(
99
+ const onSegment = react.useCallback(
100
100
  (segment) => void handleSegment(segment),
101
101
  [handleSegment]
102
102
  );
103
- const { start, stop } = react.useAudioRecorder({ track, onSegment, segmenter: react.LIVE_SEGMENTER });
104
- react$1.useEffect(() => {
103
+ const { start, stop } = react$1.useAudioRecorder({ track, onSegment, segmenter: react$1.LIVE_SEGMENTER });
104
+ react.useEffect(() => {
105
105
  if (!active) return;
106
106
  void start();
107
107
  return () => stop();
108
108
  }, [active, track, start, stop]);
109
109
  return null;
110
110
  }
111
+ var MediaContext = react.createContext(/* @__PURE__ */ new Map());
112
+ var useCallMediaPlayers = () => react.useContext(MediaContext);
113
+ var LazyAvatar = react.lazy(async () => ({ default: AvatarCanvas }));
114
+ function CallAvatarMedia({
115
+ callKey,
116
+ children
117
+ }) {
118
+ const enabled = react$1.useCallAvatarsEnabled();
119
+ const players = calls.useCallMedia(enabled, callKey);
120
+ const room = componentsReact.useRoomContext();
121
+ const tracks = componentsReact.useTracks(
122
+ [livekitClient.Track.Source.Microphone, livekitClient.Track.Source.ScreenShareAudio, livekitClient.Track.Source.Unknown],
123
+ { onlySubscribed: true, room }
124
+ ).filter((ref) => !ref.participant.isLocal && ref.publication.kind === livekitClient.Track.Kind.Audio);
125
+ return /* @__PURE__ */ jsxRuntime.jsxs(MediaContext.Provider, { value: players, children: [
126
+ children,
127
+ /* @__PURE__ */ jsxRuntime.jsx("div", { hidden: true, children: tracks.filter(
128
+ (ref) => ref.source !== livekitClient.Track.Source.Microphone || !players.get(ref.participant.identity)?.suppressesTrack
129
+ ).map((trackRef) => /* @__PURE__ */ jsxRuntime.jsx(componentsReact.AudioTrack, { trackRef }, trackRef.publication.trackSid)) })
130
+ ] });
131
+ }
132
+ function AssistantAvatar({ identity, avatar }) {
133
+ const enabled = react$1.useCallAvatarsEnabled();
134
+ const players = react.useContext(MediaContext);
135
+ const player = players.get(identity);
136
+ if (!enabled || !avatar || !["james", "claire", "mark"].includes(avatar)) return null;
137
+ return /* @__PURE__ */ jsxRuntime.jsx(react.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx(AvatarLoading, {}), children: /* @__PURE__ */ jsxRuntime.jsx(LazyAvatar, { avatar, player }) });
138
+ }
139
+ function AvatarLoading() {
140
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-full items-center justify-center text-xs text-muted-foreground", children: "Loading assistant projection\u2026" });
141
+ }
142
+ function AvatarCanvas({
143
+ avatar,
144
+ player
145
+ }) {
146
+ const arbi = react$1.useArbi();
147
+ const host = react.useRef(null);
148
+ const current = react.useRef(player);
149
+ current.current = player;
150
+ const [state, setState] = react.useState("loading");
151
+ react.useEffect(() => {
152
+ let disposed = false;
153
+ let destroy;
154
+ setState("loading");
155
+ void Promise.all([
156
+ arbi.calls.avatarAsset(avatar, "head.glb"),
157
+ arbi.calls.avatarAsset(avatar, "head-clearance.json"),
158
+ arbi.calls.avatarAsset(avatar, "blinks.json"),
159
+ import('./avatar-renderer-4OYU4ZD2.cjs')
160
+ ]).then(async ([model, clearance, blinks, { createAvatarRenderer }]) => {
161
+ if (disposed || !host.current) return;
162
+ const assets = {
163
+ model,
164
+ clearance: JSON.parse(new TextDecoder().decode(clearance)),
165
+ blinks: JSON.parse(new TextDecoder().decode(blinks))
166
+ };
167
+ destroy = await createAvatarRenderer(host.current, assets, () => current.current);
168
+ if (disposed) destroy();
169
+ else setState("ready");
170
+ }).catch(() => {
171
+ if (!disposed) setState("error");
172
+ });
173
+ return () => {
174
+ disposed = true;
175
+ destroy?.();
176
+ };
177
+ }, [arbi, avatar]);
178
+ return /* @__PURE__ */ jsxRuntime.jsxs(
179
+ "div",
180
+ {
181
+ className: "relative size-full overflow-hidden bg-[#020713]",
182
+ "data-testid": "assistant-call-avatar",
183
+ "data-avatar": avatar,
184
+ "data-render-state": state,
185
+ "data-audio-mode": player?.suppressesTrack ? "synchronized" : "livekit",
186
+ children: [
187
+ /* @__PURE__ */ jsxRuntime.jsx("div", { ref: host, className: "absolute inset-0" }),
188
+ state === "loading" && /* @__PURE__ */ jsxRuntime.jsx(AvatarLoading, {}),
189
+ state === "error" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 flex items-center justify-center text-xs text-muted-foreground", children: "Projection unavailable \xB7 audio call continues" }),
190
+ state === "ready" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pointer-events-none absolute bottom-2 right-3 text-[10px] text-sky-200/70", children: "Drag to rotate" })
191
+ ]
192
+ }
193
+ );
194
+ }
111
195
  function RecordingControl({
112
196
  recording
113
197
  }) {
114
198
  const { available, canControl, on, busy, requestStart, stop } = recording;
115
- const canHost = react.useIsEntitled("host_calls");
199
+ const canHost = react$1.useIsEntitled("host_calls");
116
200
  if (!available || !canControl || !on && !canHost) return null;
117
201
  return /* @__PURE__ */ jsxRuntime.jsx(
118
- chunkBCU65RJM_cjs.RecordControl,
202
+ chunkXQPJWPWE_cjs.RecordControl,
119
203
  {
120
204
  on,
121
205
  busy,
@@ -173,13 +257,13 @@ function RecordingIndicator({
173
257
  className
174
258
  }) {
175
259
  const { setIndicatorShown, mode, startedByMe, startedByName } = recording;
176
- react$1.useEffect(() => {
260
+ react.useEffect(() => {
177
261
  setIndicatorShown(true);
178
262
  return () => setIndicatorShown(false);
179
263
  }, [setIndicatorShown]);
180
264
  const by = startedByMe ? "you" : startedByName || "the host";
181
265
  return /* @__PURE__ */ jsxRuntime.jsx(
182
- chunkBCU65RJM_cjs.RecordingStatusChip,
266
+ chunkXQPJWPWE_cjs.RecordingStatusChip,
183
267
  {
184
268
  sentence: `Recording${mode ? ` (${chunkZ574BY3H_cjs.MODE_LABEL[mode]})` : ""} \u2014 started by ${by}`,
185
269
  compact,
@@ -197,13 +281,13 @@ function SpeakerRecorder({
197
281
  }) {
198
282
  const { microphoneTrack } = componentsReact.useLocalParticipant();
199
283
  const track = microphoneTrack?.track?.mediaStreamTrack ?? null;
200
- const mimeType = react$1.useMemo(() => react.pickRecorderMimeType("audio"), []);
284
+ const mimeType = react.useMemo(() => react$1.pickRecorderMimeType("audio"), []);
201
285
  const uploader = calls.useTrackUploader(recording, callKey, "speaker", mimeType);
202
- const uploaderRef = react$1.useRef(uploader);
286
+ const uploaderRef = react.useRef(uploader);
203
287
  uploaderRef.current = uploader;
204
- const lastUploader = react$1.useRef(null);
288
+ const lastUploader = react.useRef(null);
205
289
  if (uploader) lastUploader.current = uploader;
206
- const onSegment = react$1.useCallback((segment) => {
290
+ const onSegment = react.useCallback((segment) => {
207
291
  const target = uploaderRef.current ?? lastUploader.current;
208
292
  target?.enqueue({
209
293
  blob: segment.blob,
@@ -211,15 +295,15 @@ function SpeakerRecorder({
211
295
  durationMs: segment.durationMs
212
296
  });
213
297
  }, []);
214
- const { start, stop } = react.useAudioRecorder({
298
+ const { start, stop } = react$1.useAudioRecorder({
215
299
  track,
216
300
  onSegment,
217
- chunkMs: react.RECORDING_CHUNK_MS,
301
+ chunkMs: react$1.RECORDING_CHUNK_MS,
218
302
  mimeType,
219
- audioBitsPerSecond: react.SPEAKER_AUDIO_BITS_PER_SECOND
303
+ audioBitsPerSecond: react$1.SPEAKER_AUDIO_BITS_PER_SECOND
220
304
  });
221
305
  const active = !!uploader && !!track;
222
- react$1.useEffect(() => {
306
+ react.useEffect(() => {
223
307
  if (!active) return;
224
308
  void start();
225
309
  return () => stop();
@@ -232,24 +316,28 @@ function CompositeRecorder({
232
316
  stageRef
233
317
  }) {
234
318
  const { notify } = chunkHN56WWBR_cjs.useBlocksEnvironment();
235
- const mimeType = react$1.useMemo(() => react.pickRecorderMimeType("video"), []);
319
+ const mimeType = react.useMemo(() => react$1.pickRecorderMimeType("video"), []);
236
320
  const uploader = calls.useTrackUploader(recording, callKey, "composite", mimeType);
237
321
  const audioRefs = componentsReact.useTracks([livekitClient.Track.Source.Microphone, livekitClient.Track.Source.ScreenShareAudio], {
238
322
  onlySubscribed: true
239
323
  });
240
- const audioTracks = react$1.useMemo(
241
- () => audioRefs.map((ref) => ref.publication?.track?.mediaStreamTrack).filter((t) => !!t),
242
- [audioRefs]
324
+ const synchronized = useCallMediaPlayers();
325
+ const audioTracks = react.useMemo(
326
+ () => audioRefs.map((ref) => {
327
+ const player = synchronized.get(ref.participant.identity);
328
+ return player?.suppressesTrack && ref.source === livekitClient.Track.Source.Microphone ? player.recording.stream.getAudioTracks()[0] : ref.publication?.track?.mediaStreamTrack;
329
+ }).filter((t) => !!t),
330
+ [audioRefs, synchronized]
243
331
  );
244
- const audioTracksRef = react$1.useRef(audioTracks);
332
+ const audioTracksRef = react.useRef(audioTracks);
245
333
  audioTracksRef.current = audioTracks;
246
- const captureRef = react$1.useRef(null);
247
- react$1.useEffect(() => {
334
+ const captureRef = react.useRef(null);
335
+ react.useEffect(() => {
248
336
  const stage = stageRef.current;
249
337
  if (!uploader || !stage) return;
250
338
  let capture;
251
339
  try {
252
- capture = chunkBCU65RJM_cjs.startCompositeCapture(stage);
340
+ capture = chunkXQPJWPWE_cjs.startCompositeCapture(stage);
253
341
  } catch (err) {
254
342
  console.warn("[calls] cannot record the composite", err);
255
343
  notify("This browser cannot record the call video; audio is still recorded.", "warning");
@@ -257,13 +345,13 @@ function CompositeRecorder({
257
345
  }
258
346
  captureRef.current = capture;
259
347
  capture.setAudioTracks(audioTracksRef.current);
260
- const recorder = react.createChunkedRecorder({
348
+ const recorder = react$1.createChunkedRecorder({
261
349
  stream: capture.stream,
262
350
  mimeType,
263
- chunkMs: react.RECORDING_CHUNK_MS,
351
+ chunkMs: react$1.RECORDING_CHUNK_MS,
264
352
  mode: "timeslice",
265
- videoBitsPerSecond: react.COMPOSITE_VIDEO_BITS_PER_SECOND,
266
- audioBitsPerSecond: react.COMPOSITE_AUDIO_BITS_PER_SECOND,
353
+ videoBitsPerSecond: react$1.COMPOSITE_VIDEO_BITS_PER_SECOND,
354
+ audioBitsPerSecond: react$1.COMPOSITE_AUDIO_BITS_PER_SECOND,
267
355
  onChunk: (chunk) => uploader.enqueue({
268
356
  blob: chunk.blob,
269
357
  startedAt: chunk.startedAt,
@@ -277,7 +365,7 @@ function CompositeRecorder({
277
365
  void recorder.stop().finally(() => capture.dispose());
278
366
  };
279
367
  }, [uploader, stageRef, mimeType]);
280
- react$1.useEffect(() => {
368
+ react.useEffect(() => {
281
369
  captureRef.current?.setAudioTracks(audioTracks);
282
370
  }, [audioTracks]);
283
371
  return null;
@@ -285,14 +373,14 @@ function CompositeRecorder({
285
373
  function openDocumentToShare(session, doc) {
286
374
  session.setViewingDocument({ id: doc.id, page: null });
287
375
  session.setDocumentViewer({ presenting: true, tab: "pdf" });
288
- session.openPanel(react.DOCUMENT_VIEWER_PANEL, "popout");
376
+ session.openPanel(react$1.DOCUMENT_VIEWER_PANEL, "popout");
289
377
  }
290
378
  function ShareDocumentDialog({ open, onOpenChange, onShare }) {
291
- const session = react.useArbiSessionStore();
379
+ const session = react$1.useArbiSessionStore();
292
380
  const { notify } = chunkHN56WWBR_cjs.useBlocksEnvironment();
293
- const { data: documents } = react.useDocuments(void 0, { enabled: open });
294
- const [picked, setPicked] = react$1.useState("");
295
- const groups = react$1.useMemo(() => {
381
+ const { data: documents } = react$1.useDocuments(void 0, { enabled: open });
382
+ const [picked, setPicked] = react.useState("");
383
+ const groups = react.useMemo(() => {
296
384
  const docs = (documents ?? []).map((doc) => ({
297
385
  id: doc.external_id,
298
386
  title: ui.getDocumentTitle(doc, "Untitled"),
@@ -353,7 +441,7 @@ function ShareDocumentDialog({ open, onOpenChange, onShare }) {
353
441
  var SHARE_LABEL = "Share screen/tab";
354
442
  function reportDeviceError(notify, source) {
355
443
  return (err) => notify(
356
- react.classifyMediaError(err, source === livekitClient.Track.Source.Camera ? "camera" : "microphone"),
444
+ react$1.classifyMediaError(err, source === livekitClient.Track.Source.Camera ? "camera" : "microphone"),
357
445
  "error"
358
446
  );
359
447
  }
@@ -371,9 +459,9 @@ function RoomMediaControl({
371
459
  const { devices, activeDeviceId, setActiveMediaDevice } = componentsReact.useMediaDeviceSelect({
372
460
  kind: mic ? "audioinput" : "videoinput"
373
461
  });
374
- const [mirror, setMirror] = chunkBCU65RJM_cjs.useMirrorSelfView();
462
+ const [mirror, setMirror] = chunkXQPJWPWE_cjs.useMirrorSelfView();
375
463
  return /* @__PURE__ */ jsxRuntime.jsx(
376
- chunkBCU65RJM_cjs.MediaControl,
464
+ chunkXQPJWPWE_cjs.MediaControl,
377
465
  {
378
466
  kind: mic ? "microphone" : "camera",
379
467
  enabled,
@@ -437,13 +525,13 @@ function CallControls({
437
525
  leaveOptions
438
526
  }) {
439
527
  const { notify } = chunkHN56WWBR_cjs.useBlocksEnvironment();
440
- const arbi = react.useArbi();
528
+ const arbi = react$1.useArbi();
441
529
  const room = componentsReact.useRoomContext();
442
530
  const share = useScreenShare();
443
- const experimental = react.useServerCallsExperimental();
444
- const [locked, setLocked] = react$1.useState(false);
445
- const [locking, setLocking] = react$1.useState(false);
446
- const [sharingDocument, setSharingDocument] = react$1.useState(false);
531
+ const experimental = react$1.useServerCallsExperimental();
532
+ const [locked, setLocked] = react.useState(false);
533
+ const [locking, setLocking] = react.useState(false);
534
+ const [sharingDocument, setSharingDocument] = react.useState(false);
447
535
  const full = density === "full";
448
536
  const tiny = density === "tiny";
449
537
  const toggleLock = async () => {
@@ -537,15 +625,15 @@ function CallControls({
537
625
  ] : []
538
626
  ];
539
627
  return /* @__PURE__ */ jsxRuntime.jsxs(
540
- chunkBCU65RJM_cjs.CallControlBar,
628
+ chunkXQPJWPWE_cjs.CallControlBar,
541
629
  {
542
630
  shortcuts,
543
631
  left: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
544
- full && /* @__PURE__ */ jsxRuntime.jsx(chunkBCU65RJM_cjs.ElapsedTime, { since: startedAt, title: "Time in this call" }),
632
+ full && /* @__PURE__ */ jsxRuntime.jsx(chunkXQPJWPWE_cjs.ElapsedTime, { since: startedAt, title: "Time in this call" }),
545
633
  /* @__PURE__ */ jsxRuntime.jsx(EnableAudioButton, { compact: !full })
546
634
  ] }),
547
635
  right: /* @__PURE__ */ jsxRuntime.jsx(
548
- chunkBCU65RJM_cjs.LeaveButton,
636
+ chunkXQPJWPWE_cjs.LeaveButton,
549
637
  {
550
638
  compact: !full,
551
639
  onLeave: () => void room.disconnect(),
@@ -553,15 +641,15 @@ function CallControls({
553
641
  }
554
642
  ),
555
643
  children: [
556
- /* @__PURE__ */ jsxRuntime.jsxs(chunkBCU65RJM_cjs.ControlGroup, { children: [
644
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkXQPJWPWE_cjs.ControlGroup, { children: [
557
645
  /* @__PURE__ */ jsxRuntime.jsx(RoomMediaControl, { source: livekitClient.Track.Source.Microphone, shortcut: "M", testId: "call-mic-toggle" }),
558
646
  /* @__PURE__ */ jsxRuntime.jsx(RoomMediaControl, { source: livekitClient.Track.Source.Camera, shortcut: "V", testId: "call-camera-toggle" })
559
647
  ] }),
560
648
  !tiny && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
561
- /* @__PURE__ */ jsxRuntime.jsx(chunkBCU65RJM_cjs.ControlDivider, {}),
562
- /* @__PURE__ */ jsxRuntime.jsxs(chunkBCU65RJM_cjs.ControlGroup, { children: [
649
+ /* @__PURE__ */ jsxRuntime.jsx(chunkXQPJWPWE_cjs.ControlDivider, {}),
650
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkXQPJWPWE_cjs.ControlGroup, { children: [
563
651
  full && (share.enabled ? /* @__PURE__ */ jsxRuntime.jsx(
564
- chunkBCU65RJM_cjs.CallControlButton,
652
+ chunkXQPJWPWE_cjs.CallControlButton,
565
653
  {
566
654
  label: "Stop sharing",
567
655
  tone: "active",
@@ -573,7 +661,7 @@ function CallControls({
573
661
  }
574
662
  ) : /* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenu, { children: [
575
663
  /* @__PURE__ */ jsxRuntime.jsx(ui.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
576
- chunkBCU65RJM_cjs.CallControlButton,
664
+ chunkXQPJWPWE_cjs.CallControlButton,
577
665
  {
578
666
  label: SHARE_LABEL,
579
667
  tooltip: false,
@@ -612,7 +700,7 @@ function CallControls({
612
700
  ] })
613
701
  ] }),
614
702
  /* @__PURE__ */ jsxRuntime.jsx(
615
- chunkBCU65RJM_cjs.MoreMenu,
703
+ chunkXQPJWPWE_cjs.MoreMenu,
616
704
  {
617
705
  details: experimental ? /* @__PURE__ */ jsxRuntime.jsxs(
618
706
  "span",
@@ -642,9 +730,9 @@ function CallControls({
642
730
  }
643
731
  function WebinarChat({ chat }) {
644
732
  const { notify } = chunkHN56WWBR_cjs.useBlocksEnvironment();
645
- const end = react$1.useRef(null);
733
+ const end = react.useRef(null);
646
734
  const count = chat.lines.length;
647
- react$1.useEffect(() => {
735
+ react.useEffect(() => {
648
736
  end.current?.scrollIntoView?.({ block: "end" });
649
737
  }, [count]);
650
738
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-h-0 flex-1 flex-col", "data-testid": "webinar-chat", children: [
@@ -675,12 +763,12 @@ function WebinarChat({ chat }) {
675
763
  /* @__PURE__ */ jsxRuntime.jsx("div", { ref: end })
676
764
  ] }),
677
765
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0 border-t border-border p-3", children: /* @__PURE__ */ jsxRuntime.jsx(
678
- chunkBCU65RJM_cjs.PanelComposer,
766
+ chunkXQPJWPWE_cjs.PanelComposer,
679
767
  {
680
768
  placeholder: "Message everyone",
681
769
  ariaLabel: "Message everyone",
682
770
  sendLabel: "Send",
683
- maxLength: react.CALL_CHAT_MAX_CHARS,
771
+ maxLength: react$1.CALL_CHAT_MAX_CHARS,
684
772
  busy: false,
685
773
  onSend: (text) => chat.send(text).then(
686
774
  () => true,
@@ -719,7 +807,7 @@ function webinarTabs(webinar, opts) {
719
807
  ];
720
808
  }
721
809
  function WebinarQA({ webinar }) {
722
- const questions = react$1.useMemo(
810
+ const questions = react.useMemo(
723
811
  () => webinar.questions.map((q) => ({
724
812
  id: q.external_id,
725
813
  body: q.text,
@@ -737,7 +825,7 @@ function WebinarQA({ webinar }) {
737
825
  [webinar.questions]
738
826
  );
739
827
  return /* @__PURE__ */ jsxRuntime.jsx(
740
- chunkBCU65RJM_cjs.QAPanel,
828
+ chunkXQPJWPWE_cjs.QAPanel,
741
829
  {
742
830
  questions,
743
831
  team: webinar.team,
@@ -751,13 +839,13 @@ function WebinarQA({ webinar }) {
751
839
  }
752
840
  function WebinarAudience({ webinar }) {
753
841
  const { refresh } = webinar;
754
- react$1.useEffect(() => {
842
+ react.useEffect(() => {
755
843
  void refresh();
756
844
  const id = setInterval(() => void refresh(), AUDIENCE_REFRESH_MS);
757
845
  return () => clearInterval(id);
758
846
  }, [refresh]);
759
847
  return /* @__PURE__ */ jsxRuntime.jsx(
760
- chunkBCU65RJM_cjs.WebinarAudiencePanel,
848
+ chunkXQPJWPWE_cjs.WebinarAudiencePanel,
761
849
  {
762
850
  className: "min-h-0 flex-1 overflow-y-auto",
763
851
  hands: webinar.hands.map((h) => ({
@@ -791,7 +879,7 @@ function WebinarSidePanel({
791
879
  const tabs = webinarTabs(webinar, { people: !!people, unreadChat: chat.unread });
792
880
  const current = tabs.some((t) => t.id === tab) ? tab : tabs[0].id;
793
881
  return /* @__PURE__ */ jsxRuntime.jsxs(
794
- chunkBCU65RJM_cjs.CallSidePanel,
882
+ chunkXQPJWPWE_cjs.CallSidePanel,
795
883
  {
796
884
  title: "Webinar",
797
885
  tabs,
@@ -811,13 +899,33 @@ function WebinarSidePanel({
811
899
  }
812
900
  );
813
901
  }
902
+
903
+ // src/calls/connected/call-media-state.ts
904
+ function audibleSpeakingIds(trackSpeakers, sampled) {
905
+ return [
906
+ .../* @__PURE__ */ new Set([
907
+ ...trackSpeakers.filter((id) => !sampled.get(id)?.suppressesTrack),
908
+ ...[...sampled].filter(([, state]) => state.active).map(([id]) => id)
909
+ ])
910
+ ];
911
+ }
912
+ function assistantSpeechLabel(state, speaking, projection, sampled) {
913
+ if (sampled?.active) return "Speaking";
914
+ if (state === "speaking" && projection && !speaking) return "Preparing audio";
915
+ return {
916
+ listening: "Listening",
917
+ thinking: "Thinking",
918
+ speaking: "Speaking",
919
+ error: "Please try again"
920
+ }[state];
921
+ }
814
922
  var VIEWER_SIDE_DOCKS_AT = 768;
815
923
  var OFFSCREEN_STAGE = { top: 0, left: 0, width: 960, height: 540 };
816
924
  function ConnectedCallRoom({
817
925
  tokenResponse,
818
926
  e2eeKey,
819
927
  onLeave,
820
- choices = react.DEFAULT_JOIN_CHOICES,
928
+ choices = react$1.DEFAULT_JOIN_CHOICES,
821
929
  isCreator = false,
822
930
  lockedWorkspaceExtId,
823
931
  title = "Call",
@@ -835,7 +943,7 @@ function ConnectedCallRoom({
835
943
  }) {
836
944
  const { notify } = chunkHN56WWBR_cjs.useBlocksEnvironment();
837
945
  const { room, error: setupError } = calls.useCallRoom(e2eeKey, choices);
838
- const [joinedAt] = react$1.useState(() => startedAt ?? Date.now());
946
+ const [joinedAt] = react.useState(() => startedAt ?? Date.now());
839
947
  if (setupError) {
840
948
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cn("flex flex-col items-center justify-center gap-3 p-6", className), children: [
841
949
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.TriangleAlert, { className: "size-6 text-destructive", "aria-hidden": true }),
@@ -844,9 +952,9 @@ function ConnectedCallRoom({
844
952
  ] });
845
953
  }
846
954
  if (!room) {
847
- return /* @__PURE__ */ jsxRuntime.jsx(chunkBCU65RJM_cjs.CallStateMessage, { title: "Connecting\u2026", testId: "call-connecting" });
955
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkXQPJWPWE_cjs.CallStateMessage, { title: "Connecting\u2026", testId: "call-connecting" });
848
956
  }
849
- return /* @__PURE__ */ jsxRuntime.jsxs(
957
+ return /* @__PURE__ */ jsxRuntime.jsx(
850
958
  componentsReact.LiveKitRoom,
851
959
  {
852
960
  room,
@@ -873,9 +981,9 @@ function ConnectedCallRoom({
873
981
  onMediaDeviceFailure: (failure, kind) => {
874
982
  const device = kind === "videoinput" ? "camera" : "microphone";
875
983
  const name = failure === livekitClient.MediaDeviceFailure.PermissionDenied ? "NotAllowedError" : failure === livekitClient.MediaDeviceFailure.NotFound ? "NotFoundError" : "Error";
876
- notify(react.classifyMediaError(new DOMException(failure ?? "", name), device), "error");
984
+ notify(react$1.classifyMediaError(new DOMException(failure ?? "", name), device), "error");
877
985
  },
878
- children: [
986
+ children: /* @__PURE__ */ jsxRuntime.jsxs(CallAvatarMedia, { callKey: e2eeKey, children: [
879
987
  /* @__PURE__ */ jsxRuntime.jsx(
880
988
  CallBody,
881
989
  {
@@ -896,16 +1004,15 @@ function ConnectedCallRoom({
896
1004
  onViewerChange
897
1005
  }
898
1006
  ),
899
- /* @__PURE__ */ jsxRuntime.jsx(componentsReact.RoomAudioRenderer, {}),
900
1007
  /* @__PURE__ */ jsxRuntime.jsx(AssistantNotices, {})
901
- ]
1008
+ ] })
902
1009
  }
903
1010
  );
904
1011
  }
905
1012
  function AssistantNotices() {
906
1013
  const room = componentsReact.useRoomContext();
907
1014
  const { notify } = chunkHN56WWBR_cjs.useBlocksEnvironment();
908
- react$1.useEffect(() => {
1015
+ react.useEffect(() => {
909
1016
  const received = (bytes, from, _kind, topic) => {
910
1017
  if (topic !== "arbi.assistant" || from?.attributes["arbi.call_assistant"] !== "true") return;
911
1018
  try {
@@ -926,14 +1033,14 @@ function useRoomVoiceLevels() {
926
1033
  const mics = componentsReact.useTracks([{ source: livekitClient.Track.Source.Microphone, withPlaceholder: true }], {
927
1034
  onlySubscribed: false
928
1035
  });
929
- const sources = react$1.useRef([]);
1036
+ const sources = react.useRef([]);
930
1037
  sources.current = mics.map((t) => ({
931
1038
  identity: t.participant.identity,
932
1039
  track: componentsReact.isTrackReference(t) ? t.publication.track?.mediaStreamTrack ?? null : null,
933
1040
  muted: !componentsReact.isTrackReference(t) || t.publication.isMuted,
934
1041
  local: t.participant.isLocal
935
1042
  }));
936
- react$1.useEffect(() => chunkOAIOOVFN_cjs.startVoiceLevels(() => sources.current), []);
1043
+ react.useEffect(() => chunkOAIOOVFN_cjs.startVoiceLevels(() => sources.current), []);
937
1044
  }
938
1045
  function CallBody({
939
1046
  callExtId,
@@ -953,7 +1060,7 @@ function CallBody({
953
1060
  onViewerChange
954
1061
  }) {
955
1062
  const room = componentsReact.useRoomContext();
956
- const [view, setView] = react$1.useState("speaker");
1063
+ const [view, setView] = react.useState("speaker");
957
1064
  const webinar = calls.useWebinar({
958
1065
  role: webinarRole,
959
1066
  callExtId,
@@ -961,11 +1068,11 @@ function CallBody({
961
1068
  callKey: e2eeKey
962
1069
  });
963
1070
  const audienceView = webinar.enabled && (!webinar.onStage || webinar.stageCheck);
964
- react$1.useEffect(() => {
1071
+ react.useEffect(() => {
965
1072
  onViewerChange?.(audienceView);
966
1073
  }, [audienceView, onViewerChange]);
967
1074
  const sendsMedia = !webinar.enabled || webinar.onStage;
968
- const readOnly = react.useMeetingReadOnly(lockedWorkspaceExtId);
1075
+ const readOnly = react$1.useMeetingReadOnly(lockedWorkspaceExtId);
969
1076
  const transcription = calls.useCallTranscriber({
970
1077
  callExtId,
971
1078
  callKey: e2eeKey,
@@ -973,23 +1080,23 @@ function CallBody({
973
1080
  canPost: !readOnly && (!webinar.enabled || webinar.team),
974
1081
  linkVersion
975
1082
  });
976
- react$1.useEffect(() => {
1083
+ react.useEffect(() => {
977
1084
  onTranscriptionChange?.(transcription.on);
978
1085
  }, [transcription.on, onTranscriptionChange]);
979
- react$1.useEffect(() => {
1086
+ react.useEffect(() => {
980
1087
  chunkOAIOOVFN_cjs.publishCallStatus({ callExtId, transcribing: transcription.on });
981
1088
  }, [callExtId, transcription.on]);
982
- react$1.useEffect(() => () => chunkOAIOOVFN_cjs.publishCallStatus({ callExtId: null, transcribing: false }), []);
1089
+ react.useEffect(() => () => chunkOAIOOVFN_cjs.publishCallStatus({ callExtId: null, transcribing: false }), []);
983
1090
  const recording = calls.useCallRecorder({ callExtId, callKey: e2eeKey, isCreator, linkVersion });
984
- react$1.useEffect(() => {
1091
+ react.useEffect(() => {
985
1092
  onRecordingChange?.(recording.on);
986
1093
  }, [recording.on, onRecordingChange]);
987
1094
  const notices = useCallNotices(recording, transcription);
988
- const [teamPanelOpen, setTeamPanelOpen] = react$1.useState(true);
989
- const [endConfirm, setEndConfirm] = react$1.useState(false);
990
- const [viewerSide, setViewerSide] = react$1.useState(null);
991
- const [tab, setTab] = react$1.useState("people");
992
- const [frameRef, frame] = chunkBCU65RJM_cjs.useElementSize();
1095
+ const [teamPanelOpen, setTeamPanelOpen] = react.useState(true);
1096
+ const [endConfirm, setEndConfirm] = react.useState(false);
1097
+ const [viewerSide, setViewerSide] = react.useState(null);
1098
+ const [tab, setTab] = react.useState("people");
1099
+ const [frameRef, frame] = chunkXQPJWPWE_cjs.useElementSize();
993
1100
  const viewerSideOpen = viewerSide ?? frame.width >= VIEWER_SIDE_DOCKS_AT;
994
1101
  const sideOpen = audienceView ? viewerSideOpen : teamPanelOpen;
995
1102
  const chat = calls.useInCallChat({
@@ -1002,12 +1109,17 @@ function CallBody({
1002
1109
  const askToMute = calls.useMuteRequests();
1003
1110
  calls.useHostMuteNotice(callExtId);
1004
1111
  const participants = componentsReact.useParticipants();
1005
- const speakingIds = chunkOAIOOVFN_cjs.useSpeakingIds();
1006
- const speakingNames = react$1.useMemo(
1112
+ const trackSpeakingIds = chunkOAIOOVFN_cjs.useSpeakingIds();
1113
+ const sampledMedia = useCallMediaPlayers();
1114
+ const speakingIds = react.useMemo(
1115
+ () => audibleSpeakingIds(trackSpeakingIds, sampledMedia),
1116
+ [trackSpeakingIds, sampledMedia]
1117
+ );
1118
+ const speakingNames = react.useMemo(
1007
1119
  () => speakingIds.map((id) => participants.find((p) => p.identity === id)).filter((p) => !!p).map((p) => /* @__PURE__ */ jsxRuntime.jsx(chunkZ574BY3H_cjs.CallUserPill, { identity: p.identity, name: p.name }, p.identity)),
1008
1120
  [speakingIds, participants]
1009
1121
  );
1010
- const stageRef = react$1.useRef(null);
1122
+ const stageRef = react.useRef(null);
1011
1123
  const { share, cameras } = useStageTracks();
1012
1124
  const stageShape = {
1013
1125
  view: share || view === "speaker" && cameras.length >= 2 ? "focus" : "grid",
@@ -1016,9 +1128,9 @@ function CallBody({
1016
1128
  const drawsComposite = recording.on && recording.canControl && recording.mode === "audio_video";
1017
1129
  const density = frame.width === 0 || frame.width >= 620 ? "full" : frame.width >= 400 ? "compact" : "tiny";
1018
1130
  const shortPanel = frame.height > 0 && frame.height < 520;
1019
- const [mirrorSelf] = chunkBCU65RJM_cjs.useMirrorSelfView();
1131
+ const [mirrorSelf] = chunkXQPJWPWE_cjs.useMirrorSelfView();
1020
1132
  const status = (small) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1021
- webinar.enabled && webinar.live && /* @__PURE__ */ jsxRuntime.jsx(chunkBCU65RJM_cjs.WebinarLiveChip, { compact: small }),
1133
+ webinar.enabled && webinar.live && /* @__PURE__ */ jsxRuntime.jsx(chunkXQPJWPWE_cjs.WebinarLiveChip, { compact: small }),
1022
1134
  /* @__PURE__ */ jsxRuntime.jsx(
1023
1135
  StatusChips,
1024
1136
  {
@@ -1030,7 +1142,7 @@ function CallBody({
1030
1142
  )
1031
1143
  ] });
1032
1144
  const header = !minimized && /* @__PURE__ */ jsxRuntime.jsx(
1033
- chunkBCU65RJM_cjs.CallHeader,
1145
+ chunkXQPJWPWE_cjs.CallHeader,
1034
1146
  {
1035
1147
  title,
1036
1148
  status,
@@ -1066,14 +1178,14 @@ function CallBody({
1066
1178
  sendsMedia && /* @__PURE__ */ jsxRuntime.jsx(SpeakerRecorder, { recording, callKey: e2eeKey }),
1067
1179
  recording.canControl && recording.mode === "audio_video" && /* @__PURE__ */ jsxRuntime.jsx(CompositeRecorder, { recording, callKey: e2eeKey, stageRef }),
1068
1180
  /* @__PURE__ */ jsxRuntime.jsx(RecordingQuotaWarning, { recording }),
1069
- webinar.moderator && /* @__PURE__ */ jsxRuntime.jsx(chunkBCU65RJM_cjs.WebinarEndConfirm, { open: endConfirm, onOpenChange: setEndConfirm, onEnd: webinar.end }),
1181
+ webinar.moderator && /* @__PURE__ */ jsxRuntime.jsx(chunkXQPJWPWE_cjs.WebinarEndConfirm, { open: endConfirm, onOpenChange: setEndConfirm, onEnd: webinar.end }),
1070
1182
  webinar.stageCheck && /* @__PURE__ */ jsxRuntime.jsx(
1071
- chunkBCU65RJM_cjs.OnStageCheck,
1183
+ chunkXQPJWPWE_cjs.OnStageCheck,
1072
1184
  {
1073
- initialChoices: react.DEFAULT_JOIN_CHOICES,
1185
+ initialChoices: react$1.DEFAULT_JOIN_CHOICES,
1074
1186
  open: true,
1075
1187
  mirror: mirrorSelf,
1076
- describeError: (err, kind) => react.classifyMediaError(err, kind),
1188
+ describeError: (err, kind) => react$1.classifyMediaError(err, kind),
1077
1189
  onJoinStage: webinar.joinStage,
1078
1190
  onStayInAudience: webinar.stepDown
1079
1191
  }
@@ -1091,7 +1203,7 @@ function CallBody({
1091
1203
  inert: minimized || void 0,
1092
1204
  "data-testid": "call-stage-frame",
1093
1205
  children: audienceView ? /* @__PURE__ */ jsxRuntime.jsx(
1094
- chunkBCU65RJM_cjs.WebinarViewer,
1206
+ chunkXQPJWPWE_cjs.WebinarViewer,
1095
1207
  {
1096
1208
  header,
1097
1209
  stage: /* @__PURE__ */ jsxRuntime.jsx(CallTiles, { view: "speaker", includeLocal: false }),
@@ -1115,14 +1227,14 @@ function CallBody({
1115
1227
  shortcuts: !minimized
1116
1228
  }
1117
1229
  ) : /* @__PURE__ */ jsxRuntime.jsx(
1118
- chunkBCU65RJM_cjs.CallStageFrame,
1230
+ chunkXQPJWPWE_cjs.CallStageFrame,
1119
1231
  {
1120
1232
  stageRef,
1121
1233
  header,
1122
1234
  subheader: !minimized && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1123
- webinar.team && !webinar.live && /* @__PURE__ */ jsxRuntime.jsx(chunkBCU65RJM_cjs.BackstageBanner, { onGoLive: webinar.moderator ? webinar.goLive : void 0 }),
1124
- notices.map((n) => /* @__PURE__ */ jsxRuntime.jsx(chunkBCU65RJM_cjs.CallNotice, { children: n }, n)),
1125
- /* @__PURE__ */ jsxRuntime.jsx(chunkBCU65RJM_cjs.SpeakingNow, { names: speakingNames })
1235
+ webinar.team && !webinar.live && /* @__PURE__ */ jsxRuntime.jsx(chunkXQPJWPWE_cjs.BackstageBanner, { onGoLive: webinar.moderator ? webinar.goLive : void 0 }),
1236
+ notices.map((n) => /* @__PURE__ */ jsxRuntime.jsx(chunkXQPJWPWE_cjs.CallNotice, { children: n }, n)),
1237
+ /* @__PURE__ */ jsxRuntime.jsx(chunkXQPJWPWE_cjs.SpeakingNow, { names: speakingNames })
1126
1238
  ] }),
1127
1239
  stage: /* @__PURE__ */ jsxRuntime.jsx(CallTiles, { view }),
1128
1240
  stageOverlay: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -1204,7 +1316,7 @@ function webinarControls(webinar, opts) {
1204
1316
  ];
1205
1317
  return {
1206
1318
  menuGroups: [
1207
- ...webinar.moderator ? [chunkBCU65RJM_cjs.chatPermissionSection({ value: webinar.chat, onChange: webinar.setChat })] : [],
1319
+ ...webinar.moderator ? [chunkXQPJWPWE_cjs.chatPermissionSection({ value: webinar.chat, onChange: webinar.setChat })] : [],
1208
1320
  items
1209
1321
  ],
1210
1322
  leaveOptions: webinar.moderator && webinar.live ? [
@@ -1218,7 +1330,7 @@ function webinarControls(webinar, opts) {
1218
1330
  };
1219
1331
  }
1220
1332
  function useCallNotices(recording, transcription) {
1221
- const [shown, setShown] = react$1.useState({});
1333
+ const [shown, setShown] = react.useState({});
1222
1334
  const recordingText = recording.on ? `Recording${recording.mode ? ` (${chunkZ574BY3H_cjs.MODE_LABEL[recording.mode]})` : ""} \u2014 started by ${recording.startedByMe ? "you" : recording.startedByName || "the host"}` : null;
1223
1335
  const transcriptionText = transcription.on ? `Transcription on \u2014 started by ${transcription.startedByMe ? "you" : transcription.startedByName || "a participant"}` : null;
1224
1336
  useNotice("recording", recordingText, setShown);
@@ -1227,9 +1339,9 @@ function useCallNotices(recording, transcription) {
1227
1339
  }
1228
1340
  function useNotice(key, text, setShown) {
1229
1341
  const on = !!text;
1230
- const latest = react$1.useRef(text);
1342
+ const latest = react.useRef(text);
1231
1343
  latest.current = text;
1232
- react$1.useEffect(() => {
1344
+ react.useEffect(() => {
1233
1345
  if (!on) return;
1234
1346
  setShown((s) => ({ ...s, [key]: latest.current ?? "" }));
1235
1347
  const id = setTimeout(
@@ -1249,7 +1361,7 @@ function useNotice(key, text, setShown) {
1249
1361
  });
1250
1362
  };
1251
1363
  }, [on, key, setShown]);
1252
- react$1.useEffect(() => {
1364
+ react.useEffect(() => {
1253
1365
  if (text) setShown((s) => key in s && s[key] !== text ? { ...s, [key]: text } : s);
1254
1366
  }, [text, key, setShown]);
1255
1367
  }
@@ -1265,7 +1377,7 @@ function StatusChips({
1265
1377
  recording.on && /* @__PURE__ */ jsxRuntime.jsx(RecordingIndicator, { recording, compact, announce: false }),
1266
1378
  transcription.on && /* @__PURE__ */ jsxRuntime.jsx(TranscriptionIndicator, { transcription, compact, announce: false }),
1267
1379
  /* @__PURE__ */ jsxRuntime.jsx(
1268
- chunkBCU65RJM_cjs.EncryptionStatusChip,
1380
+ chunkXQPJWPWE_cjs.EncryptionStatusChip,
1269
1381
  {
1270
1382
  state: isE2ee ? encrypted ? "on" : "pending" : "off",
1271
1383
  compact
@@ -1279,25 +1391,28 @@ function RoomTile({
1279
1391
  size = "md"
1280
1392
  }) {
1281
1393
  const { participant } = trackRef;
1394
+ const avatarsEnabled = react$1.useCallAvatarsEnabled();
1395
+ const sampled = useCallMediaPlayers().get(participant.identity);
1396
+ const trackSpeaking = chunkOAIOOVFN_cjs.useIsSpeaking(participant.identity);
1397
+ const speaking = sampled?.suppressesTrack ? sampled.active : trackSpeaking;
1282
1398
  const { attributes } = componentsReact.useParticipantAttributes({ participant });
1283
- const assistantState = attributes?.["arbi.call_assistant"] === "true" ? {
1284
- listening: "Listening",
1285
- thinking: "Thinking",
1286
- speaking: "Speaking",
1287
- error: "Please try again"
1288
- }[attributes?.["arbi.assistant_state"] ?? ""] : void 0;
1399
+ const assistantState = attributes?.["arbi.call_assistant"] === "true" ? assistantSpeechLabel(
1400
+ attributes?.["arbi.assistant_state"] ?? "",
1401
+ speaking,
1402
+ avatarsEnabled && !!attributes?.["arbi.assistant_avatar"],
1403
+ sampled
1404
+ ) : void 0;
1289
1405
  const { elementProps } = componentsReact.useParticipantTile({ trackRef, htmlProps: {} });
1290
1406
  const screen = trackRef.source === livekitClient.Track.Source.ScreenShare;
1291
1407
  const videoMuted = componentsReact.useIsMuted(trackRef);
1292
1408
  const micMuted = componentsReact.useIsMuted({ participant, source: livekitClient.Track.Source.Microphone });
1293
- const speaking = chunkOAIOOVFN_cjs.useIsSpeaking(participant.identity);
1294
1409
  const level = chunkOAIOOVFN_cjs.useVoiceLevel(participant.identity);
1295
1410
  const { quality } = componentsReact.useConnectionQualityIndicator({ participant });
1296
1411
  const hasVideo = componentsReact.isTrackReference(trackRef) && !!trackRef.publication.track && !videoMuted;
1297
1412
  const name = participant.name || participant.identity;
1298
- const [mirrorSelf] = chunkBCU65RJM_cjs.useMirrorSelfView();
1413
+ const [mirrorSelf] = chunkXQPJWPWE_cjs.useMirrorSelfView();
1299
1414
  return /* @__PURE__ */ jsxRuntime.jsx(
1300
- chunkBCU65RJM_cjs.CallTile,
1415
+ chunkXQPJWPWE_cjs.CallTile,
1301
1416
  {
1302
1417
  ...elementProps,
1303
1418
  name: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -1313,7 +1428,13 @@ function RoomTile({
1313
1428
  assistantState && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", "data-testid": "call-assistant-state", children: assistantState })
1314
1429
  ] }),
1315
1430
  initials: chunkZBP4ZSAJ_cjs.initialsOf(name),
1316
- video: hasVideo ? /* @__PURE__ */ jsxRuntime.jsx(componentsReact.VideoTrack, { trackRef }) : void 0,
1431
+ video: hasVideo ? /* @__PURE__ */ jsxRuntime.jsx(componentsReact.VideoTrack, { trackRef }) : avatarsEnabled && attributes?.["arbi.assistant_avatar"] ? /* @__PURE__ */ jsxRuntime.jsx(
1432
+ AssistantAvatar,
1433
+ {
1434
+ identity: participant.identity,
1435
+ avatar: attributes["arbi.assistant_avatar"]
1436
+ }
1437
+ ) : void 0,
1317
1438
  source: screen ? "screen" : "camera",
1318
1439
  local: participant.isLocal,
1319
1440
  mirror: participant.isLocal && !screen && mirrorSelf,
@@ -1356,10 +1477,10 @@ function CallTiles({
1356
1477
  const spotlight = useSpotlightCamera(cameras);
1357
1478
  const focus = share ?? (view === "speaker" ? spotlight : void 0);
1358
1479
  if (!focus || cameras.length < 2 && !share) {
1359
- return /* @__PURE__ */ jsxRuntime.jsx(chunkBCU65RJM_cjs.CallGrid, { items: cameras, getKey: trackKey, renderTile: (t) => /* @__PURE__ */ jsxRuntime.jsx(RoomTile, { trackRef: t }) });
1480
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkXQPJWPWE_cjs.CallGrid, { items: cameras, getKey: trackKey, renderTile: (t) => /* @__PURE__ */ jsxRuntime.jsx(RoomTile, { trackRef: t }) });
1360
1481
  }
1361
1482
  return /* @__PURE__ */ jsxRuntime.jsx(
1362
- chunkBCU65RJM_cjs.CallFocus,
1483
+ chunkXQPJWPWE_cjs.CallFocus,
1363
1484
  {
1364
1485
  focus,
1365
1486
  others: cameras.filter((t) => t !== focus),
@@ -1383,12 +1504,12 @@ function MinimisedRoom({
1383
1504
  const mic = componentsReact.useTrackToggle({ source: livekitClient.Track.Source.Microphone });
1384
1505
  const camera = componentsReact.useTrackToggle({ source: livekitClient.Track.Source.Camera });
1385
1506
  return /* @__PURE__ */ jsxRuntime.jsx(
1386
- chunkBCU65RJM_cjs.MinimisedCall,
1507
+ chunkXQPJWPWE_cjs.MinimisedCall,
1387
1508
  {
1388
1509
  title,
1389
1510
  video: track ? /* @__PURE__ */ jsxRuntime.jsx(RoomTile, { trackRef: track, size: "sm" }) : null,
1390
1511
  status,
1391
- speaking: /* @__PURE__ */ jsxRuntime.jsx(chunkBCU65RJM_cjs.SpeakingNow, { names: speakingNames, className: "text-xs" }),
1512
+ speaking: /* @__PURE__ */ jsxRuntime.jsx(chunkXQPJWPWE_cjs.SpeakingNow, { names: speakingNames, className: "text-xs" }),
1392
1513
  micEnabled: audience ? void 0 : mic.enabled,
1393
1514
  onToggleMic: audience ? void 0 : () => void mic.toggle(),
1394
1515
  cameraEnabled: audience ? void 0 : camera.enabled,
@@ -1406,9 +1527,9 @@ function ParticipantsList({
1406
1527
  compact
1407
1528
  }) {
1408
1529
  const { notify } = chunkHN56WWBR_cjs.useBlocksEnvironment();
1409
- const arbi = react.useArbi();
1530
+ const arbi = react$1.useArbi();
1410
1531
  const participants = componentsReact.useParticipants();
1411
- const [removing, setRemoving] = react$1.useState(null);
1532
+ const [removing, setRemoving] = react.useState(null);
1412
1533
  const remove = async (identity, name) => {
1413
1534
  setRemoving(identity);
1414
1535
  try {
@@ -1437,7 +1558,7 @@ function ParticipantsList({
1437
1558
  ...participants.filter((p) => !speakingIds.includes(p.identity))
1438
1559
  ];
1439
1560
  return /* @__PURE__ */ jsxRuntime.jsx(
1440
- chunkBCU65RJM_cjs.CallParticipants,
1561
+ chunkXQPJWPWE_cjs.CallParticipants,
1441
1562
  {
1442
1563
  className: compact ? void 0 : "flex-1",
1443
1564
  compact,
@@ -1461,11 +1582,11 @@ function ParticipantsList({
1461
1582
  }
1462
1583
  function Lobby({ callExtId }) {
1463
1584
  const { notify } = chunkHN56WWBR_cjs.useBlocksEnvironment();
1464
- const arbi = react.useArbi();
1465
- const knocks = react.useCallSession((s) => s.knocks);
1585
+ const arbi = react$1.useArbi();
1586
+ const knocks = react$1.useCallSession((s) => s.knocks);
1466
1587
  const mine = knocks.filter((k) => k.callExtId === callExtId);
1467
1588
  const decide = async (knockId, admit) => {
1468
- react.callSession.removeKnock(knockId);
1589
+ react$1.callSession.removeKnock(knockId);
1469
1590
  try {
1470
1591
  await arbi.calls.decideKnock(callExtId, knockId, admit);
1471
1592
  } catch (err) {
@@ -1473,7 +1594,7 @@ function Lobby({ callExtId }) {
1473
1594
  }
1474
1595
  };
1475
1596
  return /* @__PURE__ */ jsxRuntime.jsx(
1476
- chunkBCU65RJM_cjs.LobbyRequests,
1597
+ chunkXQPJWPWE_cjs.LobbyRequests,
1477
1598
  {
1478
1599
  requests: mine.map((k) => ({
1479
1600
  id: k.knockId,
@@ -1488,9 +1609,9 @@ function ConnectingOverlay() {
1488
1609
  const state = componentsReact.useConnectionState();
1489
1610
  if (state === livekitClient.ConnectionState.Connected) return null;
1490
1611
  const label = state === livekitClient.ConnectionState.Reconnecting || state === livekitClient.ConnectionState.SignalReconnecting ? "Reconnecting\u2026" : state === livekitClient.ConnectionState.Disconnected ? "Disconnected" : "Connecting\u2026";
1491
- return /* @__PURE__ */ jsxRuntime.jsx(chunkBCU65RJM_cjs.ConnectionOverlay, { label });
1612
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkXQPJWPWE_cjs.ConnectionOverlay, { label });
1492
1613
  }
1493
1614
 
1494
1615
  exports.ConnectedCallRoom = ConnectedCallRoom;
1495
- //# sourceMappingURL=chunk-GAHGZBBM.cjs.map
1496
- //# sourceMappingURL=chunk-GAHGZBBM.cjs.map
1616
+ //# sourceMappingURL=chunk-KQYFJXR5.cjs.map
1617
+ //# sourceMappingURL=chunk-KQYFJXR5.cjs.map