mr-chat-bird 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -38,7 +38,7 @@ module.exports = __toCommonJS(index_exports);
38
38
  var import_styles = require("@mantine/core/styles.css");
39
39
  var import_styles2 = require("@mantine/tiptap/styles.css");
40
40
  var import_styles3 = require("@mantine/notifications/styles.css");
41
- var import_react9 = __toESM(require("react"));
41
+ var import_react9 = require("react");
42
42
  var import_core9 = require("@mantine/core");
43
43
  var import_notifications2 = require("@mantine/notifications");
44
44
 
@@ -325,8 +325,9 @@ var store = (0, import_toolkit2.configureStore)({
325
325
  });
326
326
 
327
327
  // src/store/provider.tsx
328
+ var import_jsx_runtime = require("react/jsx-runtime");
328
329
  function ReduxProvider({ children }) {
329
- return /* @__PURE__ */ React.createElement(import_react_redux.Provider, { store }, children);
330
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_redux.Provider, { store, children });
330
331
  }
331
332
 
332
333
  // src/store/socket/index.tsx
@@ -357,6 +358,7 @@ var getSocket = (userId) => {
357
358
  };
358
359
 
359
360
  // src/store/socket/index.tsx
361
+ var import_jsx_runtime2 = require("react/jsx-runtime");
360
362
  function SocketProvider({ children, userId }) {
361
363
  (0, import_react.useEffect)(() => {
362
364
  if (!userId) return;
@@ -373,7 +375,7 @@ function SocketProvider({ children, userId }) {
373
375
  }
374
376
  };
375
377
  }, [userId]);
376
- return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
378
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children });
377
379
  }
378
380
 
379
381
  // src/components/ChatUserList/ChatUserList.tsx
@@ -4757,6 +4759,7 @@ var import_core5 = require("@mantine/core");
4757
4759
  var import_react2 = require("react");
4758
4760
  var import_core3 = require("@mantine/core");
4759
4761
  var import_data = __toESM(require("@emoji-mart/data"));
4762
+ var import_jsx_runtime3 = require("react/jsx-runtime");
4760
4763
  var EmojiPicker = (0, import_react2.lazy)(() => import("@emoji-mart/react"));
4761
4764
  function EmojiPickerPopover({
4762
4765
  onSelect,
@@ -4766,7 +4769,7 @@ function EmojiPickerPopover({
4766
4769
  position = "bottom-start"
4767
4770
  }) {
4768
4771
  const [opened, setOpened] = (0, import_react2.useState)(false);
4769
- return /* @__PURE__ */ React.createElement(
4772
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4770
4773
  import_core3.Popover,
4771
4774
  {
4772
4775
  opened,
@@ -4777,32 +4780,34 @@ function EmojiPickerPopover({
4777
4780
  withArrow: true,
4778
4781
  shadow: "md",
4779
4782
  trapFocus: false,
4780
- closeOnEscape: true
4781
- },
4782
- /* @__PURE__ */ React.createElement(import_core3.Popover.Target, null, (0, import_react2.cloneElement)(action, {
4783
- onClick: (e) => {
4784
- action.props?.onClick?.(e);
4785
- setOpened((prev) => !prev);
4786
- }
4787
- })),
4788
- /* @__PURE__ */ React.createElement(import_core3.Popover.Dropdown, { p: 0 }, /* @__PURE__ */ React.createElement(
4789
- import_react2.Suspense,
4790
- {
4791
- fallback: /* @__PURE__ */ React.createElement("div", { style: { padding: 12, width: 320 } }, /* @__PURE__ */ React.createElement(import_core3.Skeleton, { height: 280, radius: "md" }))
4792
- },
4793
- /* @__PURE__ */ React.createElement(
4794
- EmojiPicker,
4795
- {
4796
- previewPosition: "none",
4797
- theme: "light",
4798
- data: import_data.default,
4799
- onEmojiSelect: (emoji) => {
4800
- onSelect(emoji.native);
4801
- setOpened(false);
4783
+ closeOnEscape: true,
4784
+ children: [
4785
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core3.Popover.Target, { children: (0, import_react2.cloneElement)(action, {
4786
+ onClick: (e) => {
4787
+ action.props?.onClick?.(e);
4788
+ setOpened((prev) => !prev);
4802
4789
  }
4803
- }
4804
- )
4805
- ))
4790
+ }) }),
4791
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core3.Popover.Dropdown, { p: 0, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4792
+ import_react2.Suspense,
4793
+ {
4794
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { padding: 12, width: 320 }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core3.Skeleton, { height: 280, radius: "md" }) }),
4795
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4796
+ EmojiPicker,
4797
+ {
4798
+ previewPosition: "none",
4799
+ theme: "light",
4800
+ data: import_data.default,
4801
+ onEmojiSelect: (emoji) => {
4802
+ onSelect(emoji.native);
4803
+ setOpened(false);
4804
+ }
4805
+ }
4806
+ )
4807
+ }
4808
+ ) })
4809
+ ]
4810
+ }
4806
4811
  );
4807
4812
  }
4808
4813
 
@@ -4849,6 +4854,7 @@ var EmojiNode = Node3.create({
4849
4854
  });
4850
4855
 
4851
4856
  // src/components/RichTextEditor/RichTextEditor.tsx
4857
+ var import_jsx_runtime4 = require("react/jsx-runtime");
4852
4858
  function CustomRichTextEditor({
4853
4859
  content = "",
4854
4860
  maxLength = 3e3,
@@ -4891,118 +4897,149 @@ function CustomRichTextEditor({
4891
4897
  editor.commands.focus();
4892
4898
  setCharCount(0);
4893
4899
  };
4894
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
4900
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
4895
4901
  import_tiptap.RichTextEditor,
4896
4902
  {
4897
4903
  editor,
4898
4904
  w: "100%",
4899
- className: RichTextEditor_default.richTextEditorContainer
4900
- },
4901
- /* @__PURE__ */ React.createElement(import_tiptap.RichTextEditor.Content, null),
4902
- /* @__PURE__ */ React.createElement(import_tiptap.RichTextEditor.Toolbar, { sticky: true, stickyOffset: "var(--docs-header-height)" }, /* @__PURE__ */ React.createElement("div", { className: RichTextEditor_default.mainActionContainer }, /* @__PURE__ */ React.createElement(
4903
- EmojiPickerPopover,
4904
- {
4905
- onSelect: (emoji) => {
4906
- editor?.chain().focus().insertContent({
4907
- type: "emoji",
4908
- attrs: {
4909
- emoji
4910
- }
4911
- }).run();
4912
- },
4913
- action: /* @__PURE__ */ React.createElement(
4914
- import_core5.ActionIcon,
4905
+ className: RichTextEditor_default.richTextEditorContainer,
4906
+ children: [
4907
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_tiptap.RichTextEditor.Content, {}),
4908
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_tiptap.RichTextEditor.Toolbar, { sticky: true, stickyOffset: "var(--docs-header-height)", children: [
4909
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: RichTextEditor_default.mainActionContainer, children: [
4910
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4911
+ EmojiPickerPopover,
4912
+ {
4913
+ onSelect: (emoji) => {
4914
+ editor?.chain().focus().insertContent({
4915
+ type: "emoji",
4916
+ attrs: {
4917
+ emoji
4918
+ }
4919
+ }).run();
4920
+ },
4921
+ action: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4922
+ import_core5.ActionIcon,
4923
+ {
4924
+ radius: "lg",
4925
+ variant: "subtle",
4926
+ "aria-label": "add",
4927
+ color: "#333",
4928
+ className: RichTextEditor_default.mainActionEmojiIcon,
4929
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AddReaction_default, {})
4930
+ }
4931
+ )
4932
+ }
4933
+ ),
4934
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4935
+ import_core5.ActionIcon,
4936
+ {
4937
+ radius: "lg",
4938
+ variant: "subtle",
4939
+ "aria-label": "text_format",
4940
+ color: "#333",
4941
+ className: RichTextEditor_default.mainTextFormatIcon,
4942
+ onClick: () => setShowToolbar((prev) => !prev),
4943
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TextFormat_default, {})
4944
+ }
4945
+ ),
4946
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4947
+ import_core5.ActionIcon,
4948
+ {
4949
+ radius: "lg",
4950
+ variant: "filled",
4951
+ "aria-label": "send",
4952
+ className: RichTextEditor_default.mainSendMsgIcon,
4953
+ onClick: () => handleSubmitMsg(),
4954
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons_react.IconSend, { size: 18 })
4955
+ }
4956
+ )
4957
+ ] }),
4958
+ showToolbar && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
4959
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_tiptap.RichTextEditor.ControlsGroup, { children: [
4960
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_tiptap.RichTextEditor.Bold, {}),
4961
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_tiptap.RichTextEditor.Italic, {}),
4962
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_tiptap.RichTextEditor.Underline, {}),
4963
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_tiptap.RichTextEditor.Strikethrough, {}),
4964
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_tiptap.RichTextEditor.Code, {}),
4965
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_tiptap.RichTextEditor.Highlight, {})
4966
+ ] }),
4967
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
4968
+ import_tiptap.RichTextEditor.ControlsGroup,
4969
+ {
4970
+ className: RichTextEditor_default.secondRichTextEditorToolBar,
4971
+ children: [
4972
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_tiptap.RichTextEditor.BulletList, {}),
4973
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_tiptap.RichTextEditor.OrderedList, {}),
4974
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_core5.Menu, { trigger: "hover", openDelay: 200, children: [
4975
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_core5.Menu.Target, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4976
+ import_core5.ActionIcon,
4977
+ {
4978
+ variant: "outline",
4979
+ size: "md",
4980
+ color: "#495057",
4981
+ className: RichTextEditor_default.customToolActionItem,
4982
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons_react.IconAlignLeft, { size: 16, stroke: 1.5 })
4983
+ }
4984
+ ) }),
4985
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_core5.Menu.Dropdown, { children: [
4986
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4987
+ import_core5.Menu.Item,
4988
+ {
4989
+ onClick: () => editor?.chain().focus().setTextAlign("left").run(),
4990
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons_react.IconAlignLeft, { size: 14 })
4991
+ }
4992
+ ),
4993
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4994
+ import_core5.Menu.Item,
4995
+ {
4996
+ onClick: () => editor?.chain().focus().setTextAlign("center").run(),
4997
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons_react.IconAlignCenter, { size: 14 })
4998
+ }
4999
+ ),
5000
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5001
+ import_core5.Menu.Item,
5002
+ {
5003
+ onClick: () => editor?.chain().focus().setTextAlign("right").run(),
5004
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons_react.IconAlignRight, { size: 14 })
5005
+ }
5006
+ )
5007
+ ] })
5008
+ ] }),
5009
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_tiptap.RichTextEditor.Link, {})
5010
+ ]
5011
+ }
5012
+ ),
5013
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5014
+ import_tiptap.RichTextEditor.ControlsGroup,
5015
+ {
5016
+ className: RichTextEditor_default.secondRichTextEditorToolBar,
5017
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_tiptap.RichTextEditor.ClearFormatting, {})
5018
+ }
5019
+ )
5020
+ ] })
5021
+ ] }),
5022
+ showWarning && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
5023
+ "div",
4915
5024
  {
4916
- radius: "lg",
4917
- variant: "subtle",
4918
- "aria-label": "add",
4919
- color: "#333",
4920
- className: RichTextEditor_default.mainActionEmojiIcon
4921
- },
4922
- /* @__PURE__ */ React.createElement(AddReaction_default, null)
5025
+ style: {
5026
+ textAlign: "right",
5027
+ color: "red",
5028
+ fontSize: 12,
5029
+ marginTop: 4
5030
+ },
5031
+ children: [
5032
+ "Character limit reached (",
5033
+ charCount,
5034
+ "/",
5035
+ maxLength,
5036
+ ")"
5037
+ ]
5038
+ }
4923
5039
  )
4924
- }
4925
- ), /* @__PURE__ */ React.createElement(
4926
- import_core5.ActionIcon,
4927
- {
4928
- radius: "lg",
4929
- variant: "subtle",
4930
- "aria-label": "text_format",
4931
- color: "#333",
4932
- className: RichTextEditor_default.mainTextFormatIcon,
4933
- onClick: () => setShowToolbar((prev) => !prev)
4934
- },
4935
- /* @__PURE__ */ React.createElement(TextFormat_default, null)
4936
- ), /* @__PURE__ */ React.createElement(
4937
- import_core5.ActionIcon,
4938
- {
4939
- radius: "lg",
4940
- variant: "filled",
4941
- "aria-label": "send",
4942
- className: RichTextEditor_default.mainSendMsgIcon,
4943
- onClick: () => handleSubmitMsg()
4944
- },
4945
- /* @__PURE__ */ React.createElement(import_icons_react.IconSend, { size: 18 })
4946
- )), showToolbar && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(import_tiptap.RichTextEditor.ControlsGroup, null, /* @__PURE__ */ React.createElement(import_tiptap.RichTextEditor.Bold, null), /* @__PURE__ */ React.createElement(import_tiptap.RichTextEditor.Italic, null), /* @__PURE__ */ React.createElement(import_tiptap.RichTextEditor.Underline, null), /* @__PURE__ */ React.createElement(import_tiptap.RichTextEditor.Strikethrough, null), /* @__PURE__ */ React.createElement(import_tiptap.RichTextEditor.Code, null), /* @__PURE__ */ React.createElement(import_tiptap.RichTextEditor.Highlight, null)), /* @__PURE__ */ React.createElement(
4947
- import_tiptap.RichTextEditor.ControlsGroup,
4948
- {
4949
- className: RichTextEditor_default.secondRichTextEditorToolBar
4950
- },
4951
- /* @__PURE__ */ React.createElement(import_tiptap.RichTextEditor.BulletList, null),
4952
- /* @__PURE__ */ React.createElement(import_tiptap.RichTextEditor.OrderedList, null),
4953
- /* @__PURE__ */ React.createElement(import_core5.Menu, { trigger: "hover", openDelay: 200 }, /* @__PURE__ */ React.createElement(import_core5.Menu.Target, null, /* @__PURE__ */ React.createElement(
4954
- import_core5.ActionIcon,
4955
- {
4956
- variant: "outline",
4957
- size: "md",
4958
- color: "#495057",
4959
- className: RichTextEditor_default.customToolActionItem
4960
- },
4961
- /* @__PURE__ */ React.createElement(import_icons_react.IconAlignLeft, { size: 16, stroke: 1.5 })
4962
- )), /* @__PURE__ */ React.createElement(import_core5.Menu.Dropdown, null, /* @__PURE__ */ React.createElement(
4963
- import_core5.Menu.Item,
4964
- {
4965
- onClick: () => editor?.chain().focus().setTextAlign("left").run()
4966
- },
4967
- /* @__PURE__ */ React.createElement(import_icons_react.IconAlignLeft, { size: 14 })
4968
- ), /* @__PURE__ */ React.createElement(
4969
- import_core5.Menu.Item,
4970
- {
4971
- onClick: () => editor?.chain().focus().setTextAlign("center").run()
4972
- },
4973
- /* @__PURE__ */ React.createElement(import_icons_react.IconAlignCenter, { size: 14 })
4974
- ), /* @__PURE__ */ React.createElement(
4975
- import_core5.Menu.Item,
4976
- {
4977
- onClick: () => editor?.chain().focus().setTextAlign("right").run()
4978
- },
4979
- /* @__PURE__ */ React.createElement(import_icons_react.IconAlignRight, { size: 14 })
4980
- ))),
4981
- /* @__PURE__ */ React.createElement(import_tiptap.RichTextEditor.Link, null)
4982
- ), /* @__PURE__ */ React.createElement(
4983
- import_tiptap.RichTextEditor.ControlsGroup,
4984
- {
4985
- className: RichTextEditor_default.secondRichTextEditorToolBar
4986
- },
4987
- /* @__PURE__ */ React.createElement(import_tiptap.RichTextEditor.ClearFormatting, null)
4988
- ))),
4989
- showWarning && /* @__PURE__ */ React.createElement(
4990
- "div",
4991
- {
4992
- style: {
4993
- textAlign: "right",
4994
- color: "red",
4995
- fontSize: 12,
4996
- marginTop: 4
4997
- }
4998
- },
4999
- "Character limit reached (",
5000
- charCount,
5001
- "/",
5002
- maxLength,
5003
- ")"
5004
- )
5005
- ));
5040
+ ]
5041
+ }
5042
+ ) });
5006
5043
  }
5007
5044
 
5008
5045
  // src/components/ChatUserList/ChatUserMessage.tsx
@@ -5011,7 +5048,8 @@ var import_react7 = require("react");
5011
5048
  var import_dompurify = __toESM(require("dompurify"));
5012
5049
 
5013
5050
  // src/components/VirtualizedList/ChatScrollContainer.tsx
5014
- var import_react5 = __toESM(require("react"));
5051
+ var import_react5 = require("react");
5052
+ var import_jsx_runtime5 = require("react/jsx-runtime");
5015
5053
  function ChatScrollContainer({
5016
5054
  data: data2,
5017
5055
  renderItem,
@@ -5060,7 +5098,7 @@ function ChatScrollContainer({
5060
5098
  isFetchingRef.current = false;
5061
5099
  }, 0);
5062
5100
  };
5063
- return /* @__PURE__ */ import_react5.default.createElement(
5101
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
5064
5102
  "div",
5065
5103
  {
5066
5104
  ref: containerRef,
@@ -5070,9 +5108,9 @@ function ChatScrollContainer({
5070
5108
  height: "100%",
5071
5109
  display: "flex",
5072
5110
  flexDirection: "column"
5073
- }
5074
- },
5075
- data2.map((item, index) => /* @__PURE__ */ import_react5.default.createElement("div", { key: item?.id || index }, renderItem(item, index)))
5111
+ },
5112
+ children: data2.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children: renderItem(item, index) }, item?.id || index))
5113
+ }
5076
5114
  );
5077
5115
  }
5078
5116
 
@@ -5085,6 +5123,7 @@ var import_icons_react2 = require("@tabler/icons-react");
5085
5123
  var UserProfileDrawer_default = {};
5086
5124
 
5087
5125
  // src/components/UserProfile/UserProfileDrawer.tsx
5126
+ var import_jsx_runtime6 = require("react/jsx-runtime");
5088
5127
  function UserProfileDrawer({
5089
5128
  opened,
5090
5129
  onClose,
@@ -5102,51 +5141,74 @@ function UserProfileDrawer({
5102
5141
  setTimeout(onClose, 250);
5103
5142
  };
5104
5143
  if (!opened && !visible) return null;
5105
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: UserProfileDrawer_default.overlay, onClick: handleClose }, /* @__PURE__ */ React.createElement(
5106
- "div",
5107
- {
5108
- className: `${UserProfileDrawer_default.drawer} ${visible ? UserProfileDrawer_default.open : UserProfileDrawer_default.close}`,
5109
- onClick: (e) => e.stopPropagation()
5110
- },
5111
- /* @__PURE__ */ React.createElement("div", { className: UserProfileDrawer_default.header }, /* @__PURE__ */ React.createElement("div", { className: UserProfileDrawer_default.backBtn, onClick: handleClose }, /* @__PURE__ */ React.createElement(import_icons_react2.IconArrowLeft, { size: 20 })), /* @__PURE__ */ React.createElement(import_core6.Text, { fw: 600 }, "Contact info")),
5112
- /* @__PURE__ */ React.createElement("div", { className: UserProfileDrawer_default.profileSection }, /* @__PURE__ */ React.createElement(
5113
- import_core6.Avatar,
5114
- {
5115
- src: user?.avatar,
5116
- size: 150,
5117
- radius: "xl",
5118
- style: { cursor: "pointer" },
5119
- onClick: () => user?.avatar ? setShowImagePreview(true) : {}
5120
- }
5121
- ), /* @__PURE__ */ React.createElement(import_core6.Text, { fw: 700, size: "lg", mt: "sm" }, user?.displayName), /* @__PURE__ */ React.createElement(import_core6.Text, { size: "sm", c: "dimmed" }, "@", user?.username)),
5122
- /* @__PURE__ */ React.createElement("div", { className: UserProfileDrawer_default.actions }, /* @__PURE__ */ React.createElement(
5144
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
5145
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: UserProfileDrawer_default.overlay, onClick: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
5123
5146
  "div",
5124
5147
  {
5125
- className: `${UserProfileDrawer_default.item} ${UserProfileDrawer_default.itemDanger}`,
5126
- onClick: onDeleteMessages
5127
- },
5128
- /* @__PURE__ */ React.createElement(import_icons_react2.IconTrash, { size: 18 }),
5129
- /* @__PURE__ */ React.createElement("span", null, "Delete all messages")
5130
- ), /* @__PURE__ */ React.createElement(
5148
+ className: `${UserProfileDrawer_default.drawer} ${visible ? UserProfileDrawer_default.open : UserProfileDrawer_default.close}`,
5149
+ onClick: (e) => e.stopPropagation(),
5150
+ children: [
5151
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: UserProfileDrawer_default.header, children: [
5152
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: UserProfileDrawer_default.backBtn, onClick: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons_react2.IconArrowLeft, { size: 20 }) }),
5153
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core6.Text, { fw: 600, children: "Contact info" })
5154
+ ] }),
5155
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: UserProfileDrawer_default.profileSection, children: [
5156
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
5157
+ import_core6.Avatar,
5158
+ {
5159
+ src: user?.avatar,
5160
+ size: 150,
5161
+ radius: "xl",
5162
+ style: { cursor: "pointer" },
5163
+ onClick: () => user?.avatar ? setShowImagePreview(true) : {}
5164
+ }
5165
+ ),
5166
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core6.Text, { fw: 700, size: "lg", mt: "sm", children: user?.displayName }),
5167
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_core6.Text, { size: "sm", c: "dimmed", children: [
5168
+ "@",
5169
+ user?.username
5170
+ ] })
5171
+ ] }),
5172
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: UserProfileDrawer_default.actions, children: [
5173
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
5174
+ "div",
5175
+ {
5176
+ className: `${UserProfileDrawer_default.item} ${UserProfileDrawer_default.itemDanger}`,
5177
+ onClick: onDeleteMessages,
5178
+ children: [
5179
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons_react2.IconTrash, { size: 18 }),
5180
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Delete all messages" })
5181
+ ]
5182
+ }
5183
+ ),
5184
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
5185
+ "div",
5186
+ {
5187
+ className: `${UserProfileDrawer_default.item} ${UserProfileDrawer_default.itemDanger}`,
5188
+ onClick: onBlock,
5189
+ children: [
5190
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons_react2.IconBan, { size: 18 }),
5191
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Block" })
5192
+ ]
5193
+ }
5194
+ )
5195
+ ] })
5196
+ ]
5197
+ }
5198
+ ) }),
5199
+ showImagePreview && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
5131
5200
  "div",
5132
5201
  {
5133
- className: `${UserProfileDrawer_default.item} ${UserProfileDrawer_default.itemDanger}`,
5134
- onClick: onBlock
5135
- },
5136
- /* @__PURE__ */ React.createElement(import_icons_react2.IconBan, { size: 18 }),
5137
- /* @__PURE__ */ React.createElement("span", null, "Block")
5138
- ))
5139
- )), showImagePreview && /* @__PURE__ */ React.createElement(
5140
- "div",
5141
- {
5142
- className: UserProfileDrawer_default.imagePreview,
5143
- onClick: () => setShowImagePreview(false)
5144
- },
5145
- /* @__PURE__ */ React.createElement("img", { src: user?.avatar, alt: "profile" })
5146
- ));
5202
+ className: UserProfileDrawer_default.imagePreview,
5203
+ onClick: () => setShowImagePreview(false),
5204
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("img", { src: user?.avatar, alt: "profile" })
5205
+ }
5206
+ )
5207
+ ] });
5147
5208
  }
5148
5209
 
5149
5210
  // src/components/ChatUserList/ChatUserMessage.tsx
5211
+ var import_jsx_runtime7 = require("react/jsx-runtime");
5150
5212
  function ChatUserMessage({
5151
5213
  chatId,
5152
5214
  enableChat,
@@ -5293,102 +5355,126 @@ function ChatUserMessage({
5293
5355
  deleteMessagesByChatId({ chatId, userId: senderDetails?.userId })
5294
5356
  );
5295
5357
  };
5296
- return /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.mainArea }, /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.chatHeader }, receiverDetails && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
5297
- "div",
5298
- {
5299
- className: ChatUserList_default.receiverInfo,
5300
- onClick: () => setShowUserInfo(true)
5301
- },
5302
- receiverDetails?.avatar ? /* @__PURE__ */ React.createElement(import_core7.Avatar, { src: receiverDetails.avatar, size: 36, radius: "xl" }) : /* @__PURE__ */ React.createElement(
5303
- import_core7.Avatar,
5304
- {
5305
- key: receiverDetails?.displayName || receiverDetails?.username,
5306
- name: receiverDetails?.displayName || receiverDetails?.username,
5307
- color: "initials"
5308
- }
5309
- ),
5310
- /* @__PURE__ */ React.createElement(import_core7.Text, { fw: 600, size: "md" }, receiverDetails?.displayName || receiverDetails?.username)
5311
- ), /* @__PURE__ */ React.createElement(import_core7.Menu, { shadow: "md", width: 200, position: "bottom-end" }, /* @__PURE__ */ React.createElement(import_core7.Menu.Target, null, /* @__PURE__ */ React.createElement(import_icons_react3.IconDotsVertical, { size: 20, style: { cursor: "pointer" } })), /* @__PURE__ */ React.createElement(import_core7.Menu.Dropdown, null, /* @__PURE__ */ React.createElement(
5312
- import_core7.Menu.Item,
5313
- {
5314
- color: "red",
5315
- leftSection: /* @__PURE__ */ React.createElement(import_icons_react3.IconTrash, { size: 16 }),
5316
- onClick: handleDeleteMessages
5317
- },
5318
- "Delete all messages"
5319
- ), /* @__PURE__ */ React.createElement(import_core7.Menu.Item, { color: "red", leftSection: /* @__PURE__ */ React.createElement(import_icons_react3.IconBan, { size: 16 }) }, "Block"))))), /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.messageArea }, isEmpty ? /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.emptyState }, /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.encryptionMinimal }, /* @__PURE__ */ React.createElement(import_icons_react3.IconLock, { size: 20, stroke: 1.8 }), /* @__PURE__ */ React.createElement(import_core7.Text, { className: ChatUserList_default.encryptionText, size: "md" }, "End-to-end encrypted"))) : /* @__PURE__ */ React.createElement(
5320
- ChatScrollContainer,
5321
- {
5322
- data: messages,
5323
- hasMore: messageList?.hasMore,
5324
- loadMore: handleLoadOlderMessages,
5325
- scrollToBottomTrigger: scrollTrigger,
5326
- renderItem: (item, index) => {
5327
- const isOutgoing = item?.sender === senderDetails?.userId;
5328
- const currentDate = new Date(item?.createdAt);
5329
- const prevItem = messages[index - 1];
5330
- const showDate = index === 0 || new Date(prevItem?.createdAt).toDateString() !== currentDate.toDateString();
5331
- const today = /* @__PURE__ */ new Date();
5332
- const yesterday = /* @__PURE__ */ new Date();
5333
- yesterday.setDate(today.getDate() - 1);
5334
- const isToday = currentDate.toDateString() === today.toDateString();
5335
- const isYesterday = currentDate.toDateString() === yesterday.toDateString();
5336
- let formattedDate = "";
5337
- if (isToday) {
5338
- formattedDate = "Today";
5339
- } else if (isYesterday) {
5340
- formattedDate = "Yesterday";
5341
- } else {
5342
- formattedDate = currentDate.toLocaleDateString(void 0, {
5343
- weekday: "short",
5344
- month: "short",
5345
- day: "numeric"
5346
- });
5358
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: ChatUserList_default.mainArea, children: [
5359
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: ChatUserList_default.chatHeader, children: receiverDetails && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
5360
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
5361
+ "div",
5362
+ {
5363
+ className: ChatUserList_default.receiverInfo,
5364
+ onClick: () => setShowUserInfo(true),
5365
+ children: [
5366
+ receiverDetails?.avatar ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_core7.Avatar, { src: receiverDetails.avatar, size: 36, radius: "xl" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5367
+ import_core7.Avatar,
5368
+ {
5369
+ name: receiverDetails?.displayName || receiverDetails?.username,
5370
+ color: "initials"
5371
+ },
5372
+ receiverDetails?.displayName || receiverDetails?.username
5373
+ ),
5374
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_core7.Text, { fw: 600, size: "md", children: receiverDetails?.displayName || receiverDetails?.username })
5375
+ ]
5347
5376
  }
5348
- const time = currentDate.toLocaleTimeString([], {
5349
- hour: "2-digit",
5350
- minute: "2-digit",
5351
- hour12: false
5352
- });
5353
- return /* @__PURE__ */ React.createElement("div", { key: item?.id + "_" + index }, showDate && /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.dateSeparator }, formattedDate), /* @__PURE__ */ React.createElement(
5354
- "div",
5355
- {
5356
- style: {
5357
- borderRadius: item.sender === senderDetails?.userId ? "16px 16px 1px 16px" : "16px 16px 16px 1px"
5358
- },
5359
- className: `${ChatUserList_default.messageBubble} ${isOutgoing ? ChatUserList_default.outgoing : ChatUserList_default.incoming}`
5360
- },
5361
- /* @__PURE__ */ React.createElement(
5362
- "div",
5377
+ ),
5378
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_core7.Menu, { shadow: "md", width: 200, position: "bottom-end", children: [
5379
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_core7.Menu.Target, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons_react3.IconDotsVertical, { size: 20, style: { cursor: "pointer" } }) }),
5380
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_core7.Menu.Dropdown, { children: [
5381
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5382
+ import_core7.Menu.Item,
5363
5383
  {
5364
- className: ChatUserList_default.messageContent,
5365
- dangerouslySetInnerHTML: {
5366
- __html: import_dompurify.default.sanitize(item?.message)
5367
- }
5384
+ color: "red",
5385
+ leftSection: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons_react3.IconTrash, { size: 16 }),
5386
+ onClick: handleDeleteMessages,
5387
+ children: "Delete all messages"
5368
5388
  }
5369
5389
  ),
5370
- /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.messageTime }, time)
5371
- ));
5390
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_core7.Menu.Item, { color: "red", leftSection: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons_react3.IconBan, { size: 16 }), children: "Block" })
5391
+ ] })
5392
+ ] })
5393
+ ] }) }),
5394
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: ChatUserList_default.messageArea, children: isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: ChatUserList_default.emptyState, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: ChatUserList_default.encryptionMinimal, children: [
5395
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons_react3.IconLock, { size: 20, stroke: 1.8 }),
5396
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_core7.Text, { className: ChatUserList_default.encryptionText, size: "md", children: "End-to-end encrypted" })
5397
+ ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5398
+ ChatScrollContainer,
5399
+ {
5400
+ data: messages,
5401
+ hasMore: messageList?.hasMore,
5402
+ loadMore: handleLoadOlderMessages,
5403
+ scrollToBottomTrigger: scrollTrigger,
5404
+ renderItem: (item, index) => {
5405
+ const isOutgoing = item?.sender === senderDetails?.userId;
5406
+ const currentDate = new Date(item?.createdAt);
5407
+ const prevItem = messages[index - 1];
5408
+ const showDate = index === 0 || new Date(prevItem?.createdAt).toDateString() !== currentDate.toDateString();
5409
+ const today = /* @__PURE__ */ new Date();
5410
+ const yesterday = /* @__PURE__ */ new Date();
5411
+ yesterday.setDate(today.getDate() - 1);
5412
+ const isToday = currentDate.toDateString() === today.toDateString();
5413
+ const isYesterday = currentDate.toDateString() === yesterday.toDateString();
5414
+ let formattedDate = "";
5415
+ if (isToday) {
5416
+ formattedDate = "Today";
5417
+ } else if (isYesterday) {
5418
+ formattedDate = "Yesterday";
5419
+ } else {
5420
+ formattedDate = currentDate.toLocaleDateString(void 0, {
5421
+ weekday: "short",
5422
+ month: "short",
5423
+ day: "numeric"
5424
+ });
5425
+ }
5426
+ const time = currentDate.toLocaleTimeString([], {
5427
+ hour: "2-digit",
5428
+ minute: "2-digit",
5429
+ hour12: false
5430
+ });
5431
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
5432
+ showDate && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: ChatUserList_default.dateSeparator, children: formattedDate }),
5433
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
5434
+ "div",
5435
+ {
5436
+ style: {
5437
+ borderRadius: item.sender === senderDetails?.userId ? "16px 16px 1px 16px" : "16px 16px 16px 1px"
5438
+ },
5439
+ className: `${ChatUserList_default.messageBubble} ${isOutgoing ? ChatUserList_default.outgoing : ChatUserList_default.incoming}`,
5440
+ children: [
5441
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5442
+ "div",
5443
+ {
5444
+ className: ChatUserList_default.messageContent,
5445
+ dangerouslySetInnerHTML: {
5446
+ __html: import_dompurify.default.sanitize(item?.message)
5447
+ }
5448
+ }
5449
+ ),
5450
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: ChatUserList_default.messageTime, children: time })
5451
+ ]
5452
+ }
5453
+ )
5454
+ ] }, item?.id + "_" + index);
5455
+ }
5372
5456
  }
5373
- }
5374
- )), (chatId || enableChat) && /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.inputBar }, /* @__PURE__ */ React.createElement(CustomRichTextEditor, { onSubmit: handleSendMessage })), /* @__PURE__ */ React.createElement(
5375
- UserProfileDrawer,
5376
- {
5377
- opened: showUserInfo,
5378
- onClose: () => setShowUserInfo(false),
5379
- user: {
5380
- avatar: receiverDetails?.avatar,
5381
- username: receiverDetails?.username,
5382
- displayName: receiverDetails?.displayName
5383
- },
5384
- onDeleteMessages: () => {
5385
- handleDeleteMessages();
5386
- },
5387
- onBlock: () => {
5388
- console.log("block user");
5457
+ ) }),
5458
+ (chatId || enableChat) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: ChatUserList_default.inputBar, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CustomRichTextEditor, { onSubmit: handleSendMessage }) }),
5459
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5460
+ UserProfileDrawer,
5461
+ {
5462
+ opened: showUserInfo,
5463
+ onClose: () => setShowUserInfo(false),
5464
+ user: {
5465
+ avatar: receiverDetails?.avatar,
5466
+ username: receiverDetails?.username,
5467
+ displayName: receiverDetails?.displayName
5468
+ },
5469
+ onDeleteMessages: () => {
5470
+ handleDeleteMessages();
5471
+ },
5472
+ onBlock: () => {
5473
+ console.log("block user");
5474
+ }
5389
5475
  }
5390
- }
5391
- ));
5476
+ )
5477
+ ] });
5392
5478
  }
5393
5479
 
5394
5480
  // src/components/ChatUserList/ChatUserList.tsx
@@ -6047,6 +6133,7 @@ var users_list_default = [
6047
6133
 
6048
6134
  // src/components/VirtualizedList/index.tsx
6049
6135
  var import_react_virtuoso = require("react-virtuoso");
6136
+ var import_jsx_runtime8 = require("react/jsx-runtime");
6050
6137
  function VirtualizedList({
6051
6138
  data: data2,
6052
6139
  itemContent,
@@ -6055,7 +6142,7 @@ function VirtualizedList({
6055
6142
  endReached,
6056
6143
  ...props
6057
6144
  }) {
6058
- return /* @__PURE__ */ React.createElement(
6145
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
6059
6146
  import_react_virtuoso.Virtuoso,
6060
6147
  {
6061
6148
  style: { height },
@@ -6098,6 +6185,7 @@ var getChatDisplayTime = (timestamp) => {
6098
6185
  };
6099
6186
 
6100
6187
  // src/components/ChatUserList/ChatUserList.tsx
6188
+ var import_jsx_runtime9 = require("react/jsx-runtime");
6101
6189
  function ChatUserList() {
6102
6190
  const [opened, { open, close }] = (0, import_hooks.useDisclosure)(false);
6103
6191
  const dispatch = (0, import_react_redux3.useDispatch)();
@@ -6269,155 +6357,201 @@ function ChatUserList() {
6269
6357
  label: user.displayName || user.username,
6270
6358
  user
6271
6359
  }));
6272
- return /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.chatWrapper }, /* @__PURE__ */ React.createElement(
6273
- import_core8.Modal,
6274
- {
6275
- opened,
6276
- onClose: () => {
6277
- close();
6278
- setReceiverSearchValue("");
6279
- },
6280
- title: "Find User",
6281
- centered: true,
6282
- withCloseButton: true
6283
- },
6284
- /* @__PURE__ */ React.createElement(
6285
- import_core8.Autocomplete,
6360
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: ChatUserList_default.chatWrapper, children: [
6361
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
6362
+ import_core8.Modal,
6286
6363
  {
6287
- mb: 12,
6288
- label: "Sender",
6289
- placeholder: "Type username...",
6290
- limit: 20,
6291
- data: userOptions,
6292
- value: senderSearchValue,
6293
- onChange: setSenderSearchValue,
6294
- onOptionSubmit: (val) => {
6295
- const selected = users_list_default.find((u) => u.username === val);
6296
- if (selected) {
6297
- setSenderSearchValue("");
6298
- setSenderUserDetails(selected);
6299
- }
6300
- },
6301
- renderOption: ({ option }) => {
6302
- const user = option.user;
6303
- return /* @__PURE__ */ React.createElement(import_core8.Group, { gap: "sm" }, /* @__PURE__ */ React.createElement(import_core8.Avatar, { src: user.avatar, size: 36, radius: "xl" }), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(import_core8.Text, { size: "sm" }, user.displayName || user.username), user.displayName && /* @__PURE__ */ React.createElement(import_core8.Text, { size: "xs", opacity: 0.5 }, "@", user.username)));
6304
- }
6305
- }
6306
- ),
6307
- /* @__PURE__ */ React.createElement(
6308
- import_core8.Autocomplete,
6309
- {
6310
- mb: 12,
6311
- label: "Receiver",
6312
- placeholder: "Type username...",
6313
- limit: 20,
6314
- data: userOptions,
6315
- value: receiverSearchValue,
6316
- onChange: setReceiverSearchValue,
6317
- onOptionSubmit: (val) => {
6318
- const selected = users_list_default.find((u) => u.username === val);
6319
- if (selected) {
6320
- setReceiverSearchValue("");
6321
- setReceiverUserDetails(selected);
6322
- }
6364
+ opened,
6365
+ onClose: () => {
6366
+ close();
6367
+ setReceiverSearchValue("");
6323
6368
  },
6324
- renderOption: ({ option }) => {
6325
- const user = option.user;
6326
- return /* @__PURE__ */ React.createElement(import_core8.Group, { gap: "sm" }, /* @__PURE__ */ React.createElement(import_core8.Avatar, { src: user.avatar, size: 36, radius: "xl" }), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(import_core8.Text, { size: "sm" }, user.displayName || user.username), user.displayName && /* @__PURE__ */ React.createElement(import_core8.Text, { size: "xs", opacity: 0.5 }, "@", user.username)));
6327
- }
6328
- }
6329
- ),
6330
- /* @__PURE__ */ React.createElement(
6331
- import_core8.Button,
6332
- {
6333
- fullWidth: true,
6334
- onClick: handleStartChat,
6335
- disabled: !Boolean(receiverUserDetails?.username)
6336
- },
6337
- "Start Chat"
6338
- )
6339
- ), /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.chatContainer }, /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.sidebar }, /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.sidebarTop }, /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.topBar }, /* @__PURE__ */ React.createElement(import_core8.Text, { size: "lg", fw: 600 }, "MrChat"), /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.topActions }, /* @__PURE__ */ React.createElement(
6340
- import_core8.ActionIcon,
6341
- {
6342
- variant: "subtle",
6343
- onClick: () => {
6344
- setReceiverUserDetails(null);
6345
- open();
6346
- },
6347
- radius: "lg"
6348
- },
6349
- /* @__PURE__ */ React.createElement(import_icons_react4.IconPlus, { size: 20, stroke: 3 })
6350
- )))), /* @__PURE__ */ React.createElement(import_core8.Text, { size: "xs", c: "dimmed", mt: "sm", mb: "xs", ml: 12 }, "All Messages"), /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.scrollWrapper }, /* @__PURE__ */ React.createElement(
6351
- VirtualizedList,
6352
- {
6353
- data: chatList?.rows?.data || [],
6354
- endReached: loadMoreChats,
6355
- itemContent: (_, item) => {
6356
- const isActive = item.chatId === chatId;
6357
- return /* @__PURE__ */ React.createElement(
6358
- "div",
6359
- {
6360
- className: `${ChatUserList_default.chatItem} ${isActive ? ChatUserList_default.activeChatItem : ""}`,
6361
- onClick: () => {
6362
- if (isActive) return;
6363
- handleJoinChat(item);
6364
- }
6365
- },
6366
- item.avatar ? /* @__PURE__ */ React.createElement(import_core8.Avatar, { src: item.avatar, size: 36, radius: "xl" }) : /* @__PURE__ */ React.createElement(
6367
- import_core8.Avatar,
6369
+ title: "Find User",
6370
+ centered: true,
6371
+ withCloseButton: true,
6372
+ children: [
6373
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
6374
+ import_core8.Autocomplete,
6368
6375
  {
6369
- key: item.displayName || item.username,
6370
- name: item.displayName || item.username,
6371
- color: "initials"
6376
+ mb: 12,
6377
+ label: "Sender",
6378
+ placeholder: "Type username...",
6379
+ limit: 20,
6380
+ data: userOptions,
6381
+ value: senderSearchValue,
6382
+ onChange: setSenderSearchValue,
6383
+ onOptionSubmit: (val) => {
6384
+ const selected = users_list_default.find((u) => u.username === val);
6385
+ if (selected) {
6386
+ setSenderSearchValue("");
6387
+ setSenderUserDetails(selected);
6388
+ }
6389
+ },
6390
+ renderOption: ({ option }) => {
6391
+ const user = option.user;
6392
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_core8.Group, { gap: "sm", children: [
6393
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Avatar, { src: user.avatar, size: 36, radius: "xl" }),
6394
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
6395
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Text, { size: "sm", children: user.displayName || user.username }),
6396
+ user.displayName && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_core8.Text, { size: "xs", opacity: 0.5, children: [
6397
+ "@",
6398
+ user.username
6399
+ ] })
6400
+ ] })
6401
+ ] });
6402
+ }
6372
6403
  }
6373
6404
  ),
6374
- /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.chatInfo }, /* @__PURE__ */ React.createElement(import_core8.Text, { className: ChatUserList_default.chatLabelItem, truncate: true }, item.displayName || item.username), item.unreadCount > 0 && /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.unreadBadge }, item.unreadCount || 10), /* @__PURE__ */ React.createElement("div", { className: ChatUserList_default.messagePreview }, /* @__PURE__ */ React.createElement(
6375
- import_core8.Text,
6405
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
6406
+ import_core8.Autocomplete,
6376
6407
  {
6377
- truncate: true,
6378
- size: "xs",
6379
- c: "dimmed",
6380
- style: { maxWidth: 150 },
6381
- className: ChatUserList_default.messagePreviewContent
6382
- },
6383
- stripHtml(import_dompurify2.default.sanitize(item.message))
6384
- ), /* @__PURE__ */ React.createElement(
6385
- import_core8.Text,
6408
+ mb: 12,
6409
+ label: "Receiver",
6410
+ placeholder: "Type username...",
6411
+ limit: 20,
6412
+ data: userOptions,
6413
+ value: receiverSearchValue,
6414
+ onChange: setReceiverSearchValue,
6415
+ onOptionSubmit: (val) => {
6416
+ const selected = users_list_default.find((u) => u.username === val);
6417
+ if (selected) {
6418
+ setReceiverSearchValue("");
6419
+ setReceiverUserDetails(selected);
6420
+ }
6421
+ },
6422
+ renderOption: ({ option }) => {
6423
+ const user = option.user;
6424
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_core8.Group, { gap: "sm", children: [
6425
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Avatar, { src: user.avatar, size: 36, radius: "xl" }),
6426
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
6427
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Text, { size: "sm", children: user.displayName || user.username }),
6428
+ user.displayName && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_core8.Text, { size: "xs", opacity: 0.5, children: [
6429
+ "@",
6430
+ user.username
6431
+ ] })
6432
+ ] })
6433
+ ] });
6434
+ }
6435
+ }
6436
+ ),
6437
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
6438
+ import_core8.Button,
6386
6439
  {
6387
- size: "xs",
6388
- c: "dimmed",
6389
- className: ChatUserList_default.messagePreviewTime
6390
- },
6391
- getChatDisplayTime(item.updatedAt || item.createdAt)
6392
- )))
6393
- );
6394
- }
6395
- }
6396
- ))), /* @__PURE__ */ React.createElement(
6397
- ChatUserMessage,
6398
- {
6399
- chatId,
6400
- enableChat,
6401
- senderDetails,
6402
- receiverDetails,
6403
- onChatInitialized: (data2) => {
6404
- handleJoinChat({
6405
- chatId: data2.chatId,
6406
- userId: receiverDetails?.userId,
6407
- username: receiverDetails?.username,
6408
- displayName: receiverDetails?.displayName,
6409
- avatar: receiverDetails?.avatar
6410
- });
6440
+ fullWidth: true,
6441
+ onClick: handleStartChat,
6442
+ disabled: !Boolean(receiverUserDetails?.username),
6443
+ children: "Start Chat"
6444
+ }
6445
+ )
6446
+ ]
6411
6447
  }
6412
- }
6413
- )));
6448
+ ),
6449
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: ChatUserList_default.chatContainer, children: [
6450
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: ChatUserList_default.sidebar, children: [
6451
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: ChatUserList_default.sidebarTop, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: ChatUserList_default.topBar, children: [
6452
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Text, { size: "lg", fw: 600, children: "MrChat" }),
6453
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: ChatUserList_default.topActions, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
6454
+ import_core8.ActionIcon,
6455
+ {
6456
+ variant: "subtle",
6457
+ onClick: () => {
6458
+ setReceiverUserDetails(null);
6459
+ open();
6460
+ },
6461
+ radius: "lg",
6462
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons_react4.IconPlus, { size: 20, stroke: 3 })
6463
+ }
6464
+ ) })
6465
+ ] }) }),
6466
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Text, { size: "xs", c: "dimmed", mt: "sm", mb: "xs", ml: 12, children: "All Messages" }),
6467
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: ChatUserList_default.scrollWrapper, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
6468
+ VirtualizedList,
6469
+ {
6470
+ data: chatList?.rows?.data || [],
6471
+ endReached: loadMoreChats,
6472
+ itemContent: (_, item) => {
6473
+ const isActive = item.chatId === chatId;
6474
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
6475
+ "div",
6476
+ {
6477
+ className: `${ChatUserList_default.chatItem} ${isActive ? ChatUserList_default.activeChatItem : ""}`,
6478
+ onClick: () => {
6479
+ if (isActive) return;
6480
+ handleJoinChat(item);
6481
+ },
6482
+ children: [
6483
+ item.avatar ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Avatar, { src: item.avatar, size: 36, radius: "xl" }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
6484
+ import_core8.Avatar,
6485
+ {
6486
+ name: item.displayName || item.username,
6487
+ color: "initials"
6488
+ },
6489
+ item.displayName || item.username
6490
+ ),
6491
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: ChatUserList_default.chatInfo, children: [
6492
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Text, { className: ChatUserList_default.chatLabelItem, truncate: true, children: item.displayName || item.username }),
6493
+ item.unreadCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: ChatUserList_default.unreadBadge, children: item.unreadCount || 10 }),
6494
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: ChatUserList_default.messagePreview, children: [
6495
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
6496
+ import_core8.Text,
6497
+ {
6498
+ truncate: true,
6499
+ size: "xs",
6500
+ c: "dimmed",
6501
+ style: { maxWidth: 150 },
6502
+ className: ChatUserList_default.messagePreviewContent,
6503
+ children: stripHtml(import_dompurify2.default.sanitize(item.message))
6504
+ }
6505
+ ),
6506
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
6507
+ import_core8.Text,
6508
+ {
6509
+ size: "xs",
6510
+ c: "dimmed",
6511
+ className: ChatUserList_default.messagePreviewTime,
6512
+ children: getChatDisplayTime(item.updatedAt || item.createdAt)
6513
+ }
6514
+ )
6515
+ ] })
6516
+ ] })
6517
+ ]
6518
+ }
6519
+ );
6520
+ }
6521
+ }
6522
+ ) })
6523
+ ] }),
6524
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
6525
+ ChatUserMessage,
6526
+ {
6527
+ chatId,
6528
+ enableChat,
6529
+ senderDetails,
6530
+ receiverDetails,
6531
+ onChatInitialized: (data2) => {
6532
+ handleJoinChat({
6533
+ chatId: data2.chatId,
6534
+ userId: receiverDetails?.userId,
6535
+ username: receiverDetails?.username,
6536
+ displayName: receiverDetails?.displayName,
6537
+ avatar: receiverDetails?.avatar
6538
+ });
6539
+ }
6540
+ }
6541
+ )
6542
+ ] })
6543
+ ] });
6414
6544
  }
6415
6545
 
6416
6546
  // src/components/MrChat/index.tsx
6547
+ var import_jsx_runtime10 = require("react/jsx-runtime");
6417
6548
  function MrChat(props) {
6418
6549
  const [primaryColor] = (0, import_react9.useState)("customBrand");
6419
6550
  const theme = createAppTheme(primaryColor);
6420
- return /* @__PURE__ */ import_react9.default.createElement(ReduxProvider, null, /* @__PURE__ */ import_react9.default.createElement(SocketProvider, null, /* @__PURE__ */ import_react9.default.createElement(import_core9.MantineProvider, { defaultColorScheme: "light", theme }, /* @__PURE__ */ import_react9.default.createElement(import_notifications2.Notifications, null), /* @__PURE__ */ import_react9.default.createElement(ChatUserList, { ...props }))));
6551
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ReduxProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SocketProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_core9.MantineProvider, { defaultColorScheme: "light", theme, children: [
6552
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_notifications2.Notifications, {}),
6553
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ChatUserList, { ...props })
6554
+ ] }) }) });
6421
6555
  }
6422
6556
  // Annotate the CommonJS export names for ESM import in node:
6423
6557
  0 && (module.exports = {