@delali/web-editor 0.0.0-stage → 0.4.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 (476) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/LICENSE +201 -0
  3. package/README.md +167 -2
  4. package/dist/components/editor/chat-comment-effects.d.ts +2 -0
  5. package/dist/components/editor/chat-types.d.ts +20 -0
  6. package/dist/components/editor/collaboration/base-collaboration-plugin.d.ts +14 -0
  7. package/dist/components/editor/collaboration/collaboration-plugin.d.ts +6 -0
  8. package/dist/components/editor/collaboration/collaboration-session.d.ts +30 -0
  9. package/dist/components/editor/collaboration/collaboration-starter.d.ts +9 -0
  10. package/dist/components/editor/collaboration/editor-collaboration.d.ts +16 -0
  11. package/dist/components/editor/collaboration/editor-collaboration.js +293 -0
  12. package/dist/components/editor/collaboration/remote-cursor-overlay.d.ts +1 -0
  13. package/dist/components/editor/collaboration/shared-document.d.ts +18 -0
  14. package/dist/components/editor/create-editor-plugins.d.ts +3 -0
  15. package/dist/components/editor/create-editor-plugins.js +25204 -0
  16. package/dist/components/editor/create-viewer-plugins.d.ts +3 -0
  17. package/dist/components/editor/editor-base-kit.d.ts +329 -0
  18. package/dist/components/editor/editor-base-kit.js +3136 -0
  19. package/dist/components/editor/editor-config.d.ts +14 -0
  20. package/dist/components/editor/editor-config.js +145 -0
  21. package/dist/components/editor/editor-kit.d.ts +3978 -0
  22. package/dist/components/editor/editor-kit.js +18781 -0
  23. package/dist/components/editor/plate-types.d.ts +99 -0
  24. package/dist/components/editor/plugins/accordion-group-base-kit.d.ts +2 -0
  25. package/dist/components/editor/plugins/accordion-group-kit.d.ts +3 -0
  26. package/dist/components/editor/plugins/accordion-types.d.ts +14 -0
  27. package/dist/components/editor/plugins/ai-kit.d.ts +248 -0
  28. package/dist/components/editor/plugins/align-base-kit.d.ts +3 -0
  29. package/dist/components/editor/plugins/api-doc/expandable-base-kit.d.ts +24 -0
  30. package/dist/components/editor/plugins/api-doc/expandable-kit.d.ts +29 -0
  31. package/dist/components/editor/plugins/api-doc/expandable-types.d.ts +7 -0
  32. package/dist/components/editor/plugins/api-doc/panel-base-kit.d.ts +2 -0
  33. package/dist/components/editor/plugins/api-doc/panel-kit.d.ts +3 -0
  34. package/dist/components/editor/plugins/api-doc/panel-types.d.ts +7 -0
  35. package/dist/components/editor/plugins/api-doc/response-field-base-kit.d.ts +3 -0
  36. package/dist/components/editor/plugins/api-doc/response-field-kit.d.ts +4 -0
  37. package/dist/components/editor/plugins/api-doc/response-field-types.d.ts +17 -0
  38. package/dist/components/editor/plugins/autoformat-kit.d.ts +1 -0
  39. package/dist/components/editor/plugins/badge-base-kit.d.ts +2 -0
  40. package/dist/components/editor/plugins/badge-kit.d.ts +3 -0
  41. package/dist/components/editor/plugins/badge-types.d.ts +24 -0
  42. package/dist/components/editor/plugins/banner-base-kit.d.ts +2 -0
  43. package/dist/components/editor/plugins/banner-kit.d.ts +3 -0
  44. package/dist/components/editor/plugins/banner-types.d.ts +15 -0
  45. package/dist/components/editor/plugins/basic-blocks-base-kit.d.ts +5 -0
  46. package/dist/components/editor/plugins/basic-blocks-kit.d.ts +5 -0
  47. package/dist/components/editor/plugins/basic-marks-base-kit.d.ts +19 -0
  48. package/dist/components/editor/plugins/basic-marks-kit.d.ts +35 -0
  49. package/dist/components/editor/plugins/basic-nodes-kit.d.ts +21 -0
  50. package/dist/components/editor/plugins/block-menu-kit.d.ts +165 -0
  51. package/dist/components/editor/plugins/block-placeholder-kit.d.ts +14 -0
  52. package/dist/components/editor/plugins/block-selection-kit.d.ts +137 -0
  53. package/dist/components/editor/plugins/callout-base-kit.d.ts +20 -0
  54. package/dist/components/editor/plugins/callout-kit.d.ts +20 -0
  55. package/dist/components/editor/plugins/callout-types.d.ts +18 -0
  56. package/dist/components/editor/plugins/card-base-kit.d.ts +2 -0
  57. package/dist/components/editor/plugins/card-kit.d.ts +3 -0
  58. package/dist/components/editor/plugins/card-types.d.ts +14 -0
  59. package/dist/components/editor/plugins/caret-placement-kit.d.ts +8 -0
  60. package/dist/components/editor/plugins/code-block-base-kit.d.ts +7 -0
  61. package/dist/components/editor/plugins/code-block-input-rule-gate.d.ts +4 -0
  62. package/dist/components/editor/plugins/code-block-kit.d.ts +7 -0
  63. package/dist/components/editor/plugins/color-base-kit.d.ts +2 -0
  64. package/dist/components/editor/plugins/color-kit.d.ts +3 -0
  65. package/dist/components/editor/plugins/color-types.d.ts +18 -0
  66. package/dist/components/editor/plugins/column-base-kit.d.ts +1 -0
  67. package/dist/components/editor/plugins/column-kit.d.ts +1 -0
  68. package/dist/components/editor/plugins/comment-base-kit.d.ts +47 -0
  69. package/dist/components/editor/plugins/comment-kit.d.ts +71 -0
  70. package/dist/components/editor/plugins/copilot-kit.d.ts +72 -0
  71. package/dist/components/editor/plugins/cursor-overlay-kit.d.ts +11 -0
  72. package/dist/components/editor/plugins/date-base-kit.d.ts +19 -0
  73. package/dist/components/editor/plugins/date-kit.d.ts +19 -0
  74. package/dist/components/editor/plugins/discussion-kit.d.ts +31 -0
  75. package/dist/components/editor/plugins/dnd-kit.d.ts +20 -0
  76. package/dist/components/editor/plugins/docx-kit.d.ts +1 -0
  77. package/dist/components/editor/plugins/emoji-kit.d.ts +9 -0
  78. package/dist/components/editor/plugins/exit-break-kit.d.ts +4 -0
  79. package/dist/components/editor/plugins/floating-toolbar-kit.d.ts +1 -0
  80. package/dist/components/editor/plugins/font-base-kit.d.ts +9 -0
  81. package/dist/components/editor/plugins/font-kit.d.ts +9 -0
  82. package/dist/components/editor/plugins/fraction-input-rule.d.ts +12 -0
  83. package/dist/components/editor/plugins/frame-base-kit.d.ts +2 -0
  84. package/dist/components/editor/plugins/frame-kit.d.ts +3 -0
  85. package/dist/components/editor/plugins/frame-types.d.ts +10 -0
  86. package/dist/components/editor/plugins/icon-base-kit.d.ts +2 -0
  87. package/dist/components/editor/plugins/icon-kit.d.ts +3 -0
  88. package/dist/components/editor/plugins/icon-types.d.ts +15 -0
  89. package/dist/components/editor/plugins/indent-base-kit.d.ts +1 -0
  90. package/dist/components/editor/plugins/indent-kit.d.ts +5 -0
  91. package/dist/components/editor/plugins/input-rule-gate.d.ts +8 -0
  92. package/dist/components/editor/plugins/line-height-base-kit.d.ts +3 -0
  93. package/dist/components/editor/plugins/link-base-kit.d.ts +2 -0
  94. package/dist/components/editor/plugins/link-kit.d.ts +89 -0
  95. package/dist/components/editor/plugins/list-base-kit.d.ts +1 -0
  96. package/dist/components/editor/plugins/list-kit.d.ts +16 -0
  97. package/dist/components/editor/plugins/mark-input-rule-gate.d.ts +2 -0
  98. package/dist/components/editor/plugins/markdown-kit.d.ts +19 -0
  99. package/dist/components/editor/plugins/math-base-kit.d.ts +9 -0
  100. package/dist/components/editor/plugins/math-kit.d.ts +9 -0
  101. package/dist/components/editor/plugins/media-base-kit.d.ts +25 -0
  102. package/dist/components/editor/plugins/media-kit.d.ts +38 -0
  103. package/dist/components/editor/plugins/mention-base-kit.d.ts +11 -0
  104. package/dist/components/editor/plugins/mention-kit.d.ts +11 -0
  105. package/dist/components/editor/plugins/mermaid-base-kit.d.ts +2 -0
  106. package/dist/components/editor/plugins/mermaid-kit.d.ts +3 -0
  107. package/dist/components/editor/plugins/mermaid-types.d.ts +14 -0
  108. package/dist/components/editor/plugins/shared/color-selector.d.ts +9 -0
  109. package/dist/components/editor/plugins/shared/component-popover.d.ts +12 -0
  110. package/dist/components/editor/plugins/slash-kit.d.ts +1 -0
  111. package/dist/components/editor/plugins/steps-base-kit.d.ts +3 -0
  112. package/dist/components/editor/plugins/steps-kit.d.ts +4 -0
  113. package/dist/components/editor/plugins/steps-types.d.ts +18 -0
  114. package/dist/components/editor/plugins/suggestion-base-kit.d.ts +32 -0
  115. package/dist/components/editor/plugins/suggestion-kit.d.ts +53 -0
  116. package/dist/components/editor/plugins/tabbed-code-block-base-kit.d.ts +32 -0
  117. package/dist/components/editor/plugins/tabbed-code-block-kit.d.ts +33 -0
  118. package/dist/components/editor/plugins/tabbed-code-block-types.d.ts +29 -0
  119. package/dist/components/editor/plugins/table-base-kit.d.ts +94 -0
  120. package/dist/components/editor/plugins/table-kit.d.ts +162 -0
  121. package/dist/components/editor/plugins/tabs-base-kit.d.ts +2 -0
  122. package/dist/components/editor/plugins/tabs-kit.d.ts +3 -0
  123. package/dist/components/editor/plugins/tabs-types.d.ts +14 -0
  124. package/dist/components/editor/plugins/text-substitution-input-rule-gate.d.ts +4 -0
  125. package/dist/components/editor/plugins/tiles-base-kit.d.ts +3 -0
  126. package/dist/components/editor/plugins/tiles-kit.d.ts +4 -0
  127. package/dist/components/editor/plugins/tiles-types.d.ts +16 -0
  128. package/dist/components/editor/plugins/toc-base-kit.d.ts +1 -0
  129. package/dist/components/editor/plugins/toc-kit.d.ts +5 -0
  130. package/dist/components/editor/plugins/todo-to-bullet-kit.d.ts +7 -0
  131. package/dist/components/editor/plugins/toggle-base-kit.d.ts +12 -0
  132. package/dist/components/editor/plugins/toggle-kit.d.ts +16 -0
  133. package/dist/components/editor/plugins/tooltip-base-kit.d.ts +2 -0
  134. package/dist/components/editor/plugins/tooltip-html.d.ts +27 -0
  135. package/dist/components/editor/plugins/tooltip-kit.d.ts +3 -0
  136. package/dist/components/editor/plugins/tooltip-types.d.ts +10 -0
  137. package/dist/components/editor/plugins/tree-base-kit.d.ts +2 -0
  138. package/dist/components/editor/plugins/tree-kit.d.ts +3 -0
  139. package/dist/components/editor/plugins/tree-types.d.ts +26 -0
  140. package/dist/components/editor/plugins/typed-conversion-options.d.ts +13 -0
  141. package/dist/components/editor/plugins/update-base-kit.d.ts +1 -0
  142. package/dist/components/editor/plugins/update-kit.d.ts +4 -0
  143. package/dist/components/editor/plugins/update-types.d.ts +19 -0
  144. package/dist/components/editor/plugins/web-address-text.d.ts +1 -0
  145. package/dist/components/editor/transforms.d.ts +8 -0
  146. package/dist/components/editor/use-chat.d.ts +3 -0
  147. package/dist/components/editor/use-chat.js +3315 -0
  148. package/dist/components/editor/use-typed-conversion-options.d.ts +3 -0
  149. package/dist/components/editor/version-history/chunk-node.d.ts +7 -0
  150. package/dist/components/editor/version-history/chunk-plugin.d.ts +6 -0
  151. package/dist/components/editor/version-history/collapse-blocks-without-diff.d.ts +4 -0
  152. package/dist/components/editor/version-history/diff-node.d.ts +9 -0
  153. package/dist/components/editor/version-history/diff-plate.d.ts +7 -0
  154. package/dist/components/editor/version-history/diff-plugin.d.ts +8 -0
  155. package/dist/components/editor/version-history/index.d.ts +9 -0
  156. package/dist/components/editor/version-history/index.js +19179 -0
  157. package/dist/components/editor/version-history/use-object-version.d.ts +1 -0
  158. package/dist/components/editor/version-history/use-reset-editor-on-change.d.ts +7 -0
  159. package/dist/components/editor/version-history/version-plate.d.ts +7 -0
  160. package/dist/components/editor/web-editor.d.ts +6 -0
  161. package/dist/components/editor/web-editor.js +27295 -0
  162. package/dist/context/editor-adapter-context.d.ts +13 -0
  163. package/dist/context/editor-adapter-context.js +124 -0
  164. package/dist/context/editor-adapter.d.ts +262 -0
  165. package/dist/context/editor-toc-context.d.ts +16 -0
  166. package/dist/context/heading-slug-context.d.ts +11 -0
  167. package/dist/context/link-resolution-context.d.ts +24 -0
  168. package/dist/context/link-resolution-store.d.ts +20 -0
  169. package/dist/context/portal-container.d.ts +7 -0
  170. package/dist/hooks/use-copy-to-clipboard.d.ts +10 -0
  171. package/dist/hooks/use-dark-mode.d.ts +1 -0
  172. package/dist/hooks/use-debounce-callback.d.ts +108 -0
  173. package/dist/hooks/use-debounce.d.ts +1 -0
  174. package/dist/hooks/use-is-touch-device.d.ts +1 -0
  175. package/dist/hooks/use-lock-scroll.d.ts +1 -0
  176. package/dist/hooks/use-media-query.d.ts +2 -0
  177. package/dist/hooks/use-mounted.d.ts +6 -0
  178. package/dist/hooks/use-on-click-outside.d.ts +26 -0
  179. package/dist/hooks/use-shield-input-selection-from-editor.d.ts +3 -0
  180. package/dist/hooks/use-upload-file.d.ts +25 -0
  181. package/dist/hooks/use-upload-file.js +129 -0
  182. package/dist/lib/accepted-file-types.d.ts +1 -0
  183. package/dist/lib/block-features.d.ts +11 -0
  184. package/dist/lib/comment-mark-strip.d.ts +24 -0
  185. package/dist/lib/comment-mark-strip.js +56 -0
  186. package/dist/lib/download-file.d.ts +1 -0
  187. package/dist/lib/editor-element-path.d.ts +8 -0
  188. package/dist/lib/extract-headings.d.ts +13 -0
  189. package/dist/lib/extract-headings.js +79 -0
  190. package/dist/lib/file-size-limit.d.ts +7 -0
  191. package/dist/lib/html-serialize-hast.d.ts +18 -0
  192. package/dist/lib/html-serialize-rules.d.ts +15 -0
  193. package/dist/lib/html-serialize-utils.d.ts +24 -0
  194. package/dist/lib/html-serialize-utils.js +392 -0
  195. package/dist/lib/line-marking-context.d.ts +13 -0
  196. package/dist/lib/line-marking.d.ts +47 -0
  197. package/dist/lib/list-html.d.ts +30 -0
  198. package/dist/lib/markdown-joiner-transform.d.ts +31 -0
  199. package/dist/lib/markdown-utils.d.ts +4 -0
  200. package/dist/lib/markdown-utils.js +25275 -0
  201. package/dist/lib/mdx/mdx-archetype-rules.d.ts +2 -0
  202. package/dist/lib/mdx/mdx-attribute-codec.d.ts +23 -0
  203. package/dist/lib/mdx/mdx-color-rules.d.ts +2 -0
  204. package/dist/lib/mdx/mdx-component-rules.d.ts +2 -0
  205. package/dist/lib/mdx/mdx-mermaid-rules.d.ts +10 -0
  206. package/dist/lib/mdx/mdx-reference-rules.d.ts +11 -0
  207. package/dist/lib/mdx/mdx-round-trip.d.ts +3 -0
  208. package/dist/lib/mdx/mdx-round-trip.js +1397 -0
  209. package/dist/lib/mdx/mdx-rule-builder.d.ts +45 -0
  210. package/dist/lib/mdx/mdx-server-plugins.d.ts +8 -0
  211. package/dist/lib/mdx/mdx-tabbed-code-rules.d.ts +2 -0
  212. package/dist/lib/mdx/mdx-tabs-rules.d.ts +2 -0
  213. package/dist/lib/mdx/mdx-toggle-rules.d.ts +9 -0
  214. package/dist/lib/mdx/mdx-tree-rules.d.ts +2 -0
  215. package/dist/lib/media-html.d.ts +121 -0
  216. package/dist/lib/paragraph-html.d.ts +26 -0
  217. package/dist/lib/server-plugins.d.ts +199 -0
  218. package/dist/lib/utils.d.ts +3 -0
  219. package/dist/lib/utils.js +25 -0
  220. package/dist/lib/video-embeds.d.ts +9 -0
  221. package/dist/styles.css +6726 -0
  222. package/dist/types/editor.d.ts +161 -0
  223. package/dist/types/editor.js +77 -0
  224. package/dist/ui/accordion-group-node-static.d.ts +11 -0
  225. package/dist/ui/accordion-group-node.d.ts +10 -0
  226. package/dist/ui/ai-chat-editor.d.ts +4 -0
  227. package/dist/ui/ai-menu.d.ts +2 -0
  228. package/dist/ui/ai-node.d.ts +3 -0
  229. package/dist/ui/ai-toolbar-button.d.ts +3 -0
  230. package/dist/ui/alert-dialog.d.ts +20 -0
  231. package/dist/ui/api-doc/expandable-node-static.d.ts +4 -0
  232. package/dist/ui/api-doc/expandable-node.d.ts +3 -0
  233. package/dist/ui/api-doc/expandable-settings.d.ts +17 -0
  234. package/dist/ui/api-doc/panel-node-static.d.ts +3 -0
  235. package/dist/ui/api-doc/panel-node.d.ts +3 -0
  236. package/dist/ui/api-doc/response-field-item-node-static.d.ts +3 -0
  237. package/dist/ui/api-doc/response-field-item-node.d.ts +3 -0
  238. package/dist/ui/api-doc/response-field-node-static.d.ts +9 -0
  239. package/dist/ui/api-doc/response-field-node.d.ts +9 -0
  240. package/dist/ui/avatar.d.ts +16 -0
  241. package/dist/ui/badge-node-static.d.ts +3 -0
  242. package/dist/ui/badge-node.d.ts +3 -0
  243. package/dist/ui/badge-settings-options.d.ts +24 -0
  244. package/dist/ui/badge-settings.d.ts +19 -0
  245. package/dist/ui/badge.d.ts +9 -0
  246. package/dist/ui/banner-node-static.d.ts +4 -0
  247. package/dist/ui/banner-node.d.ts +3 -0
  248. package/dist/ui/block-context-menu.d.ts +8 -0
  249. package/dist/ui/block-discussion.d.ts +3 -0
  250. package/dist/ui/block-draggable.d.ts +2 -0
  251. package/dist/ui/block-list-static.d.ts +2 -0
  252. package/dist/ui/block-list.d.ts +2 -0
  253. package/dist/ui/block-menu.d.ts +167 -0
  254. package/dist/ui/block-selection.d.ts +5 -0
  255. package/dist/ui/block-suggestion.d.ts +17 -0
  256. package/dist/ui/blockquote-node-static.d.ts +2 -0
  257. package/dist/ui/blockquote-node.d.ts +2 -0
  258. package/dist/ui/button.d.ts +81 -0
  259. package/dist/ui/calendar.d.ts +5 -0
  260. package/dist/ui/callout-detail-settings.d.ts +15 -0
  261. package/dist/ui/callout-icon.d.ts +9 -0
  262. package/dist/ui/callout-node-static.d.ts +2 -0
  263. package/dist/ui/callout-node.d.ts +3 -0
  264. package/dist/ui/callout-settings.d.ts +19 -0
  265. package/dist/ui/callout-type-button.d.ts +9 -0
  266. package/dist/ui/caption.d.ts +72 -0
  267. package/dist/ui/card-element-actions.d.ts +7 -0
  268. package/dist/ui/card-icon-settings.d.ts +11 -0
  269. package/dist/ui/card-node-static.d.ts +3 -0
  270. package/dist/ui/card-node.d.ts +3 -0
  271. package/dist/ui/card-settings.d.ts +24 -0
  272. package/dist/ui/card-title-row.d.ts +14 -0
  273. package/dist/ui/checkbox.d.ts +4 -0
  274. package/dist/ui/code-block-line-marking-form.d.ts +9 -0
  275. package/dist/ui/code-block-line-marking-input.d.ts +8 -0
  276. package/dist/ui/code-block-line-marking-popover.d.ts +12 -0
  277. package/dist/ui/code-block-line-marking-state.d.ts +11 -0
  278. package/dist/ui/code-block-node-static.d.ts +10 -0
  279. package/dist/ui/code-block-node.d.ts +5 -0
  280. package/dist/ui/code-line-selection-toolbar.d.ts +10 -0
  281. package/dist/ui/code-line-wrapper.d.ts +22 -0
  282. package/dist/ui/code-node-static.d.ts +2 -0
  283. package/dist/ui/code-node.d.ts +2 -0
  284. package/dist/ui/collapsible.d.ts +6 -0
  285. package/dist/ui/color-copy-icon.d.ts +9 -0
  286. package/dist/ui/color-element-actions.d.ts +7 -0
  287. package/dist/ui/color-item-settings.d.ts +11 -0
  288. package/dist/ui/color-node-static.d.ts +3 -0
  289. package/dist/ui/color-node.d.ts +3 -0
  290. package/dist/ui/color-settings.d.ts +18 -0
  291. package/dist/ui/color-swatch-editable.d.ts +12 -0
  292. package/dist/ui/color-table-row-editable.d.ts +10 -0
  293. package/dist/ui/column-node-static.d.ts +4 -0
  294. package/dist/ui/column-node.d.ts +3 -0
  295. package/dist/ui/command.d.ts +25 -0
  296. package/dist/ui/comment-node-static.d.ts +3 -0
  297. package/dist/ui/comment-node.d.ts +3 -0
  298. package/dist/ui/comment-toolbar-button.d.ts +1 -0
  299. package/dist/ui/comment.d.ts +45 -0
  300. package/dist/ui/cursor-overlay.d.ts +4 -0
  301. package/dist/ui/date-node-static.d.ts +2 -0
  302. package/dist/ui/date-node.d.ts +2 -0
  303. package/dist/ui/dialog.d.ts +90 -0
  304. package/dist/ui/dropdown-menu.d.ts +35 -0
  305. package/dist/ui/editor-inspector-panel.d.ts +6 -0
  306. package/dist/ui/editor-static.d.ts +8 -0
  307. package/dist/ui/editor.d.ts +15 -0
  308. package/dist/ui/emoji-node.d.ts +3 -0
  309. package/dist/ui/emoji-toolbar-button.d.ts +16 -0
  310. package/dist/ui/equation-node-static.d.ts +4 -0
  311. package/dist/ui/equation-node.d.ts +5 -0
  312. package/dist/ui/equation-toolbar-button.d.ts +2 -0
  313. package/dist/ui/floating-discussion.d.ts +8 -0
  314. package/dist/ui/floating-toolbar-buttons.d.ts +1 -0
  315. package/dist/ui/floating-toolbar.d.ts +6 -0
  316. package/dist/ui/font-color-toolbar-button.d.ts +15 -0
  317. package/dist/ui/frame-node-static.d.ts +3 -0
  318. package/dist/ui/frame-node.d.ts +3 -0
  319. package/dist/ui/frame-settings.d.ts +19 -0
  320. package/dist/ui/ghost-text.d.ts +1 -0
  321. package/dist/ui/heading-node-static.d.ts +10 -0
  322. package/dist/ui/heading-node.d.ts +14 -0
  323. package/dist/ui/highlight-node-static.d.ts +2 -0
  324. package/dist/ui/highlight-node.d.ts +2 -0
  325. package/dist/ui/hover-card.d.ts +6 -0
  326. package/dist/ui/hr-node-static.d.ts +2 -0
  327. package/dist/ui/hr-node.d.ts +2 -0
  328. package/dist/ui/icon-node-static.d.ts +3 -0
  329. package/dist/ui/icon-node.d.ts +3 -0
  330. package/dist/ui/icon-picker.d.ts +16 -0
  331. package/dist/ui/icon-settings.d.ts +17 -0
  332. package/dist/ui/inline-combobox.d.ts +38 -0
  333. package/dist/ui/input.d.ts +7 -0
  334. package/dist/ui/kbd-node-static.d.ts +2 -0
  335. package/dist/ui/kbd-node.d.ts +2 -0
  336. package/dist/ui/label.d.ts +8 -0
  337. package/dist/ui/link-node-static.d.ts +11 -0
  338. package/dist/ui/link-node.d.ts +11 -0
  339. package/dist/ui/link-reference.d.ts +39 -0
  340. package/dist/ui/link-reference.js +84 -0
  341. package/dist/ui/link-search-panel.d.ts +5 -0
  342. package/dist/ui/link-toolbar-button.d.ts +3 -0
  343. package/dist/ui/link-toolbar-edit-command.d.ts +7 -0
  344. package/dist/ui/link-toolbar-shared.d.ts +18 -0
  345. package/dist/ui/link-toolbar.d.ts +1 -0
  346. package/dist/ui/mark-toolbar-button.d.ts +6 -0
  347. package/dist/ui/media-align-button.d.ts +5 -0
  348. package/dist/ui/media-audio-node-static.d.ts +3 -0
  349. package/dist/ui/media-audio-node.d.ts +2 -0
  350. package/dist/ui/media-card.d.ts +11 -0
  351. package/dist/ui/media-embed-node-static.d.ts +6 -0
  352. package/dist/ui/media-embed-node.d.ts +2 -0
  353. package/dist/ui/media-file-display.d.ts +11 -0
  354. package/dist/ui/media-file-mode-dropdown.d.ts +10 -0
  355. package/dist/ui/media-file-node-static.d.ts +3 -0
  356. package/dist/ui/media-file-node.d.ts +2 -0
  357. package/dist/ui/media-hint-icon-picker.d.ts +5 -0
  358. package/dist/ui/media-hint-settings.d.ts +2 -0
  359. package/dist/ui/media-image-lightbox.d.ts +17 -0
  360. package/dist/ui/media-image-node-static.d.ts +6 -0
  361. package/dist/ui/media-image-node.d.ts +7 -0
  362. package/dist/ui/media-placeholder-node.d.ts +3 -0
  363. package/dist/ui/media-preview-dialog.d.ts +12 -0
  364. package/dist/ui/media-toolbar.d.ts +3 -0
  365. package/dist/ui/media-upload-toast.d.ts +1 -0
  366. package/dist/ui/media-video-node-static.d.ts +6 -0
  367. package/dist/ui/media-video-node.d.ts +2 -0
  368. package/dist/ui/member-profile-card.d.ts +17 -0
  369. package/dist/ui/mention-document-element.d.ts +5 -0
  370. package/dist/ui/mention-document-hover-card.d.ts +17 -0
  371. package/dist/ui/mention-document-link.d.ts +13 -0
  372. package/dist/ui/mention-element.d.ts +5 -0
  373. package/dist/ui/mention-input-element.d.ts +2 -0
  374. package/dist/ui/mention-node-static.d.ts +7 -0
  375. package/dist/ui/mention-page-combobox-group.d.ts +8 -0
  376. package/dist/ui/mention-people-combobox-group.d.ts +8 -0
  377. package/dist/ui/menu.d.ts +103 -0
  378. package/dist/ui/mermaid-node-static.d.ts +4 -0
  379. package/dist/ui/mermaid-node.d.ts +3 -0
  380. package/dist/ui/more-toolbar-button.d.ts +3 -0
  381. package/dist/ui/paragraph-node-static.d.ts +2 -0
  382. package/dist/ui/paragraph-node.d.ts +2 -0
  383. package/dist/ui/popover.d.ts +11 -0
  384. package/dist/ui/progress.d.ts +3 -0
  385. package/dist/ui/resize-handle.d.ts +15 -0
  386. package/dist/ui/select.d.ts +13 -0
  387. package/dist/ui/separator.d.ts +8 -0
  388. package/dist/ui/slash-node.d.ts +20 -0
  389. package/dist/ui/smart-link-clipboard.d.ts +1 -0
  390. package/dist/ui/smart-link-copy-button.d.ts +6 -0
  391. package/dist/ui/smart-link-mode-dropdown.d.ts +9 -0
  392. package/dist/ui/smart-link-toolbar.d.ts +17 -0
  393. package/dist/ui/smart-link-view.d.ts +23 -0
  394. package/dist/ui/smart-link.d.ts +43 -0
  395. package/dist/ui/spinner.d.ts +7 -0
  396. package/dist/ui/step-node-static.d.ts +3 -0
  397. package/dist/ui/step-node.d.ts +3 -0
  398. package/dist/ui/step-settings.d.ts +19 -0
  399. package/dist/ui/steps-node-static.d.ts +10 -0
  400. package/dist/ui/steps-node.d.ts +10 -0
  401. package/dist/ui/suggestion-node-static.d.ts +3 -0
  402. package/dist/ui/suggestion-node.d.ts +6 -0
  403. package/dist/ui/suggestion-toolbar-button.d.ts +1 -0
  404. package/dist/ui/switch.d.ts +4 -0
  405. package/dist/ui/tabbed-code-block-actions.d.ts +24 -0
  406. package/dist/ui/tabbed-code-block-header.d.ts +23 -0
  407. package/dist/ui/tabbed-code-block-language-selector.d.ts +7 -0
  408. package/dist/ui/tabbed-code-block-languages.d.ts +6 -0
  409. package/dist/ui/tabbed-code-block-node-static.d.ts +4 -0
  410. package/dist/ui/tabbed-code-block-node.d.ts +4 -0
  411. package/dist/ui/tabbed-code-block-settings.d.ts +18 -0
  412. package/dist/ui/tabbed-code-block-sync.d.ts +10 -0
  413. package/dist/ui/tabbed-code-block-tab-dropdown.d.ts +10 -0
  414. package/dist/ui/tabbed-code-block-tab-strip.d.ts +27 -0
  415. package/dist/ui/tabbed-code-block-tab-trigger.d.ts +14 -0
  416. package/dist/ui/tabbed-code-block-utils.d.ts +9 -0
  417. package/dist/ui/table-icons.d.ts +7 -0
  418. package/dist/ui/table-node-static.d.ts +9 -0
  419. package/dist/ui/table-node.d.ts +9 -0
  420. package/dist/ui/tabs-node-static.d.ts +4 -0
  421. package/dist/ui/tabs-node.d.ts +3 -0
  422. package/dist/ui/tabs.d.ts +10 -0
  423. package/dist/ui/textarea.d.ts +10 -0
  424. package/dist/ui/tile-node-static.d.ts +3 -0
  425. package/dist/ui/tile-node.d.ts +3 -0
  426. package/dist/ui/tile-settings.d.ts +18 -0
  427. package/dist/ui/tiles-node-static.d.ts +3 -0
  428. package/dist/ui/tiles-node.d.ts +3 -0
  429. package/dist/ui/toc-node-static.d.ts +2 -0
  430. package/dist/ui/toc-node.d.ts +2 -0
  431. package/dist/ui/toc-sidebar.d.ts +6 -0
  432. package/dist/ui/toc-state-sync.d.ts +5 -0
  433. package/dist/ui/toggle-node-static.d.ts +3 -0
  434. package/dist/ui/toggle-node-views.d.ts +35 -0
  435. package/dist/ui/toggle-node.d.ts +3 -0
  436. package/dist/ui/toggle-settings.d.ts +23 -0
  437. package/dist/ui/toggle.d.ts +8 -0
  438. package/dist/ui/toolbar.d.ts +37 -0
  439. package/dist/ui/tooltip-node-static.d.ts +3 -0
  440. package/dist/ui/tooltip-node.d.ts +3 -0
  441. package/dist/ui/tooltip-preview-content.d.ts +6 -0
  442. package/dist/ui/tooltip-settings.d.ts +21 -0
  443. package/dist/ui/tooltip-toolbar-button.d.ts +3 -0
  444. package/dist/ui/tooltip.d.ts +19 -0
  445. package/dist/ui/tree-context-value.d.ts +22 -0
  446. package/dist/ui/tree-context.d.ts +32 -0
  447. package/dist/ui/tree-file-node-static.d.ts +8 -0
  448. package/dist/ui/tree-file-node.d.ts +11 -0
  449. package/dist/ui/tree-folder-node-static.d.ts +9 -0
  450. package/dist/ui/tree-folder-node.d.ts +12 -0
  451. package/dist/ui/tree-item-utils.d.ts +11 -0
  452. package/dist/ui/tree-items-list.d.ts +11 -0
  453. package/dist/ui/tree-node-events.d.ts +19 -0
  454. package/dist/ui/tree-node-state.d.ts +14 -0
  455. package/dist/ui/tree-node-static.d.ts +12 -0
  456. package/dist/ui/tree-node.d.ts +5 -0
  457. package/dist/ui/tree-root-actions.d.ts +11 -0
  458. package/dist/ui/tree-settings.d.ts +18 -0
  459. package/dist/ui/turn-into-toolbar-button.d.ts +129 -0
  460. package/dist/ui/update-display-tags.d.ts +5 -0
  461. package/dist/ui/update-node-static.d.ts +2 -0
  462. package/dist/ui/update-node.d.ts +3 -0
  463. package/dist/ui/update-rss-settings.d.ts +9 -0
  464. package/dist/ui/update-settings.d.ts +21 -0
  465. package/dist/ui/update-tags-settings.d.ts +8 -0
  466. package/dist/ui/updates-node-static.d.ts +2 -0
  467. package/dist/ui/updates-node.d.ts +2 -0
  468. package/dist/ui/use-member-profile.d.ts +22 -0
  469. package/dist/ui/use-placeholder-max-file-size.d.ts +3 -0
  470. package/dist/vendor/slate-yjs-core.d.ts +1 -0
  471. package/dist/vendor/slate-yjs-core.js +2 -0
  472. package/dist/vendor/y-protocols-awareness.d.ts +1 -0
  473. package/dist/vendor/y-protocols-awareness.js +2 -0
  474. package/dist/vendor/yjs.d.ts +1 -0
  475. package/dist/vendor/yjs.js +2 -0
  476. package/package.json +255 -4
@@ -0,0 +1,3136 @@
1
+ "use client";
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __spreadValues = (a, b) => {
10
+ for (var prop in b || (b = {}))
11
+ if (__hasOwnProp.call(b, prop))
12
+ __defNormalProp(a, prop, b[prop]);
13
+ if (__getOwnPropSymbols)
14
+ for (var prop of __getOwnPropSymbols(b)) {
15
+ if (__propIsEnum.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ }
18
+ return a;
19
+ };
20
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
+ var __objRest = (source, exclude) => {
22
+ var target = {};
23
+ for (var prop in source)
24
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
25
+ target[prop] = source[prop];
26
+ if (source != null && __getOwnPropSymbols)
27
+ for (var prop of __getOwnPropSymbols(source)) {
28
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
29
+ target[prop] = source[prop];
30
+ }
31
+ return target;
32
+ };
33
+
34
+ // src/components/editor/plugins/basic-blocks-base-kit.tsx
35
+ import {
36
+ BaseBlockquotePlugin,
37
+ BaseH1Plugin,
38
+ BaseH2Plugin,
39
+ BaseH3Plugin,
40
+ BaseH4Plugin,
41
+ BaseH5Plugin,
42
+ BaseH6Plugin,
43
+ BaseHorizontalRulePlugin
44
+ } from "@platejs/basic-nodes";
45
+ import { BaseParagraphPlugin } from "platejs";
46
+
47
+ // src/lib/paragraph-html.ts
48
+ import { HtmlPlugin } from "platejs";
49
+ var BLANK_LINE_HTML = /<p>​<\/p>/g;
50
+ var prepareParagraphHtml = (html) => html.replace(BLANK_LINE_HTML, "<p></p>");
51
+ var overrideParagraphHtmlDeserialize = ({ editor }) => {
52
+ const { deserialize } = editor.getApi(HtmlPlugin).html;
53
+ return {
54
+ api: {
55
+ html: {
56
+ deserialize: (options2) => deserialize(__spreadProps(__spreadValues({}, options2), {
57
+ element: typeof options2.element === "string" ? prepareParagraphHtml(options2.element) : options2.element
58
+ }))
59
+ }
60
+ }
61
+ };
62
+ };
63
+
64
+ // src/ui/blockquote-node-static.tsx
65
+ import { SlateElement } from "platejs/static";
66
+ import { jsx } from "react/jsx-runtime";
67
+ function BlockquoteElementStatic(props) {
68
+ return /* @__PURE__ */ jsx(SlateElement, __spreadProps(__spreadValues({ as: "blockquote", className: "my-1 px-0.5 py-0.75" }, props), { children: /* @__PURE__ */ jsx("div", { className: "border-primary border-l-3 px-4", children: props.children }) }));
69
+ }
70
+
71
+ // src/ui/heading-node-static.tsx
72
+ import { cva } from "class-variance-authority";
73
+ import { PathApi } from "platejs";
74
+ import { SlateElement as SlateElement2 } from "platejs/static";
75
+
76
+ // src/context/heading-slug-context.tsx
77
+ import { createContext, useContext } from "react";
78
+ import { jsx as jsx2 } from "react/jsx-runtime";
79
+ var HeadingSlugContext = createContext(null);
80
+ var useHeadingSlug = () => {
81
+ return useContext(HeadingSlugContext);
82
+ };
83
+
84
+ // src/ui/heading-node-static.tsx
85
+ import { jsx as jsx3 } from "react/jsx-runtime";
86
+ var headingVariants = cva("relative mb-1 px-0.5 py-0.75 font-semibold leading-[1.3]!", {
87
+ variants: {
88
+ isFirstBlock: {
89
+ false: "",
90
+ true: "mt-0!"
91
+ },
92
+ variant: {
93
+ h1: "mt-8 text-[1.875em]",
94
+ h2: "mt-[1.4em] text-[1.5em]",
95
+ h3: "mt-[1em] text-[1.25em]",
96
+ h4: "mt-[0.75em] text-[1.1em]",
97
+ h5: "mt-[0.5em] text-[1em]",
98
+ h6: "mt-[0.5em] text-[0.875em]"
99
+ }
100
+ }
101
+ });
102
+ function HeadingElementStatic(_a) {
103
+ var _b = _a, {
104
+ children,
105
+ variant = "h1"
106
+ } = _b, props = __objRest(_b, [
107
+ "children",
108
+ "variant"
109
+ ]);
110
+ var _a2;
111
+ const isFirstBlock = PathApi.equals((_a2 = props.api.findPath(props.element)) != null ? _a2 : [], [0]);
112
+ const slugContext = useHeadingSlug();
113
+ const Heading = variant;
114
+ const originalId = props.element.id;
115
+ const id = originalId && (slugContext == null ? void 0 : slugContext.slugMap.get(originalId));
116
+ return /* @__PURE__ */ jsx3(Heading, { id, className: headingVariants({ isFirstBlock, variant }), children: /* @__PURE__ */ jsx3(SlateElement2, __spreadProps(__spreadValues({ as: "span" }, props), { children })) });
117
+ }
118
+ function H1ElementStatic(props) {
119
+ return /* @__PURE__ */ jsx3(HeadingElementStatic, __spreadValues({ variant: "h1" }, props));
120
+ }
121
+ function H2ElementStatic(props) {
122
+ return /* @__PURE__ */ jsx3(HeadingElementStatic, __spreadValues({ variant: "h2" }, props));
123
+ }
124
+ function H3ElementStatic(props) {
125
+ return /* @__PURE__ */ jsx3(HeadingElementStatic, __spreadValues({ variant: "h3" }, props));
126
+ }
127
+ function H4ElementStatic(props) {
128
+ return /* @__PURE__ */ jsx3(HeadingElementStatic, __spreadValues({ variant: "h4" }, props));
129
+ }
130
+ function H5ElementStatic(props) {
131
+ return /* @__PURE__ */ jsx3(HeadingElementStatic, __spreadValues({ variant: "h5" }, props));
132
+ }
133
+ function H6ElementStatic(props) {
134
+ return /* @__PURE__ */ jsx3(HeadingElementStatic, __spreadValues({ variant: "h6" }, props));
135
+ }
136
+
137
+ // src/ui/hr-node-static.tsx
138
+ import { SlateElement as SlateElement3 } from "platejs/static";
139
+
140
+ // src/lib/utils.ts
141
+ import { clsx } from "clsx";
142
+ import { twMerge } from "tailwind-merge";
143
+ var cn = (...inputs) => {
144
+ return twMerge(clsx(inputs));
145
+ };
146
+
147
+ // src/ui/hr-node-static.tsx
148
+ import { jsx as jsx4, jsxs } from "react/jsx-runtime";
149
+ function HrElementStatic(props) {
150
+ return /* @__PURE__ */ jsxs(SlateElement3, __spreadProps(__spreadValues({ className: "mb-1 py-2" }, props), { children: [
151
+ /* @__PURE__ */ jsx4("div", { contentEditable: false, children: /* @__PURE__ */ jsx4("hr", { className: cn("h-0.5 cursor-pointer rounded-sm border-none bg-muted bg-clip-content") }) }),
152
+ props.children
153
+ ] }));
154
+ }
155
+
156
+ // src/ui/paragraph-node-static.tsx
157
+ import { SlateElement as SlateElement4 } from "platejs/static";
158
+ import { jsx as jsx5 } from "react/jsx-runtime";
159
+ function ParagraphElementStatic(props) {
160
+ return /* @__PURE__ */ jsx5(
161
+ SlateElement4,
162
+ __spreadProps(__spreadValues({}, props), {
163
+ className: "my-px px-0.5 py-0.75",
164
+ style: {
165
+ backgroundColor: props.element.backgroundColor
166
+ },
167
+ children: props.children
168
+ })
169
+ );
170
+ }
171
+
172
+ // src/components/editor/plugins/basic-blocks-base-kit.tsx
173
+ var BaseBasicBlocksKit = [
174
+ BaseParagraphPlugin.withComponent(ParagraphElementStatic).overrideEditor(overrideParagraphHtmlDeserialize),
175
+ BaseH1Plugin.withComponent(H1ElementStatic),
176
+ BaseH2Plugin.withComponent(H2ElementStatic),
177
+ BaseH3Plugin.withComponent(H3ElementStatic),
178
+ BaseH4Plugin.withComponent(H4ElementStatic),
179
+ BaseH5Plugin.withComponent(H5ElementStatic),
180
+ BaseH6Plugin.withComponent(H6ElementStatic),
181
+ BaseBlockquotePlugin.withComponent(BlockquoteElementStatic),
182
+ BaseHorizontalRulePlugin.withComponent(HrElementStatic)
183
+ ];
184
+
185
+ // src/components/editor/plugins/basic-marks-base-kit.tsx
186
+ import {
187
+ BaseBoldPlugin,
188
+ BaseCodePlugin,
189
+ BaseHighlightPlugin,
190
+ BaseItalicPlugin,
191
+ BaseKbdPlugin,
192
+ BaseStrikethroughPlugin,
193
+ BaseSubscriptPlugin,
194
+ BaseSuperscriptPlugin,
195
+ BaseUnderlinePlugin
196
+ } from "@platejs/basic-nodes";
197
+
198
+ // src/ui/code-node-static.tsx
199
+ import { SlateLeaf } from "platejs/static";
200
+ import { jsx as jsx6 } from "react/jsx-runtime";
201
+ function CodeLeafStatic(props) {
202
+ return /* @__PURE__ */ jsx6(
203
+ SlateLeaf,
204
+ __spreadProps(__spreadValues({}, props), {
205
+ as: "code",
206
+ className: "whitespace-pre-wrap rounded-md bg-muted px-[0.3em] py-[0.2em] font-mono text-sm"
207
+ })
208
+ );
209
+ }
210
+
211
+ // src/ui/highlight-node-static.tsx
212
+ import { SlateLeaf as SlateLeaf2 } from "platejs/static";
213
+ import { jsx as jsx7 } from "react/jsx-runtime";
214
+ function HighlightLeafStatic(props) {
215
+ return /* @__PURE__ */ jsx7(SlateLeaf2, __spreadProps(__spreadValues({}, props), { as: "mark", className: "bg-highlight/30 text-inherit", children: props.children }));
216
+ }
217
+
218
+ // src/ui/kbd-node-static.tsx
219
+ import { SlateLeaf as SlateLeaf3 } from "platejs/static";
220
+ import { jsx as jsx8 } from "react/jsx-runtime";
221
+ function KbdLeafStatic(props) {
222
+ return /* @__PURE__ */ jsx8(
223
+ SlateLeaf3,
224
+ __spreadProps(__spreadValues({}, props), {
225
+ as: "kbd",
226
+ className: "rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-sm shadow-[rgba(255,255,255,0.1)_0px_0.5px_0px_0px_inset,rgb(248,249,250)_0px_1px_5px_0px_inset,rgb(193,200,205)_0px_0px_0px_0.5px,rgb(193,200,205)_0px_2px_1px_-1px,rgb(193,200,205)_0px_1px_0px_0px] dark:shadow-[rgba(255,255,255,0.1)_0px_0.5px_0px_0px_inset,rgb(26,29,30)_0px_1px_5px_0px_inset,rgb(76,81,85)_0px_0px_0px_0.5px,rgb(76,81,85)_0px_2px_1px_-1px,rgb(76,81,85)_0px_1px_0px_0px]",
227
+ children: props.children
228
+ })
229
+ );
230
+ }
231
+
232
+ // src/components/editor/plugins/basic-marks-base-kit.tsx
233
+ var BaseBasicMarksKit = [
234
+ BaseBoldPlugin,
235
+ BaseItalicPlugin,
236
+ BaseUnderlinePlugin,
237
+ BaseCodePlugin.withComponent(CodeLeafStatic),
238
+ BaseStrikethroughPlugin,
239
+ BaseSubscriptPlugin,
240
+ BaseSuperscriptPlugin,
241
+ BaseHighlightPlugin.withComponent(HighlightLeafStatic),
242
+ BaseKbdPlugin.withComponent(KbdLeafStatic)
243
+ ];
244
+
245
+ // src/components/editor/plugins/callout-base-kit.tsx
246
+ import { BaseCalloutPlugin } from "@platejs/callout";
247
+
248
+ // src/ui/callout-node-static.tsx
249
+ import {
250
+ CircleCheckIcon,
251
+ InfoIcon,
252
+ LightbulbIcon,
253
+ MessageSquareIcon,
254
+ OctagonAlertIcon,
255
+ PencilIcon,
256
+ TriangleAlertIcon
257
+ } from "lucide-react";
258
+ import { SlateElement as SlateElement5 } from "platejs/static";
259
+
260
+ // src/components/editor/plugins/callout-types.ts
261
+ var CALLOUT_PRESETS = {
262
+ note: { iconName: "pencil", color: "#1e40af", backgroundColor: "#dbeafe" },
263
+ warning: { iconName: "triangle-alert", color: "#b45309", backgroundColor: "#fef3c7" },
264
+ info: { iconName: "info", color: "#0891b2", backgroundColor: "#cffafe" },
265
+ tip: { iconName: "lightbulb", color: "#059669", backgroundColor: "#d1fae5" },
266
+ check: { iconName: "circle-check", color: "#16a34a", backgroundColor: "#dcfce7" },
267
+ danger: { iconName: "octagon-alert", color: "#dc2626", backgroundColor: "#fee2e2" },
268
+ custom: { iconName: "message-square", color: "#6b7280", backgroundColor: "#f3f4f6" }
269
+ };
270
+ var getCalloutPreset = (calloutType) => {
271
+ return CALLOUT_PRESETS[calloutType || "note"];
272
+ };
273
+ var getCalloutBackgroundColor = (element) => {
274
+ if (element.calloutType === "custom" && element.backgroundColor) {
275
+ return element.backgroundColor;
276
+ }
277
+ if (element.backgroundColor) {
278
+ return element.backgroundColor;
279
+ }
280
+ return getCalloutPreset(element.calloutType).backgroundColor;
281
+ };
282
+
283
+ // src/ui/callout-node-static.tsx
284
+ import { jsx as jsx9, jsxs as jsxs2 } from "react/jsx-runtime";
285
+ var CALLOUT_ICONS = {
286
+ pencil: PencilIcon,
287
+ "triangle-alert": TriangleAlertIcon,
288
+ info: InfoIcon,
289
+ lightbulb: LightbulbIcon,
290
+ "circle-check": CircleCheckIcon,
291
+ "octagon-alert": OctagonAlertIcon,
292
+ "message-square": MessageSquareIcon
293
+ };
294
+ function CalloutIcon({ type, customEmoji, className }) {
295
+ if (customEmoji) {
296
+ return /* @__PURE__ */ jsx9(
297
+ "span",
298
+ {
299
+ className: cn("text-lg", className),
300
+ style: {
301
+ fontFamily: '"Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Noto Color Emoji", "Segoe UI Symbol", "Android Emoji", EmojiSymbols'
302
+ },
303
+ children: customEmoji
304
+ }
305
+ );
306
+ }
307
+ const preset = CALLOUT_PRESETS[type];
308
+ const IconComponent = CALLOUT_ICONS[preset.iconName];
309
+ if (!IconComponent) {
310
+ return /* @__PURE__ */ jsx9(PencilIcon, { className, style: { color: preset.color } });
311
+ }
312
+ return /* @__PURE__ */ jsx9(IconComponent, { className, style: { color: preset.color } });
313
+ }
314
+ function CalloutElementStatic(props) {
315
+ const element = props.element;
316
+ const calloutType = element.calloutType || "note";
317
+ const backgroundColor = getCalloutBackgroundColor(element);
318
+ return /* @__PURE__ */ jsx9(
319
+ SlateElement5,
320
+ __spreadProps(__spreadValues({
321
+ className: "my-1 flex rounded-sm bg-muted p-4 pl-3",
322
+ style: {
323
+ backgroundColor
324
+ }
325
+ }, props), {
326
+ children: /* @__PURE__ */ jsxs2("div", { className: "flex w-full gap-2 rounded-md text-gray-800", children: [
327
+ /* @__PURE__ */ jsx9("div", { className: "flex size-6 shrink-0 items-center justify-center", children: /* @__PURE__ */ jsx9(CalloutIcon, { type: calloutType, customEmoji: element.customEmoji, className: "size-5" }) }),
328
+ /* @__PURE__ */ jsx9("div", { className: "w-full", children: props.children })
329
+ ] })
330
+ })
331
+ );
332
+ }
333
+
334
+ // src/components/editor/plugins/callout-base-kit.tsx
335
+ var BaseCalloutKit = [BaseCalloutPlugin.withComponent(CalloutElementStatic)];
336
+
337
+ // src/components/editor/plugins/code-block-base-kit.tsx
338
+ import { BaseCodeBlockPlugin, BaseCodeLinePlugin, BaseCodeSyntaxPlugin } from "@platejs/code-block";
339
+ import { all, createLowlight } from "lowlight";
340
+
341
+ // src/ui/code-block-node-static.tsx
342
+ import { AnimatePresence, motion } from "framer-motion";
343
+ import { CheckIcon, FilesIcon } from "lucide-react";
344
+ import { NodeApi } from "platejs";
345
+ import { SlateElement as SlateElement6, SlateLeaf as SlateLeaf4 } from "platejs/static";
346
+ import * as React3 from "react";
347
+
348
+ // src/hooks/use-copy-to-clipboard.ts
349
+ import * as React from "react";
350
+ import { toast } from "sonner";
351
+ var useCopyToClipboard = ({ timeout = 2e3 } = {}) => {
352
+ const [isCopied, setIsCopied] = React.useState(false);
353
+ const copyToClipboard = (value, { data, tooltip } = {}) => {
354
+ var _a;
355
+ if (typeof window === "undefined" || !((_a = navigator.clipboard) == null ? void 0 : _a.writeText)) {
356
+ return;
357
+ }
358
+ if (!value) {
359
+ return;
360
+ }
361
+ void navigator.clipboard.writeText(value).then(() => {
362
+ setIsCopied(true);
363
+ setTimeout(() => {
364
+ setIsCopied(false);
365
+ }, timeout);
366
+ });
367
+ if (tooltip) {
368
+ toast.success(tooltip, data);
369
+ }
370
+ };
371
+ return { copyToClipboard, isCopied };
372
+ };
373
+
374
+ // src/lib/line-marking.ts
375
+ var LineMarkTypes = ["add", "remove", "highlight"];
376
+ function parseLineRanges(rangeString) {
377
+ if (!rangeString.trim()) return [];
378
+ const lines = [];
379
+ const parts = rangeString.split(",");
380
+ for (const part of parts) {
381
+ const trimmed = part.trim();
382
+ if (!trimmed) continue;
383
+ if (trimmed.includes("-")) {
384
+ const [start, end] = trimmed.split("-").map((n) => parseInt(n.trim(), 10));
385
+ if (!Number.isNaN(start) && !Number.isNaN(end) && start <= end) {
386
+ for (let i = start; i <= end; i++) {
387
+ if (!lines.includes(i)) lines.push(i);
388
+ }
389
+ }
390
+ } else {
391
+ const num = parseInt(trimmed, 10);
392
+ if (!Number.isNaN(num) && !lines.includes(num)) {
393
+ lines.push(num);
394
+ }
395
+ }
396
+ }
397
+ return lines.sort((a, b) => a - b);
398
+ }
399
+ function parseLineMarkingMeta(meta) {
400
+ if (!(meta == null ? void 0 : meta.trim())) return { markings: [] };
401
+ const markings = [];
402
+ const parts = meta.trim().split(/\s+/);
403
+ for (const part of parts) {
404
+ if (part.includes("=")) {
405
+ const [typePart, rangesPart] = part.split("=");
406
+ const type = typePart.trim().toLowerCase();
407
+ if (LineMarkTypes.includes(type)) {
408
+ const lines = parseLineRanges(rangesPart);
409
+ for (const line of lines) {
410
+ markings.push({ line, type });
411
+ }
412
+ }
413
+ } else {
414
+ const lines = parseLineRanges(part);
415
+ for (const line of lines) {
416
+ markings.push({ line, type: "highlight" });
417
+ }
418
+ }
419
+ }
420
+ return { markings };
421
+ }
422
+ function getLineMarkType(index, config2) {
423
+ if (!(config2 == null ? void 0 : config2.markings.length)) return void 0;
424
+ const lineNumber = index + 1;
425
+ const marking = config2.markings.find((m) => m.line === lineNumber);
426
+ return marking == null ? void 0 : marking.type;
427
+ }
428
+
429
+ // src/lib/line-marking-context.tsx
430
+ import * as React2 from "react";
431
+ import { jsx as jsx10 } from "react/jsx-runtime";
432
+ var LineMarkingContext = React2.createContext(null);
433
+ function LineMarkingProvider({ children, config: config2 }) {
434
+ const lineCounterRef = React2.useRef(0);
435
+ React2.useEffect(() => {
436
+ lineCounterRef.current = 0;
437
+ }, [config2]);
438
+ const getNextLineIndex = React2.useCallback(() => {
439
+ const index = lineCounterRef.current;
440
+ lineCounterRef.current += 1;
441
+ return index;
442
+ }, []);
443
+ const resetLineCounter = React2.useCallback(() => {
444
+ lineCounterRef.current = 0;
445
+ }, []);
446
+ const value = React2.useMemo(
447
+ () => ({ config: config2, getNextLineIndex, resetLineCounter }),
448
+ [config2, getNextLineIndex, resetLineCounter]
449
+ );
450
+ return /* @__PURE__ */ jsx10(LineMarkingContext.Provider, { value, children });
451
+ }
452
+ function useLineMarking() {
453
+ const context = React2.useContext(LineMarkingContext);
454
+ const lineIndexRef = React2.useRef(null);
455
+ if (!context) {
456
+ return null;
457
+ }
458
+ if (lineIndexRef.current === null) {
459
+ lineIndexRef.current = context.getNextLineIndex();
460
+ }
461
+ const lineIndex = lineIndexRef.current;
462
+ const markType = getLineMarkType(lineIndex, context.config);
463
+ return { markType, lineIndex };
464
+ }
465
+
466
+ // src/ui/code-block-node-static.tsx
467
+ import { jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
468
+ function CodeBlockElementStatic(props) {
469
+ const { element, children } = props;
470
+ const { copyToClipboard } = useCopyToClipboard();
471
+ const [copied, setCopied] = React3.useState(false);
472
+ const lineMarkingConfig = parseLineMarkingMeta(element.lineMarkingMeta);
473
+ const handleCopy = () => {
474
+ const lines = element.children.map((child) => NodeApi.string(child));
475
+ copyToClipboard(lines.join("\n"), {
476
+ tooltip: "Copied code to clipboard"
477
+ });
478
+ setCopied(true);
479
+ setTimeout(() => setCopied(false), 2e3);
480
+ };
481
+ return /* @__PURE__ */ jsxs3(
482
+ SlateElement6,
483
+ __spreadProps(__spreadValues({
484
+ className: cn(
485
+ "group relative py-1",
486
+ "**:[.hljs-comment,.hljs-code,.hljs-formula]:text-[#6a737d]",
487
+ "**:[.hljs-keyword,.hljs-doctag,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_]:text-[#d73a49]",
488
+ "**:[.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_]:text-[#6f42c1]",
489
+ "**:[.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable]:text-[#005cc5]",
490
+ "**:[.hljs-regexp,.hljs-string,.hljs-meta_.hljs-string]:text-[#032f62]",
491
+ "**:[.hljs-built_in,.hljs-symbol]:text-[#e36209]",
492
+ "**:[.hljs-name,.hljs-quote,.hljs-selector-tag,.hljs-selector-pseudo]:text-[#22863a]",
493
+ "**:[.hljs-emphasis]:italic",
494
+ "**:[.hljs-strong]:font-bold",
495
+ "**:[.hljs-section]:font-bold **:[.hljs-section]:text-[#005cc5]",
496
+ "**:[.hljs-bullet]:text-[#735c0f]",
497
+ "**:[.hljs-addition]:bg-[#f0fff4] **:[.hljs-addition]:text-[#22863a]",
498
+ "**:[.hljs-deletion]:bg-[#ffeef0] **:[.hljs-deletion]:text-[#b31d28]"
499
+ )
500
+ }, props), {
501
+ children: [
502
+ /* @__PURE__ */ jsx11("pre", { className: "overflow-x-auto rounded-md bg-muted pt-8.5 pr-4 pb-8 pl-8 font-mono text-sm leading-[normal] [tab-size:2] print:break-inside-avoid", children: /* @__PURE__ */ jsx11("code", { children: /* @__PURE__ */ jsx11(LineMarkingProvider, { config: lineMarkingConfig, children }) }) }),
503
+ /* @__PURE__ */ jsx11("div", { className: "absolute top-2 right-2 z-10 opacity-0 transition-opacity duration-300 group-hover:opacity-100", children: /* @__PURE__ */ jsx11(
504
+ "button",
505
+ {
506
+ type: "button",
507
+ className: cn(
508
+ "flex cursor-pointer items-center gap-1.5 rounded-md px-2 py-1 text-xs transition-colors",
509
+ copied ? "bg-primary/10 text-primary" : "bg-background/80 text-muted-foreground hover:bg-background hover:text-foreground"
510
+ ),
511
+ onClick: handleCopy,
512
+ title: "Copy code",
513
+ children: /* @__PURE__ */ jsx11(AnimatePresence, { mode: "wait", initial: false, children: copied ? /* @__PURE__ */ jsxs3(
514
+ motion.div,
515
+ {
516
+ initial: { scale: 0, opacity: 0 },
517
+ animate: { scale: 1, opacity: 1 },
518
+ exit: { scale: 0, opacity: 0 },
519
+ transition: { duration: 0.15 },
520
+ className: "flex items-center gap-1.5",
521
+ children: [
522
+ /* @__PURE__ */ jsx11(CheckIcon, { className: "size-3.5" }),
523
+ /* @__PURE__ */ jsx11("span", { children: "Copied" })
524
+ ]
525
+ },
526
+ "check"
527
+ ) : /* @__PURE__ */ jsxs3(
528
+ motion.div,
529
+ {
530
+ initial: { scale: 0, opacity: 0 },
531
+ animate: { scale: 1, opacity: 1 },
532
+ exit: { scale: 0, opacity: 0 },
533
+ transition: { duration: 0.15 },
534
+ className: "flex items-center gap-1.5",
535
+ children: [
536
+ /* @__PURE__ */ jsx11(FilesIcon, { className: "size-3.5" }),
537
+ /* @__PURE__ */ jsx11("span", { children: "Copy" })
538
+ ]
539
+ },
540
+ "copy"
541
+ ) })
542
+ }
543
+ ) })
544
+ ]
545
+ })
546
+ );
547
+ }
548
+ function CodeLineElementStatic(props) {
549
+ const lineMarking = useLineMarking();
550
+ const getBackgroundStyle = () => {
551
+ if (!(lineMarking == null ? void 0 : lineMarking.markType)) return void 0;
552
+ if (lineMarking.markType === "add") return { backgroundColor: "rgba(34, 134, 58, 0.15)" };
553
+ if (lineMarking.markType === "remove") return { backgroundColor: "rgba(179, 29, 40, 0.15)" };
554
+ if (lineMarking.markType === "highlight") return { backgroundColor: "rgba(34, 134, 58, 0.2)" };
555
+ return void 0;
556
+ };
557
+ const backgroundStyle = getBackgroundStyle();
558
+ return /* @__PURE__ */ jsx11(
559
+ SlateElement6,
560
+ __spreadProps(__spreadValues({}, props), {
561
+ className: cn(props.className, backgroundStyle && "-mx-4 px-4"),
562
+ style: __spreadValues(__spreadValues({}, props.style), backgroundStyle),
563
+ "data-line": lineMarking ? lineMarking.lineIndex + 1 : void 0,
564
+ "data-mark-type": (lineMarking == null ? void 0 : lineMarking.markType) || void 0
565
+ })
566
+ );
567
+ }
568
+ function CodeSyntaxLeafStatic(props) {
569
+ const tokenClassName = props.leaf.className;
570
+ return /* @__PURE__ */ jsx11(SlateLeaf4, __spreadProps(__spreadValues({}, props), { className: tokenClassName }));
571
+ }
572
+
573
+ // src/components/editor/plugins/code-block-base-kit.tsx
574
+ var lowlight = createLowlight(all);
575
+ var BaseCodeBlockKit = [
576
+ BaseCodeBlockPlugin.configure({
577
+ node: { component: CodeBlockElementStatic },
578
+ options: { lowlight }
579
+ }),
580
+ BaseCodeLinePlugin.withComponent(CodeLineElementStatic),
581
+ BaseCodeSyntaxPlugin.withComponent(CodeSyntaxLeafStatic)
582
+ ];
583
+
584
+ // src/components/editor/plugins/column-base-kit.tsx
585
+ import { BaseColumnItemPlugin, BaseColumnPlugin } from "@platejs/layout";
586
+
587
+ // src/ui/column-node-static.tsx
588
+ import { SlateElement as SlateElement7 } from "platejs/static";
589
+ import { jsx as jsx12 } from "react/jsx-runtime";
590
+ function ColumnElementStatic(props) {
591
+ const { width } = props.element;
592
+ return /* @__PURE__ */ jsx12(SlateElement7, __spreadValues({ className: "border border-transparent p-1.5", style: { width: width != null ? width : "100%" } }, props));
593
+ }
594
+ function ColumnGroupElementStatic(props) {
595
+ return /* @__PURE__ */ jsx12(SlateElement7, __spreadProps(__spreadValues({ className: "my-2" }, props), { children: /* @__PURE__ */ jsx12("div", { className: "flex size-full gap-4 rounded", children: props.children }) }));
596
+ }
597
+
598
+ // src/components/editor/plugins/column-base-kit.tsx
599
+ var BaseColumnKit = [
600
+ BaseColumnPlugin.withComponent(ColumnGroupElementStatic),
601
+ BaseColumnItemPlugin.withComponent(ColumnElementStatic)
602
+ ];
603
+
604
+ // src/components/editor/plugins/comment-base-kit.tsx
605
+ import { BaseCommentPlugin } from "@platejs/comment";
606
+
607
+ // src/ui/comment-node-static.tsx
608
+ import { SlateLeaf as SlateLeaf5 } from "platejs/static";
609
+ import { jsx as jsx13 } from "react/jsx-runtime";
610
+ function CommentLeafStatic(props) {
611
+ return /* @__PURE__ */ jsx13(SlateLeaf5, __spreadProps(__spreadValues({}, props), { className: "border-b-2 border-b-highlight/35 bg-highlight/15" }));
612
+ }
613
+
614
+ // src/components/editor/plugins/comment-base-kit.tsx
615
+ var BaseCommentKit = [BaseCommentPlugin.withComponent(CommentLeafStatic)];
616
+
617
+ // src/components/editor/plugins/date-base-kit.tsx
618
+ import { BaseDatePlugin } from "@platejs/date";
619
+
620
+ // src/ui/date-node-static.tsx
621
+ import { SlateElement as SlateElement8 } from "platejs/static";
622
+ import { jsx as jsx14, jsxs as jsxs4 } from "react/jsx-runtime";
623
+ function DateElementStatic(props) {
624
+ const { element } = props;
625
+ return /* @__PURE__ */ jsxs4(SlateElement8, __spreadProps(__spreadValues({ className: "inline-block" }, props), { children: [
626
+ /* @__PURE__ */ jsx14("span", { className: "w-fit rounded-sm bg-muted px-1 text-muted-foreground", children: element.date ? (() => {
627
+ const today = /* @__PURE__ */ new Date();
628
+ const elementDate = new Date(element.date);
629
+ const isToday = elementDate.getDate() === today.getDate() && elementDate.getMonth() === today.getMonth() && elementDate.getFullYear() === today.getFullYear();
630
+ const isYesterday = new Date(today.setDate(today.getDate() - 1)).toDateString() === elementDate.toDateString();
631
+ const isTomorrow = new Date(today.setDate(today.getDate() + 2)).toDateString() === elementDate.toDateString();
632
+ if (isToday) return "Today";
633
+ if (isYesterday) return "Yesterday";
634
+ if (isTomorrow) return "Tomorrow";
635
+ return elementDate.toLocaleDateString(void 0, {
636
+ day: "numeric",
637
+ month: "long",
638
+ year: "numeric"
639
+ });
640
+ })() : /* @__PURE__ */ jsx14("span", { children: "Pick a date" }) }),
641
+ props.children
642
+ ] }));
643
+ }
644
+
645
+ // src/components/editor/plugins/date-base-kit.tsx
646
+ var BaseDateKit = [BaseDatePlugin.withComponent(DateElementStatic)];
647
+
648
+ // src/components/editor/plugins/font-base-kit.tsx
649
+ import {
650
+ BaseFontBackgroundColorPlugin,
651
+ BaseFontColorPlugin,
652
+ BaseFontFamilyPlugin,
653
+ BaseFontSizePlugin
654
+ } from "@platejs/basic-styles";
655
+ import { KEYS } from "platejs";
656
+ var options = {
657
+ inject: { targetPlugins: [KEYS.p] }
658
+ };
659
+ var BaseFontKit = [
660
+ BaseFontColorPlugin.configure(options),
661
+ BaseFontBackgroundColorPlugin.configure(options),
662
+ BaseFontSizePlugin.configure(options),
663
+ BaseFontFamilyPlugin.configure(options)
664
+ ];
665
+
666
+ // src/components/editor/plugins/link-base-kit.tsx
667
+ import { BaseLinkPlugin } from "@platejs/link";
668
+
669
+ // src/ui/link-node-static.tsx
670
+ import { NodeApi as NodeApi2 } from "platejs";
671
+ import { SlateElement as SlateElement9 } from "platejs/static";
672
+
673
+ // src/context/editor-adapter-context.tsx
674
+ import { createContext as createContext3, useContext as useContext3 } from "react";
675
+
676
+ // src/ui/link-reference.ts
677
+ var TARGET_ID_MAX_LENGTH = 128;
678
+ var CONTENT_TYPE_MAX_LENGTH = 64;
679
+ var TARGET_ID_PATTERN = /^[A-Za-z0-9._~-]+$/;
680
+ var CONTENT_TYPE_PATTERN = /^[a-z0-9_]+$/;
681
+ var isPlainObject = (value) => {
682
+ return typeof value === "object" && value !== null && !Array.isArray(value);
683
+ };
684
+ var isSafeTargetId = (value) => {
685
+ return typeof value === "string" && value.length > 0 && value.length <= TARGET_ID_MAX_LENGTH && !value.includes("\0") && TARGET_ID_PATTERN.test(value);
686
+ };
687
+ var isSafeContentType = (value) => {
688
+ return typeof value === "string" && value.length > 0 && value.length <= CONTENT_TYPE_MAX_LENGTH && CONTENT_TYPE_PATTERN.test(value);
689
+ };
690
+ var isEditorialPlatform = (value) => {
691
+ return value === "apps" || value === "conjoin";
692
+ };
693
+ var parseLinkReference = (value) => {
694
+ if (!isPlainObject(value)) {
695
+ return null;
696
+ }
697
+ if (value.scope === "editorial") {
698
+ if (!isEditorialPlatform(value.platform) || !isSafeContentType(value.contentType) || !isSafeTargetId(value.targetId)) {
699
+ return null;
700
+ }
701
+ return {
702
+ scope: "editorial",
703
+ platform: value.platform,
704
+ contentType: value.contentType,
705
+ targetId: value.targetId
706
+ };
707
+ }
708
+ if (value.scope === "workspace-doc") {
709
+ if (!isSafeTargetId(value.targetId)) {
710
+ return null;
711
+ }
712
+ return { scope: "workspace-doc", targetId: value.targetId };
713
+ }
714
+ return null;
715
+ };
716
+ var linkReferenceKey = (reference) => {
717
+ if (reference.scope === "editorial") {
718
+ return JSON.stringify(["editorial", reference.platform, reference.contentType, reference.targetId]);
719
+ }
720
+ return JSON.stringify(["workspace-doc", reference.targetId]);
721
+ };
722
+ var readElementReference = (element) => {
723
+ return parseLinkReference(element.reference);
724
+ };
725
+
726
+ // src/context/editor-adapter-context.tsx
727
+ import { jsx as jsx15 } from "react/jsx-runtime";
728
+ var EMPTY_ARRAY = [];
729
+ var NullEditorAdapter = {
730
+ identity: { id: "anonymous", name: "Guest" },
731
+ permissions: {
732
+ canMention: false,
733
+ canLinkPage: false,
734
+ canUseAI: false,
735
+ canMutate: false
736
+ },
737
+ mentions: {
738
+ searchMembers: async () => EMPTY_ARRAY
739
+ },
740
+ pageLinks: {
741
+ searchPages: async () => EMPTY_ARRAY,
742
+ resolvePage: async () => null
743
+ },
744
+ ai: null,
745
+ upload: null,
746
+ collab: null,
747
+ comments: null,
748
+ inspector: null
749
+ };
750
+ var EditorAdapterContext = createContext3(NullEditorAdapter);
751
+ var useEditorAdapter = () => useContext3(EditorAdapterContext);
752
+
753
+ // src/context/link-resolution-context.tsx
754
+ import {
755
+ createContext as createContext4,
756
+ useCallback as useCallback2,
757
+ useContext as useContext4,
758
+ useEffect as useEffect2,
759
+ useMemo as useMemo2,
760
+ useRef as useRef2,
761
+ useSyncExternalStore
762
+ } from "react";
763
+ import { jsx as jsx16 } from "react/jsx-runtime";
764
+ var LinkResolutionContext = createContext4(null);
765
+ var NOOP_UNSUBSCRIBE = () => {
766
+ };
767
+ var usePagePreview = (reference) => {
768
+ const store = useContext4(LinkResolutionContext);
769
+ const key = reference ? linkReferenceKey(reference) : null;
770
+ const subscribe2 = useCallback2(
771
+ (onChange) => {
772
+ if (!store || !key) return NOOP_UNSUBSCRIBE;
773
+ return store.pages.subscribe(key, onChange);
774
+ },
775
+ [store, key]
776
+ );
777
+ const getSnapshot = useCallback2(() => store && key ? store.pages.get(key) : null, [store, key]);
778
+ return useSyncExternalStore(subscribe2, getSnapshot, getSnapshot);
779
+ };
780
+ var useHasLinkSeed = (url) => {
781
+ const store = useContext4(LinkResolutionContext);
782
+ if (!store || !url) return false;
783
+ return store.seededUrls.has(url);
784
+ };
785
+ var useLinkMetadata = (url) => {
786
+ const store = useContext4(LinkResolutionContext);
787
+ const subscribe2 = useCallback2(
788
+ (onChange) => {
789
+ if (!store || !url) return NOOP_UNSUBSCRIBE;
790
+ return store.links.subscribe(url, onChange);
791
+ },
792
+ [store, url]
793
+ );
794
+ const getSnapshot = useCallback2(() => store && url ? store.links.get(url) : null, [store, url]);
795
+ return useSyncExternalStore(subscribe2, getSnapshot, getSnapshot);
796
+ };
797
+
798
+ // src/ui/smart-link.ts
799
+ var DEFAULT_SMART_LINK_DISPLAY_MODE = "inline";
800
+ var ALLOWED_SMART_LINK_PROTOCOLS = /* @__PURE__ */ new Set(["http:", "https:", "mailto:", "tel:"]);
801
+ var SMART_LINK_SCHEME_PATTERN = /^[A-Za-z][A-Za-z0-9+.-]*:/;
802
+ var SMART_LINK_HOSTNAME_PATTERN = /^(?:www\.|[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)+)(?::\d+)?(?:[/?#].*)?$/;
803
+ var isRelativeSmartLinkUrl = (url) => {
804
+ if (url.startsWith("//")) return false;
805
+ return url.startsWith("/") || url.startsWith("#") || url.startsWith("?");
806
+ };
807
+ var normalizeSmartLinkDisplayMode = (value) => {
808
+ return value === "url" || value === "card" || value === "inline" ? value : DEFAULT_SMART_LINK_DISPLAY_MODE;
809
+ };
810
+ var getSmartLinkTitle = (title, url) => {
811
+ var _a;
812
+ const trimmedTitle = (_a = title == null ? void 0 : title.trim()) != null ? _a : "";
813
+ if (trimmedTitle.length > 0) {
814
+ return trimmedTitle;
815
+ }
816
+ return url.trim();
817
+ };
818
+ var normalizeSmartLinkInputUrl = (url) => {
819
+ const trimmedUrl = url.trim();
820
+ if (SMART_LINK_SCHEME_PATTERN.test(trimmedUrl) || trimmedUrl.startsWith("/") || trimmedUrl.startsWith("#") || trimmedUrl.startsWith("?")) {
821
+ return trimmedUrl;
822
+ }
823
+ if (SMART_LINK_HOSTNAME_PATTERN.test(trimmedUrl)) {
824
+ return `https://${trimmedUrl}`;
825
+ }
826
+ return trimmedUrl;
827
+ };
828
+ var getSafeSmartLinkUrl = (url) => {
829
+ const normalizedUrl = normalizeSmartLinkInputUrl(url);
830
+ if (normalizedUrl.length === 0) {
831
+ return null;
832
+ }
833
+ if (isRelativeSmartLinkUrl(normalizedUrl)) {
834
+ return normalizedUrl;
835
+ }
836
+ try {
837
+ const target = new URL(normalizedUrl);
838
+ if (!ALLOWED_SMART_LINK_PROTOCOLS.has(target.protocol)) {
839
+ return null;
840
+ }
841
+ return normalizedUrl;
842
+ } catch (e) {
843
+ return null;
844
+ }
845
+ };
846
+ var getSmartLinkAnchorProps = (url) => {
847
+ const safeUrl = getSafeSmartLinkUrl(url);
848
+ if (!safeUrl) {
849
+ return {};
850
+ }
851
+ if (isRelativeSmartLinkUrl(safeUrl)) {
852
+ return { href: safeUrl };
853
+ }
854
+ try {
855
+ const target = new URL(safeUrl);
856
+ if (target.protocol === "http:" || target.protocol === "https:") {
857
+ return {
858
+ href: target.href,
859
+ rel: "noopener noreferrer",
860
+ target: "_blank"
861
+ };
862
+ }
863
+ return { href: safeUrl };
864
+ } catch (e) {
865
+ return {};
866
+ }
867
+ };
868
+
869
+ // src/ui/smart-link-view.tsx
870
+ import { ArrowUpRightIcon, FileTextIcon, LinkIcon } from "lucide-react";
871
+ import { useCallback as useCallback3, useState as useState3 } from "react";
872
+ import { jsx as jsx17, jsxs as jsxs5 } from "react/jsx-runtime";
873
+ var PLAIN_LINK_CLASS_NAME = "inline font-medium text-primary underline decoration-primary/45 decoration-1 underline-offset-[0.2em] transition-colors hover:decoration-primary hover:decoration-2";
874
+ function SmartLinkIcon({ icon, faviconUrl, provider, className }) {
875
+ const [failedSrc, setFailedSrc] = useState3(null);
876
+ const isPageLike = provider === "Page" || provider === "Internal link";
877
+ const showFavicon = typeof faviconUrl === "string" && faviconUrl.length > 0 && failedSrc !== faviconUrl;
878
+ const handleFaviconError = useCallback3(() => {
879
+ setFailedSrc(faviconUrl != null ? faviconUrl : null);
880
+ }, [faviconUrl]);
881
+ return /* @__PURE__ */ jsx17(
882
+ "span",
883
+ {
884
+ className: cn(
885
+ "inline-flex shrink-0 items-center justify-center text-muted-foreground",
886
+ isPageLike && "text-[#4C9A2A]",
887
+ className
888
+ ),
889
+ children: showFavicon ? /* @__PURE__ */ jsx17(
890
+ "img",
891
+ {
892
+ alt: "",
893
+ className: "size-full rounded-[0.2em] object-contain",
894
+ loading: "lazy",
895
+ onError: handleFaviconError,
896
+ referrerPolicy: "no-referrer",
897
+ src: faviconUrl
898
+ }
899
+ ) : icon != null ? icon : isPageLike ? /* @__PURE__ */ jsx17(FileTextIcon, { className: "size-4" }) : /* @__PURE__ */ jsx17(LinkIcon, { className: "size-4" })
900
+ }
901
+ );
902
+ }
903
+ function SmartLinkContent({ link, className }) {
904
+ if (link.displayMode === "card") {
905
+ return /* @__PURE__ */ jsx17(SmartLinkCardContent, { link, className });
906
+ }
907
+ if (link.displayMode === "url") {
908
+ return /* @__PURE__ */ jsx17(SmartLinkUrlContent, { link, className });
909
+ }
910
+ return /* @__PURE__ */ jsx17(SmartLinkInlineContent, { link, className });
911
+ }
912
+ function SmartLinkInlineContent({ link, className }) {
913
+ return /* @__PURE__ */ jsxs5(
914
+ "span",
915
+ {
916
+ className: cn(
917
+ "inline-flex max-w-full items-center gap-[0.2em] rounded-[0.25em] px-[0.4em] py-[0.1em] align-[-0.28em] font-medium text-[#0C66E4] leading-[1.3] outline outline-transparent transition-colors hover:bg-[#0C66E4]/5 hover:outline-[#0C66E4]/30",
918
+ className
919
+ ),
920
+ children: [
921
+ /* @__PURE__ */ jsx17(SmartLinkIcon, { icon: link.icon, faviconUrl: link.faviconUrl, provider: link.provider, className: "size-[0.9em]" }),
922
+ /* @__PURE__ */ jsx17("span", { className: "min-w-0 truncate leading-[1.3]", children: link.title }),
923
+ link.status ? /* @__PURE__ */ jsx17(SmartLinkStatus, { status: link.status }) : null
924
+ ]
925
+ }
926
+ );
927
+ }
928
+ function SmartLinkUrlContent({ link, className }) {
929
+ return /* @__PURE__ */ jsxs5(
930
+ "span",
931
+ {
932
+ className: cn(
933
+ "inline max-w-full wrap-break-word border-[#0C66E4]/35 border-b font-medium text-[#0C66E4] leading-[inherit]",
934
+ className
935
+ ),
936
+ children: [
937
+ /* @__PURE__ */ jsx17(LinkIcon, { className: "mr-1 inline size-[0.9em] align-[-0.08em] text-muted-foreground" }),
938
+ link.url
939
+ ]
940
+ }
941
+ );
942
+ }
943
+ function SmartLinkCardContent({ link, className }) {
944
+ var _a;
945
+ return /* @__PURE__ */ jsxs5(
946
+ "span",
947
+ {
948
+ className: cn(
949
+ "block w-full rounded-md border border-border bg-background p-4 text-foreground shadow-none transition-colors hover:border-muted-foreground/40",
950
+ className
951
+ ),
952
+ children: [
953
+ /* @__PURE__ */ jsxs5("span", { className: "flex min-w-0 items-start gap-3", children: [
954
+ /* @__PURE__ */ jsx17(
955
+ SmartLinkIcon,
956
+ {
957
+ icon: link.icon,
958
+ faviconUrl: link.faviconUrl,
959
+ provider: link.provider,
960
+ className: "mt-0.5 size-6"
961
+ }
962
+ ),
963
+ /* @__PURE__ */ jsxs5("span", { className: "min-w-0 flex-1", children: [
964
+ /* @__PURE__ */ jsxs5("span", { className: "flex min-w-0 items-start gap-3", children: [
965
+ /* @__PURE__ */ jsx17("span", { className: "min-w-0 flex-1 truncate font-semibold text-[#0C66E4] text-base leading-6", children: link.title }),
966
+ link.status ? /* @__PURE__ */ jsx17(SmartLinkStatus, { status: link.status }) : null
967
+ ] }),
968
+ /* @__PURE__ */ jsxs5("span", { className: "mt-2 flex min-w-0 items-center gap-2 text-muted-foreground text-sm", children: [
969
+ link.provider ? /* @__PURE__ */ jsx17("span", { className: "shrink-0", children: link.provider }) : null,
970
+ link.provider && link.description ? /* @__PURE__ */ jsx17("span", { className: "text-muted-foreground/35", children: "\xB7" }) : null,
971
+ link.description ? /* @__PURE__ */ jsx17("span", { className: "line-clamp-1 min-w-0", children: link.description }) : null
972
+ ] })
973
+ ] }),
974
+ link.coverImage ? /* @__PURE__ */ jsx17(SmartLinkCardImage, { src: link.coverImage }) : null
975
+ ] }),
976
+ /* @__PURE__ */ jsxs5("span", { className: "mt-8 flex items-end justify-between gap-4", children: [
977
+ /* @__PURE__ */ jsxs5("span", { className: "flex min-w-0 items-center gap-2 text-muted-foreground text-sm", children: [
978
+ /* @__PURE__ */ jsx17(
979
+ SmartLinkIcon,
980
+ {
981
+ faviconUrl: link.faviconUrl,
982
+ provider: link.provider,
983
+ className: "size-5 rounded bg-[#0C66E4] p-1 text-white"
984
+ }
985
+ ),
986
+ /* @__PURE__ */ jsx17("span", { className: "truncate", children: (_a = link.provider) != null ? _a : "Link" })
987
+ ] }),
988
+ /* @__PURE__ */ jsxs5("span", { className: "inline-flex shrink-0 items-center gap-1 rounded border bg-background px-3 py-1 font-medium text-muted-foreground text-sm", children: [
989
+ "Open link",
990
+ /* @__PURE__ */ jsx17(ArrowUpRightIcon, { className: "size-3.5" })
991
+ ] })
992
+ ] })
993
+ ]
994
+ }
995
+ );
996
+ }
997
+ function SmartLinkCardImage({ src }) {
998
+ const [hasFailed, setHasFailed] = useState3(false);
999
+ const handleError = useCallback3(() => {
1000
+ setHasFailed(true);
1001
+ }, []);
1002
+ if (hasFailed) return null;
1003
+ return /* @__PURE__ */ jsx17(
1004
+ "img",
1005
+ {
1006
+ alt: "",
1007
+ className: "h-12 w-20 shrink-0 rounded-sm border object-cover",
1008
+ loading: "lazy",
1009
+ onError: handleError,
1010
+ referrerPolicy: "no-referrer",
1011
+ src
1012
+ }
1013
+ );
1014
+ }
1015
+ function SmartLinkStatus({ status }) {
1016
+ return /* @__PURE__ */ jsx17("span", { className: "inline-flex shrink-0 rounded bg-zinc-200 px-1.5 py-0.5 font-semibold text-[11px] text-zinc-800 uppercase leading-4", children: status });
1017
+ }
1018
+
1019
+ // src/ui/link-node-static.tsx
1020
+ import { jsx as jsx18 } from "react/jsx-runtime";
1021
+ function LinkElementStatic(_a) {
1022
+ var _b = _a, { isPlainLink = false } = _b, props = __objRest(_b, ["isPlainLink"]);
1023
+ var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
1024
+ const element = props.element;
1025
+ const adapter = useEditorAdapter();
1026
+ const displayMode = normalizeSmartLinkDisplayMode(element.displayMode);
1027
+ const text = NodeApi2.string(element);
1028
+ const reference = readElementReference(element);
1029
+ const isPageReference = reference !== null;
1030
+ const canResolvePage = isPageReference && adapter.permissions.canLinkPage;
1031
+ const canNavigateUrl = adapter.pageLinks.canNavigateUrl;
1032
+ const page = usePagePreview(canResolvePage ? reference : null);
1033
+ const elementUrl = typeof element.url === "string" ? element.url.trim() : "";
1034
+ const hasExternalUrl = !isPageReference && elementUrl.length > 0;
1035
+ const hasSeed = useHasLinkSeed(hasExternalUrl ? elementUrl : null);
1036
+ const canResolveMetadata = !isPlainLink && hasExternalUrl && (hasSeed || Boolean(adapter.pageLinks.resolveLinkMetadata) && (displayMode === "card" || displayMode === "inline"));
1037
+ const metadata = useLinkMetadata(canResolveMetadata ? elementUrl : null);
1038
+ const isInternal = isPageReference || (metadata == null ? void 0 : metadata.kind) === "internal";
1039
+ const navigationUrl = isPageReference ? (_a2 = page == null ? void 0 : page.url) != null ? _a2 : null : hasExternalUrl ? elementUrl : null;
1040
+ const isNavigationAllowed = navigationUrl !== null && (isPageReference || (metadata == null ? void 0 : metadata.kind) !== "internal" && ((_b2 = canNavigateUrl == null ? void 0 : canNavigateUrl(navigationUrl)) != null ? _b2 : true));
1041
+ const displayUrl = navigationUrl != null ? navigationUrl : elementUrl;
1042
+ const authoredText = ((_c = element.title) != null ? _c : text).trim();
1043
+ const authoredTextIsBareUrl = authoredText.length === 0 || authoredText === elementUrl;
1044
+ const resolvedTitle = (_d = page == null ? void 0 : page.title) != null ? _d : isInternal || displayMode === "card" || authoredTextIsBareUrl ? metadata == null ? void 0 : metadata.title : void 0;
1045
+ const title = getSmartLinkTitle((_e = resolvedTitle != null ? resolvedTitle : element.title) != null ? _e : text, displayUrl);
1046
+ const anchorProps = isNavigationAllowed && navigationUrl !== null ? getSmartLinkAnchorProps(navigationUrl) : {};
1047
+ const smartLinkClassName = displayMode === "card" ? "my-2 block w-full no-underline" : "inline no-underline";
1048
+ const linkClassName = isPlainLink ? PLAIN_LINK_CLASS_NAME : smartLinkClassName;
1049
+ const link = {
1050
+ displayMode,
1051
+ title,
1052
+ url: displayUrl,
1053
+ icon: (_f = page == null ? void 0 : page.icon) != null ? _f : element.icon,
1054
+ faviconUrl: (_g = metadata == null ? void 0 : metadata.faviconUrl) != null ? _g : null,
1055
+ description: (_h = metadata == null ? void 0 : metadata.description) != null ? _h : null,
1056
+ coverImage: (_j = (_i = page == null ? void 0 : page.coverImage) != null ? _i : metadata == null ? void 0 : metadata.imageUrl) != null ? _j : null,
1057
+ status: (_l = (_k = page == null ? void 0 : page.status) != null ? _k : metadata == null ? void 0 : metadata.status) != null ? _l : null,
1058
+ provider: page ? "Page" : (_m = metadata == null ? void 0 : metadata.provider) != null ? _m : isInternal ? "Internal link" : "Web link"
1059
+ };
1060
+ return /* @__PURE__ */ jsx18(
1061
+ SlateElement9,
1062
+ __spreadProps(__spreadValues({}, props), {
1063
+ as: "a",
1064
+ attributes: __spreadProps(__spreadValues({}, props.attributes), {
1065
+ // Plate's BaseLinkPlugin injects href={element.url} via node props, so
1066
+ // every attribute is overridden explicitly; spreading {} on refusal
1067
+ // would leave the plugin's raw href clickable.
1068
+ href: anchorProps.href,
1069
+ rel: anchorProps.rel,
1070
+ target: anchorProps.target
1071
+ }),
1072
+ className: linkClassName,
1073
+ children: isPlainLink ? props.children : /* @__PURE__ */ jsx18(SmartLinkContent, { link })
1074
+ })
1075
+ );
1076
+ }
1077
+ var PlainLinkElementStatic = (props) => /* @__PURE__ */ jsx18(LinkElementStatic, __spreadProps(__spreadValues({}, props), { isPlainLink: true }));
1078
+
1079
+ // src/components/editor/plugins/link-base-kit.tsx
1080
+ var BaseLinkKit = [BaseLinkPlugin.withComponent(LinkElementStatic)];
1081
+ var BasePlainLinkKit = [BaseLinkPlugin.withComponent(PlainLinkElementStatic)];
1082
+
1083
+ // src/components/editor/plugins/list-base-kit.tsx
1084
+ import { BaseListPlugin } from "@platejs/list";
1085
+ import { KEYS as KEYS3 } from "platejs";
1086
+
1087
+ // src/lib/list-html.ts
1088
+ import { HtmlPlugin as HtmlPlugin2, isHtmlBlockElement, postCleanHtml } from "platejs";
1089
+ var LIST_TAG_NAMES = /* @__PURE__ */ new Set(["UL", "OL"]);
1090
+ var isListElement = (node) => node instanceof HTMLElement && LIST_TAG_NAMES.has(node.tagName);
1091
+ var countListAncestors = (item) => {
1092
+ let count = 0;
1093
+ for (let parent = item.parentElement; parent; parent = parent.parentElement) {
1094
+ if (isListElement(parent)) {
1095
+ count += 1;
1096
+ }
1097
+ }
1098
+ return count;
1099
+ };
1100
+ var getListStyleType = (item) => {
1101
+ if (item.style.listStyleType) {
1102
+ return item.style.listStyleType;
1103
+ }
1104
+ const list = item.closest("ul, ol");
1105
+ if (!(list instanceof HTMLElement)) {
1106
+ return void 0;
1107
+ }
1108
+ if (list.style.listStyleType) {
1109
+ return list.style.listStyleType;
1110
+ }
1111
+ return list.tagName === "OL" ? "decimal" : "disc";
1112
+ };
1113
+ var prepareListHtml = (html) => {
1114
+ if (!/<li[\s>]/i.test(html)) {
1115
+ return html;
1116
+ }
1117
+ const { body } = new DOMParser().parseFromString(html, "text/html");
1118
+ const items = Array.from(body.querySelectorAll("li"));
1119
+ for (const item of items) {
1120
+ const nestedLists = Array.from(item.children).filter(isListElement);
1121
+ for (const nestedList of nestedLists.reverse()) {
1122
+ item.after(nestedList);
1123
+ }
1124
+ }
1125
+ for (const item of items) {
1126
+ const isBlockChild = (child) => child instanceof HTMLElement && isHtmlBlockElement(child);
1127
+ const hasBlockChild = Array.from(item.childNodes).some(isBlockChild);
1128
+ const children = Array.from(item.childNodes).flatMap((child) => {
1129
+ var _a;
1130
+ if (isBlockChild(child)) return Array.from(child.childNodes);
1131
+ return hasBlockChild && child.nodeType === Node.TEXT_NODE && ((_a = child.textContent) == null ? void 0 : _a.trim()) === "" ? [] : [child];
1132
+ });
1133
+ item.replaceChildren(...children);
1134
+ const depth = Number(item.getAttribute("aria-level")) || countListAncestors(item);
1135
+ if (depth > 0) {
1136
+ item.dataset.indent = String(depth);
1137
+ }
1138
+ const listStyleType = getListStyleType(item);
1139
+ if (listStyleType) {
1140
+ item.dataset.listStyleType = listStyleType;
1141
+ }
1142
+ }
1143
+ return postCleanHtml(body.innerHTML);
1144
+ };
1145
+ var overrideListHtmlDeserialize = ({ editor }) => {
1146
+ const { deserialize } = editor.getApi(HtmlPlugin2).html;
1147
+ return {
1148
+ api: {
1149
+ html: {
1150
+ deserialize: (options2) => deserialize(__spreadProps(__spreadValues({}, options2), {
1151
+ element: typeof options2.element === "string" ? prepareListHtml(options2.element) : options2.element
1152
+ }))
1153
+ }
1154
+ }
1155
+ };
1156
+ };
1157
+
1158
+ // src/ui/block-list-static.tsx
1159
+ import { isOrderedList } from "@platejs/list";
1160
+ import { CheckIcon as CheckIcon2 } from "lucide-react";
1161
+ import { jsx as jsx19, jsxs as jsxs6 } from "react/jsx-runtime";
1162
+ var config = {
1163
+ todo: {
1164
+ Li: TodoLiStatic,
1165
+ Marker: TodoMarkerStatic
1166
+ }
1167
+ };
1168
+ var BlockListStatic = (props) => {
1169
+ if (!props.element.listStyleType) return;
1170
+ return (props2) => /* @__PURE__ */ jsx19(List, __spreadValues({}, props2));
1171
+ };
1172
+ function List(props) {
1173
+ var _a;
1174
+ const { listStart, listStyleType } = props.element;
1175
+ const { Li, Marker } = (_a = config[listStyleType]) != null ? _a : {};
1176
+ const List2 = isOrderedList(props.element) ? "ol" : "ul";
1177
+ return /* @__PURE__ */ jsxs6(List2, { className: "relative m-0 p-0", start: listStart, style: { listStyleType }, children: [
1178
+ Marker && /* @__PURE__ */ jsx19(Marker, __spreadValues({}, props)),
1179
+ Li ? /* @__PURE__ */ jsx19(Li, __spreadValues({}, props)) : /* @__PURE__ */ jsx19("li", { children: props.children })
1180
+ ] });
1181
+ }
1182
+ function TodoMarkerStatic(props) {
1183
+ const checked = props.element.checked;
1184
+ return /* @__PURE__ */ jsx19("div", { contentEditable: false, children: /* @__PURE__ */ jsx19(
1185
+ "button",
1186
+ {
1187
+ className: cn(
1188
+ "peer -left-6 pointer-events-none absolute top-1 size-4 shrink-0 rounded-sm border border-primary bg-background ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
1189
+ props.className
1190
+ ),
1191
+ "data-state": checked ? "checked" : "unchecked",
1192
+ type: "button",
1193
+ children: /* @__PURE__ */ jsx19("div", { className: cn("flex items-center justify-center text-current"), children: checked && /* @__PURE__ */ jsx19(CheckIcon2, { className: "size-4" }) })
1194
+ }
1195
+ ) });
1196
+ }
1197
+ function TodoLiStatic(props) {
1198
+ return /* @__PURE__ */ jsx19("li", { className: cn("list-none", props.element.checked && "text-muted-foreground line-through"), children: props.children });
1199
+ }
1200
+
1201
+ // src/components/editor/plugins/indent-base-kit.tsx
1202
+ import { BaseIndentPlugin } from "@platejs/indent";
1203
+ import { KEYS as KEYS2 } from "platejs";
1204
+ var BaseIndentKit = [
1205
+ BaseIndentPlugin.configure({
1206
+ inject: {
1207
+ targetPlugins: [...KEYS2.heading, KEYS2.p, KEYS2.blockquote, KEYS2.codeBlock, KEYS2.toggle]
1208
+ },
1209
+ options: {
1210
+ offset: 24
1211
+ }
1212
+ })
1213
+ ];
1214
+
1215
+ // src/components/editor/plugins/list-base-kit.tsx
1216
+ var BaseListKit = [
1217
+ ...BaseIndentKit,
1218
+ BaseListPlugin.configure({
1219
+ inject: {
1220
+ targetPlugins: [...KEYS3.heading, KEYS3.p, KEYS3.blockquote, KEYS3.codeBlock, KEYS3.toggle]
1221
+ },
1222
+ render: {
1223
+ belowNodes: BlockListStatic
1224
+ }
1225
+ }).overrideEditor(overrideListHtmlDeserialize)
1226
+ ];
1227
+
1228
+ // src/components/editor/plugins/markdown-kit.tsx
1229
+ import { MarkdownPlugin, remarkMdx, remarkMention } from "@platejs/markdown";
1230
+ import { KEYS as KEYS4 } from "platejs";
1231
+ import remarkGfm from "remark-gfm";
1232
+ import remarkMath from "remark-math";
1233
+ var MarkdownKit = [
1234
+ MarkdownPlugin.configure({
1235
+ options: {
1236
+ disallowedNodes: [KEYS4.suggestion],
1237
+ remarkPlugins: [remarkMath, remarkGfm, remarkMdx, remarkMention]
1238
+ }
1239
+ })
1240
+ ];
1241
+
1242
+ // src/components/editor/plugins/math-base-kit.tsx
1243
+ import { BaseEquationPlugin, BaseInlineEquationPlugin } from "@platejs/math";
1244
+
1245
+ // src/ui/equation-node-static.tsx
1246
+ import { getEquationHtml } from "@platejs/math";
1247
+ import { SlateElement as SlateElement10 } from "platejs/static";
1248
+ import { jsx as jsx20, jsxs as jsxs7 } from "react/jsx-runtime";
1249
+ function EquationElementStatic(props) {
1250
+ const element = props.element;
1251
+ const html = getEquationHtml({
1252
+ element,
1253
+ options: {
1254
+ displayMode: true,
1255
+ errorColor: "#cc0000",
1256
+ fleqn: false,
1257
+ leqno: false,
1258
+ macros: { "\\f": "#1f(#2)" },
1259
+ output: "htmlAndMathml",
1260
+ strict: "warn",
1261
+ throwOnError: false,
1262
+ trust: false
1263
+ }
1264
+ });
1265
+ return /* @__PURE__ */ jsxs7(SlateElement10, __spreadProps(__spreadValues({ className: "my-1" }, props), { children: [
1266
+ /* @__PURE__ */ jsx20(
1267
+ "div",
1268
+ {
1269
+ className: cn(
1270
+ "flex select-none items-center justify-center rounded-sm",
1271
+ element.texExpression.length === 0 ? "bg-muted p-3" : "px-2 py-1"
1272
+ ),
1273
+ children: /* @__PURE__ */ jsx20(
1274
+ "span",
1275
+ {
1276
+ "aria-hidden": "true",
1277
+ dangerouslySetInnerHTML: {
1278
+ __html: html
1279
+ }
1280
+ }
1281
+ )
1282
+ }
1283
+ ),
1284
+ props.children
1285
+ ] }));
1286
+ }
1287
+ function InlineEquationElementStatic(props) {
1288
+ const element = props.element;
1289
+ const html = getEquationHtml({
1290
+ element,
1291
+ options: {
1292
+ displayMode: true,
1293
+ errorColor: "#cc0000",
1294
+ fleqn: false,
1295
+ leqno: false,
1296
+ macros: { "\\f": "#1f(#2)" },
1297
+ output: "htmlAndMathml",
1298
+ strict: "warn",
1299
+ throwOnError: false,
1300
+ trust: false
1301
+ }
1302
+ });
1303
+ return /* @__PURE__ */ jsxs7(SlateElement10, __spreadProps(__spreadValues({ className: "inline-block select-none rounded-sm [&_.katex-display]:my-0" }, props), { children: [
1304
+ /* @__PURE__ */ jsx20(
1305
+ "div",
1306
+ {
1307
+ className: cn(
1308
+ 'after:-top-0.5 after:-left-1 after:absolute after:inset-0 after:z-1 after:h-[calc(100%)+4px] after:w-[calc(100%+8px)] after:rounded-sm after:content-[""]',
1309
+ "h-6",
1310
+ element.texExpression.length === 0 && "text-muted-foreground after:bg-neutral-500/10"
1311
+ ),
1312
+ children: /* @__PURE__ */ jsx20(
1313
+ "span",
1314
+ {
1315
+ "aria-hidden": "true",
1316
+ className: cn(element.texExpression.length === 0 && "hidden", "font-mono leading-none"),
1317
+ dangerouslySetInnerHTML: {
1318
+ __html: html
1319
+ }
1320
+ }
1321
+ )
1322
+ }
1323
+ ),
1324
+ props.children
1325
+ ] }));
1326
+ }
1327
+
1328
+ // src/components/editor/plugins/math-base-kit.tsx
1329
+ var BaseMathKit = [
1330
+ BaseInlineEquationPlugin.withComponent(InlineEquationElementStatic),
1331
+ BaseEquationPlugin.withComponent(EquationElementStatic)
1332
+ ];
1333
+
1334
+ // src/components/editor/plugins/media-base-kit.tsx
1335
+ import { BaseCaptionPlugin } from "@platejs/caption";
1336
+ import {
1337
+ BaseAudioPlugin,
1338
+ BaseFilePlugin,
1339
+ BaseImagePlugin,
1340
+ BaseMediaEmbedPlugin,
1341
+ BasePlaceholderPlugin,
1342
+ BaseVideoPlugin
1343
+ } from "@platejs/media";
1344
+ import { KEYS as KEYS5 } from "platejs";
1345
+
1346
+ // src/lib/media-html.ts
1347
+ var MEDIA_ALIGNS = ["left", "center", "right"];
1348
+ var findMedia = (element, selector) => {
1349
+ if (element.nodeName === "FIGURE") return element.querySelector(`:scope > ${selector}`);
1350
+ return element.matches(selector) ? element : null;
1351
+ };
1352
+ var readFigureProps = (element, media) => {
1353
+ var _a, _b;
1354
+ const props = {};
1355
+ const width = Number(media.getAttribute("width"));
1356
+ if (width > 0) props.width = width;
1357
+ if (element.nodeName !== "FIGURE") return props;
1358
+ const caption = (_b = (_a = element.querySelector(":scope > figcaption")) == null ? void 0 : _a.textContent) == null ? void 0 : _b.trim();
1359
+ if (caption) props.caption = [{ text: caption }];
1360
+ if (MEDIA_ALIGNS.includes(element.style.textAlign)) props.align = element.style.textAlign;
1361
+ return props;
1362
+ };
1363
+ var createMediaHtmlParsers = ({ selector, bareTagName, read }) => ({
1364
+ html: {
1365
+ deserializer: {
1366
+ rules: [{ validNodeName: bareTagName ? ["FIGURE", bareTagName] : "FIGURE" }],
1367
+ query: ({ element }) => findMedia(element, selector) !== null,
1368
+ parse: ({ element, type }) => {
1369
+ const media = findMedia(element, selector);
1370
+ const props = media ? read(media) : void 0;
1371
+ if (!media || !props) return void 0;
1372
+ return __spreadValues(__spreadValues({ type }, props), readFigureProps(element, media));
1373
+ },
1374
+ withoutChildren: true
1375
+ }
1376
+ }
1377
+ });
1378
+ var readSource = (media) => {
1379
+ var _a, _b;
1380
+ const url = (_b = media.getAttribute("src")) != null ? _b : (_a = media.querySelector("source")) == null ? void 0 : _a.getAttribute("src");
1381
+ return url ? { url } : void 0;
1382
+ };
1383
+ var IMAGE_HTML_PARSERS = createMediaHtmlParsers({ selector: "img", bareTagName: "IMG", read: readSource });
1384
+ var VIDEO_HTML_PARSERS = createMediaHtmlParsers({ selector: "video", bareTagName: "VIDEO", read: readSource });
1385
+ var AUDIO_HTML_PARSERS = createMediaHtmlParsers({ selector: "audio", bareTagName: "AUDIO", read: readSource });
1386
+ var MEDIA_EMBED_HTML_PARSERS = createMediaHtmlParsers({
1387
+ selector: "iframe",
1388
+ bareTagName: "IFRAME",
1389
+ read: (media) => {
1390
+ var _a;
1391
+ const url = (_a = media.dataset.url) != null ? _a : media.getAttribute("src");
1392
+ return url ? { url } : void 0;
1393
+ }
1394
+ });
1395
+ var FILE_HTML_PARSERS = createMediaHtmlParsers({
1396
+ selector: "a[download]",
1397
+ read: (media) => {
1398
+ var _a;
1399
+ const url = media.getAttribute("href");
1400
+ const name = (_a = media.textContent) == null ? void 0 : _a.trim();
1401
+ return url ? __spreadValues({ url }, name ? { name } : {}) : void 0;
1402
+ }
1403
+ });
1404
+
1405
+ // src/ui/media-audio-node-static.tsx
1406
+ import { SlateElement as SlateElement11 } from "platejs/static";
1407
+ import { jsx as jsx21, jsxs as jsxs8 } from "react/jsx-runtime";
1408
+ function MediaAudioElementStatic(props) {
1409
+ const { url } = props.element;
1410
+ return /* @__PURE__ */ jsxs8(SlateElement11, __spreadProps(__spreadValues({ className: "mb-1" }, props), { children: [
1411
+ /* @__PURE__ */ jsx21("figure", { className: "group relative cursor-default", children: /* @__PURE__ */ jsx21("div", { className: "h-16", children: /* @__PURE__ */ jsx21("audio", { className: "size-full", controls: true, src: url, children: /* @__PURE__ */ jsx21("track", { kind: "captions" }) }) }) }),
1412
+ props.children
1413
+ ] }));
1414
+ }
1415
+
1416
+ // src/ui/media-embed-node-static.tsx
1417
+ import { parseTwitterUrl, VIDEO_PROVIDERS } from "@platejs/media";
1418
+ import { NodeApi as NodeApi3 } from "platejs";
1419
+ import { SlateElement as SlateElement12 } from "platejs/static";
1420
+ import { Tweet } from "react-tweet";
1421
+
1422
+ // src/lib/video-embeds.ts
1423
+ import { parseVideoUrl } from "@platejs/media";
1424
+ var LOOM_PROVIDER = "loom";
1425
+ var YOUTUBE_PROVIDER = "youtube";
1426
+ var LOOM_VIDEO_PATH = /^\/(?:share|embed)\/([0-9a-f]{32})\/?$/;
1427
+ var LOOM_HOSTS = /* @__PURE__ */ new Set(["loom.com", "www.loom.com"]);
1428
+ var parseLoomUrl = (url) => {
1429
+ var _a;
1430
+ if (!URL.canParse(url)) return void 0;
1431
+ const parsed = new URL(url);
1432
+ if (parsed.protocol !== "https:" || !LOOM_HOSTS.has(parsed.hostname)) return void 0;
1433
+ const id = (_a = LOOM_VIDEO_PATH.exec(parsed.pathname)) == null ? void 0 : _a[1];
1434
+ if (id === void 0) return void 0;
1435
+ const embedUrl = `https://www.loom.com/embed/${id}`;
1436
+ return {
1437
+ id,
1438
+ provider: LOOM_PROVIDER,
1439
+ sourceKind: "url",
1440
+ sourceUrl: embedUrl === url ? void 0 : url,
1441
+ url: embedUrl
1442
+ };
1443
+ };
1444
+ var parseVideoEmbedUrl = (url) => {
1445
+ var _a;
1446
+ return (_a = parseVideoUrl(url)) != null ? _a : parseLoomUrl(url);
1447
+ };
1448
+ var embeddedVideoOf = (embed) => {
1449
+ if ((embed == null ? void 0 : embed.id) === void 0) return void 0;
1450
+ if (embed.provider === YOUTUBE_PROVIDER) {
1451
+ return {
1452
+ provider: YOUTUBE_PROVIDER,
1453
+ src: `https://www.youtube.com/embed/${embed.id}`,
1454
+ title: "YouTube video player"
1455
+ };
1456
+ }
1457
+ if (embed.provider === LOOM_PROVIDER) {
1458
+ return { provider: LOOM_PROVIDER, src: `https://www.loom.com/embed/${embed.id}`, title: "Loom video player" };
1459
+ }
1460
+ return void 0;
1461
+ };
1462
+
1463
+ // src/ui/media-card.tsx
1464
+ import { AlertTriangle, CircleAlert, Info, Lightbulb, MessageCircle, Sparkles } from "lucide-react";
1465
+ import { jsx as jsx22, jsxs as jsxs9 } from "react/jsx-runtime";
1466
+ var HINT_ICONS = {
1467
+ info: Info,
1468
+ tip: Lightbulb,
1469
+ warning: AlertTriangle,
1470
+ important: CircleAlert,
1471
+ note: MessageCircle,
1472
+ sparkle: Sparkles
1473
+ };
1474
+ function MediaHint({ hint, hintIcon }) {
1475
+ if (!hint) return null;
1476
+ const Icon = hintIcon ? HINT_ICONS[hintIcon] : void 0;
1477
+ return /* @__PURE__ */ jsxs9("p", { className: "mb-2 flex items-start gap-1.5 text-sm text-muted-foreground italic", children: [
1478
+ Icon && /* @__PURE__ */ jsx22(Icon, { className: "mt-0.5 size-4 shrink-0" }),
1479
+ hint
1480
+ ] });
1481
+ }
1482
+ function MediaCardBody({ children, className }) {
1483
+ return /* @__PURE__ */ jsx22("div", { className: cn("flex flex-col rounded-xl border border-border p-1.5 shadow-sm", className), children });
1484
+ }
1485
+
1486
+ // src/ui/media-embed-node-static.tsx
1487
+ import { jsx as jsx23, jsxs as jsxs10 } from "react/jsx-runtime";
1488
+ function MediaEmbedElementStatic(props) {
1489
+ var _a;
1490
+ const { align = "center", caption, hint, hintIcon, url } = props.element;
1491
+ const embed = url ? (_a = parseVideoEmbedUrl(url)) != null ? _a : parseTwitterUrl(url) : void 0;
1492
+ const embeddedVideo = embeddedVideoOf(embed);
1493
+ const isVideo = !!(embed == null ? void 0 : embed.provider) && VIDEO_PROVIDERS.includes(embed.provider);
1494
+ const isTweet = (embed == null ? void 0 : embed.provider) === "twitter";
1495
+ return /* @__PURE__ */ jsxs10(SlateElement12, __spreadProps(__spreadValues({ className: "py-2.5" }, props), { children: [
1496
+ /* @__PURE__ */ jsxs10("div", { style: { textAlign: align }, children: [
1497
+ /* @__PURE__ */ jsx23(MediaHint, { hint, hintIcon }),
1498
+ /* @__PURE__ */ jsx23("figure", { className: cn("group relative m-0", isTweet ? "inline-block max-w-137.5" : "block"), children: /* @__PURE__ */ jsxs10(MediaCardBody, { children: [
1499
+ embeddedVideo && /* @__PURE__ */ jsx23("div", { className: "aspect-video w-full overflow-hidden rounded-lg", children: /* @__PURE__ */ jsx23(
1500
+ "iframe",
1501
+ {
1502
+ allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",
1503
+ allowFullScreen: true,
1504
+ className: "size-full border-0",
1505
+ referrerPolicy: "strict-origin-when-cross-origin",
1506
+ src: embeddedVideo.src,
1507
+ title: embeddedVideo.title
1508
+ }
1509
+ ) }),
1510
+ isVideo && !embeddedVideo && (embed == null ? void 0 : embed.url) && /* @__PURE__ */ jsx23(
1511
+ "div",
1512
+ {
1513
+ className: cn(
1514
+ "relative w-full overflow-hidden rounded-lg",
1515
+ embed.provider === "vimeo" && "pb-[75%]",
1516
+ embed.provider === "youku" && "pb-[56.25%]",
1517
+ embed.provider === "dailymotion" && "pb-[56.0417%]",
1518
+ embed.provider === "coub" && "pb-[51.25%]"
1519
+ ),
1520
+ children: /* @__PURE__ */ jsx23(
1521
+ "iframe",
1522
+ {
1523
+ allowFullScreen: true,
1524
+ className: "absolute top-0 left-0 size-full border-0",
1525
+ src: embed.url,
1526
+ title: "embed"
1527
+ }
1528
+ )
1529
+ }
1530
+ ),
1531
+ isTweet && (embed == null ? void 0 : embed.id) && /* @__PURE__ */ jsx23("div", { className: "text-left [&_.react-tweet-theme]:my-0", children: /* @__PURE__ */ jsx23(Tweet, { id: embed.id }) }),
1532
+ caption && /* @__PURE__ */ jsx23("figcaption", { className: "px-3 py-2 text-center text-sm text-muted-foreground", children: NodeApi3.string(caption[0]) })
1533
+ ] }) })
1534
+ ] }),
1535
+ props.children
1536
+ ] }));
1537
+ }
1538
+
1539
+ // src/ui/media-file-node-static.tsx
1540
+ import { FileUp, Link } from "lucide-react";
1541
+ import { SlateElement as SlateElement13 } from "platejs/static";
1542
+
1543
+ // src/ui/media-file-display.ts
1544
+ var DEFAULT_FILE_DISPLAY_MODE = "inline";
1545
+ var normalizeFileDisplayMode = (value) => {
1546
+ return value === "url" || value === "embed" || value === "inline" ? value : DEFAULT_FILE_DISPLAY_MODE;
1547
+ };
1548
+ var EMBEDDABLE_FILE_EXTENSIONS = /* @__PURE__ */ new Set(["pdf", "txt", "csv", "png", "jpg", "jpeg", "gif", "webp", "svg"]);
1549
+ var getFileExtension = (value) => {
1550
+ var _a;
1551
+ const withoutQuery = (_a = value.split(/[?#]/)[0]) != null ? _a : value;
1552
+ const dotIndex = withoutQuery.lastIndexOf(".");
1553
+ return dotIndex === -1 ? "" : withoutQuery.slice(dotIndex + 1).toLowerCase();
1554
+ };
1555
+ var isEmbeddableFile = (name, url) => {
1556
+ const fromName = name.length > 0 ? getFileExtension(name) : "";
1557
+ if (fromName.length > 0) {
1558
+ return EMBEDDABLE_FILE_EXTENSIONS.has(fromName);
1559
+ }
1560
+ const fromUrl = url.length > 0 ? getFileExtension(url) : "";
1561
+ return fromUrl.length > 0 && EMBEDDABLE_FILE_EXTENSIONS.has(fromUrl);
1562
+ };
1563
+
1564
+ // src/ui/media-file-node-static.tsx
1565
+ import { jsx as jsx24, jsxs as jsxs11 } from "react/jsx-runtime";
1566
+ function MediaFileStaticBody({ canEmbed, displayMode, name, url }) {
1567
+ if (displayMode === "embed" && canEmbed && url.length > 0) {
1568
+ return /* @__PURE__ */ jsx24(
1569
+ "iframe",
1570
+ {
1571
+ className: "h-120 w-full rounded-md border bg-muted",
1572
+ contentEditable: false,
1573
+ loading: "lazy",
1574
+ referrerPolicy: "no-referrer",
1575
+ src: url,
1576
+ title: name.length > 0 ? name : "Embedded file"
1577
+ }
1578
+ );
1579
+ }
1580
+ if (displayMode === "url") {
1581
+ return /* @__PURE__ */ jsxs11(
1582
+ "a",
1583
+ {
1584
+ className: "inline-flex max-w-full items-center gap-1 break-all border-[#0C66E4]/35 border-b font-medium text-[#0C66E4]",
1585
+ contentEditable: false,
1586
+ href: url,
1587
+ rel: "noopener noreferrer",
1588
+ target: "_blank",
1589
+ children: [
1590
+ /* @__PURE__ */ jsx24(Link, { className: "size-4 shrink-0 text-muted-foreground" }),
1591
+ /* @__PURE__ */ jsx24("span", { className: "truncate", children: url })
1592
+ ]
1593
+ }
1594
+ );
1595
+ }
1596
+ return /* @__PURE__ */ jsx24(
1597
+ "a",
1598
+ {
1599
+ className: "group relative m-0 flex cursor-pointer items-center rounded px-0.5 py-0.75 hover:bg-muted",
1600
+ contentEditable: false,
1601
+ download: name.length > 0 ? name : void 0,
1602
+ href: url,
1603
+ rel: "noopener noreferrer",
1604
+ target: "_blank",
1605
+ children: /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1 p-1", children: [
1606
+ /* @__PURE__ */ jsx24(FileUp, { className: "size-5" }),
1607
+ /* @__PURE__ */ jsx24("div", { children: name.length > 0 ? name : "File" })
1608
+ ] })
1609
+ }
1610
+ );
1611
+ }
1612
+ function MediaFileElementStatic(props) {
1613
+ const { name, url } = props.element;
1614
+ const displayMode = normalizeFileDisplayMode(props.element.displayMode);
1615
+ const fileName = name != null ? name : "";
1616
+ const fileUrl = url != null ? url : "";
1617
+ return /* @__PURE__ */ jsxs11(SlateElement13, __spreadProps(__spreadValues({ className: "my-px rounded-sm" }, props), { children: [
1618
+ /* @__PURE__ */ jsx24(
1619
+ MediaFileStaticBody,
1620
+ {
1621
+ canEmbed: isEmbeddableFile(fileName, fileUrl),
1622
+ displayMode,
1623
+ name: fileName,
1624
+ url: fileUrl
1625
+ }
1626
+ ),
1627
+ props.children
1628
+ ] }));
1629
+ }
1630
+
1631
+ // src/ui/media-image-node-static.tsx
1632
+ import { NodeApi as NodeApi4 } from "platejs";
1633
+ import { SlateElement as SlateElement14 } from "platejs/static";
1634
+ import { useCallback as useCallback5, useRef as useRef3, useState as useState4 } from "react";
1635
+
1636
+ // src/ui/media-image-lightbox.tsx
1637
+ import { AnimatePresence as AnimatePresence2, motion as motion2 } from "framer-motion";
1638
+ import { CircleArrowDown, X } from "lucide-react";
1639
+ import { useCallback as useCallback4, useEffect as useEffect3 } from "react";
1640
+
1641
+ // src/lib/download-file.ts
1642
+ var downloadFile = async (url, filename) => {
1643
+ const response = await fetch(url);
1644
+ const blob = await response.blob();
1645
+ const blobUrl = window.URL.createObjectURL(blob);
1646
+ const link = document.createElement("a");
1647
+ link.href = blobUrl;
1648
+ link.download = filename;
1649
+ document.body.append(link);
1650
+ link.click();
1651
+ link.remove();
1652
+ window.URL.revokeObjectURL(blobUrl);
1653
+ };
1654
+
1655
+ // src/ui/media-image-lightbox.tsx
1656
+ import { Fragment, jsx as jsx25, jsxs as jsxs12 } from "react/jsx-runtime";
1657
+ var TRANSITION = { type: "tween", ease: [0.32, 0.72, 0, 1], duration: 0.4 };
1658
+ function ImageLightbox({ alt, isOpen, onClose, sourceRect, src }) {
1659
+ var _a, _b;
1660
+ useEffect3(() => {
1661
+ if (!isOpen) return;
1662
+ const handleKeyDown = (e) => {
1663
+ if (e.key === "Escape") onClose();
1664
+ };
1665
+ document.addEventListener("keydown", handleKeyDown);
1666
+ return () => document.removeEventListener("keydown", handleKeyDown);
1667
+ }, [isOpen, onClose]);
1668
+ const handleDownload = useCallback4(() => {
1669
+ void downloadFile(src, alt || "image");
1670
+ }, [src, alt]);
1671
+ const viewportW = typeof window !== "undefined" ? window.innerWidth : 1024;
1672
+ const viewportH = typeof window !== "undefined" ? window.innerHeight : 768;
1673
+ const padding = 64;
1674
+ const maxW = viewportW - padding * 2;
1675
+ const maxH = viewportH - padding * 2;
1676
+ const naturalW = (_a = sourceRect == null ? void 0 : sourceRect.naturalWidth) != null ? _a : maxW;
1677
+ const naturalH = (_b = sourceRect == null ? void 0 : sourceRect.naturalHeight) != null ? _b : maxH;
1678
+ const fitScale = Math.min(maxW / naturalW, maxH / naturalH, 1);
1679
+ const displayW = naturalW * fitScale;
1680
+ const displayH = naturalH * fitScale;
1681
+ const finalLeft = (viewportW - displayW) / 2;
1682
+ const finalTop = (viewportH - displayH) / 2;
1683
+ const sourceState = sourceRect ? { top: sourceRect.top, left: sourceRect.left, width: sourceRect.width, height: sourceRect.height } : { top: finalTop, left: finalLeft, width: displayW, height: displayH, opacity: 0 };
1684
+ return /* @__PURE__ */ jsx25(AnimatePresence2, { children: isOpen && /* @__PURE__ */ jsxs12(Fragment, { children: [
1685
+ /* @__PURE__ */ jsx25(
1686
+ motion2.div,
1687
+ {
1688
+ className: "fixed inset-0 z-50 cursor-default bg-black/80",
1689
+ initial: { opacity: 0 },
1690
+ animate: { opacity: 1 },
1691
+ exit: { opacity: 0 },
1692
+ transition: { duration: 0.3 },
1693
+ onClick: onClose
1694
+ }
1695
+ ),
1696
+ /* @__PURE__ */ jsx25(
1697
+ motion2.img,
1698
+ {
1699
+ alt,
1700
+ src,
1701
+ className: "fixed z-50 select-none object-cover",
1702
+ initial: __spreadProps(__spreadValues({}, sourceState), { borderRadius: 8 }),
1703
+ animate: {
1704
+ top: finalTop,
1705
+ left: finalLeft,
1706
+ width: displayW,
1707
+ height: displayH,
1708
+ opacity: 1,
1709
+ borderRadius: 10
1710
+ },
1711
+ exit: __spreadProps(__spreadValues({}, sourceState), { borderRadius: 8 }),
1712
+ transition: TRANSITION,
1713
+ onClick: (e) => e.stopPropagation()
1714
+ }
1715
+ ),
1716
+ /* @__PURE__ */ jsxs12(
1717
+ motion2.div,
1718
+ {
1719
+ className: "fixed bottom-6 left-1/2 z-50 flex -translate-x-1/2 gap-1.5 rounded-full bg-black/70 p-1.5 backdrop-blur-sm",
1720
+ initial: { opacity: 0, y: 20 },
1721
+ animate: { opacity: 1, y: 0 },
1722
+ exit: { opacity: 0, y: 20 },
1723
+ transition: { duration: 0.25, delay: 0.1 },
1724
+ onClick: (e) => e.stopPropagation(),
1725
+ children: [
1726
+ /* @__PURE__ */ jsx25(
1727
+ "button",
1728
+ {
1729
+ className: "flex size-9 items-center justify-center rounded-full text-white/80 transition-colors hover:bg-white/10 hover:text-white",
1730
+ onClick: handleDownload,
1731
+ title: "Download",
1732
+ type: "button",
1733
+ children: /* @__PURE__ */ jsx25(CircleArrowDown, { className: "size-4" })
1734
+ }
1735
+ ),
1736
+ /* @__PURE__ */ jsx25(
1737
+ "button",
1738
+ {
1739
+ className: "flex size-9 items-center justify-center rounded-full text-white/80 transition-colors hover:bg-white/10 hover:text-white",
1740
+ onClick: onClose,
1741
+ title: "Close",
1742
+ type: "button",
1743
+ children: /* @__PURE__ */ jsx25(X, { className: "size-4" })
1744
+ }
1745
+ )
1746
+ ]
1747
+ }
1748
+ )
1749
+ ] }) });
1750
+ }
1751
+
1752
+ // src/ui/media-image-node-static.tsx
1753
+ import { jsx as jsx26, jsxs as jsxs13 } from "react/jsx-runtime";
1754
+ function ImageElementStatic(props) {
1755
+ const { align = "center", caption, hint, hintIcon, url } = props.element;
1756
+ const [lightboxOpen, setLightboxOpen] = useState4(false);
1757
+ const [sourceRect, setSourceRect] = useState4(null);
1758
+ const imgRef = useRef3(null);
1759
+ const handleOpen = useCallback5(() => {
1760
+ if (imgRef.current) {
1761
+ const rect = imgRef.current.getBoundingClientRect();
1762
+ setSourceRect({
1763
+ top: rect.top,
1764
+ left: rect.left,
1765
+ width: rect.width,
1766
+ height: rect.height,
1767
+ naturalWidth: imgRef.current.naturalWidth,
1768
+ naturalHeight: imgRef.current.naturalHeight
1769
+ });
1770
+ }
1771
+ setLightboxOpen(true);
1772
+ }, []);
1773
+ return /* @__PURE__ */ jsxs13(SlateElement14, __spreadProps(__spreadValues({ className: "py-2.5" }, props), { children: [
1774
+ /* @__PURE__ */ jsxs13("div", { style: { textAlign: align }, children: [
1775
+ /* @__PURE__ */ jsx26(MediaHint, { hint, hintIcon }),
1776
+ /* @__PURE__ */ jsx26("figure", { className: "group relative m-0 block", children: /* @__PURE__ */ jsxs13(MediaCardBody, { children: [
1777
+ /* @__PURE__ */ jsx26(
1778
+ "img",
1779
+ {
1780
+ ref: imgRef,
1781
+ alt: props.attributes.alt,
1782
+ className: "block w-full cursor-zoom-in rounded-lg",
1783
+ onClick: handleOpen,
1784
+ src: url
1785
+ }
1786
+ ),
1787
+ caption && /* @__PURE__ */ jsx26("figcaption", { className: "px-3 py-2 text-center text-sm text-muted-foreground", children: NodeApi4.string(caption[0]) })
1788
+ ] }) })
1789
+ ] }),
1790
+ /* @__PURE__ */ jsx26(
1791
+ ImageLightbox,
1792
+ {
1793
+ alt: props.attributes.alt,
1794
+ isOpen: lightboxOpen,
1795
+ onClose: () => setLightboxOpen(false),
1796
+ sourceRect,
1797
+ src: url
1798
+ }
1799
+ ),
1800
+ props.children
1801
+ ] }));
1802
+ }
1803
+
1804
+ // src/ui/media-video-node-static.tsx
1805
+ import { NodeApi as NodeApi5 } from "platejs";
1806
+ import { SlateElement as SlateElement15 } from "platejs/static";
1807
+ import { jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
1808
+ function MediaVideoElementStatic(props) {
1809
+ const { align = "center", caption, hint, hintIcon, url } = props.element;
1810
+ const embeddedVideo = url ? embeddedVideoOf(parseVideoEmbedUrl(url)) : void 0;
1811
+ return /* @__PURE__ */ jsxs14(SlateElement15, __spreadProps(__spreadValues({ className: "py-2.5" }, props), { children: [
1812
+ /* @__PURE__ */ jsxs14("div", { style: { textAlign: align }, children: [
1813
+ /* @__PURE__ */ jsx27(MediaHint, { hint, hintIcon }),
1814
+ /* @__PURE__ */ jsx27("figure", { className: "group relative m-0 block", children: /* @__PURE__ */ jsxs14(MediaCardBody, { children: [
1815
+ embeddedVideo ? /* @__PURE__ */ jsx27("div", { className: "aspect-video w-full overflow-hidden rounded-lg", children: /* @__PURE__ */ jsx27(
1816
+ "iframe",
1817
+ {
1818
+ src: embeddedVideo.src,
1819
+ title: embeddedVideo.title,
1820
+ allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",
1821
+ allowFullScreen: true,
1822
+ className: "size-full border-0",
1823
+ referrerPolicy: "strict-origin-when-cross-origin"
1824
+ }
1825
+ ) }) : /* @__PURE__ */ jsx27("video", { className: cn("w-full max-w-full rounded-lg object-cover px-0"), controls: true, src: url, children: /* @__PURE__ */ jsx27("track", { kind: "captions" }) }),
1826
+ caption && /* @__PURE__ */ jsx27("figcaption", { className: "px-3 py-2 text-center text-sm text-muted-foreground", children: NodeApi5.string(caption[0]) })
1827
+ ] }) })
1828
+ ] }),
1829
+ props.children
1830
+ ] }));
1831
+ }
1832
+
1833
+ // src/components/editor/plugins/media-base-kit.tsx
1834
+ var BaseMediaKit = [
1835
+ BaseImagePlugin.configure({ parsers: IMAGE_HTML_PARSERS }).withComponent(ImageElementStatic),
1836
+ BaseVideoPlugin.configure({ parsers: VIDEO_HTML_PARSERS }).withComponent(MediaVideoElementStatic),
1837
+ BaseAudioPlugin.configure({ parsers: AUDIO_HTML_PARSERS }).withComponent(MediaAudioElementStatic),
1838
+ BaseFilePlugin.configure({ parsers: FILE_HTML_PARSERS }).withComponent(MediaFileElementStatic),
1839
+ BaseCaptionPlugin.configure({
1840
+ options: {
1841
+ query: {
1842
+ allow: [KEYS5.img, KEYS5.video, KEYS5.audio, KEYS5.file, KEYS5.mediaEmbed]
1843
+ }
1844
+ }
1845
+ }),
1846
+ BaseMediaEmbedPlugin.configure({ parsers: MEDIA_EMBED_HTML_PARSERS }).withComponent(MediaEmbedElementStatic),
1847
+ BasePlaceholderPlugin
1848
+ ];
1849
+
1850
+ // src/components/editor/plugins/mention-base-kit.tsx
1851
+ import { BaseMentionPlugin } from "@platejs/mention";
1852
+
1853
+ // src/ui/mention-node-static.tsx
1854
+ import { IS_APPLE } from "platejs";
1855
+ import { SlateElement as SlateElement16 } from "platejs/static";
1856
+ import { useCallback as useCallback6, useState as useState7 } from "react";
1857
+
1858
+ // src/ui/member-profile-card.tsx
1859
+ import { ArrowUpRight, Mail, MapPin, Users } from "lucide-react";
1860
+
1861
+ // src/ui/avatar.tsx
1862
+ import { cva as cva2 } from "class-variance-authority";
1863
+ import { Avatar as AvatarPrimitive } from "radix-ui";
1864
+ import { jsx as jsx28 } from "react/jsx-runtime";
1865
+ var avatarVariants = cva2("relative flex shrink-0 overflow-hidden", {
1866
+ defaultVariants: {
1867
+ size: "default",
1868
+ variant: "default"
1869
+ },
1870
+ variants: {
1871
+ size: {
1872
+ default: "size-10",
1873
+ lg: "size-12",
1874
+ profile: "size-20",
1875
+ settings: "size-20 md:size-28",
1876
+ sm: "size-6"
1877
+ },
1878
+ variant: {
1879
+ default: "rounded-full"
1880
+ }
1881
+ }
1882
+ });
1883
+ function Avatar(_a) {
1884
+ var _b = _a, { className, size, variant } = _b, props = __objRest(_b, ["className", "size", "variant"]);
1885
+ return /* @__PURE__ */ jsx28(AvatarPrimitive.Root, __spreadValues({ className: cn(avatarVariants({ size, variant }), className), "data-slot": "avatar" }, props));
1886
+ }
1887
+ function AvatarImage(_a) {
1888
+ var _b = _a, {
1889
+ className,
1890
+ onLoadingStatusChange
1891
+ } = _b, props = __objRest(_b, [
1892
+ "className",
1893
+ "onLoadingStatusChange"
1894
+ ]);
1895
+ return /* @__PURE__ */ jsx28(
1896
+ AvatarPrimitive.Image,
1897
+ {
1898
+ asChild: true,
1899
+ "data-slot": "avatar-image",
1900
+ onLoadingStatusChange,
1901
+ src: props.src,
1902
+ children: /* @__PURE__ */ jsx28(
1903
+ "img",
1904
+ __spreadProps(__spreadValues({
1905
+ className: cn("aspect-square size-full select-none object-cover", className),
1906
+ fill: "true"
1907
+ }, props), {
1908
+ alt: ""
1909
+ })
1910
+ )
1911
+ }
1912
+ );
1913
+ }
1914
+ var avatarFallbackVariants = cva2("box-content flex size-full items-center justify-center", {
1915
+ defaultVariants: {
1916
+ variant: "default"
1917
+ },
1918
+ variants: {
1919
+ variant: {
1920
+ default: "rounded-full bg-muted"
1921
+ }
1922
+ }
1923
+ });
1924
+ function AvatarFallback(_a) {
1925
+ var _b = _a, { className, variant } = _b, props = __objRest(_b, ["className", "variant"]);
1926
+ return /* @__PURE__ */ jsx28(
1927
+ AvatarPrimitive.Fallback,
1928
+ __spreadValues({
1929
+ className: cn(avatarFallbackVariants({ variant }), className),
1930
+ "data-slot": "avatar-fallback"
1931
+ }, props)
1932
+ );
1933
+ }
1934
+
1935
+ // src/ui/badge.tsx
1936
+ import { cva as cva3 } from "class-variance-authority";
1937
+ import { jsx as jsx29 } from "react/jsx-runtime";
1938
+ var badgeVariants = cva3(
1939
+ "inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none transition-colors overflow-hidden",
1940
+ {
1941
+ variants: {
1942
+ variant: {
1943
+ default: "border-transparent bg-primary text-primary-foreground",
1944
+ secondary: "border-transparent bg-secondary text-secondary-foreground",
1945
+ destructive: "border-transparent bg-destructive text-white dark:bg-destructive/60",
1946
+ outline: "text-foreground border-border"
1947
+ }
1948
+ },
1949
+ defaultVariants: {
1950
+ variant: "default"
1951
+ }
1952
+ }
1953
+ );
1954
+ function Badge(_a) {
1955
+ var _b = _a, { className, variant } = _b, props = __objRest(_b, ["className", "variant"]);
1956
+ return /* @__PURE__ */ jsx29("span", __spreadValues({ className: cn(badgeVariants({ variant }), className) }, props));
1957
+ }
1958
+
1959
+ // src/ui/member-profile-card.tsx
1960
+ import { jsx as jsx30, jsxs as jsxs15 } from "react/jsx-runtime";
1961
+ var getInitials = (name) => {
1962
+ var _a, _b, _c, _d;
1963
+ const parts = name.trim().split(/\s+/).filter(Boolean);
1964
+ if (parts.length === 0) {
1965
+ return "?";
1966
+ }
1967
+ const first = (_b = (_a = parts[0]) == null ? void 0 : _a[0]) != null ? _b : "";
1968
+ const last = parts.length > 1 ? (_d = (_c = parts[parts.length - 1]) == null ? void 0 : _c[0]) != null ? _d : "" : "";
1969
+ return `${first}${last}`.toUpperCase();
1970
+ };
1971
+ function DetailRow({ icon, children }) {
1972
+ return /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2 text-muted-foreground text-xs", children: [
1973
+ /* @__PURE__ */ jsx30("span", { className: "shrink-0 text-muted-foreground/70", children: icon }),
1974
+ /* @__PURE__ */ jsx30("div", { className: "min-w-0 flex-1 truncate", children })
1975
+ ] });
1976
+ }
1977
+ function ProfileLink({ label, url }) {
1978
+ const anchorProps = getSmartLinkAnchorProps(url);
1979
+ if (!anchorProps.href) {
1980
+ return null;
1981
+ }
1982
+ return /* @__PURE__ */ jsxs15(
1983
+ "a",
1984
+ __spreadProps(__spreadValues({}, anchorProps), {
1985
+ className: "group -mx-1.5 flex items-center justify-between gap-2 rounded-md px-1.5 py-1 transition-colors hover:bg-muted",
1986
+ children: [
1987
+ /* @__PURE__ */ jsx30("span", { className: "truncate font-medium text-foreground text-xs", children: label }),
1988
+ /* @__PURE__ */ jsx30(ArrowUpRight, { className: "size-3.5 shrink-0 text-muted-foreground/50 transition-colors group-hover:text-foreground" })
1989
+ ]
1990
+ })
1991
+ );
1992
+ }
1993
+ function MemberProfileCard({ profile, fallbackName, isLoading }) {
1994
+ var _a, _b, _c;
1995
+ const name = (_a = profile == null ? void 0 : profile.name) != null ? _a : fallbackName;
1996
+ const photoUrl = (profile == null ? void 0 : profile.photoUrl) ? getSafeSmartLinkUrl(profile.photoUrl) : null;
1997
+ const role = profile == null ? void 0 : profile.role;
1998
+ const email = profile == null ? void 0 : profile.email;
1999
+ const workLocation = profile == null ? void 0 : profile.workLocation;
2000
+ const teams = (_b = profile == null ? void 0 : profile.teams) != null ? _b : [];
2001
+ const bio = profile == null ? void 0 : profile.bio;
2002
+ const links = (_c = profile == null ? void 0 : profile.links) != null ? _c : [];
2003
+ const hasInternalDetail = Boolean(email) || Boolean(workLocation) || teams.length > 0;
2004
+ const hasMeta = hasInternalDetail || links.length > 0;
2005
+ const showDetailSkeleton = isLoading && profile === null;
2006
+ return /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-3", children: [
2007
+ /* @__PURE__ */ jsxs15("div", { className: "flex items-start gap-3", children: [
2008
+ /* @__PURE__ */ jsxs15(Avatar, { className: "shadow-sm ring-1 ring-border", size: "lg", children: [
2009
+ photoUrl ? /* @__PURE__ */ jsx30(AvatarImage, { alt: name, src: photoUrl }) : null,
2010
+ /* @__PURE__ */ jsx30(AvatarFallback, { className: "bg-muted font-semibold text-foreground/70 text-sm", children: getInitials(name) })
2011
+ ] }),
2012
+ /* @__PURE__ */ jsxs15("div", { className: "min-w-0 flex-1 pt-0.5", children: [
2013
+ /* @__PURE__ */ jsx30("p", { className: "truncate font-semibold text-foreground text-sm leading-tight", children: name }),
2014
+ role ? /* @__PURE__ */ jsx30("p", { className: "mt-1 truncate text-muted-foreground text-xs", children: role }) : null,
2015
+ showDetailSkeleton ? /* @__PURE__ */ jsx30("span", { className: "mt-2 block h-2.5 w-20 animate-pulse rounded-full bg-muted" }) : null
2016
+ ] })
2017
+ ] }),
2018
+ bio ? /* @__PURE__ */ jsx30("p", { className: "text-foreground/80 text-xs leading-relaxed", children: bio }) : null,
2019
+ hasMeta ? /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-3 border-border border-t pt-3", children: [
2020
+ hasInternalDetail ? /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-2", children: [
2021
+ email ? /* @__PURE__ */ jsx30(DetailRow, { icon: /* @__PURE__ */ jsx30(Mail, { className: "size-3.5" }), children: /* @__PURE__ */ jsx30("a", { className: "transition-colors hover:text-foreground", href: `mailto:${email}`, children: email }) }) : null,
2022
+ workLocation ? /* @__PURE__ */ jsx30(DetailRow, { icon: /* @__PURE__ */ jsx30(MapPin, { className: "size-3.5" }), children: workLocation }) : null,
2023
+ teams.length > 0 ? /* @__PURE__ */ jsxs15("div", { className: "flex items-start gap-2 text-muted-foreground text-xs", children: [
2024
+ /* @__PURE__ */ jsx30(Users, { className: "mt-0.5 size-3.5 shrink-0 text-muted-foreground/70" }),
2025
+ /* @__PURE__ */ jsx30("div", { className: "flex flex-wrap gap-1", children: teams.map((team) => /* @__PURE__ */ jsx30(Badge, { className: "font-normal", variant: "secondary", children: team }, team)) })
2026
+ ] }) : null
2027
+ ] }) : null,
2028
+ links.length > 0 ? /* @__PURE__ */ jsx30("div", { className: "flex flex-col gap-0.5", children: links.map((link) => /* @__PURE__ */ jsx30(ProfileLink, { label: link.label, url: link.url }, `${link.label}-${link.url}`)) }) : null
2029
+ ] }) : null
2030
+ ] });
2031
+ }
2032
+
2033
+ // src/ui/mention-document-link.ts
2034
+ import { useEffect as useEffect4, useState as useState5 } from "react";
2035
+ var getDocumentMentionLink = (element, page, displayMode) => {
2036
+ var _a, _b, _c, _d, _e, _f;
2037
+ return {
2038
+ displayMode,
2039
+ title: (_a = page == null ? void 0 : page.title) != null ? _a : element.value,
2040
+ url: (_b = page == null ? void 0 : page.url) != null ? _b : "",
2041
+ icon: (_c = page == null ? void 0 : page.icon) != null ? _c : element.icon,
2042
+ status: (_d = page == null ? void 0 : page.status) != null ? _d : null,
2043
+ coverImage: (_f = (_e = page == null ? void 0 : page.coverImage) != null ? _e : element.coverImage) != null ? _f : null,
2044
+ provider: "Page"
2045
+ };
2046
+ };
2047
+
2048
+ // src/ui/popover.tsx
2049
+ import { cva as cva4 } from "class-variance-authority";
2050
+ import { Popover as PopoverPrimitive } from "radix-ui";
2051
+
2052
+ // src/context/portal-container.tsx
2053
+ import { createContext as createContext5, useContext as useContext5, useRef as useRef4 } from "react";
2054
+ import { jsx as jsx31 } from "react/jsx-runtime";
2055
+ var PortalContainerContext = createContext5(null);
2056
+ function usePortalContainer() {
2057
+ var _a;
2058
+ const context = useContext5(PortalContainerContext);
2059
+ return (_a = context == null ? void 0 : context.container.current) != null ? _a : null;
2060
+ }
2061
+
2062
+ // src/ui/popover.tsx
2063
+ import { jsx as jsx32 } from "react/jsx-runtime";
2064
+ var popoverVariants = cva4(
2065
+ cn(
2066
+ "group/popover",
2067
+ "z-50 max-w-[calc(100vw-24px)] animate-popover overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-floating outline-hidden"
2068
+ ),
2069
+ {
2070
+ defaultVariants: {
2071
+ variant: "default"
2072
+ },
2073
+ variants: {
2074
+ variant: {
2075
+ combobox: "",
2076
+ default: "w-72",
2077
+ equation: "w-100 rounded-lg px-2.5 py-2",
2078
+ equationInline: "w-100 rounded-lg px-2.5 py-2",
2079
+ media: "max-h-[70vh] min-w-45 rounded-lg"
2080
+ }
2081
+ }
2082
+ }
2083
+ );
2084
+ function Popover(_a) {
2085
+ var props = __objRest(_a, []);
2086
+ return /* @__PURE__ */ jsx32(PopoverPrimitive.Root, __spreadValues({ "data-slot": "popover" }, props));
2087
+ }
2088
+ function PopoverTrigger(_a) {
2089
+ var props = __objRest(_a, []);
2090
+ return /* @__PURE__ */ jsx32(PopoverPrimitive.Trigger, __spreadValues({ "data-slot": "popover-trigger" }, props));
2091
+ }
2092
+ function PopoverContent(_a) {
2093
+ var _b = _a, {
2094
+ align = "center",
2095
+ className,
2096
+ sideOffset = 4,
2097
+ variant
2098
+ } = _b, props = __objRest(_b, [
2099
+ "align",
2100
+ "className",
2101
+ "sideOffset",
2102
+ "variant"
2103
+ ]);
2104
+ const container = usePortalContainer();
2105
+ return /* @__PURE__ */ jsx32(PopoverPrimitive.Portal, { container, children: /* @__PURE__ */ jsx32(
2106
+ PopoverPrimitive.Content,
2107
+ __spreadValues({
2108
+ align,
2109
+ className: cn(popoverVariants({ variant }), className),
2110
+ "data-slot": "popover-content",
2111
+ sideOffset
2112
+ }, props)
2113
+ ) });
2114
+ }
2115
+
2116
+ // src/ui/use-member-profile.ts
2117
+ import { useEffect as useEffect5, useState as useState6 } from "react";
2118
+ var IDLE_STATE = { profile: null, isLoading: false, hasResolved: false };
2119
+ var useMemberProfile = ({ enabled, memberId, resolveMember }) => {
2120
+ const [state, setState] = useState6(IDLE_STATE);
2121
+ useEffect5(() => {
2122
+ if (!enabled || !resolveMember || memberId.length === 0) {
2123
+ setState(IDLE_STATE);
2124
+ return;
2125
+ }
2126
+ const controller = new AbortController();
2127
+ let cancelled = false;
2128
+ setState({ profile: null, isLoading: true, hasResolved: false });
2129
+ resolveMember(memberId, controller.signal).then((next) => {
2130
+ if (cancelled) return;
2131
+ setState({ profile: next, isLoading: false, hasResolved: true });
2132
+ }).catch((error) => {
2133
+ if (controller.signal.aborted || cancelled) return;
2134
+ if (error instanceof DOMException && error.name === "AbortError") return;
2135
+ setState({ profile: null, isLoading: false, hasResolved: true });
2136
+ });
2137
+ return () => {
2138
+ cancelled = true;
2139
+ controller.abort();
2140
+ };
2141
+ }, [enabled, memberId, resolveMember]);
2142
+ return state;
2143
+ };
2144
+
2145
+ // src/ui/mention-node-static.tsx
2146
+ import { Fragment as Fragment2, jsx as jsx33, jsxs as jsxs16 } from "react/jsx-runtime";
2147
+ function MentionElementStatic(_a) {
2148
+ var _b = _a, { prefix } = _b, props = __objRest(_b, ["prefix"]);
2149
+ var _a2;
2150
+ const element = props.element;
2151
+ if (readElementReference(element) !== null || ((_a2 = element.key) == null ? void 0 : _a2.startsWith("/")) === true) {
2152
+ return /* @__PURE__ */ jsx33(DocumentMentionElementStatic, __spreadValues({}, props));
2153
+ }
2154
+ return /* @__PURE__ */ jsx33(UserMentionElementStatic, __spreadValues({ prefix }, props));
2155
+ }
2156
+ function DocumentMentionElementStatic(props) {
2157
+ const element = props.element;
2158
+ const adapter = useEditorAdapter();
2159
+ const reference = readElementReference(element);
2160
+ const canResolvePage = adapter.permissions.canLinkPage && reference !== null;
2161
+ const displayMode = normalizeSmartLinkDisplayMode(element.displayMode);
2162
+ const page = usePagePreview(canResolvePage ? reference : null);
2163
+ const link = getDocumentMentionLink(element, page, displayMode);
2164
+ const anchorProps = (page == null ? void 0 : page.url) ? getSmartLinkAnchorProps(page.url) : {};
2165
+ return /* @__PURE__ */ jsxs16(
2166
+ SlateElement16,
2167
+ __spreadProps(__spreadValues({}, props), {
2168
+ as: anchorProps.href ? "a" : void 0,
2169
+ attributes: __spreadProps(__spreadValues(__spreadValues({}, props.attributes), anchorProps), { "data-slate-value": element.value }),
2170
+ className: cn(
2171
+ link.displayMode === "card" ? "my-2 block w-full" : "inline align-baseline",
2172
+ anchorProps.href ? "no-underline" : void 0
2173
+ ),
2174
+ children: [
2175
+ /* @__PURE__ */ jsx33(SmartLinkContent, { link }),
2176
+ props.children
2177
+ ]
2178
+ })
2179
+ );
2180
+ }
2181
+ function UserMentionElementStatic(_a) {
2182
+ var _b = _a, { prefix } = _b, props = __objRest(_b, ["prefix"]);
2183
+ var _a2;
2184
+ const element = props.element;
2185
+ const adapter = useEditorAdapter();
2186
+ const resolveMember = adapter.mentions.resolveMember;
2187
+ const memberId = (_a2 = element.key) != null ? _a2 : "";
2188
+ const canShowCard = typeof resolveMember === "function" && memberId.length > 0;
2189
+ const [wantOpen, setWantOpen] = useState7(false);
2190
+ const { profile, isLoading, hasResolved } = useMemberProfile({
2191
+ enabled: canShowCard && wantOpen,
2192
+ memberId,
2193
+ resolveMember
2194
+ });
2195
+ const isOpen = wantOpen && !(hasResolved && profile === null);
2196
+ const handleOpenChange = useCallback6((next) => {
2197
+ setWantOpen(next);
2198
+ }, []);
2199
+ const leaf = element.children[0];
2200
+ const badgeClassName = cn(
2201
+ "inline-block rounded-md bg-muted px-1.5 py-0.5 align-baseline font-medium text-sm",
2202
+ canShowCard ? "cursor-pointer" : "cursor-default",
2203
+ (leaf == null ? void 0 : leaf.bold) === true && "font-bold",
2204
+ (leaf == null ? void 0 : leaf.italic) === true && "italic",
2205
+ (leaf == null ? void 0 : leaf.underline) === true && "underline"
2206
+ );
2207
+ if (!canShowCard) {
2208
+ return /* @__PURE__ */ jsx33(
2209
+ SlateElement16,
2210
+ __spreadProps(__spreadValues({}, props), {
2211
+ attributes: __spreadProps(__spreadValues({}, props.attributes), { "data-slate-value": element.value }),
2212
+ className: badgeClassName,
2213
+ children: IS_APPLE ? /* @__PURE__ */ jsxs16(Fragment2, { children: [
2214
+ props.children,
2215
+ prefix,
2216
+ element.value
2217
+ ] }) : /* @__PURE__ */ jsxs16(Fragment2, { children: [
2218
+ prefix,
2219
+ element.value,
2220
+ props.children
2221
+ ] })
2222
+ })
2223
+ );
2224
+ }
2225
+ return /* @__PURE__ */ jsxs16(
2226
+ SlateElement16,
2227
+ __spreadProps(__spreadValues({}, props), {
2228
+ attributes: __spreadProps(__spreadValues({}, props.attributes), { "data-slate-value": element.value }),
2229
+ className: "inline align-baseline",
2230
+ children: [
2231
+ /* @__PURE__ */ jsxs16(Popover, { modal: false, onOpenChange: handleOpenChange, open: isOpen, children: [
2232
+ /* @__PURE__ */ jsxs16(
2233
+ PopoverTrigger,
2234
+ {
2235
+ className: cn(
2236
+ badgeClassName,
2237
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1"
2238
+ ),
2239
+ children: [
2240
+ prefix,
2241
+ element.value
2242
+ ]
2243
+ }
2244
+ ),
2245
+ /* @__PURE__ */ jsx33(PopoverContent, { align: "start", className: "w-80 p-4", sideOffset: 8, children: /* @__PURE__ */ jsx33(MemberProfileCard, { fallbackName: element.value, isLoading, profile }) })
2246
+ ] }),
2247
+ props.children
2248
+ ]
2249
+ })
2250
+ );
2251
+ }
2252
+
2253
+ // src/components/editor/plugins/mention-base-kit.tsx
2254
+ var BaseMentionKit = [BaseMentionPlugin.withComponent(MentionElementStatic)];
2255
+
2256
+ // src/components/editor/plugins/suggestion-base-kit.tsx
2257
+ import { BaseSuggestionPlugin as BaseSuggestionPlugin2 } from "@platejs/suggestion";
2258
+
2259
+ // src/ui/suggestion-node-static.tsx
2260
+ import { BaseSuggestionPlugin } from "@platejs/suggestion";
2261
+ import { SlateLeaf as SlateLeaf6 } from "platejs/static";
2262
+ import { jsx as jsx34 } from "react/jsx-runtime";
2263
+ function SuggestionLeafStatic(props) {
2264
+ const { editor, leaf } = props;
2265
+ const dataList = editor.getApi(BaseSuggestionPlugin).suggestion.dataList(leaf);
2266
+ const hasRemove = dataList.some((data) => data.type === "remove");
2267
+ const diffOperation = { type: hasRemove ? "delete" : "insert" };
2268
+ const Component = { delete: "del", insert: "ins", update: "span" }[diffOperation.type];
2269
+ return /* @__PURE__ */ jsx34(
2270
+ SlateLeaf6,
2271
+ __spreadProps(__spreadValues({}, props), {
2272
+ as: Component,
2273
+ className: cn(
2274
+ "border-b-2 border-b-brand/[.24] bg-brand/8 text-brand/80 no-underline transition-colors duration-200",
2275
+ hasRemove && "border-b-gray-300 bg-gray-300/25 text-gray-400 line-through"
2276
+ ),
2277
+ children: props.children
2278
+ })
2279
+ );
2280
+ }
2281
+
2282
+ // src/components/editor/plugins/suggestion-base-kit.tsx
2283
+ var BaseSuggestionKit = [BaseSuggestionPlugin2.withComponent(SuggestionLeafStatic)];
2284
+
2285
+ // src/components/editor/plugins/tabbed-code-block-base-kit.tsx
2286
+ import { CODE_LINE_TO_DECORATIONS, setCodeBlockToDecorations } from "@platejs/code-block";
2287
+ import { all as all2, createLowlight as createLowlight2 } from "lowlight";
2288
+ import { createSlatePlugin, ElementApi } from "platejs";
2289
+ import { toPlatePlugin } from "platejs/react";
2290
+
2291
+ // src/ui/tabbed-code-block-node-static.tsx
2292
+ import { AnimatePresence as AnimatePresence3, motion as motion3 } from "framer-motion";
2293
+ import { CheckIcon as CheckIcon3, ChevronDownIcon, FilesIcon as FilesIcon2 } from "lucide-react";
2294
+ import { NodeApi as NodeApi6 } from "platejs";
2295
+ import { SlateElement as SlateElement17 } from "platejs/static";
2296
+ import * as React6 from "react";
2297
+
2298
+ // src/ui/code-line-wrapper.tsx
2299
+ import { jsx as jsx35, jsxs as jsxs17 } from "react/jsx-runtime";
2300
+ function CodeLineWrapperStatic({
2301
+ children,
2302
+ lineIndex,
2303
+ markType,
2304
+ showDiffPrefix = false,
2305
+ showLineNumbers = false
2306
+ }) {
2307
+ const lineNumber = lineIndex + 1;
2308
+ const hasBackground = Boolean(markType);
2309
+ const getBackgroundStyle = () => {
2310
+ if (markType === "add") return { backgroundColor: "rgba(34, 134, 58, 0.15)" };
2311
+ if (markType === "remove") return { backgroundColor: "rgba(179, 29, 40, 0.15)" };
2312
+ if (markType === "highlight") return { backgroundColor: "rgba(34, 134, 58, 0.2)" };
2313
+ return void 0;
2314
+ };
2315
+ return /* @__PURE__ */ jsxs17(
2316
+ "div",
2317
+ {
2318
+ className: cn(hasBackground && "-mx-4 px-4"),
2319
+ style: getBackgroundStyle(),
2320
+ "data-line": lineNumber,
2321
+ "data-mark-type": markType || "none",
2322
+ children: [
2323
+ (showDiffPrefix || showLineNumbers) && /* @__PURE__ */ jsxs17("span", { className: "mr-3 inline-block w-6 select-none text-right text-muted-foreground/60", children: [
2324
+ showDiffPrefix && markType === "add" && /* @__PURE__ */ jsx35("span", { className: "font-bold text-green-600 dark:text-green-400", children: "+" }),
2325
+ showDiffPrefix && markType === "remove" && /* @__PURE__ */ jsx35("span", { className: "font-bold text-red-600 dark:text-red-400", children: "-" }),
2326
+ showDiffPrefix && markType === "highlight" && (showLineNumbers ? lineNumber : ""),
2327
+ !showDiffPrefix && showLineNumbers && lineNumber
2328
+ ] }),
2329
+ children
2330
+ ]
2331
+ }
2332
+ );
2333
+ }
2334
+
2335
+ // src/ui/tabbed-code-block-node.tsx
2336
+ import { PlateElement, useEditorRef, useReadOnly } from "platejs/react";
2337
+ import * as React5 from "react";
2338
+
2339
+ // src/ui/button.tsx
2340
+ import { Slot } from "radix-ui";
2341
+ import { cva as cva6 } from "class-variance-authority";
2342
+
2343
+ // src/ui/spinner.tsx
2344
+ import { cva as cva5 } from "class-variance-authority";
2345
+ import { Loader2Icon } from "lucide-react";
2346
+ import { jsx as jsx36 } from "react/jsx-runtime";
2347
+ var spinnerVariants = cva5("animate-spin text-muted-foreground", {
2348
+ defaultVariants: {
2349
+ size: "default"
2350
+ },
2351
+ variants: {
2352
+ size: {
2353
+ default: "size-4",
2354
+ icon: "size-10",
2355
+ lg: "size-6",
2356
+ sm: "size-2"
2357
+ }
2358
+ }
2359
+ });
2360
+ function Spinner(_a) {
2361
+ var _b = _a, { className, size } = _b, props = __objRest(_b, ["className", "size"]);
2362
+ return /* @__PURE__ */ jsx36(Loader2Icon, __spreadValues({ className: cn(spinnerVariants({ size }), className) }, props));
2363
+ }
2364
+
2365
+ // src/ui/tooltip.tsx
2366
+ import { Tooltip as TooltipPrimitive } from "radix-ui";
2367
+
2368
+ // src/hooks/use-mounted.ts
2369
+ import { useSyncExternalStore as useSyncExternalStore2 } from "react";
2370
+ var useMounted = () => {
2371
+ return useSyncExternalStore2(
2372
+ subscribe,
2373
+ // subscribe: no-op, never changes
2374
+ () => true,
2375
+ // getSnapshot (client): always true
2376
+ () => false
2377
+ // getServerSnapshot (SSR): always false
2378
+ );
2379
+ };
2380
+ var subscribe = () => () => {
2381
+ };
2382
+
2383
+ // src/ui/tooltip.tsx
2384
+ import { jsx as jsx37, jsxs as jsxs18 } from "react/jsx-runtime";
2385
+ function TooltipProvider(_a) {
2386
+ var _b = _a, {
2387
+ delayDuration = 200,
2388
+ disableHoverableContent = true,
2389
+ skipDelayDuration = 0
2390
+ } = _b, props = __objRest(_b, [
2391
+ "delayDuration",
2392
+ "disableHoverableContent",
2393
+ "skipDelayDuration"
2394
+ ]);
2395
+ return /* @__PURE__ */ jsx37(
2396
+ TooltipPrimitive.Provider,
2397
+ __spreadValues({
2398
+ delayDuration,
2399
+ disableHoverableContent,
2400
+ skipDelayDuration
2401
+ }, props)
2402
+ );
2403
+ }
2404
+ var Tooltip = TooltipPrimitive.Root;
2405
+ var TooltipTrigger = TooltipPrimitive.Trigger;
2406
+ function TooltipPortal(props) {
2407
+ const container = usePortalContainer();
2408
+ return /* @__PURE__ */ jsx37(TooltipPrimitive.Portal, __spreadValues({ container }, props));
2409
+ }
2410
+ function TooltipContent(_a) {
2411
+ var _b = _a, {
2412
+ className,
2413
+ sideOffset = 4
2414
+ } = _b, props = __objRest(_b, [
2415
+ "className",
2416
+ "sideOffset"
2417
+ ]);
2418
+ return /* @__PURE__ */ jsx37(
2419
+ TooltipPrimitive.Content,
2420
+ __spreadValues({
2421
+ className: cn(
2422
+ "z-9999 overflow-hidden rounded-md bg-primary px-2 py-1.5 font-semibold text-primary-foreground text-xs shadow-md",
2423
+ className
2424
+ ),
2425
+ sideOffset
2426
+ }, props)
2427
+ );
2428
+ }
2429
+ function withTooltip(Component) {
2430
+ return function ExtendComponent(_a) {
2431
+ var _b = _a, {
2432
+ shortcut,
2433
+ tooltip,
2434
+ tooltipContentProps,
2435
+ tooltipProps,
2436
+ tooltipTriggerProps
2437
+ } = _b, props = __objRest(_b, [
2438
+ "shortcut",
2439
+ "tooltip",
2440
+ "tooltipContentProps",
2441
+ "tooltipProps",
2442
+ "tooltipTriggerProps"
2443
+ ]);
2444
+ const isMounted = useMounted();
2445
+ const component = /* @__PURE__ */ jsx37(Component, __spreadValues({}, props));
2446
+ if (tooltip && isMounted) {
2447
+ return /* @__PURE__ */ jsx37(TooltipProvider, { children: /* @__PURE__ */ jsxs18(Tooltip, __spreadProps(__spreadValues({}, tooltipProps), { children: [
2448
+ /* @__PURE__ */ jsx37(TooltipTrigger, __spreadProps(__spreadValues({ asChild: true }, tooltipTriggerProps), { children: component })),
2449
+ /* @__PURE__ */ jsx37(TooltipPortal, { children: /* @__PURE__ */ jsxs18(TooltipContent, __spreadProps(__spreadValues({}, tooltipContentProps), { children: [
2450
+ tooltip,
2451
+ shortcut && /* @__PURE__ */ jsx37("div", { className: "mt-px text-primary-foreground/70", children: shortcut })
2452
+ ] })) })
2453
+ ] })) });
2454
+ }
2455
+ return component;
2456
+ };
2457
+ }
2458
+
2459
+ // src/ui/button.tsx
2460
+ import { jsx as jsx38, jsxs as jsxs19 } from "react/jsx-runtime";
2461
+ var SlotRoot = Slot.Root;
2462
+ var buttonVariants = cva6(
2463
+ "focus-ring inline-flex w-fit cursor-pointer select-none items-center justify-center gap-2 rounded-md text-sm ring-offset-background transition-bg-ease disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
2464
+ {
2465
+ defaultVariants: {
2466
+ size: "default",
2467
+ truncate: true,
2468
+ variant: "default"
2469
+ },
2470
+ variants: {
2471
+ active: {
2472
+ false: "",
2473
+ true: "border-2 border-primary"
2474
+ },
2475
+ disabled: {
2476
+ true: "pointer-events-none opacity-50"
2477
+ },
2478
+ focused: {
2479
+ true: "ring-2 ring-ring ring-offset-2"
2480
+ },
2481
+ isMenu: {
2482
+ true: "h-auto w-full cursor-pointer justify-start"
2483
+ },
2484
+ size: {
2485
+ blockAction: "size-6.5 gap-1 px-1.5 text-xs",
2486
+ default: "h-7 gap-1.5 px-2",
2487
+ icon: "size-7 w-8.25 [&_svg]:size-5",
2488
+ iconSm: "size-7",
2489
+ iconXs: "size-5.5",
2490
+ lg: "h-11 px-4 text-lg",
2491
+ md: "h-8 px-3",
2492
+ menuAction: "size-6",
2493
+ navAction: "size-5",
2494
+ none: "",
2495
+ sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
2496
+ xs: "h-6.5 px-1.5 py-1 text-xs"
2497
+ },
2498
+ truncate: {
2499
+ true: "truncate whitespace-nowrap"
2500
+ },
2501
+ variant: {
2502
+ blockAction: "rounded-sm hover:bg-primary/6 [&_svg]:text-muted-foreground",
2503
+ blockActionSecondary: "rounded-sm bg-primary/6 [&_svg]:text-muted-foreground",
2504
+ brand: "bg-brand font-medium text-white hover:bg-brand/80 active:bg-brand-active",
2505
+ default: "bg-primary font-medium text-primary-foreground hover:bg-primary/90 [&_svg]:text-primary-foreground",
2506
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90 [&_svg]:text-destructive-foreground",
2507
+ ghost: "hover:bg-accent hover:text-accent-foreground",
2508
+ ghost2: "text-muted-foreground hover:bg-accent",
2509
+ ghost3: "text-muted-foreground/80 hover:bg-accent",
2510
+ ghostActive: "bg-accent hover:bg-accent hover:text-accent-foreground",
2511
+ menuAction: "text-muted-foreground/80 hover:bg-primary/6",
2512
+ nav: "rounded-sm text-muted-foreground transition hover:bg-primary/4",
2513
+ navAction: "rounded-sm text-muted-foreground/80 opacity-0 transition hover:bg-primary/6 group-hover:opacity-100",
2514
+ none: "",
2515
+ outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
2516
+ primaryOutline: "border border-primary-foreground text-primary-foreground hover:bg-accent/15 [&_svg]:text-primary-foreground",
2517
+ radio: "border-2 border-input hover:border-primary",
2518
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80"
2519
+ }
2520
+ }
2521
+ }
2522
+ );
2523
+ var Button = withTooltip(function Button2(_a) {
2524
+ var _b = _a, {
2525
+ active,
2526
+ asChild = false,
2527
+ children,
2528
+ className,
2529
+ focused,
2530
+ icon,
2531
+ iconPlacement = "left",
2532
+ isMenu,
2533
+ isPending,
2534
+ label,
2535
+ loading,
2536
+ loadingClassName,
2537
+ size,
2538
+ truncate,
2539
+ variant,
2540
+ onToggleClick
2541
+ } = _b, props = __objRest(_b, [
2542
+ "active",
2543
+ "asChild",
2544
+ "children",
2545
+ "className",
2546
+ "focused",
2547
+ "icon",
2548
+ "iconPlacement",
2549
+ "isMenu",
2550
+ "isPending",
2551
+ "label",
2552
+ "loading",
2553
+ "loadingClassName",
2554
+ "size",
2555
+ "truncate",
2556
+ "variant",
2557
+ "onToggleClick"
2558
+ ]);
2559
+ const Comp = asChild ? SlotRoot : "button";
2560
+ return /* @__PURE__ */ jsxs19(
2561
+ Comp,
2562
+ __spreadProps(__spreadValues({
2563
+ "aria-label": label && label.length > 0 ? label : void 0,
2564
+ className: cn(
2565
+ buttonVariants({
2566
+ disabled: props.disabled,
2567
+ focused,
2568
+ isMenu,
2569
+ size,
2570
+ truncate,
2571
+ variant
2572
+ }),
2573
+ active && "border-2 border-primary",
2574
+ className
2575
+ ),
2576
+ type: Comp === "button" ? "button" : void 0
2577
+ }, props), {
2578
+ children: [
2579
+ icon && iconPlacement === "left" && icon,
2580
+ loading && /* @__PURE__ */ jsx38(Spinner, { className: loadingClassName }),
2581
+ children,
2582
+ icon && iconPlacement === "right" && icon
2583
+ ]
2584
+ })
2585
+ );
2586
+ });
2587
+ var LinkButton = withTooltip(function LinkButton2(_a) {
2588
+ var _b = _a, {
2589
+ active,
2590
+ children,
2591
+ className,
2592
+ focused,
2593
+ icon,
2594
+ iconPlacement = "left",
2595
+ isMenu,
2596
+ label,
2597
+ loading,
2598
+ loadingClassName,
2599
+ size,
2600
+ truncate,
2601
+ variant = "ghost"
2602
+ } = _b, props = __objRest(_b, [
2603
+ "active",
2604
+ "children",
2605
+ "className",
2606
+ "focused",
2607
+ "icon",
2608
+ "iconPlacement",
2609
+ "isMenu",
2610
+ "label",
2611
+ "loading",
2612
+ "loadingClassName",
2613
+ "size",
2614
+ "truncate",
2615
+ "variant"
2616
+ ]);
2617
+ return /* @__PURE__ */ jsxs19(
2618
+ "a",
2619
+ __spreadProps(__spreadValues({
2620
+ className: cn(
2621
+ buttonVariants({
2622
+ disabled: props.disabled,
2623
+ focused,
2624
+ isMenu,
2625
+ size,
2626
+ truncate,
2627
+ variant
2628
+ }),
2629
+ active && "border-2 border-primary",
2630
+ className
2631
+ ),
2632
+ title: label && label.length > 0 ? label : void 0
2633
+ }, props), {
2634
+ children: [
2635
+ icon && iconPlacement === "left" && /* @__PURE__ */ jsx38("div", { className: "shrink-0", children: icon }),
2636
+ loading && /* @__PURE__ */ jsx38(Spinner, { className: loadingClassName }),
2637
+ children,
2638
+ icon && iconPlacement === "right" && icon
2639
+ ]
2640
+ })
2641
+ );
2642
+ });
2643
+
2644
+ // src/ui/tabbed-code-block-sync.tsx
2645
+ import * as React4 from "react";
2646
+ import { jsx as jsx39 } from "react/jsx-runtime";
2647
+ var TabSyncContext = React4.createContext(null);
2648
+ function useTabSync() {
2649
+ return React4.useContext(TabSyncContext);
2650
+ }
2651
+
2652
+ // src/ui/tabbed-code-block-node.tsx
2653
+ import { jsx as jsx40, jsxs as jsxs20 } from "react/jsx-runtime";
2654
+
2655
+ // src/ui/tabbed-code-block-node-static.tsx
2656
+ import { jsx as jsx41, jsxs as jsxs21 } from "react/jsx-runtime";
2657
+ var syntaxHighlightingClasses = cn(
2658
+ "**:[.hljs-comment,.hljs-code,.hljs-formula]:text-[#6a737d]",
2659
+ "**:[.hljs-keyword,.hljs-doctag,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_]:text-[#d73a49]",
2660
+ "**:[.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_]:text-[#6f42c1]",
2661
+ "**:[.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable]:text-[#005cc5]",
2662
+ "**:[.hljs-regexp,.hljs-string,.hljs-meta_.hljs-string]:text-[#032f62]",
2663
+ "**:[.hljs-built_in,.hljs-symbol]:text-[#e36209]",
2664
+ "**:[.hljs-name,.hljs-quote,.hljs-selector-tag,.hljs-selector-pseudo]:text-[#22863a]",
2665
+ "**:[.hljs-emphasis]:italic",
2666
+ "**:[.hljs-strong]:font-bold",
2667
+ "**:[.hljs-section]:font-bold **:[.hljs-section]:text-[#005cc5]",
2668
+ "**:[.hljs-bullet]:text-[#735c0f]",
2669
+ "**:[.hljs-addition]:bg-[#f0fff4] **:[.hljs-addition]:text-[#22863a]",
2670
+ "**:[.hljs-deletion]:bg-[#ffeef0] **:[.hljs-deletion]:text-[#b31d28]"
2671
+ );
2672
+ function TabbedCodeBlockElementStatic(props) {
2673
+ var _a, _b;
2674
+ const { children, element } = props;
2675
+ const { copyToClipboard } = useCopyToClipboard();
2676
+ const [copied, setCopied] = React6.useState(false);
2677
+ const tabs = element.tabs || [];
2678
+ const tabContents = element.tabContents || {};
2679
+ const displayMode = (_a = element.displayMode) != null ? _a : "tabs";
2680
+ const syncKey = element.syncKey;
2681
+ const tabSync = useTabSync();
2682
+ const initialActiveTabId = element.activeTabId || ((_b = tabs[0]) == null ? void 0 : _b.id);
2683
+ const [activeTabId, setActiveTabId] = React6.useState(initialActiveTabId);
2684
+ const [dropdownOpen, setDropdownOpen] = React6.useState(false);
2685
+ const dropdownRef = React6.useRef(null);
2686
+ const activeTab = tabs.find((t) => t.id === activeTabId);
2687
+ const activeTabIndex = tabs.findIndex((t) => t.id === activeTabId);
2688
+ const lineMarkingMeta = activeTab == null ? void 0 : activeTab.lineMarkingMeta;
2689
+ const lineMarkingConfig = parseLineMarkingMeta(lineMarkingMeta);
2690
+ const tabRefs = React6.useRef(/* @__PURE__ */ new Map());
2691
+ const [indicatorStyle, setIndicatorStyle] = React6.useState({ left: 0, width: 0 });
2692
+ React6.useEffect(() => {
2693
+ var _a2;
2694
+ if (displayMode !== "tabs") return;
2695
+ const activeTabRef = tabRefs.current.get(activeTabId);
2696
+ if (activeTabRef) {
2697
+ const parentRect = (_a2 = activeTabRef.parentElement) == null ? void 0 : _a2.getBoundingClientRect();
2698
+ const tabRect = activeTabRef.getBoundingClientRect();
2699
+ if (parentRect) {
2700
+ setIndicatorStyle({
2701
+ left: tabRect.left - parentRect.left,
2702
+ width: tabRect.width
2703
+ });
2704
+ }
2705
+ }
2706
+ }, [activeTabId, tabs, displayMode]);
2707
+ React6.useEffect(() => {
2708
+ if (!dropdownOpen) return;
2709
+ const handleClickOutside = (event) => {
2710
+ if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
2711
+ setDropdownOpen(false);
2712
+ }
2713
+ };
2714
+ document.addEventListener("mousedown", handleClickOutside);
2715
+ return () => document.removeEventListener("mousedown", handleClickOutside);
2716
+ }, [dropdownOpen]);
2717
+ React6.useEffect(() => {
2718
+ if (!syncKey || !tabSync) return;
2719
+ const syncedLabel = tabSync.syncState[syncKey];
2720
+ if (!syncedLabel) return;
2721
+ const matchingTab = tabs.find((t) => t.label === syncedLabel);
2722
+ if (matchingTab && matchingTab.id !== activeTabId) {
2723
+ setActiveTabId(matchingTab.id);
2724
+ }
2725
+ }, [syncKey, tabSync == null ? void 0 : tabSync.syncState[syncKey || ""], tabs, activeTabId]);
2726
+ const switchTab = (tabId) => {
2727
+ if (tabId === activeTabId) return;
2728
+ setActiveTabId(tabId);
2729
+ const newTab = tabs.find((t) => t.id === tabId);
2730
+ if (syncKey && tabSync && newTab) {
2731
+ tabSync.setSyncState(syncKey, newTab.label);
2732
+ }
2733
+ };
2734
+ const getTabContent = (tabId) => {
2735
+ var _a2;
2736
+ if (tabId === element.activeTabId) {
2737
+ return element.children.map((child) => NodeApi6.string(child)).join("\n");
2738
+ }
2739
+ return ((_a2 = tabContents[tabId]) == null ? void 0 : _a2.lines.join("\n")) || "";
2740
+ };
2741
+ const copyActiveTabContent = () => {
2742
+ const content = getTabContent(activeTabId);
2743
+ copyToClipboard(content, {
2744
+ tooltip: "Copied code to clipboard"
2745
+ });
2746
+ setCopied(true);
2747
+ setTimeout(() => setCopied(false), 2e3);
2748
+ };
2749
+ const isViewingStoredActiveTab = activeTabId === element.activeTabId;
2750
+ const renderTabContent = (tabId) => {
2751
+ var _a2;
2752
+ const tab = tabs.find((t) => t.id === tabId);
2753
+ const tabMarkingConfig = parseLineMarkingMeta(tab == null ? void 0 : tab.lineMarkingMeta);
2754
+ const tabHasDiffMarkings = tabMarkingConfig.markings.some((m) => m.type === "add" || m.type === "remove");
2755
+ const content = ((_a2 = tabContents[tabId]) == null ? void 0 : _a2.lines) || [];
2756
+ return content.map((line, index) => {
2757
+ const markType = getLineMarkType(index, tabMarkingConfig);
2758
+ return (
2759
+ // biome-ignore lint/suspicious/noArrayIndexKey: Lines are static content that won't be reordered
2760
+ /* @__PURE__ */ jsxs21(CodeLineWrapperStatic, { lineIndex: index, markType, showDiffPrefix: tabHasDiffMarkings, children: [
2761
+ line,
2762
+ "\n"
2763
+ ] }, index)
2764
+ );
2765
+ });
2766
+ };
2767
+ return /* @__PURE__ */ jsx41(SlateElement17, __spreadProps(__spreadValues({ className: cn("py-1", syntaxHighlightingClasses) }, props), { children: /* @__PURE__ */ jsxs21("div", { className: "overflow-hidden rounded-xl border border-border bg-muted", children: [
2768
+ /* @__PURE__ */ jsxs21("div", { className: "flex items-center justify-between px-4 pt-3", children: [
2769
+ displayMode === "tabs" ? /* @__PURE__ */ jsxs21("div", { className: "relative flex items-center gap-4 overflow-x-auto", children: [
2770
+ tabs.map((tab) => /* @__PURE__ */ jsx41(
2771
+ "button",
2772
+ {
2773
+ ref: (el) => {
2774
+ if (el) tabRefs.current.set(tab.id, el);
2775
+ else tabRefs.current.delete(tab.id);
2776
+ },
2777
+ className: "relative cursor-pointer pb-2",
2778
+ onClick: () => switchTab(tab.id),
2779
+ type: "button",
2780
+ children: /* @__PURE__ */ jsx41(
2781
+ "span",
2782
+ {
2783
+ className: cn(
2784
+ "select-none text-sm transition-colors",
2785
+ tab.id === activeTabId ? "text-foreground" : "text-muted-foreground hover:text-foreground"
2786
+ ),
2787
+ children: tab.label
2788
+ }
2789
+ )
2790
+ },
2791
+ tab.id
2792
+ )),
2793
+ activeTabIndex >= 0 && indicatorStyle.width > 0 && /* @__PURE__ */ jsx41(
2794
+ motion3.div,
2795
+ {
2796
+ className: "absolute bottom-0 h-0.5 rounded-full bg-primary",
2797
+ initial: false,
2798
+ animate: {
2799
+ left: indicatorStyle.left,
2800
+ width: indicatorStyle.width
2801
+ },
2802
+ transition: {
2803
+ type: "spring",
2804
+ stiffness: 500,
2805
+ damping: 35
2806
+ }
2807
+ }
2808
+ )
2809
+ ] }) : /* @__PURE__ */ jsxs21("div", { ref: dropdownRef, className: "relative mb-1.5", children: [
2810
+ /* @__PURE__ */ jsxs21(
2811
+ "button",
2812
+ {
2813
+ type: "button",
2814
+ className: cn(
2815
+ "flex h-7 items-center gap-1.5 rounded-md px-2 text-sm transition-colors",
2816
+ "hover:bg-background/50",
2817
+ tabs.length <= 1 && "cursor-default"
2818
+ ),
2819
+ onClick: () => tabs.length > 1 && setDropdownOpen(!dropdownOpen),
2820
+ children: [
2821
+ (activeTab == null ? void 0 : activeTab.label) || "Select tab",
2822
+ tabs.length > 1 && /* @__PURE__ */ jsx41(ChevronDownIcon, { className: "size-3.5" })
2823
+ ]
2824
+ }
2825
+ ),
2826
+ dropdownOpen && tabs.length > 1 && /* @__PURE__ */ jsx41("div", { className: "absolute left-0 top-full z-10 mt-1 w-48 overflow-hidden rounded-md border border-border bg-popover p-1 shadow-floating", children: tabs.map((tab) => /* @__PURE__ */ jsxs21(
2827
+ "button",
2828
+ {
2829
+ type: "button",
2830
+ className: cn(
2831
+ "flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm transition-colors hover:bg-muted",
2832
+ tab.id === activeTabId && "bg-muted"
2833
+ ),
2834
+ onClick: () => {
2835
+ switchTab(tab.id);
2836
+ setDropdownOpen(false);
2837
+ },
2838
+ children: [
2839
+ /* @__PURE__ */ jsx41("span", { className: "flex-1 text-left", children: tab.label }),
2840
+ /* @__PURE__ */ jsx41("span", { className: "text-xs text-muted-foreground", children: tab.lang })
2841
+ ]
2842
+ },
2843
+ tab.id
2844
+ )) })
2845
+ ] }),
2846
+ /* @__PURE__ */ jsx41("div", { className: "mb-1.5 flex items-center gap-2", children: /* @__PURE__ */ jsx41(
2847
+ "button",
2848
+ {
2849
+ className: cn(
2850
+ "relative cursor-pointer transition-colors",
2851
+ copied ? "text-primary" : "text-muted-foreground hover:text-foreground"
2852
+ ),
2853
+ onClick: copyActiveTabContent,
2854
+ type: "button",
2855
+ title: "Copy code",
2856
+ children: /* @__PURE__ */ jsx41(AnimatePresence3, { mode: "wait", initial: false, children: copied ? /* @__PURE__ */ jsx41(
2857
+ motion3.div,
2858
+ {
2859
+ initial: { scale: 0, opacity: 0 },
2860
+ animate: { scale: 1, opacity: 1 },
2861
+ exit: { scale: 0, opacity: 0 },
2862
+ transition: { duration: 0.15 },
2863
+ children: /* @__PURE__ */ jsx41(CheckIcon3, { className: "size-4" })
2864
+ },
2865
+ "check"
2866
+ ) : /* @__PURE__ */ jsx41(
2867
+ motion3.div,
2868
+ {
2869
+ initial: { scale: 0, opacity: 0 },
2870
+ animate: { scale: 1, opacity: 1 },
2871
+ exit: { scale: 0, opacity: 0 },
2872
+ transition: { duration: 0.15 },
2873
+ children: /* @__PURE__ */ jsx41(FilesIcon2, { className: "size-4" })
2874
+ },
2875
+ "copy"
2876
+ ) })
2877
+ }
2878
+ ) })
2879
+ ] }),
2880
+ /* @__PURE__ */ jsx41(
2881
+ "pre",
2882
+ {
2883
+ className: "overflow-x-auto p-4 font-mono text-sm leading-relaxed [tab-size:2] print:break-inside-avoid rounded-xl bg-background",
2884
+ "data-lang": activeTab == null ? void 0 : activeTab.lang,
2885
+ children: /* @__PURE__ */ jsx41("code", { children: isViewingStoredActiveTab ? /* @__PURE__ */ jsx41(LineMarkingProvider, { config: lineMarkingConfig, children }) : renderTabContent(activeTabId) })
2886
+ }
2887
+ )
2888
+ ] }) }));
2889
+ }
2890
+
2891
+ // src/components/editor/plugins/tabbed-code-block-base-kit.tsx
2892
+ var lowlight2 = createLowlight2(all2);
2893
+ var BaseTabbedCodeBlockPluginConfig = createSlatePlugin({
2894
+ key: "tabbed_code_block",
2895
+ node: { isElement: true },
2896
+ options: { lowlight: lowlight2 },
2897
+ // Apply syntax highlighting decorations
2898
+ decorate: ({ editor, entry }) => {
2899
+ var _a, _b;
2900
+ const [node, path] = entry;
2901
+ if (ElementApi.isElement(node) && node.type === "tabbed_code_block") {
2902
+ const element = node;
2903
+ const activeTab = ((_a = element.tabs) == null ? void 0 : _a.find((t) => t.id === element.activeTabId)) || ((_b = element.tabs) == null ? void 0 : _b[0]);
2904
+ const lang = (activeTab == null ? void 0 : activeTab.lang) || "plaintext";
2905
+ const codeBlockEntry = [__spreadProps(__spreadValues({}, element), { lang }), path];
2906
+ setCodeBlockToDecorations(editor, codeBlockEntry);
2907
+ }
2908
+ return CODE_LINE_TO_DECORATIONS.get(node) || [];
2909
+ }
2910
+ });
2911
+ var TabbedCodeBlockPluginStatic = toPlatePlugin(BaseTabbedCodeBlockPluginConfig).withComponent(
2912
+ TabbedCodeBlockElementStatic
2913
+ );
2914
+ var BaseTabbedCodeBlockKit = [TabbedCodeBlockPluginStatic];
2915
+
2916
+ // src/components/editor/plugins/table-base-kit.tsx
2917
+ import { BaseTableCellHeaderPlugin, BaseTableCellPlugin, BaseTablePlugin as BaseTablePlugin2, BaseTableRowPlugin } from "@platejs/table";
2918
+
2919
+ // src/ui/table-node-static.tsx
2920
+ import { BaseTablePlugin } from "@platejs/table";
2921
+ import { SlateElement as SlateElement18 } from "platejs/static";
2922
+ import { jsx as jsx42 } from "react/jsx-runtime";
2923
+ function TableElementStatic(_a) {
2924
+ var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
2925
+ const { disableMarginLeft } = props.editor.getOptions(BaseTablePlugin);
2926
+ const marginLeft = disableMarginLeft ? 0 : props.element.marginLeft;
2927
+ return /* @__PURE__ */ jsx42(SlateElement18, __spreadProps(__spreadValues({}, props), { className: "overflow-x-auto py-5", style: { paddingLeft: marginLeft }, children: /* @__PURE__ */ jsx42("table", { className: "group/table w-full table-auto border-collapse", style: { borderCollapse: "collapse" }, children: /* @__PURE__ */ jsx42("tbody", { children }) }) }));
2928
+ }
2929
+ function TableRowElementStatic(props) {
2930
+ return /* @__PURE__ */ jsx42(SlateElement18, __spreadProps(__spreadValues({}, props), { as: "tr", className: "h-full", children: props.children }));
2931
+ }
2932
+ function TableCellElementStatic(_a) {
2933
+ var _b = _a, {
2934
+ isHeader
2935
+ } = _b, props = __objRest(_b, [
2936
+ "isHeader"
2937
+ ]);
2938
+ var _a2, _b2, _c, _d;
2939
+ const { editor, element } = props;
2940
+ const { api } = editor.getPlugin(BaseTablePlugin);
2941
+ const { minHeight } = api.table.getCellSize({ element });
2942
+ const borders = api.table.getCellBorders({ element });
2943
+ return /* @__PURE__ */ jsx42(
2944
+ SlateElement18,
2945
+ __spreadProps(__spreadValues({}, props), {
2946
+ as: isHeader ? "th" : "td",
2947
+ className: cn(
2948
+ "h-full overflow-visible border-none bg-background p-0 align-top",
2949
+ element.background ? "bg-(--cellBackground)" : "bg-background",
2950
+ isHeader && "text-left font-normal *:m-0",
2951
+ "before:size-full",
2952
+ "before:absolute before:box-border before:select-none before:content-['']",
2953
+ borders && cn(
2954
+ ((_a2 = borders.bottom) == null ? void 0 : _a2.size) && "before:border-b before:border-b-border",
2955
+ ((_b2 = borders.right) == null ? void 0 : _b2.size) && "before:border-r before:border-r-border",
2956
+ ((_c = borders.left) == null ? void 0 : _c.size) && "before:border-l before:border-l-border",
2957
+ ((_d = borders.top) == null ? void 0 : _d.size) && "before:border-t before:border-t-border"
2958
+ )
2959
+ ),
2960
+ style: { "--cellBackground": element.background },
2961
+ attributes: __spreadProps(__spreadValues({}, props.attributes), {
2962
+ colSpan: api.table.getColSpan(element),
2963
+ rowSpan: api.table.getRowSpan(element)
2964
+ }),
2965
+ children: /* @__PURE__ */ jsx42("div", { className: "relative z-20 box-border h-full px-4 py-2", style: { minHeight }, children: props.children })
2966
+ })
2967
+ );
2968
+ }
2969
+ function TableCellHeaderElementStatic(props) {
2970
+ return /* @__PURE__ */ jsx42(TableCellElementStatic, __spreadProps(__spreadValues({}, props), { isHeader: true }));
2971
+ }
2972
+
2973
+ // src/components/editor/plugins/table-base-kit.tsx
2974
+ var BaseTableKit = [
2975
+ BaseTablePlugin2.withComponent(TableElementStatic),
2976
+ BaseTableRowPlugin.withComponent(TableRowElementStatic),
2977
+ BaseTableCellPlugin.withComponent(TableCellElementStatic),
2978
+ BaseTableCellHeaderPlugin.withComponent(TableCellHeaderElementStatic)
2979
+ ];
2980
+
2981
+ // src/components/editor/plugins/toc-base-kit.tsx
2982
+ import { BaseTocPlugin as BaseTocPlugin2 } from "@platejs/toc";
2983
+
2984
+ // src/ui/toc-node-static.tsx
2985
+ import { BaseTocPlugin, isHeading } from "@platejs/toc";
2986
+ import { cva as cva7 } from "class-variance-authority";
2987
+ import { KEYS as KEYS6, NodeApi as NodeApi7 } from "platejs";
2988
+ import { SlateElement as SlateElement19 } from "platejs/static";
2989
+ import { jsx as jsx43, jsxs as jsxs22 } from "react/jsx-runtime";
2990
+ var headingItemVariants = cva7(
2991
+ "block h-auto w-full cursor-pointer truncate rounded-none px-0.5 py-1.5 text-left font-medium text-muted-foreground underline decoration-[0.5px] underline-offset-4 hover:bg-accent hover:text-muted-foreground",
2992
+ {
2993
+ variants: {
2994
+ depth: {
2995
+ 1: "pl-0.5",
2996
+ 2: "pl-6.5",
2997
+ 3: "pl-12.5"
2998
+ }
2999
+ }
3000
+ }
3001
+ );
3002
+ function TocElementStatic(props) {
3003
+ const { editor } = props;
3004
+ const headingList = getHeadingList(editor);
3005
+ return /* @__PURE__ */ jsxs22(SlateElement19, __spreadProps(__spreadValues({}, props), { className: "mb-1 p-0", children: [
3006
+ /* @__PURE__ */ jsx43("div", { children: headingList.length > 0 ? headingList.map((item) => /* @__PURE__ */ jsx43(Button, { className: headingItemVariants({ depth: item.depth }), variant: "ghost", children: item.title }, item.title)) : /* @__PURE__ */ jsx43("div", { className: "text-gray-500 text-sm", children: "Create a heading to display the table of contents." }) }),
3007
+ props.children
3008
+ ] }));
3009
+ }
3010
+ var headingLevels = {
3011
+ [KEYS6.h1]: 1,
3012
+ [KEYS6.h2]: 2,
3013
+ [KEYS6.h3]: 3,
3014
+ [KEYS6.h4]: 4,
3015
+ [KEYS6.h5]: 5,
3016
+ [KEYS6.h6]: 6
3017
+ };
3018
+ var getHeadingList = (editor) => {
3019
+ if (!editor) return [];
3020
+ const options2 = editor.getOptions(BaseTocPlugin);
3021
+ if (options2.queryHeading) {
3022
+ return options2.queryHeading(editor);
3023
+ }
3024
+ const headingList = [];
3025
+ const values = editor.api.nodes({
3026
+ at: [],
3027
+ match: (n) => isHeading(n)
3028
+ });
3029
+ if (!values) return [];
3030
+ for (const [node, path] of values) {
3031
+ const { type } = node;
3032
+ const title = NodeApi7.string(node);
3033
+ const depth = headingLevels[type];
3034
+ const id = node.id;
3035
+ if (title) {
3036
+ headingList.push({ id, depth, path, title, type });
3037
+ }
3038
+ }
3039
+ return headingList;
3040
+ };
3041
+
3042
+ // src/components/editor/plugins/toc-base-kit.tsx
3043
+ var BaseTocKit = [BaseTocPlugin2.withComponent(TocElementStatic)];
3044
+
3045
+ // src/components/editor/plugins/toggle-base-kit.tsx
3046
+ import { BaseTogglePlugin } from "@platejs/toggle";
3047
+
3048
+ // src/ui/toggle-node-static.tsx
3049
+ import { ChevronDownIcon as ChevronDownIcon2 } from "lucide-react";
3050
+ import { SlateElement as SlateElement20 } from "platejs/static";
3051
+ import * as React7 from "react";
3052
+ import { jsx as jsx44, jsxs as jsxs23 } from "react/jsx-runtime";
3053
+ function ToggleElementStatic(props) {
3054
+ var _a;
3055
+ const element = props.element;
3056
+ const [open, setOpen] = React7.useState((_a = element.defaultOpen) != null ? _a : true);
3057
+ const isExpandable = element.variant === "expandable";
3058
+ const hasTitle = element.title && element.title.trim().length > 0;
3059
+ if (isExpandable) {
3060
+ return /* @__PURE__ */ jsx44(SlateElement20, __spreadProps(__spreadValues({}, props), { className: "my-2", children: /* @__PURE__ */ jsxs23("div", { className: "overflow-hidden rounded-lg border border-border", children: [
3061
+ /* @__PURE__ */ jsxs23(
3062
+ "button",
3063
+ {
3064
+ type: "button",
3065
+ className: "flex w-full cursor-pointer select-none items-center gap-2 px-4 py-3 text-left",
3066
+ onClick: () => setOpen(!open),
3067
+ children: [
3068
+ /* @__PURE__ */ jsx44(
3069
+ ChevronDownIcon2,
3070
+ {
3071
+ className: cn(
3072
+ "size-4 shrink-0 text-muted-foreground transition-transform duration-200",
3073
+ open ? "rotate-0" : "-rotate-90"
3074
+ )
3075
+ }
3076
+ ),
3077
+ /* @__PURE__ */ jsx44("span", { className: "font-semibold text-foreground", children: hasTitle ? element.title : "Expandable" })
3078
+ ]
3079
+ }
3080
+ ),
3081
+ /* @__PURE__ */ jsx44("div", { className: cn("border-t border-border px-4 py-3 pl-10", !open && "hidden"), children: props.children })
3082
+ ] }) }));
3083
+ }
3084
+ return /* @__PURE__ */ jsx44(SlateElement20, __spreadProps(__spreadValues({}, props), { className: "py-2", children: /* @__PURE__ */ jsxs23("div", { children: [
3085
+ /* @__PURE__ */ jsxs23(
3086
+ "button",
3087
+ {
3088
+ type: "button",
3089
+ className: "flex w-full cursor-pointer select-none items-center gap-2 text-left",
3090
+ onClick: () => setOpen(!open),
3091
+ children: [
3092
+ /* @__PURE__ */ jsx44(
3093
+ ChevronDownIcon2,
3094
+ {
3095
+ className: cn(
3096
+ "size-4 shrink-0 text-muted-foreground transition-transform duration-200",
3097
+ open ? "rotate-0" : "-rotate-90"
3098
+ )
3099
+ }
3100
+ ),
3101
+ /* @__PURE__ */ jsx44("span", { className: "font-semibold text-foreground", children: hasTitle ? element.title : "Untitled" })
3102
+ ]
3103
+ }
3104
+ ),
3105
+ /* @__PURE__ */ jsx44("div", { className: cn("pl-6", !open && "hidden"), children: props.children })
3106
+ ] }) }));
3107
+ }
3108
+
3109
+ // src/components/editor/plugins/toggle-base-kit.tsx
3110
+ var BaseToggleKit = [BaseTogglePlugin.withComponent(ToggleElementStatic)];
3111
+
3112
+ // src/components/editor/editor-base-kit.tsx
3113
+ var BaseEditorKit = [
3114
+ ...BaseBasicBlocksKit,
3115
+ ...BaseCodeBlockKit,
3116
+ ...BaseTabbedCodeBlockKit,
3117
+ ...BaseTableKit,
3118
+ ...BaseToggleKit,
3119
+ ...BaseTocKit,
3120
+ ...BaseMediaKit,
3121
+ ...BaseCalloutKit,
3122
+ ...BaseColumnKit,
3123
+ ...BaseMathKit,
3124
+ ...BaseDateKit,
3125
+ ...BaseLinkKit,
3126
+ ...BaseMentionKit,
3127
+ ...BaseBasicMarksKit,
3128
+ ...BaseFontKit,
3129
+ ...BaseListKit,
3130
+ ...BaseCommentKit,
3131
+ ...BaseSuggestionKit,
3132
+ ...MarkdownKit
3133
+ ];
3134
+ export {
3135
+ BaseEditorKit
3136
+ };