@dooherceg/tiptap-controlled-editor-with-table 0.0.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 (287) hide show
  1. package/README.md +63 -0
  2. package/dist/Combination-CO0ZtURs.js +1333 -0
  3. package/dist/assets/badge.css +1 -0
  4. package/dist/assets/button.css +1 -0
  5. package/dist/assets/card.css +1 -0
  6. package/dist/assets/color-highlight-button.css +1 -0
  7. package/dist/assets/dropdown-menu.css +1 -0
  8. package/dist/assets/image-upload-node.css +1 -0
  9. package/dist/assets/input.css +1 -0
  10. package/dist/assets/popover.css +1 -0
  11. package/dist/assets/separator.css +1 -0
  12. package/dist/assets/simple-editor.css +1 -0
  13. package/dist/assets/toolbar.css +1 -0
  14. package/dist/assets/tooltip.css +1 -0
  15. package/dist/components/tiptap-icons/add-table-column-after-icon.d.ts +1 -0
  16. package/dist/components/tiptap-icons/add-table-column-after-icon.js +26 -0
  17. package/dist/components/tiptap-icons/add-table-column-before-icon.d.ts +1 -0
  18. package/dist/components/tiptap-icons/add-table-column-before-icon.js +26 -0
  19. package/dist/components/tiptap-icons/add-table-row-after-icon.d.ts +1 -0
  20. package/dist/components/tiptap-icons/add-table-row-after-icon.js +26 -0
  21. package/dist/components/tiptap-icons/add-table-row-before-icon.d.ts +1 -0
  22. package/dist/components/tiptap-icons/add-table-row-before-icon.js +26 -0
  23. package/dist/components/tiptap-icons/align-center-icon.d.ts +3 -0
  24. package/dist/components/tiptap-icons/align-center-icon.js +47 -0
  25. package/dist/components/tiptap-icons/align-justify-icon.d.ts +3 -0
  26. package/dist/components/tiptap-icons/align-justify-icon.js +47 -0
  27. package/dist/components/tiptap-icons/align-left-icon.d.ts +1 -0
  28. package/dist/components/tiptap-icons/align-left-icon.js +49 -0
  29. package/dist/components/tiptap-icons/align-right-icon.d.ts +1 -0
  30. package/dist/components/tiptap-icons/align-right-icon.js +49 -0
  31. package/dist/components/tiptap-icons/arrow-left-icon.d.ts +1 -0
  32. package/dist/components/tiptap-icons/arrow-left-icon.js +27 -0
  33. package/dist/components/tiptap-icons/ban-icon.d.ts +1 -0
  34. package/dist/components/tiptap-icons/ban-icon.js +29 -0
  35. package/dist/components/tiptap-icons/blockquote-icon.d.ts +1 -0
  36. package/dist/components/tiptap-icons/blockquote-icon.js +58 -0
  37. package/dist/components/tiptap-icons/bold-icon.d.ts +1 -0
  38. package/dist/components/tiptap-icons/bold-icon.js +29 -0
  39. package/dist/components/tiptap-icons/chevron-down-icon.d.ts +3 -0
  40. package/dist/components/tiptap-icons/chevron-down-icon.js +27 -0
  41. package/dist/components/tiptap-icons/close-icon.d.ts +1 -0
  42. package/dist/components/tiptap-icons/close-icon.js +27 -0
  43. package/dist/components/tiptap-icons/code-block-icon.d.ts +1 -0
  44. package/dist/components/tiptap-icons/code-block-icon.js +49 -0
  45. package/dist/components/tiptap-icons/code2-icon.d.ts +1 -0
  46. package/dist/components/tiptap-icons/code2-icon.js +43 -0
  47. package/dist/components/tiptap-icons/corner-down-left-icon.d.ts +1 -0
  48. package/dist/components/tiptap-icons/corner-down-left-icon.js +29 -0
  49. package/dist/components/tiptap-icons/delete-table-column-icon.d.ts +1 -0
  50. package/dist/components/tiptap-icons/delete-table-column-icon.js +26 -0
  51. package/dist/components/tiptap-icons/delete-table-row-icon.d.ts +1 -0
  52. package/dist/components/tiptap-icons/delete-table-row-icon.js +33 -0
  53. package/dist/components/tiptap-icons/external-link-icon.d.ts +1 -0
  54. package/dist/components/tiptap-icons/external-link-icon.js +36 -0
  55. package/dist/components/tiptap-icons/heading-five-icon.d.ts +1 -0
  56. package/dist/components/tiptap-icons/heading-five-icon.js +36 -0
  57. package/dist/components/tiptap-icons/heading-four-icon.d.ts +1 -0
  58. package/dist/components/tiptap-icons/heading-four-icon.js +36 -0
  59. package/dist/components/tiptap-icons/heading-icon.d.ts +1 -0
  60. package/dist/components/tiptap-icons/heading-icon.js +27 -0
  61. package/dist/components/tiptap-icons/heading-one-icon.d.ts +1 -0
  62. package/dist/components/tiptap-icons/heading-one-icon.js +36 -0
  63. package/dist/components/tiptap-icons/heading-six-icon.d.ts +1 -0
  64. package/dist/components/tiptap-icons/heading-six-icon.js +38 -0
  65. package/dist/components/tiptap-icons/heading-three-icon.d.ts +1 -0
  66. package/dist/components/tiptap-icons/heading-three-icon.js +47 -0
  67. package/dist/components/tiptap-icons/heading-two-icon.d.ts +1 -0
  68. package/dist/components/tiptap-icons/heading-two-icon.js +36 -0
  69. package/dist/components/tiptap-icons/highlighter-icon.d.ts +1 -0
  70. package/dist/components/tiptap-icons/highlighter-icon.js +29 -0
  71. package/dist/components/tiptap-icons/image-plus-icon.d.ts +1 -0
  72. package/dist/components/tiptap-icons/image-plus-icon.js +29 -0
  73. package/dist/components/tiptap-icons/italic-icon.d.ts +1 -0
  74. package/dist/components/tiptap-icons/italic-icon.js +27 -0
  75. package/dist/components/tiptap-icons/link-icon.d.ts +1 -0
  76. package/dist/components/tiptap-icons/link-icon.js +36 -0
  77. package/dist/components/tiptap-icons/list-icon.d.ts +1 -0
  78. package/dist/components/tiptap-icons/list-icon.js +76 -0
  79. package/dist/components/tiptap-icons/list-ordered-icon.d.ts +1 -0
  80. package/dist/components/tiptap-icons/list-ordered-icon.js +76 -0
  81. package/dist/components/tiptap-icons/list-todo-icon.d.ts +1 -0
  82. package/dist/components/tiptap-icons/list-todo-icon.js +67 -0
  83. package/dist/components/tiptap-icons/merge-table-cells-icon.d.ts +1 -0
  84. package/dist/components/tiptap-icons/merge-table-cells-icon.js +26 -0
  85. package/dist/components/tiptap-icons/moon-star-icon.d.ts +1 -0
  86. package/dist/components/tiptap-icons/moon-star-icon.js +38 -0
  87. package/dist/components/tiptap-icons/redo2-icon.d.ts +1 -0
  88. package/dist/components/tiptap-icons/redo2-icon.js +29 -0
  89. package/dist/components/tiptap-icons/remove-table-icon.d.ts +1 -0
  90. package/dist/components/tiptap-icons/remove-table-icon.js +26 -0
  91. package/dist/components/tiptap-icons/split-table-cells-icon copy.d.ts +1 -0
  92. package/dist/components/tiptap-icons/split-table-cells-icon copy.js +30 -0
  93. package/dist/components/tiptap-icons/strike-icon.d.ts +1 -0
  94. package/dist/components/tiptap-icons/strike-icon.js +36 -0
  95. package/dist/components/tiptap-icons/subscript-icon.d.ts +1 -0
  96. package/dist/components/tiptap-icons/subscript-icon.js +49 -0
  97. package/dist/components/tiptap-icons/sun-icon.d.ts +1 -0
  98. package/dist/components/tiptap-icons/sun-icon.js +87 -0
  99. package/dist/components/tiptap-icons/superscript-icon.d.ts +1 -0
  100. package/dist/components/tiptap-icons/superscript-icon.js +49 -0
  101. package/dist/components/tiptap-icons/table-icon.d.ts +3 -0
  102. package/dist/components/tiptap-icons/table-icon.js +24 -0
  103. package/dist/components/tiptap-icons/trash-icon.d.ts +1 -0
  104. package/dist/components/tiptap-icons/trash-icon.js +29 -0
  105. package/dist/components/tiptap-icons/underline-icon.d.ts +1 -0
  106. package/dist/components/tiptap-icons/underline-icon.js +29 -0
  107. package/dist/components/tiptap-icons/undo2-icon.d.ts +1 -0
  108. package/dist/components/tiptap-icons/undo2-icon.js +29 -0
  109. package/dist/components/tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.d.ts +2 -0
  110. package/dist/components/tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.js +67 -0
  111. package/dist/components/tiptap-node/image-upload-node/image-upload-node-extension.d.ts +58 -0
  112. package/dist/components/tiptap-node/image-upload-node/image-upload-node-extension.js +77 -0
  113. package/dist/components/tiptap-node/image-upload-node/image-upload-node.d.ts +68 -0
  114. package/dist/components/tiptap-node/image-upload-node/image-upload-node.js +329 -0
  115. package/dist/components/tiptap-node/image-upload-node/index.d.ts +1 -0
  116. package/dist/components/tiptap-node/image-upload-node/index.js +4 -0
  117. package/dist/components/tiptap-templates/simple/simple-editor.d.ts +8 -0
  118. package/dist/components/tiptap-templates/simple/simple-editor.js +1956 -0
  119. package/dist/components/tiptap-templates/simple/theme-toggle.d.ts +1 -0
  120. package/dist/components/tiptap-templates/simple/theme-toggle.js +28 -0
  121. package/dist/components/tiptap-ui/blockquote-button/blockquote-button.d.ts +22 -0
  122. package/dist/components/tiptap-ui/blockquote-button/blockquote-button.js +71 -0
  123. package/dist/components/tiptap-ui/blockquote-button/index.d.ts +2 -0
  124. package/dist/components/tiptap-ui/blockquote-button/index.js +11 -0
  125. package/dist/components/tiptap-ui/blockquote-button/use-blockquote.d.ts +80 -0
  126. package/dist/components/tiptap-ui/blockquote-button/use-blockquote.js +82 -0
  127. package/dist/components/tiptap-ui/code-block-button/code-block-button.d.ts +22 -0
  128. package/dist/components/tiptap-ui/code-block-button/code-block-button.js +71 -0
  129. package/dist/components/tiptap-ui/code-block-button/index.d.ts +2 -0
  130. package/dist/components/tiptap-ui/code-block-button/index.js +11 -0
  131. package/dist/components/tiptap-ui/code-block-button/use-code-block.d.ts +87 -0
  132. package/dist/components/tiptap-ui/code-block-button/use-code-block.js +83 -0
  133. package/dist/components/tiptap-ui/color-highlight-button/color-highlight-button.d.ts +45 -0
  134. package/dist/components/tiptap-ui/color-highlight-button/color-highlight-button.js +89 -0
  135. package/dist/components/tiptap-ui/color-highlight-button/index.d.ts +2 -0
  136. package/dist/components/tiptap-ui/color-highlight-button/index.js +14 -0
  137. package/dist/components/tiptap-ui/color-highlight-button/use-color-highlight.d.ts +82 -0
  138. package/dist/components/tiptap-ui/color-highlight-button/use-color-highlight.js +176 -0
  139. package/dist/components/tiptap-ui/color-highlight-popover/color-highlight-popover.d.ts +25 -0
  140. package/dist/components/tiptap-ui/color-highlight-popover/color-highlight-popover.js +136 -0
  141. package/dist/components/tiptap-ui/color-highlight-popover/index.d.ts +1 -0
  142. package/dist/components/tiptap-ui/color-highlight-popover/index.js +6 -0
  143. package/dist/components/tiptap-ui/heading-button/heading-button.d.ts +23 -0
  144. package/dist/components/tiptap-ui/heading-button/heading-button.js +74 -0
  145. package/dist/components/tiptap-ui/heading-button/index.d.ts +2 -0
  146. package/dist/components/tiptap-ui/heading-button/index.js +13 -0
  147. package/dist/components/tiptap-ui/heading-button/use-heading.d.ts +108 -0
  148. package/dist/components/tiptap-ui/heading-button/use-heading.js +112 -0
  149. package/dist/components/tiptap-ui/heading-dropdown-menu/heading-dropdown-menu.d.ts +20 -0
  150. package/dist/components/tiptap-ui/heading-dropdown-menu/heading-dropdown-menu.js +67 -0
  151. package/dist/components/tiptap-ui/heading-dropdown-menu/index.d.ts +2 -0
  152. package/dist/components/tiptap-ui/heading-dropdown-menu/index.js +7 -0
  153. package/dist/components/tiptap-ui/heading-dropdown-menu/use-heading-dropdown-menu.d.ts +73 -0
  154. package/dist/components/tiptap-ui/heading-dropdown-menu/use-heading-dropdown-menu.js +38 -0
  155. package/dist/components/tiptap-ui/image-upload-button/image-upload-button.d.ts +29 -0
  156. package/dist/components/tiptap-ui/image-upload-button/image-upload-button.js +72 -0
  157. package/dist/components/tiptap-ui/image-upload-button/index.d.ts +2 -0
  158. package/dist/components/tiptap-ui/image-upload-button/index.js +12 -0
  159. package/dist/components/tiptap-ui/image-upload-button/use-image-upload.d.ts +84 -0
  160. package/dist/components/tiptap-ui/image-upload-button/use-image-upload.js +76 -0
  161. package/dist/components/tiptap-ui/insert-table-button/insert-table-button.d.ts +4 -0
  162. package/dist/components/tiptap-ui/insert-table-button/insert-table-button.js +41 -0
  163. package/dist/components/tiptap-ui/link-popover/index.d.ts +2 -0
  164. package/dist/components/tiptap-ui/link-popover/index.js +13 -0
  165. package/dist/components/tiptap-ui/link-popover/link-popover.d.ts +57 -0
  166. package/dist/components/tiptap-ui/link-popover/link-popover.js +193 -0
  167. package/dist/components/tiptap-ui/link-popover/use-link-popover.d.ts +117 -0
  168. package/dist/components/tiptap-ui/link-popover/use-link-popover.js +103 -0
  169. package/dist/components/tiptap-ui/list-button/index.d.ts +2 -0
  170. package/dist/components/tiptap-ui/list-button/index.js +14 -0
  171. package/dist/components/tiptap-ui/list-button/list-button.d.ts +23 -0
  172. package/dist/components/tiptap-ui/list-button/list-button.js +74 -0
  173. package/dist/components/tiptap-ui/list-button/use-list.d.ts +97 -0
  174. package/dist/components/tiptap-ui/list-button/use-list.js +149 -0
  175. package/dist/components/tiptap-ui/list-dropdown-menu/index.d.ts +1 -0
  176. package/dist/components/tiptap-ui/list-dropdown-menu/index.js +4 -0
  177. package/dist/components/tiptap-ui/list-dropdown-menu/list-dropdown-menu.d.ts +29 -0
  178. package/dist/components/tiptap-ui/list-dropdown-menu/list-dropdown-menu.js +63 -0
  179. package/dist/components/tiptap-ui/list-dropdown-menu/use-list-dropdown-menu.d.ts +90 -0
  180. package/dist/components/tiptap-ui/list-dropdown-menu/use-list-dropdown-menu.js +84 -0
  181. package/dist/components/tiptap-ui/mark-button/index.d.ts +2 -0
  182. package/dist/components/tiptap-ui/mark-button/index.js +14 -0
  183. package/dist/components/tiptap-ui/mark-button/mark-button.d.ts +23 -0
  184. package/dist/components/tiptap-ui/mark-button/mark-button.js +74 -0
  185. package/dist/components/tiptap-ui/mark-button/use-mark.d.ts +104 -0
  186. package/dist/components/tiptap-ui/mark-button/use-mark.js +84 -0
  187. package/dist/components/tiptap-ui/table-actions-toolbar/add-column-after-button.d.ts +4 -0
  188. package/dist/components/tiptap-ui/table-actions-toolbar/add-column-after-button.js +7 -0
  189. package/dist/components/tiptap-ui/table-actions-toolbar/add-column-before-button.d.ts +4 -0
  190. package/dist/components/tiptap-ui/table-actions-toolbar/add-column-before-button.js +7 -0
  191. package/dist/components/tiptap-ui/table-actions-toolbar/add-row-after-button.d.ts +4 -0
  192. package/dist/components/tiptap-ui/table-actions-toolbar/add-row-after-button.js +7 -0
  193. package/dist/components/tiptap-ui/table-actions-toolbar/add-row-before-button.d.ts +4 -0
  194. package/dist/components/tiptap-ui/table-actions-toolbar/add-row-before-button.js +7 -0
  195. package/dist/components/tiptap-ui/table-actions-toolbar/delete-column-button.d.ts +4 -0
  196. package/dist/components/tiptap-ui/table-actions-toolbar/delete-column-button.js +7 -0
  197. package/dist/components/tiptap-ui/table-actions-toolbar/delete-row-button.d.ts +4 -0
  198. package/dist/components/tiptap-ui/table-actions-toolbar/delete-row-button.js +7 -0
  199. package/dist/components/tiptap-ui/table-actions-toolbar/get-table-node-and-pos.d.ts +6 -0
  200. package/dist/components/tiptap-ui/table-actions-toolbar/get-table-node-and-pos.js +15 -0
  201. package/dist/components/tiptap-ui/table-actions-toolbar/merge-cells-button.d.ts +4 -0
  202. package/dist/components/tiptap-ui/table-actions-toolbar/merge-cells-button.js +7 -0
  203. package/dist/components/tiptap-ui/table-actions-toolbar/remove-table-button.d.ts +4 -0
  204. package/dist/components/tiptap-ui/table-actions-toolbar/remove-table-button.js +7 -0
  205. package/dist/components/tiptap-ui/table-actions-toolbar/split-table-cells-button.d.ts +4 -0
  206. package/dist/components/tiptap-ui/table-actions-toolbar/split-table-cells-button.js +7 -0
  207. package/dist/components/tiptap-ui/table-actions-toolbar/table-actions-toolbar.d.ts +2 -0
  208. package/dist/components/tiptap-ui/table-actions-toolbar/table-actions-toolbar.js +75 -0
  209. package/dist/components/tiptap-ui/text-align-button/index.d.ts +2 -0
  210. package/dist/components/tiptap-ui/text-align-button/index.js +15 -0
  211. package/dist/components/tiptap-ui/text-align-button/text-align-button.d.ts +30 -0
  212. package/dist/components/tiptap-ui/text-align-button/text-align-button.js +81 -0
  213. package/dist/components/tiptap-ui/text-align-button/use-text-align.d.ts +101 -0
  214. package/dist/components/tiptap-ui/text-align-button/use-text-align.js +84 -0
  215. package/dist/components/tiptap-ui/undo-redo-button/index.d.ts +2 -0
  216. package/dist/components/tiptap-ui/undo-redo-button/index.js +13 -0
  217. package/dist/components/tiptap-ui/undo-redo-button/undo-redo-button.d.ts +23 -0
  218. package/dist/components/tiptap-ui/undo-redo-button/undo-redo-button.js +70 -0
  219. package/dist/components/tiptap-ui/undo-redo-button/use-undo-redo.d.ts +90 -0
  220. package/dist/components/tiptap-ui/undo-redo-button/use-undo-redo.js +67 -0
  221. package/dist/components/tiptap-ui-primitive/badge/badge.d.ts +8 -0
  222. package/dist/components/tiptap-ui-primitive/badge/badge.js +30 -0
  223. package/dist/components/tiptap-ui-primitive/badge/index.d.ts +1 -0
  224. package/dist/components/tiptap-ui-primitive/badge/index.js +4 -0
  225. package/dist/components/tiptap-ui-primitive/button/button.d.ts +14 -0
  226. package/dist/components/tiptap-ui-primitive/button/button.js +69 -0
  227. package/dist/components/tiptap-ui-primitive/button/index.d.ts +1 -0
  228. package/dist/components/tiptap-ui-primitive/button/index.js +6 -0
  229. package/dist/components/tiptap-ui-primitive/card/card.d.ts +9 -0
  230. package/dist/components/tiptap-ui-primitive/card/card.js +62 -0
  231. package/dist/components/tiptap-ui-primitive/card/index.d.ts +1 -0
  232. package/dist/components/tiptap-ui-primitive/card/index.js +9 -0
  233. package/dist/components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.d.ts +16 -0
  234. package/dist/components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.js +1028 -0
  235. package/dist/components/tiptap-ui-primitive/dropdown-menu/index.d.ts +1 -0
  236. package/dist/components/tiptap-ui-primitive/dropdown-menu/index.js +13 -0
  237. package/dist/components/tiptap-ui-primitive/input/index.d.ts +1 -0
  238. package/dist/components/tiptap-ui-primitive/input/index.js +5 -0
  239. package/dist/components/tiptap-ui-primitive/input/input.d.ts +3 -0
  240. package/dist/components/tiptap-ui-primitive/input/input.js +16 -0
  241. package/dist/components/tiptap-ui-primitive/popover/index.d.ts +1 -0
  242. package/dist/components/tiptap-ui-primitive/popover/index.js +6 -0
  243. package/dist/components/tiptap-ui-primitive/popover/popover.d.ts +5 -0
  244. package/dist/components/tiptap-ui-primitive/popover/popover.js +244 -0
  245. package/dist/components/tiptap-ui-primitive/separator/index.d.ts +1 -0
  246. package/dist/components/tiptap-ui-primitive/separator/index.js +4 -0
  247. package/dist/components/tiptap-ui-primitive/separator/separator.d.ts +6 -0
  248. package/dist/components/tiptap-ui-primitive/separator/separator.js +22 -0
  249. package/dist/components/tiptap-ui-primitive/spacer/index.d.ts +1 -0
  250. package/dist/components/tiptap-ui-primitive/spacer/index.js +4 -0
  251. package/dist/components/tiptap-ui-primitive/spacer/spacer.d.ts +6 -0
  252. package/dist/components/tiptap-ui-primitive/spacer/spacer.js +20 -0
  253. package/dist/components/tiptap-ui-primitive/toolbar/index.d.ts +1 -0
  254. package/dist/components/tiptap-ui-primitive/toolbar/index.js +6 -0
  255. package/dist/components/tiptap-ui-primitive/toolbar/toolbar.d.ts +8 -0
  256. package/dist/components/tiptap-ui-primitive/toolbar/toolbar.js +83 -0
  257. package/dist/components/tiptap-ui-primitive/tooltip/index.d.ts +1 -0
  258. package/dist/components/tiptap-ui-primitive/tooltip/index.js +6 -0
  259. package/dist/components/tiptap-ui-primitive/tooltip/tooltip.d.ts +28 -0
  260. package/dist/components/tiptap-ui-primitive/tooltip/tooltip.js +1374 -0
  261. package/dist/floating-ui.react-dom-DgOuULHo.js +1334 -0
  262. package/dist/hooks/use-composed-ref.d.ts +3 -0
  263. package/dist/hooks/use-composed-ref.js +16 -0
  264. package/dist/hooks/use-cursor-visibility.d.ts +20 -0
  265. package/dist/hooks/use-cursor-visibility.js +31 -0
  266. package/dist/hooks/use-element-rect.d.ts +35 -0
  267. package/dist/hooks/use-element-rect.js +79 -0
  268. package/dist/hooks/use-menu-navigation.d.ts +52 -0
  269. package/dist/hooks/use-menu-navigation.js +68 -0
  270. package/dist/hooks/use-mobile.d.ts +1 -0
  271. package/dist/hooks/use-mobile.js +13 -0
  272. package/dist/hooks/use-scrolling.d.ts +8 -0
  273. package/dist/hooks/use-scrolling.js +17 -0
  274. package/dist/hooks/use-throttled-callback.d.ts +18 -0
  275. package/dist/hooks/use-throttled-callback.js +116 -0
  276. package/dist/hooks/use-tiptap-editor.d.ts +17 -0
  277. package/dist/hooks/use-tiptap-editor.js +25 -0
  278. package/dist/hooks/use-unmount.d.ts +7 -0
  279. package/dist/hooks/use-unmount.js +14 -0
  280. package/dist/hooks/use-window-size.d.ts +35 -0
  281. package/dist/hooks/use-window-size.js +33 -0
  282. package/dist/index-Bqw9S4qP.js +238 -0
  283. package/dist/lib/tiptap-utils.d.ts +160 -0
  284. package/dist/lib/tiptap-utils.js +229 -0
  285. package/dist/main.d.ts +1 -0
  286. package/dist/main.js +4 -0
  287. package/package.json +67 -0
@@ -0,0 +1,1374 @@
1
+ import { jsxs as ot, jsx as K } from "react/jsx-runtime";
2
+ import * as a from "react";
3
+ import { useLayoutEffect as st, createContext as it, forwardRef as _e, isValidElement as xe, version as ut, cloneElement as at, useContext as ct, useState as lt, useMemo as ft } from "react";
4
+ import { i as dt, a as Re, b as vt, u as mt, c as A, g as pt, d as se, e as gt, f as ie, h as bt, j as ht, o as Rt, k as Et, s as yt, l as Ct } from "../../../floating-ui.react-dom-DgOuULHo.js";
5
+ import * as xt from "react-dom";
6
+ import '../../../assets/tooltip.css';var wt = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])", "a[href]:not([inert])", "button:not([inert])", "[tabindex]:not(slot):not([inert])", "audio[controls]:not([inert])", "video[controls]:not([inert])", '[contenteditable]:not([contenteditable="false"]):not([inert])', "details>summary:first-of-type:not([inert])", "details:not([inert])"], ve = /* @__PURE__ */ wt.join(","), Be = typeof Element > "u", z = Be ? function() {
7
+ } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, re = !Be && Element.prototype.getRootNode ? function(t) {
8
+ var e;
9
+ return t == null || (e = t.getRootNode) === null || e === void 0 ? void 0 : e.call(t);
10
+ } : function(t) {
11
+ return t?.ownerDocument;
12
+ }, Q = function(e, n) {
13
+ var r;
14
+ n === void 0 && (n = !0);
15
+ var o = e == null || (r = e.getAttribute) === null || r === void 0 ? void 0 : r.call(e, "inert"), i = o === "" || o === "true", s = i || n && e && Q(e.parentNode);
16
+ return s;
17
+ }, Tt = function(e) {
18
+ var n, r = e == null || (n = e.getAttribute) === null || n === void 0 ? void 0 : n.call(e, "contenteditable");
19
+ return r === "" || r === "true";
20
+ }, St = function(e, n, r) {
21
+ if (Q(e))
22
+ return [];
23
+ var o = Array.prototype.slice.apply(e.querySelectorAll(ve));
24
+ return n && z.call(e, ve) && o.unshift(e), o = o.filter(r), o;
25
+ }, me = function(e, n, r) {
26
+ for (var o = [], i = Array.from(e); i.length; ) {
27
+ var s = i.shift();
28
+ if (!Q(s, !1))
29
+ if (s.tagName === "SLOT") {
30
+ var u = s.assignedElements(), c = u.length ? u : s.children, l = me(c, !0, r);
31
+ r.flatten ? o.push.apply(o, l) : o.push({
32
+ scopeParent: s,
33
+ candidates: l
34
+ });
35
+ } else {
36
+ var v = z.call(s, ve);
37
+ v && r.filter(s) && (n || !e.includes(s)) && o.push(s);
38
+ var p = s.shadowRoot || // check for an undisclosed shadow
39
+ typeof r.getShadowRoot == "function" && r.getShadowRoot(s), h = !Q(p, !1) && (!r.shadowRootFilter || r.shadowRootFilter(s));
40
+ if (p && h) {
41
+ var f = me(p === !0 ? s.children : p.children, !0, r);
42
+ r.flatten ? o.push.apply(o, f) : o.push({
43
+ scopeParent: s,
44
+ candidates: f
45
+ });
46
+ } else
47
+ i.unshift.apply(i, s.children);
48
+ }
49
+ }
50
+ return o;
51
+ }, Ke = function(e) {
52
+ return !isNaN(parseInt(e.getAttribute("tabindex"), 10));
53
+ }, Ve = function(e) {
54
+ if (!e)
55
+ throw new Error("No node provided");
56
+ return e.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName) || Tt(e)) && !Ke(e) ? 0 : e.tabIndex;
57
+ }, It = function(e, n) {
58
+ var r = Ve(e);
59
+ return r < 0 && n && !Ke(e) ? 0 : r;
60
+ }, Pt = function(e, n) {
61
+ return e.tabIndex === n.tabIndex ? e.documentOrder - n.documentOrder : e.tabIndex - n.tabIndex;
62
+ }, $e = function(e) {
63
+ return e.tagName === "INPUT";
64
+ }, Mt = function(e) {
65
+ return $e(e) && e.type === "hidden";
66
+ }, Lt = function(e) {
67
+ var n = e.tagName === "DETAILS" && Array.prototype.slice.apply(e.children).some(function(r) {
68
+ return r.tagName === "SUMMARY";
69
+ });
70
+ return n;
71
+ }, Ot = function(e, n) {
72
+ for (var r = 0; r < e.length; r++)
73
+ if (e[r].checked && e[r].form === n)
74
+ return e[r];
75
+ }, At = function(e) {
76
+ if (!e.name)
77
+ return !0;
78
+ var n = e.form || re(e), r = function(u) {
79
+ return n.querySelectorAll('input[type="radio"][name="' + u + '"]');
80
+ }, o;
81
+ if (typeof window < "u" && typeof window.CSS < "u" && typeof window.CSS.escape == "function")
82
+ o = r(window.CSS.escape(e.name));
83
+ else
84
+ try {
85
+ o = r(e.name);
86
+ } catch (s) {
87
+ return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", s.message), !1;
88
+ }
89
+ var i = Ot(o, e.form);
90
+ return !i || i === e;
91
+ }, Dt = function(e) {
92
+ return $e(e) && e.type === "radio";
93
+ }, Nt = function(e) {
94
+ return Dt(e) && !At(e);
95
+ }, Ft = function(e) {
96
+ var n, r = e && re(e), o = (n = r) === null || n === void 0 ? void 0 : n.host, i = !1;
97
+ if (r && r !== e) {
98
+ var s, u, c;
99
+ for (i = !!((s = o) !== null && s !== void 0 && (u = s.ownerDocument) !== null && u !== void 0 && u.contains(o) || e != null && (c = e.ownerDocument) !== null && c !== void 0 && c.contains(e)); !i && o; ) {
100
+ var l, v, p;
101
+ r = re(o), o = (l = r) === null || l === void 0 ? void 0 : l.host, i = !!((v = o) !== null && v !== void 0 && (p = v.ownerDocument) !== null && p !== void 0 && p.contains(o));
102
+ }
103
+ }
104
+ return i;
105
+ }, we = function(e) {
106
+ var n = e.getBoundingClientRect(), r = n.width, o = n.height;
107
+ return r === 0 && o === 0;
108
+ }, kt = function(e, n) {
109
+ var r = n.displayCheck, o = n.getShadowRoot;
110
+ if (r === "full-native" && "checkVisibility" in e) {
111
+ var i = e.checkVisibility({
112
+ // Checking opacity might be desirable for some use cases, but natively,
113
+ // opacity zero elements _are_ focusable and tabbable.
114
+ checkOpacity: !1,
115
+ opacityProperty: !1,
116
+ contentVisibilityAuto: !0,
117
+ visibilityProperty: !0,
118
+ // This is an alias for `visibilityProperty`. Contemporary browsers
119
+ // support both. However, this alias has wider browser support (Chrome
120
+ // >= 105 and Firefox >= 106, vs. Chrome >= 121 and Firefox >= 122), so
121
+ // we include it anyway.
122
+ checkVisibilityCSS: !0
123
+ });
124
+ return !i;
125
+ }
126
+ if (getComputedStyle(e).visibility === "hidden")
127
+ return !0;
128
+ var s = z.call(e, "details>summary:first-of-type"), u = s ? e.parentElement : e;
129
+ if (z.call(u, "details:not([open]) *"))
130
+ return !0;
131
+ if (!r || r === "full" || // full-native can run this branch when it falls through in case
132
+ // Element#checkVisibility is unsupported
133
+ r === "full-native" || r === "legacy-full") {
134
+ if (typeof o == "function") {
135
+ for (var c = e; e; ) {
136
+ var l = e.parentElement, v = re(e);
137
+ if (l && !l.shadowRoot && o(l) === !0)
138
+ return we(e);
139
+ e.assignedSlot ? e = e.assignedSlot : !l && v !== e.ownerDocument ? e = v.host : e = l;
140
+ }
141
+ e = c;
142
+ }
143
+ if (Ft(e))
144
+ return !e.getClientRects().length;
145
+ if (r !== "legacy-full")
146
+ return !0;
147
+ } else if (r === "non-zero-area")
148
+ return we(e);
149
+ return !1;
150
+ }, _t = function(e) {
151
+ if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))
152
+ for (var n = e.parentElement; n; ) {
153
+ if (n.tagName === "FIELDSET" && n.disabled) {
154
+ for (var r = 0; r < n.children.length; r++) {
155
+ var o = n.children.item(r);
156
+ if (o.tagName === "LEGEND")
157
+ return z.call(n, "fieldset[disabled] *") ? !0 : !o.contains(e);
158
+ }
159
+ return !0;
160
+ }
161
+ n = n.parentElement;
162
+ }
163
+ return !1;
164
+ }, Bt = function(e, n) {
165
+ return !(n.disabled || // we must do an inert look up to filter out any elements inside an inert ancestor
166
+ // because we're limited in the type of selectors we can use in JSDom (see related
167
+ // note related to `candidateSelectors`)
168
+ Q(n) || Mt(n) || kt(n, e) || // For a details element with a summary, the summary element gets the focus
169
+ Lt(n) || _t(n));
170
+ }, Te = function(e, n) {
171
+ return !(Nt(n) || Ve(n) < 0 || !Bt(e, n));
172
+ }, Kt = function(e) {
173
+ var n = parseInt(e.getAttribute("tabindex"), 10);
174
+ return !!(isNaN(n) || n >= 0);
175
+ }, Ue = function(e) {
176
+ var n = [], r = [];
177
+ return e.forEach(function(o, i) {
178
+ var s = !!o.scopeParent, u = s ? o.scopeParent : o, c = It(u, s), l = s ? Ue(o.candidates) : u;
179
+ c === 0 ? s ? n.push.apply(n, l) : n.push(u) : r.push({
180
+ documentOrder: i,
181
+ tabIndex: c,
182
+ item: o,
183
+ isScope: s,
184
+ content: l
185
+ });
186
+ }), r.sort(Pt).reduce(function(o, i) {
187
+ return i.isScope ? o.push.apply(o, i.content) : o.push(i.content), o;
188
+ }, []).concat(n);
189
+ }, We = function(e, n) {
190
+ n = n || {};
191
+ var r;
192
+ return n.getShadowRoot ? r = me([e], n.includeContainer, {
193
+ filter: Te.bind(null, n),
194
+ flatten: !1,
195
+ getShadowRoot: n.getShadowRoot,
196
+ shadowRootFilter: Kt
197
+ }) : r = St(e, n.includeContainer, Te.bind(null, n)), Ue(r);
198
+ };
199
+ function Vt() {
200
+ const t = navigator.userAgentData;
201
+ return t != null && t.platform ? t.platform : navigator.platform;
202
+ }
203
+ function $t() {
204
+ const t = navigator.userAgentData;
205
+ return t && Array.isArray(t.brands) ? t.brands.map((e) => {
206
+ let {
207
+ brand: n,
208
+ version: r
209
+ } = e;
210
+ return n + "/" + r;
211
+ }).join(" ") : navigator.userAgent;
212
+ }
213
+ function Ye() {
214
+ return /apple/i.test(navigator.vendor);
215
+ }
216
+ function Ut() {
217
+ return Vt().toLowerCase().startsWith("mac") && !navigator.maxTouchPoints;
218
+ }
219
+ function Wt() {
220
+ return $t().includes("jsdom/");
221
+ }
222
+ const Se = "data-floating-ui-focusable", Yt = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
223
+ function pe(t) {
224
+ let e = t.activeElement;
225
+ for (; ((n = e) == null || (n = n.shadowRoot) == null ? void 0 : n.activeElement) != null; ) {
226
+ var n;
227
+ e = e.shadowRoot.activeElement;
228
+ }
229
+ return e;
230
+ }
231
+ function Z(t, e) {
232
+ if (!t || !e)
233
+ return !1;
234
+ const n = e.getRootNode == null ? void 0 : e.getRootNode();
235
+ if (t.contains(e))
236
+ return !0;
237
+ if (n && dt(n)) {
238
+ let r = e;
239
+ for (; r; ) {
240
+ if (t === r)
241
+ return !0;
242
+ r = r.parentNode || r.host;
243
+ }
244
+ }
245
+ return !1;
246
+ }
247
+ function X(t) {
248
+ return "composedPath" in t ? t.composedPath()[0] : t.target;
249
+ }
250
+ function ue(t, e) {
251
+ if (e == null)
252
+ return !1;
253
+ if ("composedPath" in t)
254
+ return t.composedPath().includes(e);
255
+ const n = t;
256
+ return n.target != null && e.contains(n.target);
257
+ }
258
+ function Ht(t) {
259
+ return t.matches("html,body");
260
+ }
261
+ function W(t) {
262
+ return t?.ownerDocument || document;
263
+ }
264
+ function jt(t) {
265
+ return Re(t) && t.matches(Yt);
266
+ }
267
+ function qt(t) {
268
+ if (!t || Wt()) return !0;
269
+ try {
270
+ return t.matches(":focus-visible");
271
+ } catch {
272
+ return !0;
273
+ }
274
+ }
275
+ function Gt(t) {
276
+ return t ? t.hasAttribute(Se) ? t : t.querySelector("[" + Se + "]") || t : null;
277
+ }
278
+ function ne(t, e, n) {
279
+ return n === void 0 && (n = !0), t.filter((o) => {
280
+ var i;
281
+ return o.parentId === e && (!n || ((i = o.context) == null ? void 0 : i.open));
282
+ }).flatMap((o) => [o, ...ne(t, o.id, n)]);
283
+ }
284
+ function Xt(t) {
285
+ return "nativeEvent" in t;
286
+ }
287
+ function ge(t, e) {
288
+ const n = ["mouse", "pen"];
289
+ return n.push("", void 0), n.includes(t);
290
+ }
291
+ var Zt = typeof document < "u", Jt = function() {
292
+ }, V = Zt ? st : Jt;
293
+ const zt = {
294
+ ...a
295
+ };
296
+ function te(t) {
297
+ const e = a.useRef(t);
298
+ return V(() => {
299
+ e.current = t;
300
+ }), e;
301
+ }
302
+ const Qt = zt.useInsertionEffect, en = Qt || ((t) => t());
303
+ function U(t) {
304
+ const e = a.useRef(() => {
305
+ if (process.env.NODE_ENV !== "production")
306
+ throw new Error("Cannot call an event handler while rendering.");
307
+ });
308
+ return en(() => {
309
+ e.current = t;
310
+ }), a.useCallback(function() {
311
+ for (var n = arguments.length, r = new Array(n), o = 0; o < n; o++)
312
+ r[o] = arguments[o];
313
+ return e.current == null ? void 0 : e.current(...r);
314
+ }, []);
315
+ }
316
+ const He = () => ({
317
+ getShadowRoot: !0,
318
+ displayCheck: (
319
+ // JSDOM does not support the `tabbable` library. To solve this we can
320
+ // check if `ResizeObserver` is a real function (not polyfilled), which
321
+ // determines if the current environment is JSDOM-like.
322
+ typeof ResizeObserver == "function" && ResizeObserver.toString().includes("[native code]") ? "full" : "none"
323
+ )
324
+ });
325
+ function je(t, e) {
326
+ const n = We(t, He()), r = n.length;
327
+ if (r === 0) return;
328
+ const o = pe(W(t)), i = n.indexOf(o), s = i === -1 ? e === 1 ? 0 : r - 1 : i + e;
329
+ return n[s];
330
+ }
331
+ function tn(t) {
332
+ return je(W(t).body, 1) || t;
333
+ }
334
+ function nn(t) {
335
+ return je(W(t).body, -1) || t;
336
+ }
337
+ function ae(t, e) {
338
+ const n = e || t.currentTarget, r = t.relatedTarget;
339
+ return !r || !Z(n, r);
340
+ }
341
+ function rn(t) {
342
+ We(t, He()).forEach((n) => {
343
+ n.dataset.tabindex = n.getAttribute("tabindex") || "", n.setAttribute("tabindex", "-1");
344
+ });
345
+ }
346
+ function Ie(t) {
347
+ t.querySelectorAll("[data-tabindex]").forEach((n) => {
348
+ const r = n.dataset.tabindex;
349
+ delete n.dataset.tabindex, r ? n.setAttribute("tabindex", r) : n.removeAttribute("tabindex");
350
+ });
351
+ }
352
+ function qe(t) {
353
+ const e = a.useRef(void 0), n = a.useCallback((r) => {
354
+ const o = t.map((i) => {
355
+ if (i != null) {
356
+ if (typeof i == "function") {
357
+ const s = i, u = s(r);
358
+ return typeof u == "function" ? u : () => {
359
+ s(null);
360
+ };
361
+ }
362
+ return i.current = r, () => {
363
+ i.current = null;
364
+ };
365
+ }
366
+ });
367
+ return () => {
368
+ o.forEach((i) => i?.());
369
+ };
370
+ }, t);
371
+ return a.useMemo(() => t.every((r) => r == null) ? null : (r) => {
372
+ e.current && (e.current(), e.current = void 0), r != null && (e.current = n(r));
373
+ }, t);
374
+ }
375
+ const on = "data-floating-ui-focusable", Pe = "active", Me = "selected", sn = {
376
+ ...a
377
+ };
378
+ let Le = !1, un = 0;
379
+ const Oe = () => (
380
+ // Ensure the id is unique with multiple independent versions of Floating UI
381
+ // on <React 18
382
+ "floating-ui-" + Math.random().toString(36).slice(2, 6) + un++
383
+ );
384
+ function an() {
385
+ const [t, e] = a.useState(() => Le ? Oe() : void 0);
386
+ return V(() => {
387
+ t == null && e(Oe());
388
+ }, []), a.useEffect(() => {
389
+ Le = !0;
390
+ }, []), t;
391
+ }
392
+ const cn = sn.useId, Ee = cn || an;
393
+ let be;
394
+ process.env.NODE_ENV !== "production" && (be = /* @__PURE__ */ new Set());
395
+ function ln() {
396
+ for (var t, e = arguments.length, n = new Array(e), r = 0; r < e; r++)
397
+ n[r] = arguments[r];
398
+ const o = "Floating UI: " + n.join(" ");
399
+ if (!((t = be) != null && t.has(o))) {
400
+ var i;
401
+ (i = be) == null || i.add(o), console.error(o);
402
+ }
403
+ }
404
+ function fn() {
405
+ const t = /* @__PURE__ */ new Map();
406
+ return {
407
+ emit(e, n) {
408
+ var r;
409
+ (r = t.get(e)) == null || r.forEach((o) => o(n));
410
+ },
411
+ on(e, n) {
412
+ t.has(e) || t.set(e, /* @__PURE__ */ new Set()), t.get(e).add(n);
413
+ },
414
+ off(e, n) {
415
+ var r;
416
+ (r = t.get(e)) == null || r.delete(n);
417
+ }
418
+ };
419
+ }
420
+ const dn = /* @__PURE__ */ a.createContext(null), vn = /* @__PURE__ */ a.createContext(null), ye = () => {
421
+ var t;
422
+ return ((t = a.useContext(dn)) == null ? void 0 : t.id) || null;
423
+ }, Ce = () => a.useContext(vn);
424
+ function ee(t) {
425
+ return "data-floating-ui-" + t;
426
+ }
427
+ function k(t) {
428
+ t.current !== -1 && (clearTimeout(t.current), t.current = -1);
429
+ }
430
+ const Ae = /* @__PURE__ */ ee("safe-polygon");
431
+ function ce(t, e, n) {
432
+ if (n && !ge(n))
433
+ return 0;
434
+ if (typeof t == "number")
435
+ return t;
436
+ if (typeof t == "function") {
437
+ const r = t();
438
+ return typeof r == "number" ? r : r?.[e];
439
+ }
440
+ return t?.[e];
441
+ }
442
+ function le(t) {
443
+ return typeof t == "function" ? t() : t;
444
+ }
445
+ function mn(t, e) {
446
+ e === void 0 && (e = {});
447
+ const {
448
+ open: n,
449
+ onOpenChange: r,
450
+ dataRef: o,
451
+ events: i,
452
+ elements: s
453
+ } = t, {
454
+ enabled: u = !0,
455
+ delay: c = 0,
456
+ handleClose: l = null,
457
+ mouseOnly: v = !1,
458
+ restMs: p = 0,
459
+ move: h = !0
460
+ } = e, f = Ce(), R = ye(), m = te(l), E = te(c), T = te(n), y = te(p), x = a.useRef(), P = a.useRef(-1), N = a.useRef(), _ = a.useRef(-1), q = a.useRef(!0), F = a.useRef(!1), G = a.useRef(() => {
461
+ }), $ = a.useRef(!1), H = U(() => {
462
+ var g;
463
+ const d = (g = o.current.openEvent) == null ? void 0 : g.type;
464
+ return d?.includes("mouse") && d !== "mousedown";
465
+ });
466
+ a.useEffect(() => {
467
+ if (!u) return;
468
+ function g(d) {
469
+ let {
470
+ open: C
471
+ } = d;
472
+ C || (k(P), k(_), q.current = !0, $.current = !1);
473
+ }
474
+ return i.on("openchange", g), () => {
475
+ i.off("openchange", g);
476
+ };
477
+ }, [u, i]), a.useEffect(() => {
478
+ if (!u || !m.current || !n) return;
479
+ function g(C) {
480
+ H() && r(!1, C, "hover");
481
+ }
482
+ const d = W(s.floating).documentElement;
483
+ return d.addEventListener("mouseleave", g), () => {
484
+ d.removeEventListener("mouseleave", g);
485
+ };
486
+ }, [s.floating, n, r, u, m, H]);
487
+ const j = a.useCallback(function(g, d, C) {
488
+ d === void 0 && (d = !0), C === void 0 && (C = "hover");
489
+ const S = ce(E.current, "close", x.current);
490
+ S && !N.current ? (k(P), P.current = window.setTimeout(() => r(!1, g, C), S)) : d && (k(P), r(!1, g, C));
491
+ }, [E, r]), B = U(() => {
492
+ G.current(), N.current = void 0;
493
+ }), b = U(() => {
494
+ if (F.current) {
495
+ const g = W(s.floating).body;
496
+ g.style.pointerEvents = "", g.removeAttribute(Ae), F.current = !1;
497
+ }
498
+ }), I = U(() => o.current.openEvent ? ["click", "mousedown"].includes(o.current.openEvent.type) : !1);
499
+ a.useEffect(() => {
500
+ if (!u) return;
501
+ function g(w) {
502
+ if (k(P), q.current = !1, v && !ge(x.current) || le(y.current) > 0 && !ce(E.current, "open"))
503
+ return;
504
+ const M = ce(E.current, "open", x.current);
505
+ M ? P.current = window.setTimeout(() => {
506
+ T.current || r(!0, w, "hover");
507
+ }, M) : n || r(!0, w, "hover");
508
+ }
509
+ function d(w) {
510
+ if (I()) {
511
+ b();
512
+ return;
513
+ }
514
+ G.current();
515
+ const M = W(s.floating);
516
+ if (k(_), $.current = !1, m.current && o.current.floatingContext) {
517
+ n || k(P), N.current = m.current({
518
+ ...o.current.floatingContext,
519
+ tree: f,
520
+ x: w.clientX,
521
+ y: w.clientY,
522
+ onClose() {
523
+ b(), B(), I() || j(w, !0, "safe-polygon");
524
+ }
525
+ });
526
+ const L = N.current;
527
+ M.addEventListener("mousemove", L), G.current = () => {
528
+ M.removeEventListener("mousemove", L);
529
+ };
530
+ return;
531
+ }
532
+ (x.current === "touch" ? !Z(s.floating, w.relatedTarget) : !0) && j(w);
533
+ }
534
+ function C(w) {
535
+ I() || o.current.floatingContext && (m.current == null || m.current({
536
+ ...o.current.floatingContext,
537
+ tree: f,
538
+ x: w.clientX,
539
+ y: w.clientY,
540
+ onClose() {
541
+ b(), B(), I() || j(w);
542
+ }
543
+ })(w));
544
+ }
545
+ function S() {
546
+ k(P);
547
+ }
548
+ function D(w) {
549
+ I() || j(w, !1);
550
+ }
551
+ if (A(s.domReference)) {
552
+ const w = s.domReference, M = s.floating;
553
+ return n && w.addEventListener("mouseleave", C), h && w.addEventListener("mousemove", g, {
554
+ once: !0
555
+ }), w.addEventListener("mouseenter", g), w.addEventListener("mouseleave", d), M && (M.addEventListener("mouseleave", C), M.addEventListener("mouseenter", S), M.addEventListener("mouseleave", D)), () => {
556
+ n && w.removeEventListener("mouseleave", C), h && w.removeEventListener("mousemove", g), w.removeEventListener("mouseenter", g), w.removeEventListener("mouseleave", d), M && (M.removeEventListener("mouseleave", C), M.removeEventListener("mouseenter", S), M.removeEventListener("mouseleave", D));
557
+ };
558
+ }
559
+ }, [s, u, t, v, h, j, B, b, r, n, T, f, E, m, o, I, y]), V(() => {
560
+ var g;
561
+ if (u && n && (g = m.current) != null && (g = g.__options) != null && g.blockPointerEvents && H()) {
562
+ F.current = !0;
563
+ const C = s.floating;
564
+ if (A(s.domReference) && C) {
565
+ var d;
566
+ const S = W(s.floating).body;
567
+ S.setAttribute(Ae, "");
568
+ const D = s.domReference, w = f == null || (d = f.nodesRef.current.find((M) => M.id === R)) == null || (d = d.context) == null ? void 0 : d.elements.floating;
569
+ return w && (w.style.pointerEvents = ""), S.style.pointerEvents = "none", D.style.pointerEvents = "auto", C.style.pointerEvents = "auto", () => {
570
+ S.style.pointerEvents = "", D.style.pointerEvents = "", C.style.pointerEvents = "";
571
+ };
572
+ }
573
+ }
574
+ }, [u, n, R, s, f, m, H]), V(() => {
575
+ n || (x.current = void 0, $.current = !1, B(), b());
576
+ }, [n, B, b]), a.useEffect(() => () => {
577
+ B(), k(P), k(_), b();
578
+ }, [u, s.domReference, B, b]);
579
+ const O = a.useMemo(() => {
580
+ function g(d) {
581
+ x.current = d.pointerType;
582
+ }
583
+ return {
584
+ onPointerDown: g,
585
+ onPointerEnter: g,
586
+ onMouseMove(d) {
587
+ const {
588
+ nativeEvent: C
589
+ } = d;
590
+ function S() {
591
+ !q.current && !T.current && r(!0, C, "hover");
592
+ }
593
+ v && !ge(x.current) || n || le(y.current) === 0 || $.current && d.movementX ** 2 + d.movementY ** 2 < 2 || (k(_), x.current === "touch" ? S() : ($.current = !0, _.current = window.setTimeout(S, le(y.current))));
594
+ }
595
+ };
596
+ }, [v, r, n, T, y]);
597
+ return a.useMemo(() => u ? {
598
+ reference: O
599
+ } : {}, [u, O]);
600
+ }
601
+ const De = () => {
602
+ }, pn = /* @__PURE__ */ a.createContext({
603
+ delay: 0,
604
+ initialDelay: 0,
605
+ timeoutMs: 0,
606
+ currentId: null,
607
+ setCurrentId: De,
608
+ setState: De,
609
+ isInstantPhase: !1
610
+ });
611
+ function gn(t) {
612
+ const {
613
+ children: e,
614
+ delay: n,
615
+ timeoutMs: r = 0
616
+ } = t, [o, i] = a.useReducer((c, l) => ({
617
+ ...c,
618
+ ...l
619
+ }), {
620
+ delay: n,
621
+ timeoutMs: r,
622
+ initialDelay: n,
623
+ currentId: null,
624
+ isInstantPhase: !1
625
+ }), s = a.useRef(null), u = a.useCallback((c) => {
626
+ i({
627
+ currentId: c
628
+ });
629
+ }, []);
630
+ return V(() => {
631
+ o.currentId ? s.current === null ? s.current = o.currentId : o.isInstantPhase || i({
632
+ isInstantPhase: !0
633
+ }) : (o.isInstantPhase && i({
634
+ isInstantPhase: !1
635
+ }), s.current = null);
636
+ }, [o.currentId, o.isInstantPhase]), /* @__PURE__ */ K(pn.Provider, {
637
+ value: a.useMemo(() => ({
638
+ ...o,
639
+ setState: i,
640
+ setCurrentId: u
641
+ }), [o, u]),
642
+ children: e
643
+ });
644
+ }
645
+ const Ge = {
646
+ border: 0,
647
+ clip: "rect(0 0 0 0)",
648
+ height: "1px",
649
+ margin: "-1px",
650
+ overflow: "hidden",
651
+ padding: 0,
652
+ position: "fixed",
653
+ whiteSpace: "nowrap",
654
+ width: "1px",
655
+ top: 0,
656
+ left: 0
657
+ }, Ne = /* @__PURE__ */ a.forwardRef(function(e, n) {
658
+ const [r, o] = a.useState();
659
+ V(() => {
660
+ Ye() && o("button");
661
+ }, []);
662
+ const i = {
663
+ ref: n,
664
+ tabIndex: 0,
665
+ // Role is only for VoiceOver
666
+ role: r,
667
+ "aria-hidden": r ? void 0 : !0,
668
+ [ee("focus-guard")]: "",
669
+ style: Ge
670
+ };
671
+ return /* @__PURE__ */ K("span", {
672
+ ...e,
673
+ ...i
674
+ });
675
+ }), Xe = /* @__PURE__ */ a.createContext(null), Fe = /* @__PURE__ */ ee("portal");
676
+ function bn(t) {
677
+ t === void 0 && (t = {});
678
+ const {
679
+ id: e,
680
+ root: n
681
+ } = t, r = Ee(), o = Rn(), [i, s] = a.useState(null), u = a.useRef(null);
682
+ return V(() => () => {
683
+ i?.remove(), queueMicrotask(() => {
684
+ u.current = null;
685
+ });
686
+ }, [i]), V(() => {
687
+ if (!r || u.current) return;
688
+ const c = e ? document.getElementById(e) : null;
689
+ if (!c) return;
690
+ const l = document.createElement("div");
691
+ l.id = r, l.setAttribute(Fe, ""), c.appendChild(l), u.current = l, s(l);
692
+ }, [e, r]), V(() => {
693
+ if (n === null || !r || u.current) return;
694
+ let c = n || o?.portalNode;
695
+ c && !vt(c) && (c = c.current), c = c || document.body;
696
+ let l = null;
697
+ e && (l = document.createElement("div"), l.id = e, c.appendChild(l));
698
+ const v = document.createElement("div");
699
+ v.id = r, v.setAttribute(Fe, ""), c = l || c, c.appendChild(v), u.current = v, s(v);
700
+ }, [e, n, r, o]), i;
701
+ }
702
+ function hn(t) {
703
+ const {
704
+ children: e,
705
+ id: n,
706
+ root: r,
707
+ preserveTabOrder: o = !0
708
+ } = t, i = bn({
709
+ id: n,
710
+ root: r
711
+ }), [s, u] = a.useState(null), c = a.useRef(null), l = a.useRef(null), v = a.useRef(null), p = a.useRef(null), h = s?.modal, f = s?.open, R = (
712
+ // The FocusManager and therefore floating element are currently open/
713
+ // rendered.
714
+ !!s && // Guards are only for non-modal focus management.
715
+ !s.modal && // Don't render if unmount is transitioning.
716
+ s.open && o && !!(r || i)
717
+ );
718
+ return a.useEffect(() => {
719
+ if (!i || !o || h)
720
+ return;
721
+ function m(E) {
722
+ i && ae(E) && (E.type === "focusin" ? Ie : rn)(i);
723
+ }
724
+ return i.addEventListener("focusin", m, !0), i.addEventListener("focusout", m, !0), () => {
725
+ i.removeEventListener("focusin", m, !0), i.removeEventListener("focusout", m, !0);
726
+ };
727
+ }, [i, o, h]), a.useEffect(() => {
728
+ i && (f || Ie(i));
729
+ }, [f, i]), /* @__PURE__ */ ot(Xe.Provider, {
730
+ value: a.useMemo(() => ({
731
+ preserveTabOrder: o,
732
+ beforeOutsideRef: c,
733
+ afterOutsideRef: l,
734
+ beforeInsideRef: v,
735
+ afterInsideRef: p,
736
+ portalNode: i,
737
+ setFocusManagerState: u
738
+ }), [o, i]),
739
+ children: [R && i && /* @__PURE__ */ K(Ne, {
740
+ "data-type": "outside",
741
+ ref: c,
742
+ onFocus: (m) => {
743
+ if (ae(m, i)) {
744
+ var E;
745
+ (E = v.current) == null || E.focus();
746
+ } else {
747
+ const T = s ? s.domReference : null, y = nn(T);
748
+ y?.focus();
749
+ }
750
+ }
751
+ }), R && i && /* @__PURE__ */ K("span", {
752
+ "aria-owns": i.id,
753
+ style: Ge
754
+ }), i && /* @__PURE__ */ xt.createPortal(e, i), R && i && /* @__PURE__ */ K(Ne, {
755
+ "data-type": "outside",
756
+ ref: l,
757
+ onFocus: (m) => {
758
+ if (ae(m, i)) {
759
+ var E;
760
+ (E = p.current) == null || E.focus();
761
+ } else {
762
+ const T = s ? s.domReference : null, y = tn(T);
763
+ y?.focus(), s?.closeOnFocusOut && s?.onOpenChange(!1, m.nativeEvent, "focus-out");
764
+ }
765
+ }
766
+ })]
767
+ });
768
+ }
769
+ const Rn = () => a.useContext(Xe), En = {
770
+ pointerdown: "onPointerDown",
771
+ mousedown: "onMouseDown",
772
+ click: "onClick"
773
+ }, yn = {
774
+ pointerdown: "onPointerDownCapture",
775
+ mousedown: "onMouseDownCapture",
776
+ click: "onClickCapture"
777
+ }, ke = (t) => {
778
+ var e, n;
779
+ return {
780
+ escapeKey: typeof t == "boolean" ? t : (e = t?.escapeKey) != null ? e : !1,
781
+ outsidePress: typeof t == "boolean" ? t : (n = t?.outsidePress) != null ? n : !0
782
+ };
783
+ };
784
+ function Cn(t, e) {
785
+ e === void 0 && (e = {});
786
+ const {
787
+ open: n,
788
+ onOpenChange: r,
789
+ elements: o,
790
+ dataRef: i
791
+ } = t, {
792
+ enabled: s = !0,
793
+ escapeKey: u = !0,
794
+ outsidePress: c = !0,
795
+ outsidePressEvent: l = "pointerdown",
796
+ referencePress: v = !1,
797
+ referencePressEvent: p = "pointerdown",
798
+ ancestorScroll: h = !1,
799
+ bubbles: f,
800
+ capture: R
801
+ } = e, m = Ce(), E = U(typeof c == "function" ? c : () => !1), T = typeof c == "function" ? E : c, y = a.useRef(!1), {
802
+ escapeKey: x,
803
+ outsidePress: P
804
+ } = ke(f), {
805
+ escapeKey: N,
806
+ outsidePress: _
807
+ } = ke(R), q = a.useRef(!1), F = U((b) => {
808
+ var I;
809
+ if (!n || !s || !u || b.key !== "Escape" || q.current)
810
+ return;
811
+ const O = (I = i.current.floatingContext) == null ? void 0 : I.nodeId, g = m ? ne(m.nodesRef.current, O) : [];
812
+ if (!x && (b.stopPropagation(), g.length > 0)) {
813
+ let d = !0;
814
+ if (g.forEach((C) => {
815
+ var S;
816
+ if ((S = C.context) != null && S.open && !C.context.dataRef.current.__escapeKeyBubbles) {
817
+ d = !1;
818
+ return;
819
+ }
820
+ }), !d)
821
+ return;
822
+ }
823
+ r(!1, Xt(b) ? b.nativeEvent : b, "escape-key");
824
+ }), G = U((b) => {
825
+ var I;
826
+ const O = () => {
827
+ var g;
828
+ F(b), (g = X(b)) == null || g.removeEventListener("keydown", O);
829
+ };
830
+ (I = X(b)) == null || I.addEventListener("keydown", O);
831
+ }), $ = U((b) => {
832
+ var I;
833
+ const O = i.current.insideReactTree;
834
+ i.current.insideReactTree = !1;
835
+ const g = y.current;
836
+ if (y.current = !1, l === "click" && g || O || typeof T == "function" && !T(b))
837
+ return;
838
+ const d = X(b), C = "[" + ee("inert") + "]", S = W(o.floating).querySelectorAll(C);
839
+ let D = A(d) ? d : null;
840
+ for (; D && !ie(D); ) {
841
+ const L = bt(D);
842
+ if (ie(L) || !A(L))
843
+ break;
844
+ D = L;
845
+ }
846
+ if (S.length && A(d) && !Ht(d) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
847
+ !Z(d, o.floating) && // If the target root element contains none of the markers, then the
848
+ // element was injected after the floating element rendered.
849
+ Array.from(S).every((L) => !Z(D, L)))
850
+ return;
851
+ if (Re(d) && B) {
852
+ const L = ie(d), Y = ht(d), J = /auto|scroll/, Je = L || J.test(Y.overflowX), ze = L || J.test(Y.overflowY), Qe = Je && d.clientWidth > 0 && d.scrollWidth > d.clientWidth, et = ze && d.clientHeight > 0 && d.scrollHeight > d.clientHeight, tt = Y.direction === "rtl", nt = et && (tt ? b.offsetX <= d.offsetWidth - d.clientWidth : b.offsetX > d.clientWidth), rt = Qe && b.offsetY > d.clientHeight;
853
+ if (nt || rt)
854
+ return;
855
+ }
856
+ const w = (I = i.current.floatingContext) == null ? void 0 : I.nodeId, M = m && ne(m.nodesRef.current, w).some((L) => {
857
+ var Y;
858
+ return ue(b, (Y = L.context) == null ? void 0 : Y.elements.floating);
859
+ });
860
+ if (ue(b, o.floating) || ue(b, o.domReference) || M)
861
+ return;
862
+ const oe = m ? ne(m.nodesRef.current, w) : [];
863
+ if (oe.length > 0) {
864
+ let L = !0;
865
+ if (oe.forEach((Y) => {
866
+ var J;
867
+ if ((J = Y.context) != null && J.open && !Y.context.dataRef.current.__outsidePressBubbles) {
868
+ L = !1;
869
+ return;
870
+ }
871
+ }), !L)
872
+ return;
873
+ }
874
+ r(!1, b, "outside-press");
875
+ }), H = U((b) => {
876
+ var I;
877
+ const O = () => {
878
+ var g;
879
+ $(b), (g = X(b)) == null || g.removeEventListener(l, O);
880
+ };
881
+ (I = X(b)) == null || I.addEventListener(l, O);
882
+ });
883
+ a.useEffect(() => {
884
+ if (!n || !s)
885
+ return;
886
+ i.current.__escapeKeyBubbles = x, i.current.__outsidePressBubbles = P;
887
+ let b = -1;
888
+ function I(S) {
889
+ r(!1, S, "ancestor-scroll");
890
+ }
891
+ function O() {
892
+ window.clearTimeout(b), q.current = !0;
893
+ }
894
+ function g() {
895
+ b = window.setTimeout(
896
+ () => {
897
+ q.current = !1;
898
+ },
899
+ // 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
900
+ // Only apply to WebKit for the test to remain 0ms.
901
+ gt() ? 5 : 0
902
+ );
903
+ }
904
+ const d = W(o.floating);
905
+ u && (d.addEventListener("keydown", N ? G : F, N), d.addEventListener("compositionstart", O), d.addEventListener("compositionend", g)), T && d.addEventListener(l, _ ? H : $, _);
906
+ let C = [];
907
+ return h && (A(o.domReference) && (C = se(o.domReference)), A(o.floating) && (C = C.concat(se(o.floating))), !A(o.reference) && o.reference && o.reference.contextElement && (C = C.concat(se(o.reference.contextElement)))), C = C.filter((S) => {
908
+ var D;
909
+ return S !== ((D = d.defaultView) == null ? void 0 : D.visualViewport);
910
+ }), C.forEach((S) => {
911
+ S.addEventListener("scroll", I, {
912
+ passive: !0
913
+ });
914
+ }), () => {
915
+ u && (d.removeEventListener("keydown", N ? G : F, N), d.removeEventListener("compositionstart", O), d.removeEventListener("compositionend", g)), T && d.removeEventListener(l, _ ? H : $, _), C.forEach((S) => {
916
+ S.removeEventListener("scroll", I);
917
+ }), window.clearTimeout(b);
918
+ };
919
+ }, [i, o, u, T, l, n, r, h, s, x, P, F, N, G, $, _, H]), a.useEffect(() => {
920
+ i.current.insideReactTree = !1;
921
+ }, [i, T, l]);
922
+ const j = a.useMemo(() => ({
923
+ onKeyDown: F,
924
+ ...v && {
925
+ [En[p]]: (b) => {
926
+ r(!1, b.nativeEvent, "reference-press");
927
+ },
928
+ ...p !== "click" && {
929
+ onClick(b) {
930
+ r(!1, b.nativeEvent, "reference-press");
931
+ }
932
+ }
933
+ }
934
+ }), [F, r, v, p]), B = a.useMemo(() => ({
935
+ onKeyDown: F,
936
+ onMouseDown() {
937
+ y.current = !0;
938
+ },
939
+ onMouseUp() {
940
+ y.current = !0;
941
+ },
942
+ [yn[l]]: () => {
943
+ i.current.insideReactTree = !0;
944
+ }
945
+ }), [F, l, i]);
946
+ return a.useMemo(() => s ? {
947
+ reference: j,
948
+ floating: B
949
+ } : {}, [s, j, B]);
950
+ }
951
+ function xn(t) {
952
+ const {
953
+ open: e = !1,
954
+ onOpenChange: n,
955
+ elements: r
956
+ } = t, o = Ee(), i = a.useRef({}), [s] = a.useState(() => fn()), u = ye() != null;
957
+ if (process.env.NODE_ENV !== "production") {
958
+ const f = r.reference;
959
+ f && !A(f) && ln("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead.");
960
+ }
961
+ const [c, l] = a.useState(r.reference), v = U((f, R, m) => {
962
+ i.current.openEvent = f ? R : void 0, s.emit("openchange", {
963
+ open: f,
964
+ event: R,
965
+ reason: m,
966
+ nested: u
967
+ }), n?.(f, R, m);
968
+ }), p = a.useMemo(() => ({
969
+ setPositionReference: l
970
+ }), []), h = a.useMemo(() => ({
971
+ reference: c || r.reference || null,
972
+ floating: r.floating || null,
973
+ domReference: r.reference
974
+ }), [c, r.reference, r.floating]);
975
+ return a.useMemo(() => ({
976
+ dataRef: i,
977
+ open: e,
978
+ onOpenChange: v,
979
+ elements: h,
980
+ events: s,
981
+ floatingId: o,
982
+ refs: p
983
+ }), [e, v, h, s, o, p]);
984
+ }
985
+ function wn(t) {
986
+ t === void 0 && (t = {});
987
+ const {
988
+ nodeId: e
989
+ } = t, n = xn({
990
+ ...t,
991
+ elements: {
992
+ reference: null,
993
+ floating: null,
994
+ ...t.elements
995
+ }
996
+ }), r = t.rootContext || n, o = r.elements, [i, s] = a.useState(null), [u, c] = a.useState(null), v = o?.domReference || i, p = a.useRef(null), h = Ce();
997
+ V(() => {
998
+ v && (p.current = v);
999
+ }, [v]);
1000
+ const f = mt({
1001
+ ...t,
1002
+ elements: {
1003
+ ...o,
1004
+ ...u && {
1005
+ reference: u
1006
+ }
1007
+ }
1008
+ }), R = a.useCallback((x) => {
1009
+ const P = A(x) ? {
1010
+ getBoundingClientRect: () => x.getBoundingClientRect(),
1011
+ getClientRects: () => x.getClientRects(),
1012
+ contextElement: x
1013
+ } : x;
1014
+ c(P), f.refs.setReference(P);
1015
+ }, [f.refs]), m = a.useCallback((x) => {
1016
+ (A(x) || x === null) && (p.current = x, s(x)), (A(f.refs.reference.current) || f.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
1017
+ // `null` to support `positionReference` + an unstable `reference`
1018
+ // callback ref.
1019
+ x !== null && !A(x)) && f.refs.setReference(x);
1020
+ }, [f.refs]), E = a.useMemo(() => ({
1021
+ ...f.refs,
1022
+ setReference: m,
1023
+ setPositionReference: R,
1024
+ domReference: p
1025
+ }), [f.refs, m, R]), T = a.useMemo(() => ({
1026
+ ...f.elements,
1027
+ domReference: v
1028
+ }), [f.elements, v]), y = a.useMemo(() => ({
1029
+ ...f,
1030
+ ...r,
1031
+ refs: E,
1032
+ elements: T,
1033
+ nodeId: e
1034
+ }), [f, E, T, e, r]);
1035
+ return V(() => {
1036
+ r.dataRef.current.floatingContext = y;
1037
+ const x = h?.nodesRef.current.find((P) => P.id === e);
1038
+ x && (x.context = y);
1039
+ }), a.useMemo(() => ({
1040
+ ...f,
1041
+ context: y,
1042
+ refs: E,
1043
+ elements: T
1044
+ }), [f, E, T, y]);
1045
+ }
1046
+ function fe() {
1047
+ return Ut() && Ye();
1048
+ }
1049
+ function Tn(t, e) {
1050
+ e === void 0 && (e = {});
1051
+ const {
1052
+ open: n,
1053
+ onOpenChange: r,
1054
+ events: o,
1055
+ dataRef: i,
1056
+ elements: s
1057
+ } = t, {
1058
+ enabled: u = !0,
1059
+ visibleOnly: c = !0
1060
+ } = e, l = a.useRef(!1), v = a.useRef(-1), p = a.useRef(!0);
1061
+ a.useEffect(() => {
1062
+ if (!u) return;
1063
+ const f = pt(s.domReference);
1064
+ function R() {
1065
+ !n && Re(s.domReference) && s.domReference === pe(W(s.domReference)) && (l.current = !0);
1066
+ }
1067
+ function m() {
1068
+ p.current = !0;
1069
+ }
1070
+ function E() {
1071
+ p.current = !1;
1072
+ }
1073
+ return f.addEventListener("blur", R), fe() && (f.addEventListener("keydown", m, !0), f.addEventListener("pointerdown", E, !0)), () => {
1074
+ f.removeEventListener("blur", R), fe() && (f.removeEventListener("keydown", m, !0), f.removeEventListener("pointerdown", E, !0));
1075
+ };
1076
+ }, [s.domReference, n, u]), a.useEffect(() => {
1077
+ if (!u) return;
1078
+ function f(R) {
1079
+ let {
1080
+ reason: m
1081
+ } = R;
1082
+ (m === "reference-press" || m === "escape-key") && (l.current = !0);
1083
+ }
1084
+ return o.on("openchange", f), () => {
1085
+ o.off("openchange", f);
1086
+ };
1087
+ }, [o, u]), a.useEffect(() => () => {
1088
+ k(v);
1089
+ }, []);
1090
+ const h = a.useMemo(() => ({
1091
+ onMouseLeave() {
1092
+ l.current = !1;
1093
+ },
1094
+ onFocus(f) {
1095
+ if (l.current) return;
1096
+ const R = X(f.nativeEvent);
1097
+ if (c && A(R)) {
1098
+ if (fe() && !f.relatedTarget) {
1099
+ if (!p.current && !jt(R))
1100
+ return;
1101
+ } else if (!qt(R))
1102
+ return;
1103
+ }
1104
+ r(!0, f.nativeEvent, "focus");
1105
+ },
1106
+ onBlur(f) {
1107
+ l.current = !1;
1108
+ const R = f.relatedTarget, m = f.nativeEvent, E = A(R) && R.hasAttribute(ee("focus-guard")) && R.getAttribute("data-type") === "outside";
1109
+ v.current = window.setTimeout(() => {
1110
+ var T;
1111
+ const y = pe(s.domReference ? s.domReference.ownerDocument : document);
1112
+ !R && y === s.domReference || Z((T = i.current.floatingContext) == null ? void 0 : T.refs.floating.current, y) || Z(s.domReference, y) || E || r(!1, m, "focus");
1113
+ });
1114
+ }
1115
+ }), [i, s.domReference, r, c]);
1116
+ return a.useMemo(() => u ? {
1117
+ reference: h
1118
+ } : {}, [u, h]);
1119
+ }
1120
+ function de(t, e, n) {
1121
+ const r = /* @__PURE__ */ new Map(), o = n === "item";
1122
+ let i = t;
1123
+ if (o && t) {
1124
+ const {
1125
+ [Pe]: s,
1126
+ [Me]: u,
1127
+ ...c
1128
+ } = t;
1129
+ i = c;
1130
+ }
1131
+ return {
1132
+ ...n === "floating" && {
1133
+ tabIndex: -1,
1134
+ [on]: ""
1135
+ },
1136
+ ...i,
1137
+ ...e.map((s) => {
1138
+ const u = s ? s[n] : null;
1139
+ return typeof u == "function" ? t ? u(t) : null : u;
1140
+ }).concat(t).reduce((s, u) => (u && Object.entries(u).forEach((c) => {
1141
+ let [l, v] = c;
1142
+ if (!(o && [Pe, Me].includes(l)))
1143
+ if (l.indexOf("on") === 0) {
1144
+ if (r.has(l) || r.set(l, []), typeof v == "function") {
1145
+ var p;
1146
+ (p = r.get(l)) == null || p.push(v), s[l] = function() {
1147
+ for (var h, f = arguments.length, R = new Array(f), m = 0; m < f; m++)
1148
+ R[m] = arguments[m];
1149
+ return (h = r.get(l)) == null ? void 0 : h.map((E) => E(...R)).find((E) => E !== void 0);
1150
+ };
1151
+ }
1152
+ } else
1153
+ s[l] = v;
1154
+ }), s), {})
1155
+ };
1156
+ }
1157
+ function Sn(t) {
1158
+ t === void 0 && (t = []);
1159
+ const e = t.map((u) => u?.reference), n = t.map((u) => u?.floating), r = t.map((u) => u?.item), o = a.useCallback(
1160
+ (u) => de(u, t, "reference"),
1161
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1162
+ e
1163
+ ), i = a.useCallback(
1164
+ (u) => de(u, t, "floating"),
1165
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1166
+ n
1167
+ ), s = a.useCallback(
1168
+ (u) => de(u, t, "item"),
1169
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1170
+ r
1171
+ );
1172
+ return a.useMemo(() => ({
1173
+ getReferenceProps: o,
1174
+ getFloatingProps: i,
1175
+ getItemProps: s
1176
+ }), [o, i, s]);
1177
+ }
1178
+ const In = /* @__PURE__ */ new Map([["select", "listbox"], ["combobox", "listbox"], ["label", !1]]);
1179
+ function Pn(t, e) {
1180
+ var n, r;
1181
+ e === void 0 && (e = {});
1182
+ const {
1183
+ open: o,
1184
+ elements: i,
1185
+ floatingId: s
1186
+ } = t, {
1187
+ enabled: u = !0,
1188
+ role: c = "dialog"
1189
+ } = e, l = Ee(), v = ((n = i.domReference) == null ? void 0 : n.id) || l, p = a.useMemo(() => {
1190
+ var y;
1191
+ return ((y = Gt(i.floating)) == null ? void 0 : y.id) || s;
1192
+ }, [i.floating, s]), h = (r = In.get(c)) != null ? r : c, R = ye() != null, m = a.useMemo(() => h === "tooltip" || c === "label" ? {
1193
+ ["aria-" + (c === "label" ? "labelledby" : "describedby")]: o ? p : void 0
1194
+ } : {
1195
+ "aria-expanded": o ? "true" : "false",
1196
+ "aria-haspopup": h === "alertdialog" ? "dialog" : h,
1197
+ "aria-controls": o ? p : void 0,
1198
+ ...h === "listbox" && {
1199
+ role: "combobox"
1200
+ },
1201
+ ...h === "menu" && {
1202
+ id: v
1203
+ },
1204
+ ...h === "menu" && R && {
1205
+ role: "menuitem"
1206
+ },
1207
+ ...c === "select" && {
1208
+ "aria-autocomplete": "none"
1209
+ },
1210
+ ...c === "combobox" && {
1211
+ "aria-autocomplete": "list"
1212
+ }
1213
+ }, [h, p, R, o, v, c]), E = a.useMemo(() => {
1214
+ const y = {
1215
+ id: p,
1216
+ ...h && {
1217
+ role: h
1218
+ }
1219
+ };
1220
+ return h === "tooltip" || c === "label" ? y : {
1221
+ ...y,
1222
+ ...h === "menu" && {
1223
+ "aria-labelledby": v
1224
+ }
1225
+ };
1226
+ }, [h, p, v, c]), T = a.useCallback((y) => {
1227
+ let {
1228
+ active: x,
1229
+ selected: P
1230
+ } = y;
1231
+ const N = {
1232
+ role: "option",
1233
+ ...x && {
1234
+ id: p + "-fui-option"
1235
+ }
1236
+ };
1237
+ switch (c) {
1238
+ case "select":
1239
+ case "combobox":
1240
+ return {
1241
+ ...N,
1242
+ "aria-selected": P
1243
+ };
1244
+ }
1245
+ return {};
1246
+ }, [p, c]);
1247
+ return a.useMemo(() => u ? {
1248
+ reference: m,
1249
+ floating: E,
1250
+ item: T
1251
+ } : {}, [u, m, E, T]);
1252
+ }
1253
+ function Mn({
1254
+ initialOpen: t = !1,
1255
+ placement: e = "top",
1256
+ open: n,
1257
+ onOpenChange: r,
1258
+ delay: o = 600,
1259
+ closeDelay: i = 0
1260
+ } = {}) {
1261
+ const [s, u] = lt(t), c = n ?? s, l = r ?? u, v = wn({
1262
+ placement: e,
1263
+ open: c,
1264
+ onOpenChange: l,
1265
+ whileElementsMounted: Ct,
1266
+ middleware: [
1267
+ Rt(4),
1268
+ Et({
1269
+ crossAxis: e.includes("-"),
1270
+ fallbackAxisSideDirection: "start",
1271
+ padding: 4
1272
+ }),
1273
+ yt({ padding: 4 })
1274
+ ]
1275
+ }), p = v.context, h = mn(p, {
1276
+ mouseOnly: !0,
1277
+ move: !1,
1278
+ restMs: o,
1279
+ enabled: n == null,
1280
+ delay: {
1281
+ close: i
1282
+ }
1283
+ }), f = Tn(p, {
1284
+ enabled: n == null
1285
+ }), R = Cn(p), m = Pn(p, { role: "tooltip" }), E = Sn([h, f, R, m]);
1286
+ return ft(
1287
+ () => ({
1288
+ open: c,
1289
+ setOpen: l,
1290
+ ...E,
1291
+ ...v
1292
+ }),
1293
+ [c, l, E, v]
1294
+ );
1295
+ }
1296
+ const he = it(null);
1297
+ function Ze() {
1298
+ const t = ct(he);
1299
+ if (t == null)
1300
+ throw new Error("Tooltip components must be wrapped in <TooltipProvider />");
1301
+ return t;
1302
+ }
1303
+ function Ln({ children: t, ...e }) {
1304
+ const n = Mn(e);
1305
+ return e.useDelayGroup ? /* @__PURE__ */ K(
1306
+ gn,
1307
+ {
1308
+ delay: { open: e.delay ?? 0, close: e.closeDelay ?? 0 },
1309
+ timeoutMs: e.timeout,
1310
+ children: /* @__PURE__ */ K(he.Provider, { value: n, children: t })
1311
+ }
1312
+ ) : /* @__PURE__ */ K(he.Provider, { value: n, children: t });
1313
+ }
1314
+ const On = _e(
1315
+ function({ children: e, asChild: n = !1, ...r }, o) {
1316
+ const i = Ze(), s = xe(e) ? parseInt(ut, 10) >= 19 ? (
1317
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1318
+ e.props.ref
1319
+ ) : (
1320
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1321
+ e.ref
1322
+ ) : void 0, u = qe([i.refs.setReference, o, s]);
1323
+ if (n && xe(e)) {
1324
+ const c = {
1325
+ "data-tooltip-state": i.open ? "open" : "closed"
1326
+ };
1327
+ return at(
1328
+ e,
1329
+ i.getReferenceProps({
1330
+ ref: u,
1331
+ ...r,
1332
+ ...typeof e.props == "object" ? e.props : {},
1333
+ ...c
1334
+ })
1335
+ );
1336
+ }
1337
+ return /* @__PURE__ */ K(
1338
+ "button",
1339
+ {
1340
+ ref: u,
1341
+ "data-tooltip-state": i.open ? "open" : "closed",
1342
+ ...i.getReferenceProps(r),
1343
+ children: e
1344
+ }
1345
+ );
1346
+ }
1347
+ ), An = _e(
1348
+ function({ style: e, children: n, portal: r = !0, portalProps: o = {}, ...i }, s) {
1349
+ const u = Ze(), c = qe([u.refs.setFloating, s]);
1350
+ if (!u.open) return null;
1351
+ const l = /* @__PURE__ */ K(
1352
+ "div",
1353
+ {
1354
+ ref: c,
1355
+ style: {
1356
+ ...u.floatingStyles,
1357
+ ...e
1358
+ },
1359
+ ...u.getFloatingProps(i),
1360
+ className: "tiptap-tooltip",
1361
+ children: n
1362
+ }
1363
+ );
1364
+ return r ? /* @__PURE__ */ K(hn, { ...o, children: l }) : l;
1365
+ }
1366
+ );
1367
+ Ln.displayName = "Tooltip";
1368
+ On.displayName = "TooltipTrigger";
1369
+ An.displayName = "TooltipContent";
1370
+ export {
1371
+ Ln as Tooltip,
1372
+ An as TooltipContent,
1373
+ On as TooltipTrigger
1374
+ };