@q9labsai/chalk-react 5.2.5 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,7 +13,7 @@ import {
13
13
  isContentItem,
14
14
  speakingParticipantId,
15
15
  stabilizeOrder
16
- } from "./chunk-HWQLW4JR.js";
16
+ } from "./chunk-ES7AECAD.js";
17
17
  import {
18
18
  ArrowLeft01Icon,
19
19
  ArrowRight01Icon,
@@ -455,7 +455,7 @@ import { ChalkTooltip } from "@q9labsai/chalk-whiteboard/react";
455
455
  import { ChalkMenuPrimitive, ChalkPopoverPrimitive } from "@q9labsai/chalk-whiteboard/react";
456
456
 
457
457
  // src/components/call-limbo/CallLimbo.tsx
458
- import { useEffect as useEffect4, useRef as useRef3, useState as useState6 } from "react";
458
+ import { useEffect as useEffect3, useRef as useRef3, useState as useState5 } from "react";
459
459
 
460
460
  // src/theme.ts
461
461
  var LIGHT_CHALK_THEME_TOKENS = {
@@ -539,20 +539,18 @@ function chalkThemeStyle(theme, colorScheme = theme?.colorScheme ?? "dark") {
539
539
  }
540
540
 
541
541
  // src/internal/useMediaQuery.ts
542
- import { useEffect as useEffect3, useState as useState5 } from "react";
542
+ import { useCallback as useCallback3, useMemo as useMemo2, useSyncExternalStore as useSyncExternalStore2 } from "react";
543
+ var serverSnapshot = () => false;
543
544
  function useMediaQuery(query) {
544
- const [matches, setMatches] = useState5(() => typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia(query).matches : false);
545
- useEffect3(() => {
546
- if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
547
- return;
548
- }
549
- const mediaQuery = window.matchMedia(query);
550
- const handleChange = () => setMatches(mediaQuery.matches);
551
- handleChange();
552
- mediaQuery.addEventListener("change", handleChange);
553
- return () => mediaQuery.removeEventListener("change", handleChange);
554
- }, [query]);
555
- return matches;
545
+ const mediaQuery = useMemo2(() => typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia(query) : void 0, [query]);
546
+ const subscribe3 = useCallback3(
547
+ (notify) => {
548
+ mediaQuery?.addEventListener("change", notify);
549
+ return () => mediaQuery?.removeEventListener("change", notify);
550
+ },
551
+ [mediaQuery]
552
+ );
553
+ return useSyncExternalStore2(subscribe3, () => mediaQuery?.matches ?? false, serverSnapshot);
556
554
  }
557
555
  function useIsMobile() {
558
556
  return useMediaQuery("(max-width: 767px)");
@@ -598,8 +596,8 @@ import { jsx as jsx20, jsxs as jsxs7 } from "react/jsx-runtime";
598
596
  function CallLimbo({ spaceName = "Call", message, detail, action, children, overlay = false, active = true, initiallyCovered = false, theme, recorded = false, blocking = true, className }) {
599
597
  const layerRef = useRef3(null);
600
598
  const reducedMotion = usePrefersReducedMotion();
601
- const [covered, setCovered] = useState6(active || initiallyCovered);
602
- useEffect4(() => {
599
+ const [covered, setCovered] = useState5(active || initiallyCovered);
600
+ useEffect3(() => {
603
601
  let nextFrame = 0;
604
602
  const frame = requestAnimationFrame(() => {
605
603
  nextFrame = requestAnimationFrame(() => setCovered(active));
@@ -609,7 +607,7 @@ function CallLimbo({ spaceName = "Call", message, detail, action, children, over
609
607
  cancelAnimationFrame(nextFrame);
610
608
  };
611
609
  }, [active]);
612
- useEffect4(() => {
610
+ useEffect3(() => {
613
611
  if (!overlay || !active || !layerRef.current) return;
614
612
  const root = layerRef.current.closest("[data-chalk]");
615
613
  if (!root) return;
@@ -685,6 +683,7 @@ function commandFailure(cause) {
685
683
  });
686
684
  }
687
685
  var again = ({ recoverable }) => recoverable ? " Try again." : "";
686
+ var interrupted = ({ recoverable }) => `That change was interrupted.${recoverable ? " Try again." : " Rejoin the call."}`;
688
687
  var device = ({ source }) => source ?? "device";
689
688
  var settings = (context) => `Couldn\u2019t change ${context.source === "screen" ? "screen sharing" : `your ${device(context)} settings`}.`;
690
689
  var stop = (context) => context.source === "screen" ? "Couldn\u2019t stop screen sharing." : settings(context);
@@ -714,11 +713,12 @@ var MEDIA_FAILURE_POLICY = {
714
713
  "command.rejected": unavailable,
715
714
  "connection.invalid_state": {
716
715
  copy: {
717
- ...operationCopy,
718
- start: (context) => `That change was interrupted.${again(context)}`,
719
- stop: (context) => `That change was interrupted.${again(context)}`,
720
- select: (context) => `That change was interrupted.${again(context)}`,
721
- change: (context) => `That change was interrupted.${again(context)}`
716
+ start: interrupted,
717
+ stop: interrupted,
718
+ select: interrupted,
719
+ test: interrupted,
720
+ request: interrupted,
721
+ change: interrupted
722
722
  },
723
723
  retry: true
724
724
  },
@@ -780,7 +780,7 @@ function commandFailureMessage(failure, source, operation) {
780
780
  }
781
781
 
782
782
  // src/components/media-request-dialog/media-request-dialog-state.ts
783
- import { useEffect as useEffect5, useMemo as useMemo2, useState as useState7 } from "react";
783
+ import { useEffect as useEffect4, useMemo as useMemo3, useState as useState6 } from "react";
784
784
  function formatExpiryLabel(expiresAtMs, now) {
785
785
  if (!Number.isFinite(expiresAtMs)) return null;
786
786
  const remainingSeconds = Math.max(0, Math.ceil((expiresAtMs - now) / 1e3));
@@ -790,16 +790,18 @@ function formatExpiryLabel(expiresAtMs, now) {
790
790
  return `Expires in ${minutes} min`;
791
791
  }
792
792
  function useMediaRequestDialogState({ request, onDecline, onAllow, onActionError }) {
793
- const expiresAtMs = useMemo2(() => Date.parse(request.expiresAt), [request.expiresAt]);
794
- const [now, setNow] = useState7(() => Date.now());
795
- const [pendingAction, setPendingAction] = useState7(null);
796
- const [errorMessageState, setErrorMessage] = useState7(null);
797
- useEffect5(() => {
793
+ const expiresAtMs = useMemo3(() => Date.parse(request.expiresAt), [request.expiresAt]);
794
+ const [now, setNow] = useState6(() => Date.now());
795
+ const [pendingAction, setPendingAction] = useState6(null);
796
+ const [errorMessageState, setErrorMessage] = useState6(null);
797
+ const [previousRequestId, setPreviousRequestId] = useState6(request.requestId);
798
+ if (previousRequestId !== request.requestId) {
799
+ setPreviousRequestId(request.requestId);
798
800
  setNow(Date.now());
799
801
  setPendingAction(null);
800
802
  setErrorMessage(null);
801
- }, [request.requestId]);
802
- useEffect5(() => {
803
+ }
804
+ useEffect4(() => {
803
805
  if (!Number.isFinite(expiresAtMs) || expiresAtMs <= Date.now()) return;
804
806
  const interval = window.setInterval(() => setNow(Date.now()), 1e3);
805
807
  return () => window.clearInterval(interval);
@@ -853,7 +855,7 @@ function MediaRequestDialog({ request, onDecline, onAllow, onActionError }) {
853
855
  "button",
854
856
  {
855
857
  type: "button",
856
- className: "rounded-lg bg-[var(--chalk-app-control-primary)] px-3 py-2 text-sm font-medium text-white hover:bg-[var(--chalk-app-control-primary-hover)] disabled:cursor-not-allowed disabled:opacity-55",
858
+ className: "rounded-lg bg-[var(--chalk-app-control-primary)] px-3 py-2 text-sm font-medium text-[var(--chalk-app-control-active-text)] hover:bg-[var(--chalk-app-control-primary-hover)] disabled:cursor-not-allowed disabled:opacity-55",
857
859
  onClick: () => runAction("allow"),
858
860
  disabled: isExpired || pendingAction !== null,
859
861
  children: isExpired ? "Expired" : pendingAction === "allow" ? "Working\u2026" : "Allow"
@@ -866,11 +868,20 @@ function MediaRequestDialog({ request, onDecline, onAllow, onActionError }) {
866
868
  }
867
869
 
868
870
  // src/components/admission-panel/AdmissionPanel.tsx
869
- import React8, { useEffect as useEffect10, useState as useState13 } from "react";
871
+ import React8, { useEffect as useEffect8, useState as useState12 } from "react";
870
872
  import { IconButton, Spinner } from "@q9labsai/chalk-ui";
871
873
 
872
874
  // src/components/audio-output/AudioOutput.tsx
873
- import { useCallback as useCallback3, useEffect as useEffect6, useMemo as useMemo4, useRef as useRef4, useState as useState9 } from "react";
875
+ import { useCallback as useCallback4, useEffect as useEffect5, useMemo as useMemo5, useRef as useRef4, useState as useState8 } from "react";
876
+
877
+ // src/selectors/device-hint.ts
878
+ function deviceHint(participant, roster) {
879
+ if (!participant?.identityId) return void 0;
880
+ const devices = roster.filter((item) => item.identityId === participant.identityId && item.presence.state === "connected");
881
+ if (devices.length < 2) return void 0;
882
+ const label = participant.deviceType === "phone" ? "Phone" : participant.deviceType === "tablet" ? "Tablet" : participant.deviceType === "computer" ? "Computer" : "Device";
883
+ return `${label} \xB7 ${devices.length} devices`;
884
+ }
874
885
 
875
886
  // src/selectors/space-selectors.ts
876
887
  function toVideoParticipants(participants, remoteMedia, localId, displayName, localMedia) {
@@ -889,6 +900,7 @@ function toVideoParticipants(participants, remoteMedia, localId, displayName, lo
889
900
  {
890
901
  id: localId,
891
902
  displayName: localFromSync?.displayName || displayName,
903
+ deviceHint: deviceHint(localFromSync, participants),
892
904
  isLocal: true,
893
905
  isMuted: localMedia.microphone.state !== "enabled",
894
906
  isSpeaking: localFromSync?.presence.speaking ?? false,
@@ -906,6 +918,8 @@ function toVideoParticipants(participants, remoteMedia, localId, displayName, lo
906
918
  result.push({
907
919
  id: participant.participantId,
908
920
  displayName: participant.displayName,
921
+ deviceHint: deviceHint(participant, participants),
922
+ isOwnDevice: Boolean(localFromSync?.identityId && participant.identityId === localFromSync.identityId),
909
923
  isMuted: participant.media.microphone !== "active",
910
924
  isSpeaking: participant.presence.speaking,
911
925
  isActiveSpeaker: participant.presence.activeSpeaker,
@@ -931,12 +945,12 @@ function toAudioParticipants(remoteMedia) {
931
945
  }
932
946
 
933
947
  // src/components/participants-panel/participant-volume-context.tsx
934
- import { createContext as createContext2, useContext as useContext2, useMemo as useMemo3, useState as useState8 } from "react";
948
+ import { createContext as createContext2, useContext as useContext2, useMemo as useMemo4, useState as useState7 } from "react";
935
949
  import { jsx as jsx22 } from "react/jsx-runtime";
936
950
  var ParticipantVolumeContext = createContext2(null);
937
951
  function ParticipantVolumeProvider({ children }) {
938
- const [volumes, setVolumes] = useState8(/* @__PURE__ */ new Map());
939
- const value = useMemo3(
952
+ const [volumes, setVolumes] = useState7(/* @__PURE__ */ new Map());
953
+ const value = useMemo4(
940
954
  () => ({
941
955
  volumes,
942
956
  setVolume: (participantId, volume) => {
@@ -960,12 +974,15 @@ function useParticipantVolumeContext() {
960
974
  import { jsx as jsx23 } from "react/jsx-runtime";
961
975
  function AudioOutput({ participants, volume = 1, audioOutputDeviceId, getParticipantVolume, resumeAudioLabel = "Resume audio" }) {
962
976
  const media = useMedia();
977
+ const self = useSelf();
963
978
  const participantState = useParticipants();
964
979
  const volumeContext = useParticipantVolumeContext();
965
- const contextParticipants = useMemo4(() => toAudioParticipants(media.remote), [media.remote]);
966
- const effectiveParticipants = useMemo4(() => {
980
+ const contextParticipants = useMemo5(() => toAudioParticipants(media.remote), [media.remote]);
981
+ const effectiveParticipants = useMemo5(() => {
967
982
  const stateById = new Map(participantState.roster.map((participant) => [participant.participantId, participant.media]));
968
- return (participants ?? contextParticipants).map((participant) => {
983
+ const identityId = self.identityId ?? participantState.roster.find((participant) => participant.participantId === self.participantId)?.identityId;
984
+ const ownDevices = new Set(participantState.roster.filter((participant) => identityId && participant.identityId === identityId).map((participant) => participant.participantId));
985
+ return (participants ?? contextParticipants).filter((participant) => !ownDevices.has(participant.id)).map((participant) => {
969
986
  const state = stateById.get(participant.id);
970
987
  return {
971
988
  ...participant,
@@ -973,13 +990,13 @@ function AudioOutput({ participants, volume = 1, audioOutputDeviceId, getPartici
973
990
  screenShareAudioTrack: state?.screenShare === "active" ? participant.screenShareAudioTrack : null
974
991
  };
975
992
  });
976
- }, [participants, contextParticipants, participantState.roster]);
993
+ }, [participants, contextParticipants, participantState.roster, self.participantId, self.identityId]);
977
994
  const effectiveAudioOutputDeviceId = audioOutputDeviceId ?? media.selection.speaker ?? void 0;
978
995
  const effectiveGetParticipantVolume = getParticipantVolume ?? ((participantId) => (volumeContext?.volumes.get(participantId) ?? 100) / 100);
979
996
  const audioElementsRef = useRef4(/* @__PURE__ */ new Map());
980
997
  const screenShareAudioRef = useRef4(/* @__PURE__ */ new Map());
981
998
  const pendingAutoplayRetryRef = useRef4(/* @__PURE__ */ new Set());
982
- const [needsAutoplayUnlock, setNeedsAutoplayUnlock] = useState9(false);
999
+ const [needsAutoplayUnlock, setNeedsAutoplayUnlock] = useState8(false);
983
1000
  const resumeAudioRef = useRef4(null);
984
1001
  const markAutoplayBlocked = (el) => {
985
1002
  pendingAutoplayRetryRef.current.add(el);
@@ -989,7 +1006,7 @@ function AudioOutput({ participants, volume = 1, audioOutputDeviceId, getPartici
989
1006
  pendingAutoplayRetryRef.current.delete(el);
990
1007
  if (pendingAutoplayRetryRef.current.size === 0) setNeedsAutoplayUnlock(false);
991
1008
  };
992
- const applyAudioOutputDevice = useCallback3(
1009
+ const applyAudioOutputDevice = useCallback4(
993
1010
  (audioEl) => {
994
1011
  if (!effectiveAudioOutputDeviceId) return;
995
1012
  const sinkAware = audioEl;
@@ -1000,7 +1017,7 @@ function AudioOutput({ participants, volume = 1, audioOutputDeviceId, getPartici
1000
1017
  },
1001
1018
  [effectiveAudioOutputDeviceId]
1002
1019
  );
1003
- const remoteWithAudio = useMemo4(
1020
+ const remoteWithAudio = useMemo5(
1004
1021
  () => effectiveParticipants.filter((p) => {
1005
1022
  if (p.isLocal) return false;
1006
1023
  if (!p.audioTrack) return false;
@@ -1012,7 +1029,7 @@ function AudioOutput({ participants, volume = 1, audioOutputDeviceId, getPartici
1012
1029
  }),
1013
1030
  [effectiveParticipants]
1014
1031
  );
1015
- const remoteWithScreenShareAudio = useMemo4(
1032
+ const remoteWithScreenShareAudio = useMemo5(
1016
1033
  () => effectiveParticipants.filter((p) => {
1017
1034
  if (p.isLocal) return false;
1018
1035
  if (!p.screenShareAudioTrack) return false;
@@ -1024,8 +1041,8 @@ function AudioOutput({ participants, volume = 1, audioOutputDeviceId, getPartici
1024
1041
  }),
1025
1042
  [effectiveParticipants]
1026
1043
  );
1027
- const unlockEvents = useMemo4(() => ["pointerdown", "touchend", "click", "keydown"], []);
1028
- useEffect6(() => {
1044
+ const unlockEvents = useMemo5(() => ["pointerdown", "touchend", "click", "keydown"], []);
1045
+ useEffect5(() => {
1029
1046
  if (!needsAutoplayUnlock) return;
1030
1047
  if (typeof window === "undefined") return;
1031
1048
  let inFlight = false;
@@ -1071,7 +1088,7 @@ function AudioOutput({ participants, volume = 1, audioOutputDeviceId, getPartici
1071
1088
  }
1072
1089
  };
1073
1090
  }, [needsAutoplayUnlock, unlockEvents]);
1074
- useEffect6(() => {
1091
+ useEffect5(() => {
1075
1092
  const audioElements = audioElementsRef.current;
1076
1093
  for (const participant of remoteWithAudio) {
1077
1094
  const { id, audioTrack } = participant;
@@ -1088,7 +1105,7 @@ function AudioOutput({ participants, volume = 1, audioOutputDeviceId, getPartici
1088
1105
  audioEl.volume = Math.max(0, Math.min(1, baseVolume * volume));
1089
1106
  const currentStream = audioEl.srcObject;
1090
1107
  const currentTrack = currentStream?.getAudioTracks()[0];
1091
- if (currentTrack?.id !== audioTrack.id) {
1108
+ if (currentTrack !== audioTrack) {
1092
1109
  const stream = new MediaStream([audioTrack]);
1093
1110
  audioEl.srcObject = stream;
1094
1111
  const attachedElement = audioEl;
@@ -1107,7 +1124,7 @@ function AudioOutput({ participants, volume = 1, audioOutputDeviceId, getPartici
1107
1124
  }
1108
1125
  }
1109
1126
  }, [remoteWithAudio, volume, effectiveAudioOutputDeviceId, effectiveGetParticipantVolume, applyAudioOutputDevice]);
1110
- useEffect6(() => {
1127
+ useEffect5(() => {
1111
1128
  const audioElements = audioElementsRef.current;
1112
1129
  return () => {
1113
1130
  for (const audioEl of audioElements.values()) {
@@ -1118,7 +1135,7 @@ function AudioOutput({ participants, volume = 1, audioOutputDeviceId, getPartici
1118
1135
  audioElements.clear();
1119
1136
  };
1120
1137
  }, []);
1121
- useEffect6(() => {
1138
+ useEffect5(() => {
1122
1139
  const handlers = /* @__PURE__ */ new Map();
1123
1140
  for (const participant of remoteWithAudio) {
1124
1141
  const { id, audioTrack } = participant;
@@ -1147,7 +1164,7 @@ function AudioOutput({ participants, volume = 1, audioOutputDeviceId, getPartici
1147
1164
  }
1148
1165
  };
1149
1166
  }, [remoteWithAudio]);
1150
- useEffect6(() => {
1167
+ useEffect5(() => {
1151
1168
  const audioElements = screenShareAudioRef.current;
1152
1169
  for (const participant of remoteWithScreenShareAudio) {
1153
1170
  const { id, screenShareAudioTrack } = participant;
@@ -1165,7 +1182,7 @@ function AudioOutput({ participants, volume = 1, audioOutputDeviceId, getPartici
1165
1182
  audioEl.volume = Math.max(0, Math.min(1, baseVolume * volume));
1166
1183
  const currentStream = audioEl.srcObject;
1167
1184
  const currentTrack = currentStream?.getAudioTracks()[0];
1168
- if (currentTrack?.id !== screenShareAudioTrack.id) {
1185
+ if (currentTrack !== screenShareAudioTrack) {
1169
1186
  const stream = new MediaStream([screenShareAudioTrack]);
1170
1187
  audioEl.srcObject = stream;
1171
1188
  const attachedElement = audioEl;
@@ -1184,7 +1201,7 @@ function AudioOutput({ participants, volume = 1, audioOutputDeviceId, getPartici
1184
1201
  }
1185
1202
  }
1186
1203
  }, [remoteWithScreenShareAudio, volume, effectiveAudioOutputDeviceId, effectiveGetParticipantVolume, applyAudioOutputDevice]);
1187
- useEffect6(() => {
1204
+ useEffect5(() => {
1188
1205
  const audioElements = screenShareAudioRef.current;
1189
1206
  return () => {
1190
1207
  for (const audioEl of audioElements.values()) {
@@ -1226,10 +1243,10 @@ function useHaptics({ enabled = true } = {}) {
1226
1243
 
1227
1244
  // src/components/participant-tile/ParticipantTile.tsx
1228
1245
  import { Facehash as Facehash2 } from "@q9labsai/facehash/react";
1229
- import React5, { useMemo as useMemo6, useRef as useRef6 } from "react";
1246
+ import React5, { useMemo as useMemo7, useRef as useRef6 } from "react";
1230
1247
 
1231
1248
  // src/internal/useMirrorSetting.ts
1232
- import { useSyncExternalStore as useSyncExternalStore2 } from "react";
1249
+ import { useSyncExternalStore as useSyncExternalStore3 } from "react";
1233
1250
  var KEY = "chalk_mirror";
1234
1251
  var listeners = /* @__PURE__ */ new Set();
1235
1252
  var fallback = true;
@@ -1252,7 +1269,7 @@ function subscribe(listener) {
1252
1269
  };
1253
1270
  }
1254
1271
  function useMirrorSetting() {
1255
- const mirrored = useSyncExternalStore2(subscribe, read, () => true);
1272
+ const mirrored = useSyncExternalStore3(subscribe, read, () => true);
1256
1273
  return [mirrored, setMirrored];
1257
1274
  }
1258
1275
  function setMirrored(next) {
@@ -1316,7 +1333,7 @@ function StageIcon({ name, size = 16, ...props }) {
1316
1333
  }
1317
1334
 
1318
1335
  // src/components/atomic/Avatar.tsx
1319
- import React3, { useEffect as useEffect7, useMemo as useMemo5, useState as useState10 } from "react";
1336
+ import React3, { useMemo as useMemo6, useState as useState9 } from "react";
1320
1337
  import { Facehash } from "@q9labsai/facehash/react";
1321
1338
  import { jsx as jsx25, jsxs as jsxs10 } from "react/jsx-runtime";
1322
1339
  var GeneratedFacehash = Facehash;
@@ -1335,16 +1352,14 @@ var statusColorMap = {
1335
1352
  offline: "var(--chalk-muted-text)"
1336
1353
  };
1337
1354
  var Avatar = React3.memo(({ name, src, size = "md", status, className, style, gradientPreference, generated = true, animated = true }) => {
1338
- const [imageError, setImageError] = useState10(false);
1339
- const hasUploadedImage = Boolean(src) && !imageError;
1355
+ const [image, setImage] = useState9({ src, name, generated, failed: false });
1356
+ if (image.src !== src || image.name !== name || image.generated !== generated) setImage({ src, name, generated, failed: false });
1357
+ const hasUploadedImage = Boolean(src) && !image.failed;
1340
1358
  const shouldShowGeneratedAvatar = generated && Boolean(name) && !hasUploadedImage;
1341
- useEffect7(() => {
1342
- setImageError(false);
1343
- }, [src, name, generated]);
1344
- const avatarRecipe = useMemo5(() => getParticipantAvatarRecipe(name || "unknown", gradientPreference), [gradientPreference, name]);
1359
+ const avatarRecipe = useMemo6(() => getParticipantAvatarRecipe(name || "unknown", gradientPreference), [gradientPreference, name]);
1345
1360
  const { size: pxSize, fontSize } = sizeMap[size];
1346
1361
  return /* @__PURE__ */ jsxs10("div", { className: cn("relative inline-flex shrink-0 rounded-full", className), style: { width: pxSize, height: pxSize, ...style }, role: "img", "aria-label": `Avatar for ${name || "Unknown"}`, children: [
1347
- hasUploadedImage ? /* @__PURE__ */ jsx25("img", { src: src || "", alt: name, className: "h-full w-full rounded-full object-cover", onError: () => setImageError(true) }) : shouldShowGeneratedAvatar ? /* @__PURE__ */ jsx25("div", { "aria-hidden": "true", className: "h-full w-full overflow-hidden rounded-full", children: /* @__PURE__ */ jsx25(GeneratedFacehash, { name: name || "guest", size: pxSize, variant: "flat", interactive: false, intensity3d: "subtle", enableBlink: animated, colors: [...avatarRecipe.facehashColors] }) }) : /* @__PURE__ */ jsx25("div", { className: "flex h-full w-full items-center justify-center rounded-full font-medium !text-[var(--chalk-accent-text)]", style: { fontSize, backgroundColor: avatarRecipe.color }, children: avatarRecipe.initials }),
1362
+ hasUploadedImage ? /* @__PURE__ */ jsx25("img", { src: src || "", alt: name, className: "h-full w-full rounded-full object-cover", onError: () => setImage({ src, name, generated, failed: true }) }) : shouldShowGeneratedAvatar ? /* @__PURE__ */ jsx25("div", { "aria-hidden": "true", className: "h-full w-full overflow-hidden rounded-full", children: /* @__PURE__ */ jsx25(GeneratedFacehash, { name: name || "guest", size: pxSize, variant: "flat", interactive: false, intensity3d: "subtle", enableBlink: animated, colors: [...avatarRecipe.facehashColors] }) }) : /* @__PURE__ */ jsx25("div", { className: "flex h-full w-full items-center justify-center rounded-full font-medium !text-[var(--chalk-accent-text)]", style: { fontSize, backgroundColor: avatarRecipe.color }, children: avatarRecipe.initials }),
1348
1363
  status && /* @__PURE__ */ jsx25(
1349
1364
  "span",
1350
1365
  {
@@ -1391,7 +1406,7 @@ function TileShell({ label, accentColor, pinned = false, ring = false, speaking
1391
1406
  tabIndex: hidden ? -1 : 0,
1392
1407
  "aria-label": label,
1393
1408
  "aria-pressed": pinned,
1394
- className: "absolute inset-0 z-20 rounded-[inherit] outline-none motion-safe:transition-colors motion-safe:duration-150 motion-safe:ease-[ease-out] hover:bg-white/[.045] active:bg-white/[.09] focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--chalk-focus)]"
1409
+ className: "absolute inset-0 z-20 rounded-[inherit] outline-none motion-safe:transition-colors motion-safe:duration-150 motion-safe:ease-[ease-out] hover:bg-[var(--chalk-on-overlay)]/[.045] active:bg-[var(--chalk-on-overlay)]/[.09] focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--chalk-focus)]"
1395
1410
  }
1396
1411
  ) : null,
1397
1412
  /* @__PURE__ */ jsx26(
@@ -1400,23 +1415,23 @@ function TileShell({ label, accentColor, pinned = false, ring = false, speaking
1400
1415
  "aria-hidden": "true",
1401
1416
  "data-part": "speaking-ring",
1402
1417
  className: "pointer-events-none absolute inset-0 z-30 rounded-[inherit] motion-safe:transition-opacity motion-safe:duration-[90ms] motion-safe:ease-linear",
1403
- style: { opacity: speaking ? 0.3 + 0.7 * audioLevel : 0, boxShadow: "inset 0 0 0 3px rgba(255,255,255,.9), inset 0 0 0 4px rgba(0,0,0,.35)" }
1418
+ style: { opacity: speaking ? 0.3 + 0.7 * audioLevel : 0, boxShadow: "inset 0 0 0 3px color-mix(in srgb, var(--chalk-on-overlay) 90%, transparent), inset 0 0 0 4px var(--chalk-scrim)" }
1404
1419
  }
1405
1420
  ),
1406
1421
  ring ? /* @__PURE__ */ jsx26("div", { "aria-hidden": "true", "data-part": "follow-ring", className: "pointer-events-none absolute inset-0 z-30 rounded-[inherit] shadow-[inset_0_0_0_2px_var(--chalk-text)]" }) : null,
1407
1422
  corner,
1408
- chip ? /* @__PURE__ */ jsx26("div", { "data-part": "tile-tag", className: "pointer-events-none absolute bottom-2 left-2 z-30 flex h-6 max-w-[calc(100%_-_16px)] items-center gap-[5px] rounded-[6px] bg-[rgba(12,14,18,.75)] px-2 text-[12px] leading-[1.4] font-medium text-white", children: chip }) : null
1423
+ chip ? /* @__PURE__ */ jsx26("div", { "data-part": "tile-tag", className: "pointer-events-none absolute bottom-2 left-2 z-30 flex h-6 max-w-[calc(100%_-_16px)] items-center gap-[5px] rounded-[6px] bg-[var(--chalk-overlay)] px-2 text-[12px] leading-[1.4] font-medium text-[var(--chalk-on-overlay)]", children: chip }) : null
1409
1424
  ]
1410
1425
  }
1411
1426
  );
1412
1427
  }
1413
1428
 
1414
1429
  // src/components/participant-tile/useVideoTrack.ts
1415
- import { useEffect as useEffect8, useRef as useRef5, useState as useState11 } from "react";
1430
+ import { useEffect as useEffect6, useRef as useRef5, useState as useState10 } from "react";
1416
1431
  function useVideoTrack(videoRef, track, enabled) {
1417
- const [status, setStatus] = useState11("idle");
1432
+ const [status, setStatus] = useState10("idle");
1418
1433
  const loadedRef = useRef5(false);
1419
- useEffect8(() => {
1434
+ useEffect6(() => {
1420
1435
  const video = videoRef.current;
1421
1436
  loadedRef.current = false;
1422
1437
  if (!video || !track || !enabled || track.readyState !== "live") {
@@ -1493,9 +1508,10 @@ var ParticipantTileSurface = React5.memo(function ParticipantTileSurface2({
1493
1508
  const prefersReducedMotion = usePrefersReducedMotion();
1494
1509
  const phone = useMediaQuery("(max-width:640px)");
1495
1510
  const [localMirrored] = useMirrorSetting();
1511
+ const [deviceLabel, ...deviceDetails] = participant.deviceHint?.split(" \xB7 ") ?? [];
1496
1512
  const mirrored = mirror ?? (participant.isLocal === true && localMirrored);
1497
- const colors = useMemo6(() => getParticipantColor(participant.displayName || participant.id, gradientPreference), [gradientPreference, participant.displayName, participant.id]);
1498
- const recipe = useMemo6(() => getParticipantAvatarRecipe(participant.displayName || participant.id, gradientPreference), [participant.displayName, participant.id, gradientPreference]);
1513
+ const colors = useMemo7(() => getParticipantColor(participant.displayName || participant.id, gradientPreference), [gradientPreference, participant.displayName, participant.id]);
1514
+ const recipe = useMemo7(() => getParticipantAvatarRecipe(participant.displayName || participant.id, gradientPreference), [participant.displayName, participant.id, gradientPreference]);
1499
1515
  const actionLabel = `${pinned ? "Unpin" : "Pin"} ${participant.displayName}`;
1500
1516
  const followLabel = following ? "Stop following" : "Follow";
1501
1517
  const hasPoorConnection = participant.connectionQuality !== void 0 && participant.connectionQuality > 0 && participant.connectionQuality <= 2;
@@ -1516,11 +1532,19 @@ var ParticipantTileSurface = React5.memo(function ParticipantTileSurface2({
1516
1532
  dataTour: participant.isLocal ? "local-video" : "video-grid",
1517
1533
  hidden,
1518
1534
  corner: /* @__PURE__ */ jsxs12(Fragment6, { children: [
1519
- showStatus && hasPoorConnection ? /* @__PURE__ */ jsx27("span", { role: "img", "data-part": "tile-signal", "aria-label": `${participant.displayName} has a weak connection`, className: "pointer-events-none absolute top-2 left-2 z-30 flex h-6 items-center rounded-[6px] bg-[rgba(12,14,18,.75)] px-[7px]", children: /* @__PURE__ */ jsx27(SignalBars, {}) }) : null,
1535
+ showStatus && hasPoorConnection ? /* @__PURE__ */ jsx27("span", { role: "img", "data-part": "tile-signal", "aria-label": `${participant.displayName} has a weak connection`, className: "pointer-events-none absolute top-2 left-2 z-30 flex h-6 items-center rounded-[6px] bg-[var(--chalk-overlay)] px-[7px]", children: /* @__PURE__ */ jsx27(SignalBars, {}) }) : null,
1520
1536
  onClick || onFollow ? /* @__PURE__ */ jsx27("span", { "data-part": "tile-menu", className: "absolute top-2 right-2 z-30 transition-opacity duration-150 min-[641px]:opacity-0 group-hover/tile:opacity-100 focus-within:opacity-100", children: /* @__PURE__ */ jsxs12(
1521
1537
  ChalkMenu,
1522
1538
  {
1523
- trigger: /* @__PURE__ */ jsx27("button", { type: "button", "aria-label": `More options for ${participant.displayName}`, className: "grid h-8 w-8 place-items-center rounded-full bg-[rgba(12,14,18,.75)] text-white outline-none hover:bg-[rgba(40,42,48,.95)] focus-visible:ring-2 focus-visible:ring-[var(--chalk-focus)]", children: /* @__PURE__ */ jsx27(StageIcon, { name: "more", size: 18 }) }),
1539
+ trigger: /* @__PURE__ */ jsx27(
1540
+ "button",
1541
+ {
1542
+ type: "button",
1543
+ "aria-label": `More options for ${participant.displayName}`,
1544
+ className: "grid h-8 w-8 place-items-center rounded-full bg-[var(--chalk-overlay)] text-[var(--chalk-on-overlay)] outline-none hover:bg-[var(--chalk-overlay-hover)] focus-visible:ring-2 focus-visible:ring-[var(--chalk-focus)]",
1545
+ children: /* @__PURE__ */ jsx27(StageIcon, { name: "more", size: 18 })
1546
+ }
1547
+ ),
1524
1548
  children: [
1525
1549
  onClick ? /* @__PURE__ */ jsx27(ChalkMenuItem, { onClick, children: actionLabel }) : null,
1526
1550
  onFollow ? /* @__PURE__ */ jsx27(ChalkMenuItem, { onClick: onFollow, children: followLabel }) : null
@@ -1530,16 +1554,25 @@ var ParticipantTileSurface = React5.memo(function ParticipantTileSurface2({
1530
1554
  ] }),
1531
1555
  chip: showName || showStatus ? /* @__PURE__ */ jsxs12(Fragment6, { children: [
1532
1556
  pinned && /* @__PURE__ */ jsx27(StageIcon, { name: "pin", size: 14, "aria-label": "Pinned" }),
1533
- showName && /* @__PURE__ */ jsxs12(Fragment6, { children: [
1534
- /* @__PURE__ */ jsxs12("span", { dir: "auto", "data-part": "tile-full-name", className: "min-w-0 truncate [unicode-bidi:plaintext]", title: participant.displayName, children: [
1535
- participant.displayName,
1536
- participant.isLocal && participant.displayName !== "You" && /* @__PURE__ */ jsx27("span", { className: "text-white", children: " (You)" })
1557
+ /* @__PURE__ */ jsxs12("span", { "data-part": "tile-label", className: "inline-flex h-[1lh] min-w-0 max-w-full flex-wrap content-start items-center gap-x-[5px] overflow-hidden", children: [
1558
+ showName && /* @__PURE__ */ jsxs12(Fragment6, { children: [
1559
+ /* @__PURE__ */ jsxs12("span", { dir: "auto", "data-part": "tile-full-name", className: "inline-flex h-full min-w-0 max-w-full shrink-0 items-center [unicode-bidi:plaintext]", title: participant.displayName, children: [
1560
+ /* @__PURE__ */ jsx27("span", { className: "min-w-0 truncate", children: participant.displayName }),
1561
+ participant.isLocal && participant.displayName !== "You" && /* @__PURE__ */ jsxs12("span", { "data-part": "tile-self-label", className: "shrink-0 whitespace-pre text-[var(--chalk-on-overlay)]", children: [
1562
+ " ",
1563
+ "(You)"
1564
+ ] })
1565
+ ] }),
1566
+ /* @__PURE__ */ jsx27("span", { dir: "auto", "data-part": "tile-short-name", className: "hidden h-full min-w-0 max-w-full shrink-0 truncate [unicode-bidi:plaintext]", children: participant.isLocal ? "You" : participant.displayName.split(" ")[0] })
1537
1567
  ] }),
1538
- /* @__PURE__ */ jsx27("span", { dir: "auto", "data-part": "tile-short-name", className: "hidden min-w-0 truncate [unicode-bidi:plaintext]", children: participant.isLocal ? "You" : participant.displayName.split(" ")[0] })
1568
+ participant.deviceHint ? /* @__PURE__ */ jsxs12("span", { "data-part": "tile-device", className: "contents text-[11px]", children: [
1569
+ /* @__PURE__ */ jsx27("span", { "data-part": "tile-device-type", className: "flex h-full shrink-0 items-center whitespace-nowrap opacity-80", children: deviceLabel }),
1570
+ deviceDetails.length > 0 && /* @__PURE__ */ jsx27("span", { "data-part": "tile-device-count", className: "flex h-full shrink-0 items-center whitespace-nowrap opacity-80", children: `\xB7 ${deviceDetails.join(" \xB7 ")}` })
1571
+ ] }) : null
1539
1572
  ] }),
1540
1573
  following ? /* @__PURE__ */ jsx27("span", { "data-part": "tile-following", className: "shrink-0 font-semibold opacity-80", children: "following" }) : null,
1541
- showStatus && participant.isMuted && /* @__PURE__ */ jsx27(StageIcon, { name: "mute", size: 14, className: "shrink-0 text-[#ff6b6b]", "aria-label": "Muted" }),
1542
- showStatus && participant.isHandRaised && /* @__PURE__ */ jsxs12("span", { className: "flex shrink-0 items-center text-[#e2bd3a]", role: "img", "aria-label": `Hand raised${participant.handRaiseOrder ? `, number ${participant.handRaiseOrder}` : ""}`, children: [
1574
+ showStatus && participant.isMuted && /* @__PURE__ */ jsx27(StageIcon, { name: "mute", size: 14, className: "shrink-0 text-[var(--chalk-overlay-danger)]", "aria-label": "Muted" }),
1575
+ showStatus && participant.isHandRaised && /* @__PURE__ */ jsxs12("span", { className: "flex shrink-0 items-center text-[var(--chalk-overlay-warning)]", role: "img", "aria-label": `Hand raised${participant.handRaiseOrder ? `, number ${participant.handRaiseOrder}` : ""}`, children: [
1543
1576
  /* @__PURE__ */ jsx27(StageIcon, { name: "hand", size: 14 }),
1544
1577
  participant.handRaiseOrder ? /* @__PURE__ */ jsx27("b", { className: "ml-px text-[11px] font-bold", children: participant.handRaiseOrder }) : null
1545
1578
  ] })
@@ -1572,11 +1605,11 @@ var ParticipantTileSurface = React5.memo(function ParticipantTileSurface2({
1572
1605
  ParticipantTile.displayName = "ParticipantTile";
1573
1606
  ParticipantTileSurface.displayName = "ParticipantTileSurface";
1574
1607
  function SignalBars() {
1575
- return /* @__PURE__ */ jsx27("span", { "aria-hidden": "true", className: "inline-flex h-3 items-end gap-0.5", children: [6, 9, 12, 15].map((height, index) => /* @__PURE__ */ jsx27("i", { className: "block w-[3px] rounded-[1px]", style: { height, background: index === 0 ? "#e2bd3a" : "rgba(255,255,255,.3)" } }, height)) });
1608
+ return /* @__PURE__ */ jsx27("span", { "aria-hidden": "true", className: "inline-flex h-3 items-end gap-0.5", children: [6, 9, 12, 15].map((height, index) => /* @__PURE__ */ jsx27("i", { className: "block w-[3px] rounded-[1px]", style: { height, background: index === 0 ? "var(--chalk-overlay-warning)" : "color-mix(in srgb, var(--chalk-on-overlay) 30%, transparent)" } }, height)) });
1576
1609
  }
1577
1610
 
1578
1611
  // src/components/atomic/ReactionBubble.tsx
1579
- import React6, { useEffect as useEffect9, useState as useState12, useMemo as useMemo7 } from "react";
1612
+ import React6, { useEffect as useEffect7, useState as useState11, useMemo as useMemo8 } from "react";
1580
1613
  import { CELEBRATION_EMOJIS } from "@q9labsai/chalk-ui/reactions";
1581
1614
  import { jsx as jsx28, jsxs as jsxs13 } from "react/jsx-runtime";
1582
1615
  var BASE_PARTICLE_COLORS = ["#14b8a6", "#f59e0b", "#ec4899", "#8b5cf6", "#06b6d4", "#22c55e"];
@@ -1620,15 +1653,15 @@ function getParticleStyle(particle) {
1620
1653
  };
1621
1654
  }
1622
1655
  var ReactionBubble = React6.memo(({ emoji, participantName, onComplete, duration: baseDuration = 3e3, animated = true, className }) => {
1623
- const [isVisible, setIsVisible] = useState12(true);
1656
+ const [isVisible, setIsVisible] = useState11(true);
1624
1657
  const prefersReducedMotion = usePrefersReducedMotion();
1625
- const participantColors = useMemo7(() => getParticipantColor(participantName || "unknown"), [participantName]);
1658
+ const participantColors = useMemo8(() => getParticipantColor(participantName || "unknown"), [participantName]);
1626
1659
  const isCelebration = CELEBRATION_EMOJIS.includes(emoji);
1627
- const animProps = useMemo7(() => animated ? generateAnimationProps() : null, [animated]);
1628
- const particles = useMemo7(() => animated && isCelebration ? generateParticles(participantColors.primary) : [], [animated, isCelebration, participantColors.primary]);
1660
+ const animProps = useMemo8(() => animated ? generateAnimationProps() : null, [animated]);
1661
+ const particles = useMemo8(() => animated && isCelebration ? generateParticles(participantColors.primary) : [], [animated, isCelebration, participantColors.primary]);
1629
1662
  const timeoutMs = baseDuration;
1630
1663
  const floatDurationMs = prefersReducedMotion || !animProps ? baseDuration : animProps.duration;
1631
- useEffect9(() => {
1664
+ useEffect7(() => {
1632
1665
  if (!animated) return;
1633
1666
  const timer = setTimeout(() => {
1634
1667
  setIsVisible(false);
@@ -1708,13 +1741,13 @@ function getWaitingLabel(joinedAt) {
1708
1741
  return `Waiting ${minutes} min`;
1709
1742
  }
1710
1743
  var AdmissionPanelSurface = React8.memo(({ participants, onAdmit, onDeny, onAdmitAll, onDenyAll, loading = false, className, onClose, inline = false }) => {
1711
- const [, setTick] = useState13(0);
1712
- useEffect10(() => {
1744
+ const [, setTick] = useState12(0);
1745
+ useEffect8(() => {
1713
1746
  const timer = window.setInterval(() => setTick((t) => t + 1), 6e4);
1714
1747
  return () => window.clearInterval(timer);
1715
1748
  }, []);
1716
- const [busy, setBusy] = useState13(false);
1717
- const [error, setError] = useState13(null);
1749
+ const [busy, setBusy] = useState12(false);
1750
+ const [error, setError] = useState12(null);
1718
1751
  const perform = async (action) => {
1719
1752
  if (busy) return;
1720
1753
  setBusy(true);
@@ -1787,7 +1820,7 @@ AdmissionPanel.displayName = "AdmissionPanel";
1787
1820
 
1788
1821
  // src/components/composite/ChatPanel.tsx
1789
1822
  import { CHALK_CHAT_ATTACHMENT_LIMITS, CHALK_CHAT_ATTACHMENT_MIME_TYPES } from "@q9labsai/chalk-client";
1790
- import React10, { useEffect as useEffect13, useLayoutEffect, useMemo as useMemo8, useRef as useRef9, useState as useState16 } from "react";
1823
+ import React10, { useEffect as useEffect11, useLayoutEffect, useMemo as useMemo9, useRef as useRef9, useState as useState15 } from "react";
1791
1824
  import { Button } from "@q9labsai/chalk-ui";
1792
1825
 
1793
1826
  // src/components/call-card/CallCardStyles.tsx
@@ -2193,7 +2226,7 @@ var styles = `.call-card-tabs {
2193
2226
  font-weight: 700;
2194
2227
  line-height: 1;
2195
2228
  letter-spacing: 0.04em;
2196
- color: #fff;
2229
+ color: var(--chalk-on-overlay);
2197
2230
  }
2198
2231
  .call-file-type.ti,
2199
2232
  .call-file-type.tx {
@@ -2257,7 +2290,7 @@ var styles = `.call-card-tabs {
2257
2290
  border-radius: 999px;
2258
2291
  background: var(--chalk-popover);
2259
2292
  border: 1px solid var(--chalk-line-strong);
2260
- box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
2293
+ box-shadow: var(--chalk-shadow);
2261
2294
  opacity: 0;
2262
2295
  visibility: hidden;
2263
2296
  transform: translateY(3px);
@@ -2365,8 +2398,8 @@ var styles = `.call-card-tabs {
2365
2398
  width: 20px;
2366
2399
  height: 20px;
2367
2400
  border-radius: 50%;
2368
- background: #dcb740;
2369
- color: #16140c;
2401
+ background: var(--chalk-warning);
2402
+ color: var(--chalk-accent-text);
2370
2403
  font-size: 12px;
2371
2404
  font-weight: 700;
2372
2405
  }
@@ -2403,7 +2436,7 @@ var styles = `.call-card-tabs {
2403
2436
  .call-attachments.image-1 .call-photo { border-radius: 14px; aspect-ratio: auto; }
2404
2437
  .call-attachments.image-1 .call-photo img { height: auto; min-height: 150px; max-height: 320px; }
2405
2438
  .call-attachments.image-3 .call-photo:nth-child(3) { grid-column: span 2; aspect-ratio: 2; }
2406
- .call-photo-more { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.5); color: #fff; font-size: 20px; font-weight: 600; }
2439
+ .call-photo-more { position: absolute; inset: 0; display: grid; place-items: center; background: var(--chalk-scrim); color: var(--chalk-on-overlay); font-size: 20px; font-weight: 600; }
2407
2440
  .call-file > span:not(.call-file-type) {
2408
2441
  flex: 1;
2409
2442
  min-width: 0;
@@ -2563,22 +2596,22 @@ var styles = `.call-card-tabs {
2563
2596
  padding: 0;
2564
2597
  border: 0;
2565
2598
  margin: 0;
2566
- background: rgba(8, 8, 10, .94);
2567
- color: #ececee;
2599
+ background: var(--chalk-photo-viewer-overlay);
2600
+ color: var(--chalk-on-overlay);
2568
2601
  }
2569
2602
  .call-photo-viewer::backdrop { background: transparent; }
2570
2603
  .call-photo-viewer { opacity: 0; visibility: hidden; transition: opacity .18s ease-out, visibility 0s .18s; }
2571
2604
  .call-photo-viewer[open] { display: flex; flex-direction: column; opacity: 1; visibility: visible; transition: opacity .18s ease-out; }
2572
2605
  .call-photo-viewer[open][data-closing] { opacity: 0; visibility: hidden; transition: opacity .18s ease-out, visibility 0s .18s; }
2573
2606
  @starting-style { .call-photo-viewer[open] { opacity: 0; } }
2574
- .call-photo-viewer :focus-visible { outline-color: #ececee; }
2607
+ .call-photo-viewer :focus-visible { outline-color: var(--chalk-on-overlay); }
2575
2608
  .call-photo-viewer-bar { flex: none; display: flex; align-items: center; gap: 8px; padding: 12px 12px 12px 20px; }
2576
2609
  .call-photo-viewer-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
2577
2610
  .call-photo-viewer-name b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
2578
- .call-photo-viewer-name small { font-size: 12px; color: #a1a2a9; }
2579
- .call-photo-viewer-control { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #ececee; background: rgba(255,255,255,.08); }
2611
+ .call-photo-viewer-name small { font-size: 12px; color: var(--chalk-on-overlay); }
2612
+ .call-photo-viewer-control { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; color: var(--chalk-on-overlay); background: color-mix(in srgb, var(--chalk-on-overlay) 8%, transparent); }
2580
2613
  .call-photo-viewer-control svg { width: 20px; height: 20px; }
2581
- .call-photo-viewer-control:hover { background: rgba(255,255,255,.16); }
2614
+ .call-photo-viewer-control:hover { background: color-mix(in srgb, var(--chalk-on-overlay) 16%, transparent); }
2582
2615
  .call-photo-viewer-stage { position: relative; flex: 1; min-height: 0; }
2583
2616
  .call-photo-viewer-stage img { position: absolute; inset: 0 76px 36px; margin: auto; max-width: calc(100% - 152px); max-height: calc(100% - 36px); border-radius: 8px; user-select: none; }
2584
2617
  .call-photo-previous, .call-photo-next { position: absolute; top: 50%; width: 44px; height: 44px; margin-top: -40px; }
@@ -2650,14 +2683,14 @@ function CallCardStyles() {
2650
2683
 
2651
2684
  // src/components/composite/MessageBubble.tsx
2652
2685
  import { CHALK_REACTIONS } from "@q9labsai/chalk-client";
2653
- import React9, { useEffect as useEffect12, useRef as useRef8, useState as useState15 } from "react";
2686
+ import React9, { useEffect as useEffect10, useRef as useRef8, useState as useState14 } from "react";
2654
2687
 
2655
2688
  // src/components/composite/use-chat-attachment-previews.ts
2656
- import { useCallback as useCallback4, useEffect as useEffect11, useRef as useRef7, useState as useState14 } from "react";
2689
+ import { useCallback as useCallback5, useEffect as useEffect9, useRef as useRef7, useState as useState13 } from "react";
2657
2690
  function useChatAttachmentPreviews(attachments, resolveUrl) {
2658
- const [resolvedUrls, setResolvedUrls] = useState14(() => /* @__PURE__ */ new Map());
2659
- const [failedAttachmentIds, setFailedAttachmentIds] = useState14(() => /* @__PURE__ */ new Set());
2660
- const [retryGeneration, setRetryGeneration] = useState14(0);
2691
+ const [resolvedUrls, setResolvedUrls] = useState13(() => /* @__PURE__ */ new Map());
2692
+ const [failedAttachmentIds, setFailedAttachmentIds] = useState13(() => /* @__PURE__ */ new Set());
2693
+ const [retryGeneration, setRetryGeneration] = useState13(0);
2661
2694
  const resolvingAttachmentIds = useRef7(/* @__PURE__ */ new Set());
2662
2695
  const resolvedUrlsRef = useRef7(resolvedUrls);
2663
2696
  const failedAttachmentIdsRef = useRef7(failedAttachmentIds);
@@ -2669,7 +2702,7 @@ function useChatAttachmentPreviews(attachments, resolveUrl) {
2669
2702
  failedAttachmentIdsRef.current = failedAttachmentIds;
2670
2703
  currentAttachmentIdsRef.current = currentAttachmentIds;
2671
2704
  currentImageIdsRef.current = currentImageIds;
2672
- const markFailed = useCallback4((attachmentId, operation) => {
2705
+ const markFailed = useCallback5((attachmentId, operation) => {
2673
2706
  console.warn("Chat attachment preview unavailable.", { attachmentId, operation });
2674
2707
  setResolvedUrls((current) => {
2675
2708
  const next = new Map(current);
@@ -2678,7 +2711,7 @@ function useChatAttachmentPreviews(attachments, resolveUrl) {
2678
2711
  });
2679
2712
  setFailedAttachmentIds((current) => new Set(current).add(attachmentId));
2680
2713
  }, []);
2681
- useEffect11(() => {
2714
+ useEffect9(() => {
2682
2715
  if (!resolveUrl) return;
2683
2716
  setResolvedUrls((current) => {
2684
2717
  const next = new Map([...current].filter(([attachmentId]) => currentImageIdsRef.current.has(attachmentId)));
@@ -2701,7 +2734,7 @@ function useChatAttachmentPreviews(attachments, resolveUrl) {
2701
2734
  ).finally(() => resolvingAttachmentIds.current.delete(attachment.attachmentId));
2702
2735
  }
2703
2736
  }, [attachments, markFailed, resolveUrl, retryGeneration]);
2704
- const retry = useCallback4((attachmentId) => {
2737
+ const retry = useCallback5((attachmentId) => {
2705
2738
  setFailedAttachmentIds((current) => {
2706
2739
  const next = new Set(current);
2707
2740
  next.delete(attachmentId);
@@ -2740,17 +2773,17 @@ var MessageBubble = React9.memo(
2740
2773
  className
2741
2774
  }) => {
2742
2775
  const { resolvedUrls, failedAttachmentIds, markFailed, retry } = useChatAttachmentPreviews(attachments, onResolveAttachmentUrl);
2743
- const [reactionError, setReactionError] = useState15(null);
2744
- const [reacting, setReacting] = useState15(false);
2745
- const [reactionBarOpen, setReactionBarOpen] = useState15(false);
2776
+ const [reactionError, setReactionError] = useState14(null);
2777
+ const [reacting, setReacting] = useState14(false);
2778
+ const [reactionBarOpen, setReactionBarOpen] = useState14(false);
2746
2779
  const messageRef = useRef8(null);
2747
2780
  const press = useRef8(null);
2748
2781
  const cancelPress = () => {
2749
2782
  if (press.current) clearTimeout(press.current.timer);
2750
2783
  press.current = null;
2751
2784
  };
2752
- useEffect12(() => () => cancelPress(), []);
2753
- useEffect12(() => {
2785
+ useEffect10(() => () => cancelPress(), []);
2786
+ useEffect10(() => {
2754
2787
  if (!reactionBarOpen) return;
2755
2788
  messageRef.current?.querySelector(".call-reaction-bar button")?.focus({ preventScroll: true });
2756
2789
  const dismiss = (event) => {
@@ -2759,11 +2792,11 @@ var MessageBubble = React9.memo(
2759
2792
  document.addEventListener("pointerdown", dismiss);
2760
2793
  return () => document.removeEventListener("pointerdown", dismiss);
2761
2794
  }, [reactionBarOpen]);
2762
- const [photo, setPhoto] = useState15(null);
2763
- const [downloading, setDownloading] = useState15(false);
2764
- const [downloadError, setDownloadError] = useState15(null);
2795
+ const [photo, setPhoto] = useState14(null);
2796
+ const [downloading, setDownloading] = useState14(false);
2797
+ const [downloadError, setDownloadError] = useState14(null);
2765
2798
  const downloadController = useRef8(null);
2766
- useEffect12(() => () => downloadController.current?.abort(), []);
2799
+ useEffect10(() => () => downloadController.current?.abort(), []);
2767
2800
  const downloadPhoto = async () => {
2768
2801
  if (!photo || downloading) return;
2769
2802
  const url = resolvedUrls.get(photo.attachmentId);
@@ -2793,9 +2826,9 @@ var MessageBubble = React9.memo(
2793
2826
  downloadController.current = null;
2794
2827
  }
2795
2828
  };
2796
- const [photoClosing, setPhotoClosing] = useState15(false);
2829
+ const [photoClosing, setPhotoClosing] = useState14(false);
2797
2830
  const closeTimer = useRef8(null);
2798
- useEffect12(
2831
+ useEffect10(
2799
2832
  () => () => {
2800
2833
  if (closeTimer.current) clearTimeout(closeTimer.current);
2801
2834
  },
@@ -3149,29 +3182,29 @@ var ChatPanelSurface = React10.memo(
3149
3182
  autoScrollBehavior,
3150
3183
  className
3151
3184
  }) => {
3152
- const [draft, setDraft] = useState16("");
3153
- const [stagedFiles, setStagedFiles] = useState16([]);
3185
+ const [draft, setDraft] = useState15("");
3186
+ const [stagedFiles, setStagedFiles] = useState15([]);
3154
3187
  const uploads = useRef9(/* @__PURE__ */ new Map());
3155
- const [failedUploads, setFailedUploads] = useState16(/* @__PURE__ */ new Set());
3156
- const [uploading, setUploading] = useState16(/* @__PURE__ */ new Set());
3157
- const [previews, setPreviews] = useState16(/* @__PURE__ */ new Map());
3158
- useEffect13(() => {
3188
+ const [failedUploads, setFailedUploads] = useState15(/* @__PURE__ */ new Set());
3189
+ const [uploading, setUploading] = useState15(/* @__PURE__ */ new Set());
3190
+ const [previews, setPreviews] = useState15(/* @__PURE__ */ new Map());
3191
+ useEffect11(() => {
3159
3192
  const urls = new Map(stagedFiles.flatMap((file) => file instanceof File && file.type.startsWith("image/") ? [[file, URL.createObjectURL(file)]] : []));
3160
3193
  setPreviews(urls);
3161
3194
  return () => {
3162
3195
  for (const url of urls.values()) URL.revokeObjectURL(url);
3163
3196
  };
3164
3197
  }, [stagedFiles]);
3165
- const [sending, setSending] = useState16(false);
3166
- const [pickingFiles, setPickingFiles] = useState16(false);
3167
- const [composerError, setComposerError] = useState16(null);
3198
+ const [sending, setSending] = useState15(false);
3199
+ const [pickingFiles, setPickingFiles] = useState15(false);
3200
+ const [composerError, setComposerError] = useState15(null);
3168
3201
  const scrollRef = useRef9(null);
3169
3202
  const textareaRef = useRef9(null);
3170
3203
  const fileInputRef = useRef9(null);
3171
3204
  const isAtBottomRef = useRef9(true);
3172
3205
  const lastMarkedSequenceRef = useRef9(localReadThroughSequence);
3173
3206
  const restoreScrollRef = useRef9(null);
3174
- const grouped = useMemo8(() => groupChatMessages(messages), [messages]);
3207
+ const grouped = useMemo9(() => groupChatMessages(messages), [messages]);
3175
3208
  const latestSequence = messages.at(-1)?.sequence;
3176
3209
  useLayoutEffect(() => {
3177
3210
  const scroller = scrollRef.current;
@@ -3189,14 +3222,14 @@ var ChatPanelSurface = React10.memo(
3189
3222
  scroller.scrollTo({ top: scroller.scrollHeight, behavior: autoScrollBehavior ?? "auto" });
3190
3223
  if (latestSequence) markChatSequenceRead(latestSequence, lastMarkedSequenceRef, onMarkRead);
3191
3224
  }, [autoScrollBehavior, latestSequence, messages.length, onMarkRead, pendingMessages.length]);
3192
- useEffect13(() => {
3225
+ useEffect11(() => {
3193
3226
  if (!localReadThroughSequence) return;
3194
3227
  const previous = lastMarkedSequenceRef.current;
3195
3228
  if (!previous || compareChatSequence(localReadThroughSequence, previous) > 0) {
3196
3229
  lastMarkedSequenceRef.current = localReadThroughSequence;
3197
3230
  }
3198
3231
  }, [localReadThroughSequence]);
3199
- useEffect13(() => {
3232
+ useEffect11(() => {
3200
3233
  const textarea = textareaRef.current;
3201
3234
  if (!textarea) return;
3202
3235
  textarea.style.height = "auto";
@@ -3317,7 +3350,7 @@ var ChatPanelSurface = React10.memo(
3317
3350
  setComposerError(cause instanceof Error ? cause.message : "Earlier messages could not be loaded.");
3318
3351
  }
3319
3352
  };
3320
- const scrollWork = useMemo8(
3353
+ const scrollWork = useMemo9(
3321
3354
  () => createChatScrollWork({
3322
3355
  getScroller: () => scrollRef.current,
3323
3356
  getLatestSequence: () => messages.at(-1)?.sequence ?? null,
@@ -3329,7 +3362,7 @@ var ChatPanelSurface = React10.memo(
3329
3362
  }),
3330
3363
  [messages, onMarkRead]
3331
3364
  );
3332
- useEffect13(() => () => scrollWork.dispose(), [scrollWork]);
3365
+ useEffect11(() => () => scrollWork.dispose(), [scrollWork]);
3333
3366
  const handleScroll = scrollWork.onScroll;
3334
3367
  return /* @__PURE__ */ jsxs17("div", { className: cn("relative flex h-full min-h-0 w-full flex-col overflow-hidden bg-transparent text-[var(--chalk-app-text)]", className), role: "complementary", "aria-label": "Chat panel", children: [
3335
3368
  /* @__PURE__ */ jsx33(CallCardStyles, {}),
@@ -3448,7 +3481,7 @@ var ChatPanel = React10.memo((props) => {
3448
3481
  const participants = useParticipants();
3449
3482
  const self = useSelf();
3450
3483
  const localParticipantId = self.participantId ?? "local";
3451
- const participantNames = useMemo8(() => Object.fromEntries([...participants.roster.map((participant) => [participant.participantId, participant.displayName]), [localParticipantId, self.displayName ?? "You"]]), [localParticipantId, participants.roster, self.displayName]);
3484
+ const participantNames = useMemo9(() => Object.fromEntries([...participants.roster.map((participant) => [participant.participantId, participant.displayName]), [localParticipantId, self.displayName ?? "You"]]), [localParticipantId, participants.roster, self.displayName]);
3452
3485
  return /* @__PURE__ */ jsx33(
3453
3486
  ChatPanelSurface,
3454
3487
  {
@@ -3480,7 +3513,7 @@ var ChatPanel = React10.memo((props) => {
3480
3513
  ChatPanel.displayName = "ChatPanel";
3481
3514
 
3482
3515
  // src/components/composite/ReactionsOverlay.tsx
3483
- import { useEffect as useEffect14, useRef as useRef10, useState as useState17 } from "react";
3516
+ import { useEffect as useEffect12, useRef as useRef10, useState as useState16 } from "react";
3484
3517
  import { createPortal } from "react-dom";
3485
3518
 
3486
3519
  // src/components/composite/reaction-float.ts
@@ -3524,15 +3557,15 @@ function ReactionsOverlaySurface({ reactions, maxVisible = 6, className }) {
3524
3557
  return /* @__PURE__ */ jsx34("div", { ref: root, className: cn("pointer-events-none absolute inset-0 z-30", className), "aria-live": "polite", "aria-atomic": "false", children: reactions.slice(-maxVisible).map((reaction) => /* @__PURE__ */ jsx34(TileReaction, { reaction, root }, reaction.eventId)) });
3525
3558
  }
3526
3559
  function TileReaction({ reaction, root }) {
3527
- const [host, setHost] = useState17(null);
3560
+ const [host, setHost] = useState16(null);
3528
3561
  const emoji = useRef10(null);
3529
3562
  const reduced = usePrefersReducedMotion();
3530
- useEffect14(() => {
3563
+ useEffect12(() => {
3531
3564
  const frame = root.current?.closest("[data-part=call-frame]");
3532
3565
  const tile = Array.from(frame?.querySelectorAll("[data-stage-item]") ?? []).find((element) => element.dataset.stageItem === reaction.participantId && element.getAttribute("aria-hidden") !== "true");
3533
3566
  setHost(tile?.firstElementChild ?? root.current);
3534
3567
  }, [reaction.participantId, root]);
3535
- useEffect14(() => {
3568
+ useEffect12(() => {
3536
3569
  const element = emoji.current;
3537
3570
  if (!element || !host) return;
3538
3571
  const animation = element.animate(
@@ -3570,10 +3603,10 @@ function CommandErrorAlert({ message }) {
3570
3603
  }
3571
3604
 
3572
3605
  // src/components/control-bar/ControlBar.tsx
3573
- import React12, { useEffect as useEffect17, useRef as useRef12, useState as useState22 } from "react";
3606
+ import React12, { useEffect as useEffect15, useRef as useRef12, useState as useState21 } from "react";
3574
3607
 
3575
3608
  // src/components/device-popover/DevicePopover.tsx
3576
- import { useEffect as useEffect15, useRef as useRef11, useState as useState18 } from "react";
3609
+ import { useEffect as useEffect13, useRef as useRef11, useState as useState17 } from "react";
3577
3610
 
3578
3611
  // src/components/control-bar/ShellIcon.tsx
3579
3612
  import { Fragment as Fragment11, jsx as jsx36, jsxs as jsxs19 } from "react/jsx-runtime";
@@ -3717,8 +3750,8 @@ var CALL_SHELL_CSS = `.chalk-shell-dock {
3717
3750
  width: 16px;
3718
3751
  height: 16px;
3719
3752
  border-radius: 50%;
3720
- background: var(--chalk-warning, #dcb740);
3721
- color: #16140c;
3753
+ background: var(--chalk-warning);
3754
+ color: var(--chalk-accent-text);
3722
3755
  font-size: 11px;
3723
3756
  font-weight: 700;
3724
3757
  line-height: 16px;
@@ -3748,7 +3781,7 @@ var CALL_SHELL_CSS = `.chalk-shell-dock {
3748
3781
  width: 9px;
3749
3782
  height: 9px;
3750
3783
  border-radius: 50%;
3751
- background: var(--chalk-warning, #dcb740);
3784
+ background: var(--chalk-warning);
3752
3785
  box-shadow: 0 0 0 2px var(--chalk-raised);
3753
3786
  }
3754
3787
  .chalk-shell-corner {
@@ -3785,11 +3818,11 @@ var CALL_SHELL_CSS = `.chalk-shell-dock {
3785
3818
  height: 22px;
3786
3819
  padding: 0 8px;
3787
3820
  border-radius: 6px;
3788
- background: rgba(12,14,18,.75);
3821
+ background: var(--chalk-overlay);
3789
3822
  font-size: 12px;
3790
3823
  display: flex;
3791
3824
  align-items: center;
3792
- color: #fff;
3825
+ color: var(--chalk-on-overlay);
3793
3826
  }
3794
3827
  .chalk-shell-menu-separator {height:1px;background:var(--chalk-line);margin:6px 4px;}
3795
3828
  .chalk-shell-level {
@@ -3930,7 +3963,7 @@ var CALL_SHELL_CSS = `.chalk-shell-dock {
3930
3963
  background: var(--chalk-pressed);
3931
3964
  }
3932
3965
  .chalk-shell-quality i:first-child {
3933
- background: var(--chalk-warning, #dcb740);
3966
+ background: var(--chalk-warning);
3934
3967
  }
3935
3968
  .chalk-shell-modal-backdrop {
3936
3969
  position: absolute;
@@ -3950,13 +3983,13 @@ var CALL_SHELL_CSS = `.chalk-shell-dock {
3950
3983
  background: var(--chalk-surface);
3951
3984
  border: 1px solid var(--chalk-line-strong);
3952
3985
  border-radius: 16px;
3953
- box-shadow: 0 16px 40px rgba(0,0,0,.5);
3986
+ box-shadow: var(--chalk-shadow);
3954
3987
  transition:transform .2s cubic-bezier(.16,1,.3,1);
3955
3988
  }
3956
3989
  .chalk-shell-modal[data-starting-style],.chalk-shell-modal[data-ending-style] {transform:translateY(8px);}
3957
3990
  .chalk-shell-modal-backdrop {transition:opacity .18s ease-out;}
3958
3991
  .chalk-shell-modal-backdrop[data-starting-style],.chalk-shell-modal-backdrop[data-ending-style] {opacity:0;}
3959
- [data-chalk-theme="light"] .chalk-shell-modal {box-shadow:0 0 0 1px var(--chalk-line),0 12px 32px rgba(0,0,0,.12);}
3992
+ [data-chalk-theme="light"] .chalk-shell-modal {box-shadow:var(--chalk-shadow);}
3960
3993
  .chalk-shell-modal-heading {
3961
3994
  display: flex;
3962
3995
  justify-content: space-between;
@@ -3993,7 +4026,7 @@ var CALL_SHELL_CSS = `.chalk-shell-dock {
3993
4026
  border-radius: 6px;
3994
4027
  background: var(--chalk-hover);
3995
4028
  color: var(--chalk-text);
3996
- box-shadow: inset 0 -1px 0 rgba(0,0,0,.4);
4029
+ box-shadow: inset 0 -1px 0 var(--chalk-line-strong);
3997
4030
  }
3998
4031
  .chalk-shell-report {
3999
4032
  display: flex;
@@ -4032,7 +4065,7 @@ var CALL_SHELL_CSS = `.chalk-shell-dock {
4032
4065
  box-shadow: 0 0 0 1px var(--chalk-line);
4033
4066
  }
4034
4067
  [data-chalk-theme="light"] .chalk-shell-reactions {
4035
- box-shadow: 0 0 0 1px var(--chalk-line), 0 12px 32px rgba(0, 0, 0, 0.12);
4068
+ box-shadow: var(--chalk-shadow);
4036
4069
  }
4037
4070
  @media (max-width: 640px) {
4038
4071
  .chalk-shell-details-heading {display:none;}
@@ -4150,7 +4183,7 @@ var CALL_SHELL_CSS = `.chalk-shell-dock {
4150
4183
  border: 1px solid var(--chalk-line-strong);
4151
4184
  border-radius: 999px;
4152
4185
  background: var(--chalk-popover);
4153
- box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
4186
+ box-shadow: var(--chalk-shadow);
4154
4187
  }
4155
4188
  .chalk-shell-reactions-enter {animation:chalk-shell-reactions-in .18s cubic-bezier(.16,1,.3,1);}
4156
4189
  @keyframes chalk-shell-reactions-in {from{opacity:0;translate:0 4px;}}
@@ -4185,10 +4218,10 @@ var CALL_SHELL_CSS = `.chalk-shell-dock {
4185
4218
  .chalk-shell-raise svg {width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round;}
4186
4219
  .chalk-shell-raise svg {color:var(--chalk-muted-text);}
4187
4220
  .chalk-shell-raise:hover {background:var(--chalk-pressed);}
4188
- .chalk-shell-raise[aria-pressed="true"] svg {color:#16140c;}
4221
+ .chalk-shell-raise[aria-pressed="true"] svg {color:var(--chalk-accent-text);}
4189
4222
  .chalk-shell-raise[aria-pressed="true"] {
4190
- background: var(--chalk-warning, #dcb740);
4191
- color: #16140c;
4223
+ background: var(--chalk-warning);
4224
+ color: var(--chalk-accent-text);
4192
4225
  }
4193
4226
  .chalk-shell-reactions-expanded {
4194
4227
  display: grid;
@@ -4232,8 +4265,8 @@ var CALL_SHELL_CSS = `.chalk-shell-dock {
4232
4265
  // src/components/device-popover/DevicePopover.tsx
4233
4266
  import { Fragment as Fragment12, jsx as jsx38, jsxs as jsxs20 } from "react/jsx-runtime";
4234
4267
  function InputLevel({ track }) {
4235
- const [level, setLevel] = useState18(0);
4236
- useEffect15(() => {
4268
+ const [level, setLevel] = useState17(0);
4269
+ useEffect13(() => {
4237
4270
  if (!track || track.readyState !== "live") return;
4238
4271
  const context = new AudioContext();
4239
4272
  const source = context.createMediaStreamSource(new MediaStream([track]));
@@ -4256,9 +4289,9 @@ function InputLevel({ track }) {
4256
4289
  }
4257
4290
  function CameraPreview({ track, mirrored, open, selectedDeviceId, captureCameraPreview }) {
4258
4291
  const video = useRef11(null);
4259
- const [unavailable2, setUnavailable] = useState18(false);
4292
+ const [unavailable2, setUnavailable] = useState17(false);
4260
4293
  const trackEnabled = track?.enabled;
4261
- useEffect15(() => {
4294
+ useEffect13(() => {
4262
4295
  const element = video.current;
4263
4296
  if (!element || !open) return;
4264
4297
  let cancelled = false;
@@ -4326,7 +4359,7 @@ function DevicePopover({
4326
4359
  busy,
4327
4360
  onCancelPending
4328
4361
  }) {
4329
- const [open, setOpen] = useState18(false);
4362
+ const [open, setOpen] = useState17(false);
4330
4363
  const mic = type === "mic";
4331
4364
  const label = mic ? isActive ? "Mute microphone" : "Unmute microphone" : isActive ? "Turn off camera" : "Turn on camera";
4332
4365
  return /* @__PURE__ */ jsxs20("div", { "data-part": `${type}-split`, className: cn("chalk-shell-split", className), "data-off": !isActive, children: [
@@ -4416,10 +4449,10 @@ function LeaveMenu({ onLeave, onEndForEveryone, renderButton }) {
4416
4449
  }
4417
4450
 
4418
4451
  // src/components/control-bar/DockLayout.tsx
4419
- import { useState as useState19 } from "react";
4452
+ import { useState as useState18 } from "react";
4420
4453
  import { Fragment as Fragment13, jsx as jsx41, jsxs as jsxs23 } from "react/jsx-runtime";
4421
4454
  function DockLayout({ layout, onLayoutChange, children }) {
4422
- const [open, setOpen] = useState19(false);
4455
+ const [open, setOpen] = useState18(false);
4423
4456
  return /* @__PURE__ */ jsxs23(Fragment13, { children: [
4424
4457
  /* @__PURE__ */ jsx41(ChalkIconButton, { size: "lg", "aria-label": "More options", "aria-haspopup": "dialog", "aria-expanded": open, onClick: () => setOpen(true), children: /* @__PURE__ */ jsx41("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx41("path", { "data-part": "dock-more-glyph", d: "M5 12h.01M12 12h.01M19 12h.01", strokeWidth: "3" }) }) }),
4425
4458
  /* @__PURE__ */ jsx41(ChalkSheet, { title: "More options", open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs23(
@@ -4460,7 +4493,7 @@ function DockLayout({ layout, onLayoutChange, children }) {
4460
4493
  }
4461
4494
 
4462
4495
  // src/components/control-bar/ShareControl.tsx
4463
- import { useState as useState20 } from "react";
4496
+ import { useState as useState19 } from "react";
4464
4497
  import { Fragment as Fragment14, jsx as jsx42, jsxs as jsxs24 } from "react/jsx-runtime";
4465
4498
  function SourceIcon({ source }) {
4466
4499
  return /* @__PURE__ */ jsx42("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: source === "monitor" ? /* @__PURE__ */ jsxs24(Fragment14, { children: [
@@ -4475,9 +4508,9 @@ function SourceIcon({ source }) {
4475
4508
  ] }) });
4476
4509
  }
4477
4510
  function ShareControl({ sharing, onToggle, onStart, disabled = false, startDisabled = false }) {
4478
- const [surface, setSurface] = useState20("window");
4479
- const [audio, setAudio] = useState20(true);
4480
- const [replace, setReplace] = useState20(false);
4511
+ const [surface, setSurface] = useState19("window");
4512
+ const [audio, setAudio] = useState19(true);
4513
+ const [replace, setReplace] = useState19(false);
4481
4514
  const start2 = (next) => {
4482
4515
  if (disabled || startDisabled) return;
4483
4516
  setSurface(next);
@@ -4532,7 +4565,7 @@ function ShareControl({ sharing, onToggle, onStart, disabled = false, startDisab
4532
4565
  }
4533
4566
 
4534
4567
  // src/components/control-bar/control-bar-behavior.ts
4535
- import { useCallback as useCallback5, useEffect as useEffect16, useMemo as useMemo9, useState as useState21 } from "react";
4568
+ import { useCallback as useCallback6, useEffect as useEffect14, useMemo as useMemo10, useState as useState20 } from "react";
4536
4569
 
4537
4570
  // src/components/control-bar/media-toggle.ts
4538
4571
  function mediaToggleTarget(state, live) {
@@ -4576,10 +4609,10 @@ function useControlBarSurfaceBehavior({
4576
4609
  participantGradientPreference,
4577
4610
  detectDevices = true
4578
4611
  }) {
4579
- const themeVariables = useMemo9(() => getParticipantThemeVariables(participantColorSeed, participantGradientPreference), [participantColorSeed, participantGradientPreference]);
4580
- const [detectedDevices, setDetectedDevices] = useState21(EMPTY_DETECTED_DEVICES);
4612
+ const themeVariables = useMemo10(() => getParticipantThemeVariables(participantColorSeed, participantGradientPreference), [participantColorSeed, participantGradientPreference]);
4613
+ const [detectedDevices, setDetectedDevices] = useState20(EMPTY_DETECTED_DEVICES);
4581
4614
  const buttonsToRender = buttons ?? DEFAULT_CONTROL_BAR_BUTTONS;
4582
- useEffect16(() => {
4615
+ useEffect14(() => {
4583
4616
  if (!detectDevices || density !== "comfortable" || !navigator.mediaDevices?.enumerateDevices) return;
4584
4617
  let cancelled = false;
4585
4618
  const syncDevices = async () => {
@@ -4638,11 +4671,11 @@ function useConnectedControlBarBehavior(props) {
4638
4671
  const recordingStatus = recording.current?.status;
4639
4672
  const isRecording = recordingStatus === "recording" || recordingStatus === "stopping";
4640
4673
  const isRecordingPending = recordingStatus === "starting" || recordingStatus === "stopping";
4641
- const [noiseSuppression, setNoiseSuppression] = useState21(true);
4642
- const [commandError, setCommandError] = useState21(null);
4643
- const [commandSource, setCommandSource] = useState21();
4644
- const [commandAction, setCommandAction] = useState21();
4645
- const run = useCallback5(
4674
+ const [noiseSuppression, setNoiseSuppression] = useState20(true);
4675
+ const [commandError, setCommandError] = useState20(null);
4676
+ const [commandSource, setCommandSource] = useState20();
4677
+ const [commandAction, setCommandAction] = useState20();
4678
+ const run = useCallback6(
4646
4679
  async (command, source, action) => {
4647
4680
  setCommandError(null);
4648
4681
  setCommandSource(void 0);
@@ -4662,7 +4695,7 @@ function useConnectedControlBarBehavior(props) {
4662
4695
  },
4663
4696
  [props.onCommandError]
4664
4697
  );
4665
- const leave = useCallback5(() => {
4698
+ const leave = useCallback6(() => {
4666
4699
  if (props.onLeaveRequest) {
4667
4700
  props.onLeaveRequest();
4668
4701
  return;
@@ -4810,10 +4843,10 @@ function ControlBarPresentation(props) {
4810
4843
  var ControlBarSurface = React12.memo((props) => {
4811
4844
  const { buttonsToRender, effectiveAudioInputDevices, effectiveAudioOutputDevices, effectiveVideoInputDevices, showLeave } = useControlBarSurfaceBehavior({ ...props, density: props.density ?? "comfortable", detectDevices: props.detectDevices ?? true });
4812
4845
  const dock = useRef12(null);
4813
- const [fullscreen, setFullscreen] = useState22(false);
4814
- const [canCaptureDisplay, setCanCaptureDisplay] = useState22(false);
4815
- useEffect17(() => setCanCaptureDisplay(typeof navigator.mediaDevices?.getDisplayMedia === "function"), []);
4816
- useEffect17(() => {
4846
+ const [fullscreen, setFullscreen] = useState21(false);
4847
+ const [canCaptureDisplay, setCanCaptureDisplay] = useState21(false);
4848
+ useEffect15(() => setCanCaptureDisplay(typeof navigator.mediaDevices?.getDisplayMedia === "function"), []);
4849
+ useEffect15(() => {
4817
4850
  const changed = () => setFullscreen(Boolean(document.fullscreenElement));
4818
4851
  document.addEventListener("fullscreenchange", changed);
4819
4852
  return () => document.removeEventListener("fullscreenchange", changed);
@@ -4964,10 +4997,10 @@ function ControlBar(props) {
4964
4997
  }
4965
4998
 
4966
4999
  // src/components/participants-panel/ParticipantsPanel.tsx
4967
- import React13, { useMemo as useMemo10, useState as useState24 } from "react";
5000
+ import React13, { useMemo as useMemo11, useState as useState23 } from "react";
4968
5001
 
4969
5002
  // src/components/participants-panel/participant-row.tsx
4970
- import { useState as useState23, useRef as useRef13, useEffect as useEffect18 } from "react";
5003
+ import { useState as useState22, useRef as useRef13, useEffect as useEffect16 } from "react";
4971
5004
 
4972
5005
  // src/components/participants-panel/participant-options-menu-contract.ts
4973
5006
  function runParticipantAction(action, onClose, onCommandError) {
@@ -5142,13 +5175,13 @@ function ParticipantRow({
5142
5175
  onMenuToggle,
5143
5176
  onMenuClose
5144
5177
  }) {
5145
- const [isEditing, setIsEditing] = useState23(false);
5146
- const [editName, setEditName] = useState23(participant.displayName);
5178
+ const [isEditing, setIsEditing] = useState22(false);
5179
+ const [editName, setEditName] = useState22(participant.displayName);
5147
5180
  const inputRef = useRef13(null);
5148
5181
  const rootRef = useRef13(null);
5149
5182
  const hasVolumeControl = !!participantVolumes && !!onParticipantVolumeChange;
5150
5183
  const showMenuButton = canManageParticipants || hasVolumeControl || participant.isLocal && !!onUpdateDisplayName;
5151
- useEffect18(() => {
5184
+ useEffect16(() => {
5152
5185
  if (isEditing) {
5153
5186
  inputRef.current?.focus();
5154
5187
  inputRef.current?.select();
@@ -5212,7 +5245,7 @@ function ParticipantRow({
5212
5245
  onUpdateDisplayName && /* @__PURE__ */ jsx45("button", { type: "button", onClick: () => setIsEditing(true), "aria-label": "Edit your name", className: "call-edit-name", children: /* @__PURE__ */ jsx45(Edit02Icon, { className: "w-3 h-3" }) })
5213
5246
  ] })
5214
5247
  ] }),
5215
- /* @__PURE__ */ jsx45("div", { className: "flex items-center gap-1.5" })
5248
+ participant.deviceHint ? /* @__PURE__ */ jsx45("div", { className: "text-xs text-[var(--chalk-app-text-muted)]", children: participant.deviceHint }) : null
5216
5249
  ] })
5217
5250
  ] }),
5218
5251
  /* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-1 shrink-0", children: [
@@ -5292,10 +5325,10 @@ var ParticipantsPanelSurface = React13.memo(
5292
5325
  participantGradientPreference,
5293
5326
  generatedAvatars = true
5294
5327
  }) => {
5295
- const [query, setQuery] = useState24("");
5296
- const [activeMenuId, setActiveMenuId] = useState24(null);
5297
- const [muting, setMuting] = useState24(false);
5298
- const [error, setError] = useState24(null);
5328
+ const [query, setQuery] = useState23("");
5329
+ const [activeMenuId, setActiveMenuId] = useState23(null);
5330
+ const [muting, setMuting] = useState23(false);
5331
+ const [error, setError] = useState23(null);
5299
5332
  const filtered = participants.filter((person) => person.displayName.toLocaleLowerCase().includes(query.trim().toLocaleLowerCase()));
5300
5333
  const raised = participants.filter((person) => person.isHandRaised);
5301
5334
  const unmutedCount = participants.filter((person) => !person.isLocal && !person.isMuted).length;
@@ -5399,7 +5432,7 @@ var ParticipantsPanel = React13.memo((props) => {
5399
5432
  const canRemoveParticipants = useCan("removeParticipant");
5400
5433
  const canManageAdmission = useCan("manageAdmission");
5401
5434
  const contextVolumeState = useParticipantVolumeContext();
5402
- const [localVolumes, setLocalVolumes] = useState24(/* @__PURE__ */ new Map());
5435
+ const [localVolumes, setLocalVolumes] = useState23(/* @__PURE__ */ new Map());
5403
5436
  const isControlled = props.participantVolumes !== void 0 && props.onParticipantVolumeChange !== void 0;
5404
5437
  const participantVolumes = isControlled ? props.participantVolumes : contextVolumeState?.volumes ?? localVolumes;
5405
5438
  const onParticipantVolumeChange = isControlled ? props.onParticipantVolumeChange : contextVolumeState?.setVolume ?? ((participantId, volume) => setLocalVolumes((current) => {
@@ -5408,10 +5441,11 @@ var ParticipantsPanel = React13.memo((props) => {
5408
5441
  else next.set(participantId, volume);
5409
5442
  return next;
5410
5443
  }));
5411
- const participants = useMemo10(
5444
+ const participants = useMemo11(
5412
5445
  () => participantsSlice.roster.map((participant) => ({
5413
5446
  id: participant.participantId,
5414
5447
  displayName: participant.displayName,
5448
+ deviceHint: deviceHint(participant, participantsSlice.roster),
5415
5449
  role: participant.role,
5416
5450
  isHost: participant.capabilities.includes("endEpisode"),
5417
5451
  eligibleRoles: participant.eligibleRoles,
@@ -5518,7 +5552,7 @@ function StatusAction({ icon, label, onClick, disabled }) {
5518
5552
  }
5519
5553
 
5520
5554
  // src/components/call-limbo/CallReady.tsx
5521
- import { useEffect as useEffect19, useId, useRef as useRef14, useState as useState25 } from "react";
5555
+ import { useEffect as useEffect17, useId, useRef as useRef14, useState as useState24 } from "react";
5522
5556
 
5523
5557
  // src/components/call-limbo/qr-code.ts
5524
5558
  function inviteQR(text) {
@@ -5661,28 +5695,28 @@ function inviteQR(text) {
5661
5695
  // src/components/call-limbo/CallReady.tsx
5662
5696
  import { Fragment as Fragment19, jsx as jsx48, jsxs as jsxs30 } from "react/jsx-runtime";
5663
5697
  function CallReady({ open, onClose, link = typeof location === "undefined" ? "" : location.href }) {
5664
- const [showQR, setShowQR] = useState25(false);
5698
+ const [showQR, setShowQR] = useState24(false);
5665
5699
  const qrRef = useRef14(null);
5666
5700
  const cardRef = useRef14(null);
5667
5701
  const phone = useIsMobile();
5668
5702
  const reducedMotion = usePrefersReducedMotion();
5669
- const [entered, setEntered] = useState25(false);
5670
- const [present, setPresent] = useState25(open);
5703
+ const [entered, setEntered] = useState24(false);
5704
+ const [present, setPresent] = useState24(open);
5671
5705
  const id = useId();
5672
5706
  const qr = showQR ? inviteQR(link) : null;
5673
5707
  const close = () => {
5674
5708
  onClose();
5675
5709
  cardRef.current?.closest("[data-chalk]")?.querySelector("[data-call-link-trigger]")?.focus();
5676
5710
  };
5677
- useEffect19(() => {
5711
+ useEffect17(() => {
5678
5712
  if (!open && cardRef.current?.contains(document.activeElement)) cardRef.current.closest("[data-chalk]")?.querySelector("[data-call-link-trigger]")?.focus();
5679
5713
  }, [open]);
5680
- useEffect19(() => {
5714
+ useEffect17(() => {
5681
5715
  if (!showQR || reducedMotion) return;
5682
5716
  const animation = qrRef.current?.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 200, easing: "ease-out" });
5683
5717
  return () => animation?.cancel();
5684
5718
  }, [showQR, reducedMotion]);
5685
- useEffect19(() => {
5719
+ useEffect17(() => {
5686
5720
  if (open) setPresent(true);
5687
5721
  const frame = requestAnimationFrame(() => setEntered(open));
5688
5722
  const timer = setTimeout(
@@ -5748,11 +5782,11 @@ function CallReady({ open, onClose, link = typeof location === "undefined" ? ""
5748
5782
  }
5749
5783
 
5750
5784
  // src/components/toast-stack/ToastStack.tsx
5751
- import { memo, useLayoutEffect as useLayoutEffect3, useRef as useRef15, useState as useState27 } from "react";
5785
+ import { memo, useLayoutEffect as useLayoutEffect3, useRef as useRef15, useState as useState26 } from "react";
5752
5786
  import { flushSync as flushSync2 } from "react-dom";
5753
5787
 
5754
5788
  // src/components/toast-stack/useToastCapacity.ts
5755
- import { isValidElement as isValidElement2, useLayoutEffect as useLayoutEffect2, useState as useState26 } from "react";
5789
+ import { isValidElement as isValidElement2, useLayoutEffect as useLayoutEffect2, useState as useState25 } from "react";
5756
5790
  import { flushSync } from "react-dom";
5757
5791
 
5758
5792
  // src/components/toast-stack/toast-layout-snapshot.ts
@@ -5797,7 +5831,7 @@ function measureToastLayout(stack, snapshot) {
5797
5831
 
5798
5832
  // src/components/toast-stack/useToastCapacity.ts
5799
5833
  function useToastCapacity(stack, candidates, enabled, ownedIds) {
5800
- const [fit, setFit] = useState26(null);
5834
+ const [fit, setFit] = useState25(null);
5801
5835
  let count = candidates.length;
5802
5836
  if (enabled) {
5803
5837
  count = 0;
@@ -5891,7 +5925,7 @@ var ToastStack = memo(function ToastStack2({ toasts, onDismiss, maxVisible = 3,
5891
5925
  const stack = useRef15(null);
5892
5926
  const short = useShortCall(stack, onFold !== void 0);
5893
5927
  const candidates = maxVisible > 0 ? toasts.slice(-maxVisible) : [];
5894
- const [ownedIds, setOwnedIds] = useState27([]);
5928
+ const [ownedIds, setOwnedIds] = useState26([]);
5895
5929
  const fold = useRef15(onFold);
5896
5930
  const capacity = useToastCapacity(stack, candidates, onFold !== void 0 && short === false, ownedIds);
5897
5931
  const selected = onFold !== void 0 && short !== false ? [] : candidates.slice(candidates.length - capacity.count);
@@ -5900,7 +5934,7 @@ var ToastStack = memo(function ToastStack2({ toasts, onDismiss, maxVisible = 3,
5900
5934
  const foldedIds = folded.map((toast) => toast.id);
5901
5935
  const announced = useRef15(/* @__PURE__ */ new Map());
5902
5936
  const wasAnnounced = (toast) => announced.current.get(toast.id) === noticeIdentity(toast);
5903
- const [unheard, setUnheard] = useState27([]);
5937
+ const [unheard, setUnheard] = useState26([]);
5904
5938
  const reported = useRef15([]);
5905
5939
  const reporting = useRef15(false);
5906
5940
  useLayoutEffect3(() => {
@@ -5947,7 +5981,7 @@ var ToastStack = memo(function ToastStack2({ toasts, onDismiss, maxVisible = 3,
5947
5981
  ] });
5948
5982
  });
5949
5983
  function useShortCall(stack, enabled) {
5950
- const [short, setShort] = useState27(null);
5984
+ const [short, setShort] = useState26(null);
5951
5985
  useLayoutEffect3(() => {
5952
5986
  if (!enabled) {
5953
5987
  setShort(null);
@@ -5968,7 +6002,7 @@ function sameIds(a, b) {
5968
6002
  }
5969
6003
 
5970
6004
  // src/internal/call-motion.ts
5971
- import { useEffect as useEffect20, useState as useState28 } from "react";
6005
+ import { useEffect as useEffect18, useState as useState27 } from "react";
5972
6006
  var moves = /* @__PURE__ */ new WeakMap();
5973
6007
  function captureFlip(elements) {
5974
6008
  const previous = Array.from(elements, (element) => ({ element, box: element.getBoundingClientRect() }));
@@ -5996,9 +6030,9 @@ function playFlip(previous) {
5996
6030
  }
5997
6031
  var ACTIVE_LAYERS = '[role="menu"],[role="dialog"],[data-part="toast"],[data-part="notice-button"],[data-chalk-drawer]';
5998
6032
  function useIdleChrome(root, enabled) {
5999
- const [idle, setIdle] = useState28(false);
6033
+ const [idle, setIdle] = useState27(false);
6000
6034
  const fine = useMediaQuery("(pointer:fine) and (min-width:641px)");
6001
- useEffect20(() => {
6035
+ useEffect18(() => {
6002
6036
  const element = root.current;
6003
6037
  if (!element || !enabled || !fine) return;
6004
6038
  let timer;
@@ -6028,10 +6062,10 @@ function useIdleChrome(root, enabled) {
6028
6062
  }
6029
6063
 
6030
6064
  // src/components/space-header/SpaceHeader.tsx
6031
- import React14, { useCallback as useCallback6, useRef as useRef18, useState as useState30 } from "react";
6065
+ import React14, { useCallback as useCallback7, useRef as useRef18, useState as useState29 } from "react";
6032
6066
 
6033
6067
  // src/internal/useSoundsSetting.ts
6034
- import { useSyncExternalStore as useSyncExternalStore3 } from "react";
6068
+ import { useSyncExternalStore as useSyncExternalStore4 } from "react";
6035
6069
  var KEY2 = "chalk_sounds";
6036
6070
  var listeners2 = /* @__PURE__ */ new Set();
6037
6071
  var fallback2 = true;
@@ -6051,7 +6085,7 @@ function subscribe2(listener) {
6051
6085
  };
6052
6086
  }
6053
6087
  function useSoundsSetting() {
6054
- const enabled = useSyncExternalStore3(subscribe2, read2, () => true);
6088
+ const enabled = useSyncExternalStore4(subscribe2, read2, () => true);
6055
6089
  return [
6056
6090
  enabled,
6057
6091
  (next) => {
@@ -6080,7 +6114,7 @@ function LayoutMenu({ layout, onLayoutChange }) {
6080
6114
 
6081
6115
  // src/components/space-header/CallDetails.tsx
6082
6116
  import { Dialog as Dialog2 } from "@base-ui/react/dialog";
6083
- import { useEffect as useEffect21, useRef as useRef16, useState as useState29 } from "react";
6117
+ import { useRef as useRef16, useState as useState28 } from "react";
6084
6118
 
6085
6119
  // src/components/space-header/share-qr.ts
6086
6120
  function shareQr(text) {
@@ -6235,18 +6269,20 @@ function CallDialog({
6235
6269
  const container = useRef16(null);
6236
6270
  const reportInput = useRef16(null);
6237
6271
  const reportOpener = useRef16(null);
6238
- const [text, setText] = useState29("");
6239
- const [includeDiagnostics, setIncludeDiagnostics] = useState29(false);
6240
- const [status, setStatus] = useState29("idle");
6241
- const [error, setError] = useState29("");
6242
- useEffect21(() => {
6272
+ const [text, setText] = useState28("");
6273
+ const [includeDiagnostics, setIncludeDiagnostics] = useState28(false);
6274
+ const [status, setStatus] = useState28("idle");
6275
+ const [error, setError] = useState28("");
6276
+ const [session, setSession] = useState28({ kind, open });
6277
+ if (session.kind !== kind || session.open !== open) {
6278
+ setSession({ kind, open });
6243
6279
  if (open && kind === "report") {
6244
6280
  setText("");
6245
6281
  setIncludeDiagnostics(false);
6246
6282
  setError("");
6247
6283
  setStatus("idle");
6248
6284
  }
6249
- }, [kind, open]);
6285
+ }
6250
6286
  return /* @__PURE__ */ jsx51(
6251
6287
  "span",
6252
6288
  {
@@ -6373,7 +6409,7 @@ function CallDetails({
6373
6409
  }) {
6374
6410
  const link = shareUrl ?? (typeof location === "undefined" ? "" : location.href);
6375
6411
  const qr = shareQr(link);
6376
- const [details, setDetails] = useState29(false);
6412
+ const [details, setDetails] = useState28(false);
6377
6413
  return /* @__PURE__ */ jsxs32("div", { className: "chalk-details", children: [
6378
6414
  /* @__PURE__ */ jsxs32("div", { className: "chalk-shell-details-heading", children: [
6379
6415
  /* @__PURE__ */ jsx51("h2", { children: spaceName }),
@@ -6445,11 +6481,11 @@ function CallDetails({
6445
6481
  }
6446
6482
 
6447
6483
  // src/components/space-header/useCallShortcuts.ts
6448
- import { useEffect as useEffect22, useRef as useRef17 } from "react";
6484
+ import { useEffect as useEffect19, useRef as useRef17 } from "react";
6449
6485
  function useCallShortcuts(actions, show) {
6450
6486
  const latest = useRef17(actions);
6451
6487
  latest.current = actions;
6452
- useEffect22(() => {
6488
+ useEffect19(() => {
6453
6489
  let talking = false;
6454
6490
  const restore = () => {
6455
6491
  if (talking) {
@@ -6521,17 +6557,17 @@ var SpaceHeader = React14.memo((props) => {
6521
6557
  const { spaceName, duration = 0, isRecording = false, layout = "focus", onLayoutChange, className, weakConnection } = props;
6522
6558
  const remaining = props.timeLeft != null && props.timeLeft <= 600 ? props.timeLeft : null;
6523
6559
  const timer = remaining === null ? formatDuration(duration) : `${formatDuration(remaining)} left`;
6524
- const timerStyle = remaining === null ? void 0 : { color: remaining <= 60 ? "var(--chalk-danger-text)" : "var(--chalk-warning, #dcb740)" };
6560
+ const timerStyle = remaining === null ? void 0 : { color: remaining <= 60 ? "var(--chalk-danger-text)" : "var(--chalk-warning)" };
6525
6561
  const [sounds, setSounds] = useSoundsSetting();
6526
6562
  const triggerRef = useRef18(null);
6527
6563
  const focusScope = useRef18(null);
6528
- const [open, setOpen] = useState30(false);
6529
- const [dialog, setDialog] = useState30({ kind: "shortcuts", open: false });
6530
- const showShortcuts = useCallback6(() => setDialog({ kind: "shortcuts", open: true }), []);
6564
+ const [open, setOpen] = useState29(false);
6565
+ const [dialog, setDialog] = useState29({ kind: "shortcuts", open: false });
6566
+ const showShortcuts = useCallback7(() => setDialog({ kind: "shortcuts", open: true }), []);
6531
6567
  useCallShortcuts(props.shortcuts, showShortcuts);
6532
6568
  const phone = useMediaQuery("(max-width: 640px)");
6533
6569
  const chevron = /* @__PURE__ */ jsx52("svg", { width: phone ? "16" : "14", height: phone ? "16" : "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.75", "aria-hidden": "true", children: /* @__PURE__ */ jsx52("path", { d: "m6 9 6 6 6-6" }) });
6534
- const trigger = /* @__PURE__ */ jsxs33("button", { ref: triggerRef, type: "button", "data-part": "call-name", "aria-label": "Call details", className: "chalk-call-name", children: [
6570
+ const trigger = /* @__PURE__ */ jsxs33("button", { ref: triggerRef, type: "button", "data-part": "call-name", title: spaceName, "aria-label": "Call details", className: "chalk-call-name", children: [
6535
6571
  /* @__PURE__ */ jsx52("span", { dir: "auto", children: spaceName }),
6536
6572
  /* @__PURE__ */ jsx52("span", { "data-part": "call-timer", className: "chalk-call-timer", style: timerStyle, children: timer }),
6537
6573
  chevron
@@ -6555,7 +6591,7 @@ var SpaceHeader = React14.memo((props) => {
6555
6591
  /* @__PURE__ */ jsx52(ShellStyles, {}),
6556
6592
  /* @__PURE__ */ jsxs33("div", { className: "chalk-header-title flex min-w-0 items-center gap-3", children: [
6557
6593
  phone ? /* @__PURE__ */ jsxs33(Fragment22, { children: [
6558
- /* @__PURE__ */ jsxs33("button", { ref: triggerRef, type: "button", "data-call-link-trigger": true, "data-part": "call-name", className: "chalk-call-name chalk-call-name-phone", "aria-label": "Call details", "aria-haspopup": "dialog", "aria-expanded": open, onClick: () => setOpen(true), children: [
6594
+ /* @__PURE__ */ jsxs33("button", { ref: triggerRef, type: "button", "data-call-link-trigger": true, "data-part": "call-name", title: spaceName, className: "chalk-call-name chalk-call-name-phone", "aria-label": "Call details", "aria-haspopup": "dialog", "aria-expanded": open, onClick: () => setOpen(true), children: [
6559
6595
  /* @__PURE__ */ jsx52("span", { dir: "auto", children: spaceName }),
6560
6596
  chevron
6561
6597
  ] }),
@@ -6613,16 +6649,16 @@ var SpaceHeader = React14.memo((props) => {
6613
6649
  SpaceHeader.displayName = "SpaceHeader";
6614
6650
 
6615
6651
  // src/components/composite/ScreenShareView.tsx
6616
- import { useEffect as useEffect23, useMemo as useMemo11, useRef as useRef19, useState as useState31 } from "react";
6652
+ import { useEffect as useEffect20, useMemo as useMemo12, useRef as useRef19, useState as useState30 } from "react";
6617
6653
  import { Fragment as Fragment23, jsx as jsx53, jsxs as jsxs34 } from "react/jsx-runtime";
6618
6654
  function ScreenSharePresentation({ sharedByName, media, mediaVisible, state, isLocal = false, hasAudio = false, capture: capture2, primary = true, pinned, hidden, style, onClick, onDoubleClick, onStopSharing, onChangeShare, switcher, className }) {
6619
6655
  const root = useRef19(null);
6620
- const [fill, setFill] = useState31(false);
6621
- const [controlsOpen, setControlsOpen] = useState31(false);
6622
- const [poppedOut, setPoppedOut] = useState31(false);
6623
- const [zoom, setZoom] = useState31(false);
6624
- const [pending, setPending] = useState31(false);
6625
- const [error, setError] = useState31(null);
6656
+ const [fill, setFill] = useState30(false);
6657
+ const [controlsOpen, setControlsOpen] = useState30(false);
6658
+ const [poppedOut, setPoppedOut] = useState30(false);
6659
+ const [zoom, setZoom] = useState30(false);
6660
+ const [pending, setPending] = useState30(false);
6661
+ const [error, setError] = useState30(null);
6626
6662
  const status = state ?? (mediaVisible ? "live" : "connecting");
6627
6663
  const name = isLocal ? "Your screen" : `${sharedByName}'s screen`;
6628
6664
  const source = capture2?.surface === "window" ? "a window" : capture2?.surface === "browser" ? "a tab" : capture2?.surface === "monitor" ? "your screen" : null;
@@ -6638,7 +6674,7 @@ function ScreenSharePresentation({ sharedByName, media, mediaVisible, state, isL
6638
6674
  setPending(false);
6639
6675
  }
6640
6676
  };
6641
- useEffect23(() => {
6677
+ useEffect20(() => {
6642
6678
  const video = root.current?.querySelector("video");
6643
6679
  if (!video) return;
6644
6680
  const entered = () => setPoppedOut(true);
@@ -6709,14 +6745,14 @@ function ScreenSharePresentation({ sharedByName, media, mediaVisible, state, isL
6709
6745
  "\u2019s screen\u2026"
6710
6746
  ] })
6711
6747
  ] }) : null,
6712
- status === "paused" ? /* @__PURE__ */ jsxs34("div", { role: "status", className: "pointer-events-none absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 text-white", children: [
6713
- /* @__PURE__ */ jsx53("span", { className: "grid h-12 w-12 place-items-center rounded-[50%] bg-[rgba(12,14,18,.82)]", children: /* @__PURE__ */ jsx53(StageIcon, { name: "pause", size: 24 }) }),
6714
- /* @__PURE__ */ jsxs34("p", { className: "rounded-[8px] bg-[rgba(12,14,18,.82)] px-3 py-1.5 font-semibold", children: [
6748
+ status === "paused" ? /* @__PURE__ */ jsxs34("div", { role: "status", className: "pointer-events-none absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 text-[var(--chalk-on-overlay)]", children: [
6749
+ /* @__PURE__ */ jsx53("span", { className: "grid h-12 w-12 place-items-center rounded-[50%] bg-[var(--chalk-overlay-strong)]", children: /* @__PURE__ */ jsx53(StageIcon, { name: "pause", size: 24 }) }),
6750
+ /* @__PURE__ */ jsxs34("p", { className: "rounded-[8px] bg-[var(--chalk-overlay-strong)] px-3 py-1.5 font-semibold", children: [
6715
6751
  sharedByName,
6716
6752
  " paused sharing"
6717
6753
  ] })
6718
6754
  ] }) : null,
6719
- status === "low-quality" ? /* @__PURE__ */ jsxs34("div", { role: "status", "data-part": "share-low-quality", className: "absolute top-2 left-2 z-30 flex h-7 items-center gap-2 rounded-[6px] bg-[rgba(12,14,18,.82)] px-2.5 text-[12px] font-medium text-white", children: [
6755
+ status === "low-quality" ? /* @__PURE__ */ jsxs34("div", { role: "status", "data-part": "share-low-quality", className: "absolute top-2 left-2 z-30 flex h-7 items-center gap-2 rounded-[6px] bg-[var(--chalk-overlay-strong)] px-2.5 text-[12px] font-medium text-[var(--chalk-on-overlay)]", children: [
6720
6756
  /* @__PURE__ */ jsx53(SignalBars, {}),
6721
6757
  /* @__PURE__ */ jsxs34("span", { children: [
6722
6758
  sharedByName,
@@ -6724,10 +6760,10 @@ function ScreenSharePresentation({ sharedByName, media, mediaVisible, state, isL
6724
6760
  ] })
6725
6761
  ] }) : null,
6726
6762
  primary ? switcher : null,
6727
- isLocal && primary ? /* @__PURE__ */ jsxs34("div", { "data-part": "share-local-overlay", role: "group", "aria-label": "Your share", className: "absolute top-2.5 right-2.5 left-2.5 z-30 flex items-center gap-2 rounded-[12px] bg-[rgba(12,14,18,.86)] p-2 pl-3.5 text-white max-[640px]:flex-wrap", children: [
6763
+ isLocal && primary ? /* @__PURE__ */ jsxs34("div", { "data-part": "share-local-overlay", role: "group", "aria-label": "Your share", className: "absolute top-2.5 right-2.5 left-2.5 z-30 flex items-center gap-2 rounded-[12px] bg-[var(--chalk-overlay-strong)] p-2 pl-3.5 text-[var(--chalk-on-overlay)] max-[640px]:flex-wrap", children: [
6728
6764
  /* @__PURE__ */ jsxs34("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
6729
6765
  /* @__PURE__ */ jsx53("b", { className: "truncate font-semibold", children: source ? `You\u2019re sharing ${source}` : "You\u2019re screen sharing" }),
6730
- capture2?.surface === "monitor" || capture2?.surface === "browser" ? /* @__PURE__ */ jsxs34("span", { className: "text-[12px] text-[#c9cbd1]", children: [
6766
+ capture2?.surface === "monitor" || capture2?.surface === "browser" ? /* @__PURE__ */ jsxs34("span", { className: "text-[12px] text-[var(--chalk-on-overlay)]", children: [
6731
6767
  "Seeing a mirror effect? That\u2019s normal when you share ",
6732
6768
  capture2.surface === "browser" ? "this tab" : "your whole screen",
6733
6769
  "."
@@ -6736,7 +6772,7 @@ function ScreenSharePresentation({ sharedByName, media, mediaVisible, state, isL
6736
6772
  onChangeShare ? /* @__PURE__ */ jsx53(
6737
6773
  ChalkMenu,
6738
6774
  {
6739
- trigger: /* @__PURE__ */ jsx53(ChalkButton, { disabled: pending, className: "!h-8 !bg-white/[.14] !px-3 !text-white hover:!bg-white/[.22]", children: "Change" }),
6775
+ trigger: /* @__PURE__ */ jsx53(ChalkButton, { disabled: pending, className: "!h-8 !bg-[var(--chalk-on-overlay)]/[.14] !px-3 !text-[var(--chalk-on-overlay)] hover:!bg-[var(--chalk-on-overlay)]/[.22]", children: "Change" }),
6740
6776
  children: [
6741
6777
  { surface: "monitor", label: "Entire screen" },
6742
6778
  { surface: "window", label: "Window" },
@@ -6744,7 +6780,7 @@ function ScreenSharePresentation({ sharedByName, media, mediaVisible, state, isL
6744
6780
  ].map((option) => /* @__PURE__ */ jsx53(ChalkMenuItem, { onClick: () => void run(() => onChangeShare({ surface: option.surface, audio: option.surface === "browser" }), "screen", "start"), children: option.label }, option.surface))
6745
6781
  }
6746
6782
  ) : null,
6747
- onStopSharing ? /* @__PURE__ */ jsx53(ChalkButton, { disabled: pending, tone: "danger", className: "!h-8 !bg-[var(--chalk-danger)] !px-3 !text-white hover:!bg-[var(--chalk-danger-hover)]", onClick: () => void run(onStopSharing, "screen", "stop"), children: "Stop sharing" }) : null
6783
+ onStopSharing ? /* @__PURE__ */ jsx53(ChalkButton, { disabled: pending, tone: "danger", className: "!h-8 !bg-[var(--chalk-danger)] !px-3 !text-[var(--chalk-on-overlay)] hover:!bg-[var(--chalk-danger-hover)]", onClick: () => void run(onStopSharing, "screen", "stop"), children: "Stop sharing" }) : null
6748
6784
  ] }) : null,
6749
6785
  primary && !isLocal && status !== "connecting" ? /* @__PURE__ */ jsxs34("div", { role: "toolbar", "aria-label": "Share controls", className: cn("absolute right-2 bottom-2 z-30 flex gap-1.5 opacity-0 transition-opacity duration-150 group-hover/tile:opacity-100 focus-within:opacity-100", controlsOpen && "opacity-100"), children: [
6750
6786
  /* @__PURE__ */ jsx53(ShareControl2, { label: fill ? "Fit the whole screen" : "Fill the tile", pressed: fill, onClick: () => setFill(!fill), children: /* @__PURE__ */ jsx53(StageIcon, { name: fill ? "fit" : "fill", size: 16 }) }),
@@ -6752,7 +6788,7 @@ function ScreenSharePresentation({ sharedByName, media, mediaVisible, state, isL
6752
6788
  /* @__PURE__ */ jsx53(ShareControl2, { label: "Pop out", onClick: () => void popout(), children: /* @__PURE__ */ jsx53(StageIcon, { name: "pip", size: 16 }) }),
6753
6789
  /* @__PURE__ */ jsx53(ShareControl2, { label: "Full screen", onClick: () => void fullscreen(), children: /* @__PURE__ */ jsx53(StageIcon, { name: "maximize", size: 16 }) })
6754
6790
  ] }) : null,
6755
- error ? /* @__PURE__ */ jsx53("p", { role: "alert", className: "absolute right-2 bottom-12 left-2 z-40 rounded-md bg-[rgba(12,14,18,.86)] p-2 text-sm text-white", children: error }) : null
6791
+ error ? /* @__PURE__ */ jsx53("p", { role: "alert", className: "absolute right-2 bottom-12 left-2 z-40 rounded-md bg-[var(--chalk-overlay-strong)] p-2 text-sm text-[var(--chalk-on-overlay)]", children: error }) : null
6756
6792
  ]
6757
6793
  }
6758
6794
  )
@@ -6767,7 +6803,7 @@ function ShareControl2({ label, pressed, onClick, children }) {
6767
6803
  "aria-label": label,
6768
6804
  "aria-pressed": pressed,
6769
6805
  onClick,
6770
- className: "relative grid h-8 w-8 place-items-center rounded-[50%] bg-[rgba(12,14,18,.75)] text-white outline-none hover:bg-[rgba(40,42,48,.95)] aria-pressed:bg-white aria-pressed:text-[#0b0c0e] motion-safe:transition-transform motion-safe:duration-150 motion-safe:ease-[ease-out] active:scale-[.92] focus-visible:ring-2 focus-visible:ring-[var(--chalk-focus)] [@media(pointer:coarse)]:before:absolute [@media(pointer:coarse)]:before:-inset-1.5",
6806
+ className: "relative grid h-8 w-8 place-items-center rounded-[50%] bg-[var(--chalk-overlay)] text-[var(--chalk-on-overlay)] outline-none hover:bg-[var(--chalk-overlay-hover)] aria-pressed:bg-[var(--chalk-on-overlay)] aria-pressed:text-[var(--chalk-overlay)] motion-safe:transition-transform motion-safe:duration-150 motion-safe:ease-[ease-out] active:scale-[.92] focus-visible:ring-2 focus-visible:ring-[var(--chalk-focus)] [@media(pointer:coarse)]:before:absolute [@media(pointer:coarse)]:before:-inset-1.5",
6771
6807
  children
6772
6808
  }
6773
6809
  );
@@ -6784,7 +6820,7 @@ function ScreenShareView(props) {
6784
6820
  const participantsSlice = useParticipants();
6785
6821
  const media = useMedia();
6786
6822
  const localId = self.participantId ?? "local";
6787
- const participants = useMemo11(() => toVideoParticipants(participantsSlice.roster, media.remote, localId, self.displayName ?? "You", media.local), [localId, media.local, media.remote, participantsSlice.roster, self.displayName]);
6823
+ const participants = useMemo12(() => toVideoParticipants(participantsSlice.roster, media.remote, localId, self.displayName ?? "You", media.local), [localId, media.local, media.remote, participantsSlice.roster, self.displayName]);
6788
6824
  const active = participants.find((participant) => participant.isScreenSharing && participant.screenShareTrack);
6789
6825
  if (!active?.screenShareTrack)
6790
6826
  return /* @__PURE__ */ jsx53("div", { className: "grid h-full place-items-center text-sm text-[var(--chalk-muted-text)]", role: "status", children: "No active screen share" });
@@ -6808,16 +6844,16 @@ function ScreenShareView(props) {
6808
6844
  }
6809
6845
 
6810
6846
  // src/components/stage/Stage.tsx
6811
- import { useCallback as useCallback7, useEffect as useEffect24, useLayoutEffect as useLayoutEffect5, useMemo as useMemo12, useRef as useRef22, useState as useState33 } from "react";
6847
+ import { useCallback as useCallback8, useEffect as useEffect21, useLayoutEffect as useLayoutEffect5, useMemo as useMemo13, useRef as useRef22, useState as useState32 } from "react";
6812
6848
  import { createPortal as createPortal2 } from "react-dom";
6813
6849
 
6814
6850
  // src/components/stage/useStageDimensions.ts
6815
- import { useLayoutEffect as useLayoutEffect4, useRef as useRef20, useState as useState32 } from "react";
6851
+ import { useLayoutEffect as useLayoutEffect4, useRef as useRef20, useState as useState31 } from "react";
6816
6852
  import { flushSync as flushSync3 } from "react-dom";
6817
6853
  function useStageDimensions(fallback3) {
6818
6854
  const ref = useRef20(null);
6819
6855
  const current = useRef20(fallback3);
6820
- const [dimensions, setDimensions] = useState32(fallback3);
6856
+ const [dimensions, setDimensions] = useState31(fallback3);
6821
6857
  useLayoutEffect4(() => {
6822
6858
  const element = ref.current;
6823
6859
  if (!element || typeof ResizeObserver === "undefined") return;
@@ -7013,7 +7049,7 @@ function createContentPlacement() {
7013
7049
  };
7014
7050
  }
7015
7051
  function PersistentStageContent({ placement, children }) {
7016
- const [host, setHost] = useState33(null);
7052
+ const [host, setHost] = useState32(null);
7017
7053
  useLayoutEffect5(() => {
7018
7054
  const element = document.createElement("div");
7019
7055
  Object.assign(element.style, TILE_FILL);
@@ -7056,20 +7092,20 @@ function Stage({
7056
7092
  }) {
7057
7093
  const prefersReducedMotion = usePrefersReducedMotion();
7058
7094
  const { ref: boxRef, dimensions: box } = useStageDimensions(FALLBACK_BOX);
7059
- const [overflowOpen, setOverflowOpen] = useState33(false);
7060
- const [shareAspects, setShareAspects] = useState33(/* @__PURE__ */ new Map());
7061
- const [uncontrolledPinnedId, setUncontrolledPinnedId] = useState33(null);
7095
+ const [overflowOpen, setOverflowOpen] = useState32(false);
7096
+ const [shareAspects, setShareAspects] = useState32(/* @__PURE__ */ new Map());
7097
+ const [uncontrolledPinnedId, setUncontrolledPinnedId] = useState32(null);
7062
7098
  const activePinnedId = pinnedId === void 0 ? uncontrolledPinnedId : pinnedId;
7063
7099
  const orderRef = useRef22([]);
7064
7100
  const seenAtRef = useRef22(/* @__PURE__ */ new Map());
7065
7101
  const nextSeenRef = useRef22(0);
7066
7102
  const lastSpeakerRef = useRef22(null);
7067
7103
  const lastRemoteSpeakerRef = useRef22(null);
7068
- const ordered = useMemo12(() => {
7104
+ const ordered = useMemo13(() => {
7069
7105
  if (!interactive) {
7070
7106
  seenAtRef.current = new Map(items.map((item, index) => [item.id, index]));
7071
7107
  nextSeenRef.current = items.length;
7072
- return [...items];
7108
+ return stabilizeOrder([], items);
7073
7109
  }
7074
7110
  const seenAt = seenAtRef.current;
7075
7111
  const present = new Set(items.map((item) => item.id));
@@ -7078,21 +7114,21 @@ function Stage({
7078
7114
  return stabilizeOrder(orderRef.current, items);
7079
7115
  }, [interactive, items]);
7080
7116
  const handOrderRef = useRef22([]);
7081
- const handOrders = useMemo12(() => {
7117
+ const handOrders = useMemo13(() => {
7082
7118
  const raised = ordered.filter((item) => item.kind === "participant" && item.participant.isHandRaised).map((item) => item.id);
7083
7119
  const survivors = handOrderRef.current.filter((id) => raised.includes(id));
7084
7120
  const next = [...survivors, ...raised.filter((id) => !survivors.includes(id))];
7085
7121
  handOrderRef.current = next;
7086
7122
  return new Map(next.map((id, index) => [id, index + 1]));
7087
7123
  }, [ordered]);
7088
- useEffect24(() => {
7124
+ useEffect21(() => {
7089
7125
  orderRef.current = ordered.map((item) => item.id);
7090
7126
  const speaking = speakingParticipantId(ordered);
7091
7127
  if (speaking) lastSpeakerRef.current = speaking;
7092
7128
  lastRemoteSpeakerRef.current = floatingSpeakerId(ordered, lastRemoteSpeakerRef.current);
7093
7129
  }, [ordered]);
7094
- const primary = useMemo12(() => layout === "grid" ? null : choosePrimary(ordered, { layout, pinnedId: activePinnedId, lastSpeakerId: interactive ? lastSpeakerRef.current : null, seenAt: seenAtRef.current }), [activePinnedId, interactive, layout, ordered]);
7095
- const geometry = useMemo12(() => {
7130
+ const primary = useMemo13(() => layout === "grid" ? null : choosePrimary(ordered, { layout, pinnedId: activePinnedId, lastSpeakerId: interactive ? lastSpeakerRef.current : null, seenAt: seenAtRef.current }), [activePinnedId, interactive, layout, ordered]);
7131
+ const geometry = useMemo13(() => {
7096
7132
  if (!ordered.length) return EMPTY_GEOMETRY;
7097
7133
  const wideIds = ordered.filter(isContentItem).map((item) => item.id);
7098
7134
  if (layout === "grid" || !primary) {
@@ -7125,12 +7161,13 @@ function Stage({
7125
7161
  floatingPhonePeople: primary.kind === "whiteboard",
7126
7162
  speakerId,
7127
7163
  localId,
7164
+ ownDeviceIds: remaining.filter((item) => item.kind === "participant" && item.participant.isOwnDevice).map((item) => item.id),
7128
7165
  wideIds: primary.kind === "screen-share" ? ordered.filter((item) => item.kind === "whiteboard").map((item) => item.id) : wideIds,
7129
7166
  maxPerPage
7130
7167
  }
7131
7168
  );
7132
7169
  }, [activePinnedId, box, interactive, layout, maxPerPage, minTileWidth, ordered, primary, shareAspects]);
7133
- const framesById = useMemo12(() => new Map(geometry.frames.map((frame) => [frame.id, frame])), [geometry.frames]);
7170
+ const framesById = useMemo13(() => new Map(geometry.frames.map((frame) => [frame.id, frame])), [geometry.frames]);
7134
7171
  const foldedContent = ordered.filter((item) => item.kind !== "participant" && !framesById.has(item.id));
7135
7172
  const renderContent = (item, context, primaryRenderer) => {
7136
7173
  if (primaryRenderer && renderPrimaryContent) return /* @__PURE__ */ jsx56(StageContentTileSurface, { item, ...context, mediaVisible: true, media: renderPrimaryContent(item) });
@@ -7139,7 +7176,7 @@ function Stage({
7139
7176
  return /* @__PURE__ */ jsx56(StageContentTile, { item, ...context });
7140
7177
  };
7141
7178
  const animate = animateOverride ?? !prefersReducedMotion;
7142
- const [displayed, setDisplayed] = useState33({
7179
+ const [displayed, setDisplayed] = useState32({
7143
7180
  source: ordered,
7144
7181
  geometry,
7145
7182
  tiles: ordered.map((item) => ({ item, frame: framesById.get(item.id), leaving: false }))
@@ -7158,11 +7195,11 @@ function Stage({
7158
7195
  }
7159
7196
  return placement;
7160
7197
  };
7161
- useEffect24(() => {
7198
+ useEffect21(() => {
7162
7199
  const present = new Set(displayed.tiles.map(({ item }) => item.id));
7163
7200
  for (const id of contentPlacements.current.keys()) if (!present.has(id)) contentPlacements.current.delete(id);
7164
7201
  }, [displayed.tiles]);
7165
- useEffect24(() => {
7202
+ useEffect21(() => {
7166
7203
  const departing = displayed.tiles.filter((tile) => tile.leaving);
7167
7204
  if (!departing.length) return;
7168
7205
  const nextExpiry = Math.min(...departing.map((tile) => (tile.departedAt ?? 0) + 160));
@@ -7170,7 +7207,7 @@ function Stage({
7170
7207
  return () => clearTimeout(timer);
7171
7208
  }, [displayed]);
7172
7209
  const tilesRef = useRef22(null);
7173
- useEffect24(() => {
7210
+ useEffect21(() => {
7174
7211
  const root = tilesRef.current;
7175
7212
  if (!root) return;
7176
7213
  const updateAspect = (event) => {
@@ -7191,7 +7228,7 @@ function Stage({
7191
7228
  };
7192
7229
  }, [ordered]);
7193
7230
  const motionKey = displayed.tiles.map(({ item, frame, leaving }) => `${item.id}:${frame?.x},${frame?.y},${frame?.width},${frame?.height}:${leaving}`).join(";") + geometry.frames.filter((frame) => frame.id === MORE_TILE_ID).map((frame) => `${frame.x},${frame.y},${frame.width},${frame.height}`).join(";");
7194
- const togglePin = useCallback7(
7231
+ const togglePin = useCallback8(
7195
7232
  (item) => {
7196
7233
  const next = activePinnedId === item.id && !(layout === "grid" && isContentItem(item)) ? null : item.id;
7197
7234
  if (pinnedId === void 0) setUncontrolledPinnedId(next);
@@ -7199,7 +7236,7 @@ function Stage({
7199
7236
  },
7200
7237
  [activePinnedId, layout, onPinnedChange, pinnedId]
7201
7238
  );
7202
- const handlersById = useMemo12(() => {
7239
+ const handlersById = useMemo13(() => {
7203
7240
  const map = /* @__PURE__ */ new Map();
7204
7241
  if (!interactive) return map;
7205
7242
  for (const item of ordered) {
@@ -7310,7 +7347,7 @@ function Stage({
7310
7347
  Stage.displayName = "Stage";
7311
7348
 
7312
7349
  // src/components/participant-grid/ParticipantGrid.tsx
7313
- import React19, { useMemo as useMemo13 } from "react";
7350
+ import React19, { useMemo as useMemo14 } from "react";
7314
7351
  import { jsx as jsx57 } from "react/jsx-runtime";
7315
7352
  var MIN_TILE_WIDTH = { desktop: 150, mobile: 88 };
7316
7353
  function ParticipantGrid(props) {
@@ -7318,7 +7355,7 @@ function ParticipantGrid(props) {
7318
7355
  const participantsSlice = useParticipants();
7319
7356
  const media = useMedia();
7320
7357
  const localId = self.participantId ?? "local";
7321
- const participants = useMemo13(() => {
7358
+ const participants = useMemo14(() => {
7322
7359
  const hasLocalPresence = Boolean(self.participantId || self.displayName || Object.values(media.local).some((track) => track.state !== "disabled"));
7323
7360
  return hasLocalPresence ? toVideoParticipants(participantsSlice.roster, media.remote, localId, self.displayName ?? "You", media.local) : [];
7324
7361
  }, [localId, media.local, media.remote, participantsSlice.roster, self.displayName, self.participantId]);
@@ -7327,7 +7364,7 @@ function ParticipantGrid(props) {
7327
7364
  var ParticipantGridSurface = React19.memo(function ParticipantGridSurface2({ participants, layout = "grid", variant, pinnedParticipantId, onOverflowClick, onParticipantClick, onParticipantDoubleClick, maxVisibleParticipants, className, screenShareContent }) {
7328
7365
  const isMobile = useIsMobile();
7329
7366
  const effectiveVariant = variant ?? (isMobile ? "mobile" : "desktop");
7330
- const items = useMemo13(() => buildStageItems(participants, false), [participants]);
7367
+ const items = useMemo14(() => buildStageItems(participants, false), [participants]);
7331
7368
  return /* @__PURE__ */ jsx57(
7332
7369
  Stage,
7333
7370
  {
@@ -7390,7 +7427,7 @@ var WhiteboardView = memo2(WhiteboardViewBase);
7390
7427
  WhiteboardView.displayName = "WhiteboardView";
7391
7428
 
7392
7429
  // src/components/call-card/CallCard.tsx
7393
- import { useEffect as useEffect25, useId as useId2, useRef as useRef23 } from "react";
7430
+ import { useEffect as useEffect22, useId as useId2, useRef as useRef23 } from "react";
7394
7431
  import { Fragment as Fragment26, jsx as jsx59, jsxs as jsxs37 } from "react/jsx-runtime";
7395
7432
  function CallCard({ state, onClose, interactive = true, children, panel, onPanelChange, peopleCount, chatEnabled = true, participantsEnabled = true }) {
7396
7433
  const phone = useIsMobile();
@@ -7401,14 +7438,14 @@ function CallCard({ state, onClose, interactive = true, children, panel, onPanel
7401
7438
  const selected = panel === "chat" ? "chat" : "participants";
7402
7439
  const drawerRef = useRef23(null);
7403
7440
  const openerRef = useRef23(null);
7404
- useEffect25(() => {
7441
+ useEffect22(() => {
7405
7442
  if (!interactive || state !== "open") return;
7406
7443
  const drawer = drawerRef.current;
7407
7444
  if (!drawer || drawer.contains(document.activeElement)) return;
7408
7445
  openerRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
7409
7446
  drawer.focus({ preventScroll: true });
7410
7447
  }, [interactive, state]);
7411
- useEffect25(() => {
7448
+ useEffect22(() => {
7412
7449
  if (!interactive || state !== "closing") return;
7413
7450
  const opener = openerRef.current;
7414
7451
  openerRef.current = null;
@@ -7506,7 +7543,7 @@ function SpacePresentation({ colorScheme = "dark", stageBackground, header, stag
7506
7543
  // src/components/space-view/SpaceView.tsx
7507
7544
  import "@q9labsai/chalk-client";
7508
7545
  import { DEFAULT_QUICK_REACTIONS as DEFAULT_QUICK_REACTIONS2 } from "@q9labsai/chalk-ui/reactions";
7509
- import { useCallback as useCallback14, useEffect as useEffect36, useMemo as useMemo18, useRef as useRef29, useState as useState44 } from "react";
7546
+ import { useCallback as useCallback15, useEffect as useEffect32, useMemo as useMemo19, useRef as useRef29, useState as useState43 } from "react";
7510
7547
 
7511
7548
  // src/components/space-header/call-diagnostics.ts
7512
7549
  function callDiagnostics(connection, media) {
@@ -7537,12 +7574,12 @@ function callCountdown(deadline, now, previousSeconds) {
7537
7574
  }
7538
7575
 
7539
7576
  // src/internal/useEpisodeDuration.ts
7540
- import { useEffect as useEffect26, useState as useState34 } from "react";
7577
+ import { useEffect as useEffect23, useState as useState33 } from "react";
7541
7578
  function useEpisodeDuration() {
7542
7579
  const connection = useConnection();
7543
7580
  const episodeStart = connection.episode?.startedAt ? Date.parse(connection.episode.startedAt) : null;
7544
- const [now, setNow] = useState34(() => Date.now());
7545
- useEffect26(() => {
7581
+ const [now, setNow] = useState33(() => Date.now());
7582
+ useEffect23(() => {
7546
7583
  if (episodeStart === null || Number.isNaN(episodeStart)) return;
7547
7584
  setNow(Date.now());
7548
7585
  const timer = window.setInterval(() => setNow(Date.now()), 1e3);
@@ -7553,7 +7590,7 @@ function useEpisodeDuration() {
7553
7590
  }
7554
7591
 
7555
7592
  // src/internal/useSoundCues.ts
7556
- import { useCallback as useCallback8, useEffect as useEffect27, useRef as useRef25 } from "react";
7593
+ import { useCallback as useCallback9, useEffect as useEffect24, useRef as useRef25 } from "react";
7557
7594
 
7558
7595
  // src/internal/sound-cues.ts
7559
7596
  function idsOf(items, id) {
@@ -7711,7 +7748,7 @@ function useSoundCues(enabled, createPlayer = createSoundPlayer) {
7711
7748
  createPlayerRef.current = createPlayer;
7712
7749
  const pendingFailures = useRef25(/* @__PURE__ */ new Set());
7713
7750
  const failureTurn = useRef25(void 0);
7714
- const playFailure = useCallback8((failure) => {
7751
+ const playFailure = useCallback9((failure) => {
7715
7752
  const key = JSON.stringify([failure.code, failure.message, failure.recoverable]);
7716
7753
  if (!enabledRef.current || pendingFailures.current.has(key)) return;
7717
7754
  pendingFailures.current.add(key);
@@ -7722,7 +7759,7 @@ function useSoundCues(enabled, createPlayer = createSoundPlayer) {
7722
7759
  failureTurn.current = void 0;
7723
7760
  }, 0);
7724
7761
  }, []);
7725
- useEffect27(() => {
7762
+ useEffect24(() => {
7726
7763
  const player = createPlayerRef.current({ outputDeviceId });
7727
7764
  playerRef.current = player;
7728
7765
  let previous = client.getSnapshot();
@@ -7754,7 +7791,7 @@ function useSoundCues(enabled, createPlayer = createSoundPlayer) {
7754
7791
  pendingFailures.current.clear();
7755
7792
  };
7756
7793
  }, [client, outputDeviceId, playFailure]);
7757
- return useCallback8(
7794
+ return useCallback9(
7758
7795
  (cue, failure) => {
7759
7796
  if (cue === "error" && failure) return playFailure(failure);
7760
7797
  if (enabledRef.current) playerRef.current?.play(cue);
@@ -7764,14 +7801,14 @@ function useSoundCues(enabled, createPlayer = createSoundPlayer) {
7764
7801
  }
7765
7802
 
7766
7803
  // src/components/composite/ReactionPicker.tsx
7767
- import React21, { useMemo as useMemo14, useState as useState36, useCallback as useCallback10, useEffect as useEffect29, useRef as useRef27 } from "react";
7804
+ import React21, { useMemo as useMemo15, useState as useState35, useCallback as useCallback11, useEffect as useEffect26, useRef as useRef27 } from "react";
7768
7805
  import { DEFAULT_QUICK_REACTIONS, EMOJI_CATEGORIES, EMOJI_KEYWORDS } from "@q9labsai/chalk-ui/reactions";
7769
7806
 
7770
7807
  // src/components/composite/ReactionTray.tsx
7771
- import { useCallback as useCallback9, useEffect as useEffect28, useLayoutEffect as useLayoutEffect6, useRef as useRef26, useState as useState35 } from "react";
7808
+ import { useCallback as useCallback10, useEffect as useEffect25, useLayoutEffect as useLayoutEffect6, useRef as useRef26, useState as useState34 } from "react";
7772
7809
  import { Fragment as Fragment27, jsx as jsx61, jsxs as jsxs39 } from "react/jsx-runtime";
7773
7810
  function ReactionTray({ isHandRaised, onToggleHandRaise, reactions, onSelect, onClose, position = "top", className }) {
7774
- const [more, setMore] = useState35(false);
7811
+ const [more, setMore] = useState34(false);
7775
7812
  const returnFocus = useRef26(null);
7776
7813
  const prefersReducedMotion = usePrefersReducedMotion();
7777
7814
  const { trigger } = useHaptics();
@@ -7808,14 +7845,14 @@ function ReactionTray({ isHandRaised, onToggleHandRaise, reactions, onSelect, on
7808
7845
  if (returnFocus.current instanceof HTMLElement && returnFocus.current.isConnected) returnFocus.current.focus();
7809
7846
  };
7810
7847
  }, [position]);
7811
- useEffect28(() => {
7848
+ useEffect25(() => {
7812
7849
  const handleKeyDown2 = (event) => {
7813
7850
  if (event.key === "Escape") onClose();
7814
7851
  };
7815
7852
  document.addEventListener("keydown", handleKeyDown2);
7816
7853
  return () => document.removeEventListener("keydown", handleKeyDown2);
7817
7854
  }, [onClose]);
7818
- const handleSelect = useCallback9(
7855
+ const handleSelect = useCallback10(
7819
7856
  (emoji) => {
7820
7857
  void trigger("success");
7821
7858
  onSelect(emoji);
@@ -7856,18 +7893,19 @@ import { Fragment as Fragment28, jsx as jsx62, jsxs as jsxs40 } from "react/jsx-
7856
7893
  var ReactionPicker = React21.memo(({ isHandRaised, onToggleHandRaise, isOpen, onClose, onSelect, recentReactions = [], allowedReactions, position = "top", participantColorSeed, participantGradientPreference, className, size = "default" }) => {
7857
7894
  const prefersReducedMotion = usePrefersReducedMotion();
7858
7895
  const { trigger } = useHaptics();
7859
- const [activeCategory, setActiveCategory] = useState36("smileys");
7860
- const [searchQuery, setSearchQuery] = useState36("");
7896
+ const [activeCategory, setActiveCategory] = useState35("smileys");
7897
+ const [searchQuery, setSearchQuery] = useState35("");
7861
7898
  const inputRef = useRef27(null);
7862
- const themeVariables = useMemo14(() => getParticipantThemeVariables(participantColorSeed, participantGradientPreference), [participantColorSeed, participantGradientPreference]);
7863
- useEffect29(() => {
7899
+ const themeVariables = useMemo15(() => getParticipantThemeVariables(participantColorSeed, participantGradientPreference), [participantColorSeed, participantGradientPreference]);
7900
+ useEffect26(() => {
7864
7901
  if (isOpen) {
7865
- setTimeout(() => inputRef.current?.focus(), 50);
7902
+ const timer = setTimeout(() => inputRef.current?.focus(), 50);
7866
7903
  setSearchQuery("");
7867
7904
  setActiveCategory("smileys");
7905
+ return () => clearTimeout(timer);
7868
7906
  }
7869
7907
  }, [isOpen]);
7870
- const handleSelect = useCallback10(
7908
+ const handleSelect = useCallback11(
7871
7909
  (emoji) => {
7872
7910
  void trigger("success");
7873
7911
  onSelect(emoji);
@@ -7875,7 +7913,7 @@ var ReactionPicker = React21.memo(({ isHandRaised, onToggleHandRaise, isOpen, on
7875
7913
  },
7876
7914
  [onClose, onSelect, trigger]
7877
7915
  );
7878
- useEffect29(() => {
7916
+ useEffect26(() => {
7879
7917
  if (!isOpen || typeof window === "undefined") return;
7880
7918
  const handleKeyDown = (e) => {
7881
7919
  if (e.key === "Escape") onClose();
@@ -7887,7 +7925,7 @@ var ReactionPicker = React21.memo(({ isHandRaised, onToggleHandRaise, isOpen, on
7887
7925
  const categories = Object.entries(EMOJI_CATEGORIES);
7888
7926
  const isSearching = searchQuery.trim() !== "";
7889
7927
  const query = searchQuery.toLowerCase().trim();
7890
- const searchResults = useMemo14(() => {
7928
+ const searchResults = useMemo15(() => {
7891
7929
  if (!isSearching) return [];
7892
7930
  const results = [];
7893
7931
  for (const [emoji, keywords] of Object.entries(EMOJI_KEYWORDS)) {
@@ -8014,7 +8052,7 @@ var ReactionPicker = React21.memo(({ isHandRaised, onToggleHandRaise, isOpen, on
8014
8052
  ReactionPicker.displayName = "ReactionPicker";
8015
8053
 
8016
8054
  // src/components/offline-actions/OfflineActions.tsx
8017
- import { useEffect as useEffect30, useState as useState37, useSyncExternalStore as useSyncExternalStore4 } from "react";
8055
+ import { useEffect as useEffect27, useState as useState36, useSyncExternalStore as useSyncExternalStore5 } from "react";
8018
8056
  import { jsx as jsx63 } from "react/jsx-runtime";
8019
8057
  var RECONNECTING_GRACE_MS = 2e3;
8020
8058
  function offlineNoticeText(pendingCount, online) {
@@ -8026,10 +8064,10 @@ function OfflineActions({ reconnecting: requestedReconnecting = false, hasNotice
8026
8064
  const client = useSpaceClient();
8027
8065
  const connection = useConnection();
8028
8066
  const offline = useOffline();
8029
- const online = useSyncExternalStore4(subscribeToOnline, readOnline, () => true);
8067
+ const online = useSyncExternalStore5(subscribeToOnline, readOnline, () => true);
8030
8068
  const reconnecting = requestedReconnecting || connection.status === "reconnecting";
8031
8069
  const reconnectingNoticeDue = useTrueFor(reconnecting, RECONNECTING_GRACE_MS);
8032
- useEffect30(() => {
8070
+ useEffect27(() => {
8033
8071
  void client.offline.setPolicy("send");
8034
8072
  }, [client]);
8035
8073
  const count = offline.pending.length;
@@ -8042,8 +8080,8 @@ function OfflineActions({ reconnecting: requestedReconnecting = false, hasNotice
8042
8080
  return null;
8043
8081
  }
8044
8082
  function useTrueFor(value, milliseconds) {
8045
- const [elapsed, setElapsed] = useState37(false);
8046
- useEffect30(() => {
8083
+ const [elapsed, setElapsed] = useState36(false);
8084
+ useEffect27(() => {
8047
8085
  setElapsed(false);
8048
8086
  if (!value) return;
8049
8087
  const timer = setTimeout(() => setElapsed(true), milliseconds);
@@ -8064,13 +8102,13 @@ function readOnline() {
8064
8102
  }
8065
8103
 
8066
8104
  // src/components/reconnecting-overlay/ReconnectingOverlay.tsx
8067
- import { memo as memo3, useEffect as useEffect31, useState as useState38 } from "react";
8105
+ import { memo as memo3, useEffect as useEffect28, useState as useState37 } from "react";
8068
8106
  import { jsx as jsx64 } from "react/jsx-runtime";
8069
8107
  var RECONNECTING_NOTICE_MS = 2e3;
8070
8108
  var ReconnectingOverlay = memo3(function ReconnectingOverlay2({ isVisible, status, onRetry, onLeft, message, showNotice }) {
8071
8109
  const reconnecting = isVisible && status === "reconnecting";
8072
- const [elapsed, setElapsed] = useState38(false);
8073
- useEffect31(() => {
8110
+ const [elapsed, setElapsed] = useState37(false);
8111
+ useEffect28(() => {
8074
8112
  setElapsed(false);
8075
8113
  if (!reconnecting) return;
8076
8114
  const timer = setTimeout(() => setElapsed(true), RECONNECTING_NOTICE_MS);
@@ -8084,7 +8122,7 @@ var ReconnectingOverlay = memo3(function ReconnectingOverlay2({ isVisible, statu
8084
8122
  });
8085
8123
 
8086
8124
  // src/components/toast-stack/useCallToasts.ts
8087
- import { useCallback as useCallback11, useEffect as useEffect32, useRef as useRef28, useState as useState39 } from "react";
8125
+ import { useCallback as useCallback12, useEffect as useEffect29, useRef as useRef28, useState as useState38 } from "react";
8088
8126
 
8089
8127
  // src/components/toast-stack/call-events.tsx
8090
8128
  import { Fragment as Fragment29, jsx as jsx65, jsxs as jsxs41 } from "react/jsx-runtime";
@@ -8181,9 +8219,9 @@ function callEventToasts(previous, next) {
8181
8219
  // src/components/toast-stack/useCallToasts.ts
8182
8220
  function useCallToasts() {
8183
8221
  const client = useSpaceClient();
8184
- const [toasts, setToasts] = useState39([]);
8222
+ const [toasts, setToasts] = useState38([]);
8185
8223
  const sequence = useRef28(0);
8186
- useEffect32(() => {
8224
+ useEffect29(() => {
8187
8225
  setToasts([]);
8188
8226
  let previous = client.getSnapshot();
8189
8227
  let failedSource;
@@ -8216,26 +8254,28 @@ function useCallToasts() {
8216
8254
  offError();
8217
8255
  };
8218
8256
  }, [client]);
8219
- const dismiss = useCallback11((id) => setToasts((current) => current.filter((toast) => toast.id !== id)), []);
8220
- const dismissFailure = useCallback11((code) => setToasts((current) => current.filter((toast) => toast.failureCode !== code)), []);
8257
+ const dismiss = useCallback12((id) => setToasts((current) => current.filter((toast) => toast.id !== id)), []);
8258
+ const dismissFailure = useCallback12((code) => setToasts((current) => current.filter((toast) => toast.failureCode !== code)), []);
8221
8259
  return { toasts, dismiss, dismissFailure };
8222
8260
  }
8223
8261
 
8224
8262
  // src/components/call-limbo/useCallLink.ts
8225
- import { useEffect as useEffect33, useState as useState40 } from "react";
8263
+ import { useState as useState39 } from "react";
8226
8264
  function useCallLink(alone) {
8227
- const [open, setOpen] = useState40(alone);
8228
- useEffect33(() => {
8265
+ const [open, setOpen] = useState39(alone);
8266
+ const [wasAlone, setWasAlone] = useState39(alone);
8267
+ if (wasAlone !== alone) {
8268
+ setWasAlone(alone);
8229
8269
  if (!alone) setOpen(false);
8230
- }, [alone]);
8270
+ }
8231
8271
  return { open, toggle: () => setOpen((current) => !current), close: () => setOpen(false) };
8232
8272
  }
8233
8273
 
8234
8274
  // src/components/toast-stack/NoticeButton.tsx
8235
- import { useState as useState41 } from "react";
8275
+ import { useState as useState40 } from "react";
8236
8276
  import { jsx as jsx66, jsxs as jsxs42 } from "react/jsx-runtime";
8237
8277
  function NoticeButton({ toasts, onDismiss }) {
8238
- const [open, setOpen] = useState41(false);
8278
+ const [open, setOpen] = useState40(false);
8239
8279
  if (toasts.length === 0) return null;
8240
8280
  const label = toasts.length === 1 ? "1 notice" : `${toasts.length} notices`;
8241
8281
  const trigger = /* @__PURE__ */ jsxs42("button", { type: "button", "data-part": "notice-button", className: "chalk-notice-button", "aria-label": `Show ${label}`, children: [
@@ -8257,13 +8297,13 @@ function NoticeButton({ toasts, onDismiss }) {
8257
8297
  import { BoardToastContext as BoardToastContext2 } from "@q9labsai/chalk-whiteboard/react";
8258
8298
 
8259
8299
  // src/components/stage/SpaceStage.tsx
8260
- import { useCallback as useCallback13, useEffect as useEffect34, useMemo as useMemo17, useState as useState42 } from "react";
8300
+ import { useCallback as useCallback14, useEffect as useEffect30, useMemo as useMemo18, useState as useState41 } from "react";
8261
8301
 
8262
8302
  // src/components/board/Board.tsx
8263
- import { useContext as useContext3, useMemo as useMemo16 } from "react";
8303
+ import { useContext as useContext3, useMemo as useMemo17 } from "react";
8264
8304
 
8265
8305
  // src/components/board/board-draw-policy.ts
8266
- import { useCallback as useCallback12, useMemo as useMemo15 } from "react";
8306
+ import { useCallback as useCallback13, useMemo as useMemo16 } from "react";
8267
8307
  function useWhoCanDraw(toast) {
8268
8308
  const client = useSpaceClient();
8269
8309
  const isHost = useCan("manageWhiteboard");
@@ -8271,7 +8311,7 @@ function useWhoCanDraw(toast) {
8271
8311
  const { roster } = useParticipants();
8272
8312
  const { access } = useWhiteboard();
8273
8313
  const transport = client.whiteboard.transport();
8274
- const people = useMemo15(
8314
+ const people = useMemo16(
8275
8315
  () => roster.filter((person) => person.participantId !== self.participantId && !person.capabilities.includes("manageWhiteboard")).map((person) => ({
8276
8316
  id: person.participantId,
8277
8317
  name: person.displayName,
@@ -8279,13 +8319,13 @@ function useWhoCanDraw(toast) {
8279
8319
  })),
8280
8320
  [roster, self.participantId, access.permissions]
8281
8321
  );
8282
- const onPolicy = useCallback12(
8322
+ const onPolicy = useCallback13(
8283
8323
  (policy) => {
8284
8324
  transport?.setDrawPolicy?.(policy).catch(() => toast({ type: "error", message: "Could not change who can draw. Try again." }));
8285
8325
  },
8286
8326
  [transport, toast]
8287
8327
  );
8288
- const onPick = useCallback12(
8328
+ const onPick = useCallback13(
8289
8329
  (id, picked) => {
8290
8330
  transport?.setDrawPermission(id, picked).catch(() => toast({ type: "error", message: "Could not change who can draw. Try again." }));
8291
8331
  },
@@ -8306,7 +8346,7 @@ function Board(props) {
8306
8346
  const boardSession = useWhiteboard().engine;
8307
8347
  const self = useSelf();
8308
8348
  const { roster } = useParticipants();
8309
- const participantIds = useMemo16(() => roster.map((person) => person.participantId), [roster]);
8349
+ const participantIds = useMemo17(() => roster.map((person) => person.participantId), [roster]);
8310
8350
  const whoCanDraw = useWhoCanDraw(useContext3(BoardToastContext));
8311
8351
  return /* @__PURE__ */ jsx67(
8312
8352
  SharedBoard,
@@ -8328,33 +8368,35 @@ function Board(props) {
8328
8368
  // src/components/stage/SpaceStage.tsx
8329
8369
  import { jsx as jsx68 } from "react/jsx-runtime";
8330
8370
  function SpaceStage({ pinnedId, onPinnedChange, tiles, layout, onLayoutChange, generatedAvatars = true, whiteboard, onOverflowClick, shareCapture, onStopSharing, onChangeShare, colorScheme = "dark", onCloseBoard, className }) {
8331
- const items = useMemo17(() => buildStageItems(tiles, whiteboard?.isOpen === true), [tiles, whiteboard?.isOpen]);
8332
- const [selectedShare, setSelectedShare] = useState42(null);
8333
- const [localPin, setLocalPin] = useState42(null);
8371
+ const items = useMemo18(() => buildStageItems(tiles, whiteboard?.isOpen === true), [tiles, whiteboard?.isOpen]);
8372
+ const [selectedShare, setSelectedShare] = useState41(null);
8373
+ const [localPin, setLocalPin] = useState41(null);
8334
8374
  const pin = pinnedId === void 0 ? localPin : pinnedId;
8335
- const setPin = useCallback13(
8375
+ const setPin = useCallback14(
8336
8376
  (id) => {
8337
8377
  setLocalPin(id);
8338
8378
  onPinnedChange?.(id);
8339
8379
  },
8340
8380
  [onPinnedChange]
8341
8381
  );
8342
- const [following, setFollowing] = useState42(void 0);
8382
+ const [following, setFollowing] = useState41(void 0);
8343
8383
  const boardOpen = whiteboard?.isOpen === true && Boolean(whiteboard.props);
8344
- useEffect34(() => {
8384
+ const [wasBoardOpen, setWasBoardOpen] = useState41(boardOpen);
8385
+ if (wasBoardOpen !== boardOpen) {
8386
+ setWasBoardOpen(boardOpen);
8345
8387
  if (!boardOpen) setFollowing(void 0);
8346
- }, [boardOpen]);
8388
+ }
8347
8389
  const canFollow = boardOpen && Boolean(whiteboard?.sendView);
8348
8390
  const target = following === void 0 ? whiteboard?.presenterId : following;
8349
8391
  const followed = canFollow && tiles.some((tile) => tile.id === target && !tile.isLocal) ? target ?? null : null;
8350
8392
  const activePin = items.some((item) => item.id === pin) ? pin : null;
8351
8393
  const shares = items.filter((item) => item.kind === "screen-share");
8352
8394
  const activeShare = selectedShare && shares.some((item) => item.id === selectedShare) ? selectedShare : null;
8353
- useEffect34(() => {
8395
+ useEffect30(() => {
8354
8396
  if (pin !== activePin) setPin(activePin);
8355
8397
  if (selectedShare !== activeShare) setSelectedShare(activeShare);
8356
8398
  }, [pin, activePin, selectedShare, activeShare, setPin]);
8357
- const follow = useCallback13(
8399
+ const follow = useCallback14(
8358
8400
  (id) => {
8359
8401
  if (id) {
8360
8402
  setPin(null);
@@ -8364,7 +8406,7 @@ function SpaceStage({ pinnedId, onPinnedChange, tiles, layout, onLayoutChange, g
8364
8406
  },
8365
8407
  [setPin]
8366
8408
  );
8367
- const renderContentTile = useCallback13(
8409
+ const renderContentTile = useCallback14(
8368
8410
  (item, context) => {
8369
8411
  if (item.kind === "screen-share")
8370
8412
  return /* @__PURE__ */ jsx68(
@@ -8375,7 +8417,7 @@ function SpaceStage({ pinnedId, onPinnedChange, tiles, layout, onLayoutChange, g
8375
8417
  capture: item.participant.isLocal ? shareCapture : void 0,
8376
8418
  onStopSharing: item.participant.isLocal ? onStopSharing : void 0,
8377
8419
  onChangeShare: item.participant.isLocal ? onChangeShare : void 0,
8378
- switcher: shares.length > 1 ? /* @__PURE__ */ jsx68("div", { role: "group", "aria-label": "Whose screen is big", className: cn("absolute left-2 z-30 flex rounded-[999px] bg-[rgba(12,14,18,.82)] p-[3px]", item.participant.screenShareState === "low-quality" ? "top-11" : "top-2"), children: shares.map((share) => /* @__PURE__ */ jsx68(
8420
+ switcher: shares.length > 1 ? /* @__PURE__ */ jsx68("div", { role: "group", "aria-label": "Whose screen is big", className: cn("absolute left-2 z-30 flex rounded-[999px] bg-[var(--chalk-overlay-strong)] p-[3px]", item.participant.screenShareState === "low-quality" ? "top-11" : "top-2"), children: shares.map((share) => /* @__PURE__ */ jsx68(
8379
8421
  "button",
8380
8422
  {
8381
8423
  type: "button",
@@ -8384,7 +8426,7 @@ function SpaceStage({ pinnedId, onPinnedChange, tiles, layout, onLayoutChange, g
8384
8426
  setPin(null);
8385
8427
  setSelectedShare(share.id);
8386
8428
  },
8387
- className: "relative h-7 rounded-[999px] px-3 text-[12px] font-semibold text-[#d4d5d9] hover:bg-white/10 aria-pressed:bg-white aria-pressed:text-[#0b0c0e] [@media(pointer:coarse)]:before:absolute [@media(pointer:coarse)]:before:-inset-y-2 [@media(pointer:coarse)]:before:inset-x-0",
8429
+ className: "relative h-7 rounded-[999px] px-3 text-[12px] font-semibold text-[var(--chalk-on-overlay)] hover:bg-[var(--chalk-on-overlay)]/10 aria-pressed:bg-[var(--chalk-on-overlay)] aria-pressed:text-[var(--chalk-overlay)] [@media(pointer:coarse)]:before:absolute [@media(pointer:coarse)]:before:-inset-y-2 [@media(pointer:coarse)]:before:inset-x-0",
8388
8430
  children: share.participant.displayName
8389
8431
  },
8390
8432
  share.id
@@ -8404,7 +8446,7 @@ function SpaceStage({ pinnedId, onPinnedChange, tiles, layout, onLayoutChange, g
8404
8446
  },
8405
8447
  [follow, whiteboard, shares, shareCapture, onStopSharing, onChangeShare, colorScheme, tiles, followed, canFollow, onCloseBoard]
8406
8448
  );
8407
- const focusContent = useCallback13(
8449
+ const focusContent = useCallback14(
8408
8450
  (item) => {
8409
8451
  if (item.kind !== "participant") onLayoutChange?.("focus");
8410
8452
  },
@@ -8431,12 +8473,12 @@ function SpaceStage({ pinnedId, onPinnedChange, tiles, layout, onLayoutChange, g
8431
8473
  SpaceStage.displayName = "SpaceStage";
8432
8474
 
8433
8475
  // src/components/space-view/useDrawerPresence.ts
8434
- import { useEffect as useEffect35, useState as useState43 } from "react";
8476
+ import { useEffect as useEffect31, useState as useState42 } from "react";
8435
8477
  var DRAWER_EXIT_MS = 200;
8436
8478
  function useDrawerPresence(panel, exitMs) {
8437
- const [retained, setRetained] = useState43(panel);
8438
- const [state, setState] = useState43(panel === null ? "closed" : "open");
8439
- useEffect35(() => {
8479
+ const [retained, setRetained] = useState42(panel);
8480
+ const [state, setState] = useState42(panel === null ? "closed" : "open");
8481
+ useEffect31(() => {
8440
8482
  if (panel !== null) {
8441
8483
  setRetained(panel);
8442
8484
  setState("open");
@@ -8496,7 +8538,7 @@ function SpaceView({
8496
8538
  const media = useMedia();
8497
8539
  const connection = useConnection();
8498
8540
  const offline = useOffline();
8499
- const [dismissedOfflineNotice, setDismissedOfflineNotice] = useState44(null);
8541
+ const [dismissedOfflineNotice, setDismissedOfflineNotice] = useState43(null);
8500
8542
  const offlineNotice = offline.notice && offline.notice !== dismissedOfflineNotice ? offline.notice : null;
8501
8543
  const recording = useRecording();
8502
8544
  const canPublishScreen = useCan("publishScreen");
@@ -8507,32 +8549,37 @@ function SpaceView({
8507
8549
  const canManageRecording = useCan("manageRecording");
8508
8550
  const episodeDuration = useEpisodeDuration();
8509
8551
  const deadline = connection.episode?.deadline;
8510
- const [now, setNow] = useState44(Date.now);
8552
+ const [now, setNow] = useState43(Date.now);
8511
8553
  const previousCountdown = useRef29(null);
8512
- const [limitWarning, setLimitWarning] = useState44(null);
8554
+ const [limitWarning, setLimitWarning] = useState43(null);
8513
8555
  const countdown = callCountdown(deadline, now);
8514
- useEffect36(() => {
8556
+ useEffect32(() => {
8515
8557
  if (!deadline) return;
8516
8558
  const tick = () => setNow(Date.now());
8517
8559
  tick();
8518
8560
  const timer = window.setInterval(tick, 1e3);
8519
8561
  return () => window.clearInterval(timer);
8520
8562
  }, [deadline]);
8521
- useEffect36(() => {
8563
+ useEffect32(() => {
8522
8564
  const previous = previousCountdown.current;
8523
8565
  const next = callCountdown(deadline, now, previous?.deadline === deadline ? previous?.seconds : void 0);
8524
8566
  previousCountdown.current = { deadline, seconds: next.seconds };
8525
8567
  if (previous?.deadline !== deadline) setLimitWarning(null);
8526
8568
  if (next.warning !== null) setLimitWarning({ id: `time-limit-${deadline}-${next.warning}`, minutes: next.warning });
8527
8569
  }, [deadline, now]);
8528
- const [uncontrolledLayout, setUncontrolledLayout] = useState44(controlledLayout ?? "focus");
8529
- const [pinnedId, setPinnedId] = useState44(null);
8530
- const [activePanel, setActivePanel] = useState44(initialPanel);
8531
- const [isReactionPickerOpen, setReactionPickerOpen] = useState44(false);
8532
- const [commandError, setCommandError] = useState44(null);
8533
- const [commandSource, setCommandSource] = useState44();
8534
- const [commandAction, setCommandAction] = useState44();
8535
- const [retryCommand, setRetryCommand] = useState44();
8570
+ const [uncontrolledLayout, setUncontrolledLayout] = useState43(controlledLayout ?? "focus");
8571
+ const [pinnedId, setPinnedId] = useState43(null);
8572
+ const [activePanel, setActivePanel] = useState43(initialPanel);
8573
+ const [previousInitialPanel, setPreviousInitialPanel] = useState43(initialPanel);
8574
+ if (previousInitialPanel !== initialPanel) {
8575
+ setPreviousInitialPanel(initialPanel);
8576
+ setActivePanel(initialPanel);
8577
+ }
8578
+ const [isReactionPickerOpen, setReactionPickerOpen] = useState43(false);
8579
+ const [commandError, setCommandError] = useState43(null);
8580
+ const [commandSource, setCommandSource] = useState43();
8581
+ const [commandAction, setCommandAction] = useState43();
8582
+ const [retryCommand, setRetryCommand] = useState43();
8536
8583
  const onCommandError = (failure, source, mediaSource, action, command) => {
8537
8584
  if (!failure && commandError && typeof commandError === "object") callToasts.dismissFailure(commandError.code);
8538
8585
  setCommandError(failure);
@@ -8544,15 +8591,14 @@ function SpaceView({
8544
8591
  const layout = onLayoutChange ? controlledLayout ?? uncontrolledLayout : uncontrolledLayout;
8545
8592
  const feature = (name) => features?.[name] !== false;
8546
8593
  const localId = self.participantId ?? "local";
8547
- const tiles = useMemo18(
8594
+ const tiles = useMemo19(
8548
8595
  () => toVideoParticipants(participantsSlice.roster, media.remote, localId, self.displayName ?? "You", media.local).map((tile) => ({
8549
8596
  ...tile,
8550
8597
  screenShareHasAudio: tile.isLocal ? media.screenShare.hasAudio : participantsSlice.roster.find((person) => person.participantId === tile.id)?.media.screenShareHasAudio
8551
8598
  })),
8552
8599
  [localId, media.local, media.remote, media.screenShare.hasAudio, participantsSlice.roster, self.displayName]
8553
8600
  );
8554
- useEffect36(() => setActivePanel(initialPanel), [initialPanel]);
8555
- useEffect36(() => {
8601
+ useEffect32(() => {
8556
8602
  if (feature("admission") && feature("participants") && canManageAdmission && participantsSlice.admissionQueue.length > 0) setActivePanel("participants");
8557
8603
  }, [canManageAdmission, participantsSlice.admissionQueue.length, features?.admission, features?.participants]);
8558
8604
  const buttons = [
@@ -8576,7 +8622,7 @@ function SpaceView({
8576
8622
  const playSound = useSoundCues(feature("sounds") && soundsEnabled);
8577
8623
  const prefersReducedMotion = usePrefersReducedMotion();
8578
8624
  const drawer = useDrawerPresence(activePanel, prefersReducedMotion ? 0 : DRAWER_EXIT_MS);
8579
- const runCommand = useCallback14(async (command, source, action) => {
8625
+ const runCommand = useCallback15(async (command, source, action) => {
8580
8626
  try {
8581
8627
  await command();
8582
8628
  setCommandError(null);
@@ -8605,12 +8651,14 @@ function SpaceView({
8605
8651
  };
8606
8652
  const mappedFailure = mediaFailureToast(typeof displayedCommandError === "object" ? displayedCommandError : null, displayedCommandSource, externalCommandError != null ? externalCommandAction : commandAction, externalCommandError == null && retryCommand ? () => void retryMedia() : void 0);
8607
8653
  const commandToasts = mappedFailure ? [{ id: "space-command-error", ...mappedFailure }] : typeof displayedCommandError === "string" ? [{ id: "space-command-error", message: displayedCommandError, type: "error" }] : [];
8608
- const [boardToasts, setBoardToasts] = useState44([]);
8654
+ const [boardToasts, setBoardToasts] = useState43([]);
8609
8655
  const boardToastCount = useRef29(0);
8610
- useEffect36(() => {
8656
+ const [previousBoardOpen, setPreviousBoardOpen] = useState43(whiteboard?.isOpen);
8657
+ if (previousBoardOpen !== whiteboard?.isOpen) {
8658
+ setPreviousBoardOpen(whiteboard?.isOpen);
8611
8659
  if (!whiteboard?.isOpen) setBoardToasts([]);
8612
- }, [whiteboard?.isOpen]);
8613
- const showBoardToast = useCallback14((toast) => {
8660
+ }
8661
+ const showBoardToast = useCallback15((toast) => {
8614
8662
  if (!toast) {
8615
8663
  setBoardToasts([]);
8616
8664
  return;
@@ -8639,7 +8687,7 @@ function SpaceView({
8639
8687
  else if (id.startsWith("board-")) setBoardToasts((current) => current.filter((toast) => toast.id !== id));
8640
8688
  else callToasts.dismiss(id);
8641
8689
  };
8642
- const [foldedNotices, setFoldedNotices] = useState44([]);
8690
+ const [foldedNotices, setFoldedNotices] = useState43([]);
8643
8691
  const microphoneTarget = mediaToggleTarget(media.local.microphone.state, connection.status === "live");
8644
8692
  const cameraTarget = mediaToggleTarget(media.local.camera.state, connection.status === "live");
8645
8693
  const folded = toasts.filter((toast) => foldedNotices.includes(toast.id));