@jfrader/ui 0.4.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (307) hide show
  1. package/README.md +2 -0
  2. package/dist/accordion-DLul6vIl.js +205 -0
  3. package/dist/accordion.js +1 -1
  4. package/dist/{alert-BBqaKI4k.js → alert-DS_einpy.js} +1 -1
  5. package/dist/alert.js +1 -1
  6. package/dist/announcement-bar-Dlbq5-9D.js +382 -0
  7. package/dist/announcement-bar.js +2 -0
  8. package/dist/avatar-CaGJHy1N.js +145 -0
  9. package/dist/avatar-group-M1opAQEG.js +138 -0
  10. package/dist/avatar-group.js +2 -0
  11. package/dist/avatar.js +1 -1
  12. package/dist/badge-CjM5Agqk.js +119 -0
  13. package/dist/badge.js +1 -1
  14. package/dist/bottom-sheet-DjZOPq4k.js +674 -0
  15. package/dist/bottom-sheet.js +2 -0
  16. package/dist/{breadcrumbs-DVAOxfvL.js → breadcrumbs-BDK_LiwH.js} +11 -4
  17. package/dist/breadcrumbs.js +1 -1
  18. package/dist/{button-P2e7_44z.js → button-NLY0h6EJ.js} +8 -8
  19. package/dist/button.js +1 -1
  20. package/dist/calendar-BzJdv_SZ.js +449 -0
  21. package/dist/calendar.js +1 -1
  22. package/dist/card-Ca4KQKYQ.js +154 -0
  23. package/dist/card.js +1 -1
  24. package/dist/carousel-B7OrvD6J.js +474 -0
  25. package/dist/carousel.js +2 -0
  26. package/dist/{checkbox-COYG6L7d.js → checkbox-DKSzExj2.js} +17 -16
  27. package/dist/checkbox.js +1 -1
  28. package/dist/chip-group-DjQ0_6Y9.js +290 -0
  29. package/dist/chip-group.js +2 -0
  30. package/dist/code-block/shiki.js +147 -0
  31. package/dist/code-block-B5we2lZa.js +293 -0
  32. package/dist/code-block.js +2 -0
  33. package/dist/collection-registry-k6JcD3Jr.js +44 -0
  34. package/dist/combobox-DFFqOBCi.js +339 -0
  35. package/dist/combobox.js +1 -1
  36. package/dist/command-palette-BmQu2w4H.js +391 -0
  37. package/dist/command-palette.js +1 -1
  38. package/dist/comment-thread-ASaXDcGo.js +1410 -0
  39. package/dist/comment-thread.js +2 -0
  40. package/dist/context-menu-__1c2Dk9.js +370 -0
  41. package/dist/context-menu.js +2 -0
  42. package/dist/copy-button-DCSLcYS-.js +252 -0
  43. package/dist/copy-button.js +2 -0
  44. package/dist/countdown-Dp_TD1VP.js +293 -0
  45. package/dist/countdown.js +2 -0
  46. package/dist/date-picker-BiPN7yeK.js +255 -0
  47. package/dist/date-picker.js +1 -1
  48. package/dist/date-range-picker-DQpUeKqV.js +570 -0
  49. package/dist/date-range-picker.js +2 -0
  50. package/dist/{dialog-xaydbXl2.js → dialog-BX1zYMs-.js} +21 -20
  51. package/dist/dialog.js +1 -1
  52. package/dist/{divider-DYoJf0I_.js → divider-Cp7aNbhM.js} +21 -20
  53. package/dist/divider.js +1 -1
  54. package/dist/drawer-DsASTiP-.js +553 -0
  55. package/dist/drawer.js +2 -0
  56. package/dist/elastic-slider-BG6K019r.js +395 -0
  57. package/dist/elastic-slider.js +2 -0
  58. package/dist/empty-state-CDgrjPPf.js +142 -0
  59. package/dist/empty-state.js +2 -0
  60. package/dist/expandable-card-rUATve0o.js +347 -0
  61. package/dist/expandable-card.js +2 -0
  62. package/dist/expanding-search-BxOwtdwt.js +238 -0
  63. package/dist/expanding-search.js +2 -0
  64. package/dist/field-anatomy-COVdNpf5.js +84 -0
  65. package/dist/file-dropzone-BuXm3Tea.js +457 -0
  66. package/dist/file-dropzone.js +2 -0
  67. package/dist/filter-toolbar-Cy5Hqur-.js +314 -0
  68. package/dist/filter-toolbar.js +2 -0
  69. package/dist/hold-to-confirm-DjB2EVjM.js +294 -0
  70. package/dist/hold-to-confirm.js +2 -0
  71. package/dist/hover-card-CoMJKg1g.js +347 -0
  72. package/dist/hover-card.js +2 -0
  73. package/dist/image-compare-BxY8Ykzt.js +415 -0
  74. package/dist/image-compare.js +2 -0
  75. package/dist/index.js +84 -38
  76. package/dist/inline-edit-C0eeml65.js +535 -0
  77. package/dist/inline-edit.js +2 -0
  78. package/dist/input-control-DmMuAuPS.js +34 -0
  79. package/dist/json-viewer-DgWqyU75.js +802 -0
  80. package/dist/json-viewer.js +2 -0
  81. package/dist/listbox-style-WX-RASp1.js +59 -0
  82. package/dist/{media-D_eA_I-e.js → media-8yrN85VT.js} +2 -2
  83. package/dist/mention-input-sq61si9L.js +600 -0
  84. package/dist/mention-input.js +2 -0
  85. package/dist/menu-DDKgmK2F.js +295 -0
  86. package/dist/menu.js +1 -1
  87. package/dist/metric-card--lVTz5Wn.js +118 -0
  88. package/dist/metric-card.js +2 -0
  89. package/dist/multi-select-DG1BCFX7.js +598 -0
  90. package/dist/multi-select.js +2 -0
  91. package/dist/{navigation-DhnKriOp.js → navigation-CC26JDr-.js} +24 -18
  92. package/dist/navigation.js +1 -1
  93. package/dist/overlay-layer-qEbpEtb8.js +78 -0
  94. package/dist/overlay-portal-C4JZFq2M.js +15 -0
  95. package/dist/{pagination-DYdwsxwe.js → pagination-BfkeWbmP.js} +24 -23
  96. package/dist/pagination.js +1 -1
  97. package/dist/password-field-03pWRkuY.js +250 -0
  98. package/dist/password-field.js +2 -0
  99. package/dist/pill-BaS-uIbn.js +58 -0
  100. package/dist/pill.js +1 -1
  101. package/dist/popover-CErIw2q3.js +125 -0
  102. package/dist/popover.js +1 -1
  103. package/dist/{progress-BpJswTG4.js → progress-DAQkfhPd.js} +5 -5
  104. package/dist/progress.js +1 -1
  105. package/dist/radio-cards-Cu9cBssN.js +456 -0
  106. package/dist/radio-cards.js +2 -0
  107. package/dist/{radio-group-Ce0_IWQr.js → radio-group-TIK0-iPX.js} +22 -19
  108. package/dist/radio-group.js +1 -1
  109. package/dist/resizable-panels-DUpQEpwG.js +520 -0
  110. package/dist/resizable-panels.js +2 -0
  111. package/dist/scroll-area-CcZyiSOQ.js +371 -0
  112. package/dist/scroll-area.js +2 -0
  113. package/dist/search-field-DMvho0KQ.js +274 -0
  114. package/dist/search-field.js +2 -0
  115. package/dist/segmented-control-8ZUGnsZm.js +327 -0
  116. package/dist/segmented-control.js +2 -0
  117. package/dist/select-D5rhJ8gi.js +293 -0
  118. package/dist/select.js +1 -1
  119. package/dist/signature-pad-_bTeguN9.js +645 -0
  120. package/dist/signature-pad.js +2 -0
  121. package/dist/{skeleton-OoFlOEXO.js → skeleton-XQQDkCHd.js} +1 -1
  122. package/dist/skeleton.js +1 -1
  123. package/dist/slider-DVG6-Awh.js +308 -0
  124. package/dist/slider.js +2 -0
  125. package/dist/sortable-data-table-CYKT_Ng7.js +365 -0
  126. package/dist/sortable-data-table.js +2 -0
  127. package/dist/{spinner-C2YDoiMn.js → spinner-DtxvDPdM.js} +1 -1
  128. package/dist/spinner.js +1 -1
  129. package/dist/split-button-BCw4zZom.js +262 -0
  130. package/dist/split-button.js +2 -0
  131. package/dist/stepper-CruHbXxX.js +480 -0
  132. package/dist/stepper.js +2 -0
  133. package/dist/swipe-actions-CBuJREU1.js +420 -0
  134. package/dist/swipe-actions.js +2 -0
  135. package/dist/switch-C1WrKrf-.js +145 -0
  136. package/dist/switch.js +1 -1
  137. package/dist/tabs-XluwRjgg.js +210 -0
  138. package/dist/tabs.js +1 -1
  139. package/dist/tag-input-DSRCyrX2.js +418 -0
  140. package/dist/tag-input.js +2 -0
  141. package/dist/{text-field-D60ok14S.js → text-field-hU72iSVS.js} +20 -17
  142. package/dist/text-field.js +1 -1
  143. package/dist/{textarea-DyfjtP0A.js → textarea-3k4Y0QQ3.js} +23 -20
  144. package/dist/textarea.js +1 -1
  145. package/dist/theme-root.js +1 -1
  146. package/dist/theme-switch-C505TtU8.js +166 -0
  147. package/dist/theme-switch.js +2 -0
  148. package/dist/time-picker-CPlhW0tr.js +311 -0
  149. package/dist/time-picker.js +2 -0
  150. package/dist/timeline-B0uAAVfT.js +624 -0
  151. package/dist/timeline.js +2 -0
  152. package/dist/toast-B7wo3sX1.js +371 -0
  153. package/dist/toast-stack-B40VpS4M.js +197 -0
  154. package/dist/toast-stack.js +2 -0
  155. package/dist/toast.js +1 -1
  156. package/dist/{toggle-group-CI0e7hFm.js → toggle-group-B2fpFZwV.js} +5 -5
  157. package/dist/toggle-group.js +1 -1
  158. package/dist/tooltip-BvgVTCTN.js +120 -0
  159. package/dist/tooltip.js +1 -1
  160. package/dist/tree-view-j8qLqkb_.js +364 -0
  161. package/dist/tree-view.js +2 -0
  162. package/dist/types/components/announcement-bar/announcement-bar.d.ts +75 -0
  163. package/dist/types/components/announcement-bar/index.d.ts +2 -0
  164. package/dist/types/components/avatar-group/avatar-group.d.ts +43 -0
  165. package/dist/types/components/avatar-group/index.d.ts +2 -0
  166. package/dist/types/components/bottom-sheet/bottom-sheet.d.ts +60 -0
  167. package/dist/types/components/bottom-sheet/index.d.ts +2 -0
  168. package/dist/types/components/calendar/calendar.d.ts +25 -1
  169. package/dist/types/components/calendar/index.d.ts +1 -1
  170. package/dist/types/components/carousel/carousel.d.ts +73 -0
  171. package/dist/types/components/carousel/index.d.ts +2 -0
  172. package/dist/types/components/checkbox/checkbox.d.ts +1 -1
  173. package/dist/types/components/chip-group/chip-group.d.ts +54 -0
  174. package/dist/types/components/chip-group/index.d.ts +1 -0
  175. package/dist/types/components/code-block/code-block.d.ts +58 -0
  176. package/dist/types/components/code-block/index.d.ts +1 -0
  177. package/dist/types/components/code-block/shiki.d.ts +3 -0
  178. package/dist/types/components/combobox/combobox.d.ts +1 -1
  179. package/dist/types/components/command-palette/command-palette.d.ts +2 -2
  180. package/dist/types/components/comment-thread/comment-thread.d.ts +118 -0
  181. package/dist/types/components/comment-thread/index.d.ts +1 -0
  182. package/dist/types/components/comment-thread/thread-core.d.ts +96 -0
  183. package/dist/types/components/comment-thread/thread-parts.d.ts +114 -0
  184. package/dist/types/components/context-menu/context-menu.d.ts +55 -0
  185. package/dist/types/components/context-menu/index.d.ts +2 -0
  186. package/dist/types/components/copy-button/copy-button.d.ts +49 -0
  187. package/dist/types/components/copy-button/index.d.ts +2 -0
  188. package/dist/types/components/countdown/countdown.d.ts +37 -0
  189. package/dist/types/components/countdown/index.d.ts +1 -0
  190. package/dist/types/components/date-picker/date-picker.d.ts +1 -1
  191. package/dist/types/components/date-range-picker/date-range-picker.d.ts +103 -0
  192. package/dist/types/components/date-range-picker/index.d.ts +2 -0
  193. package/dist/types/components/drawer/drawer.d.ts +59 -0
  194. package/dist/types/components/drawer/index.d.ts +2 -0
  195. package/dist/types/components/elastic-slider/elastic-slider.d.ts +53 -0
  196. package/dist/types/components/elastic-slider/index.d.ts +1 -0
  197. package/dist/types/components/empty-state/empty-state.d.ts +36 -0
  198. package/dist/types/components/empty-state/index.d.ts +2 -0
  199. package/dist/types/components/expandable-card/expandable-card.d.ts +28 -0
  200. package/dist/types/components/expandable-card/index.d.ts +2 -0
  201. package/dist/types/components/expanding-search/expanding-search.d.ts +22 -0
  202. package/dist/types/components/expanding-search/index.d.ts +1 -0
  203. package/dist/types/components/field/field-anatomy.d.ts +4 -2
  204. package/dist/types/components/file-dropzone/file-dropzone.d.ts +93 -0
  205. package/dist/types/components/file-dropzone/index.d.ts +2 -0
  206. package/dist/types/components/filter-toolbar/filter-toolbar.d.ts +70 -0
  207. package/dist/types/components/filter-toolbar/index.d.ts +1 -0
  208. package/dist/types/components/hold-to-confirm/hold-to-confirm.d.ts +32 -0
  209. package/dist/types/components/hold-to-confirm/index.d.ts +2 -0
  210. package/dist/types/components/hover-card/hover-card.d.ts +97 -0
  211. package/dist/types/components/hover-card/index.d.ts +2 -0
  212. package/dist/types/components/image-compare/image-compare.d.ts +54 -0
  213. package/dist/types/components/image-compare/index.d.ts +1 -0
  214. package/dist/types/components/inline-edit/index.d.ts +2 -0
  215. package/dist/types/components/inline-edit/inline-edit.d.ts +93 -0
  216. package/dist/types/components/json-viewer/index.d.ts +2 -0
  217. package/dist/types/components/json-viewer/json-viewer.d.ts +82 -0
  218. package/dist/types/components/mention-input/index.d.ts +2 -0
  219. package/dist/types/components/mention-input/mention-input.d.ts +87 -0
  220. package/dist/types/components/menu/menu.d.ts +68 -7
  221. package/dist/types/components/metric-card/index.d.ts +1 -0
  222. package/dist/types/components/metric-card/metric-card.d.ts +37 -0
  223. package/dist/types/components/multi-select/index.d.ts +2 -0
  224. package/dist/types/components/multi-select/multi-select.d.ts +73 -0
  225. package/dist/types/components/pagination/pagination.d.ts +1 -1
  226. package/dist/types/components/password-field/index.d.ts +2 -0
  227. package/dist/types/components/password-field/password-field.d.ts +34 -0
  228. package/dist/types/components/popover/popover.d.ts +1 -1
  229. package/dist/types/components/radio-cards/index.d.ts +1 -0
  230. package/dist/types/components/radio-cards/radio-cards.d.ts +42 -0
  231. package/dist/types/components/radio-group/radio-group.d.ts +1 -1
  232. package/dist/types/components/resizable-panels/index.d.ts +2 -0
  233. package/dist/types/components/resizable-panels/resizable-panels.d.ts +42 -0
  234. package/dist/types/components/scroll-area/index.d.ts +2 -0
  235. package/dist/types/components/scroll-area/scroll-area.d.ts +34 -0
  236. package/dist/types/components/search-field/index.d.ts +1 -0
  237. package/dist/types/components/search-field/search-field.d.ts +31 -0
  238. package/dist/types/components/segmented-control/index.d.ts +2 -0
  239. package/dist/types/components/segmented-control/segmented-control.d.ts +32 -0
  240. package/dist/types/components/select/select.d.ts +1 -1
  241. package/dist/types/components/signature-pad/index.d.ts +2 -0
  242. package/dist/types/components/signature-pad/signature-pad.d.ts +104 -0
  243. package/dist/types/components/slider/index.d.ts +1 -0
  244. package/dist/types/components/slider/slider-style.d.ts +14 -0
  245. package/dist/types/components/slider/slider.d.ts +62 -0
  246. package/dist/types/components/slider/use-slider-interaction.d.ts +79 -0
  247. package/dist/types/components/sortable-data-table/index.d.ts +1 -0
  248. package/dist/types/components/sortable-data-table/sortable-data-table.d.ts +76 -0
  249. package/dist/types/components/split-button/index.d.ts +2 -0
  250. package/dist/types/components/split-button/split-button.d.ts +55 -0
  251. package/dist/types/components/stepper/index.d.ts +2 -0
  252. package/dist/types/components/stepper/stepper.d.ts +85 -0
  253. package/dist/types/components/swipe-actions/index.d.ts +2 -0
  254. package/dist/types/components/swipe-actions/swipe-actions.d.ts +44 -0
  255. package/dist/types/components/tabs/tabs.d.ts +1 -1
  256. package/dist/types/components/tag-input/index.d.ts +2 -0
  257. package/dist/types/components/tag-input/tag-input.d.ts +66 -0
  258. package/dist/types/components/text-field/text-field.d.ts +1 -1
  259. package/dist/types/components/textarea/textarea.d.ts +1 -1
  260. package/dist/types/components/theme-switch/index.d.ts +1 -0
  261. package/dist/types/components/theme-switch/theme-switch.d.ts +33 -0
  262. package/dist/types/components/time-picker/index.d.ts +2 -0
  263. package/dist/types/components/time-picker/time-picker.d.ts +48 -0
  264. package/dist/types/components/timeline/index.d.ts +2 -0
  265. package/dist/types/components/timeline/timeline.d.ts +66 -0
  266. package/dist/types/components/toast/toast.d.ts +37 -2
  267. package/dist/types/components/toast-stack/index.d.ts +2 -0
  268. package/dist/types/components/toast-stack/toast-stack.d.ts +28 -0
  269. package/dist/types/components/tooltip/tooltip.d.ts +2 -2
  270. package/dist/types/components/tree-view/index.d.ts +1 -0
  271. package/dist/types/components/tree-view/tree-view.d.ts +47 -0
  272. package/dist/types/components/usage-meter/index.d.ts +2 -0
  273. package/dist/types/components/usage-meter/usage-meter.d.ts +83 -0
  274. package/dist/types/index.d.ts +45 -0
  275. package/dist/types/overlay/overlay-layer.d.ts +53 -0
  276. package/dist/types/overlay/use-overlay-floating.d.ts +19 -2
  277. package/dist/types/styling/media.d.ts +1 -0
  278. package/dist/types/styling/theme.d.ts +12 -0
  279. package/dist/types/utils/use-controlled-state.d.ts +2 -1
  280. package/dist/usage-meter-qyQ3rYVv.js +463 -0
  281. package/dist/usage-meter.js +2 -0
  282. package/dist/use-controlled-state-DpeVQZNR.js +20 -0
  283. package/dist/use-latest-callback-cj1OOQL6.js +11 -0
  284. package/dist/use-overlay-floating-Bx2jBKAA.js +33 -0
  285. package/dist/use-slider-interaction-ChL-208h.js +234 -0
  286. package/package.json +195 -3
  287. package/dist/accordion-Bd-j04hW.js +0 -198
  288. package/dist/avatar-BahDVO9t.js +0 -132
  289. package/dist/badge-B_sLygxU.js +0 -108
  290. package/dist/calendar-C9Yad_-w.js +0 -394
  291. package/dist/card-D-aI2QHx.js +0 -158
  292. package/dist/collection-registry-BTYi6zGh.js +0 -98
  293. package/dist/combobox-DiMC2g_u.js +0 -327
  294. package/dist/command-palette-V_2pEay7.js +0 -379
  295. package/dist/date-picker-C29Uo4Tx.js +0 -250
  296. package/dist/field-anatomy-D2ToMeRa.js +0 -109
  297. package/dist/menu-CGPTNRnF.js +0 -216
  298. package/dist/pill-DO2gHzMb.js +0 -56
  299. package/dist/popover-CdRXjQqI.js +0 -113
  300. package/dist/select-BgG7WgSh.js +0 -286
  301. package/dist/switch-Dr-qjmT4.js +0 -142
  302. package/dist/tabs-CK_g1RKa.js +0 -203
  303. package/dist/toast-CjmELMZZ.js +0 -283
  304. package/dist/tooltip-CaL3rKbV.js +0 -108
  305. package/dist/use-controlled-state-CVXDa-qM.js +0 -21
  306. package/dist/use-overlay-floating-Bit-f0FU.js +0 -31
  307. package/dist/{theme-root-BbTBuLMQ.js → theme-root-Bs1U3uPA.js} +2 -2
@@ -0,0 +1,1410 @@
1
+ 'use client';
2
+ import { i as e, r as t, t as n } from "./sx-Dx9JUKp5.js";
3
+ import { n as r, r as i } from "./media-8yrN85VT.js";
4
+ import { n as a } from "./roving-focus-CYlo_Kf8.js";
5
+ import { t as o } from "./use-controlled-state-DpeVQZNR.js";
6
+ import { t as s } from "./visually-hidden-BJdvqqvn.js";
7
+ import { t as c } from "./renderable-DzcIj1Lo.js";
8
+ import { t as l } from "./button-NLY0h6EJ.js";
9
+ import { t as u } from "./avatar-CaGJHy1N.js";
10
+ import { t as d } from "./card-Ca4KQKYQ.js";
11
+ import { n as f, o as p, s as m, t as h } from "./listbox-style-WX-RASp1.js";
12
+ import { t as g } from "./part-id-D0zksy32.js";
13
+ import { t as _ } from "./overlay-portal-C4JZFq2M.js";
14
+ import { t as ee } from "./textarea-3k4Y0QQ3.js";
15
+ import { useEffect as te, useId as ne, useLayoutEffect as v, useMemo as y, useRef as b, useState as x } from "react";
16
+ import { vars as S } from "@jfrader/tokens/vars";
17
+ import { Fragment as re, jsx as C, jsxs as w } from "@emotion/react/jsx-runtime";
18
+ import { autoUpdate as ie, flip as ae, offset as oe, shift as se, useFloating as ce, useMergeRefs as le } from "@floating-ui/react";
19
+ var T = [], ue = 864e13, de = 1e3, fe = 60 * de, E = 60 * fe, D = 24 * E, O = 365.2425 * D, pe = [
20
+ ["year", O],
21
+ ["month", O / 12],
22
+ ["week", 7 * D],
23
+ ["day", D],
24
+ ["hour", E],
25
+ ["minute", fe]
26
+ ], k = /^(\d{4})-(\d{2})-(\d{2})T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:\d{2})$/, me = "en-US", A = (e) => Number.isFinite(e) && Math.abs(e) <= ue;
27
+ function he(e) {
28
+ if (typeof e == "number") return A(e) ? e : null;
29
+ if (e instanceof Date) return A(e.getTime()) ? e.getTime() : null;
30
+ if (typeof e != "string") return null;
31
+ let t = k.exec(e);
32
+ if (!t) return null;
33
+ let [n, r, i] = t.slice(1, 4).map(Number), a = new Date(Date.UTC(n, r - 1, i));
34
+ if (a.getUTCMonth() !== r - 1 || a.getUTCDate() !== i) return null;
35
+ let o = Date.parse(e);
36
+ return A(o) ? o : null;
37
+ }
38
+ function j(e, t, n) {
39
+ let r = e - t;
40
+ for (let [e, t] of pe) if (Math.abs(r) >= t) return n.format(Math.trunc(r / t), e);
41
+ return n.format(Math.trunc(r / de), "second");
42
+ }
43
+ function ge(e, t) {
44
+ return {
45
+ relative: new Intl.RelativeTimeFormat(e, { numeric: "auto" }),
46
+ full: new Intl.DateTimeFormat(e, {
47
+ timeZone: t,
48
+ dateStyle: "full",
49
+ timeStyle: "short"
50
+ }),
51
+ number: new Intl.NumberFormat(e),
52
+ plural: new Intl.PluralRules(e),
53
+ people: new Intl.ListFormat(e, { type: "conjunction" }),
54
+ facts: new Intl.ListFormat(e, {
55
+ type: "unit",
56
+ style: "short"
57
+ })
58
+ };
59
+ }
60
+ function _e(e, t, n) {
61
+ let r = [], i = t;
62
+ try {
63
+ Intl.getCanonicalLocales(t);
64
+ } catch {
65
+ r.push(`${e}: locale ${JSON.stringify(String(t))} is not a valid language tag; using the default locale.`), i = void 0;
66
+ }
67
+ let a = n;
68
+ try {
69
+ new Intl.DateTimeFormat(me, { timeZone: n });
70
+ } catch {
71
+ r.push(`${e}: timeZone ${JSON.stringify(n)} is not a valid IANA time zone; using UTC.`), a = "UTC";
72
+ }
73
+ return {
74
+ formatters: ge(i, a),
75
+ problems: r
76
+ };
77
+ }
78
+ var ve = (e, t, n, r) => `${e.number.format(t)} ${e.plural.select(t) === "one" ? n : r}`;
79
+ function ye(e) {
80
+ let t = /* @__PURE__ */ new Map(), n = [], r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = !1, o = (e, s, c) => {
81
+ for (let l of e) i.has(l) ? a = !0 : (t.has(l.id) ? r.add(l.id) : (t.set(l.id, {
82
+ comment: l,
83
+ parentId: s,
84
+ depth: c
85
+ }), n.push(l.id)), i.add(l), o(l.replies ?? T, l.id, c + 1), i.delete(l));
86
+ };
87
+ return o(e, null, 0), {
88
+ entries: t,
89
+ order: n,
90
+ duplicates: [...r],
91
+ cyclic: a
92
+ };
93
+ }
94
+ function M(e, t, n, r = /* @__PURE__ */ new Set()) {
95
+ for (let [i, a] of e.entries()) {
96
+ if (r.has(a)) continue;
97
+ if (a.id === t) {
98
+ let t = n(a);
99
+ if (t === a) return e;
100
+ let r = [...e];
101
+ return t === null ? r.splice(i, 1) : r[i] = t, r;
102
+ }
103
+ let o = a.replies;
104
+ if (!o?.length) continue;
105
+ let s = M(o, t, n, new Set(r).add(a));
106
+ if (s !== o) return e.with(i, {
107
+ ...a,
108
+ replies: s
109
+ });
110
+ }
111
+ return e;
112
+ }
113
+ function be(e, t, n) {
114
+ if (t === null) return null;
115
+ let r = e.entries.get(t);
116
+ if (r) {
117
+ if (n <= 0) return null;
118
+ for (; r.depth + 1 > n && r.parentId !== null;) r = e.entries.get(r.parentId);
119
+ return r.comment.id;
120
+ }
121
+ }
122
+ function N(e, t, n) {
123
+ return t === null ? [...e, n] : M(e, t, (e) => ({
124
+ ...e,
125
+ replies: [...e.replies ?? T, n]
126
+ }));
127
+ }
128
+ function P(e, t, n) {
129
+ return M(e, t, (e) => e.deleted || e.body === n ? e : {
130
+ ...e,
131
+ body: n,
132
+ edited: !0
133
+ });
134
+ }
135
+ function F(e, t) {
136
+ return M(e, t, (e) => e.deleted ? e : e.replies?.length ? {
137
+ ...e,
138
+ deleted: !0,
139
+ body: "",
140
+ reactions: []
141
+ } : null);
142
+ }
143
+ function I(e, t, n) {
144
+ let r = e.find((e) => e.emoji === t);
145
+ if (!r) return {
146
+ reactions: [...e, {
147
+ emoji: t,
148
+ users: [n]
149
+ }],
150
+ added: !0
151
+ };
152
+ let i = !r.users.includes(n), a = i ? [...r.users, n] : r.users.filter((e) => e !== n);
153
+ return {
154
+ reactions: a.length === 0 ? e.filter((e) => e !== r) : e.map((e) => e === r ? {
155
+ emoji: t,
156
+ users: a
157
+ } : e),
158
+ added: i
159
+ };
160
+ }
161
+ function xe(e, t, n, r) {
162
+ let i = !1;
163
+ return {
164
+ comments: M(e, t, (e) => {
165
+ if (e.deleted) return e;
166
+ let t = I(e.reactions ?? [], n, r);
167
+ return i = t.added, {
168
+ ...e,
169
+ reactions: t.reactions
170
+ };
171
+ }),
172
+ added: i
173
+ };
174
+ }
175
+ function Se(e, t) {
176
+ let n = /* @__PURE__ */ new Set();
177
+ return e.filter((e) => {
178
+ let r = t(e);
179
+ return !n.has(r) && (n.add(r), !0);
180
+ });
181
+ }
182
+ //#endregion
183
+ //#region src/components/comment-thread/thread-parts.tsx
184
+ var Ce = "@", we = 8, L = 4, R = 8, Te = /\s/u, z = (e, t) => `${e}-${t}`, Ee = (e) => e.nativeEvent.isComposing || e.nativeEvent.keyCode === 229, B = {
185
+ sm: "sm",
186
+ md: "md"
187
+ }, De = t({
188
+ fontSize: S.textSize.xs,
189
+ color: S.color.textMuted,
190
+ fontVariantNumeric: "tabular-nums",
191
+ whiteSpace: "nowrap"
192
+ });
193
+ function Oe({ epoch: e, now: t, formatters: n, invalidLabel: r, id: i, fullId: a, ui: o, part: c }) {
194
+ return e === null ? /* @__PURE__ */ C("span", {
195
+ id: i,
196
+ "data-ui": z(o, "time"),
197
+ className: c?.className,
198
+ css: [De, c?.css],
199
+ children: r
200
+ }) : /* @__PURE__ */ w(re, { children: [/* @__PURE__ */ C("time", {
201
+ id: i,
202
+ dateTime: new Date(e).toISOString(),
203
+ "data-ui": z(o, "time"),
204
+ className: c?.className,
205
+ css: [De, c?.css],
206
+ children: t === null ? n.full.format(e) : j(e, t, n.relative)
207
+ }), /* @__PURE__ */ C("span", {
208
+ id: a,
209
+ css: s,
210
+ children: n.full.format(e)
211
+ })] });
212
+ }
213
+ var ke = t({
214
+ display: "grid",
215
+ gridTemplateColumns: "auto minmax(0, 1fr)",
216
+ columnGap: "var(--thread-column-gap)",
217
+ alignItems: "start"
218
+ }), Ae = t({ display: "inline-flex" }), je = t({
219
+ display: "grid",
220
+ rowGap: S.space[1],
221
+ minInlineSize: 0
222
+ }), V = t({
223
+ display: "flex",
224
+ flexWrap: "wrap",
225
+ alignItems: "baseline",
226
+ columnGap: S.space[2],
227
+ rowGap: S.space[1],
228
+ minInlineSize: 0
229
+ }), Me = t({
230
+ fontWeight: S.fontWeight.semibold,
231
+ color: S.color.text,
232
+ overflowWrap: "anywhere"
233
+ }), H = t({
234
+ fontSize: S.textSize.xs,
235
+ color: S.color.textMuted
236
+ });
237
+ function Ne({ ui: e, author: t, label: n, epoch: r, now: i, formatters: a, invalidTimeLabel: o, meta: s, size: c, baseId: l, messageId: d, children: f, slots: p }) {
238
+ let m = g(l, "author", d), h = g(l, "time", d), _ = g(l, "when", d);
239
+ return /* @__PURE__ */ w("article", {
240
+ "aria-label": n,
241
+ "aria-labelledby": n === void 0 ? `${m} ${h}` : void 0,
242
+ "aria-describedby": r === null ? void 0 : _,
243
+ "data-ui": z(e, "article"),
244
+ className: p?.article?.className,
245
+ css: [ke, p?.article?.css],
246
+ children: [/* @__PURE__ */ C("span", {
247
+ "aria-hidden": "true",
248
+ css: Ae,
249
+ children: /* @__PURE__ */ C(u, {
250
+ name: t.name,
251
+ src: t.avatar,
252
+ size: B[c]
253
+ })
254
+ }), /* @__PURE__ */ w("div", {
255
+ css: je,
256
+ children: [/* @__PURE__ */ w("div", {
257
+ css: V,
258
+ children: [
259
+ /* @__PURE__ */ C("span", {
260
+ id: m,
261
+ "data-ui": z(e, "author"),
262
+ css: Me,
263
+ children: t.name
264
+ }),
265
+ /* @__PURE__ */ C(Oe, {
266
+ epoch: r,
267
+ now: i,
268
+ formatters: a,
269
+ invalidLabel: o,
270
+ id: h,
271
+ fullId: _,
272
+ ui: e,
273
+ part: p?.time
274
+ }),
275
+ s ? /* @__PURE__ */ C("span", {
276
+ css: H,
277
+ children: s
278
+ }) : null
279
+ ]
280
+ }), f]
281
+ })]
282
+ });
283
+ }
284
+ var U = t({
285
+ display: "flex",
286
+ flexWrap: "wrap",
287
+ alignItems: "center",
288
+ gap: S.space[1]
289
+ }), W = t({
290
+ gap: S.space[1],
291
+ paddingInline: S.space[2],
292
+ fontVariantNumeric: "tabular-nums",
293
+ "&[aria-pressed=\"true\"]": {
294
+ borderWidth: "2px",
295
+ borderColor: S.color.accentBorder,
296
+ backgroundColor: S.color.accentSoft,
297
+ color: S.color.accentText,
298
+ fontWeight: S.fontWeight.semibold
299
+ },
300
+ [r]: { "&[aria-pressed=\"true\"]": { borderColor: "Highlight" } }
301
+ }), Pe = t({
302
+ display: "inline-flex",
303
+ alignItems: "center",
304
+ gap: S.space[1],
305
+ minBlockSize: S.space[6],
306
+ paddingInline: S.space[2],
307
+ border: `1px solid ${S.color.border}`,
308
+ borderRadius: S.radius.full,
309
+ fontSize: S.textSize.sm,
310
+ fontVariantNumeric: "tabular-nums"
311
+ }), Fe = t({ paddingInline: S.space[2] }), Ie = t({
312
+ display: "flex",
313
+ flexWrap: "wrap",
314
+ alignItems: "center",
315
+ gap: S.space[1],
316
+ padding: S.space[1],
317
+ border: `1px solid ${S.color.border}`,
318
+ borderRadius: S.radius.md,
319
+ backgroundColor: S.color.surface,
320
+ [r]: { borderColor: "CanvasText" }
321
+ }), G = t({
322
+ display: "block",
323
+ inlineSize: "1em",
324
+ blockSize: "1em"
325
+ }), Le = /* @__PURE__ */ w("svg", {
326
+ viewBox: "0 0 16 16",
327
+ fill: "none",
328
+ stroke: "currentColor",
329
+ strokeWidth: "1.5",
330
+ css: G,
331
+ "aria-hidden": "true",
332
+ children: [/* @__PURE__ */ C("circle", {
333
+ cx: "8",
334
+ cy: "8",
335
+ r: "6.25"
336
+ }), /* @__PURE__ */ C("path", {
337
+ d: "M5.5 9.5c.6.9 1.4 1.3 2.5 1.3s1.9-.4 2.5-1.3M6 6.25h.01M10 6.25h.01",
338
+ strokeLinecap: "round"
339
+ })]
340
+ }), Re = /* @__PURE__ */ C("svg", {
341
+ viewBox: "0 0 16 16",
342
+ fill: "none",
343
+ stroke: "currentColor",
344
+ strokeWidth: "1.5",
345
+ css: G,
346
+ "aria-hidden": "true",
347
+ children: /* @__PURE__ */ C("path", {
348
+ d: "M4 4l8 8M12 4l-8 8",
349
+ strokeLinecap: "round"
350
+ })
351
+ });
352
+ function ze({ ui: e, reactions: t, offered: n, currentUserId: r, formatters: i, labels: o, readOnly: c, disabled: u, pickerOpen: d, onPickerOpenChange: f, onToggle: p, pickerId: m, part: h }) {
353
+ let g = b(null), _ = b(!1), [ee, te] = x(0), ne = {
354
+ itemSelector: "[data-part=\"emoji\"]",
355
+ ownerSelector: `[data-ui="${z(e, "picker")}"]`
356
+ }, y = !c && n.length > 0, S = y && d;
357
+ v(() => {
358
+ !d && _.current && (_.current = !1, g.current?.focus());
359
+ }, [d]);
360
+ let ie = () => {
361
+ _.current = !0, f(!1);
362
+ };
363
+ return t.length === 0 && !y ? null : /* @__PURE__ */ w("div", {
364
+ "data-ui": z(e, "reactions"),
365
+ className: h?.className,
366
+ css: [U, h?.css],
367
+ children: [
368
+ t.map(({ emoji: e, users: t }) => {
369
+ let n = t.includes(r), a = o.reactionCount(e, t.length, n), d = /* @__PURE__ */ w(re, { children: [/* @__PURE__ */ C("span", {
370
+ "aria-hidden": "true",
371
+ children: e
372
+ }), /* @__PURE__ */ C("span", {
373
+ "aria-hidden": "true",
374
+ children: i.number.format(t.length)
375
+ })] });
376
+ return c ? /* @__PURE__ */ w("span", {
377
+ "data-part": "reaction",
378
+ css: Pe,
379
+ children: [d, /* @__PURE__ */ C("span", {
380
+ css: s,
381
+ children: a
382
+ })]
383
+ }, e) : /* @__PURE__ */ C(l, {
384
+ variant: "outline",
385
+ size: "sm",
386
+ "data-part": "reaction",
387
+ "aria-label": a,
388
+ "aria-pressed": n,
389
+ disabled: u,
390
+ onClick: () => p(e),
391
+ css: W,
392
+ children: d
393
+ }, e);
394
+ }),
395
+ y ? /* @__PURE__ */ C(l, {
396
+ ref: g,
397
+ variant: "ghost",
398
+ size: "sm",
399
+ "aria-label": o.addReaction,
400
+ "aria-expanded": S,
401
+ "aria-controls": S ? m : void 0,
402
+ disabled: u,
403
+ "data-action": "react",
404
+ onClick: () => f(!d),
405
+ css: Fe,
406
+ children: Le
407
+ }) : null,
408
+ S ? /* @__PURE__ */ w("div", {
409
+ id: m,
410
+ role: "group",
411
+ "aria-label": o.reactions,
412
+ "data-ui": z(e, "picker"),
413
+ onKeyDown: (e) => {
414
+ e.key === "Escape" ? (e.preventDefault(), e.stopPropagation(), ie()) : a(e, e.currentTarget, "horizontal", ne);
415
+ },
416
+ css: Ie,
417
+ children: [n.map((e, t) => /* @__PURE__ */ C(l, {
418
+ variant: "ghost",
419
+ size: "sm",
420
+ "data-part": "emoji",
421
+ "aria-label": o.reactWith(e),
422
+ tabIndex: t === Math.min(ee, n.length - 1) ? 0 : -1,
423
+ autoFocus: t === 0,
424
+ disabled: u,
425
+ onFocus: () => te(t),
426
+ onClick: () => {
427
+ p(e), ie();
428
+ },
429
+ css: Fe,
430
+ children: /* @__PURE__ */ C("span", {
431
+ "aria-hidden": "true",
432
+ children: e
433
+ })
434
+ }, e)), /* @__PURE__ */ C(l, {
435
+ variant: "ghost",
436
+ size: "sm",
437
+ "aria-label": o.closeReactions,
438
+ onClick: ie,
439
+ css: Fe,
440
+ children: Re
441
+ })]
442
+ }) : null
443
+ ]
444
+ });
445
+ }
446
+ function Be(e, t) {
447
+ let n = e.slice(0, t), r = n.lastIndexOf(Ce);
448
+ if (r === -1 || r > 0 && !Te.test(n[r - 1])) return null;
449
+ let i = n.slice(r + 1);
450
+ return Te.test(i) ? null : {
451
+ start: r,
452
+ query: i
453
+ };
454
+ }
455
+ function Ve(e, t, n) {
456
+ let r = t.toLocaleLowerCase(n);
457
+ return e.filter((e) => e.name.toLocaleLowerCase(n).split(Te).some((e) => e.startsWith(r))).slice(0, we);
458
+ }
459
+ var He = {
460
+ ArrowDown: (e, t) => (e + 1) % t,
461
+ ArrowUp: (e, t) => (e - 1 + t) % t,
462
+ Home: () => 0,
463
+ End: (e, t) => t - 1
464
+ }, Ue = t({
465
+ display: "grid",
466
+ gridTemplateColumns: "auto minmax(0, 1fr)",
467
+ columnGap: "var(--thread-column-gap)",
468
+ alignItems: "start",
469
+ inlineSize: "100%",
470
+ "&[data-avatar=\"false\"]": { gridTemplateColumns: "minmax(0, 1fr)" }
471
+ }), K = t({
472
+ display: "inline-flex",
473
+ "@container (max-width: 28rem)": { display: "none" }
474
+ }), q = t({
475
+ display: "grid",
476
+ rowGap: S.space[2],
477
+ minInlineSize: 0,
478
+ "@container (max-width: 28rem)": { gridColumn: "1 / -1" }
479
+ }), We = t({
480
+ display: "flex",
481
+ flexWrap: "wrap",
482
+ justifyContent: "flex-end",
483
+ gap: S.space[2]
484
+ }), J = t({ gap: S.space[2] }), Y = {
485
+ sm: "sm",
486
+ md: "md"
487
+ }, Ge = {
488
+ sm: 2,
489
+ md: 3
490
+ }, Ke = {
491
+ sm: t({
492
+ "--thread-column-gap": S.space[2],
493
+ "--thread-avatar": S.space[6]
494
+ }),
495
+ md: t({
496
+ "--thread-column-gap": S.space[3],
497
+ "--thread-avatar": S.space[8]
498
+ })
499
+ };
500
+ function qe({ ui: e, draft: t, onDraftChange: n, onSubmit: r, onCancel: i, cancelOnEscape: a = !0, cancelable: o, label: s, placeholder: c, submitLabel: d, cancelLabel: te, mentionsLabel: y, people: S, locale: re, disabled: T, pending: ue, autoFocus: de, size: fe, author: E, textareaProps: D, submitProps: O, part: pe, kind: k }) {
501
+ let me = ne(), A = b(null), he = b(null), j = b(null), [ge, _e] = x(null), [ve, ye] = x(null), [M, be] = x({
502
+ query: "",
503
+ index: 0
504
+ }), N = ge === null ? null : Be(t, ge), P = N ? Ve(S, N.query, re) : [], F = N !== null && !T && P.length > 0 && ve !== N.start, I = N && M.query === N.query ? Math.min(M.index, P.length - 1) : 0, xe = `${me}-mentions`, Se = (e) => g(me, "person", e.id), { refs: we, floatingStyles: Te } = ce({
505
+ open: F,
506
+ placement: "bottom-start",
507
+ middleware: [
508
+ oe(L),
509
+ ae({ padding: R }),
510
+ se({ padding: R })
511
+ ],
512
+ whileElementsMounted: ie
513
+ }), De = le([
514
+ he,
515
+ we.setReference,
516
+ D?.ref
517
+ ]);
518
+ v(() => {
519
+ j.current !== null && he.current && (he.current.setSelectionRange(j.current, j.current), j.current = null);
520
+ });
521
+ let Oe = (e) => _e(e.selectionStart === e.selectionEnd ? e.selectionStart : null), ke = (e) => {
522
+ if (!N) return;
523
+ let r = `${Ce}${e.name} `, i = N.start + 1 + N.query.length, a = t.slice(0, N.start) + r + t.slice(i), o = N.start + r.length;
524
+ j.current = o, _e(o), n(a);
525
+ }, je = () => {
526
+ let e = t.trim();
527
+ T || ue || e === "" || !A.current || r(e, A.current);
528
+ }, V = (e) => {
529
+ D?.onChange?.(e), n(e.currentTarget.value), Oe(e.currentTarget);
530
+ }, Me = (e) => {
531
+ D?.onSelect?.(e), Oe(e.currentTarget);
532
+ }, H = (e) => {
533
+ D?.onBlur?.(e), N && ye(N.start);
534
+ }, Ne = (e) => {
535
+ if (D?.onKeyDown?.(e), e.defaultPrevented || Ee(e)) return;
536
+ let t = !e.altKey && !e.ctrlKey && !e.metaKey && !e.shiftKey;
537
+ if (F && N) {
538
+ let n = t ? He[e.key] : void 0;
539
+ if (n) {
540
+ e.preventDefault(), be({
541
+ query: N.query,
542
+ index: n(I, P.length)
543
+ });
544
+ return;
545
+ }
546
+ if (t && (e.key === "Enter" || e.key === "Tab")) {
547
+ e.preventDefault(), ke(P[I]);
548
+ return;
549
+ }
550
+ if (e.key === "Escape") {
551
+ e.preventDefault(), e.stopPropagation(), ye(N.start);
552
+ return;
553
+ }
554
+ }
555
+ e.key === "Enter" && (e.ctrlKey || e.metaKey) && !e.altKey && !e.shiftKey ? (e.preventDefault(), je()) : e.key === "Escape" && a && i && A.current && (e.preventDefault(), e.stopPropagation(), i(A.current));
556
+ }, U = t.trim() === "", W = E !== void 0;
557
+ return /* @__PURE__ */ w("div", {
558
+ ref: A,
559
+ "data-ui": z(e, "composer"),
560
+ "data-composer": k,
561
+ "data-avatar": W,
562
+ className: pe?.className,
563
+ css: [Ue, pe?.css],
564
+ children: [
565
+ W ? /* @__PURE__ */ C("span", {
566
+ "aria-hidden": "true",
567
+ css: K,
568
+ children: /* @__PURE__ */ C(u, {
569
+ name: E.name,
570
+ src: E.avatar,
571
+ size: B[fe]
572
+ })
573
+ }) : null,
574
+ /* @__PURE__ */ w("div", {
575
+ css: q,
576
+ children: [/* @__PURE__ */ C(ee, {
577
+ "aria-label": s,
578
+ placeholder: c,
579
+ size: Y[fe],
580
+ rows: Ge[fe],
581
+ autoResize: !0,
582
+ autoFocus: de,
583
+ ...D,
584
+ ref: De,
585
+ value: t,
586
+ disabled: T || D?.disabled,
587
+ "aria-autocomplete": "list",
588
+ "aria-controls": F ? xe : D?.["aria-controls"],
589
+ "aria-activedescendant": F ? Se(P[I]) : void 0,
590
+ onChange: V,
591
+ onSelect: Me,
592
+ onBlur: H,
593
+ onKeyDown: Ne
594
+ }), /* @__PURE__ */ w("div", {
595
+ css: We,
596
+ children: [o ? /* @__PURE__ */ C(l, {
597
+ variant: "ghost",
598
+ size: "sm",
599
+ disabled: T,
600
+ onClick: () => A.current && i?.(A.current),
601
+ children: te
602
+ }) : null, /* @__PURE__ */ C(l, {
603
+ variant: "solid",
604
+ tone: "accent",
605
+ size: "sm",
606
+ ...O,
607
+ disabled: T || O?.disabled,
608
+ "aria-disabled": U ? !0 : O?.["aria-disabled"],
609
+ loading: ue,
610
+ "data-action": "submit",
611
+ onClick: (e) => {
612
+ O?.onClick?.(e), e.defaultPrevented || je();
613
+ },
614
+ children: d
615
+ })]
616
+ })]
617
+ }),
618
+ F ? /* @__PURE__ */ C(_, { children: /* @__PURE__ */ C("div", {
619
+ ref: we.setFloating,
620
+ id: xe,
621
+ role: "listbox",
622
+ "aria-label": y,
623
+ "data-ui": z(e, "mentions"),
624
+ style: Te,
625
+ css: [m, p],
626
+ children: P.map((t, n) => /* @__PURE__ */ w("div", {
627
+ id: Se(t),
628
+ role: "option",
629
+ "aria-selected": n === I,
630
+ "data-active": n === I ? "" : void 0,
631
+ "data-ui": z(e, "mention"),
632
+ onMouseDown: (e) => e.preventDefault(),
633
+ onClick: () => ke(t),
634
+ css: [
635
+ f,
636
+ h,
637
+ J
638
+ ],
639
+ children: [/* @__PURE__ */ C("span", {
640
+ "aria-hidden": "true",
641
+ css: Ae,
642
+ children: /* @__PURE__ */ C(u, {
643
+ name: t.name,
644
+ src: t.avatar,
645
+ size: "sm"
646
+ })
647
+ }), t.name]
648
+ }, t.id))
649
+ }) }) : null
650
+ ]
651
+ });
652
+ }
653
+ //#endregion
654
+ //#region src/components/comment-thread/comment-thread.tsx
655
+ var X = "comment-thread", Z = "root", Je = [
656
+ "👍",
657
+ "❤️",
658
+ "🎉",
659
+ "👀",
660
+ "🚀",
661
+ "✅"
662
+ ], Ye = 2, Xe = 3, Ze = [], Qe = [], $e = {
663
+ replyTo: null,
664
+ editing: null,
665
+ confirming: null,
666
+ picker: null,
667
+ drafts: {},
668
+ pending: {}
669
+ }, et = "@container (max-width: 28rem)", Q = (e) => `reply:${e}`, $ = (e) => `edit:${e}`, tt = () => crypto.randomUUID(), nt = (e) => JSON.stringify([...new Set(e)].sort());
670
+ function rt(e, t) {
671
+ if (!(t in e)) return e;
672
+ let { [t]: n, ...r } = e;
673
+ return r;
674
+ }
675
+ function it(e, t) {
676
+ return {
677
+ ...e,
678
+ drafts: rt(e.drafts, t),
679
+ pending: rt(e.pending, t),
680
+ replyTo: e.replyTo !== null && t === Q(e.replyTo) ? null : e.replyTo,
681
+ editing: e.editing !== null && t === $(e.editing) ? null : e.editing
682
+ };
683
+ }
684
+ function at(e, t) {
685
+ let n = e;
686
+ for (let [r, i] of Object.entries(e.pending)) {
687
+ let e = t.entries.get(i.id);
688
+ (i.kind === "add" ? e !== void 0 : !e || e.comment.deleted || e.comment.body === i.body) && (n = it(n, r));
689
+ }
690
+ let r = (e) => e === null || ot(t, e);
691
+ return r(n.replyTo) || (n = it(n, Q(n.replyTo))), r(n.editing) || (n = it(n, $(n.editing))), r(n.confirming) || (n = {
692
+ ...n,
693
+ confirming: null
694
+ }), r(n.picker) || (n = {
695
+ ...n,
696
+ picker: null
697
+ }), n;
698
+ }
699
+ function ot(e, t) {
700
+ let n = e.entries.get(t);
701
+ return n !== void 0 && !n.comment.deleted;
702
+ }
703
+ function st(e) {
704
+ return e.order.filter((t) => (e.entries.get(t).comment.replies?.length ?? 0) > 0);
705
+ }
706
+ function ct(e) {
707
+ let t = (t, n, r) => ve(e, t, n, r);
708
+ return {
709
+ thread: "Comments",
710
+ composer: "Add a comment",
711
+ placeholder: "Write a comment",
712
+ resolve: "Resolve",
713
+ resolved: "Resolved",
714
+ reopen: "Reopen",
715
+ empty: "No comments yet",
716
+ reply: "Reply",
717
+ edit: "Edit",
718
+ delete: "Delete",
719
+ cancel: "Cancel",
720
+ send: "Send",
721
+ save: "Save",
722
+ edited: "Edited",
723
+ editComment: "Edit comment",
724
+ deleteConfirm: "Delete this comment?",
725
+ deletedText: "This comment was deleted.",
726
+ deletedComment: "Deleted comment",
727
+ hideReplies: "Hide replies",
728
+ cancelReply: "Cancel",
729
+ addReaction: "Add reaction",
730
+ closeReactions: "Close reactions",
731
+ reactions: "Reactions",
732
+ mentions: "People",
733
+ invalidTime: "Unknown time",
734
+ replyingTo: (e) => `Reply to ${e}`,
735
+ showReplies: (e) => `Show ${t(e, "reply", "replies")}`,
736
+ commentCount: (e) => t(e, "comment", "comments"),
737
+ peopleCount: (e) => t(e, "person", "people"),
738
+ newComments: (e) => t(e, "new comment", "new comments"),
739
+ reactWith: (e) => `React with ${e}`,
740
+ reactionCount: (e, n, r) => r ? `${e} ${t(n, "reaction", "reactions")}, including you` : `${e} ${t(n, "reaction", "reactions")}`
741
+ };
742
+ }
743
+ var lt = e({
744
+ from: { opacity: 0 },
745
+ to: { opacity: 1 }
746
+ }), ut = t({
747
+ minInlineSize: 0,
748
+ containerType: "inline-size",
749
+ fontFamily: S.font.sans,
750
+ fontSize: S.textSize.sm,
751
+ lineHeight: S.lineHeight.base,
752
+ color: S.color.text
753
+ }), dt = {
754
+ sm: t({
755
+ "--comment-thread-gap": S.space[3],
756
+ "--comment-thread-indent": S.space[4]
757
+ }),
758
+ md: t({
759
+ "--comment-thread-gap": S.space[4],
760
+ "--comment-thread-indent": S.space[6]
761
+ })
762
+ }, ft = t({
763
+ display: "flex",
764
+ flexWrap: "wrap",
765
+ alignItems: "center",
766
+ justifyContent: "space-between",
767
+ gap: S.space[2]
768
+ }), pt = t({
769
+ display: "grid",
770
+ gap: S.space[1],
771
+ minInlineSize: 0
772
+ }), mt = t({ overflowWrap: "anywhere" }), ht = t({
773
+ margin: 0,
774
+ fontSize: S.textSize.xs,
775
+ color: S.color.textMuted
776
+ }), gt = t({ "&[hidden]": { display: "none" } }), _t = t({
777
+ display: "grid",
778
+ rowGap: "var(--comment-thread-gap)",
779
+ listStyle: "none",
780
+ margin: 0,
781
+ padding: 0
782
+ }), vt = t({
783
+ display: "grid",
784
+ rowGap: S.space[2],
785
+ minInlineSize: 0,
786
+ "&[data-new]": {
787
+ animationName: lt,
788
+ animationDuration: S.motion.duration.base,
789
+ animationTimingFunction: S.motion.easeStandard
790
+ },
791
+ [i]: { "&[data-new]": { animation: "none" } }
792
+ }), yt = t({
793
+ margin: 0,
794
+ whiteSpace: "pre-wrap",
795
+ overflowWrap: "anywhere",
796
+ lineHeight: S.lineHeight.relaxed,
797
+ color: S.color.text,
798
+ "&[data-deleted]": {
799
+ color: S.color.textMuted,
800
+ fontStyle: "italic"
801
+ }
802
+ }), bt = t({
803
+ display: "flex",
804
+ flexWrap: "wrap",
805
+ alignItems: "center",
806
+ gap: S.space[1]
807
+ }), xt = t({
808
+ display: "flex",
809
+ flexWrap: "wrap",
810
+ alignItems: "center",
811
+ gap: S.space[2],
812
+ paddingBlock: S.space[2],
813
+ paddingInline: S.space[3],
814
+ border: `1px solid ${S.color.dangerBorder}`,
815
+ borderRadius: S.radius.md,
816
+ [r]: { borderColor: "CanvasText" }
817
+ }), St = t({
818
+ flex: "1 1 auto",
819
+ fontWeight: S.fontWeight.medium
820
+ }), Ct = t({
821
+ marginInlineStart: "calc(var(--thread-avatar) + var(--thread-column-gap))",
822
+ [et]: { marginInlineStart: 0 }
823
+ }), wt = t({ justifySelf: "start" }), Tt = t({
824
+ display: "grid",
825
+ rowGap: "var(--comment-thread-gap)",
826
+ listStyle: "none",
827
+ margin: 0,
828
+ marginInlineStart: "calc(var(--thread-avatar) / 2 - 1px)",
829
+ padding: 0,
830
+ paddingInlineStart: "var(--comment-thread-indent)",
831
+ borderInlineStart: `2px solid ${S.color.border}`,
832
+ "&[hidden]": { display: "none" },
833
+ "&[data-capped]": {
834
+ marginInlineStart: 0,
835
+ paddingInlineStart: 0,
836
+ borderInlineStart: 0
837
+ },
838
+ [et]: { paddingInlineStart: S.space[3] },
839
+ [r]: { borderInlineStartColor: "GrayText" }
840
+ }), Et = t({
841
+ margin: 0,
842
+ paddingBlock: S.space[4],
843
+ color: S.color.textMuted
844
+ }), Dt = t({
845
+ display: "flex",
846
+ flexWrap: "wrap",
847
+ alignItems: "center",
848
+ gap: S.space[3]
849
+ }), Ot = t({
850
+ flex: "1 1 12rem",
851
+ display: "flex",
852
+ flexWrap: "wrap",
853
+ alignItems: "center",
854
+ gap: S.space[2],
855
+ margin: 0,
856
+ color: S.color.textMuted,
857
+ overflowWrap: "anywhere"
858
+ }), kt = t({
859
+ display: "inline-flex",
860
+ alignItems: "center",
861
+ gap: S.space[1],
862
+ minBlockSize: S.space[6],
863
+ paddingInline: S.space[2],
864
+ border: `1px solid ${S.color.borderStrong}`,
865
+ borderRadius: S.radius.full,
866
+ fontWeight: S.fontWeight.medium,
867
+ color: S.color.text,
868
+ [r]: { borderColor: "CanvasText" }
869
+ }), At = t({
870
+ display: "block",
871
+ inlineSize: "1em",
872
+ blockSize: "1em"
873
+ }), jt = /* @__PURE__ */ C("svg", {
874
+ viewBox: "0 0 16 16",
875
+ fill: "none",
876
+ stroke: "currentColor",
877
+ strokeWidth: "2",
878
+ css: At,
879
+ "aria-hidden": "true",
880
+ children: /* @__PURE__ */ C("path", {
881
+ d: "M3 8.5l3 3 7-7",
882
+ strokeLinecap: "round"
883
+ })
884
+ });
885
+ function Mt({ ref: e, value: t, defaultValue: r, onValueChange: i, currentUser: a, people: u, resolvedValue: f, defaultResolvedValue: p, onResolvedValueChange: m, expandedValue: h, defaultExpandedValue: _, onExpandedValueChange: ee, title: S, headingLevel: ie = 3, reactions: ae = Je, maxDepth: oe = Ye, now: se, locale: ce, timeZone: T = "UTC", getNewId: ue = tt, placeholder: de, composerLabel: fe, disabled: E = !1, readOnly: D = !1, size: O = "md", labels: pe, slotProps: k, className: me, sx: j, onFocus: ge, onBlur: ve, "aria-label": M, "aria-labelledby": I, "aria-describedby": Ce, ...we }) {
886
+ let L = ne(), R = b(null), Te = le([e, R]), { formatters: z, problems: Ee } = y(() => _e("CommentThread", ce, T), [ce, T]), B = {
887
+ ...ct(z),
888
+ ...pe
889
+ }, De = A(se) ? se : null, Oe = Number.isInteger(oe) && oe >= 0, ke = Oe ? oe : Ye, Ae = y(() => Se(ae, (e) => e), [ae]), je = b(null), [V = Ze, Me] = o(t, r ?? Ze, (e) => i?.([...e], je.current)), H = y(() => ye(V), [V]), U = (e, t) => {
890
+ e !== V && (je.current = t, Me(e));
891
+ }, [W = !1, Pe] = o(f, p ?? !1, m), Fe = b(null);
892
+ v(() => {
893
+ Fe.current = null;
894
+ }, [W]);
895
+ let [Ie] = x(() => _ ?? st(H)), [G = Qe, Le] = o(h, Ie, (e) => ee?.([...e])), Re = new Set(G), Be = nt(G), Ve = b(null);
896
+ v(() => {
897
+ Ve.current = null;
898
+ }, [Be]);
899
+ let He = (e) => {
900
+ let t = nt(e);
901
+ t !== Be && t !== Ve.current && (Ve.current = t, Le(e));
902
+ }, [Ue, K] = x($e), q = at(Ue, H);
903
+ q !== Ue && K(q);
904
+ let We = y(() => Se(u ?? [...H.order.map((e) => H.entries.get(e).comment.author), a], (e) => e.id), [
905
+ u,
906
+ H,
907
+ a
908
+ ]), J = b(null), Y = b(null), Ge = b(H.order), et = b(null), lt = b(/* @__PURE__ */ new Set()), [At, Mt] = x({
909
+ text: "",
910
+ key: 0
911
+ }), Nt = y(() => {
912
+ let e = et.current;
913
+ return new Set(e ? H.order.filter((t) => !e.has(t)) : []);
914
+ }, [H]), Pt = (e) => R.current?.querySelector(`[data-ui="${X}-item"][data-comment-id="${CSS.escape(e)}"]`), Ft = (e, t) => Pt(e)?.querySelector(`:scope > article [data-action="${t}"]`), It = (e) => {
915
+ let t = Pt(e);
916
+ return [
917
+ ":scope > article [data-action=\"reply\"]:not(:disabled)",
918
+ ":scope > article [data-action]:not(:disabled)",
919
+ ":scope > [data-part=\"toggle\"]"
920
+ ].map((e) => t?.querySelector(e)).find(Boolean);
921
+ }, Lt = () => R.current?.querySelector(`[data-composer="${Z}"] textarea:not(:disabled)`), Rt = (e) => {
922
+ let t = Ge.current, n = e === null ? -1 : t.indexOf(e), r = e === null ? null : It(e);
923
+ if (r) r.focus();
924
+ else {
925
+ for (let e = 1; n !== -1 && e < t.length; e++) {
926
+ let r = [t[n + e], t[n - e]].filter((e) => e !== void 0).map(It).find(Boolean);
927
+ if (r) {
928
+ r.focus();
929
+ return;
930
+ }
931
+ }
932
+ Lt()?.focus();
933
+ }
934
+ };
935
+ v(() => {
936
+ let e = R.current;
937
+ if (!e) return;
938
+ let t = e.ownerDocument, n = t.activeElement, r = !n || n === t.body, i = J.current;
939
+ if (i && !i.invoker.isConnected) {
940
+ if (J.current = null, r) {
941
+ let e = i.target();
942
+ e ? e.focus() : Rt(i.commentId);
943
+ }
944
+ } else if (r && Y.current && !Y.current.element.isConnected) {
945
+ let { commentId: e } = Y.current;
946
+ Y.current = null, Rt(e);
947
+ }
948
+ let a = Y.current?.element;
949
+ if (a?.isConnected && (r || n === a)) {
950
+ let t = `[data-ui="${X}-replies"][hidden]`, n = null;
951
+ for (let e = a.closest(t); e; e = e.parentElement.closest(t)) n = e;
952
+ let r = n ? e.querySelector(`[aria-controls="${CSS.escape(n.id)}"]`) : null, i = a.closest(`[data-ui="${X}-content"][hidden]`) ? e.querySelector("[data-action=\"reopen\"]") : null;
953
+ (r ?? i)?.focus();
954
+ }
955
+ Ge.current = H.order;
956
+ }), v(() => {
957
+ let e = et.current;
958
+ if (et.current = new Set(H.order), !e) return;
959
+ let t = H.order.filter((t) => !e.has(t) && !lt.current.has(t));
960
+ t.length > 0 && Mt((e) => ({
961
+ text: B.newComments(t.length),
962
+ key: e.key + 1
963
+ }));
964
+ }, [H]);
965
+ let zt = [
966
+ ...Ee,
967
+ ...De === null ? [`CommentThread: now ${String(se)} is not a finite epoch-ms value; showing full dates.`] : [],
968
+ ...Oe ? [] : [`CommentThread: maxDepth ${String(oe)} is not a nonnegative integer; using ${Ye}.`],
969
+ ...H.duplicates.length > 0 ? [`CommentThread: duplicate comment ids ${JSON.stringify(H.duplicates)}; showing the first of each.`] : [],
970
+ ...H.cyclic ? ["CommentThread: a comment appears among its own replies; the repeat is not shown."] : []
971
+ ].join("\n");
972
+ te(() => {
973
+ process.env.NODE_ENV !== "production" && zt !== "" && console.error(zt);
974
+ }, [zt]);
975
+ let Bt = (e) => {
976
+ ge?.(e);
977
+ let t = e.target.closest(`[data-ui="${X}-item"]`);
978
+ Y.current = {
979
+ element: e.target,
980
+ commentId: t?.dataset.commentId ?? null
981
+ }, J.current && !J.current.invoker.contains(e.target) && (J.current = null);
982
+ }, Vt = (e) => {
983
+ ve?.(e);
984
+ let { target: t } = e;
985
+ queueMicrotask(() => {
986
+ t.isConnected && Y.current?.element === t && (Y.current = null, J.current = null);
987
+ });
988
+ }, Ht = (e, t) => K((n) => ({
989
+ ...n,
990
+ drafts: {
991
+ ...n.drafts,
992
+ [e]: t
993
+ },
994
+ pending: rt(n.pending, e)
995
+ })), Ut = (e, t, n, r) => {
996
+ if (E || D || q.pending[e] || t !== null && !ot(H, t)) return;
997
+ let i = be(H, t, ke);
998
+ if (i === void 0) return;
999
+ let o = {
1000
+ id: ue(),
1001
+ author: a,
1002
+ body: n,
1003
+ createdAt: De ?? Date.now(),
1004
+ reactions: []
1005
+ };
1006
+ lt.current.add(o.id), K((t) => ({
1007
+ ...t,
1008
+ pending: {
1009
+ ...t.pending,
1010
+ [e]: {
1011
+ kind: "add",
1012
+ id: o.id
1013
+ }
1014
+ }
1015
+ })), t !== null && (J.current = {
1016
+ invoker: r,
1017
+ target: () => Ft(t, "reply"),
1018
+ commentId: t
1019
+ }), U(N(V, i, o), {
1020
+ type: "reply",
1021
+ comment: o,
1022
+ parentId: i
1023
+ }), i !== null && !Re.has(i) && He([...G, i]);
1024
+ }, Wt = () => K((e) => e.pending[Z] ? {
1025
+ ...e,
1026
+ pending: rt(e.pending, Z)
1027
+ } : it(e, Z)), Gt = (e) => K((t) => ({
1028
+ ...t,
1029
+ replyTo: e,
1030
+ confirming: null,
1031
+ picker: null
1032
+ })), Kt = (e, t) => {
1033
+ J.current = {
1034
+ invoker: t,
1035
+ target: () => Ft(e, "reply"),
1036
+ commentId: e
1037
+ }, K((t) => it(t, Q(e)));
1038
+ }, qt = (e) => K((t) => ({
1039
+ ...t,
1040
+ editing: e.id,
1041
+ confirming: null,
1042
+ picker: null,
1043
+ drafts: {
1044
+ ...t.drafts,
1045
+ [$(e.id)]: e.body
1046
+ }
1047
+ })), Jt = (e, t) => {
1048
+ J.current = {
1049
+ invoker: t,
1050
+ target: () => Ft(e, "edit"),
1051
+ commentId: e
1052
+ }, K((t) => it(t, $(e)));
1053
+ }, Yt = (e, t, n) => {
1054
+ let r = $(e.id);
1055
+ E || D || q.pending[r] || !ot(H, e.id) || (t === e.body ? Jt(e.id, n) : (J.current = {
1056
+ invoker: n,
1057
+ target: () => Ft(e.id, "edit"),
1058
+ commentId: e.id
1059
+ }, K((n) => ({
1060
+ ...n,
1061
+ pending: {
1062
+ ...n.pending,
1063
+ [r]: {
1064
+ kind: "edit",
1065
+ id: e.id,
1066
+ body: t
1067
+ }
1068
+ }
1069
+ })), U(P(V, e.id, t), {
1070
+ type: "edit",
1071
+ id: e.id,
1072
+ body: t
1073
+ })));
1074
+ }, Xt = (e, t) => {
1075
+ J.current = {
1076
+ invoker: t,
1077
+ target: () => Ft(e, "delete"),
1078
+ commentId: e
1079
+ }, K((e) => ({
1080
+ ...e,
1081
+ confirming: null
1082
+ }));
1083
+ }, Zt = (e, t) => {
1084
+ Xt(e, t), !(E || D) && U(F(V, e), {
1085
+ type: "delete",
1086
+ id: e
1087
+ });
1088
+ }, Qt = (e, t) => {
1089
+ if (E || D) return;
1090
+ let { comments: n, added: r } = xe(V, e, t, a.id);
1091
+ U(n, {
1092
+ type: "react",
1093
+ id: e,
1094
+ emoji: t,
1095
+ added: r
1096
+ });
1097
+ }, $t = (e, t) => {
1098
+ if (E || D || e === Fe.current) return;
1099
+ Fe.current = e;
1100
+ let n = e ? "reopen" : "resolve";
1101
+ J.current = {
1102
+ invoker: t.currentTarget,
1103
+ target: () => R.current?.querySelector(`[data-action="${n}"]`),
1104
+ commentId: null
1105
+ }, Pe(e);
1106
+ }, en = (e) => He(Re.has(e) ? G.filter((t) => t !== e) : [...G, e]), tn = H.order.filter((e) => ot(H, e)), nn = Se(tn.map((e) => H.entries.get(e).comment.author), (e) => e.id), rn = B.commentCount(tn.length), an = tn.length > 0 ? z.facts.format([rn, B.peopleCount(nn.length)]) : rn, on = H.order.length === 0, sn = `${L}-empty`, cn = `${L}-title`, ln = c(S) && S !== "", un = [I, ln ? cn : void 0].filter(Boolean).join(" ") || void 0, dn = [Ce, on ? sn : void 0].filter(Boolean).join(" ") || void 0, fn = {
1107
+ ui: X,
1108
+ mentionsLabel: B.mentions,
1109
+ people: We,
1110
+ locale: ce,
1111
+ disabled: E,
1112
+ size: O,
1113
+ textareaProps: k?.textarea,
1114
+ submitProps: k?.send
1115
+ }, pn = (e, t, n) => {
1116
+ if (n.has(e) || H.entries.get(e.id)?.comment !== e) return null;
1117
+ let { id: r } = e, i = e.deleted === !0, o = e.author.id === a.id, s = q.editing === r && !i, c = q.confirming === r && !i, u = e.replies ?? Ze, d = g(L, "replies", r), f = Re.has(r), p = new Set(n).add(e), m = g(L, "confirm", r), h = (e) => {
1118
+ e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), Xt(r, e.currentTarget));
1119
+ };
1120
+ return /* @__PURE__ */ w("li", {
1121
+ "data-ui": `${X}-item`,
1122
+ "data-comment-id": r,
1123
+ "data-depth": t,
1124
+ "data-deleted": i ? "" : void 0,
1125
+ "data-new": Nt.has(r) ? "" : void 0,
1126
+ className: k?.item?.className,
1127
+ css: [vt, k?.item?.css],
1128
+ children: [
1129
+ /* @__PURE__ */ w(Ne, {
1130
+ ui: X,
1131
+ author: e.author,
1132
+ label: i ? B.deletedComment : void 0,
1133
+ epoch: he(e.createdAt),
1134
+ now: De,
1135
+ formatters: z,
1136
+ invalidTimeLabel: B.invalidTime,
1137
+ meta: e.edited && !i ? B.edited : null,
1138
+ size: O,
1139
+ baseId: L,
1140
+ messageId: r,
1141
+ slots: {
1142
+ article: k?.article,
1143
+ time: k?.time
1144
+ },
1145
+ children: [
1146
+ s ? /* @__PURE__ */ C(qe, {
1147
+ ...fn,
1148
+ kind: "edit",
1149
+ draft: q.drafts[$(r)] ?? e.body,
1150
+ onDraftChange: (e) => Ht($(r), e),
1151
+ onSubmit: (t, n) => Yt(e, t, n),
1152
+ onCancel: (e) => Jt(r, e),
1153
+ cancelable: !0,
1154
+ label: B.editComment,
1155
+ submitLabel: B.save,
1156
+ cancelLabel: B.cancel,
1157
+ pending: q.pending[$(r)] !== void 0,
1158
+ autoFocus: !0,
1159
+ part: k?.composer
1160
+ }) : /* @__PURE__ */ C("p", {
1161
+ "data-ui": `${X}-body`,
1162
+ "data-deleted": i ? "" : void 0,
1163
+ className: k?.body?.className,
1164
+ css: [yt, k?.body?.css],
1165
+ children: i ? B.deletedText : e.body
1166
+ }),
1167
+ i || s ? null : /* @__PURE__ */ C(ze, {
1168
+ ui: X,
1169
+ reactions: e.reactions ?? [],
1170
+ offered: Ae,
1171
+ currentUserId: a.id,
1172
+ formatters: z,
1173
+ labels: B,
1174
+ readOnly: D,
1175
+ disabled: E,
1176
+ pickerOpen: q.picker === r,
1177
+ onPickerOpenChange: (e) => K((t) => ({
1178
+ ...t,
1179
+ picker: e ? r : null,
1180
+ confirming: null
1181
+ })),
1182
+ onToggle: (e) => Qt(r, e),
1183
+ pickerId: g(L, "picker", r),
1184
+ part: k?.reaction
1185
+ }),
1186
+ i || s || D ? null : c ? /* @__PURE__ */ w("div", {
1187
+ role: "group",
1188
+ "aria-labelledby": m,
1189
+ "data-ui": `${X}-confirm`,
1190
+ onKeyDown: h,
1191
+ css: xt,
1192
+ children: [
1193
+ /* @__PURE__ */ C("span", {
1194
+ id: m,
1195
+ css: St,
1196
+ children: B.deleteConfirm
1197
+ }),
1198
+ /* @__PURE__ */ C(l, {
1199
+ variant: "ghost",
1200
+ size: "sm",
1201
+ autoFocus: !0,
1202
+ onClick: (e) => Xt(r, e.currentTarget.parentElement),
1203
+ children: B.cancel
1204
+ }),
1205
+ /* @__PURE__ */ C(l, {
1206
+ variant: "solid",
1207
+ tone: "danger",
1208
+ size: "sm",
1209
+ disabled: E,
1210
+ onClick: (e) => Zt(r, e.currentTarget.parentElement),
1211
+ children: B.delete
1212
+ })
1213
+ ]
1214
+ }, "confirm") : /* @__PURE__ */ w("div", {
1215
+ "data-ui": `${X}-actions`,
1216
+ className: k?.actions?.className,
1217
+ css: [bt, k?.actions?.css],
1218
+ children: [/* @__PURE__ */ C(l, {
1219
+ variant: "ghost",
1220
+ size: "sm",
1221
+ "data-action": "reply",
1222
+ "aria-expanded": q.replyTo === r,
1223
+ disabled: E,
1224
+ onClick: () => Gt(r),
1225
+ children: B.reply
1226
+ }), o ? /* @__PURE__ */ w(re, { children: [/* @__PURE__ */ C(l, {
1227
+ variant: "ghost",
1228
+ size: "sm",
1229
+ "data-action": "edit",
1230
+ disabled: E,
1231
+ onClick: () => qt(e),
1232
+ children: B.edit
1233
+ }), /* @__PURE__ */ C(l, {
1234
+ variant: "ghost",
1235
+ size: "sm",
1236
+ tone: "danger",
1237
+ "data-action": "delete",
1238
+ disabled: E,
1239
+ onClick: () => K((e) => ({
1240
+ ...e,
1241
+ confirming: r,
1242
+ picker: null
1243
+ })),
1244
+ children: B.delete
1245
+ })] }) : null]
1246
+ }, "actions")
1247
+ ]
1248
+ }),
1249
+ q.replyTo === r && !i && !D ? /* @__PURE__ */ C("div", {
1250
+ css: Ct,
1251
+ children: /* @__PURE__ */ C(qe, {
1252
+ ...fn,
1253
+ kind: "reply",
1254
+ draft: q.drafts[Q(r)] ?? "",
1255
+ onDraftChange: (e) => Ht(Q(r), e),
1256
+ onSubmit: (e, t) => Ut(Q(r), r, e, t),
1257
+ onCancel: (e) => Kt(r, e),
1258
+ cancelable: !0,
1259
+ label: B.replyingTo(e.author.name),
1260
+ placeholder: de ?? B.placeholder,
1261
+ submitLabel: B.send,
1262
+ cancelLabel: B.cancelReply,
1263
+ pending: q.pending[Q(r)] !== void 0,
1264
+ autoFocus: !0,
1265
+ part: k?.composer
1266
+ })
1267
+ }) : null,
1268
+ u.length > 0 ? /* @__PURE__ */ w(re, { children: [/* @__PURE__ */ C(l, {
1269
+ variant: "ghost",
1270
+ size: "sm",
1271
+ "data-part": "toggle",
1272
+ "aria-expanded": f,
1273
+ "aria-controls": d,
1274
+ onClick: () => en(r),
1275
+ css: [wt, Ct],
1276
+ children: f ? B.hideReplies : B.showReplies(u.length)
1277
+ }), /* @__PURE__ */ C("ul", {
1278
+ role: "list",
1279
+ id: d,
1280
+ hidden: !f,
1281
+ "data-ui": `${X}-replies`,
1282
+ "data-capped": t + 1 > Xe ? "" : void 0,
1283
+ className: k?.replies?.className,
1284
+ css: [Tt, k?.replies?.css],
1285
+ children: u.map((e) => pn(e, t + 1, p))
1286
+ })] }) : null
1287
+ ]
1288
+ }, r);
1289
+ };
1290
+ return /* @__PURE__ */ C(n, {
1291
+ className: me,
1292
+ styles: [
1293
+ ut,
1294
+ Ke[O],
1295
+ dt[O]
1296
+ ],
1297
+ sx: j,
1298
+ children: (e) => /* @__PURE__ */ w("section", {
1299
+ ...we,
1300
+ ref: Te,
1301
+ "aria-label": M ?? (un ? void 0 : B.thread),
1302
+ "aria-labelledby": un,
1303
+ "aria-describedby": dn,
1304
+ "data-ui": X,
1305
+ "data-size": O,
1306
+ "data-state": W ? "resolved" : "open",
1307
+ onFocus: Bt,
1308
+ onBlur: Vt,
1309
+ className: e,
1310
+ children: [/* @__PURE__ */ w(d, { children: [
1311
+ /* @__PURE__ */ w(d.Header, {
1312
+ className: k?.header?.className,
1313
+ css: [ft, k?.header?.css],
1314
+ children: [/* @__PURE__ */ w("div", {
1315
+ css: pt,
1316
+ children: [ln ? /* @__PURE__ */ C(d.Title, {
1317
+ id: cn,
1318
+ level: ie,
1319
+ className: k?.title?.className,
1320
+ css: [mt, k?.title?.css],
1321
+ children: S
1322
+ }) : null, /* @__PURE__ */ C("p", {
1323
+ "data-ui": `${X}-count`,
1324
+ css: ht,
1325
+ children: an
1326
+ })]
1327
+ }), !W && !D ? /* @__PURE__ */ C(l, {
1328
+ variant: "outline",
1329
+ size: "sm",
1330
+ "data-action": "resolve",
1331
+ disabled: E,
1332
+ startIcon: jt,
1333
+ onClick: (e) => $t(!0, e),
1334
+ children: B.resolve
1335
+ }) : null]
1336
+ }),
1337
+ /* @__PURE__ */ w(d.Content, { children: [/* @__PURE__ */ C("div", {
1338
+ "data-ui": `${X}-content`,
1339
+ hidden: W,
1340
+ css: gt,
1341
+ children: on ? /* @__PURE__ */ C("p", {
1342
+ id: sn,
1343
+ "data-ui": `${X}-empty`,
1344
+ css: Et,
1345
+ children: B.empty
1346
+ }) : /* @__PURE__ */ C("ul", {
1347
+ role: "list",
1348
+ "data-ui": `${X}-list`,
1349
+ className: k?.list?.className,
1350
+ css: [_t, k?.list?.css],
1351
+ children: V.map((e) => pn(e, 0, /* @__PURE__ */ new Set()))
1352
+ })
1353
+ }), W ? /* @__PURE__ */ w("div", {
1354
+ "data-ui": `${X}-resolved`,
1355
+ className: k?.resolved?.className,
1356
+ css: [Dt, k?.resolved?.css],
1357
+ children: [/* @__PURE__ */ w("p", {
1358
+ css: Ot,
1359
+ children: [
1360
+ /* @__PURE__ */ w("span", {
1361
+ css: kt,
1362
+ children: [jt, B.resolved]
1363
+ }),
1364
+ /* @__PURE__ */ C("span", { children: rn }),
1365
+ nn.length > 0 ? /* @__PURE__ */ C("span", { children: z.people.format(nn.map((e) => e.name)) }) : null
1366
+ ]
1367
+ }), D ? null : /* @__PURE__ */ C(l, {
1368
+ variant: "outline",
1369
+ size: "sm",
1370
+ "data-action": "reopen",
1371
+ disabled: E,
1372
+ onClick: (e) => $t(!1, e),
1373
+ children: B.reopen
1374
+ })]
1375
+ }) : null] }),
1376
+ D ? null : /* @__PURE__ */ C(d.Footer, {
1377
+ hidden: W,
1378
+ css: gt,
1379
+ children: /* @__PURE__ */ C(qe, {
1380
+ ...fn,
1381
+ kind: Z,
1382
+ draft: q.drafts[Z] ?? "",
1383
+ onDraftChange: (e) => Ht(Z, e),
1384
+ onSubmit: (e, t) => Ut(Z, null, e, t),
1385
+ onCancel: Wt,
1386
+ cancelOnEscape: !1,
1387
+ cancelable: (q.drafts[Z] ?? "") !== "" || q.pending[Z] !== void 0,
1388
+ label: fe ?? B.composer,
1389
+ placeholder: de ?? B.placeholder,
1390
+ submitLabel: B.send,
1391
+ cancelLabel: B.cancel,
1392
+ pending: q.pending[Z] !== void 0,
1393
+ author: a,
1394
+ part: k?.composer
1395
+ })
1396
+ })
1397
+ ] }), /* @__PURE__ */ C("div", {
1398
+ role: "status",
1399
+ "aria-atomic": "true",
1400
+ "data-ui": `${X}-status`,
1401
+ className: k?.status?.className,
1402
+ css: [s, k?.status?.css],
1403
+ children: At.text ? /* @__PURE__ */ C("span", { children: At.text }, At.key) : null
1404
+ })]
1405
+ })
1406
+ });
1407
+ }
1408
+ Mt.displayName = "CommentThread";
1409
+ //#endregion
1410
+ export { Mt as t };