elseware-ui 2.31.16 → 2.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -3104,7 +3104,7 @@ var ShapeSwitch = () => {
3104
3104
  {
3105
3105
  value: currentShape,
3106
3106
  onChange: handleChange,
3107
- className: "\n px-3 py-2 rounded-md border border-gray-300\n bg-white dark:bg-gray-800\n text-sm shadow-sm\n focus:outline-none\n ",
3107
+ className: "\r\n px-3 py-2 rounded-md border border-gray-300\r\n bg-white dark:bg-gray-800\r\n text-sm shadow-sm\r\n focus:outline-none\r\n ",
3108
3108
  children: Object.keys(Shape).map((shape) => /* @__PURE__ */ jsx("option", { value: shape, children: shape }, shape))
3109
3109
  }
3110
3110
  ) });
@@ -16098,7 +16098,7 @@ function MarkdownTOC({ title = "Table of Contents" }) {
16098
16098
  /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
16099
16099
  "h2",
16100
16100
  {
16101
- className: "\n text-sm\n font-semibold\n uppercase\n tracking-wide\n text-gray-900\n dark:text-gray-100\n ",
16101
+ className: "\r\n text-sm\r\n font-semibold\r\n uppercase\r\n tracking-wide\r\n text-gray-900\r\n dark:text-gray-100\r\n ",
16102
16102
  children: title
16103
16103
  }
16104
16104
  ) }),
@@ -17093,6 +17093,7 @@ var Menu = ({
17093
17093
  badge: item.badge,
17094
17094
  to: item.to,
17095
17095
  navigate: item.navigate || navigate,
17096
+ onClick: item.onClick,
17096
17097
  className: cn(
17097
17098
  item.className,
17098
17099
  isActive && "bg-gray-200 dark:bg-gray-800/50 text-gray-900 dark:text-gray-300"
@@ -17427,7 +17428,7 @@ var GlowWrapper = ({
17427
17428
  /* @__PURE__ */ jsx(
17428
17429
  "span",
17429
17430
  {
17430
- className: "\n pointer-events-none absolute inset-0 opacity-0 \n group-hover:opacity-100 transition-opacity duration-300\n ",
17431
+ className: "\r\n pointer-events-none absolute inset-0 opacity-0 \r\n group-hover:opacity-100 transition-opacity duration-300\r\n ",
17431
17432
  style: { background: "var(--glow-bg)" }
17432
17433
  }
17433
17434
  ),
@@ -17437,6 +17438,41 @@ var GlowWrapper = ({
17437
17438
  );
17438
17439
  };
17439
17440
  var GlowWrapper_default = GlowWrapper;
17441
+ function InfiniteScrollTrigger({
17442
+ children,
17443
+ className,
17444
+ hasMore = false,
17445
+ isLoading = false,
17446
+ rootMargin = "600px",
17447
+ threshold = 0,
17448
+ onLoadMore
17449
+ }) {
17450
+ const triggerRef = useRef(null);
17451
+ useEffect(() => {
17452
+ const element = triggerRef.current;
17453
+ if (!element || !hasMore || isLoading) {
17454
+ return;
17455
+ }
17456
+ const observer = new IntersectionObserver(
17457
+ ([entry]) => {
17458
+ if (entry?.isIntersecting) {
17459
+ onLoadMore?.();
17460
+ }
17461
+ },
17462
+ {
17463
+ root: null,
17464
+ rootMargin,
17465
+ threshold
17466
+ }
17467
+ );
17468
+ observer.observe(element);
17469
+ return () => {
17470
+ observer.disconnect();
17471
+ };
17472
+ }, [hasMore, isLoading, onLoadMore, rootMargin, threshold]);
17473
+ return /* @__PURE__ */ jsx("div", { ref: triggerRef, className: cn("w-full", className), children });
17474
+ }
17475
+ var InfiniteScrollTrigger_default = InfiniteScrollTrigger;
17440
17476
  function ShowMore({ text, limit }) {
17441
17477
  const [showMore, setShowMore] = useState(false);
17442
17478
  return /* @__PURE__ */ jsxs("div", { children: [
@@ -17577,6 +17613,33 @@ function CommentContent({ comment }) {
17577
17613
  }
17578
17614
  var CommentContent_default = CommentContent;
17579
17615
 
17616
+ // src/compositions/comment-thread/utils/commentReaction.ts
17617
+ function getOptimisticLikeState(comment) {
17618
+ return {
17619
+ liked: !comment.liked,
17620
+ disliked: false,
17621
+ likes: comment.liked ? Math.max(comment.likes - 1, 0) : comment.likes + 1,
17622
+ dislikes: comment.disliked ? Math.max(comment.dislikes - 1, 0) : comment.dislikes
17623
+ };
17624
+ }
17625
+ function getOptimisticDislikeState(comment) {
17626
+ return {
17627
+ liked: false,
17628
+ disliked: !comment.disliked,
17629
+ likes: comment.liked ? Math.max(comment.likes - 1, 0) : comment.likes,
17630
+ dislikes: comment.disliked ? Math.max(comment.dislikes - 1, 0) : comment.dislikes + 1
17631
+ };
17632
+ }
17633
+ function applyReactionState(comment, reaction) {
17634
+ return {
17635
+ ...comment,
17636
+ likes: reaction.likes,
17637
+ dislikes: reaction.dislikes,
17638
+ liked: reaction.liked,
17639
+ disliked: reaction.disliked
17640
+ };
17641
+ }
17642
+
17580
17643
  // src/compositions/comment-thread/utils/formatCommentDate.ts
17581
17644
  function formatCommentDate(date, format = "relative") {
17582
17645
  const target = new Date(date);
@@ -17615,6 +17678,65 @@ function formatCommentDate(date, format = "relative") {
17615
17678
  }
17616
17679
  return "Just now";
17617
17680
  }
17681
+
17682
+ // src/compositions/comment-thread/utils/removeComment.ts
17683
+ function removeComment(comments, commentId) {
17684
+ return comments.filter((comment) => comment.id !== commentId);
17685
+ }
17686
+ function incrementReplyCount(comments, commentId) {
17687
+ return comments.map(
17688
+ (comment) => comment.id === commentId ? {
17689
+ ...comment,
17690
+ replyCount: comment.replyCount + 1
17691
+ } : comment
17692
+ );
17693
+ }
17694
+ function decrementReplyCount(comments, commentId) {
17695
+ return comments.map(
17696
+ (comment) => comment.id === commentId ? {
17697
+ ...comment,
17698
+ replyCount: Math.max(comment.replyCount - 1, 0)
17699
+ } : comment
17700
+ );
17701
+ }
17702
+
17703
+ // src/compositions/comment-thread/utils/replyCache.ts
17704
+ function addReplyToCache(cache, parentCommentId, reply) {
17705
+ return {
17706
+ ...cache,
17707
+ [parentCommentId]: [...cache[parentCommentId] ?? [], reply]
17708
+ };
17709
+ }
17710
+ function updateReplyCacheComment(cache, commentId, updater) {
17711
+ const next = {};
17712
+ for (const [parentId, replies] of Object.entries(cache)) {
17713
+ next[parentId] = replies.map(
17714
+ (reply) => reply.id === commentId ? updater(reply) : reply
17715
+ );
17716
+ }
17717
+ return next;
17718
+ }
17719
+ function removeCommentTreeFromCache(cache, commentId) {
17720
+ const childIds = cache[commentId]?.map((reply) => reply.id) ?? [];
17721
+ let next = Object.fromEntries(
17722
+ Object.entries(cache).map(([parentId, replies]) => [
17723
+ parentId,
17724
+ replies.filter((reply) => reply.id !== commentId)
17725
+ ])
17726
+ );
17727
+ delete next[commentId];
17728
+ for (const childId of childIds) {
17729
+ next = removeCommentTreeFromCache(next, childId);
17730
+ }
17731
+ return next;
17732
+ }
17733
+
17734
+ // src/compositions/comment-thread/utils/updateComment.ts
17735
+ function updateComment(comments, commentId, updater) {
17736
+ return comments.map(
17737
+ (comment) => comment.id === commentId ? updater(comment) : comment
17738
+ );
17739
+ }
17618
17740
  function CommentHeader({ comment, config }) {
17619
17741
  const author = comment.author;
17620
17742
  const displayName = author?.firstName || author?.lastName ? `${author?.firstName ?? ""} ${author?.lastName ?? ""}`.trim() : author?.username ?? "Unknown";
@@ -17635,6 +17757,60 @@ function CommentHeader({ comment, config }) {
17635
17757
  ] });
17636
17758
  }
17637
17759
  var CommentHeader_default = CommentHeader;
17760
+ var useDrawer = (defaultVisibility = true) => {
17761
+ const [show, setShow] = useState(defaultVisibility);
17762
+ const openDrawer = () => {
17763
+ setShow((prev) => !prev);
17764
+ };
17765
+ const closeDrawer = () => {
17766
+ setShow(false);
17767
+ };
17768
+ return {
17769
+ show,
17770
+ openDrawer,
17771
+ closeDrawer
17772
+ };
17773
+ };
17774
+ var useDrawer_default = useDrawer;
17775
+ var useModal = () => {
17776
+ const [show, setShow] = useState(false);
17777
+ const handleOpenModal = () => {
17778
+ setShow(true);
17779
+ };
17780
+ const handleCloseModal = () => {
17781
+ setShow(false);
17782
+ };
17783
+ return {
17784
+ show,
17785
+ handleOpenModal,
17786
+ handleCloseModal
17787
+ };
17788
+ };
17789
+ var useModal_default = useModal;
17790
+ function CommentMenuItem({
17791
+ icon,
17792
+ name,
17793
+ badge,
17794
+ to,
17795
+ navigate,
17796
+ className,
17797
+ onClick,
17798
+ style
17799
+ }) {
17800
+ return /* @__PURE__ */ jsx(
17801
+ MenuItem,
17802
+ {
17803
+ icon,
17804
+ name,
17805
+ badge,
17806
+ to,
17807
+ navigate,
17808
+ onClick,
17809
+ style,
17810
+ className
17811
+ }
17812
+ );
17813
+ }
17638
17814
  function CommentMenu({
17639
17815
  open,
17640
17816
  setOpen,
@@ -17646,17 +17822,48 @@ function CommentMenu({
17646
17822
  onReport
17647
17823
  }) {
17648
17824
  const ref = useRef(null);
17649
- useEffect(() => {
17650
- function handleOutsideClick(event) {
17651
- if (ref.current && !ref.current.contains(event.target)) {
17825
+ useClickOutside(ref, () => setOpen(false));
17826
+ const items = [];
17827
+ if (canEdit) {
17828
+ items.push({
17829
+ type: "item",
17830
+ icon: /* @__PURE__ */ jsx(BiEdit, {}),
17831
+ name: "Edit",
17832
+ component: CommentMenuItem,
17833
+ onClick: () => {
17652
17834
  setOpen(false);
17653
- }
17654
- }
17655
- document.addEventListener("mousedown", handleOutsideClick);
17656
- return () => document.removeEventListener("mousedown", handleOutsideClick);
17657
- }, [setOpen]);
17658
- const hasActions = canEdit || canDelete || canReport;
17659
- if (!hasActions) {
17835
+ onEdit?.();
17836
+ },
17837
+ className: "flex w-full items-center gap-2 px-4 py-3 text-sm hover:bg-gray-100 dark:hover:bg-neutral-800"
17838
+ });
17839
+ }
17840
+ if (canDelete) {
17841
+ items.push({
17842
+ type: "item",
17843
+ icon: /* @__PURE__ */ jsx(BiTrash, {}),
17844
+ name: "Delete",
17845
+ component: CommentMenuItem,
17846
+ onClick: () => {
17847
+ setOpen(false);
17848
+ onDelete?.();
17849
+ },
17850
+ className: "flex w-full items-center gap-2 px-4 py-3 text-sm text-red-500 hover:bg-gray-100 dark:hover:bg-neutral-800"
17851
+ });
17852
+ }
17853
+ if (canReport) {
17854
+ items.push({
17855
+ type: "item",
17856
+ icon: /* @__PURE__ */ jsx(BiFlag, {}),
17857
+ name: "Report",
17858
+ component: CommentMenuItem,
17859
+ onClick: () => {
17860
+ setOpen(false);
17861
+ onReport?.();
17862
+ },
17863
+ className: "flex w-full items-center gap-2 px-4 py-3 text-sm hover:bg-gray-100 dark:hover:bg-neutral-800"
17864
+ });
17865
+ }
17866
+ if (!items.length) {
17660
17867
  return null;
17661
17868
  }
17662
17869
  return /* @__PURE__ */ jsxs("div", { ref, className: "relative", children: [
@@ -17669,53 +17876,7 @@ function CommentMenu({
17669
17876
  children: /* @__PURE__ */ jsx(BiDotsVerticalRounded, { size: 18 })
17670
17877
  }
17671
17878
  ),
17672
- open && /* @__PURE__ */ jsxs("div", { className: "absolute right-0 top-full z-50 mt-2 min-w-[180px] overflow-hidden rounded-xl border border-gray-200 bg-white shadow-xl dark:border-neutral-800 dark:bg-neutral-900", children: [
17673
- canEdit && /* @__PURE__ */ jsxs(
17674
- "button",
17675
- {
17676
- type: "button",
17677
- onClick: () => {
17678
- setOpen(false);
17679
- onEdit?.();
17680
- },
17681
- className: "flex w-full items-center gap-2 px-4 py-3 text-sm hover:bg-gray-100 dark:hover:bg-neutral-800",
17682
- children: [
17683
- /* @__PURE__ */ jsx(BiEdit, {}),
17684
- "Edit"
17685
- ]
17686
- }
17687
- ),
17688
- canDelete && /* @__PURE__ */ jsxs(
17689
- "button",
17690
- {
17691
- type: "button",
17692
- onClick: () => {
17693
- setOpen(false);
17694
- onDelete?.();
17695
- },
17696
- className: "flex w-full items-center gap-2 px-4 py-3 text-sm text-red-500 hover:bg-gray-100 dark:hover:bg-neutral-800",
17697
- children: [
17698
- /* @__PURE__ */ jsx(BiTrash, {}),
17699
- "Delete"
17700
- ]
17701
- }
17702
- ),
17703
- canReport && /* @__PURE__ */ jsxs(
17704
- "button",
17705
- {
17706
- type: "button",
17707
- onClick: () => {
17708
- setOpen(false);
17709
- onReport?.();
17710
- },
17711
- className: "flex w-full items-center gap-2 px-4 py-3 text-sm hover:bg-gray-100 dark:hover:bg-neutral-800",
17712
- children: [
17713
- /* @__PURE__ */ jsx(BiFlag, {}),
17714
- "Report"
17715
- ]
17716
- }
17717
- )
17718
- ] })
17879
+ /* @__PURE__ */ jsx(Transition4.TransitionDropdown, { visibility: open, children: /* @__PURE__ */ jsx("div", { className: "absolute right-0 top-full z-50 mt-2 min-w-[180px] overflow-hidden rounded-xl border border-gray-200 bg-white shadow-xl dark:border-neutral-800 dark:bg-neutral-900", children: /* @__PURE__ */ jsx(Menu, { items }) }) })
17719
17880
  ] });
17720
17881
  }
17721
17882
  var CommentMenu_default = CommentMenu;
@@ -17936,13 +18097,6 @@ function CommentList({
17936
18097
  }
17937
18098
  var CommentList_default = CommentList;
17938
18099
 
17939
- // src/compositions/comment-thread/utils/updateComment.ts
17940
- function updateComment(comments, commentId, updater) {
17941
- return comments.map(
17942
- (comment) => comment.id === commentId ? updater(comment) : comment
17943
- );
17944
- }
17945
-
17946
18100
  // src/compositions/comment-thread/constants/comment.constants.ts
17947
18101
  var DEFAULT_COMMENT_THREAD_CONFIG = {
17948
18102
  maxDepth: 5,
@@ -17958,6 +18112,7 @@ function CommentThread({
17958
18112
  components,
17959
18113
  config,
17960
18114
  updatedComment,
18115
+ deletedComment,
17961
18116
  onEdit,
17962
18117
  onDelete,
17963
18118
  onReport
@@ -17985,7 +18140,7 @@ function CommentThread({
17985
18140
  setIsLoadingComments(false);
17986
18141
  }
17987
18142
  }
17988
- loadComments();
18143
+ void loadComments();
17989
18144
  }, [dataSource, resolvedConfig.commentsPerPage]);
17990
18145
  useEffect(() => {
17991
18146
  replyCacheRef.current = replyCache;
@@ -18026,29 +18181,18 @@ function CommentThread({
18026
18181
  cancelled = true;
18027
18182
  };
18028
18183
  }, [dataSource, resolvedConfig.repliesPerPage]);
18029
- function updateReplyCacheComment(cache, commentId, updater) {
18030
- const next = {};
18031
- for (const [parentId, replies] of Object.entries(cache)) {
18032
- next[parentId] = replies.map(
18033
- (reply) => reply.id === commentId ? updater(reply) : reply
18034
- );
18184
+ useEffect(() => {
18185
+ if (!updatedComment) {
18186
+ return;
18035
18187
  }
18036
- return next;
18037
- }
18038
- function removeCommentTreeFromCache(cache, commentId) {
18039
- const childIds = cache[commentId]?.map((reply) => reply.id) ?? [];
18040
- let next = Object.fromEntries(
18041
- Object.entries(cache).map(([parentId, replies]) => [
18042
- parentId,
18043
- replies.filter((reply) => reply.id !== commentId)
18044
- ])
18045
- );
18046
- delete next[commentId];
18047
- for (const childId of childIds) {
18048
- next = removeCommentTreeFromCache(next, childId);
18188
+ updateCommentEverywhere(updatedComment.id, () => updatedComment);
18189
+ }, [updatedComment]);
18190
+ useEffect(() => {
18191
+ if (!deletedComment) {
18192
+ return;
18049
18193
  }
18050
- return next;
18051
- }
18194
+ removeCommentEverywhere(deletedComment);
18195
+ }, [deletedComment]);
18052
18196
  async function handleCreateComment(content) {
18053
18197
  const comment = await dataSource.createComment({
18054
18198
  content,
@@ -18056,51 +18200,13 @@ function CommentThread({
18056
18200
  });
18057
18201
  setComments((prev) => [comment, ...prev]);
18058
18202
  }
18059
- async function handleDeleteComment(comment) {
18060
- await dataSource.deleteComment(comment.id);
18061
- setComments((prev) => prev.filter((item) => item.id !== comment.id));
18062
- setReplyCache((prev) => removeCommentTreeFromCache(prev, comment.id));
18063
- if (comment.parentCommentId) {
18064
- setComments(
18065
- (prev) => updateComment(prev, comment.parentCommentId, (item) => ({
18066
- ...item,
18067
- replyCount: Math.max(item.replyCount - 1, 0)
18068
- }))
18069
- );
18070
- setReplyCache(
18071
- (prev) => updateReplyCacheComment(prev, comment.parentCommentId, (item) => ({
18072
- ...item,
18073
- replyCount: Math.max(item.replyCount - 1, 0)
18074
- }))
18075
- );
18076
- }
18077
- }
18078
- function updateCommentEverywhere(commentId, updater) {
18079
- setComments((prev) => updateComment(prev, commentId, updater));
18080
- setReplyCache((prev) => updateReplyCacheComment(prev, commentId, updater));
18081
- }
18082
- useEffect(() => {
18083
- if (!updatedComment) {
18084
- return;
18085
- }
18086
- updateCommentEverywhere(updatedComment.id, () => updatedComment);
18087
- }, [updatedComment]);
18088
18203
  async function handleReply(parentComment, content) {
18089
18204
  const reply = await dataSource.createComment({
18090
18205
  content,
18091
18206
  parentCommentId: parentComment.id
18092
18207
  });
18093
- setReplyCache((prev) => ({
18094
- ...prev,
18095
- [parentComment.id]: [...prev[parentComment.id] ?? [], reply]
18096
- }));
18097
- const incrementReplyCount = (items) => items.map(
18098
- (item) => item.id === parentComment.id ? {
18099
- ...item,
18100
- replyCount: item.replyCount + 1
18101
- } : item
18102
- );
18103
- setComments((prev) => incrementReplyCount(prev));
18208
+ setReplyCache((prev) => addReplyToCache(prev, parentComment.id, reply));
18209
+ setComments((prev) => incrementReplyCount(prev, parentComment.id));
18104
18210
  setReplyCache(
18105
18211
  (prev) => updateReplyCacheComment(prev, parentComment.id, (item) => ({
18106
18212
  ...item,
@@ -18121,61 +18227,66 @@ function CommentThread({
18121
18227
  }));
18122
18228
  }
18123
18229
  async function handleLike(comment) {
18124
- const optimistic = {
18125
- liked: !comment.liked,
18126
- disliked: false,
18127
- likes: comment.liked ? Math.max(comment.likes - 1, 0) : comment.likes + 1,
18128
- dislikes: comment.disliked ? Math.max(comment.dislikes - 1, 0) : comment.dislikes
18129
- };
18130
- const updater = (item) => ({
18131
- ...item,
18132
- likes: optimistic.likes,
18133
- dislikes: optimistic.dislikes,
18134
- liked: optimistic.liked,
18135
- disliked: optimistic.disliked
18136
- });
18230
+ const optimistic = getOptimisticLikeState(comment);
18231
+ const updater = (item) => applyReactionState(item, optimistic);
18137
18232
  setComments((prev) => updateComment(prev, comment.id, updater));
18138
18233
  setReplyCache((prev) => updateReplyCacheComment(prev, comment.id, updater));
18139
18234
  try {
18140
18235
  await dataSource.toggleLike(comment.id);
18141
18236
  } catch {
18142
- setComments((prev) => updateComment(prev, comment.id, () => comment));
18143
- setReplyCache(
18144
- (prev) => updateReplyCacheComment(prev, comment.id, () => comment)
18145
- );
18237
+ rollbackComment(comment);
18146
18238
  }
18147
18239
  }
18148
18240
  async function handleDislike(comment) {
18149
- const optimistic = {
18150
- liked: false,
18151
- disliked: !comment.disliked,
18152
- likes: comment.liked ? Math.max(comment.likes - 1, 0) : comment.likes,
18153
- dislikes: comment.disliked ? Math.max(comment.dislikes - 1, 0) : comment.dislikes + 1
18154
- };
18155
- const updater = (item) => ({
18156
- ...item,
18157
- likes: optimistic.likes,
18158
- dislikes: optimistic.dislikes,
18159
- liked: optimistic.liked,
18160
- disliked: optimistic.disliked
18161
- });
18241
+ const optimistic = getOptimisticDislikeState(comment);
18242
+ const updater = (item) => applyReactionState(item, optimistic);
18162
18243
  setComments((prev) => updateComment(prev, comment.id, updater));
18163
18244
  setReplyCache((prev) => updateReplyCacheComment(prev, comment.id, updater));
18164
18245
  try {
18165
18246
  await dataSource.toggleDislike(comment.id);
18166
18247
  } catch {
18167
- setComments((prev) => updateComment(prev, comment.id, () => comment));
18168
- setReplyCache(
18169
- (prev) => updateReplyCacheComment(prev, comment.id, () => comment)
18170
- );
18248
+ rollbackComment(comment);
18171
18249
  }
18172
18250
  }
18251
+ function rollbackComment(comment) {
18252
+ setComments((prev) => updateComment(prev, comment.id, () => comment));
18253
+ setReplyCache(
18254
+ (prev) => updateReplyCacheComment(prev, comment.id, () => comment)
18255
+ );
18256
+ }
18173
18257
  async function handleEditComment(comment) {
18174
18258
  const updatedComment2 = await onEdit?.(comment);
18175
18259
  if (updatedComment2) {
18176
18260
  updateCommentEverywhere(updatedComment2.id, () => updatedComment2);
18177
18261
  }
18178
18262
  }
18263
+ function updateCommentEverywhere(commentId, updater) {
18264
+ setComments((prev) => updateComment(prev, commentId, updater));
18265
+ setReplyCache((prev) => updateReplyCacheComment(prev, commentId, updater));
18266
+ }
18267
+ async function handleDeleteComment(comment) {
18268
+ if (onDelete) {
18269
+ onDelete(comment);
18270
+ return;
18271
+ }
18272
+ await dataSource.deleteComment(comment.id);
18273
+ removeCommentEverywhere(comment);
18274
+ }
18275
+ function removeCommentEverywhere(comment) {
18276
+ setComments((prev) => removeComment(prev, comment.id));
18277
+ setReplyCache((prev) => removeCommentTreeFromCache(prev, comment.id));
18278
+ if (comment.parentCommentId) {
18279
+ setComments(
18280
+ (prev) => decrementReplyCount(prev, comment.parentCommentId)
18281
+ );
18282
+ setReplyCache(
18283
+ (prev) => updateReplyCacheComment(prev, comment.parentCommentId, (item) => ({
18284
+ ...item,
18285
+ replyCount: Math.max(item.replyCount - 1, 0)
18286
+ }))
18287
+ );
18288
+ }
18289
+ }
18179
18290
  if (loading || isLoadingComments) {
18180
18291
  return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-6", children: "Loading comments..." });
18181
18292
  }
@@ -18873,36 +18984,6 @@ var TopNav = ({
18873
18984
  };
18874
18985
  return /* @__PURE__ */ jsx("div", { className: "flex items-center", children: items.map(renderNode) });
18875
18986
  };
18876
- var useDrawer = (defaultVisibility = true) => {
18877
- const [show, setShow] = useState(defaultVisibility);
18878
- const openDrawer = () => {
18879
- setShow((prev) => !prev);
18880
- };
18881
- const closeDrawer = () => {
18882
- setShow(false);
18883
- };
18884
- return {
18885
- show,
18886
- openDrawer,
18887
- closeDrawer
18888
- };
18889
- };
18890
- var useDrawer_default = useDrawer;
18891
- var useModal = () => {
18892
- const [show, setShow] = useState(false);
18893
- const handleOpenModal = () => {
18894
- setShow(true);
18895
- };
18896
- const handleCloseModal = () => {
18897
- setShow(false);
18898
- };
18899
- return {
18900
- show,
18901
- handleOpenModal,
18902
- handleCloseModal
18903
- };
18904
- };
18905
- var useModal_default = useModal;
18906
18987
  function GenericLayout({
18907
18988
  children,
18908
18989
  styles,
@@ -19019,6 +19100,6 @@ function ScrollToTop({
19019
19100
  }
19020
19101
  var ScrollToTop_default = ScrollToTop;
19021
19102
 
19022
- export { Accordion_default as Accordion, AsyncComponentWrapper_default as AsyncComponentWrapper, Avatar, Backdrop_default as Backdrop, Badge, BarChart_default as BarChart, Block_default as Block, BlockGroup_default as BlockGroup, BoxNav_default as BoxNav, BoxNavItem_default as BoxNavItem, Brand_default as Brand, Breadcrumb, BreadcrumbItem_default as BreadcrumbItem, Button_default as Button, Caption, Card_default as Card, CardContent_default as CardContent, CardFooter_default as CardFooter, CardHeader_default as CardHeader, Chapter, Checkbox_default as Checkbox, Chip, CloudinaryImage_default as CloudinaryImage, CloudinaryProvider, CloudinaryVideo_default as CloudinaryVideo, Code, CommentThread_default as CommentThread, Content, ContentArea_default as ContentArea, DataView, DataViewTable_default as DataViewTable, DateSelector_default as DateSelector, DefaultLayout_default as DefaultLayout, Display, DocumentationPanel_default as DocumentationPanel, Drawer, DrawerToggler_default as DrawerToggler, EUIDevLayout_default as EUIDevLayout, EUIProvider, Flag, Flex, FlexCol_default as FlexCol, FlexRow_default as FlexRow, Footer, FooterNav_default as FooterNav, FooterNavGroup_default as FooterNavGroup, FooterNavItem, FooterNavItemContext, FooterNavItemTitle, Form, FormResponse_default as FormResponse, GenericLayout_default as GenericLayout, GlowWrapper_default as GlowWrapper, Graph, GraphEdge, GraphNode, GraphRenderer, Grid_default as Grid, Header, HeaderNav_default as HeaderNav, HeaderNavGroup_default as HeaderNavGroup, HeaderNavItem, HeaderNavItemContext, HeaderNavItemTitle, HomeLayout_default as HomeLayout, Image2 as Image, ImageInput_default as ImageInput, Info_default as Info, Input, InputFile, InputLabel_default as InputLabel, InputList, InputListGroup, InputResponse_default as InputResponse, Label, Layout, Lead, LineChart_default as LineChart, Link, List_default as List, ListItem_default as ListItem, MarkdownEditor_default as MarkdownEditor, MarkdownProvider_default as MarkdownProvider, MarkdownTOC_default as MarkdownTOC, MarkdownViewer_default as MarkdownViewer, Menu, MenuGroup, MenuItem, MenuItemTitle, Modal_default as Modal, MotionSurface_default as MotionSurface, MultiImageInput_default as MultiImageInput, NumericRating_default as NumericRating, Overline, Paragraph, PieChart_default as PieChart, PriceTag, ProgressBar, ProgressBarRating_default as ProgressBarRating, Quote, Radio_default as Radio, RouteTab_default as RouteTab, RouteTabs_default as RouteTabs, ScrollToTop_default as ScrollToTop, Section, Select_default as Select, ShapeSwitch, ShowMore_default as ShowMore, Sidebar_default as Sidebar, SidebarLayout_default as SidebarLayout, SidemenuLayout_default as SidemenuLayout, Skeleton, Slider_default as Slider, StarRating_default as StarRating, StarRatingDistribution_default as StarRatingDistribution, StarRatingInput_default as StarRatingInput, Switch_default as Switch, TNDropdown, TNDropdownItem, TNDropdownTitle, TNGroup, Table_default as Table, Tag_default as Tag, Tags_default as Tags, TextArea_default as TextArea, ThemeContext, ThemeProvider, ThemeSwitch, TitleBanner, Toast, Tooltip4 as Tooltip, TopNav, Transition4 as Transition, TransitionDropdown_default as TransitionDropdown, TransitionFadeIn_default as TransitionFadeIn, Typography, UnderConstructionBanner, ValueBadge_default as ValueBadge, WorldMap, WorldMapCountryTable, YoutubeVideo_default as YoutubeVideoPlayer, cn, createForceLayout, createGridLayout, createTreeLayout, enumValues, formatCommentDate, getCurrencySymbol, getLayout, isMatch, isRenderFn, normalize, registerLayout, resolveAppearanceStyles, resolveWithGlobal, sendToast, useClickOutside, useCloudinaryConfig, useCurrentTheme_default as useCurrentTheme, useDrawer_default as useDrawer, useEUIConfig, useIsMobile_default as useIsMobile, useModal_default as useModal, useTheme_default as useTheme };
19103
+ export { Accordion_default as Accordion, AsyncComponentWrapper_default as AsyncComponentWrapper, Avatar, Backdrop_default as Backdrop, Badge, BarChart_default as BarChart, Block_default as Block, BlockGroup_default as BlockGroup, BoxNav_default as BoxNav, BoxNavItem_default as BoxNavItem, Brand_default as Brand, Breadcrumb, BreadcrumbItem_default as BreadcrumbItem, Button_default as Button, Caption, Card_default as Card, CardContent_default as CardContent, CardFooter_default as CardFooter, CardHeader_default as CardHeader, Chapter, Checkbox_default as Checkbox, Chip, CloudinaryImage_default as CloudinaryImage, CloudinaryProvider, CloudinaryVideo_default as CloudinaryVideo, Code, CommentThread_default as CommentThread, Content, ContentArea_default as ContentArea, DataView, DataViewTable_default as DataViewTable, DateSelector_default as DateSelector, DefaultLayout_default as DefaultLayout, Display, DocumentationPanel_default as DocumentationPanel, Drawer, DrawerToggler_default as DrawerToggler, EUIDevLayout_default as EUIDevLayout, EUIProvider, Flag, Flex, FlexCol_default as FlexCol, FlexRow_default as FlexRow, Footer, FooterNav_default as FooterNav, FooterNavGroup_default as FooterNavGroup, FooterNavItem, FooterNavItemContext, FooterNavItemTitle, Form, FormResponse_default as FormResponse, GenericLayout_default as GenericLayout, GlowWrapper_default as GlowWrapper, Graph, GraphEdge, GraphNode, GraphRenderer, Grid_default as Grid, Header, HeaderNav_default as HeaderNav, HeaderNavGroup_default as HeaderNavGroup, HeaderNavItem, HeaderNavItemContext, HeaderNavItemTitle, HomeLayout_default as HomeLayout, Image2 as Image, ImageInput_default as ImageInput, InfiniteScrollTrigger_default as InfiniteScrollTrigger, Info_default as Info, Input, InputFile, InputLabel_default as InputLabel, InputList, InputListGroup, InputResponse_default as InputResponse, Label, Layout, Lead, LineChart_default as LineChart, Link, List_default as List, ListItem_default as ListItem, MarkdownEditor_default as MarkdownEditor, MarkdownProvider_default as MarkdownProvider, MarkdownTOC_default as MarkdownTOC, MarkdownViewer_default as MarkdownViewer, Menu, MenuGroup, MenuItem, MenuItemTitle, Modal_default as Modal, MotionSurface_default as MotionSurface, MultiImageInput_default as MultiImageInput, NumericRating_default as NumericRating, Overline, Paragraph, PieChart_default as PieChart, PriceTag, ProgressBar, ProgressBarRating_default as ProgressBarRating, Quote, Radio_default as Radio, RouteTab_default as RouteTab, RouteTabs_default as RouteTabs, ScrollToTop_default as ScrollToTop, Section, Select_default as Select, ShapeSwitch, ShowMore_default as ShowMore, Sidebar_default as Sidebar, SidebarLayout_default as SidebarLayout, SidemenuLayout_default as SidemenuLayout, Skeleton, Slider_default as Slider, StarRating_default as StarRating, StarRatingDistribution_default as StarRatingDistribution, StarRatingInput_default as StarRatingInput, Switch_default as Switch, TNDropdown, TNDropdownItem, TNDropdownTitle, TNGroup, Table_default as Table, Tag_default as Tag, Tags_default as Tags, TextArea_default as TextArea, ThemeContext, ThemeProvider, ThemeSwitch, TitleBanner, Toast, Tooltip4 as Tooltip, TopNav, Transition4 as Transition, TransitionDropdown_default as TransitionDropdown, TransitionFadeIn_default as TransitionFadeIn, Typography, UnderConstructionBanner, ValueBadge_default as ValueBadge, WorldMap, WorldMapCountryTable, YoutubeVideo_default as YoutubeVideoPlayer, addReplyToCache, applyReactionState, cn, createForceLayout, createGridLayout, createTreeLayout, decrementReplyCount, enumValues, formatCommentDate, getCurrencySymbol, getLayout, getOptimisticDislikeState, getOptimisticLikeState, incrementReplyCount, isMatch, isRenderFn, normalize, registerLayout, removeComment, removeCommentTreeFromCache, resolveAppearanceStyles, resolveWithGlobal, sendToast, updateComment, updateReplyCacheComment, useClickOutside, useCloudinaryConfig, useCurrentTheme_default as useCurrentTheme, useDrawer_default as useDrawer, useEUIConfig, useIsMobile_default as useIsMobile, useModal_default as useModal, useTheme_default as useTheme };
19023
19104
  //# sourceMappingURL=index.mjs.map
19024
19105
  //# sourceMappingURL=index.mjs.map