@commentkit/comment-kit 0.6.8 → 0.6.9

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 (330) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +73 -45
  3. package/dist/angular.es.js +47 -3411
  4. package/dist/comment-kit.es.js +13 -3184
  5. package/dist/demo.es.js +395 -0
  6. package/dist/headless.es.js +4 -0
  7. package/dist/preact.es.js +79 -3443
  8. package/dist/qwik.es.js +79 -3443
  9. package/dist/react.es.js +80 -28447
  10. package/dist/shared/ShadowRootContext-Bv-4aElu.js +13 -0
  11. package/dist/shared/annotation-toolbar-pX17NLmJ.js +1104 -0
  12. package/dist/shared/bridge-DRE03N9X.js +174 -0
  13. package/dist/shared/button-By0hGrJK.js +505 -0
  14. package/dist/shared/button-group-CHfMRXyA.js +93 -0
  15. package/dist/shared/clamp-CcFVX0vC.js +55 -0
  16. package/dist/shared/comment-drawing-canvas-CYu5SwRf.js +126 -0
  17. package/dist/shared/comment-image-lightbox-0VdAs2iT.js +178 -0
  18. package/dist/shared/comment-kit-core-D0kY00St.js +3083 -0
  19. package/dist/shared/comment-kit-ui-D2j2gvnm.js +16685 -0
  20. package/dist/shared/comment-screenshot-annotator-BuojwviY.js +137 -0
  21. package/dist/shared/comment-screenshot-overlay-BZX0Vcb8.js +144 -0
  22. package/dist/shared/createReactComponent-BZHeRbD0.js +45 -0
  23. package/dist/shared/dev-export-panel-BLngcr5q.js +208 -0
  24. package/dist/shared/dev-grab-pDAfH2lr.js +203 -0
  25. package/dist/{core/dom-x9svfpMk.js → shared/dom-Bhf4WFtY.js} +2 -2
  26. package/dist/shared/element-selector-CtFzgHvq.js +852 -0
  27. package/dist/shared/errors-Bu5ajEmB.js +22 -0
  28. package/dist/shared/icons-BSHCWYO1.js +267 -0
  29. package/dist/shared/local-demo-context-BohlYbHt.js +6 -0
  30. package/dist/shared/mount-ui-CVivB_eQ.js +193 -0
  31. package/dist/{angular/pusher-Vs-W-c8I.js → shared/pusher-BEl7Qn-8.js} +93 -127
  32. package/dist/{core/realtime-C3_O7gi2.js → shared/realtime-BG_t_ze7.js} +75 -72
  33. package/dist/shared/resolveAriaLabelledBy-CIKpnjNJ.js +669 -0
  34. package/dist/shared/separator-DusFNTs-.js +3915 -0
  35. package/dist/shared/shadow-root-CmYXiSRR.js +135 -0
  36. package/dist/shared/styles-D_FEJZ9G.js +2 -0
  37. package/dist/shared/useLabelableId-DGbfdMi_.js +155 -0
  38. package/dist/shared/useValueChanged-DQXLia-2.js +92 -0
  39. package/dist/{angular/limits-AEqOBweE.js → shared/validation-C7QG8j7Z.js} +2 -28
  40. package/dist/{core/websocket-manager-D1_TEuy_.js → shared/websocket-manager-BTRqNTB7.js} +90 -148
  41. package/dist/solid.es.js +63 -3427
  42. package/dist/svelte.es.js +78 -3442
  43. package/dist/types/adapters/bridge.d.ts +1 -1
  44. package/dist/types/angular/index.d.ts +2 -2
  45. package/dist/types/core/comment-kit-core.d.ts +10 -1
  46. package/dist/types/core/local-demo.d.ts +59 -0
  47. package/dist/types/demo.d.ts +17 -0
  48. package/dist/types/headless.d.ts +8 -0
  49. package/dist/types/index.d.ts +14 -16
  50. package/dist/vue.es.js +80 -3443
  51. package/package.json +55 -37
  52. package/dist/angular/chunk-Cyg4N8Ue.js +0 -11
  53. package/dist/angular/comment-kit-ui-D-LUFD6n.js +0 -24898
  54. package/dist/angular/dom-Cx1nMbdI.js +0 -104
  55. package/dist/angular/mount-ui-C9PJ5aK_.js +0 -72
  56. package/dist/angular/realtime-VrKV0lPI.js +0 -567
  57. package/dist/angular/shadow-root-yMOaW9pk.js +0 -93
  58. package/dist/angular/styles-CMz7-p8x.js +0 -2
  59. package/dist/angular/widget-theme-CYPYAwhR.js +0 -24
  60. package/dist/comment-kit.css +0 -2
  61. package/dist/core/chunk-t7YoJN_i.js +0 -11
  62. package/dist/core/comment-kit-ui-Ct4E18do.js +0 -24898
  63. package/dist/core/error-boundary-CN_BGsYl.js +0 -21
  64. package/dist/core/mount-ui-Bfnuuesk.js +0 -72
  65. package/dist/core/pusher-CizoY5NA.js +0 -2504
  66. package/dist/core/shadow-root-DAtdjHG2.js +0 -93
  67. package/dist/core/styles-ClRoB6ro.js +0 -2
  68. package/dist/core/widget-theme-BWDYr7VR.js +0 -24
  69. package/dist/preact/chunk-CZ0PdaaN.js +0 -11
  70. package/dist/preact/comment-kit-ui-DEzn7J_P.js +0 -24898
  71. package/dist/preact/dom-_ULpq7rg.js +0 -104
  72. package/dist/preact/error-boundary-B4-Bfy3g.js +0 -21
  73. package/dist/preact/limits-C3ZEKcL_.js +0 -71
  74. package/dist/preact/mount-ui-Dx8en--W.js +0 -72
  75. package/dist/preact/pusher-BP4kCufH.js +0 -2504
  76. package/dist/preact/realtime-COin_nJF.js +0 -567
  77. package/dist/preact/shadow-root-D-NcwruG.js +0 -93
  78. package/dist/preact/styles-D6i7be5-.js +0 -2
  79. package/dist/preact/widget-theme-B7Z2pbaA.js +0 -24
  80. package/dist/qwik/chunk-CKKKzG2Q.js +0 -11
  81. package/dist/qwik/comment-kit-ui-Dvwee2tw.js +0 -24898
  82. package/dist/qwik/dom-Dm3gzBBJ.js +0 -104
  83. package/dist/qwik/error-boundary-C4hlYQwS.js +0 -21
  84. package/dist/qwik/limits-DK35yjGY.js +0 -71
  85. package/dist/qwik/mount-ui-DSAwNk_d.js +0 -72
  86. package/dist/qwik/pusher-B1KgC4iB.js +0 -2504
  87. package/dist/qwik/realtime-DhfcBrwF.js +0 -567
  88. package/dist/qwik/shadow-root-PkjcnvPe.js +0 -93
  89. package/dist/qwik/styles-DmEmq5Lh.js +0 -2
  90. package/dist/qwik/widget-theme-lbPF3I0A.js +0 -24
  91. package/dist/react/chunk--MHYZ-zp.js +0 -12
  92. package/dist/react/limits-CpprSem3.js +0 -175
  93. package/dist/react/pusher-3dki8s2l.js +0 -2505
  94. package/dist/react/realtime-DGqScuox.js +0 -567
  95. package/dist/solid/chunk-B2NCWFvW.js +0 -11
  96. package/dist/solid/comment-kit-ui-ACW8BpEm.js +0 -24898
  97. package/dist/solid/dom-DqDH-Gml.js +0 -104
  98. package/dist/solid/error-boundary-9mimpbZA.js +0 -21
  99. package/dist/solid/limits-B_69IbLl.js +0 -71
  100. package/dist/solid/mount-ui-Dq1wj_tx.js +0 -72
  101. package/dist/solid/pusher-_RVNpj1f.js +0 -2504
  102. package/dist/solid/realtime-DbUJK4gU.js +0 -567
  103. package/dist/solid/shadow-root-CssU3bQb.js +0 -93
  104. package/dist/solid/styles-DbueS9xx.js +0 -2
  105. package/dist/solid/widget-theme-B4DJ14fI.js +0 -24
  106. package/dist/svelte/chunk-Pi70BKld.js +0 -11
  107. package/dist/svelte/comment-kit-ui-Cx4u1g77.js +0 -24898
  108. package/dist/svelte/dom-MyTrWzy_.js +0 -104
  109. package/dist/svelte/error-boundary-C3GWI_IX.js +0 -21
  110. package/dist/svelte/limits-CURF22v3.js +0 -71
  111. package/dist/svelte/mount-ui-CBoNGLNS.js +0 -72
  112. package/dist/svelte/pusher-DN1BiUDw.js +0 -2504
  113. package/dist/svelte/realtime-M1CJbCBA.js +0 -567
  114. package/dist/svelte/shadow-root-DG8inbf6.js +0 -93
  115. package/dist/svelte/styles-BK_MaUpD.js +0 -2
  116. package/dist/svelte/widget-theme-CkfJNysI.js +0 -24
  117. package/dist/types/adapters/errors.d.ts +0 -3
  118. package/dist/types/core/auth.d.ts +0 -18
  119. package/dist/types/core/comments.d.ts +0 -43
  120. package/dist/types/core/dev-grab.d.ts +0 -14
  121. package/dist/types/core/keyboard.d.ts +0 -12
  122. package/dist/types/core/limits.d.ts +0 -52
  123. package/dist/types/core/offline-queue.d.ts +0 -23
  124. package/dist/types/core/realtime.d.ts +0 -9
  125. package/dist/types/core/screenshot.d.ts +0 -12
  126. package/dist/types/core/session.d.ts +0 -9
  127. package/dist/types/core/source-resolver.d.ts +0 -19
  128. package/dist/types/core/state.d.ts +0 -24
  129. package/dist/types/react/comment-kit-ui.d.ts +0 -9
  130. package/dist/types/react/comments/comment-flow.d.ts +0 -8
  131. package/dist/types/react/comments/outcomes.d.ts +0 -28
  132. package/dist/types/react/comments/pin-geometry.d.ts +0 -12
  133. package/dist/types/react/comments/view-model.d.ts +0 -66
  134. package/dist/types/react/components/annotation-toolbar.d.ts +0 -36
  135. package/dist/types/react/components/build-panel-shared-props.d.ts +0 -25
  136. package/dist/types/react/components/comment-actions.d.ts +0 -19
  137. package/dist/types/react/components/comment-body.d.ts +0 -8
  138. package/dist/types/react/components/comment-branch-filter.d.ts +0 -15
  139. package/dist/types/react/components/comment-composer-actions.d.ts +0 -26
  140. package/dist/types/react/components/comment-composer-extras-fields.d.ts +0 -32
  141. package/dist/types/react/components/comment-composer-extras-toolbar.d.ts +0 -9
  142. package/dist/types/react/components/comment-composer-extras.d.ts +0 -10
  143. package/dist/types/react/components/comment-composer-extras.state.d.ts +0 -24
  144. package/dist/types/react/components/comment-composer-hook.d.ts +0 -1
  145. package/dist/types/react/components/comment-composer-media.d.ts +0 -17
  146. package/dist/types/react/components/comment-composer.d.ts +0 -4
  147. package/dist/types/react/components/comment-composer.types.d.ts +0 -41
  148. package/dist/types/react/components/comment-composer.utils.d.ts +0 -3
  149. package/dist/types/react/components/comment-connection-alert.d.ts +0 -7
  150. package/dist/types/react/components/comment-cursor-layer.d.ts +0 -14
  151. package/dist/types/react/components/comment-custom-cursor.d.ts +0 -14
  152. package/dist/types/react/components/comment-drawing-canvas.d.ts +0 -10
  153. package/dist/types/react/components/comment-emoji-picker.d.ts +0 -12
  154. package/dist/types/react/components/comment-error-banner.d.ts +0 -8
  155. package/dist/types/react/components/comment-extension-banner.d.ts +0 -8
  156. package/dist/types/react/components/comment-fab-tools.d.ts +0 -37
  157. package/dist/types/react/components/comment-fab.d.ts +0 -34
  158. package/dist/types/react/components/comment-filter-assignee.d.ts +0 -9
  159. package/dist/types/react/components/comment-filter-bar.d.ts +0 -27
  160. package/dist/types/react/components/comment-filter-popover.d.ts +0 -20
  161. package/dist/types/react/components/comment-format-toolbar.constants.d.ts +0 -34
  162. package/dist/types/react/components/comment-format-toolbar.d.ts +0 -6
  163. package/dist/types/react/components/comment-header.d.ts +0 -34
  164. package/dist/types/react/components/comment-highlight-layer.d.ts +0 -11
  165. package/dist/types/react/components/comment-highlight-marker.d.ts +0 -9
  166. package/dist/types/react/components/comment-image-lightbox.d.ts +0 -10
  167. package/dist/types/react/components/comment-images.d.ts +0 -7
  168. package/dist/types/react/components/comment-item.d.ts +0 -26
  169. package/dist/types/react/components/comment-keyboard-shortcuts.d.ts +0 -7
  170. package/dist/types/react/components/comment-kit-overlays.d.ts +0 -15
  171. package/dist/types/react/components/comment-kit.d.ts +0 -12
  172. package/dist/types/react/components/comment-list-filters.d.ts +0 -14
  173. package/dist/types/react/components/comment-login-modal.d.ts +0 -20
  174. package/dist/types/react/components/comment-marker-layer-composer.d.ts +0 -21
  175. package/dist/types/react/components/comment-marker-layer.d.ts +0 -27
  176. package/dist/types/react/components/comment-marker-popover.d.ts +0 -12
  177. package/dist/types/react/components/comment-marker.d.ts +0 -15
  178. package/dist/types/react/components/comment-member-list.d.ts +0 -10
  179. package/dist/types/react/components/comment-mode-bar.d.ts +0 -15
  180. package/dist/types/react/components/comment-online-users.d.ts +0 -8
  181. package/dist/types/react/components/comment-page-ref.d.ts +0 -9
  182. package/dist/types/react/components/comment-panel-header.d.ts +0 -22
  183. package/dist/types/react/components/comment-panel-mobile.d.ts +0 -9
  184. package/dist/types/react/components/comment-panel-utils.d.ts +0 -6
  185. package/dist/types/react/components/comment-panel-view-body.d.ts +0 -23
  186. package/dist/types/react/components/comment-panel.d.ts +0 -37
  187. package/dist/types/react/components/comment-quoted-text.d.ts +0 -9
  188. package/dist/types/react/components/comment-reactions.d.ts +0 -11
  189. package/dist/types/react/components/comment-remote-cursor.d.ts +0 -11
  190. package/dist/types/react/components/comment-screenshot-annotator.d.ts +0 -11
  191. package/dist/types/react/components/comment-screenshot-overlay.d.ts +0 -10
  192. package/dist/types/react/components/comment-search-bar.d.ts +0 -7
  193. package/dist/types/react/components/comment-settings-view.d.ts +0 -20
  194. package/dist/types/react/components/comment-skeletons.d.ts +0 -9
  195. package/dist/types/react/components/comment-thread-detail-badges.d.ts +0 -16
  196. package/dist/types/react/components/comment-thread-detail-meta.d.ts +0 -9
  197. package/dist/types/react/components/comment-thread-detail-replies.d.ts +0 -13
  198. package/dist/types/react/components/comment-thread-detail.d.ts +0 -13
  199. package/dist/types/react/components/comment-thread-footer.d.ts +0 -12
  200. package/dist/types/react/components/comment-thread-list-item.d.ts +0 -15
  201. package/dist/types/react/components/comment-thread-list.d.ts +0 -16
  202. package/dist/types/react/components/comment-user-avatar-tooltip.d.ts +0 -12
  203. package/dist/types/react/components/comment-users-context.d.ts +0 -15
  204. package/dist/types/react/components/comment-utils.d.ts +0 -20
  205. package/dist/types/react/components/comment.d.ts +0 -26
  206. package/dist/types/react/components/constants.d.ts +0 -50
  207. package/dist/types/react/components/dev-export-panel.d.ts +0 -10
  208. package/dist/types/react/components/drawing-path-renderer.d.ts +0 -10
  209. package/dist/types/react/components/element-selector.d.ts +0 -11
  210. package/dist/types/react/components/live-region.d.ts +0 -16
  211. package/dist/types/react/components/screenshot-capture.d.ts +0 -17
  212. package/dist/types/react/components/status-indicator.d.ts +0 -43
  213. package/dist/types/react/components/ui.d.ts +0 -44
  214. package/dist/types/react/components/use-comment-composer.d.ts +0 -28
  215. package/dist/types/react/error-boundary.d.ts +0 -25
  216. package/dist/types/react/hooks/use-comment-fab-drag.d.ts +0 -21
  217. package/dist/types/react/hooks/use-comment-hash-link.d.ts +0 -20
  218. package/dist/types/react/hooks/use-comment-kit-filters.d.ts +0 -19
  219. package/dist/types/react/hooks/use-comment-kit-keyboard.d.ts +0 -11
  220. package/dist/types/react/hooks/use-comment-kit-prop-sync.d.ts +0 -12
  221. package/dist/types/react/hooks/use-comment-marker-drag.d.ts +0 -23
  222. package/dist/types/react/hooks/use-comment-panel-navigation.d.ts +0 -21
  223. package/dist/types/react/hooks/use-comment-realtime.d.ts +0 -6
  224. package/dist/types/react/hooks/use-comment-thread-actions.d.ts +0 -15
  225. package/dist/types/react/hooks/use-connection-retry.d.ts +0 -9
  226. package/dist/types/react/hooks/use-drawing.d.ts +0 -32
  227. package/dist/types/react/hooks/use-extension-conflicts.d.ts +0 -13
  228. package/dist/types/react/hooks/use-filtered-threads.d.ts +0 -7
  229. package/dist/types/react/hooks/use-marker-layer.d.ts +0 -19
  230. package/dist/types/react/hooks/use-screenshot.d.ts +0 -18
  231. package/dist/types/react/hooks/use-text-selection.d.ts +0 -17
  232. package/dist/types/react/hooks/use-websocket.d.ts +0 -9
  233. package/dist/types/react/is-local-host.d.ts +0 -2
  234. package/dist/types/react/mount-ui.d.ts +0 -19
  235. package/dist/types/react/shadow-root.d.ts +0 -23
  236. package/dist/types/react/shims/use-sync-external-store-with-selector.d.ts +0 -4
  237. package/dist/types/react/shims/use-sync-external-store.d.ts +0 -1
  238. package/dist/types/react/ui/lib/ShadowRootContext.d.ts +0 -10
  239. package/dist/types/react/ui/lib/cn.d.ts +0 -12
  240. package/dist/types/react/ui/lib/widget-theme.d.ts +0 -7
  241. package/dist/types/react/ui/primitives/alert/alert.d.ts +0 -8
  242. package/dist/types/react/ui/primitives/alert/index.d.ts +0 -1
  243. package/dist/types/react/ui/primitives/alert-dialog/alert-dialog.d.ts +0 -23
  244. package/dist/types/react/ui/primitives/alert-dialog/index.d.ts +0 -1
  245. package/dist/types/react/ui/primitives/avatar/avatar.d.ts +0 -10
  246. package/dist/types/react/ui/primitives/avatar/index.d.ts +0 -1
  247. package/dist/types/react/ui/primitives/badge/badge.d.ts +0 -5
  248. package/dist/types/react/ui/primitives/badge/index.d.ts +0 -1
  249. package/dist/types/react/ui/primitives/breadcrumb/breadcrumb.d.ts +0 -10
  250. package/dist/types/react/ui/primitives/breadcrumb/index.d.ts +0 -1
  251. package/dist/types/react/ui/primitives/button/button.d.ts +0 -6
  252. package/dist/types/react/ui/primitives/button/index.d.ts +0 -1
  253. package/dist/types/react/ui/primitives/button-group/button-group.d.ts +0 -9
  254. package/dist/types/react/ui/primitives/button-group/index.d.ts +0 -1
  255. package/dist/types/react/ui/primitives/card/card.d.ts +0 -11
  256. package/dist/types/react/ui/primitives/card/index.d.ts +0 -1
  257. package/dist/types/react/ui/primitives/checkbox/checkbox.d.ts +0 -3
  258. package/dist/types/react/ui/primitives/checkbox/index.d.ts +0 -1
  259. package/dist/types/react/ui/primitives/dialog/dialog.d.ts +0 -17
  260. package/dist/types/react/ui/primitives/dialog/index.d.ts +0 -1
  261. package/dist/types/react/ui/primitives/dropdown-menu/dropdown-menu.d.ts +0 -29
  262. package/dist/types/react/ui/primitives/dropdown-menu/index.d.ts +0 -1
  263. package/dist/types/react/ui/primitives/empty/empty.d.ts +0 -10
  264. package/dist/types/react/ui/primitives/empty/index.d.ts +0 -1
  265. package/dist/types/react/ui/primitives/field/field.d.ts +0 -22
  266. package/dist/types/react/ui/primitives/field/index.d.ts +0 -1
  267. package/dist/types/react/ui/primitives/hover-card/hover-card.d.ts +0 -6
  268. package/dist/types/react/ui/primitives/hover-card/index.d.ts +0 -1
  269. package/dist/types/react/ui/primitives/input/index.d.ts +0 -1
  270. package/dist/types/react/ui/primitives/input/input.d.ts +0 -3
  271. package/dist/types/react/ui/primitives/input-group/index.d.ts +0 -1
  272. package/dist/types/react/ui/primitives/input-group/input-group.d.ts +0 -16
  273. package/dist/types/react/ui/primitives/input-otp/index.d.ts +0 -1
  274. package/dist/types/react/ui/primitives/input-otp/input-otp.d.ts +0 -11
  275. package/dist/types/react/ui/primitives/kbd/index.d.ts +0 -1
  276. package/dist/types/react/ui/primitives/kbd/kbd.d.ts +0 -4
  277. package/dist/types/react/ui/primitives/label/index.d.ts +0 -1
  278. package/dist/types/react/ui/primitives/label/label.d.ts +0 -3
  279. package/dist/types/react/ui/primitives/native-select/index.d.ts +0 -1
  280. package/dist/types/react/ui/primitives/native-select/native-select.d.ts +0 -7
  281. package/dist/types/react/ui/primitives/popover/index.d.ts +0 -1
  282. package/dist/types/react/ui/primitives/popover/popover.d.ts +0 -9
  283. package/dist/types/react/ui/primitives/preview/component-preview.d.ts +0 -8
  284. package/dist/types/react/ui/primitives/progress/index.d.ts +0 -1
  285. package/dist/types/react/ui/primitives/progress/progress.d.ts +0 -7
  286. package/dist/types/react/ui/primitives/radio-group/index.d.ts +0 -1
  287. package/dist/types/react/ui/primitives/radio-group/radio-group.d.ts +0 -6
  288. package/dist/types/react/ui/primitives/scroll-area/index.d.ts +0 -1
  289. package/dist/types/react/ui/primitives/scroll-area/scroll-area.d.ts +0 -6
  290. package/dist/types/react/ui/primitives/select/index.d.ts +0 -1
  291. package/dist/types/react/ui/primitives/select/select.d.ts +0 -15
  292. package/dist/types/react/ui/primitives/separator/index.d.ts +0 -1
  293. package/dist/types/react/ui/primitives/separator/separator.d.ts +0 -3
  294. package/dist/types/react/ui/primitives/sheet/index.d.ts +0 -1
  295. package/dist/types/react/ui/primitives/sheet/sheet.d.ts +0 -14
  296. package/dist/types/react/ui/primitives/skeleton/index.d.ts +0 -1
  297. package/dist/types/react/ui/primitives/skeleton/skeleton.d.ts +0 -3
  298. package/dist/types/react/ui/primitives/slider/index.d.ts +0 -1
  299. package/dist/types/react/ui/primitives/slider/slider.d.ts +0 -7
  300. package/dist/types/react/ui/primitives/sonner/index.d.ts +0 -1
  301. package/dist/types/react/ui/primitives/sonner/sonner.d.ts +0 -4
  302. package/dist/types/react/ui/primitives/spinner/index.d.ts +0 -1
  303. package/dist/types/react/ui/primitives/spinner/spinner.d.ts +0 -3
  304. package/dist/types/react/ui/primitives/switch/index.d.ts +0 -1
  305. package/dist/types/react/ui/primitives/switch/switch.d.ts +0 -5
  306. package/dist/types/react/ui/primitives/tabs/index.d.ts +0 -1
  307. package/dist/types/react/ui/primitives/tabs/tabs.d.ts +0 -8
  308. package/dist/types/react/ui/primitives/textarea/index.d.ts +0 -1
  309. package/dist/types/react/ui/primitives/textarea/textarea.d.ts +0 -3
  310. package/dist/types/react/ui/primitives/toggle/index.d.ts +0 -1
  311. package/dist/types/react/ui/primitives/toggle/toggle.d.ts +0 -7
  312. package/dist/types/react/ui/primitives/toggle-group/index.d.ts +0 -1
  313. package/dist/types/react/ui/primitives/toggle-group/toggle-group.d.ts +0 -14
  314. package/dist/types/react/ui/primitives/tooltip/index.d.ts +0 -1
  315. package/dist/types/react/ui/primitives/tooltip/tooltip.d.ts +0 -7
  316. package/dist/types/utils/freeze-animations.d.ts +0 -8
  317. package/dist/types/utils/text.d.ts +0 -9
  318. package/dist/types/utils/validation.d.ts +0 -10
  319. package/dist/vue/chunk-DHrubWSL.js +0 -11
  320. package/dist/vue/comment-kit-ui-C3zijClM.js +0 -24898
  321. package/dist/vue/dom-C7krZAR8.js +0 -104
  322. package/dist/vue/error-boundary-DW6uGR8U.js +0 -21
  323. package/dist/vue/limits-B6csdQeI.js +0 -71
  324. package/dist/vue/mount-ui-18BnLwCO.js +0 -72
  325. package/dist/vue/pusher-cmjNbW6a.js +0 -2504
  326. package/dist/vue/realtime-B0B5cE-E.js +0 -567
  327. package/dist/vue/shadow-root-zwd_wUIP.js +0 -93
  328. package/dist/vue/styles-B0NAkbKu.js +0 -2
  329. package/dist/vue/widget-theme-D7Vkagk7.js +0 -24
  330. /package/dist/{angular/error-boundary-CxhCm8iF.js → shared/error-boundary-D3PD74vI.js} +0 -0
@@ -0,0 +1,852 @@
1
+ import { a as e, i as t, m as n, n as r } from "./dom-Bhf4WFtY.js";
2
+ import { t as i } from "./button-By0hGrJK.js";
3
+ import { t as a } from "./createReactComponent-BZHeRbD0.js";
4
+ import { n as o } from "./local-demo-context-BohlYbHt.js";
5
+ import { _ as s, b as c, i as ee, n as te } from "./comment-kit-ui-D2j2gvnm.js";
6
+ import * as l from "react";
7
+ import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
8
+ var p = a("outline", "paperclip", "Paperclip", [["path", {
9
+ d: "M15 7l-6.5 6.5a1.5 1.5 0 0 0 3 3l6.5 -6.5a3 3 0 0 0 -6 -6l-6.5 6.5a4.5 4.5 0 0 0 9 9l6.5 -6.5",
10
+ key: "svg-0"
11
+ }]]), m = ".ck-element-selector{z-index:calc(var(--z-ck-fab) - 1);pointer-events:none;position:fixed;inset:0}.ck-element-selector-outline,.ck-element-selector-mark{pointer-events:none;border-radius:4px;position:fixed}.ck-element-selector-outline{z-index:calc(var(--z-ck-fab) - 1);border:2px solid var(--primary);background-color:color-mix(in oklch, var(--primary) 8%, transparent);box-shadow:0 0 0 1px color-mix(in oklch, var(--background) 95%, transparent), 0 0 0 4px color-mix(in oklch, var(--primary) 18%, transparent)}.ck-element-selector-outline[data-state=selected]{background-color:color-mix(in oklch, var(--primary) 12%, transparent);border-style:solid}.ck-element-selector-outline[data-state=multi]{border-style:dashed;border-color:color-mix(in oklch, var(--primary) 70%, var(--foreground));background-color:color-mix(in oklch, var(--primary) 6%, transparent)}.ck-element-selector-outline[data-state=multi]:before{content:attr(data-multi-index);top:-10px;background:var(--primary);min-width:20px;height:20px;color:var(--primary-foreground,white);text-align:center;border-radius:999px;padding:0 6px;font:600 11px/20px ui-monospace,SF Mono,Menlo,monospace;position:absolute;inset-inline-start:-10px;box-shadow:0 1px 3px #00000040}.ck-element-selector-multibar{bottom:24px;z-index:calc(var(--z-ck-fab) + 1);border:1px solid var(--border);background-color:var(--popover);color:var(--popover-foreground);box-shadow:0 18px 30px -12px #00000047, 0 0 0 1px color-mix(in oklch, var(--foreground) 8%, transparent);pointer-events:auto;border-radius:999px;align-items:center;gap:8px;padding:6px 10px;font:13px/1 system-ui,sans-serif;display:inline-flex;position:fixed;inset-inline-start:50%;transform:translate(-50%)}.ck-element-selector-multibar-count{color:var(--popover-foreground);padding:0 4px}.ck-element-selector-marquee{z-index:calc(var(--z-ck-fab) - 1);border:1px dashed var(--primary);background-color:color-mix(in oklch, var(--primary) 12%, transparent);pointer-events:none;border-radius:4px;position:fixed}.ck-element-selector-context-menu{z-index:calc(var(--z-ck-fab) + 2);border:1px solid var(--border);background-color:var(--popover);min-width:200px;color:var(--popover-foreground);box-shadow:0 18px 30px -12px #0000004d, 0 0 0 1px color-mix(in oklch, var(--foreground) 8%, transparent);pointer-events:auto;border-radius:8px;margin:0;padding:4px;font:13px/1 system-ui,sans-serif;list-style:none;position:fixed}.ck-element-selector-context-menu li{list-style:none}.ck-element-selector-context-menu button{width:100%;color:inherit;text-align:left;cursor:pointer;font:inherit;background:0 0;border:0;border-radius:4px;padding:8px 10px}.ck-element-selector-context-menu button:hover,.ck-element-selector-context-menu button:focus-visible{background-color:color-mix(in oklch, var(--primary) 14%, transparent);outline:none}.ck-element-selector-mark{z-index:calc(var(--z-ck-fab) - 2);border:2px solid color-mix(in oklch, var(--primary) 78%, var(--foreground));box-shadow:inset 0 0 0 1px color-mix(in oklch, var(--background) 80%, transparent), 0 0 0 3px color-mix(in oklch, var(--primary) 14%, transparent)}.ck-element-selector-composer{z-index:var(--z-ck-fab);border:1px solid var(--border);background-color:var(--popover);width:min(28rem,100vw - 1rem);color:var(--popover-foreground);box-shadow:0 22px 42px -16px #00000052, 0 0 0 1px color-mix(in oklch, var(--foreground) 8%, transparent);pointer-events:auto;border-radius:8px;align-items:stretch;gap:.625rem;padding:.75rem;display:grid;position:fixed}.ck-element-selector-input-row{min-width:0}.ck-element-selector-composer .ck-input{border-radius:7px;width:100%;min-width:0;min-height:3rem;padding-inline:.875rem;font-size:.875rem;line-height:1.25rem}.ck-element-selector-actions{align-items:center;gap:.5rem;width:100%;display:flex}.ck-element-selector-actions .ck-button{min-height:2.375rem}.ck-element-selector-attach-action{gap:.375rem;margin-inline-end:auto}.ck-element-selector-grab-action{min-width:8.75rem}.ck-element-selector-action-icon{flex:none;width:.95rem;height:.95rem}.ck-element-selector-file-input{clip:rect(0 0 0 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.ck-element-selector-attachment{border:1px solid color-mix(in oklch, var(--border) 80%, transparent);background-color:color-mix(in oklch, var(--muted) 55%, transparent);border-radius:7px;align-items:center;gap:.625rem;width:100%;min-width:0;padding:.5rem;display:flex}.ck-element-selector-attachment-image{object-fit:cover;border-radius:6px;flex:none;width:2.5rem;height:2.5rem}.ck-element-selector-attachment-meta{flex:1;gap:.125rem;min-width:0;display:grid}.ck-element-selector-attachment-name,.ck-element-selector-attachment-path,.ck-element-selector-attachment-size{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.ck-element-selector-attachment-name{color:var(--foreground);font-size:.75rem;font-weight:600;line-height:1rem}.ck-element-selector-attachment-path,.ck-element-selector-attachment-size{color:var(--muted-foreground);font-size:.6875rem;line-height:.875rem}.ck-element-selector-error{width:100%;color:var(--destructive);font-size:.75rem;line-height:1rem}@media (width<=420px){.ck-element-selector-actions{flex-wrap:wrap}.ck-element-selector-attach-action{margin-inline-end:0}.ck-element-selector-save-action,.ck-element-selector-grab-action{flex:auto}}", h = "data-commentkit-freeze", g = "\n*, *::before, *::after {\n animation-play-state: paused !important;\n transition: none !important;\n}\n", _ = 0, v = null, y = [];
12
+ function b() {
13
+ if (v || typeof document > "u") return;
14
+ let e = document.createElement("style");
15
+ e.setAttribute(h, ""), e.textContent = g, document.head.appendChild(e), v = e;
16
+ }
17
+ function x() {
18
+ v &&= (v.remove(), null);
19
+ }
20
+ function S() {
21
+ typeof document < "u" && typeof document.getAnimations == "function" && (y = document.getAnimations().filter((e) => {
22
+ if (e.playState !== "running") return !1;
23
+ try {
24
+ return e.pause(), !0;
25
+ } catch {
26
+ return !1;
27
+ }
28
+ }));
29
+ }
30
+ function C() {
31
+ for (let e of y) try {
32
+ e.play();
33
+ } catch {}
34
+ y = [];
35
+ }
36
+ function ne() {
37
+ _++, _ === 1 && (b(), S());
38
+ let e = !1;
39
+ return () => {
40
+ e || (e = !0, _ = Math.max(0, _ - 1), _ === 0 && (x(), C()));
41
+ };
42
+ }
43
+ var w = 448, re = 236, T = 8, E = .9, D = 1e3, O = 2147483600;
44
+ function k(e) {
45
+ return typeof Element < "u" && e instanceof Element;
46
+ }
47
+ function A() {
48
+ let e = document.activeElement;
49
+ for (; e?.shadowRoot?.activeElement;) e = e.shadowRoot.activeElement;
50
+ return e;
51
+ }
52
+ function ie(e) {
53
+ let t = typeof e.composedPath == "function" ? e.composedPath()[0] ?? e.target : e.target;
54
+ if (!k(t)) return !1;
55
+ let n = t.tagName.toLowerCase();
56
+ return n === "input" || n === "textarea" || n === "select" || t instanceof HTMLElement && t.isContentEditable;
57
+ }
58
+ function j(e) {
59
+ let t = e.getRootNode();
60
+ return !!(e.closest("[data-commentkit], [data-commentkit-host], [data-commentkit-ui], .ck-root") || typeof ShadowRoot < "u" && t instanceof ShadowRoot && t.host.matches("[data-commentkit], [data-commentkit-host], [data-commentkit-ui]"));
61
+ }
62
+ function M(e, t = V(e)) {
63
+ let n = e.tagName.toLowerCase();
64
+ if (n === "html" || n === "body" || j(e) || e.closest("[data-commentkit-ignore], [data-react-grab-ignore]") || !se(t)) return !1;
65
+ let r = window.getComputedStyle(e);
66
+ if (r.display === "none" || r.visibility === "hidden") return !1;
67
+ let i = Number.parseFloat(r.opacity || "1");
68
+ if (Number.isFinite(i) && i <= .01) return !1;
69
+ let a = Number.parseInt(r.zIndex || "", 10), o = r.position === "fixed" || r.position === "absolute", s = t.width / Math.max(window.innerWidth, 1) >= E && t.height / Math.max(window.innerHeight, 1) >= E;
70
+ return !(r.pointerEvents === "none" && r.position === "fixed" && Number.isFinite(a) && a >= O || s && o && (r.backgroundColor === "transparent" || r.backgroundColor === "rgba(0, 0, 0, 0)" || Number.isFinite(i) && i < .1 || Number.isFinite(a) && a > D));
71
+ }
72
+ function N(e) {
73
+ return typeof e.composedPath == "function" ? e.composedPath() : e.target ? [e.target] : [];
74
+ }
75
+ function P(e) {
76
+ return N(e).some((e) => k(e) && j(e));
77
+ }
78
+ function F(e, t) {
79
+ if (typeof document.elementsFromPoint == "function") return document.elementsFromPoint(e, t);
80
+ let n = document.elementFromPoint?.(e, t);
81
+ return n ? [n] : [];
82
+ }
83
+ function I(e, t) {
84
+ return F(e, t).find((e) => M(e)) ?? null;
85
+ }
86
+ function ae(e) {
87
+ let t = Math.min(e.startX, e.x), n = Math.min(e.startY, e.y), r = Math.abs(e.x - e.startX), i = Math.abs(e.y - e.startY);
88
+ return {
89
+ left: t,
90
+ top: n,
91
+ width: r,
92
+ height: i,
93
+ right: t + r,
94
+ bottom: n + i
95
+ };
96
+ }
97
+ function L(e, t) {
98
+ return !(e.right < t.left || e.left > t.right || e.bottom < t.top || e.top > t.bottom);
99
+ }
100
+ var R = 200, z = 5e3;
101
+ function B(e) {
102
+ let t = window.getComputedStyle(e), n = (e) => e === "hidden" || e === "clip";
103
+ return n(t.overflowX) || n(t.overflowY) || n(t.overflow);
104
+ }
105
+ function oe(e) {
106
+ let t = [];
107
+ if (typeof document > "u") return t;
108
+ let n = 0, r = document.createTreeWalker(document.body, NodeFilter.SHOW_ELEMENT, { acceptNode(r) {
109
+ if (n >= z || t.length >= R) return NodeFilter.FILTER_REJECT;
110
+ n += 1;
111
+ let i = r, a = V(i), o = se(a) && L(a, e);
112
+ return !o && B(i) ? NodeFilter.FILTER_REJECT : o && M(i, a) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
113
+ } }), i = r.nextNode();
114
+ for (; i && (t.push(i), !(t.length >= R || n >= z));) i = r.nextNode();
115
+ return t;
116
+ }
117
+ function V(e) {
118
+ let t = e.getBoundingClientRect();
119
+ return {
120
+ top: t.top,
121
+ left: t.left,
122
+ width: t.width,
123
+ height: t.height,
124
+ bottom: t.bottom,
125
+ right: t.right
126
+ };
127
+ }
128
+ function se(e) {
129
+ return e.width > 0 && e.height > 0;
130
+ }
131
+ function H(n) {
132
+ return {
133
+ element: n,
134
+ selector: t(n),
135
+ xpath: e(n),
136
+ rect: V(n)
137
+ };
138
+ }
139
+ function U(e, t, n) {
140
+ return Math.min(n, Math.max(t, e));
141
+ }
142
+ function W() {
143
+ return {
144
+ width: Math.max(window.innerWidth || 0, 16),
145
+ height: Math.max(window.innerHeight || 0, 16)
146
+ };
147
+ }
148
+ function ce(e) {
149
+ let t = W(), r = U(e.rect.left + e.rect.width / 2, 0, t.width), i = U(e.rect.top + e.rect.height / 2, 0, t.height);
150
+ return {
151
+ ...n(r, i, t),
152
+ element: e.selector,
153
+ xpath: e.xpath
154
+ };
155
+ }
156
+ function le(e) {
157
+ return typeof e != "number" || !Number.isFinite(e) ? "" : e < 1024 ? `${e} B` : e < 1048576 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1024 / 1024).toFixed(1)} MB`;
158
+ }
159
+ function ue(e, t) {
160
+ let n = e.path;
161
+ if (typeof n == "string" && n.trim()) return {
162
+ path: n.trim(),
163
+ pathSource: "native"
164
+ };
165
+ if (e.webkitRelativePath) return {
166
+ path: e.webkitRelativePath,
167
+ pathSource: "relative"
168
+ };
169
+ let r = t.value.trim();
170
+ return r && !r.includes("\\fakepath\\") ? {
171
+ path: r,
172
+ pathSource: "native"
173
+ } : {
174
+ path: e.name,
175
+ pathSource: "browser-fallback"
176
+ };
177
+ }
178
+ function de(e, t) {
179
+ let { path: n, pathSource: r } = ue(e, t);
180
+ return {
181
+ name: e.name,
182
+ path: n,
183
+ pathSource: r,
184
+ type: e.type || "application/octet-stream",
185
+ size: e.size,
186
+ lastModified: e.lastModified,
187
+ previewUrl: e.type.startsWith("image/") && typeof URL.createObjectURL == "function" ? URL.createObjectURL(e) : null
188
+ };
189
+ }
190
+ function G(e) {
191
+ e && typeof URL.revokeObjectURL == "function" && URL.revokeObjectURL(e);
192
+ }
193
+ async function fe(e, t) {
194
+ try {
195
+ if (!navigator.clipboard?.writeText) throw Error("clipboard unavailable");
196
+ await navigator.clipboard.writeText(e);
197
+ try {
198
+ c.success(`${t} copied`);
199
+ } catch {}
200
+ } catch {
201
+ try {
202
+ c.error(`Could not copy ${t.toLowerCase()}`);
203
+ } catch {}
204
+ }
205
+ }
206
+ function K(e) {
207
+ return {
208
+ top: e.top,
209
+ left: e.left,
210
+ width: e.width,
211
+ height: e.height
212
+ };
213
+ }
214
+ function pe(e, t = re) {
215
+ let n = W(), r = Math.max(T, n.width - w - T), i = U(e.left, T, r), a = e.bottom + T, o = e.top - t - T;
216
+ return {
217
+ left: i,
218
+ top: a + t <= n.height - T ? a : U(o, T, n.height - t - T)
219
+ };
220
+ }
221
+ var me = 220, q = 200;
222
+ function he(e) {
223
+ let t = W();
224
+ return {
225
+ left: U(e.x, T, Math.max(T, t.width - me - T)),
226
+ top: U(e.y, T, Math.max(T, t.height - q - T))
227
+ };
228
+ }
229
+ function ge(e) {
230
+ return e.status === "open" && !!(e.position.element || e.position.xpath);
231
+ }
232
+ function _e(e) {
233
+ return e.flatMap((e) => {
234
+ if (!ge(e)) return [];
235
+ let t = r(e.position.element ?? "", e.position.xpath);
236
+ if (!t) return [];
237
+ let n = V(t);
238
+ return M(t, n) ? [{
239
+ id: e.id,
240
+ rect: n
241
+ }] : [];
242
+ });
243
+ }
244
+ function ve(e) {
245
+ let [t, n] = l.useState(0);
246
+ return l.useEffect(() => {
247
+ if (!e) return;
248
+ let t = 0, r = () => {
249
+ t ||= window.requestAnimationFrame(() => {
250
+ t = 0, n((e) => e + 1);
251
+ });
252
+ };
253
+ window.addEventListener("scroll", r, !0), window.addEventListener("resize", r);
254
+ let i = typeof MutationObserver < "u" ? new MutationObserver(r) : null;
255
+ return i?.observe(document.body, {
256
+ childList: !0,
257
+ subtree: !0,
258
+ attributes: !0,
259
+ attributeFilter: [
260
+ "class",
261
+ "style",
262
+ "hidden",
263
+ "data-state"
264
+ ]
265
+ }), () => {
266
+ t && window.cancelAnimationFrame(t), window.removeEventListener("scroll", r, !0), window.removeEventListener("resize", r), i?.disconnect();
267
+ };
268
+ }, [e]), t;
269
+ }
270
+ var ye = l.memo(function({ core: n, state: r, active: a }) {
271
+ let c = o(), [m, h] = l.useState(null), [g, _] = l.useState(null), [v, y] = l.useState([]), [b, x] = l.useState(null), [S, C] = l.useState(null), [w, T] = l.useState(""), [E, D] = l.useState(null), [O, k] = l.useState(!1), [j, M] = l.useState(!1), [N, F] = l.useState(null), L = l.useRef(null), R = l.useRef(null), z = l.useRef(null), B = l.useRef(null), [se, U] = l.useState(re), W = r.comments.some(ge), ue = ve(a || W || !!g || v.length > 0), me = l.useRef(null), q = l.useRef([]), ye = l.useRef(""), J = l.useRef(null);
272
+ l.useEffect(() => {
273
+ me.current = g?.element ?? m?.element ?? null;
274
+ }, [m, g]), l.useEffect(() => {
275
+ q.current = v;
276
+ }, [v]), l.useEffect(() => {
277
+ ye.current = w;
278
+ }, [w]), l.useEffect(() => {
279
+ J.current = E;
280
+ }, [E]);
281
+ let be = l.useMemo(() => _e(r.comments), [r.comments, ue]);
282
+ l.useEffect(() => {
283
+ a || (h(null), _(null), y([]), C(null), T(""), D((e) => (G(e?.previewUrl), null)), k(!1), F(null), x(null), Q.current = null, $.current = !1);
284
+ }, [a]), l.useEffect(() => () => {
285
+ G(J.current?.previewUrl);
286
+ }, []), l.useEffect(() => {
287
+ if (!a) return;
288
+ let e = document.body.style.cursor;
289
+ document.body.style.cursor = "crosshair";
290
+ let t = ne();
291
+ return () => {
292
+ document.body.style.cursor = e, t();
293
+ };
294
+ }, [a]);
295
+ let Y = a && !!g;
296
+ l.useEffect(() => {
297
+ if (!Y) return;
298
+ let e = A();
299
+ return e instanceof HTMLElement && !L.current?.contains(e) && (B.current = e), L.current?.querySelector("[data-ck-composer-input]")?.focus({ preventScroll: !0 }), () => {
300
+ let e = B.current;
301
+ B.current = null, e && e.isConnected && e.focus({ preventScroll: !0 });
302
+ };
303
+ }, [Y]);
304
+ let xe = l.useRef(r.isAuthenticated);
305
+ l.useEffect(() => {
306
+ let e = !xe.current && r.isAuthenticated;
307
+ if (xe.current = r.isAuthenticated, !e || !Y || !w.trim()) return;
308
+ let t = L.current?.querySelector("[data-ck-composer-input]");
309
+ t?.focus({ preventScroll: !0 });
310
+ let n = t?.value.length ?? 0;
311
+ t?.setSelectionRange?.(n, n), F((e) => e && e.startsWith("Sign in to save comments") ? null : e);
312
+ }, [
313
+ r.isAuthenticated,
314
+ Y,
315
+ w
316
+ ]), l.useLayoutEffect(() => {
317
+ if (!Y) return;
318
+ let e = L.current;
319
+ if (!e) return;
320
+ let t = () => {
321
+ let t = e.getBoundingClientRect().height;
322
+ t > 0 && U((e) => Math.abs(e - t) > 1 ? t : e);
323
+ };
324
+ t();
325
+ let n = null;
326
+ try {
327
+ typeof ResizeObserver < "u" && (n = new ResizeObserver(t), n.observe(e));
328
+ } catch {
329
+ n = null;
330
+ }
331
+ return () => n?.disconnect();
332
+ }, [
333
+ Y,
334
+ E,
335
+ N
336
+ ]), l.useEffect(() => {
337
+ if (!a) return;
338
+ let e = () => {
339
+ _((e) => e && {
340
+ ...e,
341
+ rect: V(e.element)
342
+ }), h((e) => e && {
343
+ ...e,
344
+ rect: V(e.element)
345
+ }), y((e) => e.map((e) => ({
346
+ ...e,
347
+ rect: V(e.element)
348
+ })));
349
+ };
350
+ return window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
351
+ window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
352
+ };
353
+ }, [a]);
354
+ let X = l.useCallback(async (e, t, r) => {
355
+ if (!e || j) return !1;
356
+ M(!0), F(null);
357
+ try {
358
+ let i = t?.trim(), a = r ? [{
359
+ name: r.name,
360
+ path: r.path,
361
+ pathSource: r.pathSource,
362
+ type: r.type,
363
+ size: r.size,
364
+ lastModified: r.lastModified
365
+ }] : [], o = i || a.length > 0 ? {
366
+ ...i ? { comment: i } : {},
367
+ ...a.length > 0 ? { attachments: a } : {}
368
+ } : void 0, s = o ? await n.grabElement(e, o) : await n.grabElement(e);
369
+ return M(!1), s ? (_(null), h(null), T(""), D((e) => (G(e?.previewUrl), null)), n.setTool(null), !0) : (F("Could not grab this element."), !1);
370
+ } catch {
371
+ return M(!1), F("Could not copy this element for the agent."), !1;
372
+ }
373
+ }, [n, j]), Z = l.useCallback(async (e) => {
374
+ if (e.length === 0 || j) return !1;
375
+ M(!0), F(null);
376
+ try {
377
+ let t = await n.grabElements(e);
378
+ return M(!1), t ? (y([]), _(null), h(null), T(""), D((e) => (G(e?.previewUrl), null)), n.setTool(null), !0) : (F("Could not grab these elements."), !1);
379
+ } catch {
380
+ return M(!1), F("Could not copy these elements for the agent."), !1;
381
+ }
382
+ }, [n, j]), Se = l.useCallback(() => {
383
+ let e = q.current.map((e) => e.element);
384
+ Z(e);
385
+ }, [Z]), Ce = l.useCallback(() => {
386
+ y([]);
387
+ }, []), Q = l.useRef(null), $ = l.useRef(!1), we = l.useRef(null);
388
+ we.current = b;
389
+ let Te = l.useRef(null);
390
+ Te.current = S, l.useEffect(() => {
391
+ if (!S) return;
392
+ let e = n.blockEscape();
393
+ return () => e();
394
+ }, [S, n]), l.useEffect(() => {
395
+ if (!S) return;
396
+ let e = A();
397
+ return e instanceof HTMLElement && !z.current?.contains(e) && (B.current = e), z.current?.querySelector("[role=\"menuitem\"]")?.focus({ preventScroll: !0 }), () => {
398
+ let e = B.current;
399
+ B.current = null, e && e.isConnected && e.focus({ preventScroll: !0 });
400
+ };
401
+ }, [S]);
402
+ let Ee = l.useCallback((e) => {
403
+ let t = z.current;
404
+ if (!t) return;
405
+ let n = Array.from(t.querySelectorAll("[role=\"menuitem\"]"));
406
+ if (n.length === 0) return;
407
+ let r = A(), i = n.findIndex((e) => e === r), a = (e) => {
408
+ n[(e + n.length) % n.length]?.focus({ preventScroll: !0 });
409
+ };
410
+ switch (e.key) {
411
+ case "ArrowDown":
412
+ e.preventDefault(), e.stopPropagation(), a(i < 0 ? 0 : i + 1);
413
+ break;
414
+ case "ArrowUp":
415
+ e.preventDefault(), e.stopPropagation(), a(i < 0 ? n.length - 1 : i - 1);
416
+ break;
417
+ case "Home":
418
+ e.preventDefault(), e.stopPropagation(), a(0);
419
+ break;
420
+ case "End":
421
+ e.preventDefault(), e.stopPropagation(), a(n.length - 1);
422
+ break;
423
+ case "Enter":
424
+ case " ": e.preventDefault(), e.stopPropagation(), A()?.click();
425
+ }
426
+ }, []);
427
+ l.useEffect(() => {
428
+ if (!a) return;
429
+ let r = (e) => {
430
+ e.button !== 0 || P(e) || g || (C(null), Q.current = {
431
+ x: e.clientX,
432
+ y: e.clientY
433
+ }, $.current = !1);
434
+ }, i = (n) => {
435
+ if (P(n)) return;
436
+ let r = I(n.clientX, n.clientY);
437
+ r && (n.preventDefault(), n.stopPropagation(), C({
438
+ element: r,
439
+ selector: t(r),
440
+ xpath: e(r),
441
+ x: n.clientX,
442
+ y: n.clientY
443
+ }));
444
+ }, o = null, s = null, c = () => {
445
+ o &&= (clearTimeout(o), null), s = null;
446
+ }, ee = (n) => {
447
+ if (P(n) || n.touches.length !== 1) return;
448
+ let r = n.touches[0];
449
+ if (!r) return;
450
+ let i = I(r.clientX, r.clientY);
451
+ i && (s = {
452
+ x: r.clientX,
453
+ y: r.clientY,
454
+ element: i
455
+ }, o = setTimeout(() => {
456
+ s && (C({
457
+ element: s.element,
458
+ selector: t(s.element),
459
+ xpath: e(s.element),
460
+ x: s.x,
461
+ y: s.y
462
+ }), s = null, o = null);
463
+ }, 550));
464
+ }, te = (e) => {
465
+ if (!s || e.touches.length !== 1) return;
466
+ let t = e.touches[0];
467
+ if (!t) return;
468
+ let n = t.clientX - s.x, r = t.clientY - s.y;
469
+ (Math.abs(n) > 10 || Math.abs(r) > 10) && c();
470
+ }, l = () => {
471
+ c();
472
+ }, u = (e) => {
473
+ if (P(e)) return;
474
+ let t = Q.current;
475
+ if (t) {
476
+ if (e.pointerType === "mouse" && !(e.buttons & 1)) Q.current = null, $.current = !1, x(null);
477
+ else {
478
+ let n = e.clientX - t.x, r = e.clientY - t.y;
479
+ if (we.current || Math.abs(n) > 6 || Math.abs(r) > 6) {
480
+ $.current = !0, x({
481
+ startX: t.x,
482
+ startY: t.y,
483
+ x: e.clientX,
484
+ y: e.clientY
485
+ }), h(null);
486
+ return;
487
+ }
488
+ }
489
+ }
490
+ if (g) return;
491
+ let n = I(e.clientX, e.clientY);
492
+ h(n ? H(n) : null);
493
+ }, d = () => {
494
+ Q.current = null, $.current = !1, x(null);
495
+ }, f = (e) => {
496
+ let t = Q.current;
497
+ Q.current = null;
498
+ let n = we.current;
499
+ if (!t || !n) return;
500
+ let r = ae({
501
+ ...n,
502
+ x: e.clientX,
503
+ y: e.clientY
504
+ });
505
+ if (r.width < 6 || r.height < 6) {
506
+ x(null);
507
+ return;
508
+ }
509
+ let i = oe(r);
510
+ if (i.length > 0) {
511
+ let e = i.map(H);
512
+ y((t) => {
513
+ let n = new Set(t.map((e) => e.element)), r = [...t];
514
+ for (let t of e) n.has(t.element) || r.push(t);
515
+ return r;
516
+ });
517
+ }
518
+ x(null);
519
+ }, p = (e) => {
520
+ if (P(e)) return;
521
+ if ($.current) {
522
+ $.current = !1, e.preventDefault(), e.stopPropagation();
523
+ return;
524
+ }
525
+ e.preventDefault(), e.stopPropagation();
526
+ let t = I(e.clientX, e.clientY);
527
+ g && !e.shiftKey ? (_(null), h(null), T(""), D((e) => (G(e?.previewUrl), null)), F(null)) : t && (e.shiftKey ? (y((e) => e.some((e) => e.element === t) ? e.filter((e) => e.element !== t) : [...g && !e.some((e) => e.element === g.element) ? [...e, g] : e, H(t)]), h(null), _(null), T(""), D((e) => (G(e?.previewUrl), null)), F(null)) : (_(H(t)), h(null), T(""), D((e) => (G(e?.previewUrl), null)), F(null)));
528
+ }, m = (e) => {
529
+ if (e.key === "Escape") {
530
+ if (e.isComposing) return;
531
+ if (Te.current) {
532
+ e.preventDefault(), e.stopPropagation(), C(null);
533
+ return;
534
+ }
535
+ e.preventDefault(), e.stopPropagation(), _(null), h(null), T(""), D((e) => (G(e?.previewUrl), null)), F(null), n.setTool(null);
536
+ return;
537
+ }
538
+ if (!e.metaKey && !e.ctrlKey || e.shiftKey || e.altKey || e.key !== "c" && e.key !== "C" && e.code !== "KeyC" || ie(e)) return;
539
+ let t = typeof window < "u" ? window.getSelection() : null;
540
+ if (t && !t.isCollapsed && t.toString().length > 0) return;
541
+ let r = q.current;
542
+ if (r.length > 0) {
543
+ e.preventDefault(), e.stopPropagation(), Z(r.map((e) => e.element));
544
+ return;
545
+ }
546
+ let i = me.current;
547
+ if (!i) return;
548
+ e.preventDefault(), e.stopPropagation();
549
+ let a = g?.element === i;
550
+ X(i, a ? ye.current : void 0, a ? J.current : null);
551
+ };
552
+ return document.addEventListener("pointerdown", r, !0), document.addEventListener("pointermove", u, !0), document.addEventListener("pointerup", f, !0), document.addEventListener("pointercancel", d, !0), document.addEventListener("click", p, !0), document.addEventListener("contextmenu", i, !0), document.addEventListener("touchstart", ee, {
553
+ capture: !0,
554
+ passive: !0
555
+ }), document.addEventListener("touchmove", te, {
556
+ capture: !0,
557
+ passive: !0
558
+ }), document.addEventListener("touchend", l, {
559
+ capture: !0,
560
+ passive: !0
561
+ }), document.addEventListener("touchcancel", l, {
562
+ capture: !0,
563
+ passive: !0
564
+ }), window.addEventListener("keydown", m, !0), () => {
565
+ document.removeEventListener("pointerdown", r, !0), document.removeEventListener("pointermove", u, !0), document.removeEventListener("pointerup", f, !0), document.removeEventListener("pointercancel", d, !0), document.removeEventListener("click", p, !0), document.removeEventListener("contextmenu", i, !0), document.removeEventListener("touchstart", ee, !0), document.removeEventListener("touchmove", te, !0), document.removeEventListener("touchend", l, !0), document.removeEventListener("touchcancel", l, !0), window.removeEventListener("keydown", m, !0), c();
566
+ };
567
+ }, [
568
+ a,
569
+ n,
570
+ X,
571
+ Z,
572
+ g
573
+ ]);
574
+ let De = l.useCallback(async (e) => {
575
+ e.preventDefault();
576
+ let t = w.trim();
577
+ if (g && t && !O) {
578
+ if (!r.currentUser) F("Sign in to save comments. You can still use Grab for agent without signing in."), n.toggleLoginModal();
579
+ else {
580
+ k(!0), F(null);
581
+ try {
582
+ await n.createComment("pin", t, ce(g)), k(!1), _(null), T(""), D((e) => (G(e?.previewUrl), null)), n.setTool(null);
583
+ } catch {
584
+ k(!1), F("Could not save this comment. Try again.");
585
+ }
586
+ }
587
+ }
588
+ }, [
589
+ w,
590
+ n,
591
+ O,
592
+ g,
593
+ r.currentUser
594
+ ]), Oe = l.useCallback(() => {
595
+ X(g?.element ?? null, w, E);
596
+ }, [
597
+ E,
598
+ w,
599
+ X,
600
+ g
601
+ ]), ke = l.useCallback(() => {
602
+ R.current?.click();
603
+ }, []), Ae = l.useCallback((e) => {
604
+ let t = e.currentTarget, n = t.files?.[0] ?? null;
605
+ D((e) => (G(e?.previewUrl), n ? de(n, t) : null)), t.value = "";
606
+ }, []), je = l.useCallback(() => {
607
+ D((e) => (G(e?.previewUrl), null));
608
+ }, []), Me = l.useMemo(() => te(), []);
609
+ return !a && be.length === 0 ? null : /* @__PURE__ */ f("div", {
610
+ className: "ck-element-selector",
611
+ "data-testid": "ck-element-selector",
612
+ children: [
613
+ be.map((e) => /* @__PURE__ */ d("div", {
614
+ "aria-hidden": "true",
615
+ className: "ck-element-selector-mark",
616
+ "data-comment-id": e.id,
617
+ style: K(e.rect)
618
+ }, e.id)),
619
+ a && m && !b && /* @__PURE__ */ d("div", {
620
+ "aria-hidden": "true",
621
+ className: "ck-element-selector-outline",
622
+ "data-state": "hover",
623
+ style: K(m.rect)
624
+ }),
625
+ a && b && /* @__PURE__ */ d("div", {
626
+ "aria-hidden": "true",
627
+ className: "ck-element-selector-marquee",
628
+ "data-testid": "ck-element-selector-marquee",
629
+ style: {
630
+ left: Math.min(b.startX, b.x),
631
+ top: Math.min(b.startY, b.y),
632
+ width: Math.abs(b.x - b.startX),
633
+ height: Math.abs(b.y - b.startY)
634
+ }
635
+ }),
636
+ a && v.map((e, t) => /* @__PURE__ */ d("div", {
637
+ "aria-hidden": "true",
638
+ className: "ck-element-selector-outline",
639
+ "data-state": "multi",
640
+ "data-multi-index": t + 1,
641
+ style: K(e.rect)
642
+ }, `multi-${t}-${e.selector}-${e.xpath}`)),
643
+ a && S && /* @__PURE__ */ f("ul", {
644
+ ref: z,
645
+ className: "ck-element-selector-context-menu",
646
+ "data-testid": "ck-element-selector-context-menu",
647
+ role: "menu",
648
+ "aria-label": "Element actions",
649
+ onKeyDown: Ee,
650
+ style: he(S),
651
+ children: [
652
+ /* @__PURE__ */ d("li", { children: /* @__PURE__ */ d("button", {
653
+ type: "button",
654
+ role: "menuitem",
655
+ "data-testid": "ck-context-menu-grab",
656
+ onClick: () => {
657
+ let e = S.element;
658
+ C(null), X(e);
659
+ },
660
+ children: "Grab for agent"
661
+ }) }),
662
+ /* @__PURE__ */ d("li", { children: /* @__PURE__ */ d("button", {
663
+ type: "button",
664
+ role: "menuitem",
665
+ "data-testid": "ck-context-menu-comment",
666
+ onClick: () => {
667
+ let e = H(S.element);
668
+ C(null), _(e);
669
+ },
670
+ children: "Add comment"
671
+ }) }),
672
+ /* @__PURE__ */ d("li", { children: /* @__PURE__ */ d("button", {
673
+ type: "button",
674
+ role: "menuitem",
675
+ "data-testid": "ck-context-menu-copy-selector",
676
+ onClick: () => {
677
+ let e = S.selector;
678
+ C(null), fe(e, "CSS selector");
679
+ },
680
+ children: "Copy CSS selector"
681
+ }) }),
682
+ /* @__PURE__ */ d("li", { children: /* @__PURE__ */ d("button", {
683
+ type: "button",
684
+ role: "menuitem",
685
+ "data-testid": "ck-context-menu-copy-xpath",
686
+ onClick: () => {
687
+ let e = S.xpath;
688
+ C(null), fe(e, "XPath");
689
+ },
690
+ children: "Copy XPath"
691
+ }) }),
692
+ /* @__PURE__ */ d("li", { children: /* @__PURE__ */ d("button", {
693
+ type: "button",
694
+ role: "menuitem",
695
+ "data-testid": "ck-context-menu-inspect",
696
+ onClick: () => {
697
+ console.log("[CommentKit] inspect", S.element), C(null);
698
+ },
699
+ children: "Inspect (log to console)"
700
+ }) })
701
+ ]
702
+ }),
703
+ a && v.length > 0 && /* @__PURE__ */ f("div", {
704
+ className: "ck-element-selector-multibar",
705
+ "data-testid": "ck-element-selector-multibar",
706
+ children: [
707
+ /* @__PURE__ */ f("span", {
708
+ className: "ck-element-selector-multibar-count",
709
+ children: [v.length, " selected"]
710
+ }),
711
+ /* @__PURE__ */ d(i, {
712
+ type: "button",
713
+ size: "sm",
714
+ onClick: Se,
715
+ disabled: j,
716
+ "data-testid": "ck-element-grab-many-button",
717
+ children: j ? "Grabbing…" : `Grab ${v.length} for agent`
718
+ }),
719
+ /* @__PURE__ */ d(i, {
720
+ type: "button",
721
+ size: "sm",
722
+ variant: "ghost",
723
+ onClick: Ce,
724
+ disabled: j,
725
+ "data-testid": "ck-element-grab-clear-button",
726
+ children: "Clear"
727
+ })
728
+ ]
729
+ }),
730
+ a && g && /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("div", {
731
+ "aria-hidden": "true",
732
+ className: "ck-element-selector-outline",
733
+ "data-state": "selected",
734
+ style: K(g.rect)
735
+ }), /* @__PURE__ */ f("form", {
736
+ ref: L,
737
+ className: "ck-element-selector-composer",
738
+ style: pe(g.rect, se),
739
+ onSubmit: De,
740
+ children: [
741
+ /* @__PURE__ */ d("div", {
742
+ className: "ck-element-selector-input-row",
743
+ children: /* @__PURE__ */ d(ee, {
744
+ "data-ck-composer-input": "",
745
+ "aria-label": "Element comment",
746
+ value: w,
747
+ placeholder: "Add comment",
748
+ disabled: O || j,
749
+ onChange: (e) => {
750
+ T(e.currentTarget.value), N && F(null);
751
+ }
752
+ })
753
+ }),
754
+ !c && /* @__PURE__ */ d("input", {
755
+ ref: R,
756
+ "aria-label": "Attach file",
757
+ className: "ck-element-selector-file-input",
758
+ type: "file",
759
+ onChange: Ae
760
+ }),
761
+ E && /* @__PURE__ */ f("div", {
762
+ className: "ck-element-selector-attachment",
763
+ "data-testid": "ck-element-attachment-preview",
764
+ children: [
765
+ E.previewUrl && /* @__PURE__ */ d("img", {
766
+ alt: "",
767
+ "aria-hidden": "true",
768
+ className: "ck-element-selector-attachment-image",
769
+ src: E.previewUrl
770
+ }),
771
+ /* @__PURE__ */ f("div", {
772
+ className: "ck-element-selector-attachment-meta",
773
+ children: [
774
+ /* @__PURE__ */ d("span", {
775
+ className: "ck-element-selector-attachment-name",
776
+ children: E.name
777
+ }),
778
+ /* @__PURE__ */ d("span", {
779
+ className: "ck-element-selector-attachment-path",
780
+ title: E.path,
781
+ children: E.path
782
+ }),
783
+ /* @__PURE__ */ d("span", {
784
+ className: "ck-element-selector-attachment-size",
785
+ children: le(E.size)
786
+ })
787
+ ]
788
+ }),
789
+ /* @__PURE__ */ d(i, {
790
+ type: "button",
791
+ size: "icon-xs",
792
+ variant: "ghost",
793
+ "aria-label": "Remove attachment",
794
+ disabled: O || j,
795
+ onClick: je,
796
+ children: /* @__PURE__ */ d(s, {
797
+ className: "ck-element-selector-action-icon",
798
+ "aria-hidden": "true"
799
+ })
800
+ })
801
+ ]
802
+ }),
803
+ /* @__PURE__ */ f("div", {
804
+ className: "ck-element-selector-actions",
805
+ children: [
806
+ !c && /* @__PURE__ */ f(i, {
807
+ type: "button",
808
+ variant: "outline",
809
+ className: "ck-element-selector-attach-action",
810
+ disabled: O || j,
811
+ onClick: ke,
812
+ "data-testid": "ck-element-attach-button",
813
+ children: [/* @__PURE__ */ d(p, {
814
+ className: "ck-element-selector-action-icon",
815
+ "aria-hidden": "true"
816
+ }), /* @__PURE__ */ d("span", { children: "Attach" })]
817
+ }),
818
+ /* @__PURE__ */ d(i, {
819
+ type: "submit",
820
+ className: "ck-element-selector-save-action",
821
+ disabled: !w.trim() || O || j,
822
+ children: O ? "Saving" : "Save"
823
+ }),
824
+ /* @__PURE__ */ d(i, {
825
+ type: "button",
826
+ className: "ck-element-selector-grab-action",
827
+ variant: Me ? "default" : "outline",
828
+ disabled: O || j,
829
+ onClick: Oe,
830
+ title: c ? "Copy element context to clipboard for your agent" : "Copy element source + screenshot to clipboard for your agent",
831
+ "data-testid": "ck-element-grab-button",
832
+ children: j ? "Grabbing…" : "Grab for agent"
833
+ })
834
+ ]
835
+ }),
836
+ N && /* @__PURE__ */ d("p", {
837
+ className: "ck-element-selector-error",
838
+ role: "alert",
839
+ children: N
840
+ })
841
+ ]
842
+ })] })
843
+ ]
844
+ });
845
+ });
846
+ function J(e) {
847
+ return /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("style", {
848
+ "data-ck-tool-styles": "element-selector",
849
+ children: m
850
+ }), /* @__PURE__ */ d(ye, { ...e })] });
851
+ }
852
+ export { J as ElementSelector };