@100mslive/roomkit-react 0.3.23 → 0.3.24-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. package/dist/Accordion/Accordion.d.ts +134 -322
  2. package/dist/Accordion/index.d.ts +134 -322
  3. package/dist/Avatar/Avatar.d.ts +47 -141
  4. package/dist/Button/Button.d.ts +47 -141
  5. package/dist/Checkbox/Checkbox.d.ts +134 -322
  6. package/dist/Collapsible/Collapsible.d.ts +201 -483
  7. package/dist/ConferenceScreen-CLPW3BGP.css +2780 -0
  8. package/dist/{HLSView-S4NJF7Q2.css.map → ConferenceScreen-CLPW3BGP.css.map} +1 -1
  9. package/dist/ConferenceScreen-M6RBPTAJ.js +1774 -0
  10. package/dist/ConferenceScreen-M6RBPTAJ.js.map +7 -0
  11. package/dist/Divider/Divider.d.ts +134 -322
  12. package/dist/Dropdown/Dropdown.d.ts +804 -1932
  13. package/dist/EmbedView-DDSO7ZCV.js +17 -0
  14. package/dist/EmbedView-DDSO7ZCV.js.map +7 -0
  15. package/dist/EmbedView-HGIUZHKA.css +2780 -0
  16. package/dist/EmbedView-HGIUZHKA.css.map +7 -0
  17. package/dist/EmojiReaction-23JDKJD4.js +11 -0
  18. package/dist/EmojiReaction-23JDKJD4.js.map +7 -0
  19. package/dist/Fieldset/Fieldset.d.ts +47 -141
  20. package/dist/Footer/Footer.d.ts +536 -1288
  21. package/dist/{HLSView-S4NJF7Q2.css → HLSView-OW77EAAO.css} +3 -3
  22. package/dist/HLSView-OW77EAAO.css.map +7 -0
  23. package/dist/{HLSView-HYI6LLL6.js → HLSView-Q6GEB3UM.js} +38 -24
  24. package/dist/HLSView-Q6GEB3UM.js.map +7 -0
  25. package/dist/IconButton/IconButton.d.ts +47 -141
  26. package/dist/Input/Input.d.ts +362 -926
  27. package/dist/Label/Label.d.ts +47 -141
  28. package/dist/Layout/Box.d.ts +47 -141
  29. package/dist/Layout/Flex.d.ts +47 -141
  30. package/dist/LeaveScreen-BYTE73MT.js +556 -0
  31. package/dist/LeaveScreen-BYTE73MT.js.map +7 -0
  32. package/dist/LeaveScreen-P7AATEIF.css +2780 -0
  33. package/dist/LeaveScreen-P7AATEIF.css.map +7 -0
  34. package/dist/Link/Link.d.ts +47 -141
  35. package/dist/Modal/Dialog.d.ts +329 -987
  36. package/dist/Modal/DialogContent.d.ts +469 -1127
  37. package/dist/MoreSettings-LV5X2U6K.css +2780 -0
  38. package/dist/MoreSettings-LV5X2U6K.css.map +7 -0
  39. package/dist/MoreSettings-WSHMMNOC.js +16 -0
  40. package/dist/MoreSettings-WSHMMNOC.js.map +7 -0
  41. package/dist/PDFView-RIPRIIH6.css +2780 -0
  42. package/dist/PDFView-RIPRIIH6.css.map +7 -0
  43. package/dist/PDFView-ZFSG2ESE.js +84 -0
  44. package/dist/PDFView-ZFSG2ESE.js.map +7 -0
  45. package/dist/Pagination/StyledPagination.d.ts +268 -644
  46. package/dist/Polls-QWW5LTTB.js +1584 -0
  47. package/dist/Polls-QWW5LTTB.js.map +7 -0
  48. package/dist/Polls-ULYGUPPF.css +2780 -0
  49. package/dist/Polls-ULYGUPPF.css.map +7 -0
  50. package/dist/Popover/index.d.ts +201 -483
  51. package/dist/Prebuilt/IconButton.d.ts +134 -322
  52. package/dist/Prebuilt/components/Chat/ChatBody.d.ts +134 -322
  53. package/dist/Prebuilt/components/Leave/LeaveAtoms.d.ts +335 -805
  54. package/dist/Prebuilt/components/Notifications/DeviceChangeNotifications.d.ts +1 -0
  55. package/dist/Prebuilt/components/Notifications/ErrorNotifications.d.ts +1 -0
  56. package/dist/Prebuilt/components/Notifications/MessageNotifications.d.ts +1 -0
  57. package/dist/Prebuilt/components/Notifications/PollNotificationModal.d.ts +1 -0
  58. package/dist/Prebuilt/components/Notifications/RoleChangeNotification.d.ts +1 -0
  59. package/dist/Prebuilt/components/Settings/common.d.ts +134 -322
  60. package/dist/Progress/index.d.ts +134 -322
  61. package/dist/RadioGroup/RadioGroup.d.ts +201 -483
  62. package/dist/RaiseHand-K7NFLH7H.js +10 -0
  63. package/dist/RaiseHand-K7NFLH7H.js.map +7 -0
  64. package/dist/ReactSelect/ReactSelect.d.ts +670 -1610
  65. package/dist/RoleProminence-235AFT7F.js +116 -0
  66. package/dist/RoleProminence-235AFT7F.js.map +7 -0
  67. package/dist/RoleProminence-6XN3POS5.css +2780 -0
  68. package/dist/RoleProminence-6XN3POS5.css.map +7 -0
  69. package/dist/RoomDetailsPane-O5TFMTPI.css +2780 -0
  70. package/dist/RoomDetailsPane-O5TFMTPI.css.map +7 -0
  71. package/dist/RoomDetailsPane-RF3D3TDR.js +53 -0
  72. package/dist/RoomDetailsPane-RF3D3TDR.js.map +7 -0
  73. package/dist/ScreenshareLayout-KNEB3AJJ.css +2780 -0
  74. package/dist/ScreenshareLayout-KNEB3AJJ.css.map +7 -0
  75. package/dist/ScreenshareLayout-PSQMS3NC.js +358 -0
  76. package/dist/ScreenshareLayout-PSQMS3NC.js.map +7 -0
  77. package/dist/Select/Select.d.ts +201 -483
  78. package/dist/Sheet/Sheet.d.ts +329 -987
  79. package/dist/SidePaneTabs-I6DECE5R.css +2780 -0
  80. package/dist/SidePaneTabs-I6DECE5R.css.map +7 -0
  81. package/dist/SidePaneTabs-NXHBI2JB.js +1354 -0
  82. package/dist/SidePaneTabs-NXHBI2JB.js.map +7 -0
  83. package/dist/Slider/Slider.d.ts +47 -141
  84. package/dist/Stats/StyledStats.d.ts +402 -966
  85. package/dist/Switch/Switch.d.ts +47 -141
  86. package/dist/Tabs/Tabs.d.ts +268 -644
  87. package/dist/Text/Text.d.ts +47 -141
  88. package/dist/TextArea/TextArea.d.ts +47 -141
  89. package/dist/Theme/base.config.d.ts +26 -78
  90. package/dist/Theme/stitches.config.d.ts +1046 -1493
  91. package/dist/TileMenu/StyledMenuTile.d.ts +469 -1127
  92. package/dist/Toast/Toast.d.ts +382 -946
  93. package/dist/VBPicker-2CQ3IIO7.js +322 -0
  94. package/dist/VBPicker-2CQ3IIO7.js.map +7 -0
  95. package/dist/VBPicker-DCNYGO23.css +2780 -0
  96. package/dist/VBPicker-DCNYGO23.css.map +7 -0
  97. package/dist/Video/Video.d.ts +47 -141
  98. package/dist/VideoList/StyledVideoList.d.ts +201 -483
  99. package/dist/VideoTile/StyledVideoTile.d.ts +670 -1610
  100. package/dist/WaitingView-NZIUOXBI.js +10 -0
  101. package/dist/WaitingView-NZIUOXBI.js.map +7 -0
  102. package/dist/WhiteboardLayout-4YLFM3EY.js +96 -0
  103. package/dist/WhiteboardLayout-4YLFM3EY.js.map +7 -0
  104. package/dist/WhiteboardLayout-JUOBDFKY.css +2780 -0
  105. package/dist/WhiteboardLayout-JUOBDFKY.css.map +7 -0
  106. package/dist/android-perm-1.png +0 -0
  107. package/dist/audio-level.png +0 -0
  108. package/dist/chunk-3C7IESSI.js +254 -0
  109. package/dist/chunk-3C7IESSI.js.map +7 -0
  110. package/dist/chunk-7FD3VT6Q.js +114 -0
  111. package/dist/chunk-7FD3VT6Q.js.map +7 -0
  112. package/dist/chunk-AHI4HCY3.js +62 -0
  113. package/dist/chunk-AHI4HCY3.js.map +7 -0
  114. package/dist/chunk-BGSYLCVD.js +6337 -0
  115. package/dist/chunk-BGSYLCVD.js.map +7 -0
  116. package/dist/chunk-DANANDDE.js +418 -0
  117. package/dist/chunk-DANANDDE.js.map +7 -0
  118. package/dist/chunk-ETRNLEWQ.js +2658 -0
  119. package/dist/chunk-ETRNLEWQ.js.map +7 -0
  120. package/dist/chunk-EWPHJFZJ.js +487 -0
  121. package/dist/chunk-EWPHJFZJ.js.map +7 -0
  122. package/dist/chunk-F63YJBI4.js +98 -0
  123. package/dist/chunk-F63YJBI4.js.map +7 -0
  124. package/dist/chunk-GLAJUP3O.js +576 -0
  125. package/dist/chunk-GLAJUP3O.js.map +7 -0
  126. package/dist/chunk-GOXRTCTY.js +90 -0
  127. package/dist/chunk-GOXRTCTY.js.map +7 -0
  128. package/dist/chunk-HMCBZI3A.js +59 -0
  129. package/dist/chunk-HMCBZI3A.js.map +7 -0
  130. package/dist/chunk-HVYTC3PX.js +171 -0
  131. package/dist/chunk-HVYTC3PX.js.map +7 -0
  132. package/dist/chunk-LJVP6AWF.js +262 -0
  133. package/dist/chunk-LJVP6AWF.js.map +7 -0
  134. package/dist/chunk-LXJGCRKM.js +30 -0
  135. package/dist/chunk-LXJGCRKM.js.map +7 -0
  136. package/dist/chunk-MG3UGW66.js +16800 -0
  137. package/dist/chunk-MG3UGW66.js.map +7 -0
  138. package/dist/chunk-MUKUP7JU.js +161 -0
  139. package/dist/chunk-MUKUP7JU.js.map +7 -0
  140. package/dist/chunk-OV6MVDCL.js +41 -0
  141. package/dist/chunk-OV6MVDCL.js.map +7 -0
  142. package/dist/chunk-P6NV2XO4.js +178 -0
  143. package/dist/chunk-P6NV2XO4.js.map +7 -0
  144. package/dist/chunk-REL3HBSD.js +71 -0
  145. package/dist/chunk-REL3HBSD.js.map +7 -0
  146. package/dist/chunk-U4SQBXPZ.js +830 -0
  147. package/dist/chunk-U4SQBXPZ.js.map +7 -0
  148. package/dist/chunk-YEL5ZTFU.js +136 -0
  149. package/dist/chunk-YEL5ZTFU.js.map +7 -0
  150. package/dist/empty-chat.svg +12 -0
  151. package/dist/index.cjs.css +2 -2
  152. package/dist/index.cjs.css.map +1 -1
  153. package/dist/index.cjs.js +21713 -21508
  154. package/dist/index.cjs.js.map +4 -4
  155. package/dist/index.css +2 -2
  156. package/dist/index.css.map +1 -1
  157. package/dist/index.js +25 -15
  158. package/dist/ios-perm-0.png +0 -0
  159. package/dist/meta.cjs.json +5515 -5153
  160. package/dist/meta.esbuild.json +8998 -6138
  161. package/dist/pdf-share.png +0 -0
  162. package/dist/screen-share.png +0 -0
  163. package/dist/transaction_error.svg +12 -0
  164. package/package.json +8 -8
  165. package/src/Avatar/Avatar.tsx +1 -1
  166. package/src/Popover/Popover.stories.tsx +1 -1
  167. package/src/Prebuilt/App.tsx +6 -2
  168. package/src/Prebuilt/components/Chat/Chat.tsx +12 -8
  169. package/src/Prebuilt/components/Chat/ChatFooter.tsx +1 -1
  170. package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.tsx +14 -1
  171. package/src/Prebuilt/components/Notifications/DeviceChangeNotifications.tsx +18 -0
  172. package/src/Prebuilt/components/Notifications/ErrorNotifications.tsx +56 -0
  173. package/src/Prebuilt/components/Notifications/MessageNotifications.tsx +24 -0
  174. package/src/Prebuilt/components/Notifications/Notifications.tsx +13 -171
  175. package/src/Prebuilt/components/Notifications/PeerNotifications.tsx +9 -2
  176. package/src/Prebuilt/components/Notifications/PollNotificationModal.tsx +71 -0
  177. package/src/Prebuilt/components/Notifications/ReconnectNotifications.tsx +1 -5
  178. package/src/Prebuilt/components/Notifications/RoleChangeNotification.tsx +24 -0
  179. package/src/Prebuilt/components/Notifications/TrackBulkUnmuteModal.tsx +7 -5
  180. package/src/Prebuilt/components/Notifications/TrackNotifications.tsx +23 -1
  181. package/src/Prebuilt/components/Notifications/TrackUnmuteModal.tsx +13 -5
  182. package/src/Prebuilt/components/StatsForNerds.jsx +122 -9
  183. package/src/Prebuilt/components/VideoLayouts/GridLayout.tsx +43 -31
  184. package/src/Prebuilt/components/VideoLayouts/ProminenceLayout.tsx +2 -2
  185. package/src/Prebuilt/components/VirtualBackground/VBOption.tsx +3 -1
  186. package/src/Prebuilt/components/VirtualBackground/VBPicker.tsx +6 -0
  187. package/src/Prebuilt/layouts/HLSView.jsx +1 -0
  188. package/src/Prebuilt/layouts/PDFView.jsx +1 -0
  189. package/src/Prebuilt/layouts/SidePane.tsx +12 -6
  190. package/src/Prebuilt/layouts/VideoStreamingSection.tsx +35 -34
  191. package/src/Prebuilt/layouts/WaitingView.tsx +2 -2
  192. package/dist/HLSView-HYI6LLL6.js.map +0 -7
  193. package/dist/chunk-LRJSQMZ4.js +0 -34759
  194. package/dist/chunk-LRJSQMZ4.js.map +0 -7
@@ -0,0 +1,2658 @@
1
+ import {
2
+ StopRecordingInSheet
3
+ } from "./chunk-3C7IESSI.js";
4
+ import {
5
+ EmojiReaction
6
+ } from "./chunk-7FD3VT6Q.js";
7
+ import {
8
+ useMyMetadata
9
+ } from "./chunk-AHI4HCY3.js";
10
+ import {
11
+ Accordion,
12
+ ActionTile,
13
+ Button,
14
+ ChangeNameModal,
15
+ Checkbox,
16
+ Dialog,
17
+ DialogContent,
18
+ DialogDropdownTrigger,
19
+ DialogRow,
20
+ DialogSelect,
21
+ Ee,
22
+ HorizontalDivider,
23
+ Input,
24
+ Label,
25
+ Loading,
26
+ NoiseCancellation,
27
+ PictureInPicture,
28
+ RadioGroup,
29
+ RoleChangeModal,
30
+ SettingsModal_default,
31
+ Sheet,
32
+ Switch,
33
+ TextArea,
34
+ formatBytes,
35
+ trackSourceOptions,
36
+ trackTypeOptions,
37
+ useDropdownSelection,
38
+ useIsSidepaneTypeOpen,
39
+ usePIPWindow,
40
+ usePollViewToggle,
41
+ useSheetToggle,
42
+ useSidepaneToggle
43
+ } from "./chunk-MG3UGW66.js";
44
+ import {
45
+ Text
46
+ } from "./chunk-MUKUP7JU.js";
47
+ import {
48
+ Dropdown,
49
+ ToastManager,
50
+ useDropdownList,
51
+ useFilteredRoles,
52
+ useLandscapeHLSStream,
53
+ useMobileHLSStream,
54
+ useRecordingHandler
55
+ } from "./chunk-DANANDDE.js";
56
+ import {
57
+ Box,
58
+ Flex
59
+ } from "./chunk-GOXRTCTY.js";
60
+ import {
61
+ IconButton,
62
+ IconButton_default,
63
+ Tooltip,
64
+ getFormattedCount,
65
+ usePinnedTrack,
66
+ useRoomLayoutConferencingScreen,
67
+ useRoomLayoutHeader,
68
+ useSetAppDataByKey,
69
+ useSetIsCaptionEnabled,
70
+ useSetSubscribedChatSelector,
71
+ useSetUiSettings,
72
+ useShowPolls
73
+ } from "./chunk-BGSYLCVD.js";
74
+ import {
75
+ APP_DATA,
76
+ CAPTION_TOAST,
77
+ CHAT_SELECTOR,
78
+ DEFAULT_PORTAL_CONTAINER,
79
+ RTMP_RECORD_DEFAULT_RESOLUTION,
80
+ RTMP_RECORD_RESOLUTION_MAX,
81
+ RTMP_RECORD_RESOLUTION_MIN,
82
+ SHEET_OPTIONS,
83
+ SIDE_PANE_OPTIONS,
84
+ UI_SETTINGS,
85
+ __async,
86
+ __publicField,
87
+ __spreadValues,
88
+ config,
89
+ getCssText,
90
+ init_define_process_env,
91
+ isMacOS,
92
+ styled
93
+ } from "./chunk-GLAJUP3O.js";
94
+
95
+ // src/Prebuilt/components/MoreSettings/MoreSettings.tsx
96
+ init_define_process_env();
97
+ import React20 from "react";
98
+ import { useMedia as useMedia5 } from "react-use";
99
+
100
+ // src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.tsx
101
+ init_define_process_env();
102
+ import React18, { Fragment as Fragment2, useState as useState12 } from "react";
103
+ import { HMSHLSPlayer } from "@100mslive/hls-player";
104
+ import { match as match2 } from "ts-pattern";
105
+ import {
106
+ HMSTranscriptionMode as HMSTranscriptionMode2,
107
+ selectAppData,
108
+ selectIsTranscriptionAllowedByMode,
109
+ selectIsTranscriptionEnabled as selectIsTranscriptionEnabled2,
110
+ selectLocalPeerID as selectLocalPeerID4,
111
+ useHMSActions as useHMSActions12,
112
+ useHMSStore as useHMSStore11
113
+ } from "@100mslive/react-sdk";
114
+ import {
115
+ BrbIcon,
116
+ CheckIcon as CheckIcon2,
117
+ HamburgerMenuIcon,
118
+ InfoIcon as InfoIcon2,
119
+ OpenCaptionIcon,
120
+ PipIcon as PipIcon2,
121
+ SettingsIcon
122
+ } from "@100mslive/react-icons";
123
+
124
+ // src/Prebuilt/components/PIP/index.jsx
125
+ init_define_process_env();
126
+ import React2 from "react";
127
+
128
+ // src/Prebuilt/components/PIP/PIPComponent.tsx
129
+ init_define_process_env();
130
+ import React, { useCallback, useEffect, useState } from "react";
131
+ import { selectPeers, selectTracksMap, useHMSActions, useHMSVanillaStore } from "@100mslive/react-sdk";
132
+ import { PipIcon } from "@100mslive/react-icons";
133
+
134
+ // src/Prebuilt/components/PIP/SetupMediaSession.js
135
+ init_define_process_env();
136
+ import { selectIsLocalAudioEnabled, selectIsLocalVideoEnabled } from "@100mslive/react-sdk";
137
+ var SetupMediaSession = class {
138
+ constructor() {
139
+ __publicField(this, "setup", (actions, store) => {
140
+ this.actions = actions;
141
+ this.store = store;
142
+ this.initState();
143
+ this.setUpHandlers();
144
+ });
145
+ __publicField(this, "initState", () => {
146
+ var _a, _b, _c, _d;
147
+ const isMicActive = this.store.getState(selectIsLocalAudioEnabled);
148
+ const isCamActive = this.store.getState(selectIsLocalVideoEnabled);
149
+ (_b = (_a = navigator.mediaSession) == null ? void 0 : _a.setMicrophoneActive) == null ? void 0 : _b.call(_a, isMicActive);
150
+ (_d = (_c = navigator.mediaSession) == null ? void 0 : _c.setCameraActive) == null ? void 0 : _d.call(_c, isCamActive);
151
+ this.store.subscribe((isMicActive2) => {
152
+ var _a2, _b2;
153
+ (_b2 = (_a2 = navigator.mediaSession) == null ? void 0 : _a2.setMicrophoneActive) == null ? void 0 : _b2.call(_a2, isMicActive2);
154
+ }, selectIsLocalAudioEnabled);
155
+ this.store.subscribe((isCamActive2) => {
156
+ var _a2, _b2;
157
+ (_b2 = (_a2 = navigator.mediaSession) == null ? void 0 : _a2.setCameraActive) == null ? void 0 : _b2.call(_a2, isCamActive2);
158
+ }, selectIsLocalVideoEnabled);
159
+ });
160
+ __publicField(this, "toggleMic", () => __async(this, null, function* () {
161
+ console.log("toggle mic clicked in pip");
162
+ const current = this.store.getState(selectIsLocalAudioEnabled);
163
+ yield this.actions.setLocalAudioEnabled(!current);
164
+ }));
165
+ __publicField(this, "toggleCam", () => __async(this, null, function* () {
166
+ console.log("toggle cam clicked in pip");
167
+ const current = this.store.getState(selectIsLocalVideoEnabled);
168
+ yield this.actions.setLocalVideoEnabled(!current);
169
+ }));
170
+ __publicField(this, "leave", () => {
171
+ console.log("leave called from pip");
172
+ this.actions.leave();
173
+ });
174
+ __publicField(this, "setUpHandlers", () => {
175
+ if (navigator.mediaSession) {
176
+ try {
177
+ navigator.mediaSession.setActionHandler("togglemicrophone", this.toggleMic);
178
+ navigator.mediaSession.setActionHandler("togglecamera", this.toggleCam);
179
+ navigator.mediaSession.setActionHandler("hangup", this.leave);
180
+ } catch (err) {
181
+ console.error("error in setting media session handlers", err);
182
+ }
183
+ }
184
+ });
185
+ }
186
+ };
187
+ var MediaSession = new SetupMediaSession();
188
+
189
+ // src/Prebuilt/components/PIP/PIPComponent.tsx
190
+ var PIPComponent = ({ content = null }) => {
191
+ const [isPipOn, setIsPipOn] = useState(PictureInPicture.isOn());
192
+ const hmsActions = useHMSActions();
193
+ const store = useHMSVanillaStore();
194
+ const onPipToggle = useCallback(() => {
195
+ if (!isPipOn) {
196
+ PictureInPicture.start(hmsActions, setIsPipOn).catch((err) => console.error("error in starting pip", err));
197
+ MediaSession.setup(hmsActions, store);
198
+ } else {
199
+ PictureInPicture.stop().catch((err) => console.error("error in stopping pip", err));
200
+ }
201
+ }, [hmsActions, isPipOn, store]);
202
+ if (!PictureInPicture.isSupported()) {
203
+ return null;
204
+ }
205
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, content ? /* @__PURE__ */ React.createElement(Flex, { css: { w: "100%" }, onClick: () => onPipToggle(), "data-testid": "pip_btn" }, content) : /* @__PURE__ */ React.createElement(Tooltip, { title: `${isPipOn ? "Deactivate" : "Activate"} picture in picture view` }, /* @__PURE__ */ React.createElement(IconButton_default, { active: !isPipOn, key: "pip", onClick: () => onPipToggle(), "data-testid": "pip_btn" }, /* @__PURE__ */ React.createElement(PipIcon, null))));
206
+ };
207
+ var ActivatedPIP = () => {
208
+ const store = useHMSVanillaStore();
209
+ const pinnedTrack = usePinnedTrack();
210
+ useEffect(() => {
211
+ function subscribeToStore() {
212
+ return store.subscribe((tracksMap) => {
213
+ let pipPeers = store.getState(selectPeers);
214
+ if (pinnedTrack) {
215
+ pipPeers = pipPeers.filter((peer) => pinnedTrack.peerId === peer.id);
216
+ }
217
+ PictureInPicture.updatePeersAndTracks(pipPeers, tracksMap).catch((err) => {
218
+ console.error("error in updating pip", err);
219
+ });
220
+ }, selectTracksMap);
221
+ }
222
+ let unsubscribe = PictureInPicture.isOn() ? subscribeToStore() : void 0;
223
+ PictureInPicture.listenToStateChange((isOn) => {
224
+ if (isOn) {
225
+ if (!unsubscribe) {
226
+ unsubscribe = subscribeToStore();
227
+ }
228
+ } else {
229
+ unsubscribe == null ? void 0 : unsubscribe();
230
+ unsubscribe = void 0;
231
+ }
232
+ });
233
+ return () => {
234
+ unsubscribe == null ? void 0 : unsubscribe();
235
+ unsubscribe = void 0;
236
+ };
237
+ }, [pinnedTrack, store]);
238
+ return /* @__PURE__ */ React.createElement(React.Fragment, null);
239
+ };
240
+ var PIPComponent_default = PIPComponent;
241
+
242
+ // src/Prebuilt/components/PIP/index.jsx
243
+ var PIP = ({ content = null }) => {
244
+ return /* @__PURE__ */ React2.createElement(PIPComponent_default, { content });
245
+ };
246
+
247
+ // src/Prebuilt/components/PIP/PIPChat.tsx
248
+ init_define_process_env();
249
+ import React7, { useCallback as useCallback6, useEffect as useEffect4, useMemo as useMemo2, useState as useState5 } from "react";
250
+ import {
251
+ selectHMSMessages as selectHMSMessages2,
252
+ selectLocalPeerID as selectLocalPeerID2,
253
+ selectPeerNameByID as selectPeerNameByID3,
254
+ selectSessionStore as selectSessionStore5,
255
+ selectUnreadHMSMessagesCount as selectUnreadHMSMessagesCount2,
256
+ useHMSStore as useHMSStore5
257
+ } from "@100mslive/react-sdk";
258
+ import { SendIcon } from "@100mslive/react-icons";
259
+
260
+ // src/Prebuilt/components/Chat/ChatBody.tsx
261
+ init_define_process_env();
262
+ import React6, { Fragment, useCallback as useCallback5, useEffect as useEffect3, useLayoutEffect, useMemo, useRef, useState as useState4 } from "react";
263
+ import { useMedia as useMedia2 } from "react-use";
264
+ import AutoSizer from "react-virtualized-auto-sizer";
265
+ import { VariableSizeList } from "react-window";
266
+ import {
267
+ selectHMSMessages,
268
+ selectLocalPeerID,
269
+ selectLocalPeerName as selectLocalPeerName2,
270
+ selectLocalPeerRoleName,
271
+ selectPeerNameByID as selectPeerNameByID2,
272
+ selectSessionStore as selectSessionStore4,
273
+ selectUnreadHMSMessagesCount,
274
+ useHMSActions as useHMSActions5,
275
+ useHMSStore as useHMSStore4,
276
+ useHMSVanillaStore as useHMSVanillaStore3
277
+ } from "@100mslive/react-sdk";
278
+ import { SolidPinIcon } from "@100mslive/react-icons";
279
+
280
+ // src/Prebuilt/components/Chat/ChatActions.tsx
281
+ init_define_process_env();
282
+ import React4, { useCallback as useCallback4, useState as useState2 } from "react";
283
+ import { selectLocalPeerName, selectPermissions, useHMSActions as useHMSActions4, useHMSStore as useHMSStore2 } from "@100mslive/react-sdk";
284
+ import {
285
+ CopyIcon,
286
+ CrossCircleIcon,
287
+ CrossIcon,
288
+ EyeCloseIcon,
289
+ PeopleRemoveIcon,
290
+ PinIcon,
291
+ ReplyGroupIcon,
292
+ ReplyIcon,
293
+ VerticalMenuIcon
294
+ } from "@100mslive/react-icons";
295
+
296
+ // src/Prebuilt/components/Chat/MwebChatOption.tsx
297
+ init_define_process_env();
298
+ import React3 from "react";
299
+ var MwebChatOption = ({
300
+ icon,
301
+ text,
302
+ onClick,
303
+ color = "$on_surface_high"
304
+ }) => {
305
+ return /* @__PURE__ */ React3.createElement(Flex, { align: "center", css: { w: "100%", color, cursor: "pointer", gap: "$4", p: "$8" }, onClick }, icon, /* @__PURE__ */ React3.createElement(Text, { variant: "sm", css: { color, fontWeight: "$semiBold" } }, text));
306
+ };
307
+
308
+ // src/Prebuilt/components/hooks/useChatBlacklist.ts
309
+ init_define_process_env();
310
+ import { useCallback as useCallback2 } from "react";
311
+ import { selectLocalPeer, selectSessionStore, useHMSActions as useHMSActions2, useHMSStore } from "@100mslive/react-sdk";
312
+ var useChatBlacklist = (sessionStoreKey) => {
313
+ const hmsActions = useHMSActions2();
314
+ const blacklistedIDs = useHMSStore(selectSessionStore(sessionStoreKey));
315
+ const blacklistItem = useCallback2(
316
+ (blacklistID) => __async(void 0, null, function* () {
317
+ yield hmsActions.sessionStore.set(sessionStoreKey, [...blacklistedIDs || [], blacklistID]).catch((err) => ToastManager.addToast({ title: err.description }));
318
+ }),
319
+ [hmsActions, sessionStoreKey, blacklistedIDs]
320
+ );
321
+ return { blacklistItem, blacklistedIDs };
322
+ };
323
+ var useIsPeerBlacklisted = ({ local = false, peerCustomerUserId = "" }) => {
324
+ const localPeer = useHMSStore(selectLocalPeer);
325
+ const blacklistedPeerIDs = useHMSStore(selectSessionStore("chatPeerBlacklist" /* CHAT_PEER_BLACKLIST */)) || [];
326
+ return blacklistedPeerIDs == null ? void 0 : blacklistedPeerIDs.includes(local ? localPeer == null ? void 0 : localPeer.customerUserId : peerCustomerUserId);
327
+ };
328
+
329
+ // src/Prebuilt/components/hooks/usePinnedMessages.ts
330
+ init_define_process_env();
331
+ import { useCallback as useCallback3 } from "react";
332
+ import {
333
+ selectPeerNameByID,
334
+ selectSessionStore as selectSessionStore2,
335
+ useHMSActions as useHMSActions3,
336
+ useHMSVanillaStore as useHMSVanillaStore2
337
+ } from "@100mslive/react-sdk";
338
+ var usePinnedMessages = () => {
339
+ const hmsActions = useHMSActions3();
340
+ const vanillaStore = useHMSVanillaStore2();
341
+ const setPinnedMessages = useCallback3(
342
+ (message, pinnedBy) => __async(void 0, null, function* () {
343
+ const peerName = vanillaStore.getState(selectPeerNameByID(message == null ? void 0 : message.sender)) || (message == null ? void 0 : message.senderName);
344
+ const newPinnedMessage = { text: "", id: message.id, pinnedBy };
345
+ if (message && peerName) {
346
+ newPinnedMessage["text"] = `${peerName}: ${message.message}`;
347
+ } else if (message) {
348
+ newPinnedMessage["text"] = message.message;
349
+ }
350
+ const pinnedMessages = vanillaStore.getState(selectSessionStore2("pinnedMessages" /* PINNED_MESSAGES */)) || [];
351
+ if (!(pinnedMessages == null ? void 0 : pinnedMessages.find((pinnedMessage) => pinnedMessage.id === newPinnedMessage.id))) {
352
+ yield hmsActions.sessionStore.set("pinnedMessages" /* PINNED_MESSAGES */, [...pinnedMessages, newPinnedMessage].slice(-3)).catch((err) => ToastManager.addToast({ title: err.description }));
353
+ }
354
+ }),
355
+ [hmsActions, vanillaStore]
356
+ );
357
+ const removePinnedMessage = useCallback3(
358
+ (indexToRemove) => __async(void 0, null, function* () {
359
+ const pinnedMessages = vanillaStore.getState(selectSessionStore2("pinnedMessages" /* PINNED_MESSAGES */)) || [];
360
+ if (pinnedMessages[indexToRemove]) {
361
+ yield hmsActions.sessionStore.set(
362
+ "pinnedMessages" /* PINNED_MESSAGES */,
363
+ pinnedMessages.filter((_, index) => index !== indexToRemove)
364
+ ).catch((err) => ToastManager.addToast({ title: err.description }));
365
+ }
366
+ }),
367
+ [hmsActions, vanillaStore]
368
+ );
369
+ const unpinBlacklistedMessages = useCallback3(
370
+ (blacklistedMessageIDSet) => __async(void 0, null, function* () {
371
+ const pinnedMessages = vanillaStore.getState(selectSessionStore2("pinnedMessages" /* PINNED_MESSAGES */)) || [];
372
+ const filteredPinnedMessages = pinnedMessages == null ? void 0 : pinnedMessages.filter(
373
+ (pinnedMessage) => !(blacklistedMessageIDSet == null ? void 0 : blacklistedMessageIDSet.has(pinnedMessage.id))
374
+ );
375
+ yield hmsActions.sessionStore.set("pinnedMessages" /* PINNED_MESSAGES */, filteredPinnedMessages).catch((err) => ToastManager.addToast({ title: err.description }));
376
+ }),
377
+ [hmsActions, vanillaStore]
378
+ );
379
+ return { setPinnedMessages, removePinnedMessage, unpinBlacklistedMessages };
380
+ };
381
+
382
+ // src/Prebuilt/components/Chat/ChatActions.tsx
383
+ var iconStyle = { height: "1.125rem", width: "1.125rem" };
384
+ var tooltipBoxCSS = {
385
+ fontSize: "$xs",
386
+ backgroundColor: "$surface_default",
387
+ p: "$1 $5",
388
+ fontWeight: "$regular",
389
+ borderRadius: "$3"
390
+ };
391
+ var ChatActions = ({
392
+ showPinAction,
393
+ onReply,
394
+ onReplyGroup,
395
+ showReply,
396
+ message,
397
+ sentByLocalPeer,
398
+ isMobile,
399
+ openSheet,
400
+ setOpenSheet
401
+ }) => {
402
+ var _a, _b;
403
+ const { elements } = useRoomLayoutConferencingScreen();
404
+ const { can_hide_message = false, can_block_user = false } = ((_a = elements == null ? void 0 : elements.chat) == null ? void 0 : _a.real_time_controls) || {};
405
+ const { roles_whitelist = [] } = (elements == null ? void 0 : elements.chat) || {};
406
+ const [open, setOpen] = useState2(false);
407
+ const actions = useHMSActions4();
408
+ const canRemoveOthers = (_b = useHMSStore2(selectPermissions)) == null ? void 0 : _b.removeOthers;
409
+ const { blacklistItem: blacklistPeer } = useChatBlacklist("chatPeerBlacklist" /* CHAT_PEER_BLACKLIST */);
410
+ const localPeerName = useHMSStore2(selectLocalPeerName);
411
+ const { setPinnedMessages, unpinBlacklistedMessages } = usePinnedMessages();
412
+ const { blacklistItem: blacklistMessage, blacklistedIDs: blacklistedMessageIDs } = useChatBlacklist(
413
+ "chatMessageBlacklist" /* CHAT_MESSAGE_BLACKLIST */
414
+ );
415
+ const isSenderBlocked = useIsPeerBlacklisted({ peerCustomerUserId: message.senderUserId });
416
+ const updatePinnedMessages = useCallback4(
417
+ (messageID = "") => {
418
+ const blacklistedMessageIDSet = /* @__PURE__ */ new Set([...blacklistedMessageIDs || [], messageID]);
419
+ unpinBlacklistedMessages(blacklistedMessageIDSet);
420
+ },
421
+ [blacklistedMessageIDs, unpinBlacklistedMessages]
422
+ );
423
+ const copyMessageContent = useCallback4(() => {
424
+ try {
425
+ navigator == null ? void 0 : navigator.clipboard.writeText(message.message);
426
+ ToastManager.addToast({
427
+ title: "Message copied successfully"
428
+ });
429
+ } catch (e) {
430
+ console.log(e);
431
+ ToastManager.addToast({
432
+ title: "Could not copy message"
433
+ });
434
+ }
435
+ }, [message]);
436
+ const options = {
437
+ reply: {
438
+ text: "Reply privately",
439
+ tooltipText: "Reply privately",
440
+ icon: /* @__PURE__ */ React4.createElement(ReplyIcon, { style: iconStyle }),
441
+ onClick: onReply,
442
+ show: showReply
443
+ },
444
+ replyGroup: {
445
+ text: "Reply to group",
446
+ tooltipText: "Reply to group",
447
+ icon: /* @__PURE__ */ React4.createElement(ReplyGroupIcon, { style: iconStyle }),
448
+ onClick: onReplyGroup,
449
+ show: !!message.senderRole && roles_whitelist.includes(message.senderRole)
450
+ },
451
+ pin: {
452
+ text: "Pin message",
453
+ tooltipText: "Pin",
454
+ icon: /* @__PURE__ */ React4.createElement(PinIcon, { style: iconStyle }),
455
+ onClick: () => setPinnedMessages(message, localPeerName || ""),
456
+ show: showPinAction
457
+ },
458
+ copy: {
459
+ text: "Copy text",
460
+ tooltipText: "Copy",
461
+ icon: /* @__PURE__ */ React4.createElement(CopyIcon, { style: iconStyle }),
462
+ onClick: copyMessageContent,
463
+ show: true
464
+ },
465
+ hide: {
466
+ text: message.recipientPeer ? "Hide for both" : "Hide for everyone",
467
+ icon: /* @__PURE__ */ React4.createElement(EyeCloseIcon, { style: iconStyle }),
468
+ onClick: () => __async(void 0, null, function* () {
469
+ blacklistMessage(message.id);
470
+ updatePinnedMessages(message.id);
471
+ }),
472
+ show: !!can_hide_message
473
+ },
474
+ block: {
475
+ text: "Block from chat",
476
+ icon: /* @__PURE__ */ React4.createElement(CrossCircleIcon, { style: iconStyle }),
477
+ onClick: () => __async(void 0, null, function* () {
478
+ if (message.senderUserId) {
479
+ blacklistPeer(message.senderUserId);
480
+ }
481
+ }),
482
+ color: "$alert_error_default",
483
+ show: !!can_block_user && !sentByLocalPeer && !isSenderBlocked
484
+ },
485
+ remove: {
486
+ text: "Remove participant",
487
+ icon: /* @__PURE__ */ React4.createElement(PeopleRemoveIcon, { style: iconStyle }),
488
+ color: "$alert_error_default",
489
+ show: !!canRemoveOthers && !sentByLocalPeer,
490
+ onClick: () => __async(void 0, null, function* () {
491
+ if (!message.sender) {
492
+ return;
493
+ }
494
+ try {
495
+ yield actions.removePeer(message.sender, "");
496
+ } catch (error) {
497
+ ToastManager.addToast({ title: error.message, variant: "error" });
498
+ }
499
+ })
500
+ }
501
+ };
502
+ if (isMobile) {
503
+ return /* @__PURE__ */ React4.createElement(Sheet.Root, { open: openSheet, onOpenChange: setOpenSheet }, /* @__PURE__ */ React4.createElement(Sheet.Content, { css: { bg: "$surface_default", pb: "$14" }, onClick: (e) => setOpenSheet(false, e) }, /* @__PURE__ */ React4.createElement(
504
+ Sheet.Title,
505
+ {
506
+ css: {
507
+ display: "flex",
508
+ color: "$on_surface_high",
509
+ w: "100%",
510
+ justifyContent: "space-between",
511
+ mt: "$8",
512
+ fontSize: "$md",
513
+ px: "$10",
514
+ pb: "$8",
515
+ borderBottom: "1px solid $border_bright",
516
+ alignItems: "center"
517
+ }
518
+ },
519
+ "Message options",
520
+ /* @__PURE__ */ React4.createElement(Sheet.Close, { css: { color: "$on_surface_high" }, onClick: (e) => setOpenSheet(false, e) }, /* @__PURE__ */ React4.createElement(CrossIcon, null))
521
+ ), Object.keys(options).map((optionKey) => {
522
+ const option = options[optionKey];
523
+ return option.show ? /* @__PURE__ */ React4.createElement(
524
+ MwebChatOption,
525
+ {
526
+ key: optionKey,
527
+ text: option.text,
528
+ icon: option.icon,
529
+ onClick: option.onClick,
530
+ color: option == null ? void 0 : option.color
531
+ }
532
+ ) : null;
533
+ })));
534
+ }
535
+ return /* @__PURE__ */ React4.createElement(Dropdown.Root, { open, onOpenChange: setOpen, css: { "@md": { display: "none" } } }, /* @__PURE__ */ React4.createElement(
536
+ Flex,
537
+ {
538
+ className: "chat_actions",
539
+ css: {
540
+ background: "$surface_bright",
541
+ borderRadius: "$1",
542
+ p: "$2",
543
+ opacity: open ? 1 : 0,
544
+ position: "absolute",
545
+ top: 0,
546
+ right: 0,
547
+ zIndex: 1,
548
+ "@md": { opacity: 1 }
549
+ }
550
+ },
551
+ options.reply.show ? /* @__PURE__ */ React4.createElement(Tooltip, { boxCss: tooltipBoxCSS, title: options.reply.tooltipText }, /* @__PURE__ */ React4.createElement(IconButton, { "data-testid": "reply_message_btn", onClick: options.reply.onClick }, options.reply.icon)) : null,
552
+ options.replyGroup.show ? /* @__PURE__ */ React4.createElement(Tooltip, { boxCss: tooltipBoxCSS, title: options.replyGroup.tooltipText }, /* @__PURE__ */ React4.createElement(IconButton, { "data-testid": "reply_group_message_btn", onClick: options.replyGroup.onClick }, options.replyGroup.icon)) : null,
553
+ options.pin.show ? /* @__PURE__ */ React4.createElement(Tooltip, { boxCss: tooltipBoxCSS, title: options.pin.tooltipText }, /* @__PURE__ */ React4.createElement(IconButton, { "data-testid": "pin_message_btn", onClick: options.pin.onClick }, options.pin.icon)) : null,
554
+ options.copy.show ? /* @__PURE__ */ React4.createElement(Tooltip, { boxCss: tooltipBoxCSS, title: options.copy.tooltipText }, /* @__PURE__ */ React4.createElement(IconButton, { onClick: options.copy.onClick, "data-testid": "copy_message_btn" }, /* @__PURE__ */ React4.createElement(CopyIcon, { style: iconStyle }))) : null,
555
+ options.block.show || options.hide.show || options.remove.show ? /* @__PURE__ */ React4.createElement(Tooltip, { boxCss: tooltipBoxCSS, title: "More actions" }, /* @__PURE__ */ React4.createElement(Dropdown.Trigger, { asChild: true }, /* @__PURE__ */ React4.createElement(IconButton, null, /* @__PURE__ */ React4.createElement(VerticalMenuIcon, { style: iconStyle })))) : null
556
+ ), /* @__PURE__ */ React4.createElement(Dropdown.Portal, null, /* @__PURE__ */ React4.createElement(
557
+ Dropdown.Content,
558
+ {
559
+ sideOffset: 5,
560
+ align: "end",
561
+ css: { width: "$48", backgroundColor: "$surface_bright", py: "$0", border: "1px solid $border_bright" }
562
+ },
563
+ options.hide.show ? /* @__PURE__ */ React4.createElement(Dropdown.Item, { "data-testid": "hide_message_btn", onClick: options.hide.onClick }, options.hide.icon, /* @__PURE__ */ React4.createElement(Text, { variant: "sm", css: { ml: "$4", fontWeight: "$semiBold" } }, options.hide.text)) : null,
564
+ options.block.show ? /* @__PURE__ */ React4.createElement(
565
+ Dropdown.Item,
566
+ {
567
+ "data-testid": "block_peer_btn",
568
+ onClick: options.block.onClick,
569
+ css: { color: options.block.color }
570
+ },
571
+ options.block.icon,
572
+ /* @__PURE__ */ React4.createElement(Text, { variant: "sm", css: { ml: "$4", color: "inherit", fontWeight: "$semiBold" } }, options.block.text)
573
+ ) : null,
574
+ options.remove.show ? /* @__PURE__ */ React4.createElement(
575
+ Dropdown.Item,
576
+ {
577
+ "data-testid": "remove_peer_btn",
578
+ onClick: options.remove.onClick,
579
+ css: { color: options.remove.color }
580
+ },
581
+ options.remove.icon,
582
+ /* @__PURE__ */ React4.createElement(Text, { variant: "sm", css: { ml: "$4", color: "inherit", fontWeight: "$semiBold" } }, options.remove.text)
583
+ ) : null
584
+ )));
585
+ };
586
+
587
+ // src/Prebuilt/components/Chat/EmptyChat.tsx
588
+ init_define_process_env();
589
+ import React5 from "react";
590
+ import { useMedia } from "react-use";
591
+ import emptyChat from "./empty-chat.svg";
592
+ var EmptyChat = () => {
593
+ var _a;
594
+ const { elements } = useRoomLayoutConferencingScreen();
595
+ const isLocalPeerBlacklisted = useIsPeerBlacklisted({ local: true });
596
+ const isMobile = useMedia(config.media.md);
597
+ const canSendMessages = elements.chat && (elements.chat.public_chat_enabled || elements.chat.private_chat_enabled || elements.chat.roles_whitelist && elements.chat.roles_whitelist.length) && !isLocalPeerBlacklisted;
598
+ const isMobileHLSStream = useMobileHLSStream();
599
+ const isLandscapeStream = useLandscapeHLSStream();
600
+ const streaming = isMobileHLSStream || isLandscapeStream;
601
+ if (isMobile && ((_a = elements == null ? void 0 : elements.chat) == null ? void 0 : _a.is_overlay) && !streaming)
602
+ return /* @__PURE__ */ React5.createElement(React5.Fragment, null);
603
+ return /* @__PURE__ */ React5.createElement(
604
+ Flex,
605
+ {
606
+ css: {
607
+ width: "100%",
608
+ flex: "1 1 0",
609
+ textAlign: "center",
610
+ px: "$4"
611
+ },
612
+ align: "center",
613
+ justify: "center"
614
+ },
615
+ /* @__PURE__ */ React5.createElement(Box, null, /* @__PURE__ */ React5.createElement(Box, { css: { m: "0 auto", mt: "$4", "@media (max-height: 575px)": { display: "none" } } }, /* @__PURE__ */ React5.createElement("img", { src: emptyChat, style: { display: "inline" }, alt: "Empty Chat", height: 132, width: 185 })), /* @__PURE__ */ React5.createElement(Text, { variant: "h5", css: { mt: "$8", c: "$on_surface_high" } }, canSendMessages ? "Start a conversation" : "No messages yet"), canSendMessages ? /* @__PURE__ */ React5.createElement(
616
+ Text,
617
+ {
618
+ variant: "sm",
619
+ css: { mt: "$4", maxWidth: "80%", textAlign: "center", mx: "auto", c: "$on_surface_medium" }
620
+ },
621
+ "There are no messages here yet. Start a conversation by sending a message."
622
+ ) : null)
623
+ );
624
+ };
625
+
626
+ // src/Prebuilt/components/hooks/usePinnedBy.tsx
627
+ init_define_process_env();
628
+ import { useEffect as useEffect2, useState as useState3 } from "react";
629
+ import { selectSessionStore as selectSessionStore3, useHMSStore as useHMSStore3 } from "@100mslive/react-sdk";
630
+ var usePinnedBy = (messageId) => {
631
+ const pinnedMessages = useHMSStore3(selectSessionStore3("pinnedMessages" /* PINNED_MESSAGES */));
632
+ const [pinnedBy, setPinnedBy] = useState3("");
633
+ useEffect2(() => {
634
+ let match4 = "";
635
+ pinnedMessages == null ? void 0 : pinnedMessages.forEach((pinnedMessage) => {
636
+ if (pinnedMessage.id === messageId) {
637
+ match4 = pinnedMessage.pinnedBy;
638
+ }
639
+ });
640
+ setPinnedBy(match4);
641
+ }, [messageId, pinnedMessages]);
642
+ return pinnedBy;
643
+ };
644
+
645
+ // src/Prebuilt/components/Chat/utils.ts
646
+ init_define_process_env();
647
+ var formatTime = (date) => {
648
+ if (!(date instanceof Date)) {
649
+ return "";
650
+ }
651
+ const hours = date.getHours();
652
+ const minutes = date.getMinutes();
653
+ const suffix = hours > 11 ? "PM" : "AM";
654
+ return `${hours < 10 ? "0" : ""}${hours}:${minutes < 10 ? "0" : ""}${minutes} ${suffix}`;
655
+ };
656
+ var CHAT_MESSAGE_LIMIT = 2e3;
657
+
658
+ // src/Prebuilt/components/Chat/ChatBody.tsx
659
+ var rowHeights = {};
660
+ var listInstance = null;
661
+ function getRowHeight(index) {
662
+ var _a;
663
+ return ((_a = rowHeights[index]) == null ? void 0 : _a.size) || 72;
664
+ }
665
+ var setRowHeight = (index, id, size) => {
666
+ var _a, _b;
667
+ if (((_a = rowHeights[index]) == null ? void 0 : _a.id) === id && ((_b = rowHeights[index]) == null ? void 0 : _b.size) === size) {
668
+ return;
669
+ }
670
+ listInstance == null ? void 0 : listInstance.resetAfterIndex(Math.max(index - 1, 0));
671
+ Object.assign(rowHeights, { [index]: { size, id } });
672
+ };
673
+ var getMessageBackgroundColor = (messageType, selectedPeerID, selectedRole, isOverlay) => {
674
+ if (messageType && !(selectedPeerID || selectedRole)) {
675
+ return isOverlay ? "rgba(0, 0, 0, 0.64)" : "$surface_default";
676
+ }
677
+ return "";
678
+ };
679
+ var MessageTypeContainer = ({ left, right }) => {
680
+ return /* @__PURE__ */ React6.createElement(
681
+ Flex,
682
+ {
683
+ align: "center",
684
+ css: {
685
+ ml: "$2",
686
+ mr: "$4",
687
+ gap: "$space$2",
688
+ flexWrap: "nowrap"
689
+ }
690
+ },
691
+ left && /* @__PURE__ */ React6.createElement(
692
+ Text,
693
+ {
694
+ variant: "xs",
695
+ as: "span",
696
+ css: {
697
+ color: "$on_surface_medium",
698
+ textTransform: "capitalize",
699
+ fontWeight: "$regular",
700
+ whiteSpace: "nowrap"
701
+ }
702
+ },
703
+ left
704
+ ),
705
+ right && /* @__PURE__ */ React6.createElement(
706
+ Text,
707
+ {
708
+ as: "span",
709
+ variant: "overline",
710
+ css: {
711
+ color: "$on_surface_medium",
712
+ fontWeight: "$regular",
713
+ whiteSpace: "nowrap"
714
+ }
715
+ },
716
+ right
717
+ )
718
+ );
719
+ };
720
+ var MessageType = ({
721
+ roles,
722
+ hasCurrentUserSent,
723
+ receiver
724
+ }) => {
725
+ const peerName = useHMSStore4(selectPeerNameByID2(receiver));
726
+ const localPeerRoleName = useHMSStore4(selectLocalPeerRoleName);
727
+ if (receiver) {
728
+ return /* @__PURE__ */ React6.createElement(MessageTypeContainer, { left: hasCurrentUserSent ? `${peerName ? `to ${peerName}` : ""}` : "to You", right: "(DM)" });
729
+ }
730
+ if (roles && roles.length) {
731
+ return /* @__PURE__ */ React6.createElement(MessageTypeContainer, { left: `to ${hasCurrentUserSent ? roles[0] : localPeerRoleName}`, right: "(Group)" });
732
+ }
733
+ return null;
734
+ };
735
+ var URL_REGEX = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;
736
+ var Link = styled("a", {
737
+ color: "$primary_default",
738
+ wordBreak: "break-word",
739
+ "&:hover": {
740
+ textDecoration: "underline"
741
+ }
742
+ });
743
+ var AnnotisedMessage = ({ message, length }) => {
744
+ if (!message) {
745
+ return /* @__PURE__ */ React6.createElement(Fragment, null);
746
+ }
747
+ return /* @__PURE__ */ React6.createElement(Fragment, null, message.trim().split(/(\s)/).map(
748
+ (part) => URL_REGEX.test(part) ? /* @__PURE__ */ React6.createElement(Link, { href: part, key: part, target: "_blank", rel: "noopener noreferrer" }, part.slice(0, length)) : part.slice(0, length)
749
+ ));
750
+ };
751
+ var getMessageType = ({ roles, receiver }) => {
752
+ if (roles && roles.length > 0) {
753
+ return "role";
754
+ }
755
+ return receiver ? "private" : "";
756
+ };
757
+ var SenderName = styled(Text, {
758
+ overflow: "hidden",
759
+ textOverflow: "ellipsis",
760
+ whiteSpace: "nowrap",
761
+ width: "100%",
762
+ minWidth: 0,
763
+ color: "$on_surface_high",
764
+ fontWeight: "$semiBold"
765
+ });
766
+ var ChatMessage = React6.memo(
767
+ ({ index, style = {}, message }) => {
768
+ var _a, _b, _c;
769
+ const { elements } = useRoomLayoutConferencingScreen();
770
+ const rowRef = useRef(null);
771
+ const isMobile = useMedia2(config.media.md);
772
+ const isPrivateChatEnabled = !!((_a = elements == null ? void 0 : elements.chat) == null ? void 0 : _a.private_chat_enabled);
773
+ const isOverlay = ((_b = elements == null ? void 0 : elements.chat) == null ? void 0 : _b.is_overlay) && isMobile;
774
+ const localPeerId = useHMSStore4(selectLocalPeerID);
775
+ const [selectedRole, setRoleSelector] = useSetSubscribedChatSelector(CHAT_SELECTOR.ROLE);
776
+ const [selectedPeer, setPeerSelector] = useSetSubscribedChatSelector(CHAT_SELECTOR.PEER);
777
+ const messageType = getMessageType({
778
+ roles: message.recipientRoles,
779
+ receiver: message.recipientPeer
780
+ });
781
+ const [openSheet, setOpenSheetBare] = useState4(false);
782
+ const showPinAction = !!((_c = elements == null ? void 0 : elements.chat) == null ? void 0 : _c.allow_pinning_messages);
783
+ const showReply = message.sender !== selectedPeer.id && message.sender !== localPeerId && isPrivateChatEnabled;
784
+ useLayoutEffect(() => {
785
+ if (rowRef.current) {
786
+ setRowHeight(index, message.id, rowRef.current.clientHeight);
787
+ }
788
+ }, [index, message.id]);
789
+ const setOpenSheet = (value, e) => {
790
+ e == null ? void 0 : e.stopPropagation();
791
+ setOpenSheetBare(value);
792
+ };
793
+ return /* @__PURE__ */ React6.createElement(
794
+ Box,
795
+ {
796
+ css: {
797
+ mb: "$5",
798
+ pr: "$10",
799
+ mt: "$4",
800
+ "&:not(:hover} .chat_actions": { display: "none" },
801
+ "&:hover .chat_actions": { display: "flex", opacity: 1 }
802
+ },
803
+ style
804
+ },
805
+ /* @__PURE__ */ React6.createElement(
806
+ Flex,
807
+ {
808
+ ref: rowRef,
809
+ align: "center",
810
+ css: {
811
+ flexWrap: "wrap",
812
+ position: "relative",
813
+ // Theme independent color, token should not be used for transparent chat
814
+ background: getMessageBackgroundColor(messageType, selectedPeer.id, selectedRole, !!isOverlay),
815
+ r: "$1",
816
+ p: "$4",
817
+ userSelect: "none",
818
+ "@md": {
819
+ cursor: "pointer"
820
+ },
821
+ "&:hover": {
822
+ background: "linear-gradient(277deg, $surface_default 0%, $surface_dim 60.87%)"
823
+ }
824
+ },
825
+ "data-testid": "chat_msg",
826
+ onClick: (e) => {
827
+ if (isMobile) {
828
+ setOpenSheet(true, e);
829
+ }
830
+ }
831
+ },
832
+ /* @__PURE__ */ React6.createElement(PinnedBy, { messageId: message.id, index, rowRef }),
833
+ /* @__PURE__ */ React6.createElement(
834
+ Text,
835
+ {
836
+ css: {
837
+ color: isOverlay ? "#FFF" : "$on_surface_high",
838
+ fontWeight: "$semiBold",
839
+ display: "flex",
840
+ alignItems: "center",
841
+ alignSelf: "stretch",
842
+ width: "100%"
843
+ },
844
+ as: "div"
845
+ },
846
+ /* @__PURE__ */ React6.createElement(
847
+ Flex,
848
+ {
849
+ align: "baseline",
850
+ css: {
851
+ flexWrap: "nowrap",
852
+ maxWidth: "calc(100% - 10ch)",
853
+ textOverflow: "ellipsis",
854
+ whiteSpace: "nowrap"
855
+ }
856
+ },
857
+ message.senderName === "You" || !message.senderName ? /* @__PURE__ */ React6.createElement(
858
+ SenderName,
859
+ {
860
+ as: "span",
861
+ variant: "sub2",
862
+ css: { color: isOverlay ? "#FFF" : "$on_surface_high", fontWeight: "$semiBold" }
863
+ },
864
+ message.senderName || "Anonymous"
865
+ ) : /* @__PURE__ */ React6.createElement(Tooltip, { title: message.senderName, side: "top", align: "start", boxCss: { zIndex: 50 } }, /* @__PURE__ */ React6.createElement(
866
+ SenderName,
867
+ {
868
+ as: "span",
869
+ variant: "sub2",
870
+ css: { color: isOverlay ? "#FFF" : "$on_surface_high", fontWeight: "$semiBold" }
871
+ },
872
+ message.sender === localPeerId ? `${message.senderName} (You)` : message.senderName
873
+ )),
874
+ /* @__PURE__ */ React6.createElement(
875
+ MessageType,
876
+ {
877
+ hasCurrentUserSent: message.sender === localPeerId,
878
+ receiver: message.recipientPeer,
879
+ roles: message.recipientRoles
880
+ }
881
+ )
882
+ ),
883
+ !isOverlay ? /* @__PURE__ */ React6.createElement(
884
+ Text,
885
+ {
886
+ as: "span",
887
+ variant: "caption",
888
+ css: {
889
+ color: "$on_surface_medium",
890
+ flexShrink: 0,
891
+ position: "absolute",
892
+ right: 0,
893
+ zIndex: 1,
894
+ mr: "$4",
895
+ p: "$2"
896
+ }
897
+ },
898
+ formatTime(message.time)
899
+ ) : null,
900
+ /* @__PURE__ */ React6.createElement(
901
+ ChatActions,
902
+ {
903
+ showPinAction,
904
+ message,
905
+ sentByLocalPeer: message.sender === localPeerId,
906
+ onReply: () => {
907
+ setRoleSelector("");
908
+ setPeerSelector({ id: message.sender, name: message.senderName });
909
+ },
910
+ onReplyGroup: () => {
911
+ if (message.senderRole) {
912
+ setRoleSelector(message.senderRole);
913
+ setPeerSelector({});
914
+ }
915
+ },
916
+ showReply,
917
+ isMobile,
918
+ openSheet,
919
+ setOpenSheet
920
+ }
921
+ )
922
+ ),
923
+ /* @__PURE__ */ React6.createElement(
924
+ Text,
925
+ {
926
+ variant: "sm",
927
+ css: {
928
+ w: "100%",
929
+ mt: "$2",
930
+ wordBreak: "break-word",
931
+ whiteSpace: "pre-wrap",
932
+ userSelect: "all",
933
+ color: isOverlay ? "#FFF" : "$on_surface_high"
934
+ },
935
+ onClick: (e) => {
936
+ setOpenSheet(true, e);
937
+ }
938
+ },
939
+ /* @__PURE__ */ React6.createElement(AnnotisedMessage, { message: message.message })
940
+ )
941
+ )
942
+ );
943
+ }
944
+ );
945
+ var MessageWrapper = React6.memo(
946
+ ({ index, style, data }) => {
947
+ return /* @__PURE__ */ React6.createElement(ChatMessage, { style, index, key: data[index].id, message: data[index] });
948
+ }
949
+ );
950
+ var VirtualizedChatMessages = React6.forwardRef(({ messages, scrollToBottom }, listRef) => {
951
+ const hmsActions = useHMSActions5();
952
+ const itemKey = useCallback5((index, data) => {
953
+ return data[index].id;
954
+ }, []);
955
+ useEffect3(() => {
956
+ requestAnimationFrame(() => scrollToBottom(1));
957
+ }, [scrollToBottom]);
958
+ return /* @__PURE__ */ React6.createElement(
959
+ Box,
960
+ {
961
+ css: {
962
+ mr: "-$10",
963
+ h: "100%"
964
+ }
965
+ },
966
+ /* @__PURE__ */ React6.createElement(
967
+ AutoSizer,
968
+ {
969
+ style: {
970
+ width: "90%"
971
+ }
972
+ },
973
+ ({ height, width }) => /* @__PURE__ */ React6.createElement(
974
+ VariableSizeList,
975
+ {
976
+ ref: (node) => {
977
+ if (node) {
978
+ listRef.current = node;
979
+ listInstance = node;
980
+ }
981
+ },
982
+ itemCount: messages.length,
983
+ itemSize: getRowHeight,
984
+ itemData: messages,
985
+ width,
986
+ height,
987
+ style: {
988
+ overflowX: "hidden"
989
+ },
990
+ itemKey,
991
+ onItemsRendered: ({ visibleStartIndex, visibleStopIndex }) => {
992
+ for (let i = visibleStartIndex; i <= visibleStopIndex; i++) {
993
+ if (!messages[i].read) {
994
+ hmsActions.setMessageRead(true, messages[i].id);
995
+ }
996
+ }
997
+ }
998
+ },
999
+ MessageWrapper
1000
+ )
1001
+ )
1002
+ );
1003
+ });
1004
+ var ChatBody = React6.forwardRef(
1005
+ ({ scrollToBottom }, listRef) => {
1006
+ const messages = useHMSStore4(selectHMSMessages);
1007
+ const blacklistedMessageIDs = useHMSStore4(selectSessionStore4("chatMessageBlacklist" /* CHAT_MESSAGE_BLACKLIST */));
1008
+ const filteredMessages = useMemo(() => {
1009
+ const blacklistedMessageIDSet = new Set(blacklistedMessageIDs || []);
1010
+ return (messages == null ? void 0 : messages.filter((message) => message.type === "chat" && !blacklistedMessageIDSet.has(message.id))) || [];
1011
+ }, [blacklistedMessageIDs, messages]);
1012
+ const vanillaStore = useHMSVanillaStore3();
1013
+ const rerenderOnFirstMount = useRef(false);
1014
+ useEffect3(() => {
1015
+ const unsubscribe = vanillaStore.subscribe(() => {
1016
+ if (!listRef.current) {
1017
+ return;
1018
+ }
1019
+ const outerElement = listRef.current._outerRef;
1020
+ if (outerElement && outerElement.clientHeight + outerElement.scrollTop + outerElement.offsetTop >= outerElement.scrollHeight) {
1021
+ requestAnimationFrame(() => scrollToBottom(1));
1022
+ }
1023
+ }, selectUnreadHMSMessagesCount);
1024
+ return unsubscribe;
1025
+ }, [vanillaStore, listRef, scrollToBottom]);
1026
+ useEffect3(() => {
1027
+ if (filteredMessages.length > 0 && (listRef == null ? void 0 : listRef.current) && !rerenderOnFirstMount.current) {
1028
+ rerenderOnFirstMount.current = true;
1029
+ listRef.current.resetAfterIndex(0);
1030
+ }
1031
+ }, [listRef, filteredMessages]);
1032
+ return filteredMessages.length === 0 ? /* @__PURE__ */ React6.createElement(EmptyChat, null) : /* @__PURE__ */ React6.createElement(VirtualizedChatMessages, { messages: filteredMessages, ref: listRef, scrollToBottom });
1033
+ }
1034
+ );
1035
+ var PinnedBy = ({
1036
+ messageId,
1037
+ index,
1038
+ rowRef
1039
+ }) => {
1040
+ const pinnedBy = usePinnedBy(messageId);
1041
+ const localPeerName = useHMSStore4(selectLocalPeerName2);
1042
+ useLayoutEffect(() => {
1043
+ if (rowRef == null ? void 0 : rowRef.current) {
1044
+ if (pinnedBy) {
1045
+ rowRef.current.style.background = "linear-gradient(277deg, var(--hms-ui-colors-surface_default) 0%, var(--hms-ui-colors-surface_dim) 60.87%)";
1046
+ } else {
1047
+ rowRef.current.style.background = "";
1048
+ }
1049
+ setRowHeight(index, messageId, rowRef == null ? void 0 : rowRef.current.clientHeight);
1050
+ }
1051
+ }, [index, messageId, pinnedBy, rowRef]);
1052
+ if (!pinnedBy) {
1053
+ return null;
1054
+ }
1055
+ return /* @__PURE__ */ React6.createElement(Flex, { align: "center", css: { gap: "$2", mb: "$2", color: "$on_surface_low" } }, /* @__PURE__ */ React6.createElement(SolidPinIcon, { height: 12, width: 12 }), /* @__PURE__ */ React6.createElement(Text, { variant: "xs", css: { color: "inherit" } }, "Pinned by ", localPeerName === pinnedBy ? "you" : pinnedBy));
1056
+ };
1057
+
1058
+ // src/Prebuilt/components/PIP/PIPChat.tsx
1059
+ var PIPChat = () => {
1060
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
1061
+ const messages = useHMSStore5(selectHMSMessages2);
1062
+ const localPeerID = useHMSStore5(selectLocalPeerID2);
1063
+ const count = useHMSStore5(selectUnreadHMSMessagesCount2);
1064
+ const [unreadMessageCount, setUnreadMessageCount] = useState5(0);
1065
+ const getSenderName = useCallback6(
1066
+ (senderName, senderID) => {
1067
+ const slicedName = senderName.length > 10 ? senderName.slice(0, 10) + "..." : senderName;
1068
+ return slicedName + (senderID === localPeerID ? " (You)" : "");
1069
+ },
1070
+ [localPeerID]
1071
+ );
1072
+ useEffect4(() => {
1073
+ const timeoutId = setTimeout(() => {
1074
+ setUnreadMessageCount(count);
1075
+ }, 100);
1076
+ return () => clearTimeout(timeoutId);
1077
+ }, [count]);
1078
+ const blacklistedMessageIDs = useHMSStore5(selectSessionStore5("chatMessageBlacklist" /* CHAT_MESSAGE_BLACKLIST */));
1079
+ const filteredMessages = useMemo2(() => {
1080
+ const blacklistedMessageIDSet = new Set(blacklistedMessageIDs || []);
1081
+ return (messages == null ? void 0 : messages.filter((message) => message.type === "chat" && !blacklistedMessageIDSet.has(message.id))) || [];
1082
+ }, [blacklistedMessageIDs, messages]);
1083
+ const { enabled: isChatEnabled = true, updatedBy: chatStateUpdatedBy = "" } = useHMSStore5(selectSessionStore5("chatState" /* CHAT_STATE */)) || {};
1084
+ const isLocalPeerBlacklisted = useIsPeerBlacklisted({ local: true });
1085
+ const { elements } = useRoomLayoutConferencingScreen();
1086
+ const message_placeholder = ((_a = elements == null ? void 0 : elements.chat) == null ? void 0 : _a.message_placeholder) || "Send a message";
1087
+ const canSendChatMessages = !!((_b = elements == null ? void 0 : elements.chat) == null ? void 0 : _b.public_chat_enabled) || !!((_d = (_c = elements == null ? void 0 : elements.chat) == null ? void 0 : _c.roles_whitelist) == null ? void 0 : _d.length) || !!((_e = elements == null ? void 0 : elements.chat) == null ? void 0 : _e.private_chat_enabled);
1088
+ const getChatStatus = useCallback6(() => {
1089
+ if (isLocalPeerBlacklisted)
1090
+ return "You've been blocked from sending messages";
1091
+ if (!isChatEnabled)
1092
+ return `Chat has been paused by ${chatStateUpdatedBy.peerId === localPeerID ? "you" : chatStateUpdatedBy == null ? void 0 : chatStateUpdatedBy.userName}`;
1093
+ return message_placeholder;
1094
+ }, [
1095
+ chatStateUpdatedBy.peerId,
1096
+ chatStateUpdatedBy == null ? void 0 : chatStateUpdatedBy.userName,
1097
+ isChatEnabled,
1098
+ isLocalPeerBlacklisted,
1099
+ localPeerID,
1100
+ message_placeholder
1101
+ ]);
1102
+ return /* @__PURE__ */ React7.createElement("div", { style: { height: "100%" } }, /* @__PURE__ */ React7.createElement(
1103
+ Box,
1104
+ {
1105
+ id: "chat-container",
1106
+ css: {
1107
+ bg: "$surface_dim",
1108
+ overflowY: "auto",
1109
+ // Subtracting height of footer
1110
+ h: canSendChatMessages ? "calc(100% - 87px)" : "100%",
1111
+ position: "relative"
1112
+ }
1113
+ },
1114
+ unreadMessageCount ? /* @__PURE__ */ React7.createElement(
1115
+ Box,
1116
+ {
1117
+ id: "new-message-notif",
1118
+ style: {
1119
+ position: "fixed",
1120
+ bottom: "76px",
1121
+ right: "4px"
1122
+ }
1123
+ },
1124
+ /* @__PURE__ */ React7.createElement(
1125
+ Text,
1126
+ {
1127
+ variant: "xs",
1128
+ css: { cursor: "pointer" },
1129
+ style: { color: "white", background: "gray", padding: "4px", borderRadius: "4px" }
1130
+ },
1131
+ unreadMessageCount === 1 ? "New message" : `${unreadMessageCount} new messages`
1132
+ )
1133
+ ) : "",
1134
+ filteredMessages.length === 0 ? /* @__PURE__ */ React7.createElement(
1135
+ "div",
1136
+ {
1137
+ style: {
1138
+ display: "flex",
1139
+ flexDirection: "column",
1140
+ height: "100%",
1141
+ width: "100%",
1142
+ alignItems: "center",
1143
+ justifyContent: "center"
1144
+ }
1145
+ },
1146
+ /* @__PURE__ */ React7.createElement(Text, { variant: "h5", css: { mt: "$8", c: "$on_surface_high" } }, canSendChatMessages ? "Start a conversation" : "No messages yet"),
1147
+ canSendChatMessages ? /* @__PURE__ */ React7.createElement(Text, { variant: "sm", style: { maxWidth: "80%", textAlign: "center", marginTop: "4px" } }, "There are no messages here yet. Start a conversation by sending a message.") : ""
1148
+ ) : filteredMessages.map((message) => /* @__PURE__ */ React7.createElement(Box, { className: "pip-message", key: message.id, id: message.id, style: { padding: "8px 0.75rem" } }, /* @__PURE__ */ React7.createElement(Flex, { style: { width: "100%", alignItems: "center", justifyContent: "between" } }, /* @__PURE__ */ React7.createElement(
1149
+ Text,
1150
+ {
1151
+ style: { display: "flex", justifyContent: "between", width: "100%", alignItems: "center" },
1152
+ css: {
1153
+ color: "$on_surface_high",
1154
+ fontWeight: "$semiBold"
1155
+ }
1156
+ },
1157
+ /* @__PURE__ */ React7.createElement(Flex, { style: { flexGrow: 1, gap: "2px", alignItems: "center" } }, message.senderName === "You" || !message.senderName ? /* @__PURE__ */ React7.createElement(Text, { as: "span", variant: "sub2", css: { color: "$on_surface_high", fontWeight: "$semiBold" } }, message.senderName || "Anonymous") : /* @__PURE__ */ React7.createElement(Tooltip, { title: message.senderName, side: "top", align: "start" }, /* @__PURE__ */ React7.createElement(Text, { as: "span", variant: "sub2", css: { color: "$on_surface_high", fontWeight: "$semiBold" } }, getSenderName(message.senderName, message == null ? void 0 : message.sender))), /* @__PURE__ */ React7.createElement(
1158
+ MessageTitle,
1159
+ {
1160
+ localPeerID,
1161
+ recipientPeer: message.recipientPeer,
1162
+ recipientRoles: message.recipientRoles
1163
+ }
1164
+ )),
1165
+ /* @__PURE__ */ React7.createElement(
1166
+ Text,
1167
+ {
1168
+ variant: "xs",
1169
+ css: {
1170
+ color: "$on_surface_medium",
1171
+ flexShrink: 0,
1172
+ p: "$2",
1173
+ whitespace: "nowrap"
1174
+ }
1175
+ },
1176
+ formatTime(message.time)
1177
+ )
1178
+ )), /* @__PURE__ */ React7.createElement(
1179
+ Text,
1180
+ {
1181
+ variant: "sm",
1182
+ css: {
1183
+ w: "100%",
1184
+ mt: "$2",
1185
+ wordBreak: "break-word",
1186
+ whiteSpace: "pre-wrap",
1187
+ userSelect: "all",
1188
+ color: "$on_surface_high"
1189
+ }
1190
+ },
1191
+ /* @__PURE__ */ React7.createElement(AnnotisedMessage, { message: message.message })
1192
+ ))),
1193
+ /* @__PURE__ */ React7.createElement("div", { id: "marker", style: { height: filteredMessages.length ? "1px" : 0 } })
1194
+ ), canSendChatMessages && /* @__PURE__ */ React7.createElement(Box, { css: { bg: "$surface_dim" } }, /* @__PURE__ */ React7.createElement(Flex, { css: { px: "$4", pb: "3px", gap: "$2", alignItems: "center" } }, /* @__PURE__ */ React7.createElement(Text, { variant: "caption" }, "To:"), /* @__PURE__ */ React7.createElement(Flex, { css: { bg: "$primary_bright", color: "$on_primary_high", r: "$2" } }, /* @__PURE__ */ React7.createElement(
1195
+ "select",
1196
+ {
1197
+ id: "selector",
1198
+ style: {
1199
+ background: "inherit",
1200
+ color: "inherit",
1201
+ border: "none",
1202
+ outline: "none",
1203
+ borderRadius: "4px",
1204
+ padding: "0 2px"
1205
+ },
1206
+ defaultValue: ((_f = elements.chat) == null ? void 0 : _f.public_chat_enabled) ? "Everyone" : (_h = (_g = elements.chat) == null ? void 0 : _g.roles_whitelist) == null ? void 0 : _h[0]
1207
+ },
1208
+ (_j = (_i = elements.chat) == null ? void 0 : _i.roles_whitelist) == null ? void 0 : _j.map((role) => /* @__PURE__ */ React7.createElement("option", { key: role, value: role }, role)),
1209
+ ((_k = elements.chat) == null ? void 0 : _k.public_chat_enabled) ? /* @__PURE__ */ React7.createElement("option", { value: "Everyone" }, "Everyone") : ""
1210
+ ))), /* @__PURE__ */ React7.createElement(
1211
+ Flex,
1212
+ {
1213
+ align: "center",
1214
+ css: {
1215
+ bg: "$surface_default",
1216
+ minHeight: "$16",
1217
+ width: "100%",
1218
+ py: "$6",
1219
+ pl: "$4",
1220
+ boxSizing: "border-box",
1221
+ gap: "$2",
1222
+ r: "$2"
1223
+ }
1224
+ },
1225
+ /* @__PURE__ */ React7.createElement(
1226
+ TextArea,
1227
+ {
1228
+ id: "chat-input",
1229
+ maxLength: CHAT_MESSAGE_LIMIT,
1230
+ disabled: !isChatEnabled || isLocalPeerBlacklisted,
1231
+ rows: 1,
1232
+ css: {
1233
+ w: "100%",
1234
+ c: "$on_surface_high",
1235
+ p: "0.75rem 0.75rem !important",
1236
+ border: "none",
1237
+ resize: "none"
1238
+ },
1239
+ placeholder: getChatStatus(),
1240
+ required: true,
1241
+ autoComplete: "off",
1242
+ "aria-autocomplete": "none"
1243
+ }
1244
+ ),
1245
+ /* @__PURE__ */ React7.createElement(
1246
+ IconButton_default,
1247
+ {
1248
+ id: "send-btn",
1249
+ disabled: !isChatEnabled || isLocalPeerBlacklisted,
1250
+ title: getChatStatus(),
1251
+ css: {
1252
+ ml: "auto",
1253
+ height: "max-content",
1254
+ mr: "$4",
1255
+ "&:hover": { c: "$on_surface_medium" }
1256
+ },
1257
+ "data-testid": "send_msg_btn"
1258
+ },
1259
+ /* @__PURE__ */ React7.createElement(SendIcon, null)
1260
+ )
1261
+ )));
1262
+ };
1263
+ var MessageTitle = ({
1264
+ recipientPeer,
1265
+ recipientRoles,
1266
+ localPeerID
1267
+ }) => {
1268
+ const peerName = useHMSStore5(selectPeerNameByID3(recipientPeer));
1269
+ return /* @__PURE__ */ React7.createElement(React7.Fragment, null, recipientRoles ? /* @__PURE__ */ React7.createElement(Text, { as: "span", variant: "sub2", css: { color: "$on_surface_high", fontWeight: "$semiBold" } }, "to ", recipientRoles, " (Group)") : null, recipientPeer ? /* @__PURE__ */ React7.createElement(Text, { as: "span", variant: "sub2", css: { color: "$on_surface_high", fontWeight: "$semiBold" } }, "to ", recipientPeer === localPeerID ? "You" : peerName, " (DM)") : null);
1270
+ };
1271
+
1272
+ // src/Prebuilt/components/PIP/PIPChatOption.tsx
1273
+ init_define_process_env();
1274
+ import React8 from "react";
1275
+ import { ExternalLinkIcon } from "@100mslive/react-icons";
1276
+ var PIPChatOption = ({ openChat, showPIPChat }) => {
1277
+ if (!showPIPChat) {
1278
+ return /* @__PURE__ */ React8.createElement(React8.Fragment, null);
1279
+ }
1280
+ return /* @__PURE__ */ React8.createElement(Dropdown.Item, { onClick: openChat, "data-testid": "pip_chat_btn" }, /* @__PURE__ */ React8.createElement(ExternalLinkIcon, null), /* @__PURE__ */ React8.createElement(Text, { variant: "sm", css: { ml: "$4", color: "$on_surface_high" } }, "Pop out Chat"));
1281
+ };
1282
+
1283
+ // src/Prebuilt/components/PIP/PIPWindow.tsx
1284
+ init_define_process_env();
1285
+ import { createPortal } from "react-dom";
1286
+ var PIPWindow = ({ pipWindow, children }) => {
1287
+ pipWindow.document.body.style.margin = "0";
1288
+ pipWindow.document.body.style.overflow = "clip";
1289
+ return createPortal(children, pipWindow.document.body);
1290
+ };
1291
+
1292
+ // src/Prebuilt/components/Settings/StartRecording.jsx
1293
+ init_define_process_env();
1294
+ import React10, { useState as useState7 } from "react";
1295
+ import { selectPermissions as selectPermissions2, useHMSActions as useHMSActions6, useHMSStore as useHMSStore6, useRecordingStreaming } from "@100mslive/react-sdk";
1296
+ import { AlertTriangleIcon } from "@100mslive/react-icons";
1297
+
1298
+ // src/Prebuilt/components/Streaming/ResolutionInput.jsx
1299
+ init_define_process_env();
1300
+ import React9, { useCallback as useCallback7, useState as useState6 } from "react";
1301
+ import { InfoIcon } from "@100mslive/react-icons";
1302
+ var ResolutionInput = ({ onResolutionChange, disabled, tooltipText, css, testId }) => {
1303
+ const [resolution, setResolution] = useState6(RTMP_RECORD_DEFAULT_RESOLUTION);
1304
+ const resolutionChangeHandler = useCallback7(
1305
+ (event) => {
1306
+ const { name, value } = event.target;
1307
+ let width = name === "resWidth" ? Number(value) : resolution.width;
1308
+ let height = name === "resHeight" ? Number(value) : resolution.height;
1309
+ if (width === 0) {
1310
+ width = null;
1311
+ }
1312
+ if (height === 0) {
1313
+ height = null;
1314
+ }
1315
+ const newResolution = {
1316
+ width: !isNaN(width) ? width : RTMP_RECORD_DEFAULT_RESOLUTION.width,
1317
+ height: !isNaN(height) ? height : RTMP_RECORD_DEFAULT_RESOLUTION.height
1318
+ };
1319
+ setResolution(newResolution);
1320
+ },
1321
+ [resolution]
1322
+ );
1323
+ return /* @__PURE__ */ React9.createElement(DialogRow, { breakSm: true, css }, /* @__PURE__ */ React9.createElement(Flex, { gap: 1 }, /* @__PURE__ */ React9.createElement(Label, { css: { mb: "$8" } }, "Resolution"), tooltipText && /* @__PURE__ */ React9.createElement(Tooltip, { title: tooltipText }, /* @__PURE__ */ React9.createElement("div", null, /* @__PURE__ */ React9.createElement(InfoIcon, { color: "#B0C3DB" })))), /* @__PURE__ */ React9.createElement(
1324
+ Flex,
1325
+ {
1326
+ justify: "between",
1327
+ css: { width: !tooltipText ? "100%" : "70%", "@sm": { width: "100%" } },
1328
+ gap: 2,
1329
+ direction: "column"
1330
+ },
1331
+ /* @__PURE__ */ React9.createElement(Flex, { justify: "between", gap: 2 }, /* @__PURE__ */ React9.createElement(Flex, { direction: "column", css: { width: "50%" } }, /* @__PURE__ */ React9.createElement(Text, { variant: "xs" }, "Width"), /* @__PURE__ */ React9.createElement(
1332
+ Input,
1333
+ {
1334
+ "data-testid": `${testId}_width`,
1335
+ css: { width: "100%", mt: "$4" },
1336
+ name: "resWidth",
1337
+ value: resolution.width,
1338
+ onChange: resolutionChangeHandler,
1339
+ readOnly: disabled,
1340
+ min: RTMP_RECORD_RESOLUTION_MIN,
1341
+ max: RTMP_RECORD_RESOLUTION_MAX,
1342
+ onBlur: () => onResolutionChange(resolution),
1343
+ type: "number"
1344
+ }
1345
+ )), /* @__PURE__ */ React9.createElement(Flex, { direction: "column", css: { width: "50%" } }, /* @__PURE__ */ React9.createElement(Text, { variant: "xs" }, "Height"), /* @__PURE__ */ React9.createElement(
1346
+ Input,
1347
+ {
1348
+ "data-testid": `${testId}_height`,
1349
+ css: { width: "100%", mt: "$4" },
1350
+ name: "resHeight",
1351
+ value: resolution.height,
1352
+ onChange: resolutionChangeHandler,
1353
+ onBlur: () => onResolutionChange(resolution),
1354
+ readOnly: disabled,
1355
+ min: RTMP_RECORD_RESOLUTION_MIN,
1356
+ max: RTMP_RECORD_RESOLUTION_MAX,
1357
+ type: "number"
1358
+ }
1359
+ )))
1360
+ ));
1361
+ };
1362
+
1363
+ // src/Prebuilt/components/Settings/StartRecording.jsx
1364
+ var StartRecording = ({ open, onOpenChange }) => {
1365
+ const permissions = useHMSStore6(selectPermissions2);
1366
+ const [resolution, setResolution] = useState7(RTMP_RECORD_DEFAULT_RESOLUTION);
1367
+ const { startRecording, recordingStarted } = useRecordingHandler();
1368
+ const { isBrowserRecordingOn, isStreamingOn, isHLSRunning } = useRecordingStreaming();
1369
+ const hmsActions = useHMSActions6();
1370
+ if (!(permissions == null ? void 0 : permissions.browserRecording) || isHLSRunning) {
1371
+ return null;
1372
+ }
1373
+ if (isBrowserRecordingOn) {
1374
+ return /* @__PURE__ */ React10.createElement(Dialog.Root, { open, onOpenChange }, /* @__PURE__ */ React10.createElement(Dialog.Portal, null, /* @__PURE__ */ React10.createElement(
1375
+ Dialog.Content,
1376
+ {
1377
+ css: {
1378
+ width: "min(400px,80%)",
1379
+ p: "$10",
1380
+ bg: "#201617"
1381
+ }
1382
+ },
1383
+ /* @__PURE__ */ React10.createElement(Dialog.Title, null, /* @__PURE__ */ React10.createElement(Flex, { gap: 2, css: { c: "$alert_error_default" } }, /* @__PURE__ */ React10.createElement(AlertTriangleIcon, null), /* @__PURE__ */ React10.createElement(Text, { css: { c: "inherit" }, variant: "h6" }, "End Recording"))),
1384
+ /* @__PURE__ */ React10.createElement(Text, { variant: "sm", css: { c: "$on_surface_medium", my: "$8" } }, "Are you sure you want to end recording? You can\u2019t undo this action."),
1385
+ /* @__PURE__ */ React10.createElement(Flex, { justify: "end", css: { mt: "$12" } }, /* @__PURE__ */ React10.createElement(Dialog.Close, { asChild: true }, /* @__PURE__ */ React10.createElement(Button, { outlined: true, css: { borderColor: "$secondary_bright", mr: "$4" } }, "Don't end")), /* @__PURE__ */ React10.createElement(
1386
+ Button,
1387
+ {
1388
+ "data-testid": "stop_recording_confirm_mobile",
1389
+ variant: "danger",
1390
+ icon: true,
1391
+ onClick: () => __async(void 0, null, function* () {
1392
+ try {
1393
+ yield hmsActions.stopRTMPAndRecording();
1394
+ } catch (error) {
1395
+ ToastManager.addToast({
1396
+ title: error.message,
1397
+ variant: "error"
1398
+ });
1399
+ }
1400
+ onOpenChange(false);
1401
+ })
1402
+ },
1403
+ "End recording"
1404
+ ))
1405
+ )));
1406
+ }
1407
+ return /* @__PURE__ */ React10.createElement(Dialog.Root, { open, onOpenChange }, /* @__PURE__ */ React10.createElement(Dialog.Content, { css: { width: "min(400px,80%)", p: "$10" } }, /* @__PURE__ */ React10.createElement(Dialog.Title, null, /* @__PURE__ */ React10.createElement(Text, { variant: "h6" }, "Start Recording")), /* @__PURE__ */ React10.createElement(
1408
+ ResolutionInput,
1409
+ {
1410
+ testId: "recording_resolution_mobile",
1411
+ css: { flexDirection: "column", alignItems: "start" },
1412
+ onResolutionChange: setResolution
1413
+ }
1414
+ ), /* @__PURE__ */ React10.createElement(
1415
+ Button,
1416
+ {
1417
+ "data-testid": "start_recording_confirm_mobile",
1418
+ variant: "primary",
1419
+ icon: true,
1420
+ css: { ml: "auto" },
1421
+ type: "submit",
1422
+ disabled: recordingStarted || isStreamingOn,
1423
+ onClick: () => __async(void 0, null, function* () {
1424
+ yield startRecording(resolution);
1425
+ onOpenChange(false);
1426
+ })
1427
+ },
1428
+ "Start"
1429
+ )));
1430
+ };
1431
+ var StartRecording_default = StartRecording;
1432
+
1433
+ // src/Prebuilt/components/StatsForNerds.jsx
1434
+ init_define_process_env();
1435
+ import React11, { useEffect as useEffect5, useMemo as useMemo3, useRef as useRef2, useState as useState8 } from "react";
1436
+ import { useMedia as useMedia3 } from "react-use";
1437
+ import { match, P } from "ts-pattern";
1438
+ import {
1439
+ selectHMSStats,
1440
+ selectLocalPeerID as selectLocalPeerID3,
1441
+ selectPeersMap,
1442
+ selectTracksMap as selectTracksMap2,
1443
+ useHMSActions as useHMSActions7,
1444
+ useHMSStatsStore,
1445
+ useHMSStore as useHMSStore7
1446
+ } from "@100mslive/react-sdk";
1447
+ var StatsForNerds = ({ open, onOpenChange }) => {
1448
+ var _a, _b;
1449
+ const mediaQueryLg = config.media.md;
1450
+ const isMobile = useMedia3(mediaQueryLg);
1451
+ const tracksWithLabels = useTracksWithLabel();
1452
+ const statsOptions = useMemo3(
1453
+ () => [{ id: "local-peer", label: "Local Peer Stats" }, ...tracksWithLabels],
1454
+ [tracksWithLabels]
1455
+ );
1456
+ const hmsActions = useHMSActions7();
1457
+ const details = hmsActions.getDebugInfo();
1458
+ const [selectedStat, setSelectedStat] = useState8(statsOptions[0]);
1459
+ const [showStatsOnTiles, setShowStatsOnTiles] = useSetUiSettings(UI_SETTINGS.showStatsOnTiles);
1460
+ const [openDropdown, setOpenDropdown] = useState8(false);
1461
+ const ref = useRef2();
1462
+ const selectionBg = useDropdownSelection();
1463
+ useEffect5(() => {
1464
+ if (selectedStat.id !== "local-peer" && !tracksWithLabels.find((track) => track.id === selectedStat.id)) {
1465
+ setSelectedStat("local-peer");
1466
+ }
1467
+ }, [tracksWithLabels, selectedStat]);
1468
+ return isMobile ? /* @__PURE__ */ React11.createElement(Sheet.Root, { open, onOpenChange }, /* @__PURE__ */ React11.createElement(
1469
+ Sheet.Content,
1470
+ {
1471
+ css: {
1472
+ bg: "$surface_dim",
1473
+ overflowY: "auto",
1474
+ px: "$4"
1475
+ }
1476
+ },
1477
+ /* @__PURE__ */ React11.createElement(Sheet.Title, { css: { py: "$10", px: "$8", alignItems: "center" } }, /* @__PURE__ */ React11.createElement(Flex, { justify: "between" }, /* @__PURE__ */ React11.createElement(Flex, { align: "center", css: { mb: "$1" } }, /* @__PURE__ */ React11.createElement(Text, { variant: "h6", inline: true }, "Stats For Nerds")), /* @__PURE__ */ React11.createElement(Dialog.DefaultClose, { "data-testid": "stats_dialog_close_icon" }))),
1478
+ /* @__PURE__ */ React11.createElement(HorizontalDivider, null),
1479
+ /* @__PURE__ */ React11.createElement(Flex, { justify: "start", gap: 4, css: { m: "$10 0" } }, /* @__PURE__ */ React11.createElement(Switch, { checked: showStatsOnTiles, onCheckedChange: setShowStatsOnTiles }), /* @__PURE__ */ React11.createElement(Text, { variant: "body2", css: { fontWeight: "$semiBold" } }, "Show Stats on Tiles")),
1480
+ /* @__PURE__ */ React11.createElement(
1481
+ Flex,
1482
+ {
1483
+ direction: "column",
1484
+ css: {
1485
+ mb: "$12",
1486
+ position: "relative",
1487
+ minWidth: 0
1488
+ }
1489
+ },
1490
+ /* @__PURE__ */ React11.createElement(Label, { variant: "body2", css: { c: "$on_surface_high" } }, "Stats For"),
1491
+ /* @__PURE__ */ React11.createElement(Dropdown.Root, { "data-testid": "dialog_select_Stats For", open: openDropdown, onOpenChange: setOpenDropdown }, /* @__PURE__ */ React11.createElement(
1492
+ DialogDropdownTrigger,
1493
+ {
1494
+ title: selectedStat.label || "Select Stats",
1495
+ css: { mt: "$4" },
1496
+ titleCSS: { mx: 0 },
1497
+ open: openDropdown,
1498
+ ref
1499
+ }
1500
+ ), /* @__PURE__ */ React11.createElement(Dropdown.Portal, null, /* @__PURE__ */ React11.createElement(Dropdown.Content, { align: "start", sideOffset: 8, css: { w: (_a = ref.current) == null ? void 0 : _a.clientWidth, zIndex: 1e3 } }, statsOptions.map((option) => {
1501
+ const isSelected = option.id === selectedStat.id && option.layer === selectedStat.layer;
1502
+ return /* @__PURE__ */ React11.createElement(
1503
+ Dropdown.Item,
1504
+ {
1505
+ key: `${option.id}-${option.layer || ""}`,
1506
+ onClick: () => {
1507
+ setSelectedStat(option);
1508
+ },
1509
+ css: {
1510
+ px: "$9",
1511
+ bg: isSelected ? selectionBg : void 0,
1512
+ c: isSelected ? "$on_primary_high" : "$on_primary_high"
1513
+ }
1514
+ },
1515
+ option.label
1516
+ );
1517
+ }))))
1518
+ ),
1519
+ selectedStat.id === "local-peer" ? /* @__PURE__ */ React11.createElement(LocalPeerStats, null) : /* @__PURE__ */ React11.createElement(TrackStats, { trackID: selectedStat.id, layer: selectedStat.layer, local: selectedStat.local })
1520
+ )) : /* @__PURE__ */ React11.createElement(Dialog.Root, { open, onOpenChange }, /* @__PURE__ */ React11.createElement(Dialog.Portal, null, /* @__PURE__ */ React11.createElement(Dialog.Overlay, null), /* @__PURE__ */ React11.createElement(
1521
+ Dialog.Content,
1522
+ {
1523
+ css: {
1524
+ width: "min(500px, 95%)",
1525
+ height: "min(656px, 90%)",
1526
+ overflowY: "auto"
1527
+ }
1528
+ },
1529
+ /* @__PURE__ */ React11.createElement(Dialog.Title, { css: { p: "$4 0" } }, /* @__PURE__ */ React11.createElement(Flex, { justify: "between" }, /* @__PURE__ */ React11.createElement(Flex, { align: "center", css: { mb: "$1" } }, /* @__PURE__ */ React11.createElement(Text, { variant: "h6", inline: true }, "Stats For Nerds")), /* @__PURE__ */ React11.createElement(Dialog.DefaultClose, { "data-testid": "stats_dialog_close_icon" }))),
1530
+ /* @__PURE__ */ React11.createElement(HorizontalDivider, { css: { mt: "0.8rem" } }),
1531
+ /* @__PURE__ */ React11.createElement(Flex, { justify: "start", gap: 4, css: { m: "$10 0" } }, /* @__PURE__ */ React11.createElement(Switch, { checked: showStatsOnTiles, onCheckedChange: setShowStatsOnTiles }), /* @__PURE__ */ React11.createElement(Text, { variant: "body2", css: { fontWeight: "$semiBold" } }, "Show Stats on Tiles")),
1532
+ /* @__PURE__ */ React11.createElement(
1533
+ Flex,
1534
+ {
1535
+ direction: "column",
1536
+ css: {
1537
+ mb: "$12",
1538
+ position: "relative",
1539
+ minWidth: 0
1540
+ }
1541
+ },
1542
+ /* @__PURE__ */ React11.createElement(Label, { variant: "body2", css: { c: "$on_surface_high" } }, "Stats For"),
1543
+ /* @__PURE__ */ React11.createElement(Dropdown.Root, { "data-testid": "dialog_select_Stats For", open: openDropdown, onOpenChange: setOpenDropdown }, /* @__PURE__ */ React11.createElement(
1544
+ DialogDropdownTrigger,
1545
+ {
1546
+ title: selectedStat.label || "Select Stats",
1547
+ css: { mt: "$4" },
1548
+ titleCSS: { mx: 0 },
1549
+ open: openDropdown,
1550
+ ref
1551
+ }
1552
+ ), /* @__PURE__ */ React11.createElement(Dropdown.Portal, null, /* @__PURE__ */ React11.createElement(Dropdown.Content, { align: "start", sideOffset: 8, css: { w: (_b = ref.current) == null ? void 0 : _b.clientWidth, zIndex: 1e3 } }, statsOptions.map((option) => {
1553
+ const isSelected = option.id === selectedStat.id && option.layer === selectedStat.layer;
1554
+ return /* @__PURE__ */ React11.createElement(
1555
+ Dropdown.Item,
1556
+ {
1557
+ key: `${option.id}-${option.layer || ""}`,
1558
+ onClick: () => {
1559
+ setSelectedStat(option);
1560
+ },
1561
+ css: {
1562
+ px: "$9",
1563
+ bg: isSelected ? selectionBg : void 0,
1564
+ c: isSelected ? "$on_primary_high" : "$on_primary_high"
1565
+ }
1566
+ },
1567
+ option.label
1568
+ );
1569
+ }))))
1570
+ ),
1571
+ selectedStat.id === "local-peer" ? /* @__PURE__ */ React11.createElement(LocalPeerStats, null) : /* @__PURE__ */ React11.createElement(TrackStats, { trackID: selectedStat.id, layer: selectedStat.layer, local: selectedStat.local }),
1572
+ /* @__PURE__ */ React11.createElement(Flex, { justify: "start", gap: 4, css: { m: "$10 0", w: "100%" } }, /* @__PURE__ */ React11.createElement(DebugInfo, { details }))
1573
+ )));
1574
+ };
1575
+ var useTracksWithLabel = () => {
1576
+ const tracksMap = useHMSStore7(selectTracksMap2);
1577
+ const peersMap = useHMSStore7(selectPeersMap);
1578
+ const localPeerID = useHMSStore7(selectLocalPeerID3);
1579
+ const tracksWithLabels = useMemo3(
1580
+ () => Object.values(tracksMap).reduce((res, track) => {
1581
+ var _a, _b;
1582
+ const peerName = (_a = peersMap[track.peerId]) == null ? void 0 : _a.name;
1583
+ const isLocalTrack = track.peerId === localPeerID;
1584
+ if (isLocalTrack && ((_b = track.layerDefinitions) == null ? void 0 : _b.length)) {
1585
+ res = res.concat(
1586
+ track.layerDefinitions.map(({ layer }) => {
1587
+ return {
1588
+ id: track.id,
1589
+ layer,
1590
+ local: true,
1591
+ label: `${peerName} ${track.source} ${track.type} - ${layer}`
1592
+ };
1593
+ })
1594
+ );
1595
+ return res;
1596
+ }
1597
+ res.push({
1598
+ id: track.id,
1599
+ local: isLocalTrack,
1600
+ label: `${peerName} ${track.source} ${track.type}`
1601
+ });
1602
+ return res;
1603
+ }, []),
1604
+ [tracksMap, peersMap, localPeerID]
1605
+ );
1606
+ return tracksWithLabels;
1607
+ };
1608
+ var LocalPeerStats = () => {
1609
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
1610
+ const stats = useHMSStatsStore(selectHMSStats.localPeerStats);
1611
+ if (!stats) {
1612
+ return null;
1613
+ }
1614
+ return /* @__PURE__ */ React11.createElement(Flex, { css: { flexWrap: "wrap", gap: "$10" } }, /* @__PURE__ */ React11.createElement(StatsRow, { label: "Packets Lost", value: (_a = stats.subscribe) == null ? void 0 : _a.packetsLost }), /* @__PURE__ */ React11.createElement(StatsRow, { label: "Jitter", value: (_b = stats.subscribe) == null ? void 0 : _b.jitter }), /* @__PURE__ */ React11.createElement(StatsRow, { label: "Publish Bitrate", value: formatBytes((_c = stats.publish) == null ? void 0 : _c.bitrate, "b/s") }), /* @__PURE__ */ React11.createElement(StatsRow, { label: "Subscribe Bitrate", value: formatBytes((_d = stats.subscribe) == null ? void 0 : _d.bitrate, "b/s") }), /* @__PURE__ */ React11.createElement(
1615
+ StatsRow,
1616
+ {
1617
+ label: "Available Outgoing Bitrate",
1618
+ value: formatBytes((_e = stats.publish) == null ? void 0 : _e.availableOutgoingBitrate, "b/s")
1619
+ }
1620
+ ), /* @__PURE__ */ React11.createElement(StatsRow, { label: "Total Bytes Sent", value: formatBytes((_f = stats.publish) == null ? void 0 : _f.bytesSent) }), /* @__PURE__ */ React11.createElement(StatsRow, { label: "Total Bytes Received", value: formatBytes((_g = stats.subscribe) == null ? void 0 : _g.bytesReceived) }), /* @__PURE__ */ React11.createElement(
1621
+ StatsRow,
1622
+ {
1623
+ label: "Round Trip Time",
1624
+ value: `${(((((_h = stats.publish) == null ? void 0 : _h.currentRoundTripTime) || 0) + (((_i = stats.subscribe) == null ? void 0 : _i.currentRoundTripTime) || 0)) / 2).toFixed(3) * 1e3} ms`
1625
+ }
1626
+ ));
1627
+ };
1628
+ var TrackStats = ({ trackID, layer, local }) => {
1629
+ var _a;
1630
+ const selector = match({ trackID, layer, local }).with(
1631
+ {
1632
+ layer: P.when((layer2) => !!layer2)
1633
+ },
1634
+ () => selectHMSStats.localVideoTrackStatsByLayer(layer)(trackID)
1635
+ ).with({ local: P.when((local2) => !!local2) }, () => selectHMSStats.localAudioTrackStatsByID(trackID)).otherwise(() => selectHMSStats.trackStatsByID(trackID));
1636
+ const stats = useHMSStatsStore(selector);
1637
+ if (!stats) {
1638
+ return null;
1639
+ }
1640
+ const inbound = stats.type.includes("inbound");
1641
+ return /* @__PURE__ */ React11.createElement(Flex, { css: { flexWrap: "wrap", gap: "$10" } }, /* @__PURE__ */ React11.createElement(StatsRow, { label: "Type", value: stats.type + " " + stats.kind }), /* @__PURE__ */ React11.createElement(StatsRow, { label: "Bitrate", value: formatBytes(stats.bitrate, "b/s") }), /* @__PURE__ */ React11.createElement(StatsRow, { label: "Packets Lost", value: stats.packetsLost }), /* @__PURE__ */ React11.createElement(StatsRow, { label: "Jitter", value: (_a = stats.jitter) == null ? void 0 : _a.toFixed(3) }), /* @__PURE__ */ React11.createElement(
1642
+ StatsRow,
1643
+ {
1644
+ label: inbound ? "Bytes Received" : "Bytes Sent",
1645
+ value: formatBytes(inbound ? stats.bytesReceived : stats.bytesSent)
1646
+ }
1647
+ ), stats.kind === "video" && /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(StatsRow, { label: "Framerate", value: stats.framesPerSecond }), !inbound && /* @__PURE__ */ React11.createElement(StatsRow, { label: "Quality Limitation Reason", value: stats.qualityLimitationReason })), /* @__PURE__ */ React11.createElement(
1648
+ StatsRow,
1649
+ {
1650
+ label: "Round Trip Time",
1651
+ value: stats.roundTripTime ? `${(stats.roundTripTime * 1e3).toFixed(3)} ms` : "-"
1652
+ }
1653
+ ));
1654
+ };
1655
+ var DebugInfo = ({ details }) => {
1656
+ var _a;
1657
+ return /* @__PURE__ */ React11.createElement(Accordion.Root, { type: "single", collapsible: true, css: { w: "100%" } }, /* @__PURE__ */ React11.createElement(Accordion.Item, { value: "Debug Info" }, /* @__PURE__ */ React11.createElement(Accordion.Header, null, /* @__PURE__ */ React11.createElement(Label, { variant: "body2", css: { c: "$on_surface_high" } }, "Debug Info")), /* @__PURE__ */ React11.createElement(Accordion.Content, null, /* @__PURE__ */ React11.createElement(Flex, { css: { flexWrap: "wrap", mt: "$10", gap: "$10" } }, /* @__PURE__ */ React11.createElement(StatsRow, { css: { w: "100%" }, label: "Websocket URL", value: details == null ? void 0 : details.websocketURL }), /* @__PURE__ */ React11.createElement(StatsRow, { css: { w: "100%" }, label: "Init Endpoint", value: details == null ? void 0 : details.initEndpoint }), /* @__PURE__ */ React11.createElement(StatsRow, { css: { w: "100%" }, label: "Enabled flags", value: (_a = details == null ? void 0 : details.enabledFlags) == null ? void 0 : _a.join(", ") })))));
1658
+ };
1659
+ var StatsRow = React11.memo(({ label, value, css }) => /* @__PURE__ */ React11.createElement(Box, { css: __spreadValues({ bg: "$surface_bright", w: "calc(50% - $6)", p: "$8", r: "$3" }, css) }, /* @__PURE__ */ React11.createElement(
1660
+ Text,
1661
+ {
1662
+ variant: "overline",
1663
+ css: {
1664
+ fontWeight: "$semiBold",
1665
+ color: "$on_surface_medium",
1666
+ textTransform: "uppercase"
1667
+ }
1668
+ },
1669
+ label
1670
+ ), /* @__PURE__ */ React11.createElement(Text, { variant: "sub1", css: { fontWeight: "$semiBold", color: "$on_surface_high" } }, value || "-")));
1671
+
1672
+ // src/Prebuilt/components/MoreSettings/BulkRoleChangeModal.jsx
1673
+ init_define_process_env();
1674
+ import React12, { useCallback as useCallback8, useRef as useRef3, useState as useState9 } from "react";
1675
+ import { useHMSActions as useHMSActions8 } from "@100mslive/react-sdk";
1676
+ import { AlertTriangleIcon as AlertTriangleIcon2, ChangeRoleIcon, CheckIcon } from "@100mslive/react-icons";
1677
+ var BulkRoleChangeModal = ({ onOpenChange }) => {
1678
+ var _a, _b;
1679
+ const roles = useFilteredRoles();
1680
+ const hmsActions = useHMSActions8();
1681
+ const ref = useRef3(null);
1682
+ const roleRef = useRef3(null);
1683
+ const [selectedBulkRole, setBulkRole] = useState9([]);
1684
+ const [selectedRole, setRole] = useState9("");
1685
+ const [bulkRoleDialog, setBulkRoleDialog] = useState9(false);
1686
+ const [roleDialog, setRoleDialog] = useState9(false);
1687
+ const [errorMessage, setErrorMessage] = useState9("");
1688
+ const [isSubmiting, setIsSubmiting] = useState9(false);
1689
+ const changeBulkRole = useCallback8(() => __async(void 0, null, function* () {
1690
+ if (selectedBulkRole.length > 0 && selectedRole) {
1691
+ try {
1692
+ setIsSubmiting(true);
1693
+ yield hmsActions.changeRoleOfPeersWithRoles(selectedBulkRole, selectedRole);
1694
+ setIsSubmiting(false);
1695
+ setErrorMessage("");
1696
+ onOpenChange(false);
1697
+ } catch (err) {
1698
+ setErrorMessage((err == null ? void 0 : err.message) ? err == null ? void 0 : err.message : "Unknown error");
1699
+ setIsSubmiting(false);
1700
+ }
1701
+ }
1702
+ }), [selectedBulkRole, selectedRole, hmsActions, onOpenChange]);
1703
+ return /* @__PURE__ */ React12.createElement(Dialog.Root, { defaultOpen: true, onOpenChange }, /* @__PURE__ */ React12.createElement(DialogContent, { title: "Bulk Role Change", Icon: ChangeRoleIcon }, /* @__PURE__ */ React12.createElement(DialogRow, null, /* @__PURE__ */ React12.createElement(Text, null, "For Roles: "), /* @__PURE__ */ React12.createElement(
1704
+ Dropdown.Root,
1705
+ {
1706
+ open: bulkRoleDialog,
1707
+ onOpenChange: (value) => {
1708
+ if (value) {
1709
+ setBulkRoleDialog(value);
1710
+ }
1711
+ },
1712
+ modal: false
1713
+ },
1714
+ /* @__PURE__ */ React12.createElement(
1715
+ DialogDropdownTrigger,
1716
+ {
1717
+ ref,
1718
+ title: selectedBulkRole.length === 0 ? "Select Multiple Roles" : selectedBulkRole.toString(),
1719
+ css: {
1720
+ w: "70%",
1721
+ p: "$8"
1722
+ },
1723
+ open: bulkRoleDialog
1724
+ }
1725
+ ),
1726
+ /* @__PURE__ */ React12.createElement(
1727
+ Dropdown.Content,
1728
+ {
1729
+ css: { w: (_a = ref.current) == null ? void 0 : _a.clientWidth, zIndex: 1e3 },
1730
+ onInteractOutside: () => {
1731
+ if (bulkRoleDialog) {
1732
+ setBulkRoleDialog(false);
1733
+ }
1734
+ }
1735
+ },
1736
+ roles && roles.map((role) => {
1737
+ return /* @__PURE__ */ React12.createElement(
1738
+ Dropdown.CheckboxItem,
1739
+ {
1740
+ key: role,
1741
+ checked: selectedBulkRole.includes(role),
1742
+ onCheckedChange: (value) => {
1743
+ setBulkRole((selection) => {
1744
+ return value ? [...selection, role] : selection.filter((selectedRole2) => selectedRole2 !== role);
1745
+ });
1746
+ setErrorMessage("");
1747
+ }
1748
+ },
1749
+ /* @__PURE__ */ React12.createElement(Checkbox.Root, { css: { margin: "$2" }, checked: selectedBulkRole.includes(role) }, /* @__PURE__ */ React12.createElement(Checkbox.Indicator, null, /* @__PURE__ */ React12.createElement(CheckIcon, { width: 16, height: 16 }))),
1750
+ role
1751
+ );
1752
+ })
1753
+ )
1754
+ )), /* @__PURE__ */ React12.createElement(DialogRow, null, /* @__PURE__ */ React12.createElement(Text, null, "To Role: "), /* @__PURE__ */ React12.createElement(Dropdown.Root, { open: roleDialog, onOpenChange: (value) => setRoleDialog(value) }, /* @__PURE__ */ React12.createElement(
1755
+ DialogDropdownTrigger,
1756
+ {
1757
+ ref: roleRef,
1758
+ title: selectedRole || "Select Role",
1759
+ css: {
1760
+ w: "70%",
1761
+ p: "$8"
1762
+ },
1763
+ open: roleDialog
1764
+ }
1765
+ ), /* @__PURE__ */ React12.createElement(Dropdown.Content, { css: { w: (_b = roleRef.current) == null ? void 0 : _b.clientWidth, zIndex: 1e3 } }, roles && roles.map((role) => {
1766
+ return /* @__PURE__ */ React12.createElement(
1767
+ Dropdown.Item,
1768
+ {
1769
+ key: role,
1770
+ onSelect: () => {
1771
+ setRole(role);
1772
+ setErrorMessage("");
1773
+ }
1774
+ },
1775
+ role
1776
+ );
1777
+ })))), /* @__PURE__ */ React12.createElement(DialogRow, null, errorMessage && /* @__PURE__ */ React12.createElement(Flex, { gap: 2, css: { c: "$alert_error_default", w: "70%", ml: "auto" } }, /* @__PURE__ */ React12.createElement(AlertTriangleIcon2, null), /* @__PURE__ */ React12.createElement(Text, { css: { c: "inherit" } }, errorMessage))), /* @__PURE__ */ React12.createElement(DialogRow, { justify: "end" }, /* @__PURE__ */ React12.createElement(Button, { variant: "primary", onClick: changeBulkRole, disabled: !(selectedRole && selectedBulkRole.length > 0) }, isSubmiting && /* @__PURE__ */ React12.createElement(Loading, { css: { color: "$on_primary_medium" } }), "Apply"))));
1778
+ };
1779
+
1780
+ // src/Prebuilt/components/MoreSettings/CaptionModal.tsx
1781
+ init_define_process_env();
1782
+ import React14 from "react";
1783
+ import { useMedia as useMedia4 } from "react-use";
1784
+
1785
+ // src/Prebuilt/components/MoreSettings/CaptionContent.tsx
1786
+ init_define_process_env();
1787
+ import React13 from "react";
1788
+ import { HMSTranscriptionMode, selectIsTranscriptionEnabled, useHMSActions as useHMSActions9, useHMSStore as useHMSStore8 } from "@100mslive/react-sdk";
1789
+ import { AlertTriangleIcon as AlertTriangleIcon3, CrossIcon as CrossIcon2 } from "@100mslive/react-icons";
1790
+ var CaptionContent = ({ isMobile, onExit }) => {
1791
+ const DURATION = 2e3;
1792
+ const actions = useHMSActions9();
1793
+ const isTranscriptionEnabled = useHMSStore8(selectIsTranscriptionEnabled);
1794
+ const [toastId, setToastId] = useSetAppDataByKey(CAPTION_TOAST.captionToast);
1795
+ const [isCaptionEnabled, setIsCaptionEnabled] = useSetIsCaptionEnabled();
1796
+ return /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(
1797
+ Text,
1798
+ {
1799
+ variant: isMobile ? "md" : "lg",
1800
+ css: {
1801
+ color: "$on_surface_high",
1802
+ fontWeight: "$semiBold",
1803
+ display: "flex",
1804
+ "@md": { px: "$8" }
1805
+ }
1806
+ },
1807
+ isTranscriptionEnabled ? "Disable" : "Enable",
1808
+ " Closed Caption (CC) for this session?",
1809
+ /* @__PURE__ */ React13.createElement(
1810
+ Box,
1811
+ {
1812
+ css: { color: "inherit", ml: "auto", "&:hover": { color: "$on_surface_medium", cursor: "pointer" } },
1813
+ onClick: onExit
1814
+ },
1815
+ /* @__PURE__ */ React13.createElement(CrossIcon2, null)
1816
+ )
1817
+ ), !isMobile ? /* @__PURE__ */ React13.createElement(Text, { variant: "sm", css: { color: "$on_surface_medium", mt: "$4", "@md": { px: "$8" } } }, "This will ", isTranscriptionEnabled ? "disable" : "enable", " Closed Captions for everyone in this room. You can\xA0", isTranscriptionEnabled ? "enable" : "disable", " it later.") : null, /* @__PURE__ */ React13.createElement(
1818
+ Flex,
1819
+ {
1820
+ justify: "between",
1821
+ align: "center",
1822
+ css: {
1823
+ width: "100%",
1824
+ gap: "$md",
1825
+ mt: "$10",
1826
+ "@md": { px: "$4" }
1827
+ }
1828
+ },
1829
+ isMobile ? null : /* @__PURE__ */ React13.createElement(Button, { variant: "standard", css: { w: "100%" }, outlined: true, onClick: onExit }, "Cancel"),
1830
+ /* @__PURE__ */ React13.createElement(
1831
+ Flex,
1832
+ {
1833
+ direction: "column",
1834
+ justify: "between",
1835
+ align: "center",
1836
+ css: {
1837
+ width: "100%",
1838
+ "@md": { px: "$4" }
1839
+ }
1840
+ },
1841
+ isMobile && isTranscriptionEnabled ? /* @__PURE__ */ React13.createElement(
1842
+ Button,
1843
+ {
1844
+ variant: "standard",
1845
+ css: { w: "100%", mb: "$4" },
1846
+ outlined: true,
1847
+ onClick: () => {
1848
+ setIsCaptionEnabled(!isCaptionEnabled);
1849
+ onExit();
1850
+ }
1851
+ },
1852
+ isCaptionEnabled ? "Hide For Me" : "Show For Me"
1853
+ ) : null,
1854
+ /* @__PURE__ */ React13.createElement(
1855
+ Button,
1856
+ {
1857
+ variant: isTranscriptionEnabled ? "danger" : "primary",
1858
+ css: { width: "100%" },
1859
+ "data-testid": "popup_change_btn",
1860
+ onClick: () => __async(void 0, null, function* () {
1861
+ try {
1862
+ if (isTranscriptionEnabled) {
1863
+ yield actions.stopTranscription({
1864
+ mode: HMSTranscriptionMode.CAPTION
1865
+ });
1866
+ setIsCaptionEnabled(false);
1867
+ const id2 = ToastManager.replaceToast(toastId, {
1868
+ title: `Disabling Closed Caption for everyone.`,
1869
+ variant: "standard",
1870
+ duration: DURATION,
1871
+ icon: /* @__PURE__ */ React13.createElement(Loading, { color: "currentColor" })
1872
+ });
1873
+ setToastId(id2);
1874
+ onExit();
1875
+ return;
1876
+ }
1877
+ yield actions.startTranscription({
1878
+ mode: HMSTranscriptionMode.CAPTION
1879
+ });
1880
+ const id = ToastManager.replaceToast(toastId, {
1881
+ title: `Enabling Closed Caption for everyone.`,
1882
+ variant: "standard",
1883
+ duration: DURATION,
1884
+ icon: /* @__PURE__ */ React13.createElement(Loading, { color: "currentColor" })
1885
+ });
1886
+ setToastId(id);
1887
+ } catch (err) {
1888
+ const id = ToastManager.replaceToast(toastId, {
1889
+ title: `Failed to ${isTranscriptionEnabled ? "disable" : "enable"} closed caption`,
1890
+ variant: "error",
1891
+ icon: /* @__PURE__ */ React13.createElement(AlertTriangleIcon3, { style: { marginRight: "0.5rem" } })
1892
+ });
1893
+ setToastId(id);
1894
+ } finally {
1895
+ setIsCaptionEnabled(true);
1896
+ }
1897
+ onExit();
1898
+ })
1899
+ },
1900
+ isTranscriptionEnabled ? "Disable" : "Enable",
1901
+ " for Everyone"
1902
+ )
1903
+ )
1904
+ ), isMobile && /* @__PURE__ */ React13.createElement(Text, { variant: "sm", css: { color: "$on_surface_medium", pb: "$4", mb: "$8", "@md": { px: "$8", mt: "$4" } } }, "This will ", isTranscriptionEnabled ? "disable" : "enable", " Closed Captions for everyone in this room. You can\xA0", isTranscriptionEnabled ? "enable" : "disable", " it later."));
1905
+ };
1906
+
1907
+ // src/Prebuilt/components/MoreSettings/CaptionModal.tsx
1908
+ var CaptionModal = ({ onOpenChange }) => {
1909
+ const isMobile = useMedia4(config.media.md);
1910
+ const props = {
1911
+ isMobile,
1912
+ onExit: () => {
1913
+ onOpenChange(false);
1914
+ }
1915
+ };
1916
+ if (isMobile) {
1917
+ return /* @__PURE__ */ React14.createElement(Sheet.Root, { defaultOpen: true, onOpenChange }, /* @__PURE__ */ React14.createElement(Sheet.Content, { css: { bg: "$surface_dim", p: "$8 0" } }, /* @__PURE__ */ React14.createElement(CaptionContent, __spreadValues({}, props))));
1918
+ }
1919
+ return /* @__PURE__ */ React14.createElement(Dialog.Root, { defaultOpen: true, onOpenChange }, /* @__PURE__ */ React14.createElement(Dialog.Portal, null, /* @__PURE__ */ React14.createElement(Dialog.Overlay, null), /* @__PURE__ */ React14.createElement(Dialog.Content, { css: { bg: "$surface_dim", width: "min(400px,80%)", p: "$10" } }, /* @__PURE__ */ React14.createElement(CaptionContent, __spreadValues({}, props)))));
1920
+ };
1921
+
1922
+ // src/Prebuilt/components/MoreSettings/FullScreenItem.tsx
1923
+ init_define_process_env();
1924
+ import React15 from "react";
1925
+ import { ExpandIcon } from "@100mslive/react-icons";
1926
+
1927
+ // src/Prebuilt/components/hooks/useFullscreen.ts
1928
+ init_define_process_env();
1929
+ import { useCallback as useCallback9, useEffect as useEffect6, useState as useState10 } from "react";
1930
+ import screenfull from "screenfull";
1931
+ var useFullscreen = () => {
1932
+ const [isFullScreenEnabled, setIsFullScreenEnabled] = useState10(screenfull.isFullscreen);
1933
+ const toggle = useCallback9(() => __async(void 0, null, function* () {
1934
+ if (!screenfull.isEnabled) {
1935
+ ToastManager.addToast({ title: "Fullscreen feature not supported" });
1936
+ return;
1937
+ }
1938
+ try {
1939
+ const container = document.querySelector(DEFAULT_PORTAL_CONTAINER);
1940
+ if (isFullScreenEnabled) {
1941
+ yield screenfull.exit();
1942
+ } else if (container) {
1943
+ yield screenfull.request(container);
1944
+ }
1945
+ } catch (err) {
1946
+ ToastManager.addToast({ title: err.message });
1947
+ }
1948
+ }), [isFullScreenEnabled]);
1949
+ useEffect6(() => {
1950
+ const onChange = () => {
1951
+ setIsFullScreenEnabled(screenfull.isFullscreen);
1952
+ };
1953
+ if (screenfull.isEnabled) {
1954
+ screenfull.on("change", onChange);
1955
+ }
1956
+ return () => {
1957
+ if (screenfull.isEnabled) {
1958
+ screenfull.off("change", onChange);
1959
+ }
1960
+ };
1961
+ }, []);
1962
+ return {
1963
+ allowed: screenfull.isEnabled,
1964
+ isFullscreen: isFullScreenEnabled,
1965
+ toggleFullscreen: toggle
1966
+ };
1967
+ };
1968
+
1969
+ // src/Prebuilt/components/MoreSettings/FullScreenItem.tsx
1970
+ var FullScreenItem = () => {
1971
+ const { allowed, isFullscreen, toggleFullscreen } = useFullscreen();
1972
+ if (!allowed) {
1973
+ return null;
1974
+ }
1975
+ return /* @__PURE__ */ React15.createElement(
1976
+ Dropdown.Item,
1977
+ {
1978
+ onClick: () => {
1979
+ toggleFullscreen();
1980
+ },
1981
+ "data-testid": "full_screen_btn"
1982
+ },
1983
+ /* @__PURE__ */ React15.createElement(ExpandIcon, null),
1984
+ /* @__PURE__ */ React15.createElement(Text, { variant: "sm", css: { ml: "$4" } }, isFullscreen ? "Exit " : "Go ", "Fullscreen")
1985
+ );
1986
+ };
1987
+
1988
+ // src/Prebuilt/components/MoreSettings/MuteAllModal.tsx
1989
+ init_define_process_env();
1990
+ import React17, { useCallback as useCallback10, useState as useState11 } from "react";
1991
+ import {
1992
+ selectAvailableRoleNames,
1993
+ useHMSActions as useHMSActions10,
1994
+ useHMSStore as useHMSStore10
1995
+ } from "@100mslive/react-sdk";
1996
+ import { MicOffIcon } from "@100mslive/react-icons";
1997
+
1998
+ // src/Prebuilt/components/MoreSettings/MuteAllContent.tsx
1999
+ init_define_process_env();
2000
+ import React16 from "react";
2001
+ import { selectPermissions as selectPermissions3, useHMSStore as useHMSStore9 } from "@100mslive/react-sdk";
2002
+ var MuteAllContent = (props) => {
2003
+ const roles = props.roles || [];
2004
+ const permissions = useHMSStore9(selectPermissions3);
2005
+ return /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(
2006
+ DialogSelect,
2007
+ {
2008
+ title: "Role",
2009
+ options: [{ label: "All Roles", value: "" }, ...roles.map((role) => ({ label: role, value: role }))],
2010
+ selected: props.selectedRole,
2011
+ keyField: "value",
2012
+ labelField: "label",
2013
+ onChange: props.setRole
2014
+ }
2015
+ ), /* @__PURE__ */ React16.createElement(
2016
+ DialogSelect,
2017
+ {
2018
+ title: "Track type",
2019
+ options: trackTypeOptions,
2020
+ selected: props.trackType,
2021
+ onChange: props.setTrackType,
2022
+ keyField: "value",
2023
+ labelField: "label"
2024
+ }
2025
+ ), /* @__PURE__ */ React16.createElement(
2026
+ DialogSelect,
2027
+ {
2028
+ title: "Track source",
2029
+ options: trackSourceOptions,
2030
+ selected: props.selectedSource,
2031
+ onChange: props.setSource,
2032
+ keyField: "value",
2033
+ labelField: "label"
2034
+ }
2035
+ ), /* @__PURE__ */ React16.createElement(DialogRow, null, /* @__PURE__ */ React16.createElement(Text, { variant: "md" }, "Track status"), /* @__PURE__ */ React16.createElement(RadioGroup.Root, { value: String(props.enabled), onValueChange: (value) => props.setEnabled(value === "true") }, (permissions == null ? void 0 : permissions.mute) && /* @__PURE__ */ React16.createElement(Flex, { align: "center", css: { mr: "$8" } }, /* @__PURE__ */ React16.createElement(RadioGroup.Item, { value: "false", id: "trackDisableRadio", css: { mr: "$4" } }, /* @__PURE__ */ React16.createElement(RadioGroup.Indicator, null)), /* @__PURE__ */ React16.createElement(Label, { htmlFor: "trackDisableRadio" }, "Mute")), (permissions == null ? void 0 : permissions.unmute) && /* @__PURE__ */ React16.createElement(Flex, { align: "center", css: { cursor: "pointer" } }, /* @__PURE__ */ React16.createElement(RadioGroup.Item, { value: "true", id: "trackEnableRadio", css: { mr: "$4" } }, /* @__PURE__ */ React16.createElement(RadioGroup.Indicator, null)), /* @__PURE__ */ React16.createElement(Label, { htmlFor: "trackEnableRadio" }, "Request Unmute")))), /* @__PURE__ */ React16.createElement(DialogRow, { justify: "end" }, /* @__PURE__ */ React16.createElement(Button, { variant: "primary", onClick: props.muteAll, css: { w: (props == null ? void 0 : props.isMobile) ? "100%" : "" } }, "Apply")));
2036
+ };
2037
+
2038
+ // src/Prebuilt/components/MoreSettings/MuteAllModal.tsx
2039
+ var MuteAllModal = ({
2040
+ onOpenChange,
2041
+ isMobile = false
2042
+ }) => {
2043
+ const roles = useHMSStore10(selectAvailableRoleNames);
2044
+ const hmsActions = useHMSActions10();
2045
+ const [enabled, setEnabled] = useState11(false);
2046
+ const [trackType, setTrackType] = useState11();
2047
+ const [selectedRole, setRole] = useState11();
2048
+ const [selectedSource, setSource] = useState11();
2049
+ const muteAll = useCallback10(() => __async(void 0, null, function* () {
2050
+ yield hmsActions.setRemoteTracksEnabled({
2051
+ enabled,
2052
+ type: trackType,
2053
+ source: selectedSource,
2054
+ roles: selectedRole ? [selectedRole] : void 0
2055
+ });
2056
+ onOpenChange(false);
2057
+ }), [selectedRole, enabled, trackType, selectedSource, hmsActions, onOpenChange]);
2058
+ const props = {
2059
+ muteAll,
2060
+ roles,
2061
+ enabled,
2062
+ setEnabled,
2063
+ trackType,
2064
+ setTrackType,
2065
+ selectedRole,
2066
+ setRole,
2067
+ selectedSource,
2068
+ setSource,
2069
+ isMobile
2070
+ };
2071
+ if (isMobile) {
2072
+ return /* @__PURE__ */ React17.createElement(Sheet.Root, { defaultOpen: true, onOpenChange }, /* @__PURE__ */ React17.createElement(Sheet.Content, { css: { px: "$10" } }, /* @__PURE__ */ React17.createElement(MuteAllContent, __spreadValues({}, props))));
2073
+ }
2074
+ return /* @__PURE__ */ React17.createElement(Dialog.Root, { defaultOpen: true, onOpenChange }, /* @__PURE__ */ React17.createElement(DialogContent, { title: "Mute/Unmute Remote Tracks", Icon: MicOffIcon }, /* @__PURE__ */ React17.createElement(MuteAllContent, __spreadValues({}, props))));
2075
+ };
2076
+
2077
+ // src/Prebuilt/components/PIP/usePIPChat.tsx
2078
+ init_define_process_env();
2079
+ import { useEffect as useEffect7 } from "react";
2080
+ import { useHMSActions as useHMSActions11 } from "@100mslive/react-sdk";
2081
+ var usePIPChat = () => {
2082
+ const hmsActions = useHMSActions11();
2083
+ const { isSupported, requestPipWindow, pipWindow, closePipWindow } = usePIPWindow();
2084
+ useEffect7(() => {
2085
+ if (document && pipWindow) {
2086
+ const style = document.createElement("style");
2087
+ style.id = "stitches";
2088
+ style.textContent = getCssText();
2089
+ pipWindow.document.head.appendChild(style);
2090
+ }
2091
+ }, [pipWindow]);
2092
+ useEffect7(() => {
2093
+ if (pipWindow) {
2094
+ const chatContainer = pipWindow.document.getElementById("chat-container");
2095
+ const selector = pipWindow.document.getElementById("selector");
2096
+ const sendBtn = pipWindow.document.getElementById("send-btn");
2097
+ const pipChatInput = pipWindow.document.getElementById("chat-input");
2098
+ const marker = pipWindow.document.getElementById("marker");
2099
+ marker == null ? void 0 : marker.scrollIntoView({ block: "end" });
2100
+ const observer = new IntersectionObserver(
2101
+ (entries) => {
2102
+ entries.forEach((entry) => {
2103
+ if (entry.isIntersecting && entry.target.id) {
2104
+ hmsActions.setMessageRead(true, entry.target.id);
2105
+ }
2106
+ });
2107
+ },
2108
+ {
2109
+ root: chatContainer,
2110
+ threshold: 0.8
2111
+ }
2112
+ );
2113
+ const mutationObserver = new MutationObserver((mutations) => {
2114
+ mutations.forEach((mutation) => {
2115
+ if (mutation.addedNodes.length > 0) {
2116
+ const newMessages = mutation.addedNodes;
2117
+ newMessages.forEach((message) => {
2118
+ const messageId = message == null ? void 0 : message.id;
2119
+ if (messageId === "new-message-notif") {
2120
+ message.addEventListener(
2121
+ "click",
2122
+ () => setTimeout(() => marker == null ? void 0 : marker.scrollIntoView({ block: "end", behavior: "smooth" }), 0)
2123
+ );
2124
+ } else if (messageId)
2125
+ observer.observe(message);
2126
+ });
2127
+ }
2128
+ });
2129
+ });
2130
+ mutationObserver.observe(chatContainer, {
2131
+ childList: true
2132
+ });
2133
+ const sendMessage = () => __async(void 0, null, function* () {
2134
+ const selection = (selector == null ? void 0 : selector.value) || "Everyone";
2135
+ if (selection === "Everyone") {
2136
+ yield hmsActions.sendBroadcastMessage(pipChatInput.value.trim());
2137
+ } else {
2138
+ yield hmsActions.sendGroupMessage(pipChatInput.value.trim(), [selection]);
2139
+ }
2140
+ pipChatInput.value = "";
2141
+ setTimeout(() => marker == null ? void 0 : marker.scrollIntoView({ block: "end", behavior: "smooth" }), 0);
2142
+ });
2143
+ if (sendBtn && hmsActions && pipChatInput) {
2144
+ const pipMessages = pipWindow.document.getElementsByClassName("pip-message");
2145
+ [...pipMessages].forEach((message) => {
2146
+ if (message.id) {
2147
+ hmsActions.setMessageRead(true, message.id);
2148
+ }
2149
+ });
2150
+ const sendOnEnter = (e) => {
2151
+ if (e.key === "Enter")
2152
+ sendMessage();
2153
+ };
2154
+ sendBtn.addEventListener("click", sendMessage);
2155
+ pipChatInput.addEventListener("keypress", sendOnEnter);
2156
+ return () => {
2157
+ sendBtn.removeEventListener("click", sendMessage);
2158
+ pipChatInput.removeEventListener("keypress", sendOnEnter);
2159
+ mutationObserver.disconnect();
2160
+ observer.disconnect();
2161
+ };
2162
+ }
2163
+ }
2164
+ }, [pipWindow, hmsActions]);
2165
+ useEffect7(() => {
2166
+ return () => {
2167
+ pipWindow && closePipWindow();
2168
+ };
2169
+ }, [closePipWindow, pipWindow]);
2170
+ return { isSupported, requestPipWindow, pipWindow };
2171
+ };
2172
+
2173
+ // src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.tsx
2174
+ var MODALS = {
2175
+ CHANGE_NAME: "changeName",
2176
+ SELF_ROLE_CHANGE: "selfRoleChange",
2177
+ MORE_SETTINGS: "moreSettings",
2178
+ START_RECORDING: "startRecording",
2179
+ DEVICE_SETTINGS: "deviceSettings",
2180
+ STATS_FOR_NERDS: "statsForNerds",
2181
+ BULK_ROLE_CHANGE: "bulkRoleChange",
2182
+ MUTE_ALL: "muteAll",
2183
+ EMBED_URL: "embedUrl",
2184
+ CAPTION: "caption"
2185
+ };
2186
+ var DesktopOptions = ({
2187
+ elements,
2188
+ screenType
2189
+ }) => {
2190
+ const localPeerId = useHMSStore11(selectLocalPeerID4);
2191
+ const hmsActions = useHMSActions12();
2192
+ const enablHlsStats = useHMSStore11(selectAppData(APP_DATA.hlsStats));
2193
+ const [openModals, setOpenModals] = useState12(/* @__PURE__ */ new Set());
2194
+ const { isBRBOn, toggleBRB } = useMyMetadata();
2195
+ const isPipOn = PictureInPicture.isOn();
2196
+ const isBRBEnabled = !!(elements == null ? void 0 : elements.brb);
2197
+ const isTranscriptionAllowed = useHMSStore11(selectIsTranscriptionAllowedByMode(HMSTranscriptionMode2.CAPTION));
2198
+ const isTranscriptionEnabled = useHMSStore11(selectIsTranscriptionEnabled2);
2199
+ const { isSupported, pipWindow, requestPipWindow } = usePIPChat();
2200
+ const isChatOpen = useIsSidepaneTypeOpen(SIDE_PANE_OPTIONS.CHAT);
2201
+ const toggleChat = useSidepaneToggle(SIDE_PANE_OPTIONS.CHAT);
2202
+ const showPipChatOption = !!(elements == null ? void 0 : elements.chat) && isSupported && !pipWindow;
2203
+ useDropdownList({ open: openModals.size > 0, name: "MoreSettings" });
2204
+ const updateState = (modalName, value) => {
2205
+ setOpenModals((modals) => {
2206
+ const copy = new Set(modals);
2207
+ if (value) {
2208
+ copy.clear();
2209
+ copy.add(modalName);
2210
+ } else {
2211
+ copy.delete(modalName);
2212
+ }
2213
+ return copy;
2214
+ });
2215
+ };
2216
+ return /* @__PURE__ */ React18.createElement(Fragment2, null, isSupported && pipWindow ? /* @__PURE__ */ React18.createElement(PIPWindow, { pipWindow }, /* @__PURE__ */ React18.createElement(PIPChat, null)) : null, /* @__PURE__ */ React18.createElement(
2217
+ Dropdown.Root,
2218
+ {
2219
+ open: openModals.has(MODALS.MORE_SETTINGS),
2220
+ onOpenChange: (value) => updateState(MODALS.MORE_SETTINGS, value),
2221
+ modal: false
2222
+ },
2223
+ /* @__PURE__ */ React18.createElement(Tooltip, { title: "More options" }, /* @__PURE__ */ React18.createElement(Dropdown.Trigger, { asChild: true, "data-testid": "more_settings_btn" }, /* @__PURE__ */ React18.createElement(IconButton_default, null, /* @__PURE__ */ React18.createElement(HamburgerMenuIcon, null)))),
2224
+ /* @__PURE__ */ React18.createElement(
2225
+ Dropdown.Content,
2226
+ {
2227
+ sideOffset: 5,
2228
+ align: "end",
2229
+ css: {
2230
+ py: "$0",
2231
+ maxHeight: "unset",
2232
+ "@md": { w: "$64" },
2233
+ "div[role='separator']:first-child": {
2234
+ display: "none"
2235
+ }
2236
+ }
2237
+ },
2238
+ isBRBEnabled && screenType !== "hls_live_streaming" ? /* @__PURE__ */ React18.createElement(Dropdown.Item, { onClick: toggleBRB, "data-testid": "brb_btn" }, /* @__PURE__ */ React18.createElement(BrbIcon, null), /* @__PURE__ */ React18.createElement(Text, { variant: "sm", css: { ml: "$4", color: "$on_surface_high" } }, "Be Right Back"), /* @__PURE__ */ React18.createElement(Flex, { justify: "end", css: { color: "$on_surface_high", flexGrow: "1" } }, isBRBOn ? /* @__PURE__ */ React18.createElement(CheckIcon2, null) : null)) : null,
2239
+ isTranscriptionAllowed ? /* @__PURE__ */ React18.createElement(
2240
+ Dropdown.Item,
2241
+ {
2242
+ "data-testid": "closed_caption_admin",
2243
+ onClick: () => {
2244
+ updateState(MODALS.CAPTION, true);
2245
+ }
2246
+ },
2247
+ /* @__PURE__ */ React18.createElement(OpenCaptionIcon, null),
2248
+ /* @__PURE__ */ React18.createElement(Flex, { direction: "column", css: { flexGrow: "1" } }, /* @__PURE__ */ React18.createElement(Text, { variant: "sm", css: { ml: "$4", color: "$on_surface_high" } }, "Closed Captions"), /* @__PURE__ */ React18.createElement(Text, { variant: "caption", css: { ml: "$4", color: "$on_surface_medium" } }, isTranscriptionEnabled ? "Enabled" : "Disabled")),
2249
+ /* @__PURE__ */ React18.createElement(Switch, { id: "closed_caption_start_stop", checked: isTranscriptionEnabled, disabled: false })
2250
+ ) : null,
2251
+ screenType !== "hls_live_streaming" ? /* @__PURE__ */ React18.createElement(Dropdown.Item, { css: { p: 0, "&:empty": { display: "none" } } }, /* @__PURE__ */ React18.createElement(
2252
+ PIP,
2253
+ {
2254
+ content: /* @__PURE__ */ React18.createElement(Flex, { css: { w: "100%", h: "100%", p: "$8" } }, /* @__PURE__ */ React18.createElement(PipIcon2, null), /* @__PURE__ */ React18.createElement(Text, { variant: "sm", css: { ml: "$4" } }, isPipOn ? "Disable" : "Enable", " Picture-in-Picture"))
2255
+ }
2256
+ )) : null,
2257
+ /* @__PURE__ */ React18.createElement(
2258
+ PIPChatOption,
2259
+ {
2260
+ showPIPChat: showPipChatOption,
2261
+ openChat: () => __async(void 0, null, function* () {
2262
+ isChatOpen && toggleChat();
2263
+ yield requestPipWindow(350, 500);
2264
+ })
2265
+ }
2266
+ ),
2267
+ /* @__PURE__ */ React18.createElement(FullScreenItem, null),
2268
+ /* @__PURE__ */ React18.createElement(Dropdown.ItemSeparator, { css: { mx: 0 } }),
2269
+ /* @__PURE__ */ React18.createElement(Dropdown.Item, { onClick: () => updateState(MODALS.DEVICE_SETTINGS, true), "data-testid": "device_settings_btn" }, /* @__PURE__ */ React18.createElement(SettingsIcon, null), /* @__PURE__ */ React18.createElement(Text, { variant: "sm", css: { ml: "$4" } }, "Settings")),
2270
+ match2({ screenType, isSupported: HMSHLSPlayer.isSupported() }).with({ screenType: "hls_live_streaming", isSupported: false }, () => null).with({ screenType: "hls_live_streaming", isSupported: true }, () => {
2271
+ return /* @__PURE__ */ React18.createElement(
2272
+ Dropdown.Item,
2273
+ {
2274
+ onClick: () => hmsActions.setAppData(APP_DATA.hlsStats, !enablHlsStats),
2275
+ "data-testid": "hls_stats"
2276
+ },
2277
+ /* @__PURE__ */ React18.createElement(
2278
+ Checkbox.Root,
2279
+ {
2280
+ css: { margin: "$2" },
2281
+ checked: enablHlsStats,
2282
+ onCheckedChange: () => hmsActions.setAppData(APP_DATA.hlsStats, !enablHlsStats)
2283
+ },
2284
+ /* @__PURE__ */ React18.createElement(Checkbox.Indicator, null, /* @__PURE__ */ React18.createElement(CheckIcon2, { width: 16, height: 16 }))
2285
+ ),
2286
+ /* @__PURE__ */ React18.createElement(Flex, { justify: "between", css: { width: "100%" } }, /* @__PURE__ */ React18.createElement(Text, { variant: "sm", css: { ml: "$4" } }, "Show HLS Stats"), /* @__PURE__ */ React18.createElement(Text, { variant: "sm", css: { ml: "$4" } }, `${isMacOS ? "\u2318" : "ctrl"} + ]`))
2287
+ );
2288
+ }).otherwise(() => /* @__PURE__ */ React18.createElement(
2289
+ Dropdown.Item,
2290
+ {
2291
+ onClick: () => updateState(MODALS.STATS_FOR_NERDS, true),
2292
+ "data-testid": "stats_for_nerds_btn"
2293
+ },
2294
+ /* @__PURE__ */ React18.createElement(InfoIcon2, null),
2295
+ /* @__PURE__ */ React18.createElement(Text, { variant: "sm", css: { ml: "$4" } }, "Stats for Nerds")
2296
+ ))
2297
+ )
2298
+ ), openModals.has(MODALS.BULK_ROLE_CHANGE) && /* @__PURE__ */ React18.createElement(BulkRoleChangeModal, { onOpenChange: (value) => updateState(MODALS.BULK_ROLE_CHANGE, value) }), openModals.has(MODALS.MUTE_ALL) && /* @__PURE__ */ React18.createElement(MuteAllModal, { onOpenChange: (value) => updateState(MODALS.MUTE_ALL, value) }), openModals.has(MODALS.START_RECORDING) && /* @__PURE__ */ React18.createElement(StartRecording_default, { open: true, onOpenChange: (value) => updateState(MODALS.START_RECORDING, value) }), openModals.has(MODALS.DEVICE_SETTINGS) && /* @__PURE__ */ React18.createElement(
2299
+ SettingsModal_default,
2300
+ {
2301
+ open: true,
2302
+ onOpenChange: (value) => updateState(MODALS.DEVICE_SETTINGS, value),
2303
+ screenType
2304
+ }
2305
+ ), openModals.has(MODALS.STATS_FOR_NERDS) && /* @__PURE__ */ React18.createElement(StatsForNerds, { open: true, onOpenChange: (value) => updateState(MODALS.STATS_FOR_NERDS, value) }), openModals.has(MODALS.SELF_ROLE_CHANGE) && /* @__PURE__ */ React18.createElement(
2306
+ RoleChangeModal,
2307
+ {
2308
+ peerId: localPeerId,
2309
+ onOpenChange: (value) => updateState(MODALS.SELF_ROLE_CHANGE, value)
2310
+ }
2311
+ ), openModals.has(MODALS.CAPTION) && /* @__PURE__ */ React18.createElement(CaptionModal, { onOpenChange: (value) => updateState(MODALS.CAPTION, value) }));
2312
+ };
2313
+
2314
+ // src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.tsx
2315
+ init_define_process_env();
2316
+ import React19, { useRef as useRef4, useState as useState14 } from "react";
2317
+ import { useClickAway } from "react-use";
2318
+ import { match as match3 } from "ts-pattern";
2319
+ import {
2320
+ HMSTranscriptionMode as HMSTranscriptionMode3,
2321
+ selectIsConnectedToRoom,
2322
+ selectIsLocalVideoEnabled as selectIsLocalVideoEnabled2,
2323
+ selectIsTranscriptionAllowedByMode as selectIsTranscriptionAllowedByMode2,
2324
+ selectIsTranscriptionEnabled as selectIsTranscriptionEnabled3,
2325
+ selectPeerCount,
2326
+ selectPermissions as selectPermissions4,
2327
+ useHMSActions as useHMSActions13,
2328
+ useHMSStore as useHMSStore13,
2329
+ useRecordingStreaming as useRecordingStreaming2
2330
+ } from "@100mslive/react-sdk";
2331
+ import {
2332
+ BrbIcon as BrbIcon2,
2333
+ ClosedCaptionIcon,
2334
+ CrossIcon as CrossIcon3,
2335
+ EmojiIcon,
2336
+ HamburgerMenuIcon as HamburgerMenuIcon2,
2337
+ HandIcon,
2338
+ HandRaiseSlashedIcon,
2339
+ InfoIcon as InfoIcon3,
2340
+ OpenCaptionIcon as OpenCaptionIcon2,
2341
+ PeopleIcon,
2342
+ QuizActiveIcon,
2343
+ QuizIcon,
2344
+ RecordIcon,
2345
+ SettingsIcon as SettingsIcon2,
2346
+ VirtualBackgroundIcon
2347
+ } from "@100mslive/react-icons";
2348
+
2349
+ // src/Prebuilt/components/hooks/useUnreadPollQuizPresent.tsx
2350
+ init_define_process_env();
2351
+ import { useEffect as useEffect8, useState as useState13 } from "react";
2352
+ import { HMSNotificationTypes, useHMSNotifications, useHMSStore as useHMSStore12 } from "@100mslive/react-sdk";
2353
+ var useUnreadPollQuizPresent = () => {
2354
+ const localPeerID = useHMSStore12(Ee);
2355
+ const notification = useHMSNotifications(HMSNotificationTypes.POLL_STARTED);
2356
+ const [unreadPollQuiz, setUnreadPollQuiz] = useState13(false);
2357
+ useEffect8(() => {
2358
+ if (!notification) {
2359
+ return;
2360
+ }
2361
+ setUnreadPollQuiz(notification.data.startedBy !== localPeerID);
2362
+ }, [localPeerID, notification]);
2363
+ return { unreadPollQuiz, setUnreadPollQuiz };
2364
+ };
2365
+
2366
+ // src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.tsx
2367
+ var MODALS2 = {
2368
+ CHANGE_NAME: "changeName",
2369
+ SELF_ROLE_CHANGE: "selfRoleChange",
2370
+ MORE_SETTINGS: "moreSettings",
2371
+ START_RECORDING: "startRecording",
2372
+ DEVICE_SETTINGS: "deviceSettings",
2373
+ STATS_FOR_NERDS: "statsForNerds",
2374
+ BULK_ROLE_CHANGE: "bulkRoleChange",
2375
+ MUTE_ALL: "muteAll",
2376
+ EMBED_URL: "embedUrl",
2377
+ CAPTION: "caption"
2378
+ };
2379
+ var MwebOptions = ({
2380
+ elements,
2381
+ screenType
2382
+ }) => {
2383
+ const hmsActions = useHMSActions13();
2384
+ const permissions = useHMSStore13(selectPermissions4);
2385
+ const isConnected = useHMSStore13(selectIsConnectedToRoom);
2386
+ const { isBrowserRecordingOn, isStreamingOn, isHLSRunning } = useRecordingStreaming2();
2387
+ const [openModals, setOpenModals] = useState14(/* @__PURE__ */ new Set());
2388
+ const [openOptionsSheet, setOpenOptionsSheet] = useState14(false);
2389
+ const [openSettingsSheet, setOpenSettingsSheet] = useState14(false);
2390
+ const [openStatsForNerdsSheet, setOpenStatsForNerdsSheet] = useState14(false);
2391
+ const [showEmojiCard, setShowEmojiCard] = useState14(false);
2392
+ const [showRecordingOn, setShowRecordingOn] = useState14(false);
2393
+ const toggleParticipants = useSidepaneToggle(SIDE_PANE_OPTIONS.PARTICIPANTS);
2394
+ const { showPolls } = useShowPolls();
2395
+ const togglePollView = usePollViewToggle();
2396
+ const peerCount = useHMSStore13(selectPeerCount);
2397
+ const emojiCardRef = useRef4(null);
2398
+ const { isBRBOn, toggleBRB, isHandRaised, toggleHandRaise } = useMyMetadata();
2399
+ const { unreadPollQuiz, setUnreadPollQuiz } = useUnreadPollQuizPresent();
2400
+ const { title, description } = useRoomLayoutHeader();
2401
+ const toggleDetailsSheet = useSheetToggle(SHEET_OPTIONS.ROOM_DETAILS);
2402
+ const isMobileHLSStream = useMobileHLSStream();
2403
+ const isLandscapeHLSStream = useLandscapeHLSStream();
2404
+ const toggleVB = useSidepaneToggle(SIDE_PANE_OPTIONS.VB);
2405
+ const isLocalVideoEnabled = useHMSStore13(selectIsLocalVideoEnabled2);
2406
+ const { startRecording, isRecordingLoading } = useRecordingHandler();
2407
+ const isTranscriptionAllowed = useHMSStore13(selectIsTranscriptionAllowedByMode2(HMSTranscriptionMode3.CAPTION));
2408
+ const isTranscriptionEnabled = useHMSStore13(selectIsTranscriptionEnabled3);
2409
+ const [isCaptionEnabled] = useSetIsCaptionEnabled();
2410
+ useDropdownList({ open: openModals.size > 0 || openOptionsSheet || openSettingsSheet, name: "MoreSettings" });
2411
+ const updateState = (modalName, value) => {
2412
+ setOpenModals((modals) => {
2413
+ const copy = new Set(modals);
2414
+ if (value) {
2415
+ copy.add(modalName);
2416
+ } else {
2417
+ copy.delete(modalName);
2418
+ }
2419
+ return copy;
2420
+ });
2421
+ };
2422
+ useClickAway(emojiCardRef, () => setShowEmojiCard(false));
2423
+ return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(Sheet.Root, { open: openOptionsSheet, onOpenChange: setOpenOptionsSheet }, /* @__PURE__ */ React19.createElement(Tooltip, { title: "More options" }, /* @__PURE__ */ React19.createElement(Sheet.Trigger, { asChild: true, "data-testid": "more_settings_btn" }, /* @__PURE__ */ React19.createElement(IconButton_default, { css: { bg: isMobileHLSStream || isLandscapeHLSStream ? "$surface_default" : "" } }, /* @__PURE__ */ React19.createElement(HamburgerMenuIcon2, null)))), /* @__PURE__ */ React19.createElement(Sheet.Content, { css: { bg: "$surface_dim", pb: "$14" } }, /* @__PURE__ */ React19.createElement(
2424
+ Sheet.Title,
2425
+ {
2426
+ css: {
2427
+ display: "flex",
2428
+ color: "$on_surface_high",
2429
+ w: "100%",
2430
+ justifyContent: "space-between",
2431
+ fontSize: "$md",
2432
+ mt: "$8",
2433
+ px: "$10",
2434
+ pb: "$8",
2435
+ borderBottom: "1px solid $border_default",
2436
+ mb: "$8",
2437
+ alignItems: "center"
2438
+ }
2439
+ },
2440
+ "Options",
2441
+ /* @__PURE__ */ React19.createElement(Sheet.Close, null, /* @__PURE__ */ React19.createElement(Box, { css: { color: "$on_surface_high" } }, /* @__PURE__ */ React19.createElement(CrossIcon3, null)))
2442
+ ), /* @__PURE__ */ React19.createElement(
2443
+ Box,
2444
+ {
2445
+ css: {
2446
+ display: "grid",
2447
+ gridTemplateColumns: "1fr 1fr 1fr",
2448
+ gridTemplateRows: "auto",
2449
+ gridColumnGap: "$6",
2450
+ gridRowGap: "$8",
2451
+ px: "$9"
2452
+ }
2453
+ },
2454
+ (elements == null ? void 0 : elements.participant_list) && /* @__PURE__ */ React19.createElement(
2455
+ ActionTile.Root,
2456
+ {
2457
+ onClick: () => {
2458
+ toggleParticipants();
2459
+ setOpenOptionsSheet(false);
2460
+ }
2461
+ },
2462
+ /* @__PURE__ */ React19.createElement(ActionTile.Count, null, getFormattedCount(peerCount)),
2463
+ /* @__PURE__ */ React19.createElement(PeopleIcon, null),
2464
+ /* @__PURE__ */ React19.createElement(ActionTile.Title, null, "Participants")
2465
+ ),
2466
+ elements.hand_raise ? /* @__PURE__ */ React19.createElement(
2467
+ ActionTile.Root,
2468
+ {
2469
+ active: isHandRaised,
2470
+ onClick: () => {
2471
+ toggleHandRaise();
2472
+ setOpenOptionsSheet(false);
2473
+ }
2474
+ },
2475
+ isHandRaised ? /* @__PURE__ */ React19.createElement(HandRaiseSlashedIcon, null) : /* @__PURE__ */ React19.createElement(HandIcon, null),
2476
+ /* @__PURE__ */ React19.createElement(ActionTile.Title, null, isHandRaised ? "Lower" : "Raise", " Hand")
2477
+ ) : null,
2478
+ /* @__PURE__ */ React19.createElement(NoiseCancellation, { setOpenOptionsSheet, actionTile: true }),
2479
+ isTranscriptionAllowed ? /* @__PURE__ */ React19.createElement(
2480
+ ActionTile.Root,
2481
+ {
2482
+ onClick: () => {
2483
+ setOpenOptionsSheet(false);
2484
+ updateState(MODALS2.CAPTION, true);
2485
+ }
2486
+ },
2487
+ isTranscriptionEnabled && isCaptionEnabled ? /* @__PURE__ */ React19.createElement(ClosedCaptionIcon, null) : /* @__PURE__ */ React19.createElement(OpenCaptionIcon2, null),
2488
+ /* @__PURE__ */ React19.createElement(ActionTile.Title, null, "Closed Caption")
2489
+ ) : null,
2490
+ isLocalVideoEnabled && !!(elements == null ? void 0 : elements.virtual_background) ? /* @__PURE__ */ React19.createElement(
2491
+ ActionTile.Root,
2492
+ {
2493
+ onClick: () => {
2494
+ toggleVB();
2495
+ setOpenOptionsSheet(false);
2496
+ }
2497
+ },
2498
+ /* @__PURE__ */ React19.createElement(VirtualBackgroundIcon, null),
2499
+ /* @__PURE__ */ React19.createElement(ActionTile.Title, null, "Virtual Background")
2500
+ ) : null,
2501
+ (elements == null ? void 0 : elements.emoji_reactions) && !(isLandscapeHLSStream || isMobileHLSStream) && /* @__PURE__ */ React19.createElement(
2502
+ ActionTile.Root,
2503
+ {
2504
+ onClick: () => {
2505
+ setShowEmojiCard(true);
2506
+ setOpenOptionsSheet(false);
2507
+ }
2508
+ },
2509
+ /* @__PURE__ */ React19.createElement(EmojiIcon, null),
2510
+ /* @__PURE__ */ React19.createElement(ActionTile.Title, null, "Emoji Reactions")
2511
+ ),
2512
+ showPolls && /* @__PURE__ */ React19.createElement(
2513
+ ActionTile.Root,
2514
+ {
2515
+ onClick: () => {
2516
+ togglePollView();
2517
+ setOpenOptionsSheet(false);
2518
+ setUnreadPollQuiz(false);
2519
+ }
2520
+ },
2521
+ unreadPollQuiz ? /* @__PURE__ */ React19.createElement(QuizActiveIcon, null) : /* @__PURE__ */ React19.createElement(QuizIcon, null),
2522
+ /* @__PURE__ */ React19.createElement(ActionTile.Title, null, "Polls and Quizzes")
2523
+ ),
2524
+ (elements == null ? void 0 : elements.brb) && /* @__PURE__ */ React19.createElement(
2525
+ ActionTile.Root,
2526
+ {
2527
+ active: isBRBOn,
2528
+ onClick: () => {
2529
+ toggleBRB();
2530
+ setOpenOptionsSheet(false);
2531
+ }
2532
+ },
2533
+ /* @__PURE__ */ React19.createElement(BrbIcon2, null),
2534
+ /* @__PURE__ */ React19.createElement(ActionTile.Title, null, "Be Right Back")
2535
+ ),
2536
+ /* @__PURE__ */ React19.createElement(
2537
+ ActionTile.Root,
2538
+ {
2539
+ onClick: () => {
2540
+ setOpenSettingsSheet(true);
2541
+ setOpenOptionsSheet(false);
2542
+ }
2543
+ },
2544
+ /* @__PURE__ */ React19.createElement(SettingsIcon2, null),
2545
+ /* @__PURE__ */ React19.createElement(ActionTile.Title, null, "Settings")
2546
+ ),
2547
+ /* @__PURE__ */ React19.createElement(
2548
+ ActionTile.Root,
2549
+ {
2550
+ onClick: () => {
2551
+ setOpenStatsForNerdsSheet(true);
2552
+ setOpenOptionsSheet(false);
2553
+ }
2554
+ },
2555
+ /* @__PURE__ */ React19.createElement(InfoIcon3, null),
2556
+ /* @__PURE__ */ React19.createElement(ActionTile.Title, null, "Stats For Nerds")
2557
+ ),
2558
+ isConnected && (permissions == null ? void 0 : permissions.browserRecording) ? /* @__PURE__ */ React19.createElement(
2559
+ ActionTile.Root,
2560
+ {
2561
+ disabled: isHLSRunning,
2562
+ onClick: () => __async(void 0, null, function* () {
2563
+ if (isRecordingLoading) {
2564
+ return;
2565
+ }
2566
+ if (isBrowserRecordingOn || isStreamingOn) {
2567
+ setOpenOptionsSheet(false);
2568
+ setShowRecordingOn(true);
2569
+ } else {
2570
+ yield startRecording();
2571
+ setOpenOptionsSheet(false);
2572
+ }
2573
+ if (isHLSRunning) {
2574
+ setOpenOptionsSheet(false);
2575
+ }
2576
+ })
2577
+ },
2578
+ isRecordingLoading ? /* @__PURE__ */ React19.createElement(Loading, null) : /* @__PURE__ */ React19.createElement(RecordIcon, null),
2579
+ /* @__PURE__ */ React19.createElement(ActionTile.Title, null, match3({ isBrowserRecordingOn, isRecordingLoading }).with({ isBrowserRecordingOn: true, isRecordingLoading: false }, () => "Recording On").with({ isRecordingLoading: true }, () => "Starting Recording").with({ isRecordingLoading: false }, () => "Start Recording").otherwise(() => null))
2580
+ ) : null,
2581
+ title || description ? /* @__PURE__ */ React19.createElement(
2582
+ ActionTile.Root,
2583
+ {
2584
+ onClick: () => {
2585
+ setOpenOptionsSheet(false);
2586
+ toggleDetailsSheet();
2587
+ }
2588
+ },
2589
+ /* @__PURE__ */ React19.createElement(InfoIcon3, null),
2590
+ /* @__PURE__ */ React19.createElement(ActionTile.Title, null, "About Session")
2591
+ ) : null
2592
+ ))), /* @__PURE__ */ React19.createElement(SettingsModal_default, { open: openSettingsSheet, onOpenChange: setOpenSettingsSheet, screenType }), /* @__PURE__ */ React19.createElement(StatsForNerds, { open: openStatsForNerdsSheet, onOpenChange: setOpenStatsForNerdsSheet }), openModals.has(MODALS2.MUTE_ALL) && /* @__PURE__ */ React19.createElement(MuteAllModal, { onOpenChange: (value) => updateState(MODALS2.MUTE_ALL, value), isMobile: true }), openModals.has(MODALS2.CHANGE_NAME) && /* @__PURE__ */ React19.createElement(
2593
+ ChangeNameModal,
2594
+ {
2595
+ onOpenChange: (value) => updateState(MODALS2.CHANGE_NAME, value),
2596
+ openParentSheet: () => setOpenOptionsSheet(true)
2597
+ }
2598
+ ), openModals.has(MODALS2.CAPTION) && /* @__PURE__ */ React19.createElement(CaptionModal, { onOpenChange: (value) => updateState(MODALS2.CAPTION, value) }), showEmojiCard && /* @__PURE__ */ React19.createElement(
2599
+ Box,
2600
+ {
2601
+ ref: emojiCardRef,
2602
+ css: {
2603
+ maxWidth: "100%",
2604
+ w: "100%",
2605
+ position: "absolute",
2606
+ left: 0,
2607
+ right: 0,
2608
+ bottom: "$18",
2609
+ bg: "$surface_default",
2610
+ zIndex: "10",
2611
+ p: "$8",
2612
+ pb: 0,
2613
+ r: "$1",
2614
+ mx: "$4"
2615
+ }
2616
+ },
2617
+ /* @__PURE__ */ React19.createElement(EmojiReaction, { showCard: true })
2618
+ ), showRecordingOn && /* @__PURE__ */ React19.createElement(
2619
+ StopRecordingInSheet,
2620
+ {
2621
+ onClose: () => setShowRecordingOn(false),
2622
+ onStopRecording: () => __async(void 0, null, function* () {
2623
+ try {
2624
+ yield hmsActions.stopRTMPAndRecording();
2625
+ setShowRecordingOn(false);
2626
+ } catch (error) {
2627
+ ToastManager.addToast({
2628
+ // @ts-ignore
2629
+ title: error.message,
2630
+ variant: "error"
2631
+ });
2632
+ }
2633
+ })
2634
+ }
2635
+ ));
2636
+ };
2637
+
2638
+ // src/Prebuilt/components/MoreSettings/MoreSettings.tsx
2639
+ var MoreSettings = ({
2640
+ elements,
2641
+ screenType
2642
+ }) => {
2643
+ const isMobile = useMedia5(config.media.md);
2644
+ const isLandscapeHLSStream = useLandscapeHLSStream();
2645
+ return isMobile || isLandscapeHLSStream ? /* @__PURE__ */ React20.createElement(MwebOptions, { elements, screenType }) : /* @__PURE__ */ React20.createElement(DesktopOptions, { elements, screenType });
2646
+ };
2647
+
2648
+ export {
2649
+ useIsPeerBlacklisted,
2650
+ usePinnedMessages,
2651
+ CHAT_MESSAGE_LIMIT,
2652
+ AnnotisedMessage,
2653
+ ChatBody,
2654
+ ActivatedPIP,
2655
+ useUnreadPollQuizPresent,
2656
+ MoreSettings
2657
+ };
2658
+ //# sourceMappingURL=chunk-ETRNLEWQ.js.map