@q9labsai/chalk-react 5.4.0 → 5.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/README.md +7 -30
  2. package/dist/Board-PPO62QTR.js +80 -0
  3. package/dist/CallCharts-7ZQLN47C.js +114 -0
  4. package/dist/CallDetails-IG57GXT2.js +200 -0
  5. package/dist/CallDialogContent-GST2I23W.js +177 -0
  6. package/dist/CameraBackgroundPicker-AZXKBGRF.js +72 -0
  7. package/dist/ConnectionNotice-NQUBBT46.js +55 -0
  8. package/dist/DeviceAccessCard-MLRBTPRP.js +238 -0
  9. package/dist/DeviceAccessWaiting-MQXXW45M.js +25 -0
  10. package/dist/DeviceSheet-GZTV44UW.js +118 -0
  11. package/dist/InviteQrCode-TNTZA3GS.js +54 -0
  12. package/dist/KnockNotice-CAW4CJ4S.js +181 -0
  13. package/dist/ReactionSheet-ZU6RWC66.js +132 -0
  14. package/dist/chunk-26PBFST5.js +25 -0
  15. package/dist/{chunk-K5DV2OTY.js → chunk-4RSCAIFK.js} +340 -165
  16. package/dist/chunk-ADIDI7AJ.js +10 -0
  17. package/dist/chunk-ALGD3RBI.js +10 -0
  18. package/dist/chunk-CQBYFA2W.js +73 -0
  19. package/dist/chunk-E6HPIMFO.js +44 -0
  20. package/dist/{chunk-LYZ7EBFF.js → chunk-F6QZY5SM.js} +4116 -4605
  21. package/dist/chunk-I6FSUWKG.js +51 -0
  22. package/dist/chunk-JDCFKSGV.js +95 -0
  23. package/dist/chunk-PH3RC6T6.js +476 -0
  24. package/dist/chunk-PMGIER77.js +92 -0
  25. package/dist/chunk-Q36UO2T2.js +363 -0
  26. package/dist/chunk-SBGC5DKV.js +114 -0
  27. package/dist/chunk-SZNV3J4B.js +9 -0
  28. package/dist/{chunk-4U7QZC72.js → chunk-TSBY6C5U.js} +1 -102
  29. package/dist/chunk-XY7WXXME.js +85 -0
  30. package/dist/chunk-YOWY22N7.js +148 -0
  31. package/dist/chunk-Z5AASN4L.js +34 -0
  32. package/dist/components/admission-panel/KnockNotice.d.ts +31 -0
  33. package/dist/components/admission-panel/answer-all.d.ts +2 -0
  34. package/dist/components/call-limbo/CallLimbo.d.ts +5 -1
  35. package/dist/components/chalk/Chalk.d.ts +2 -5
  36. package/dist/components/chalk/StatusSurface.d.ts +3 -3
  37. package/dist/components/chalk-ui/ChalkSheet.d.ts +6 -2
  38. package/dist/components/chalk-ui/InviteLinkButton.d.ts +5 -0
  39. package/dist/components/chalk-ui/InviteQR.d.ts +4 -0
  40. package/dist/components/chalk-ui/InviteQrCode.d.ts +3 -0
  41. package/dist/components/chalk-ui/MenuIcon.d.ts +17 -0
  42. package/dist/components/chalk-ui/invite-qr-path.d.ts +10 -0
  43. package/dist/components/chalk-ui/sheet-drag.d.ts +17 -0
  44. package/dist/components/chalk-ui/useCopyText.d.ts +6 -0
  45. package/dist/components/chalk-ui/useSheetDrag.d.ts +11 -0
  46. package/dist/components/composite/ReactionSheet.d.ts +5 -0
  47. package/dist/components/connection-notice/ConnectionBars.d.ts +4 -0
  48. package/dist/components/connection-notice/ConnectionNotice.d.ts +12 -0
  49. package/dist/components/connection-notice/shown-notice.d.ts +12 -0
  50. package/dist/components/connection-status/ConnectionRing.d.ts +2 -0
  51. package/dist/components/connection-status/ConnectionStatus.d.ts +24 -0
  52. package/dist/components/connection-status/LiveConnectionStatus.d.ts +9 -0
  53. package/dist/components/connection-status/use-connection-phase.d.ts +23 -0
  54. package/dist/components/control-bar/DockLayout.d.ts +2 -1
  55. package/dist/components/control-bar/ShareControl.d.ts +3 -1
  56. package/dist/components/control-bar/ShellIcon.d.ts +18 -6
  57. package/dist/components/control-bar/control-bar-behavior.d.ts +19 -8
  58. package/dist/components/control-bar/control-bar-devices.d.ts +8 -0
  59. package/dist/components/control-bar/useDeviceSheets.d.ts +7 -0
  60. package/dist/components/device-access/DeviceAccessCard.d.ts +17 -0
  61. package/dist/components/device-access/DeviceAccessStyles.d.ts +1 -0
  62. package/dist/components/device-access/DeviceAccessWaiting.d.ts +4 -0
  63. package/dist/components/device-access/LazyDeviceAccessCard.d.ts +7 -0
  64. package/dist/components/device-access/browser-marks.d.ts +5 -0
  65. package/dist/components/device-access/card-copy.d.ts +17 -0
  66. package/dist/components/device-access/load-card.d.ts +2 -0
  67. package/dist/components/device-access/model.d.ts +29 -0
  68. package/dist/components/device-access/ports.d.ts +21 -0
  69. package/dist/components/device-access/resolve.d.ts +31 -0
  70. package/dist/components/device-access/store.d.ts +32 -0
  71. package/dist/components/device-access/useDeviceAccess.d.ts +7 -0
  72. package/dist/components/device-popover/CameraBackgroundPicker.d.ts +23 -0
  73. package/dist/components/device-popover/DevicePopover.d.ts +7 -1
  74. package/dist/components/device-popover/DevicePreview.d.ts +12 -0
  75. package/dist/components/device-popover/DeviceSheet.d.ts +26 -0
  76. package/dist/components/index.js +30 -15
  77. package/dist/components/participant-grid/ParticipantGrid.d.ts +9 -0
  78. package/dist/components/participant-tile/ParticipantTile.d.ts +12 -1
  79. package/dist/components/participant-tile/TileConnection.d.ts +9 -0
  80. package/dist/components/participant-tile/TileShell.d.ts +2 -1
  81. package/dist/components/participant-tile/useFrozenFrame.d.ts +12 -0
  82. package/dist/components/participant-tile/useVideoTileVisibility.d.ts +6 -0
  83. package/dist/components/participants-panel/ParticipantsPanel.d.ts +5 -0
  84. package/dist/components/participants-panel/participant-options-menu.d.ts +4 -1
  85. package/dist/components/participants-panel/participant-order.d.ts +13 -0
  86. package/dist/components/participants-panel/participant-row.d.ts +5 -1
  87. package/dist/components/participants-panel/participant-search.d.ts +4 -0
  88. package/dist/components/space-header/CallCharts.d.ts +22 -0
  89. package/dist/components/space-header/CallDetails.d.ts +5 -13
  90. package/dist/components/space-header/CallDialog.d.ts +5 -0
  91. package/dist/components/space-header/CallDialogContent.d.ts +13 -0
  92. package/dist/components/space-header/CallMenuStyles.d.ts +2 -0
  93. package/dist/components/space-header/RowIcon.d.ts +12 -0
  94. package/dist/components/space-header/call-diagnostics.d.ts +2 -1
  95. package/dist/components/space-header/call-network.d.ts +18 -0
  96. package/dist/components/space-header/space-header-contract.d.ts +8 -1
  97. package/dist/components/space-view/SpacePresentation.d.ts +3 -1
  98. package/dist/components/space-view/SpaceView.d.ts +3 -5
  99. package/dist/components/space-view/useBoardNotices.d.ts +7 -0
  100. package/dist/components/space-view/useMicrophoneNotice.d.ts +11 -0
  101. package/dist/components/toast-stack/ToastStack.d.ts +3 -1
  102. package/dist/components/toast-stack/call-events.d.ts +4 -2
  103. package/dist/index.d.ts +4 -0
  104. package/dist/index.js +298 -28
  105. package/dist/internal/call-width.d.ts +9 -0
  106. package/dist/internal/media-devices.d.ts +11 -0
  107. package/dist/internal/speaker-test.d.ts +2 -0
  108. package/dist/internal/useHandOrder.d.ts +2 -0
  109. package/dist/internal/useHeldWhile.d.ts +2 -0
  110. package/dist/internal/useInputLevel.d.ts +4 -0
  111. package/dist/internal/useLongPress.d.ts +15 -0
  112. package/dist/internal/useSeenConnected.d.ts +9 -0
  113. package/dist/internal/useSilentMicrophone.d.ts +4 -0
  114. package/dist/internal/useTrueFor.d.ts +4 -0
  115. package/dist/participant-options-menu-S3EL6K3M.js +330 -0
  116. package/dist/pre-join/remembered-devices.d.ts +12 -0
  117. package/dist/pre-join/usePreJoinDevices.d.ts +47 -0
  118. package/dist/public-surface.contract.d.ts +1 -1
  119. package/dist/test-support/index.d.ts +1 -1
  120. package/dist/test-support/index.js +41 -10
  121. package/dist/theme.d.ts +32 -32
  122. package/dist/toast.d.ts +1 -0
  123. package/dist/toast.js +7 -0
  124. package/dist/utils/formatClockTime.d.ts +2 -0
  125. package/dist/utils/index.d.ts +1 -0
  126. package/dist/utils/index.js +20 -12
  127. package/package.json +24 -11
  128. package/dist/components/call-limbo/qr-code.d.ts +0 -4
  129. package/dist/components/offline-actions/OfflineActions.d.ts +0 -9
  130. package/dist/components/participants-panel/index.d.ts +0 -2
  131. package/dist/components/reconnecting-overlay/ReconnectingOverlay.d.ts +0 -12
  132. package/dist/components/space-header/share-qr.d.ts +0 -2
  133. package/dist/components/space-view/countdown.d.ts +0 -5
package/README.md CHANGED
@@ -42,7 +42,6 @@ export function SpacePage() {
42
42
  Forward the `getAccess` request unchanged to your authenticated backend. Pass it
43
43
  as the final `participants.issueAccess` argument with the server-only state from
44
44
  `getAccessRefreshState`; Chalk selects replacement only when recovery needs it.
45
- See the [web quickstart](../../../docs/sdk-web-quickstart.md) for the endpoint call.
46
45
 
47
46
  Sound cues are on by default. People already in a call hear a quiet chime when
48
47
  a new participant joins, at most once every three seconds. Initial rosters,
@@ -105,38 +104,16 @@ export function SpacePanel({ client }: { readonly client: SpaceClient }) {
105
104
  }
106
105
  ```
107
106
 
108
- The public hook set is closed: `useSpaceClient`, `useConnection`, `useSelf`,
109
- `useParticipants`, `useMedia`, `useChat`, `useOffline`, `useReactions`, `useWhiteboard`, and
110
- `useCan`. Each snapshot hook returns its stable `SpaceSnapshot` slice; use the
111
- client hook for commands.
107
+ Each snapshot hook (`useConnection`, `useSelf`, `useParticipants`, `useMedia`, `useChat`, `useOffline`, `useReactions`, `useWhiteboard`, `useCan`) returns its stable `SpaceSnapshot` slice. Use `useSpaceClient` for commands.
112
108
 
113
- `AccessGrant` remains opaque. The application backend creates it, `getAccess`
114
- returns it unchanged, and `SpaceClient` handles refresh and recovery.
109
+ ## Preview entrypoint
115
110
 
116
- ## Component maintenance
111
+ The `@q9labsai/chalk-react/preview` dev-tool entrypoint exposes the preview contract used by the first-party gallery. Application previews should use it instead of reaching into this package's `src` tree.
117
112
 
118
- `sdks/typescript/react/src/components/control-bar/control-bar-behavior.ts` owns the shared contracts, state, and commands for the
119
- controls. The component files own presentation.
113
+ ## Screen sharing
120
114
 
121
- The SDK-owned `@q9labsai/chalk-react/preview` dev-tool entrypoint exposes the
122
- preview contract used by the first-party gallery. Application previews should
123
- consume that entrypoint instead of reaching into this package's `src` tree.
115
+ `useScreenShare()` returns the local screen state, `capture: { surface, label }` and `setEnabled(enabled, options?)`. `surface` is only a hint, so read `capture.surface` for the actual choice. `audio: true` publishes a separate `screen_audio` track when the browser returns one. `hasAudio` reports local share audio, and `useParticipants()` exposes `media.screenShareHasAudio` for remote shares. Recordings exclude shared tab audio.
124
116
 
125
- ### Screen sharing
117
+ ## Message reactions
126
118
 
127
- `useScreenShare()` returns the local screen state, optional `capture: { surface, label }`, and `setEnabled(enabled, options?)`. For example, `await share.setEnabled(true, { surface: "browser", audio: true })` opens the browser picker with a tab hint. `surface` is only a hint; read `capture.surface` for what was actually chosen. `audio` publishes a separate `screen_audio` track when the browser returns one. `hasAudio` reports local share audio; `useParticipants()` exposes `media.screenShareHasAudio` for remote shares. `AudioOutput` plays it through the selected call speaker, using the existing participant/global volume controls. Recordings exclude shared tab audio. `useMedia().screenShare` exposes the same capture metadata.
128
-
129
- ### Message reactions
130
-
131
- ```ts
132
- await client.chat.react({ messageId, emoji: "👏", on: true });
133
- await client.chat.react({ messageId, emoji: "👏", on: false });
134
- ```
135
-
136
- The action sets a desired state, never toggles it. Retrying the same request leaves one membership (or none). Anyone with `sendChat` may react. `CHALK_REACTIONS` exports the fixed 24-emoji set shared with call reactions. Unsupported emoji are rejected. A message has at most 128 reaction memberships across all emoji; adding another returns `overloaded`, while removal remains available.
137
-
138
- Each message's `reactions` contains `{ emoji, count, participantIds }`; IDs identify who reacted and can be resolved through the participant roster. Old messages/servers may omit the wire fields; the client normalizes them to an empty list and revision `"0"`. New history includes current reactions. Loaded messages update live, and reconnecting reloads their reaction snapshots. Revisions keep delayed broadcasts/history responses from rolling state backward. Actions taken while reconnecting use the same persisted, participant-scoped offline queue as chat messages. They are cleared if the participant or Episode changes and fail if the message has expired. Deleting a message cascades to its reactions under existing retention.
139
-
140
- Message reactions are stored separately from recording facts and are not rendered or added to recording timelines yet. Recording validators accept all 24 call-reaction emoji.
141
-
142
- `useChat()` returns the same state and `react(input)` action. Each hook message always has a reactions array; each group adds `isMine` for the current participant. Public types are `MessageReaction`, `ReactChatMessage`, and `UseChatResult`.
119
+ `useChat()` returns messages with a `reactions` array of `{ emoji, count, participantIds }` (plus `isMine` per group) and `react({ messageId, emoji, on })`. The action sets a desired state and never toggles. The reaction rules (24-emoji `CHALK_REACTIONS`, 128 memberships per message, offline queueing) are in the `@q9labsai/chalk-client` README.
@@ -0,0 +1,80 @@
1
+ import {
2
+ Avatar,
3
+ useCan,
4
+ useConnection,
5
+ useParticipants,
6
+ useSelf,
7
+ useSpaceClient,
8
+ useWhiteboard
9
+ } from "./chunk-YOWY22N7.js";
10
+ import "./chunk-JDCFKSGV.js";
11
+ import "./chunk-ADIDI7AJ.js";
12
+
13
+ // src/components/board/Board.tsx
14
+ import { useContext, useMemo as useMemo2 } from "react";
15
+
16
+ // src/components/board/board-draw-policy.ts
17
+ import { useCallback, useMemo } from "react";
18
+ function useWhoCanDraw(toast) {
19
+ const client = useSpaceClient();
20
+ const isHost = useCan("manageWhiteboard");
21
+ const self = useSelf();
22
+ const { roster } = useParticipants();
23
+ const { access } = useWhiteboard();
24
+ const transport = client.whiteboard.transport();
25
+ const people = useMemo(
26
+ () => roster.filter((person) => person.participantId !== self.participantId && !person.capabilities.includes("manageWhiteboard")).map((person) => ({
27
+ id: person.participantId,
28
+ name: person.displayName,
29
+ picked: access.permissions.some((permission) => permission.participantId === person.participantId && permission.canDraw)
30
+ })),
31
+ [roster, self.participantId, access.permissions]
32
+ );
33
+ const onPolicy = useCallback(
34
+ (policy) => {
35
+ transport?.setDrawPolicy?.(policy).catch(() => toast({ type: "error", message: "Could not change who can draw. Try again." }));
36
+ },
37
+ [transport, toast]
38
+ );
39
+ const onPick = useCallback(
40
+ (id, picked) => {
41
+ transport?.setDrawPermission(id, picked).catch(() => toast({ type: "error", message: "Could not change who can draw. Try again." }));
42
+ },
43
+ [transport, toast]
44
+ );
45
+ if (!isHost || access.policy === null || !transport?.setDrawPolicy) return void 0;
46
+ return { policy: access.policy, people, onPolicy, onPick };
47
+ }
48
+
49
+ // src/components/board/Board.tsx
50
+ import { ChalkWhiteboardViewBounds } from "@q9labsai/chalk-client";
51
+ import { Board as SharedBoard, BoardToastContext } from "@q9labsai/chalk-whiteboard/react";
52
+ import { jsx } from "react/jsx-runtime";
53
+ var cursorAvatar = (name) => /* @__PURE__ */ jsx(Avatar, { name, size: "xs", animated: false, className: "chalk-board-cursor-avatar" });
54
+ function Board(props) {
55
+ const isHost = useCan("manageWhiteboard");
56
+ const connection = useConnection();
57
+ const boardSession = useWhiteboard().engine;
58
+ const self = useSelf();
59
+ const { roster } = useParticipants();
60
+ const participantIds = useMemo2(() => roster.map((person) => person.participantId), [roster]);
61
+ const whoCanDraw = useWhoCanDraw(useContext(BoardToastContext));
62
+ return /* @__PURE__ */ jsx(
63
+ SharedBoard,
64
+ {
65
+ ...props,
66
+ participantIds,
67
+ whoCanDraw,
68
+ isHost,
69
+ connectionStatus: connection.status,
70
+ sceneId: boardSession.sceneId,
71
+ sceneStatus: boardSession.status,
72
+ ownParticipantId: self.participantId,
73
+ viewBounds: ChalkWhiteboardViewBounds,
74
+ renderCursorAvatar: cursorAvatar
75
+ }
76
+ );
77
+ }
78
+ export {
79
+ Board
80
+ };
@@ -0,0 +1,114 @@
1
+ import {
2
+ lossOf,
3
+ rounded
4
+ } from "./chunk-Z5AASN4L.js";
5
+
6
+ // src/components/space-header/CallCharts.tsx
7
+ import { CALL_STATS_HISTORY } from "@q9labsai/chalk-client";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ var MIN_CHART_SAMPLES = 2;
10
+ var megabits = (kbps) => typeof kbps === "number" ? kbps / 1e3 : null;
11
+ var WIDTH = 328;
12
+ var HEIGHT = 36;
13
+ var LOSS_SCALE_PCT = 2;
14
+ var LATENCY_FLOOR_MS = 30;
15
+ var LATENCY_CEILING_MS = 60;
16
+ var BANDWIDTH_CEILING_MBPS = 4;
17
+ var slotX = (index, count) => (CALL_STATS_HISTORY - count + index) / (CALL_STATS_HISTORY - 1) * WIDTH;
18
+ function peak(...series) {
19
+ return Math.max(0, ...series.flatMap((points) => points.filter((value) => value !== null)));
20
+ }
21
+ function line(points, min, max) {
22
+ let path = "";
23
+ let drawing = false;
24
+ points.forEach((value, index) => {
25
+ if (value === null) {
26
+ drawing = false;
27
+ return;
28
+ }
29
+ const y = HEIGHT - 2 - (Math.min(max, Math.max(min, value)) - min) / (max - min) * (HEIGHT - 4);
30
+ path += `${drawing ? "L" : "M"}${slotX(index, points.length).toFixed(1)} ${y.toFixed(1)}`;
31
+ drawing = true;
32
+ });
33
+ return path;
34
+ }
35
+ function callCharts(samples) {
36
+ if (samples.length < MIN_CHART_SAMPLES) return null;
37
+ const latest = samples.at(-1);
38
+ if (!latest) return null;
39
+ const upload = samples.map((sample) => megabits(sample.send_bitrate_kbps));
40
+ const download = samples.map((sample) => megabits(sample.recv_bitrate_kbps));
41
+ return {
42
+ latency: { points: samples.map((sample) => sample.rtt_ms ?? null), headline: rounded(latest.rtt_ms ?? null, 0) },
43
+ loss: { points: samples.map(lossOf), headline: rounded(lossOf(latest), 1) },
44
+ bandwidth: { upload, download, headline: `${rounded(upload.at(-1) ?? null, 1)} / ${rounded(download.at(-1) ?? null, 1)}` }
45
+ };
46
+ }
47
+ function Row({ label, headline, unit, children }) {
48
+ return /* @__PURE__ */ jsxs("div", { className: "chalk-shell-chart", children: [
49
+ /* @__PURE__ */ jsxs("div", { className: "chalk-shell-chart-top", children: [
50
+ /* @__PURE__ */ jsx("span", { children: label }),
51
+ /* @__PURE__ */ jsxs("b", { children: [
52
+ headline,
53
+ /* @__PURE__ */ jsx("small", { children: unit })
54
+ ] })
55
+ ] }),
56
+ children
57
+ ] });
58
+ }
59
+ var Plot = ({ children }) => /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${WIDTH} ${HEIGHT}`, preserveAspectRatio: "none", "aria-hidden": "true", children });
60
+ function Stroke({ d, color, opacity }) {
61
+ return /* @__PURE__ */ jsx("path", { d, fill: "none", stroke: color, strokeWidth: "1.5", strokeLinejoin: "round", strokeOpacity: opacity, vectorEffect: "non-scaling-stroke" });
62
+ }
63
+ function CallChartsView({ samples }) {
64
+ const charts = callCharts(samples);
65
+ if (!charts) return null;
66
+ const { latency, loss, bandwidth } = charts;
67
+ const latencyMin = Math.min(LATENCY_FLOOR_MS, ...latency.points.filter((value) => value !== null));
68
+ const latencyMax = Math.max(LATENCY_CEILING_MS, peak(latency.points));
69
+ const latencyLine = line(latency.points, latencyMin, latencyMax);
70
+ const lossMax = Math.max(LOSS_SCALE_PCT, peak(loss.points));
71
+ const barWidth = WIDTH / CALL_STATS_HISTORY;
72
+ const bandwidthMax = Math.max(BANDWIDTH_CEILING_MBPS, peak(bandwidth.upload, bandwidth.download));
73
+ return /* @__PURE__ */ jsxs("div", { className: "chalk-shell-charts", role: "group", "aria-label": "Connection over the last minute", children: [
74
+ /* @__PURE__ */ jsx(Row, { label: "Latency", headline: latency.headline, unit: "ms", children: /* @__PURE__ */ jsxs(Plot, { children: [
75
+ latencyLine ? /* @__PURE__ */ jsx("path", { d: `${latencyLine}L${WIDTH} ${HEIGHT}L${slotX(0, latency.points.length)} ${HEIGHT}Z`, fill: "var(--chalk-positive)", fillOpacity: ".1" }) : null,
76
+ /* @__PURE__ */ jsx(Stroke, { d: latencyLine, color: "var(--chalk-positive)" })
77
+ ] }) }),
78
+ /* @__PURE__ */ jsx(Row, { label: "Packet loss", headline: loss.headline, unit: "%", children: /* @__PURE__ */ jsx(Plot, { children: loss.points.map((value, index) => {
79
+ if (value === null) return null;
80
+ const height = Math.max(2, value / lossMax * (HEIGHT - 2));
81
+ const fill = value >= 1 ? "var(--chalk-warning)" : value > 0 ? "var(--chalk-muted-text)" : "var(--chalk-line-strong)";
82
+ return /* @__PURE__ */ jsx("rect", { x: (CALL_STATS_HISTORY - loss.points.length + index) * barWidth + 1, y: HEIGHT - height, width: barWidth - 2, height, rx: "1", fill }, index);
83
+ }) }) }),
84
+ /* @__PURE__ */ jsx(
85
+ Row,
86
+ {
87
+ label: /* @__PURE__ */ jsxs("span", { className: "chalk-shell-chart-legend", children: [
88
+ /* @__PURE__ */ jsxs("span", { children: [
89
+ /* @__PURE__ */ jsx("i", { style: { background: "var(--chalk-text)" } }),
90
+ "Upload"
91
+ ] }),
92
+ /* @__PURE__ */ jsxs("span", { children: [
93
+ /* @__PURE__ */ jsx("i", { style: { background: "var(--chalk-accent)" } }),
94
+ "Download"
95
+ ] })
96
+ ] }),
97
+ headline: bandwidth.headline,
98
+ unit: "Mb/s",
99
+ children: /* @__PURE__ */ jsxs(Plot, { children: [
100
+ /* @__PURE__ */ jsx(Stroke, { d: line(bandwidth.download, 0, bandwidthMax), color: "var(--chalk-accent)" }),
101
+ /* @__PURE__ */ jsx(Stroke, { d: line(bandwidth.upload, 0, bandwidthMax), color: "var(--chalk-text)", opacity: 0.7 })
102
+ ] })
103
+ }
104
+ ),
105
+ /* @__PURE__ */ jsxs("div", { className: "chalk-shell-chart-axis", "aria-hidden": "true", children: [
106
+ /* @__PURE__ */ jsx("span", { children: "1 min ago" }),
107
+ /* @__PURE__ */ jsx("span", { children: "now" })
108
+ ] })
109
+ ] });
110
+ }
111
+ export {
112
+ CallChartsView,
113
+ callCharts
114
+ };
@@ -0,0 +1,200 @@
1
+ import {
2
+ connectionQuality
3
+ } from "./chunk-Z5AASN4L.js";
4
+ import {
5
+ GlyphSvg,
6
+ InviteLinkButton,
7
+ InviteQR,
8
+ canEncodeInviteQr
9
+ } from "./chunk-CQBYFA2W.js";
10
+ import {
11
+ ConnectionBars
12
+ } from "./chunk-26PBFST5.js";
13
+ import {
14
+ ShellIcon
15
+ } from "./chunk-PMGIER77.js";
16
+ import {
17
+ ChalkCopyButton,
18
+ ChalkIconButton,
19
+ ChalkSegmentedControl
20
+ } from "./chunk-PH3RC6T6.js";
21
+ import "./chunk-I6FSUWKG.js";
22
+ import "./chunk-ADIDI7AJ.js";
23
+
24
+ // src/components/space-header/CallDetails.tsx
25
+ import { lazy, Suspense, useState } from "react";
26
+
27
+ // src/components/space-header/CallMenuStyles.tsx
28
+ import { jsx } from "react/jsx-runtime";
29
+ function CallMenuStyles() {
30
+ return /* @__PURE__ */ jsx("style", { href: "chalk-call-menu", precedence: "default", children: CALL_MENU_CSS });
31
+ }
32
+ var CALL_MENU_CSS = `.chalk-shell-sep {height:1px;background:var(--chalk-line-strong);margin:var(--space-1) var(--space-3);}
33
+ .chalk-shell-detail-value {display:inline-flex;align-items:center;gap:var(--space-1);color:var(--chalk-muted-text);font-size:var(--type-body-sm);}
34
+ .chalk-shell-detail-value[data-tone="good"] {color:var(--chalk-positive);}
35
+ .chalk-shell-detail-value[data-tone="warn"] {color:var(--chalk-warning);}
36
+ .chalk-shell-detail-value[data-tone="bad"] {color:var(--chalk-danger-text);}
37
+ .chalk-invite-link-slug {min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--chalk-muted-text);font-size:var(--type-body-sm);}
38
+ .chalk-invite-link[data-variant="menu"] .chalk-invite-link-label {flex:none;}
39
+ .chalk-invite-link[data-variant="menu"] .chalk-invite-link-slug {flex:1;text-align:end;}
40
+ .chalk-invite-link[data-variant="menu"] .chalk-invite-link-end {font-size:var(--type-body-sm);}
41
+ .chalk-invite-link[data-variant="menu"][data-copied="true"] .chalk-invite-link-label {flex:1;}
42
+ .chalk-shell-qr-card {margin:var(--space-1) 0;padding:var(--space-2) var(--space-4);display:grid;place-items:center;}
43
+ .chalk-shell-qr-card[hidden] {display:none;}
44
+ .chalk-shell-detail-action[data-ringed] {outline:2px solid var(--chalk-focus);}
45
+ .chalk-shell-detail-helper {padding:0 var(--space-3) var(--space-2) calc(var(--space-10) + var(--space-0-5));margin-top:calc(var(--space-1) * -1);font-size:var(--type-caption);color:var(--chalk-muted-text);}
46
+ .chalk-shell-charts {display:grid;gap:var(--space-4);padding:var(--space-2) var(--space-3);}
47
+ .chalk-shell-chart-top {display:flex;justify-content:space-between;align-items:baseline;margin-bottom:var(--space-1-5);font-size:var(--type-caption);color:var(--chalk-muted-text);}
48
+ .chalk-shell-chart-top b {color:var(--chalk-text);font-size:var(--type-body-sm);font-weight:600;font-variant-numeric:tabular-nums;}
49
+ .chalk-shell-chart-top small {margin-inline-start:var(--space-0-5);color:var(--chalk-muted-text);font-size:var(--type-caption);font-weight:500;}
50
+ .chalk-shell-chart svg {display:block;width:100%;height:36px;overflow:visible;}
51
+ .chalk-shell-chart-legend {display:inline-flex;gap:var(--space-2);}
52
+ .chalk-shell-chart-legend i {display:inline-block;width:8px;height:2px;margin-inline-end:var(--space-1);border-radius:var(--corner-xs);vertical-align:middle;}
53
+ .chalk-shell-chart-axis {display:flex;justify-content:space-between;margin-top:calc(var(--space-1) * -1);font-size:var(--type-micro);color:var(--chalk-muted-text);}
54
+ .chalk-shell-diagnostics {
55
+ display: grid;
56
+ grid-template-columns: 84px 1fr;
57
+ gap: var(--space-1-5) var(--space-3);
58
+ margin: 0;
59
+ padding: var(--space-3) var(--space-3) var(--space-2);
60
+ font-size: var(--type-caption);
61
+ font-variant-numeric: tabular-nums;
62
+ }
63
+ .chalk-shell-diagnostics dt {color:var(--chalk-muted-text);}
64
+ .chalk-shell-diagnostics dd {margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;user-select:text;}
65
+ .chalk-shell-diagnostics dd[data-mono] {font-family:var(--chalk-mono);}
66
+ `;
67
+
68
+ // src/components/space-header/RowIcon.tsx
69
+ import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
70
+ var GLYPHS = {
71
+ qr: /* @__PURE__ */ jsxs(Fragment, { children: [
72
+ /* @__PURE__ */ jsx2("rect", { x: "3", y: "3", width: "7", height: "7", rx: "1.5" }),
73
+ /* @__PURE__ */ jsx2("rect", { x: "14", y: "3", width: "7", height: "7", rx: "1.5" }),
74
+ /* @__PURE__ */ jsx2("rect", { x: "3", y: "14", width: "7", height: "7", rx: "1.5" }),
75
+ /* @__PURE__ */ jsx2("path", { d: "M14 14h3v3M21 14v.01M17 21h4v-4M14 21v.01" })
76
+ ] }),
77
+ flag: /* @__PURE__ */ jsx2("path", { d: "M5 21V4M5 4h11.5l-2 4 2 4H5" }),
78
+ keyboard: /* @__PURE__ */ jsxs(Fragment, { children: [
79
+ /* @__PURE__ */ jsx2("rect", { x: "2", y: "5", width: "20", height: "14", rx: "2.5" }),
80
+ /* @__PURE__ */ jsx2("path", { d: "M6 9h.01M10 9h.01M14 9h.01M18 9h.01M6 13h.01M18 13h.01M10 13h4M8 16h8" })
81
+ ] }),
82
+ sun: /* @__PURE__ */ jsxs(Fragment, { children: [
83
+ /* @__PURE__ */ jsx2("circle", { cx: "12", cy: "12", r: "4" }),
84
+ /* @__PURE__ */ jsx2("path", { d: "M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4" })
85
+ ] }),
86
+ bell: /* @__PURE__ */ jsx2("path", { d: "M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9M10.3 21a1.94 1.94 0 0 0 3.4 0" })
87
+ };
88
+ function RowIcon({ name }) {
89
+ return /* @__PURE__ */ jsx2(GlyphSvg, { children: GLYPHS[name] });
90
+ }
91
+
92
+ // src/components/space-header/CallDetails.tsx
93
+ import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
94
+ var CallChartsView = lazy(() => import("./CallCharts-7ZQLN47C.js").then((module) => ({ default: module.CallChartsView })));
95
+ function CallDetails({
96
+ shareUrl,
97
+ spaceName,
98
+ onClose,
99
+ diagnostics = [],
100
+ network,
101
+ people,
102
+ isRecording = false,
103
+ colorScheme = "dark",
104
+ onColorSchemeChange,
105
+ sounds,
106
+ onSoundsChange,
107
+ onDialog,
108
+ onReportProblem,
109
+ revealConnection = false,
110
+ hideShortcuts = false
111
+ }) {
112
+ const link = shareUrl ?? (typeof location === "undefined" ? "" : location.href);
113
+ const qr = canEncodeInviteQr(link);
114
+ const [qrOpen, setQrOpen] = useState(false);
115
+ const [details, setDetails] = useState(revealConnection);
116
+ const quality = network ? connectionQuality(network) : null;
117
+ const facts = diagnostics.filter(({ label }) => label !== "Connection");
118
+ const summary = [isRecording ? "Recording" : null, people ? `${people.length} in call` : null].filter(Boolean).join(" \xB7 ");
119
+ return /* @__PURE__ */ jsxs2("div", { className: "chalk-details", children: [
120
+ /* @__PURE__ */ jsx3(CallMenuStyles, {}),
121
+ /* @__PURE__ */ jsxs2("div", { className: "chalk-shell-details-heading", children: [
122
+ /* @__PURE__ */ jsxs2("div", { children: [
123
+ /* @__PURE__ */ jsx3("h2", { children: spaceName }),
124
+ summary ? /* @__PURE__ */ jsxs2("p", { className: "chalk-shell-details-sub", children: [
125
+ isRecording ? /* @__PURE__ */ jsx3("i", { "aria-hidden": "true" }) : null,
126
+ summary
127
+ ] }) : null
128
+ ] }),
129
+ /* @__PURE__ */ jsx3(ChalkIconButton, { "aria-label": "Close", size: "sm", onClick: onClose, children: /* @__PURE__ */ jsx3("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx3("path", { d: "m6 6 12 12M6 18 18 6" }) }) })
130
+ ] }),
131
+ /* @__PURE__ */ jsx3(InviteLinkButton, { link, variant: "menu" }),
132
+ qr ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
133
+ /* @__PURE__ */ jsxs2("button", { type: "button", className: "chalk-shell-detail-action", "aria-expanded": qrOpen, "aria-controls": "chalk-details-qr", onClick: () => setQrOpen(!qrOpen), children: [
134
+ /* @__PURE__ */ jsx3("span", { className: "chalk-shell-detail-lead", children: /* @__PURE__ */ jsx3(RowIcon, { name: "qr" }) }),
135
+ /* @__PURE__ */ jsx3("span", { className: "chalk-shell-detail-label", children: "QR code" }),
136
+ /* @__PURE__ */ jsx3("span", { className: "chalk-shell-detail-trail", children: /* @__PURE__ */ jsx3(ShellIcon, { name: qrOpen ? "up2" : "down", size: 16 }) })
137
+ ] }),
138
+ /* @__PURE__ */ jsx3("div", { id: "chalk-details-qr", hidden: !qrOpen, className: "chalk-shell-qr-card", children: qrOpen ? /* @__PURE__ */ jsx3(InviteQR, { value: link }) : null })
139
+ ] }) : null,
140
+ network && quality ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
141
+ /* @__PURE__ */ jsx3("div", { className: "chalk-shell-sep" }),
142
+ /* @__PURE__ */ jsxs2("button", { type: "button", className: "chalk-shell-detail-action", "data-ringed": revealConnection || void 0, "aria-expanded": details, "aria-controls": "chalk-details-connection", onClick: () => setDetails(!details), children: [
143
+ /* @__PURE__ */ jsx3("span", { className: "chalk-shell-detail-lead", children: /* @__PURE__ */ jsx3(ConnectionBars, { level: quality.level }) }),
144
+ /* @__PURE__ */ jsx3("span", { className: "chalk-shell-detail-label", children: "Connection" }),
145
+ /* @__PURE__ */ jsxs2("span", { className: "chalk-shell-detail-value", "data-tone": quality.tone, children: [
146
+ quality.word,
147
+ /* @__PURE__ */ jsx3(ShellIcon, { name: details ? "up2" : "down", size: 16 })
148
+ ] })
149
+ ] }),
150
+ quality.helper ? /* @__PURE__ */ jsx3("p", { className: "chalk-shell-detail-helper", children: quality.helper }) : null,
151
+ /* @__PURE__ */ jsxs2("div", { id: "chalk-details-connection", hidden: !details, children: [
152
+ details && network.samples && network.samples.length > 1 ? /* @__PURE__ */ jsx3(Suspense, { fallback: null, children: /* @__PURE__ */ jsx3(CallChartsView, { samples: network.samples }) }) : null,
153
+ facts.length ? /* @__PURE__ */ jsx3("dl", { className: "chalk-shell-diagnostics", children: facts.map(({ label, value }) => /* @__PURE__ */ jsxs2("div", { style: { display: "contents" }, children: [
154
+ /* @__PURE__ */ jsx3("dt", { children: label }),
155
+ /* @__PURE__ */ jsx3("dd", { dir: "ltr", "data-mono": label === "Session" ? "" : void 0, children: value })
156
+ ] }, label)) }) : null,
157
+ /* @__PURE__ */ jsx3("div", { className: "chalk-shell-diagnostics-copy", children: /* @__PURE__ */ jsx3(ChalkCopyButton, { text: diagnostics.map(({ label, value }) => `${label}: ${value}`).join("\n"), label: "Copy diagnostics", announcement: "Diagnostics copied", showLabel: true }) })
158
+ ] })
159
+ ] }) : null,
160
+ /* @__PURE__ */ jsx3("div", { className: "chalk-shell-sep" }),
161
+ /* @__PURE__ */ jsxs2("div", { className: "chalk-details-row", children: [
162
+ /* @__PURE__ */ jsx3("span", { className: "chalk-shell-detail-lead", children: /* @__PURE__ */ jsx3(RowIcon, { name: "sun" }) }),
163
+ /* @__PURE__ */ jsx3("span", { className: "chalk-shell-detail-label", children: "Appearance" }),
164
+ /* @__PURE__ */ jsx3(
165
+ ChalkSegmentedControl,
166
+ {
167
+ size: "compact",
168
+ label: "Appearance",
169
+ value: colorScheme,
170
+ options: [
171
+ { value: "dark", label: "Dark" },
172
+ { value: "light", label: "Light" }
173
+ ],
174
+ onValueChange: (next) => onColorSchemeChange?.(next)
175
+ }
176
+ )
177
+ ] }),
178
+ /* @__PURE__ */ jsxs2("button", { type: "button", role: "switch", "aria-label": "Sounds", "aria-checked": sounds, className: "chalk-shell-detail-action", onClick: () => onSoundsChange(!sounds), children: [
179
+ /* @__PURE__ */ jsx3("span", { className: "chalk-shell-detail-lead", children: /* @__PURE__ */ jsx3(RowIcon, { name: "bell" }) }),
180
+ /* @__PURE__ */ jsx3("span", { className: "chalk-shell-detail-label", children: "Sounds" }),
181
+ /* @__PURE__ */ jsx3("span", { className: "chalk-switch", "aria-checked": sounds, "aria-hidden": "true", children: /* @__PURE__ */ jsx3("span", {}) })
182
+ ] }),
183
+ hideShortcuts ? null : /* @__PURE__ */ jsxs2("button", { type: "button", className: "chalk-shell-detail-action", "aria-haspopup": "dialog", onClick: () => onDialog("shortcuts"), children: [
184
+ /* @__PURE__ */ jsx3("span", { className: "chalk-shell-detail-lead", children: /* @__PURE__ */ jsx3(RowIcon, { name: "keyboard" }) }),
185
+ /* @__PURE__ */ jsx3("span", { className: "chalk-shell-detail-label", children: "Keyboard shortcuts" }),
186
+ /* @__PURE__ */ jsx3("span", { className: "chalk-shell-detail-trail", children: /* @__PURE__ */ jsx3(ShellIcon, { name: "right", size: 16 }) })
187
+ ] }),
188
+ onReportProblem ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
189
+ /* @__PURE__ */ jsx3("div", { className: "chalk-shell-sep" }),
190
+ /* @__PURE__ */ jsxs2("button", { type: "button", className: "chalk-shell-detail-action", "aria-haspopup": "dialog", onClick: () => onDialog("report"), children: [
191
+ /* @__PURE__ */ jsx3("span", { className: "chalk-shell-detail-lead", children: /* @__PURE__ */ jsx3(RowIcon, { name: "flag" }) }),
192
+ /* @__PURE__ */ jsx3("span", { className: "chalk-shell-detail-label", children: "Report a problem" }),
193
+ /* @__PURE__ */ jsx3("span", { className: "chalk-shell-detail-trail", children: /* @__PURE__ */ jsx3(ShellIcon, { name: "right", size: 16 }) })
194
+ ] })
195
+ ] }) : null
196
+ ] });
197
+ }
198
+ export {
199
+ CallDetails
200
+ };
@@ -0,0 +1,177 @@
1
+ import {
2
+ ChalkButton,
3
+ ChalkIconButton,
4
+ ChalkToggle
5
+ } from "./chunk-PH3RC6T6.js";
6
+ import "./chunk-I6FSUWKG.js";
7
+ import "./chunk-ADIDI7AJ.js";
8
+
9
+ // src/components/space-header/CallDialogContent.tsx
10
+ import { Dialog } from "@base-ui/react/dialog";
11
+ import { useRef, useState } from "react";
12
+ import { jsx, jsxs } from "react/jsx-runtime";
13
+ var REPORT_MAX_CHARACTERS = 1e3;
14
+ var CALL_SHORTCUTS = [
15
+ ["Mute or unmute", "\u2318 D"],
16
+ ["Turn camera on or off", "\u2318 E"],
17
+ ["Raise or lower hand", "\u2303 \u2318 H"],
18
+ ["Open or close chat", "\u2303 \u2318 C"],
19
+ ["Open or close people", "\u2303 \u2318 P"],
20
+ ["Switch layout", "\u2303 \u2318 L"],
21
+ ["Full screen", "\u2303 \u2318 F"],
22
+ ["Talk while muted", "Hold Space"],
23
+ ["Show shortcuts", "?"],
24
+ ["Close a menu or panel", "Esc"]
25
+ ];
26
+ function CallDialogContent({
27
+ kind,
28
+ open,
29
+ onClose,
30
+ onReportProblem,
31
+ diagnostics,
32
+ returnFocus,
33
+ focusScope,
34
+ unavailableReason
35
+ }) {
36
+ const container = useRef(null);
37
+ const reportInput = useRef(null);
38
+ const reportOpener = useRef(null);
39
+ const [text, setText] = useState("");
40
+ const [includeDiagnostics, setIncludeDiagnostics] = useState(false);
41
+ const [status, setStatus] = useState("idle");
42
+ const [error, setError] = useState("");
43
+ const [session, setSession] = useState({ kind, open });
44
+ if (session.kind !== kind || session.open !== open) {
45
+ setSession({ kind, open });
46
+ if (open && kind === "report") {
47
+ setText("");
48
+ setIncludeDiagnostics(false);
49
+ setError("");
50
+ setStatus("idle");
51
+ }
52
+ }
53
+ return /* @__PURE__ */ jsx(
54
+ "span",
55
+ {
56
+ ref: (element) => {
57
+ container.current = element?.closest("[data-chalk]") ?? element;
58
+ },
59
+ style: { display: "contents" },
60
+ children: /* @__PURE__ */ jsx(
61
+ Dialog.Root,
62
+ {
63
+ open,
64
+ onOpenChange: (open2, event) => {
65
+ if (!open2 && status === "sending") {
66
+ event.cancel();
67
+ return;
68
+ }
69
+ if (!open2) onClose();
70
+ },
71
+ children: /* @__PURE__ */ jsxs(Dialog.Portal, { container, children: [
72
+ /* @__PURE__ */ jsx(Dialog.Backdrop, { className: "chalk-shell-modal-backdrop" }),
73
+ /* @__PURE__ */ jsxs(
74
+ Dialog.Popup,
75
+ {
76
+ initialFocus: kind === "report" ? () => {
77
+ const opener = reportInput.current?.ownerDocument.activeElement;
78
+ reportOpener.current = opener instanceof HTMLElement && focusScope.current?.contains(opener) ? opener : null;
79
+ return reportInput.current;
80
+ } : void 0,
81
+ finalFocus: kind === "report" ? () => reportFocusTarget(focusScope.current, reportOpener.current) : returnFocus,
82
+ className: "chalk-shell-modal",
83
+ children: [
84
+ kind === "report" && status === "sent" ? null : /* @__PURE__ */ jsxs("div", { className: "chalk-shell-modal-heading", children: [
85
+ /* @__PURE__ */ jsx(Dialog.Title, { children: kind === "shortcuts" ? "Keyboard shortcuts" : "Report a problem" }),
86
+ /* @__PURE__ */ jsx(
87
+ Dialog.Close,
88
+ {
89
+ disabled: status === "sending",
90
+ render: /* @__PURE__ */ jsx(ChalkIconButton, { "aria-label": "Close", size: "sm", children: /* @__PURE__ */ jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "m6 6 12 12M6 18 18 6" }) }) })
91
+ }
92
+ )
93
+ ] }),
94
+ kind === "shortcuts" ? /* @__PURE__ */ jsx("dl", { className: "chalk-shell-shortcuts", children: CALL_SHORTCUTS.map(([label, keys]) => /* @__PURE__ */ jsxs("div", { style: { display: "contents" }, children: [
95
+ /* @__PURE__ */ jsx("dt", { children: label }),
96
+ /* @__PURE__ */ jsx("dd", { children: keys.split(" ").map((key, index) => /* @__PURE__ */ jsx("kbd", { children: key }, `${key}${index}`)) })
97
+ ] }, label)) }) : status === "sent" ? /* @__PURE__ */ jsxs("div", { className: "chalk-shell-report-sent", role: "status", children: [
98
+ /* @__PURE__ */ jsx("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "m5 12 4 4L19 6" }) }),
99
+ /* @__PURE__ */ jsx(Dialog.Title, { children: "Sent" }),
100
+ /* @__PURE__ */ jsx("p", { children: "Thanks. We\u2019ll look into it." }),
101
+ /* @__PURE__ */ jsx(ChalkButton, { variant: "solid", onClick: onClose, children: "Done" })
102
+ ] }) : /* @__PURE__ */ jsxs(
103
+ "form",
104
+ {
105
+ className: "chalk-shell-report",
106
+ onSubmit: (event) => {
107
+ event.preventDefault();
108
+ if (!text.trim() || !onReportProblem || status === "sending" || unavailableReason) return;
109
+ setStatus("sending");
110
+ setError("");
111
+ void Promise.resolve().then(() => onReportProblem({ description: text.trim(), diagnostics: includeDiagnostics && diagnostics.trim() ? diagnostics : void 0 })).then(
112
+ () => setStatus("sent"),
113
+ () => {
114
+ setStatus("idle");
115
+ setError("Your report could not be sent. Try again.");
116
+ }
117
+ );
118
+ },
119
+ children: [
120
+ /* @__PURE__ */ jsxs("div", { className: "chalk-shell-report-field", children: [
121
+ /* @__PURE__ */ jsx("textarea", { ref: reportInput, id: "chalk-problem", rows: 2, required: true, "aria-label": "What went wrong?", disabled: status === "sending", value: text, onChange: (event) => setText(Array.from(event.target.value).slice(0, REPORT_MAX_CHARACTERS).join("")), placeholder: "What went wrong?" }),
122
+ /* @__PURE__ */ jsxs("span", { className: "chalk-shell-report-count", "aria-hidden": "true", children: [
123
+ Array.from(text).length,
124
+ " / ",
125
+ REPORT_MAX_CHARACTERS
126
+ ] })
127
+ ] }),
128
+ diagnostics.trim() ? /* @__PURE__ */ jsxs("div", { className: "chalk-shell-report-check", children: [
129
+ /* @__PURE__ */ jsxs("span", { id: "chalk-report-diagnostics", children: [
130
+ "Include diagnostics",
131
+ /* @__PURE__ */ jsx("small", { children: "Session, connection and devices" })
132
+ ] }),
133
+ /* @__PURE__ */ jsx(ChalkToggle, { "aria-labelledby": "chalk-report-diagnostics", disabled: status === "sending", pressed: includeDiagnostics, onPressedChange: setIncludeDiagnostics })
134
+ ] }) : null,
135
+ error ? /* @__PURE__ */ jsx("p", { role: "alert", children: error }) : null,
136
+ unavailableReason ? /* @__PURE__ */ jsx("p", { role: "alert", children: unavailableReason }) : null,
137
+ /* @__PURE__ */ jsxs("div", { className: "chalk-shell-report-actions", children: [
138
+ /* @__PURE__ */ jsx(ChalkButton, { onClick: onClose, disabled: status === "sending", children: "Cancel" }),
139
+ /* @__PURE__ */ jsx(ChalkButton, { type: "submit", variant: "solid", disabled: !text.trim() || status === "sending" || Boolean(unavailableReason), children: status === "sending" ? "Sending\u2026" : "Send report" })
140
+ ] })
141
+ ]
142
+ }
143
+ )
144
+ ]
145
+ }
146
+ )
147
+ ] })
148
+ }
149
+ )
150
+ }
151
+ );
152
+ }
153
+ function reportFocusTarget(scope, opener) {
154
+ if (usableReportFocusTarget(opener)) return opener;
155
+ if (!scope?.isConnected) return false;
156
+ for (const selector of ['button[data-part="call-name"]', '[data-part="status-actions"] button', 'main, [role="main"]']) {
157
+ for (const target of [scope, ...scope.querySelectorAll(selector)]) {
158
+ if (!target.matches(selector) || !usableReportFocusTarget(target)) continue;
159
+ if (target.matches('main, [role="main"]')) target.tabIndex = -1;
160
+ return target;
161
+ }
162
+ }
163
+ return false;
164
+ }
165
+ function usableReportFocusTarget(target) {
166
+ if (!target?.isConnected || target.matches(':disabled, [aria-disabled="true"]') || target.closest("[inert]") || target.getClientRects().length === 0) return false;
167
+ const visibility = getComputedStyle(target).visibility;
168
+ if (visibility === "hidden" || visibility === "collapse") return false;
169
+ for (let element = target; element; element = element.parentElement) {
170
+ if (getComputedStyle(element).opacity === "0") return false;
171
+ }
172
+ return true;
173
+ }
174
+ export {
175
+ CALL_SHORTCUTS,
176
+ CallDialogContent
177
+ };