@payloadcms/richtext-lexical 4.0.0-internal.011fd46 → 4.0.0-internal.016994f

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 (501) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/cell/rscEntry.d.ts.map +1 -1
  3. package/dist/cell/rscEntry.js +5 -5
  4. package/dist/cell/rscEntry.js.map +1 -1
  5. package/dist/exports/client/Field-F22V5L4V.js +2 -0
  6. package/dist/exports/client/Field-F22V5L4V.js.map +7 -0
  7. package/dist/exports/client/bundled.css +1 -1
  8. package/dist/exports/client/chunk-43E5QYAA.js +2 -0
  9. package/dist/exports/client/chunk-43E5QYAA.js.map +7 -0
  10. package/dist/exports/client/{chunk-CUFJGFNW.js → chunk-ESITTE3C.js} +2 -2
  11. package/dist/exports/client/{chunk-CUFJGFNW.js.map → chunk-ESITTE3C.js.map} +2 -2
  12. package/dist/exports/client/chunk-LN6VX25I.js +2 -0
  13. package/dist/exports/client/chunk-LN6VX25I.js.map +7 -0
  14. package/dist/exports/client/component-D5QLYS7W.js +2 -0
  15. package/dist/exports/client/component-D5QLYS7W.js.map +7 -0
  16. package/dist/exports/client/componentInline-H24N7GUG.js +2 -0
  17. package/dist/exports/client/index.d.ts +1 -2
  18. package/dist/exports/client/index.d.ts.map +1 -1
  19. package/dist/exports/client/index.js +27 -30
  20. package/dist/exports/client/index.js.map +4 -4
  21. package/dist/features/align/client/toolbarAlignGroup.d.ts.map +1 -1
  22. package/dist/features/blockquote/client/index.js +2 -2
  23. package/dist/features/blockquote/client/index.js.map +1 -1
  24. package/dist/features/blockquote/server/index.js +2 -2
  25. package/dist/features/blockquote/server/index.js.map +1 -1
  26. package/dist/features/blocks/client/component/index.css +2 -2
  27. package/dist/features/blocks/client/component/index.js.map +1 -1
  28. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.d.ts.map +1 -1
  29. package/dist/features/blocks/client/componentInline/index.css +8 -8
  30. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  31. package/dist/features/blocks/client/getBlockImageComponent.d.ts +1 -1
  32. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts +1 -1
  33. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts.map +1 -1
  34. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js +5 -2
  35. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js.map +1 -1
  36. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts.map +1 -1
  37. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  38. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
  39. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.css +1 -1
  40. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.css +2 -4
  41. package/dist/features/blocks/premade/CodeBlock/Component/index.css +5 -5
  42. package/dist/features/blocks/server/graphQLPopulationPromise.d.ts.map +1 -1
  43. package/dist/features/blocks/server/index.js +2 -2
  44. package/dist/features/blocks/server/index.js.map +1 -1
  45. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts.map +1 -1
  46. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  47. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  48. package/dist/features/blocks/server/schema.d.ts.map +1 -1
  49. package/dist/features/blocks/server/schema.js +3 -2
  50. package/dist/features/blocks/server/schema.js.map +1 -1
  51. package/dist/features/blocks/server/validate.d.ts.map +1 -1
  52. package/dist/features/converters/htmlToLexical/index.d.ts.map +1 -1
  53. package/dist/features/converters/lexicalToHtml/shared/cssColors.d.ts.map +1 -1
  54. package/dist/features/converters/lexicalToMarkdown/index.d.ts.map +1 -1
  55. package/dist/features/converters/markdownToLexical/index.d.ts.map +1 -1
  56. package/dist/features/converters/markdownToLexical/index.js +5 -2
  57. package/dist/features/converters/markdownToLexical/index.js.map +1 -1
  58. package/dist/features/debug/jsxConverter/client/plugin/style.css +2 -2
  59. package/dist/features/debug/testRecorder/client/plugin/index.css +0 -1
  60. package/dist/features/format/bold/feature.client.js +1 -1
  61. package/dist/features/format/bold/feature.client.js.map +1 -1
  62. package/dist/features/format/bold/feature.server.d.ts.map +1 -1
  63. package/dist/features/format/bold/feature.server.js +1 -1
  64. package/dist/features/format/bold/feature.server.js.map +1 -1
  65. package/dist/features/format/inlineCode/feature.client.js +1 -1
  66. package/dist/features/format/inlineCode/feature.client.js.map +1 -1
  67. package/dist/features/format/inlineCode/feature.server.d.ts.map +1 -1
  68. package/dist/features/format/inlineCode/feature.server.js +1 -1
  69. package/dist/features/format/inlineCode/feature.server.js.map +1 -1
  70. package/dist/features/format/italic/feature.client.js +1 -1
  71. package/dist/features/format/italic/feature.client.js.map +1 -1
  72. package/dist/features/format/italic/feature.server.d.ts.map +1 -1
  73. package/dist/features/format/italic/feature.server.js +1 -1
  74. package/dist/features/format/italic/feature.server.js.map +1 -1
  75. package/dist/features/format/shared/toolbarFormatGroup.d.ts.map +1 -1
  76. package/dist/features/format/strikethrough/feature.client.js +1 -1
  77. package/dist/features/format/strikethrough/feature.client.js.map +1 -1
  78. package/dist/features/format/strikethrough/feature.server.d.ts.map +1 -1
  79. package/dist/features/format/strikethrough/feature.server.js +1 -1
  80. package/dist/features/format/strikethrough/feature.server.js.map +1 -1
  81. package/dist/features/heading/client/index.js +2 -2
  82. package/dist/features/heading/client/index.js.map +1 -1
  83. package/dist/features/heading/markdownTransformer.d.ts +1 -1
  84. package/dist/features/heading/markdownTransformer.d.ts.map +1 -1
  85. package/dist/features/heading/markdownTransformer.js +6 -19
  86. package/dist/features/heading/markdownTransformer.js.map +1 -1
  87. package/dist/features/heading/server/index.js +2 -2
  88. package/dist/features/heading/server/index.js.map +1 -1
  89. package/dist/features/heading/server/schema.d.ts.map +1 -1
  90. package/dist/features/horizontalRule/client/index.js +2 -2
  91. package/dist/features/horizontalRule/client/index.js.map +1 -1
  92. package/dist/features/horizontalRule/client/markdownTransformer.d.ts +1 -1
  93. package/dist/features/horizontalRule/client/markdownTransformer.d.ts.map +1 -1
  94. package/dist/features/horizontalRule/client/markdownTransformer.js +1 -1
  95. package/dist/features/horizontalRule/client/markdownTransformer.js.map +1 -1
  96. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts +1 -1
  97. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  98. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js +1 -1
  99. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  100. package/dist/features/horizontalRule/client/plugin/index.css +2 -2
  101. package/dist/features/horizontalRule/server/index.js +2 -2
  102. package/dist/features/horizontalRule/server/index.js.map +1 -1
  103. package/dist/features/horizontalRule/server/markdownTransformer.d.ts +1 -1
  104. package/dist/features/horizontalRule/server/markdownTransformer.d.ts.map +1 -1
  105. package/dist/features/horizontalRule/server/markdownTransformer.js +1 -1
  106. package/dist/features/horizontalRule/server/markdownTransformer.js.map +1 -1
  107. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +1 -1
  108. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  109. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js +1 -1
  110. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  111. package/dist/features/indent/client/toolbarIndentGroup.d.ts.map +1 -1
  112. package/dist/features/link/client/index.js +2 -2
  113. package/dist/features/link/client/index.js.map +1 -1
  114. package/dist/features/link/client/plugins/autoLink/index.d.ts.map +1 -1
  115. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +3 -3
  116. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  117. package/dist/features/link/client/plugins/floatingLinkEditor/index.css +7 -12
  118. package/dist/features/link/markdownTransformer.d.ts +3 -3
  119. package/dist/features/link/markdownTransformer.d.ts.map +1 -1
  120. package/dist/features/link/markdownTransformer.js +2 -2
  121. package/dist/features/link/markdownTransformer.js.map +1 -1
  122. package/dist/features/link/markdownTransformer.spec.js +9 -9
  123. package/dist/features/link/markdownTransformer.spec.js.map +1 -1
  124. package/dist/features/link/nodes/AutoLinkNode.d.ts +1 -1
  125. package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  126. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  127. package/dist/features/link/nodes/LinkNode.d.ts +1 -1
  128. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  129. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  130. package/dist/features/link/server/baseFields.d.ts.map +1 -1
  131. package/dist/features/link/server/baseFields.js.map +1 -1
  132. package/dist/features/link/server/graphQLPopulationPromise.d.ts.map +1 -1
  133. package/dist/features/link/server/index.js +4 -4
  134. package/dist/features/link/server/index.js.map +1 -1
  135. package/dist/features/link/server/schema.d.ts.map +1 -1
  136. package/dist/features/link/server/schema.js +4 -2
  137. package/dist/features/link/server/schema.js.map +1 -1
  138. package/dist/features/link/server/validate.d.ts.map +1 -1
  139. package/dist/features/lists/checklist/client/index.js +1 -1
  140. package/dist/features/lists/checklist/client/index.js.map +1 -1
  141. package/dist/features/lists/checklist/server/index.js +1 -1
  142. package/dist/features/lists/checklist/server/index.js.map +1 -1
  143. package/dist/features/lists/orderedList/client/index.js +1 -1
  144. package/dist/features/lists/orderedList/client/index.js.map +1 -1
  145. package/dist/features/lists/orderedList/server/index.js +1 -1
  146. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  147. package/dist/features/lists/unorderedList/client/index.js +1 -1
  148. package/dist/features/lists/unorderedList/client/index.js.map +1 -1
  149. package/dist/features/lists/unorderedList/server/index.js +1 -1
  150. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  151. package/dist/features/relationship/client/drawer/index.d.ts.map +1 -1
  152. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  153. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  154. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  155. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  156. package/dist/features/relationship/server/schema.d.ts +3 -3
  157. package/dist/features/relationship/server/schema.d.ts.map +1 -1
  158. package/dist/features/relationship/server/schema.js +22 -5
  159. package/dist/features/relationship/server/schema.js.map +1 -1
  160. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -1
  161. package/dist/features/shared/toolbar/addDropdownGroup.d.ts.map +1 -1
  162. package/dist/features/shared/toolbar/featureButtonsGroup.d.ts.map +1 -1
  163. package/dist/features/shared/toolbar/textDropdownGroup.d.ts.map +1 -1
  164. package/dist/features/table/client/index.d.ts.map +1 -0
  165. package/dist/features/{experimental_table → table}/client/index.js +2 -2
  166. package/dist/features/table/client/index.js.map +1 -0
  167. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -0
  168. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js.map +1 -0
  169. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.d.ts.map +1 -0
  170. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js.map +1 -0
  171. package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -0
  172. package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -0
  173. package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.d.ts.map +1 -0
  174. package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.js.map +1 -0
  175. package/dist/features/table/client/plugins/TablePlugin/index.d.ts.map +1 -0
  176. package/dist/features/table/client/plugins/TablePlugin/index.js.map +1 -0
  177. package/dist/features/table/client/utils/debounce.d.ts.map +1 -0
  178. package/dist/features/table/client/utils/debounce.js.map +1 -0
  179. package/dist/features/table/client/utils/useDebounce.d.ts.map +1 -0
  180. package/dist/features/table/client/utils/useDebounce.js.map +1 -0
  181. package/dist/features/table/markdownTransformer.d.ts +5 -0
  182. package/dist/features/table/markdownTransformer.d.ts.map +1 -0
  183. package/dist/features/{experimental_table → table}/markdownTransformer.js +6 -3
  184. package/dist/features/table/markdownTransformer.js.map +1 -0
  185. package/dist/features/table/server/index.d.ts +3 -0
  186. package/dist/features/table/server/index.d.ts.map +1 -0
  187. package/dist/features/{experimental_table → table}/server/index.js +6 -6
  188. package/dist/features/table/server/index.js.map +1 -0
  189. package/dist/features/table/server/schema.d.ts.map +1 -0
  190. package/dist/features/table/server/schema.js.map +1 -0
  191. package/dist/features/textState/feature.client.js +1 -1
  192. package/dist/features/textState/feature.client.js.map +1 -1
  193. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts +8 -0
  194. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts.map +1 -0
  195. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js +80 -0
  196. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js.map +1 -0
  197. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.spec.js +65 -0
  198. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.spec.js.map +1 -0
  199. package/dist/features/toolbars/fixed/client/Toolbar/index.css +80 -8
  200. package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
  201. package/dist/features/toolbars/fixed/client/Toolbar/index.js +4 -1
  202. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  203. package/dist/features/toolbars/inline/client/Toolbar/index.css +2 -14
  204. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  205. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +8 -14
  206. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
  207. package/dist/features/typesServer.d.ts +2 -2
  208. package/dist/features/typesServer.d.ts.map +1 -1
  209. package/dist/features/typesServer.js.map +1 -1
  210. package/dist/features/upload/client/component/index.css +9 -9
  211. package/dist/features/upload/client/component/index.js +2 -1
  212. package/dist/features/upload/client/component/index.js.map +1 -1
  213. package/dist/features/upload/client/drawer/index.d.ts.map +1 -1
  214. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  215. package/dist/features/upload/client/plugin/index.js +5 -5
  216. package/dist/features/upload/client/plugin/index.js.map +1 -1
  217. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  218. package/dist/features/upload/server/index.js +4 -4
  219. package/dist/features/upload/server/index.js.map +1 -1
  220. package/dist/features/upload/server/markdownTransformer.d.ts +1 -1
  221. package/dist/features/upload/server/markdownTransformer.d.ts.map +1 -1
  222. package/dist/features/upload/server/markdownTransformer.js +1 -1
  223. package/dist/features/upload/server/markdownTransformer.js.map +1 -1
  224. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  225. package/dist/features/upload/server/schema.d.ts +4 -4
  226. package/dist/features/upload/server/schema.d.ts.map +1 -1
  227. package/dist/features/upload/server/schema.js +26 -6
  228. package/dist/features/upload/server/schema.js.map +1 -1
  229. package/dist/features/upload/server/validate.d.ts.map +1 -1
  230. package/dist/field/Diff/converters/unknown/index.css +1 -1
  231. package/dist/field/Field.d.ts.map +1 -1
  232. package/dist/field/Field.js +18 -15
  233. package/dist/field/Field.js.map +1 -1
  234. package/dist/field/ViewSelector.css +1 -1
  235. package/dist/field/bundled.css +1 -1
  236. package/dist/field/index.css +12 -15
  237. package/dist/field/index.js +1 -1
  238. package/dist/field/index.js.map +1 -1
  239. package/dist/field/rscEntry.d.ts.map +1 -1
  240. package/dist/field/rscEntry.js +2 -0
  241. package/dist/field/rscEntry.js.map +1 -1
  242. package/dist/i18n.d.ts.map +1 -1
  243. package/dist/i18n.js +68 -0
  244. package/dist/i18n.js.map +1 -1
  245. package/dist/index.d.ts +3 -3
  246. package/dist/index.d.ts.map +1 -1
  247. package/dist/index.js +7 -7
  248. package/dist/index.js.map +1 -1
  249. package/dist/lexical/LexicalEditor.css +18 -18
  250. package/dist/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
  251. package/dist/lexical/config/client/loader.d.ts.map +1 -1
  252. package/dist/lexical/config/client/loader.js +5 -1
  253. package/dist/lexical/config/client/loader.js.map +1 -1
  254. package/dist/lexical/config/client/sanitize.d.ts.map +1 -1
  255. package/dist/lexical/config/server/loader.d.ts +1 -1
  256. package/dist/lexical/config/server/loader.d.ts.map +1 -1
  257. package/dist/lexical/config/server/loader.js +2 -2
  258. package/dist/lexical/config/server/loader.js.map +1 -1
  259. package/dist/lexical/config/server/sanitize.d.ts +1 -1
  260. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  261. package/dist/lexical/config/server/sanitize.js +2 -2
  262. package/dist/lexical/config/server/sanitize.js.map +1 -1
  263. package/dist/lexical/plugins/DecoratorPlugin/index.css +1 -1
  264. package/dist/lexical/plugins/InsertParagraphAtEnd/index.css +16 -24
  265. package/dist/lexical/plugins/InsertParagraphAtEnd/index.d.ts.map +1 -1
  266. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +27 -14
  267. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
  268. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts.map +1 -1
  269. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js +21 -0
  270. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js.map +1 -1
  271. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts +0 -1
  272. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
  273. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +1 -20
  274. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  275. package/dist/lexical/plugins/SlashMenu/index.css +1 -6
  276. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.css +1 -1
  277. package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.d.ts.map +1 -1
  278. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.css +4 -3
  279. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +1 -1
  280. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  281. package/dist/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.d.ts.map +1 -1
  282. package/dist/lexical/theme/EditorTheme.css +18 -19
  283. package/dist/lexical/ui/ContentEditable.css +22 -17
  284. package/dist/lexical/utils/markdown/convertFromMarkdownString.d.ts +17 -0
  285. package/dist/lexical/utils/markdown/convertFromMarkdownString.d.ts.map +1 -0
  286. package/dist/lexical/utils/markdown/convertFromMarkdownString.js +27 -0
  287. package/dist/lexical/utils/markdown/convertFromMarkdownString.js.map +1 -0
  288. package/dist/{lexical-proxy/@lexical-markdown.spec.js → lexical/utils/markdown/convertFromMarkdownString.spec.js} +8 -9
  289. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js.map +1 -0
  290. package/dist/lexical/utils/markdown/createBlockNode.d.ts +1 -1
  291. package/dist/lexical/utils/markdown/createBlockNode.d.ts.map +1 -1
  292. package/dist/lexical/utils/markdown/normalizeMarkdown.d.ts +7 -10
  293. package/dist/lexical/utils/markdown/normalizeMarkdown.d.ts.map +1 -1
  294. package/dist/lexical/utils/markdown/normalizeMarkdown.js +9 -13
  295. package/dist/lexical/utils/markdown/normalizeMarkdown.js.map +1 -1
  296. package/dist/lexical/utils/nodeFormat.d.ts.map +1 -1
  297. package/dist/lexical/utils/point.d.ts.map +1 -1
  298. package/dist/lexical/utils/rect.d.ts.map +1 -1
  299. package/dist/lexical-proxy/@lexical-markdown.d.ts +1 -40
  300. package/dist/lexical-proxy/@lexical-markdown.d.ts.map +1 -1
  301. package/dist/lexical-proxy/@lexical-markdown.js +1 -56
  302. package/dist/lexical-proxy/@lexical-markdown.js.map +1 -1
  303. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.d.ts +2 -0
  304. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.d.ts.map +1 -0
  305. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.js +2 -0
  306. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.js.map +1 -0
  307. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.d.ts +2 -0
  308. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.d.ts.map +1 -0
  309. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.js +2 -0
  310. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.js.map +1 -0
  311. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.d.ts +2 -0
  312. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.d.ts.map +1 -0
  313. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.js +2 -0
  314. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.js.map +1 -0
  315. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.d.ts +2 -0
  316. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.d.ts.map +1 -0
  317. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.js +2 -0
  318. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.js.map +1 -0
  319. package/dist/lexical-proxy/@lexical-react/ReactExtension.d.ts +2 -0
  320. package/dist/lexical-proxy/@lexical-react/ReactExtension.d.ts.map +1 -0
  321. package/dist/lexical-proxy/@lexical-react/ReactExtension.js +2 -0
  322. package/dist/lexical-proxy/@lexical-react/ReactExtension.js.map +1 -0
  323. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.d.ts +2 -0
  324. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.d.ts.map +1 -0
  325. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.js +2 -0
  326. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.js.map +1 -0
  327. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.d.ts +2 -0
  328. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.d.ts.map +1 -0
  329. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.js +2 -0
  330. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.js.map +1 -0
  331. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.d.ts +2 -0
  332. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.d.ts.map +1 -0
  333. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.js +2 -0
  334. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.js.map +1 -0
  335. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.d.ts +2 -0
  336. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.d.ts.map +1 -0
  337. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.js +2 -0
  338. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.js.map +1 -0
  339. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.d.ts +2 -0
  340. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.d.ts.map +1 -0
  341. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.js +2 -0
  342. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.js.map +1 -0
  343. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.d.ts +2 -0
  344. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.d.ts.map +1 -0
  345. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.js +2 -0
  346. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.js.map +1 -0
  347. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.d.ts +2 -0
  348. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.d.ts.map +1 -0
  349. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.js +2 -0
  350. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.js.map +1 -0
  351. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.d.ts +2 -0
  352. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.d.ts.map +1 -0
  353. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.js +2 -0
  354. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.js.map +1 -0
  355. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.d.ts +2 -0
  356. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.d.ts.map +1 -0
  357. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.js +2 -0
  358. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.js.map +1 -0
  359. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.d.ts +2 -0
  360. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.d.ts.map +1 -0
  361. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.js +2 -0
  362. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.js.map +1 -0
  363. package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts.map +1 -1
  364. package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.d.ts.map +1 -1
  365. package/dist/types/index.d.ts +3 -3
  366. package/dist/types/index.d.ts.map +1 -1
  367. package/dist/types/index.js.map +1 -1
  368. package/dist/types/jsonSchemaHelpers.d.ts.map +1 -1
  369. package/dist/types/nodeTypes.d.ts +1 -1
  370. package/dist/types/nodeTypes.d.ts.map +1 -1
  371. package/dist/types/nodeTypes.js.map +1 -1
  372. package/dist/types/schema.d.ts.map +1 -1
  373. package/dist/types/schema.js +12 -5
  374. package/dist/types/schema.js.map +1 -1
  375. package/dist/utilities/applyBaseFilterToFields.d.ts.map +1 -1
  376. package/dist/utilities/applyBaseFilterToFields.js.map +1 -1
  377. package/dist/utilities/buildInitialState.d.ts +2 -1
  378. package/dist/utilities/buildInitialState.d.ts.map +1 -1
  379. package/dist/utilities/buildInitialState.js.map +1 -1
  380. package/dist/utilities/createServerFeature.d.ts +1 -1
  381. package/dist/utilities/createServerFeature.d.ts.map +1 -1
  382. package/dist/utilities/createServerFeature.js +2 -2
  383. package/dist/utilities/createServerFeature.js.map +1 -1
  384. package/dist/utilities/editorConfigFactory.d.ts +6 -6
  385. package/dist/utilities/editorConfigFactory.d.ts.map +1 -1
  386. package/dist/utilities/editorConfigFactory.js +9 -9
  387. package/dist/utilities/editorConfigFactory.js.map +1 -1
  388. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts +1 -1
  389. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts.map +1 -1
  390. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.d.ts.map +1 -1
  391. package/dist/utilities/fieldsDrawer/useLexicalDrawer.d.ts.map +1 -1
  392. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.d.ts.map +1 -1
  393. package/dist/utilities/generateImportMap.d.ts +1 -1
  394. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  395. package/dist/utilities/generateSchemaMap.d.ts +1 -1
  396. package/dist/utilities/generateSchemaMap.d.ts.map +1 -1
  397. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts +2 -2
  398. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts.map +1 -1
  399. package/dist/utilities/getDefaultSanitizedEditorConfig.js +6 -17
  400. package/dist/utilities/getDefaultSanitizedEditorConfig.js.map +1 -1
  401. package/dist/utilities/recurseNodeTree.d.ts.map +1 -1
  402. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts.map +1 -1
  403. package/dist/utilities/useLexicalFeature.d.ts.map +1 -1
  404. package/dist/validate/index.d.ts.map +1 -1
  405. package/package.json +96 -23
  406. package/dist/exports/client/Field-VQX3RNMF.js +0 -2
  407. package/dist/exports/client/Field-VQX3RNMF.js.map +0 -7
  408. package/dist/exports/client/chunk-UD4DQ4AK.js +0 -2
  409. package/dist/exports/client/chunk-UD4DQ4AK.js.map +0 -7
  410. package/dist/exports/client/chunk-X3D4LZS7.js +0 -2
  411. package/dist/exports/client/chunk-X3D4LZS7.js.map +0 -7
  412. package/dist/exports/client/component-PHZQBOJE.js +0 -2
  413. package/dist/exports/client/component-PHZQBOJE.js.map +0 -7
  414. package/dist/exports/client/componentInline-DV4EGOWU.js +0 -2
  415. package/dist/features/blockquote/markdownTransformer.d.ts +0 -3
  416. package/dist/features/blockquote/markdownTransformer.d.ts.map +0 -1
  417. package/dist/features/blockquote/markdownTransformer.js +0 -33
  418. package/dist/features/blockquote/markdownTransformer.js.map +0 -1
  419. package/dist/features/experimental_table/client/index.d.ts.map +0 -1
  420. package/dist/features/experimental_table/client/index.js.map +0 -1
  421. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.d.ts.map +0 -1
  422. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +0 -1
  423. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.d.ts.map +0 -1
  424. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +0 -1
  425. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +0 -1
  426. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +0 -1
  427. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.d.ts.map +0 -1
  428. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.js.map +0 -1
  429. package/dist/features/experimental_table/client/plugins/TablePlugin/index.d.ts.map +0 -1
  430. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +0 -1
  431. package/dist/features/experimental_table/client/utils/debounce.d.ts.map +0 -1
  432. package/dist/features/experimental_table/client/utils/debounce.js.map +0 -1
  433. package/dist/features/experimental_table/client/utils/useDebounce.d.ts.map +0 -1
  434. package/dist/features/experimental_table/client/utils/useDebounce.js.map +0 -1
  435. package/dist/features/experimental_table/markdownTransformer.d.ts +0 -5
  436. package/dist/features/experimental_table/markdownTransformer.d.ts.map +0 -1
  437. package/dist/features/experimental_table/markdownTransformer.js.map +0 -1
  438. package/dist/features/experimental_table/server/index.d.ts +0 -3
  439. package/dist/features/experimental_table/server/index.d.ts.map +0 -1
  440. package/dist/features/experimental_table/server/index.js.map +0 -1
  441. package/dist/features/experimental_table/server/schema.d.ts.map +0 -1
  442. package/dist/features/experimental_table/server/schema.js.map +0 -1
  443. package/dist/features/format/bold/markdownTransformers.d.ts +0 -6
  444. package/dist/features/format/bold/markdownTransformers.d.ts.map +0 -1
  445. package/dist/features/format/bold/markdownTransformers.js +0 -23
  446. package/dist/features/format/bold/markdownTransformers.js.map +0 -1
  447. package/dist/features/format/inlineCode/markdownTransformers.d.ts +0 -3
  448. package/dist/features/format/inlineCode/markdownTransformers.d.ts.map +0 -1
  449. package/dist/features/format/inlineCode/markdownTransformers.js +0 -6
  450. package/dist/features/format/inlineCode/markdownTransformers.js.map +0 -1
  451. package/dist/features/format/italic/markdownTransformers.d.ts +0 -4
  452. package/dist/features/format/italic/markdownTransformers.d.ts.map +0 -1
  453. package/dist/features/format/italic/markdownTransformers.js +0 -12
  454. package/dist/features/format/italic/markdownTransformers.js.map +0 -1
  455. package/dist/features/format/strikethrough/markdownTransformers.d.ts +0 -3
  456. package/dist/features/format/strikethrough/markdownTransformers.d.ts.map +0 -1
  457. package/dist/features/format/strikethrough/markdownTransformers.js +0 -6
  458. package/dist/features/format/strikethrough/markdownTransformers.js.map +0 -1
  459. package/dist/features/lists/checklist/markdownTransformers.d.ts +0 -3
  460. package/dist/features/lists/checklist/markdownTransformers.d.ts.map +0 -1
  461. package/dist/features/lists/checklist/markdownTransformers.js +0 -12
  462. package/dist/features/lists/checklist/markdownTransformers.js.map +0 -1
  463. package/dist/features/lists/orderedList/markdownTransformer.d.ts +0 -3
  464. package/dist/features/lists/orderedList/markdownTransformer.d.ts.map +0 -1
  465. package/dist/features/lists/orderedList/markdownTransformer.js +0 -12
  466. package/dist/features/lists/orderedList/markdownTransformer.js.map +0 -1
  467. package/dist/features/lists/shared/markdown.d.ts +0 -6
  468. package/dist/features/lists/shared/markdown.d.ts.map +0 -1
  469. package/dist/features/lists/shared/markdown.js +0 -57
  470. package/dist/features/lists/shared/markdown.js.map +0 -1
  471. package/dist/features/lists/unorderedList/markdownTransformer.d.ts +0 -3
  472. package/dist/features/lists/unorderedList/markdownTransformer.d.ts.map +0 -1
  473. package/dist/features/lists/unorderedList/markdownTransformer.js +0 -12
  474. package/dist/features/lists/unorderedList/markdownTransformer.js.map +0 -1
  475. package/dist/lexical/utils/guard.d.ts +0 -5
  476. package/dist/lexical/utils/guard.d.ts.map +0 -1
  477. package/dist/lexical/utils/guard.js +0 -9
  478. package/dist/lexical/utils/guard.js.map +0 -1
  479. package/dist/lexical-proxy/@lexical-markdown.spec.js.map +0 -1
  480. /package/dist/exports/client/{componentInline-DV4EGOWU.js.map → componentInline-H24N7GUG.js.map} +0 -0
  481. /package/dist/features/{experimental_table → table}/client/index.d.ts +0 -0
  482. /package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.css +0 -0
  483. /package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.d.ts +0 -0
  484. /package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.js +0 -0
  485. /package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.css +0 -0
  486. /package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.d.ts +0 -0
  487. /package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.js +0 -0
  488. /package/dist/features/{experimental_table → table}/client/plugins/TableHoverActionsPlugin/index.d.ts +0 -0
  489. /package/dist/features/{experimental_table → table}/client/plugins/TableHoverActionsPlugin/index.js +0 -0
  490. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.css +0 -0
  491. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.d.ts +0 -0
  492. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.js +0 -0
  493. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.css +0 -0
  494. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.d.ts +0 -0
  495. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.js +0 -0
  496. /package/dist/features/{experimental_table → table}/client/utils/debounce.d.ts +0 -0
  497. /package/dist/features/{experimental_table → table}/client/utils/debounce.js +0 -0
  498. /package/dist/features/{experimental_table → table}/client/utils/useDebounce.d.ts +0 -0
  499. /package/dist/features/{experimental_table → table}/client/utils/useDebounce.js +0 -0
  500. /package/dist/features/{experimental_table → table}/server/schema.d.ts +0 -0
  501. /package/dist/features/{experimental_table → table}/server/schema.js +0 -0
@@ -1,28 +1,26 @@
1
- "use client";import{a as be,c as bt,d as kt,e as _t}from"./chunk-CUFJGFNW.js";import{a as Qe}from"./chunk-DBWINSQN.js";import{a as Bo,b as et}from"./chunk-UD4DQ4AK.js";import{a as br,b as kr,c as Oe}from"./chunk-5VIL27GI.js";import{a as hu}from"./chunk-WSAPGI3Z.js";import{a as se,b as _r,c as Po,d as jo,e as gu,f as xu,h as Cu,j as bu,m as ku}from"./chunk-X3D4LZS7.js";import{a as fu,b as G}from"./chunk-RJ5MAOKZ.js";function X(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{c as Su}from"react/compiler-runtime";import{useLexicalComposerContext as Nu}from"@lexical/react/LexicalComposerContext";import{$isDecoratorBlockNode as ke}from"@lexical/react/LexicalDecoratorBlockNode";import{$findMatchingParent as Lu}from"@lexical/utils";import{$getSelection as Ru,$isElementNode as me,$isNodeSelection as yu,$isRangeSelection as Tt,COMMAND_PRIORITY_LOW as vu,FORMAT_ELEMENT_COMMAND as Et}from"lexical";import{useEffect as Iu}from"react";import{jsx as Tr}from"react/jsx-runtime";import"react";var _u="M5 7.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m3 4a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5M7.5 15a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1z",Er=({className:t})=>Tr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Tr("path",{clipRule:"evenodd",d:_u,fill:"currentColor",fillRule:"evenodd"})});import{jsx as wr}from"react/jsx-runtime";import"react";var Tu="M5 7.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m0 4a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1z",Sr=({className:t})=>wr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:wr("path",{clipRule:"evenodd",d:Tu,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Nr}from"react/jsx-runtime";import"react";var Eu="M5 7.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m0 4a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1z",Wt=({className:t})=>Nr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Nr("path",{clipRule:"evenodd",d:Eu,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Lr}from"react/jsx-runtime";import"react";var wu="M19 7.5a.5.5 0 0 0-.5-.5h-13a.5.5 0 0 0 0 1h13a.5.5 0 0 0 .5-.5m0 4a.5.5 0 0 0-.5-.5h-7a.5.5 0 0 0 0 1h7a.5.5 0 0 0 .5-.5m-.5 3.5a.5.5 0 0 1 0 1h-9a.5.5 0 0 1 0-1z",Rr=({className:t})=>Lr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Lr("path",{clipRule:"evenodd",d:wu,fill:"currentColor",fillRule:"evenodd"})});var A=t=>o=>{let n={clientFeatureProps:o};if(typeof t=="function")n.feature=({config:r,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:u,resolvedFeatures:c,schemaPath:d,unSanitizedEditorConfig:a})=>{let m=t({config:r,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:u,props:o,resolvedFeatures:c,schemaPath:d,unSanitizedEditorConfig:a});return m.sanitizedClientFeatureProps===null&&(m.sanitizedClientFeatureProps=o),m};else{let r={...t};r.sanitizedClientFeatureProps=o,n.feature=r}return n};var yr=t=>({type:"dropdown",ChildComponent:Wt,iconOnly:!0,items:t,key:"align",order:30});var Ie=t=>me(t)?t.getFormatType():t.__format,vr=[yr([{ChildComponent:Wt,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if((me(e)||ke(e))&&Ie(e)==="left")continue;let o=e.getParent();if(!((me(o)||ke(o))&&Ie(o)==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"left")},order:1},{ChildComponent:Er,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if((me(e)||ke(e))&&Ie(e)==="center")continue;let o=e.getParent();if(!((me(o)||ke(o))&&Ie(o)==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"center")},order:2},{ChildComponent:Rr,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if((me(e)||ke(e))&&Ie(e)==="right")continue;let o=e.getParent();if(!((me(o)||ke(o))&&Ie(o)==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"right")},order:3},{ChildComponent:Sr,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if((me(e)||ke(e))&&Ie(e)==="justify")continue;let o=e.getParent();if(!((me(o)||ke(o))&&Ie(o)==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"justify")},order:4}])],Mu=()=>{let t=Su(3),[e]=Nu(),o,n;return t[0]!==e?(o=()=>e.registerCommand(Et,$u,vu),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Iu(o,n),null},Au=A({plugins:[{Component:Mu,position:"normal"}],toolbarFixed:{groups:vr},toolbarInline:{groups:vr}});function Du(t){return(me(t)||ke(t))&&!t.isInline()}function $u(t){let e=Ru();if(!Tt(e)&&!yu(e))return!1;let o=e.getNodes();for(let n of o){let r=Lu(n,Du);r!==null&&r.setFormat(t)}return!0}import{$createQuoteNode as Fr,$isQuoteNode as $r,QuoteNode as ju}from"@lexical/rich-text";import{$setBlocksType as Br}from"@lexical/selection";import{$getSelection as Pr,$isRangeSelection as Hu}from"lexical";import{jsx as Ir}from"react/jsx-runtime";import"react";var Ou="M13.5353 10.5725C13.5353 9.47709 11.0456 9.99991 11.0456 7.85883C11.0456 6.46464 12.1162 5.61816 13.361 5.61816C14.805 5.61816 16 6.86298 16 8.92937C16 11.2945 14.4564 13.7841 11.1203 14.3816L10.8216 13.1368C12.888 12.4895 13.5353 11.4937 13.5353 10.5725ZM6.71369 10.5725C6.71369 9.47709 4.22407 9.99991 4.22407 7.85883C4.22407 6.46464 5.29461 5.61816 6.53942 5.61816C7.9834 5.61816 9.17842 6.86298 9.17842 8.92937C9.17842 11.2945 7.63485 13.7841 4.29876 14.3816L4 13.1368C6.06639 12.4895 6.71369 11.4937 6.71369 10.5725Z",Ho=({className:t})=>Ir("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ir("path",{d:Ou,fill:"currentColor"})});import{jsx as Mr}from"react/jsx-runtime";import"react";var Fu={16:"M3 3.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 .5.5V5a.5.5 0 0 1-1 0V4H8.5v8h1a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1h1V4H4v1a.5.5 0 0 1-1 0z",24:"M6 6.5a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 .5.5V9a.5.5 0 0 1-1 0V7h-4.5v10h2a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1h2V7H7v2a.5.5 0 0 1-1 0z"},wt=({className:t,size:e=24})=>Mr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Mr("path",{clipRule:"evenodd",d:Fu[e],fill:"currentColor",fillRule:"evenodd"})});var te=t=>({type:"dropdown",ChildComponent:wt,items:t,key:"text",order:25});import{$createQuoteNode as Bu,$isQuoteNode as Ar,QuoteNode as Pu}from"@lexical/rich-text";var Dr={type:"element",dependencies:[Pu],export:(t,e)=>{if(!Ar(t))return null;let o=e(t).split(`
2
- `),n=[];for(let r of o)n.push("> "+r);return n.join(`
3
- `)},regExp:/^>\s/,replace:(t,e,o,n)=>{if(n){let l=t.getPreviousSibling();if(Ar(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let r=Bu();r.append(...e),t.replace(r),r.select(0,0)}};var Or=[te([{ChildComponent:Ho,isActive:({selection:t})=>{if(!Hu(t))return!1;for(let e of t.getNodes())if(!$r(e)&&!$r(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Pr();Br(e,()=>Fr())})},order:20}])],Uu=A({markdownTransformers:[Dr],nodes:[ju],slashMenu:{groups:[X([{Icon:Ho,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Pr();Br(e,()=>Fr())})}}])]},toolbarFixed:{groups:Or},toolbarInline:{groups:Or}});import{getTranslation as eo}from"@payloadcms/translations";import{jsx as jr}from"react/jsx-runtime";import"react";var Gu="M10.5 7C11.3284 7 12 7.67157 12 8.5V11.5C12 11.7329 11.9453 11.9527 11.8506 12.1494C12.0473 12.0547 12.2671 12 12.5 12H15.5C16.3284 12 17 12.6716 17 13.5V16.5C17 17.3284 16.3284 18 15.5 18H12.5C12.1151 18 11.7655 17.8535 11.5 17.6152C11.2345 17.8535 10.8849 18 10.5 18H7.5C6.67157 18 6 17.3284 6 16.5V13.5C6 13.1154 6.14578 12.7655 6.38379 12.5C6.14578 12.2345 6 11.8846 6 11.5V8.5C6 7.67157 6.67157 7 7.5 7H10.5ZM12.5 13C12.2239 13 12 13.2239 12 13.5V16.5C12 16.7761 12.2239 17 12.5 17H15.5C15.7761 17 16 16.7761 16 16.5V13.5C16 13.2239 15.7761 13 15.5 13H12.5ZM7.5 13C7.22386 13 7 13.2239 7 13.5V16.5C7 16.7761 7.22386 17 7.5 17H10.5C10.7761 17 11 16.7761 11 16.5V13.5C11 13.2239 10.7761 13 10.5 13H7.5ZM7.5 8C7.22386 8 7 8.22386 7 8.5V11.5C7 11.7761 7.22386 12 7.5 12H10.5C10.7761 12 11 11.7761 11 11.5V8.5C11 8.22386 10.7761 8 10.5 8H7.5ZM17.5 5C18.3284 5 19 5.67157 19 6.5V9.5C19 10.3284 18.3284 11 17.5 11H14.5C13.6716 11 13 10.3284 13 9.5V6.5C13 5.67157 13.6716 5 14.5 5H17.5ZM14.5 6C14.2239 6 14 6.22386 14 6.5V9.5C14 9.77614 14.2239 10 14.5 10H17.5C17.7761 10 18 9.77614 18 9.5V6.5C18 6.22386 17.7761 6 17.5 6H14.5Z",Uo=({className:t})=>jr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:jr("path",{d:Gu,fill:"currentColor"})});import{jsx as Hr}from"react/jsx-runtime";import"react";var Vu="M17 8C18.1046 8 19 8.89543 19 10V14L18.9893 14.2041C18.8938 15.1457 18.1457 15.8938 17.2041 15.9893L17 16H7L6.7959 15.9893C5.78722 15.887 5 15.0357 5 14V10C5 8.89543 5.89543 8 7 8H17ZM7 9C6.44772 9 6 9.44772 6 10V14C6 14.5523 6.44772 15 7 15H17C17.5523 15 18 14.5523 18 14V10C18 9.44772 17.5523 9 17 9H7ZM9 11C9.55228 11 10 11.4477 10 12C10 12.5523 9.55228 13 9 13C8.44772 13 8 12.5523 8 12C8 11.4477 8.44772 11 9 11ZM12 11C12.5523 11 13 11.4477 13 12C13 12.5523 12.5523 13 12 13C11.4477 13 11 12.5523 11 12C11 11.4477 11.4477 11 12 11ZM15 11C15.5523 11 16 11.4477 16 12C16 12.5523 15.5523 13 15 13C14.4477 13 14 12.5523 14 12C14 11.4477 14.4477 11 15 11Z",Go=({className:t})=>Hr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Hr("path",{clipRule:"evenodd",d:Vu,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Wu}from"react/jsx-runtime";import"react";function Ur(t,e){let{admin:o,imageAltText:n,imageURL:r}=t,l=o?.images,s,i;if(l?.icon?(s=typeof l.icon=="string"?l.icon:l.icon.url,i=typeof l.icon=="string"?void 0:l.icon.alt):l?.thumbnail?(s=typeof l.thumbnail=="string"?l.thumbnail:l.thumbnail.url,i=typeof l.thumbnail=="string"?void 0:l.thumbnail.alt):(s=r,i=n),!s)return e;let u=i??"Block Image";return()=>Wu("img",{alt:u,className:"lexical-block-custom-image",src:s,style:{maxHeight:20,maxWidth:20}})}import{$parseSerializedNode as al}from"lexical";import{JSOX as Vo}from"jsox";function zt({propsString:t}){let e={},o="",n=!0;for(let r=0;r<t.length;r++){let l=t[r];if(n)l==="="||l===" "?o&&(l===" "?(e[o]=!0,o=""):n=!1):o+=l;else{let s=zu(t,r);e[o]=s.value,r=s.newIndex,o="",n=!0}}return o&&(e[o]=!0),e}function zu(t,e){let o=t[e];return o==='"'?Gr(t,e):o==="'"?Gr(t,e,!0):o==="{"?Ju(t,e):o==="["?Ku(t,e):Zu(t,e)}function Ku(t,e){let o=1,n="",r=e+1;for(;r<t.length&&o>0;)t[r]==="["?o++:t[r]==="]"&&o--,o>0&&(n+=t[r]),r++;return{newIndex:r,value:Vo.parse(`[${n}]`)}}function Gr(t,e,o=!1){let n="",r=e+1;for(;r<t.length&&(t[r]!==(o?"'":'"')||t[r-1]==="\\");)n+=t[r],r++;return{newIndex:r,value:n}}function Ju(t,e){let o=1,n="",r=e+1;for(;r<t.length&&o>0;)t[r]==="{"?o++:t[r]==="}"&&o--,o>0&&(n+=t[r]),r++;return{newIndex:r,value:Xu(n)}}function Xu(t){return t[0]!=="{"?Vo.parse(t):Vo.parse(t.replace(/(\w+):/g,'"$1":'))}function Zu(t,e){let o="",n=e;for(;n<t.length&&t[n]!==" ";)o+=t[n],n++;return{newIndex:n-1,value:o}}function St({props:t}){let e=[];for(let[o,n]of Object.entries(t))typeof n=="string"?e.push(`${o}="${Yu(n)}"`):typeof n=="number"?e.push(`${o}={${n}}`):typeof n=="boolean"?n&&e.push(`${o}`):n!==null&&typeof n=="object"&&(Array.isArray(n)?e.push(`${o}={[${n.map(r=>JSON.stringify(r,Vr)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(n,Vr)}}`));return e.join(" ")}function Yu(t){return t.replace(/"/g,"&quot;")}function Vr(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function Kt({isEndOptional:t,lines:e,regexpEndRegex:o,startLineIndex:n,startMatch:r,trimChildren:l}){let s="",i="",u=e.slice(n),c=!1,d=0,a=0,m=null,p=!1,h=0,f=u[0].slice(0,r.index),g=0,_=n;e:for(let[v,b]of u.entries()){let x=l?b.trim():b,C=0;if(l)for(let T=0;T<b.length&&b[T]===" ";T++)C++;let k=0;for(v===0&&(k=(r.index??0)+r[0].length-C);k<x.length;){let T=x[k],I=x[k+1];if(c){if(T==="`"&&h++,h%2===0)if(T==="<"&&I==="/"){if(d--,d<0){i[i.length-1]===`
4
- `&&(i=i.slice(0,-1)),_=v;for(let N=k;N<x.length;N++)if(x[N]===">"){g=N+1;break}break e}}else if(T==="/"&&I===">"){if(d--,d<0){i[i.length-1]===`
5
- `&&(i=i.slice(0,-1)),_=v,g=k+2;break e}}else T==="<"&&I!=="/"&&d++;i+=T}else{if(T==="{"&&!m?a++:T==="}"&&!m?a--:(T==='"'||T==="'")&&!m?m=T:T===m&&(m=null),T==="/"&&I===">"&&a===0&&!m){p=!0,_=v,g=k+2;break e}else if(T===">"&&a===0&&!m){c=!0,k++;continue}s+=T}k++}if(c?i?.length>0&&v>0&&(i+=`
1
+ "use client";import{a as Ce,c as xt,d as bt,e as kt}from"./chunk-ESITTE3C.js";import{a as Ye}from"./chunk-DBWINSQN.js";import{a as $o,b as qe,c as Qe,d as Re,e as et}from"./chunk-43E5QYAA.js";import{a as fr,b as pr,c as De}from"./chunk-5VIL27GI.js";import{a as Gc}from"./chunk-WSAPGI3Z.js";import{a as se,b as hr,c as gr,d as Do,e as Oo,f as Uc,g as zc,i as Vc,k as Wc,n as Kc}from"./chunk-LN6VX25I.js";import{a as Hc,b as U}from"./chunk-RJ5MAOKZ.js";function J(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{c as qc}from"react/compiler-runtime";import{useLexicalComposerContext as Qc}from"@lexical/react/LexicalComposerContext";import{$isDecoratorBlockNode as xe}from"@lexical/react/LexicalDecoratorBlockNode";import{$findMatchingParent as eu}from"@lexical/utils";import{$getSelection as tu,$isElementNode as me,$isNodeSelection as ou,$isRangeSelection as _t,COMMAND_PRIORITY_LOW as nu,FORMAT_ELEMENT_COMMAND as Tt}from"lexical";import{useEffect as ru}from"react";import{jsx as Cr}from"react/jsx-runtime";import"react";var Xc="M5 7.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m3 4a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5M7.5 15a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1z",xr=({className:t})=>Cr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Cr("path",{clipRule:"evenodd",d:Xc,fill:"currentColor",fillRule:"evenodd"})});import{jsx as br}from"react/jsx-runtime";import"react";var Jc="M5 7.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m0 4a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1z",kr=({className:t})=>br("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:br("path",{clipRule:"evenodd",d:Jc,fill:"currentColor",fillRule:"evenodd"})});import{jsx as _r}from"react/jsx-runtime";import"react";var Zc="M5 7.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m0 4a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1z",Ut=({className:t})=>_r("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:_r("path",{clipRule:"evenodd",d:Zc,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Tr}from"react/jsx-runtime";import"react";var Yc="M19 7.5a.5.5 0 0 0-.5-.5h-13a.5.5 0 0 0 0 1h13a.5.5 0 0 0 .5-.5m0 4a.5.5 0 0 0-.5-.5h-7a.5.5 0 0 0 0 1h7a.5.5 0 0 0 .5-.5m-.5 3.5a.5.5 0 0 1 0 1h-9a.5.5 0 0 1 0-1z",wr=({className:t})=>Tr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Tr("path",{clipRule:"evenodd",d:Yc,fill:"currentColor",fillRule:"evenodd"})});var A=t=>o=>{let n={clientFeatureProps:o};if(typeof t=="function")n.feature=({config:r,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:u,resolvedFeatures:d,schemaPath:c,unSanitizedEditorConfig:a})=>{let m=t({config:r,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:u,props:o,resolvedFeatures:d,schemaPath:c,unSanitizedEditorConfig:a});return m.sanitizedClientFeatureProps===null&&(m.sanitizedClientFeatureProps=o),m};else{let r={...t};r.sanitizedClientFeatureProps=o,n.feature=r}return n};var Er=t=>({type:"dropdown",ChildComponent:Ut,iconOnly:!0,items:t,key:"align",order:30});var ve=t=>me(t)?t.getFormatType():t.__format,Sr=[Er([{ChildComponent:Ut,isActive:({selection:t})=>{if(!_t(t))return!1;for(let e of t.getNodes()){if((me(e)||xe(e))&&ve(e)==="left")continue;let o=e.getParent();if(!((me(o)||xe(o))&&ve(o)==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Tt,"left")},order:1},{ChildComponent:xr,isActive:({selection:t})=>{if(!_t(t))return!1;for(let e of t.getNodes()){if((me(e)||xe(e))&&ve(e)==="center")continue;let o=e.getParent();if(!((me(o)||xe(o))&&ve(o)==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Tt,"center")},order:2},{ChildComponent:wr,isActive:({selection:t})=>{if(!_t(t))return!1;for(let e of t.getNodes()){if((me(e)||xe(e))&&ve(e)==="right")continue;let o=e.getParent();if(!((me(o)||xe(o))&&ve(o)==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Tt,"right")},order:3},{ChildComponent:kr,isActive:({selection:t})=>{if(!_t(t))return!1;for(let e of t.getNodes()){if((me(e)||xe(e))&&ve(e)==="justify")continue;let o=e.getParent();if(!((me(o)||xe(o))&&ve(o)==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Tt,"justify")},order:4}])],lu=()=>{let t=qc(3),[e]=Qc(),o,n;return t[0]!==e?(o=()=>e.registerCommand(Tt,au,nu),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),ru(o,n),null},iu=A({plugins:[{Component:lu,position:"normal"}],toolbarFixed:{groups:Sr},toolbarInline:{groups:Sr}});function su(t){return(me(t)||xe(t))&&!t.isInline()}function au(t){let e=tu();if(!_t(e)&&!ou(e))return!1;let o=e.getNodes();for(let n of o){let r=eu(n,su);r!==null&&r.setFormat(t)}return!0}import{QUOTE as du}from"@lexical/markdown";import{$createQuoteNode as vr,$isQuoteNode as yr,QuoteNode as mu}from"@lexical/rich-text";import{$setBlocksType as Ir}from"@lexical/selection";import{$getSelection as Mr,$isRangeSelection as fu}from"lexical";import{jsx as Nr}from"react/jsx-runtime";import"react";var cu="M13.5353 10.5725C13.5353 9.47709 11.0456 9.99991 11.0456 7.85883C11.0456 6.46464 12.1162 5.61816 13.361 5.61816C14.805 5.61816 16 6.86298 16 8.92937C16 11.2945 14.4564 13.7841 11.1203 14.3816L10.8216 13.1368C12.888 12.4895 13.5353 11.4937 13.5353 10.5725ZM6.71369 10.5725C6.71369 9.47709 4.22407 9.99991 4.22407 7.85883C4.22407 6.46464 5.29461 5.61816 6.53942 5.61816C7.9834 5.61816 9.17842 6.86298 9.17842 8.92937C9.17842 11.2945 7.63485 13.7841 4.29876 14.3816L4 13.1368C6.06639 12.4895 6.71369 11.4937 6.71369 10.5725Z",Fo=({className:t})=>Nr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Nr("path",{d:cu,fill:"currentColor"})});import{jsx as Lr}from"react/jsx-runtime";import"react";var uu={16:"M3 3.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 .5.5V5a.5.5 0 0 1-1 0V4H8.5v8h1a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1h1V4H4v1a.5.5 0 0 1-1 0z",24:"M6 6.5a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 .5.5V9a.5.5 0 0 1-1 0V7h-4.5v10h2a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1h2V7H7v2a.5.5 0 0 1-1 0z"},wt=({className:t,size:e=24})=>Lr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Lr("path",{clipRule:"evenodd",d:uu[e],fill:"currentColor",fillRule:"evenodd"})});var te=t=>({type:"dropdown",ChildComponent:wt,items:t,key:"text",order:25});var Rr=[te([{ChildComponent:Fo,isActive:({selection:t})=>{if(!fu(t))return!1;for(let e of t.getNodes())if(!yr(e)&&!yr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Mr();Ir(e,()=>vr())})},order:20}])],pu=A({markdownTransformers:[du],nodes:[mu],slashMenu:{groups:[J([{Icon:Fo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Mr();Ir(e,()=>vr())})}}])]},toolbarFixed:{groups:Rr},toolbarInline:{groups:Rr}});import{getTranslation as qt}from"@payloadcms/translations";import{jsx as Ar}from"react/jsx-runtime";import"react";var hu="M10.5 7C11.3284 7 12 7.67157 12 8.5V11.5C12 11.7329 11.9453 11.9527 11.8506 12.1494C12.0473 12.0547 12.2671 12 12.5 12H15.5C16.3284 12 17 12.6716 17 13.5V16.5C17 17.3284 16.3284 18 15.5 18H12.5C12.1151 18 11.7655 17.8535 11.5 17.6152C11.2345 17.8535 10.8849 18 10.5 18H7.5C6.67157 18 6 17.3284 6 16.5V13.5C6 13.1154 6.14578 12.7655 6.38379 12.5C6.14578 12.2345 6 11.8846 6 11.5V8.5C6 7.67157 6.67157 7 7.5 7H10.5ZM12.5 13C12.2239 13 12 13.2239 12 13.5V16.5C12 16.7761 12.2239 17 12.5 17H15.5C15.7761 17 16 16.7761 16 16.5V13.5C16 13.2239 15.7761 13 15.5 13H12.5ZM7.5 13C7.22386 13 7 13.2239 7 13.5V16.5C7 16.7761 7.22386 17 7.5 17H10.5C10.7761 17 11 16.7761 11 16.5V13.5C11 13.2239 10.7761 13 10.5 13H7.5ZM7.5 8C7.22386 8 7 8.22386 7 8.5V11.5C7 11.7761 7.22386 12 7.5 12H10.5C10.7761 12 11 11.7761 11 11.5V8.5C11 8.22386 10.7761 8 10.5 8H7.5ZM17.5 5C18.3284 5 19 5.67157 19 6.5V9.5C19 10.3284 18.3284 11 17.5 11H14.5C13.6716 11 13 10.3284 13 9.5V6.5C13 5.67157 13.6716 5 14.5 5H17.5ZM14.5 6C14.2239 6 14 6.22386 14 6.5V9.5C14 9.77614 14.2239 10 14.5 10H17.5C17.7761 10 18 9.77614 18 9.5V6.5C18 6.22386 17.7761 6 17.5 6H14.5Z",Po=({className:t})=>Ar("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ar("path",{d:hu,fill:"currentColor"})});import{jsx as $r}from"react/jsx-runtime";import"react";var gu="M17 8C18.1046 8 19 8.89543 19 10V14L18.9893 14.2041C18.8938 15.1457 18.1457 15.8938 17.2041 15.9893L17 16H7L6.7959 15.9893C5.78722 15.887 5 15.0357 5 14V10C5 8.89543 5.89543 8 7 8H17ZM7 9C6.44772 9 6 9.44772 6 10V14C6 14.5523 6.44772 15 7 15H17C17.5523 15 18 14.5523 18 14V10C18 9.44772 17.5523 9 17 9H7ZM9 11C9.55228 11 10 11.4477 10 12C10 12.5523 9.55228 13 9 13C8.44772 13 8 12.5523 8 12C8 11.4477 8.44772 11 9 11ZM12 11C12.5523 11 13 11.4477 13 12C13 12.5523 12.5523 13 12 13C11.4477 13 11 12.5523 11 12C11 11.4477 11.4477 11 12 11ZM15 11C15.5523 11 16 11.4477 16 12C16 12.5523 15.5523 13 15 13C14.4477 13 14 12.5523 14 12C14 11.4477 14.4477 11 15 11Z",Bo=({className:t})=>$r("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:$r("path",{clipRule:"evenodd",d:gu,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Cu}from"react/jsx-runtime";import"react";function Dr(t,e){let{admin:o,imageAltText:n,imageURL:r}=t,l=o?.images,s,i;if(l?.icon?(s=typeof l.icon=="string"?l.icon:l.icon.url,i=typeof l.icon=="string"?void 0:l.icon.alt):l?.thumbnail?(s=typeof l.thumbnail=="string"?l.thumbnail:l.thumbnail.url,i=typeof l.thumbnail=="string"?void 0:l.thumbnail.alt):(s=r,i=n),!s)return e;let u=i??"Block Image";return()=>Cu("img",{alt:u,className:"lexical-block-custom-image",src:s,style:{maxHeight:20,maxWidth:20}})}import{$parseSerializedNode as Qr}from"lexical";import{JSOX as jo}from"jsox";function zt({propsString:t}){let e={},o="",n=!0;for(let r=0;r<t.length;r++){let l=t[r];if(n)l==="="||l===" "?o&&(l===" "?(e[o]=!0,o=""):n=!1):o+=l;else{let s=xu(t,r);e[o]=s.value,r=s.newIndex,o="",n=!0}}return o&&(e[o]=!0),e}function xu(t,e){let o=t[e];return o==='"'?Or(t,e):o==="'"?Or(t,e,!0):o==="{"?ku(t,e):o==="["?bu(t,e):Tu(t,e)}function bu(t,e){let o=1,n="",r=e+1;for(;r<t.length&&o>0;)t[r]==="["?o++:t[r]==="]"&&o--,o>0&&(n+=t[r]),r++;return{newIndex:r,value:jo.parse(`[${n}]`)}}function Or(t,e,o=!1){let n="",r=e+1;for(;r<t.length&&(t[r]!==(o?"'":'"')||t[r-1]==="\\");)n+=t[r],r++;return{newIndex:r,value:n}}function ku(t,e){let o=1,n="",r=e+1;for(;r<t.length&&o>0;)t[r]==="{"?o++:t[r]==="}"&&o--,o>0&&(n+=t[r]),r++;return{newIndex:r,value:_u(n)}}function _u(t){return t[0]!=="{"?jo.parse(t):jo.parse(t.replace(/(\w+):/g,'"$1":'))}function Tu(t,e){let o="",n=e;for(;n<t.length&&t[n]!==" ";)o+=t[n],n++;return{newIndex:n-1,value:o}}function Et({props:t}){let e=[];for(let[o,n]of Object.entries(t))typeof n=="string"?e.push(`${o}="${wu(n)}"`):typeof n=="number"?e.push(`${o}={${n}}`):typeof n=="boolean"?n&&e.push(`${o}`):n!==null&&typeof n=="object"&&(Array.isArray(n)?e.push(`${o}={[${n.map(r=>JSON.stringify(r,Fr)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(n,Fr)}}`));return e.join(" ")}function wu(t){return t.replace(/"/g,"&quot;")}function Fr(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function Vt({isEndOptional:t,lines:e,regexpEndRegex:o,startLineIndex:n,startMatch:r,trimChildren:l}){let s="",i="",u=e.slice(n),d=!1,c=0,a=0,m=null,f=!1,h=0,p=u[0].slice(0,r.index),g=0,_=n;e:for(let[v,b]of u.entries()){let C=l?b.trim():b,x=0;if(l)for(let T=0;T<b.length&&b[T]===" ";T++)x++;let k=0;for(v===0&&(k=(r.index??0)+r[0].length-x);k<C.length;){let T=C[k],I=C[k+1];if(d){if(T==="`"&&h++,h%2===0)if(T==="<"&&I==="/"){if(c--,c<0){i[i.length-1]===`
2
+ `&&(i=i.slice(0,-1)),_=v;for(let N=k;N<C.length;N++)if(C[N]===">"){g=N+1;break}break e}}else if(T==="/"&&I===">"){if(c--,c<0){i[i.length-1]===`
3
+ `&&(i=i.slice(0,-1)),_=v,g=k+2;break e}}else T==="<"&&I!=="/"&&c++;i+=T}else{if(T==="{"&&!m?a++:T==="}"&&!m?a--:(T==='"'||T==="'")&&!m?m=T:T===m&&(m=null),T==="/"&&I===">"&&a===0&&!m){f=!0,_=v,g=k+2;break e}else if(T===">"&&a===0&&!m){d=!0,k++;continue}s+=T}k++}if(d?i?.length>0&&v>0&&(i+=`
6
4
  `):s+=`
7
- `,o&&d<0){let T=x.match(o);if(T?.index!==void 0){_=v,g=T.index+T[0].length-1;break}}if(v===u.length-1&&!t&&!p)throw new Error("End match not found for lines "+e.join(`
5
+ `,o&&c<0){let T=C.match(o);if(T?.index!==void 0){_=v,g=T.index+T[0].length-1;break}}if(v===u.length-1&&!t&&!f)throw new Error("End match not found for lines "+e.join(`
8
6
  `)+`
9
7
 
10
- . Start match: `+JSON.stringify(r))}return{afterEndLine:u[_].trim().slice(g),beforeStartLine:f,content:i,endLineIndex:n+_,endlineLastCharIndex:g,propsString:s}}import{jsx as Ad}from"react/jsx-runtime";import Dd from"bson-objectid";import{$applyNodeReplacement as $d}from"lexical";import"react";import{DecoratorBlockNode as qu}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as Qu}from"@lexical/utils";import ed from"bson-objectid";import{$applyNodeReplacement as td}from"lexical";var Nt=class extends qu{__cacheBuster;__fields;constructor({cacheBuster:e,fields:o,format:n,key:r}){super(n,r),this.__fields=o,this.__cacheBuster=e||0}static clone(e){return new this({cacheBuster:e.__cacheBuster,fields:e.__fields,format:e.__format,key:e.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=od(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return Qu(o,e?.theme?.block),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div"),o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),type:"block",fields:this.getFields(),version:2}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e,o){let n=this.getWritable();n.__fields=e,o||n.__cacheBuster++}};function od(t){return td(new Nt({fields:{...t,id:t?.id||new ed.default().toHexString()}}))}import{jsx as V,jsxs as Lt}from"react/jsx-runtime";import{useLexicalComposerContext as ud}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as dd}from"@lexical/react/useLexicalEditable";import{getTranslation as md}from"@payloadcms/translations";import{Button as Jr,Collapsible as pd,Drawer as fd,EditDepthProvider as hd,ErrorPill as gd,Form as xd,formatDrawerSlug as Cd,MoreIcon as bd,Pill as kd,Popup as _d,PopupList as Wo,RenderFields as Td,SectionTitle as Ed,useConfig as wd,useDocumentForm as Sd,useDocumentInfo as Xr,useEditDepth as Nd,useFormSubmitted as Ld,useServerFunctions as Rd,useTranslation as yd,XIcon as vd}from"@payloadcms/ui";import{abortAndIgnore as zo}from"@payloadcms/ui/shared";import{$getNodeByKey as Xt,$getRoot as Id,SKIP_DOM_SELECTION_TAG as Ko}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as Zt,reduceFieldsToValues as Zr}from"payload/shared";import Fe,{useCallback as Jo,useEffect as Yt,useMemo as Be,useRef as Xo}from"react";import{v4 as Md}from"uuid";import{c as nd}from"react/compiler-runtime";import{jsx as Jt,jsxs as rd}from"react/jsx-runtime";import{useLexicalEditable as ld}from"@lexical/react/useLexicalEditable";import{RenderFields as id,useFormSubmitted as sd}from"@payloadcms/ui";import ad,{createContext as cd}from"react";var Wr=cd({baseClass:"LexicalEditorTheme__block",BlockCollapsible:()=>null,BlockDrawer:()=>null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),ae=()=>ad.use(Wr),zr=t=>{let e=nd(4),{Collapsible:o,CustomBlock:n,CustomLabel:r,...l}=t,{BlockDrawer:s,errorCount:i,formSchema:u}=l,d=sd()&&i>0,a=ld(),m;e[0]!==o||e[1]!==i||e[2]!==d?(m=f=>{let{children:g,..._}=f;return Jt(o,{errorCount:i,fieldHasErrors:d,..._,children:g})},e[0]=o,e[1]=i,e[2]=d,e[3]=m):m=e[3];let p=m,h={...l,BlockCollapsible:p};return n?rd(Wr,{value:h,children:[n,Jt(s,{})]}):Jt(p,{children:Jt(id,{fields:u,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!a})})};function Kr({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var Yr=t=>{let{cacheBuster:e,className:o,CustomBlock:n,CustomLabel:r,formData:l,nodeKey:s}=t,i=Ld(),{id:u,collectionSlug:c,globalSlug:d}=Xr(),{fieldProps:{featureClientSchemaMap:a,field:m,initialLexicalFormState:p,schemaPath:h},uuid:f}=G(),{fields:g}=Sd(),_=Xo(new AbortController),L=Nd(),[v,b]=Fe.useState(0),{config:x}=wd(),C=Cd({slug:`lexical-blocks-create-${f}-${l.id}`,depth:L}),{toggleDrawer:k}=Oe(C),{getDocPreferences:T,setDocFieldPreferences:I}=Xr(),[N]=ud(),w=dd(),S=l.blockType,{getFormState:E}=Rd(),y=`${h}.lexical_internal_feature.blocks.lexical_blocks.${S}.fields`,[R,M]=Fe.useState(()=>{let P=p?.[l.id]?.formState;if(!P)return!1;let q=Object.fromEntries(Object.entries(P).map(([U,W])=>[U,U in l?{...W,initialValue:l[U],value:l[U]}:W]));return q.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName},q}),D=Xo(!1),$=Xo(e);Yt(()=>{D.current?($.current!==e&&M(!1),$.current=e):D.current=!0},[e]);let[F]=Fe.useState(()=>Md()),[B,Y]=Fe.useState(()=>{if(!r)return R?._components?.customComponents?.BlockLabel??void 0}),[J,Xe]=Fe.useState(()=>{if(!n)return R?._components?.customComponents?.Block??void 0}),ve=Be(()=>n?V(n,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ae}):J,[n,o,l,s,J]),xe=Be(()=>r?V(r,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ae}):B,[r,o,l,s,B]);Yt(()=>{let P=new AbortController;return l&&!R&&(async()=>{let{state:U}=await E({id:u,collectionSlug:c,data:l,docPermissions:{fields:!0},docPreferences:await T(),documentFormState:Zt(g,{excludeFiles:!0}),globalSlug:d,initialBlockData:l,operation:"update",readOnly:!w,renderAllFields:!0,schemaPath:y,signal:P.signal});if(U){U.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName};let W=Zr(Zt(U,{excludeFiles:!0}),!0);N.update(()=>{let z=Xt(s);if(z&&Me(z)){let ie=W;ie.blockType=S,z.setFields(ie,!0)}},{tag:Ko}),M(U),r||Y(U._components?.customComponents?.BlockLabel??void 0),n||Xe(U._components?.customComponents?.Block??void 0)}})(),()=>{zo(P)}},[E,y,w,u,r,n,l,N,s,R,c,d,T,g,S]);let[le,Ce]=Fe.useState(p?.[l.id]?.collapsed??!1),Gt=`${h}.lexical_internal_feature.blocks.lexical_blocks.${S}`,gt=a.blocks?.[Gt]?.[0]?.blocks?.[0],ee=typeof gt=="string"?x.blocksMap[gt]:gt,{i18n:xt,t:de}=yd(),$o=Jo(async({formState:P,submit:q})=>{zo(_.current);let U=new AbortController;_.current=U;let{state:W}=await E({id:u,collectionSlug:c,docPermissions:{fields:!0},docPreferences:await T(),documentFormState:Zt(g,{excludeFiles:!0}),formState:P,globalSlug:d,initialBlockFormState:P,operation:"update",readOnly:!w,renderAllFields:!!q,schemaPath:y,signal:U.signal});if(!W)return P;P.blockName&&(W.blockName=P.blockName);let z=Zr(Kr({fields:Zt(W,{excludeFiles:!0})}),!0);if(setTimeout(()=>{N.update(()=>{let ie=Xt(s);if(ie&&Me(ie)){let qe=z;qe.blockType=S,ie.setFields(qe,!0)}},{tag:Ko})},0),q){r||Y(W._components?.customComponents?.BlockLabel??void 0),n||Xe(W._components?.customComponents?.Block??void 0);let ie=0;for(let qe of Object.values(W))qe?.valid===!1&&ie++;b(ie)}return W},[E,u,c,T,d,y,S,g,w,N,s,n,r]);Yt(()=>()=>{zo(_.current)},[]);let Vt=Jo(()=>{N.update(()=>{Xt(s)?.remove()})},[N,s]),[cr,cu]=Fe.useState(0);Yt(()=>{let P=()=>{N.getEditorState().read(()=>{let U=Id().getChildren(),W=0;for(let z of U)if(Me(z)){if(z.getKey()===s){cu(W);return}W++}})};return P(),N.registerUpdateListener(()=>{P()})},[N,s]);let Ye=ee?.labels?.singular?md(ee.labels.singular,xt):ee?.slug,ur=Jo(P=>{T().then(q=>{let W=q?.fields?.[m.name]?.collapsed,z=W&&W?.length?W:[];P?z.includes(l.id)||z.push(l.id):z.includes(l.id)&&z.splice(z.indexOf(l.id),1),I(m.name,{collapsed:z,hello:"hi"})})},[T,m.name,I,l.id]),dr=Be(()=>()=>V(Jr,{buttonStyle:"ghost",className:`${o}__editButton`,disabled:!w,el:"button",icon:"edit",onClick:P=>(P.preventDefault(),P.stopPropagation(),k(),!1),onMouseDown:P=>{P.preventDefault()},round:!0,size:"medium",tooltip:de("lexical:blocks:inlineBlocks:edit",{label:Ye})}),[o,w,de,Ye,k]),mr=Be(()=>()=>V(Jr,{buttonStyle:"ghost",className:`${o}__removeButton`,disabled:!w,icon:"x",onClick:P=>{P.preventDefault(),Vt()},round:!0,tooltip:"Remove Block"}),[o,w,Vt]),Oo=Be(()=>({Actions:P,children:q,className:U,collapsibleProps:W,disableBlockName:z,editButton:ie,errorCount:qe,fieldHasErrors:Fo,Label:xr,Pill:Cr,removeButton:du,showDragHandle:mu=!0,showRowNumber:pu=!0})=>V("div",{className:`${o}__container ${o}-${S}`,children:V(pd,{actions:typeof P<"u"?P:w?V(_d,{button:V(bd,{}),buttonClassName:`${o}__actions-button`,caret:!1,horizontalAlign:"right",render:({close:Ct})=>Lt(Wo.ButtonGroup,{buttonSize:"medium",children:[(ve&&ie!==!1||!ve&&ie)&&V(Wo.Button,{onClick:()=>{k(),Ct()},children:de("general:edit")}),du!==!1&&Lt(Wo.Button,{onClick:()=>{Vt(),Ct()},children:[V(vd,{}),de("general:remove")]})]}),size:"large"}):null,className:[`${o}__row`,Fo?`${o}__row--has-errors`:`${o}__row--no-errors`,U].filter(Boolean).join(" "),collapsibleStyle:Fo?"error":"default",dragHandleProps:mu?{id:s,attributes:{role:"button",tabIndex:0},listeners:{}}:void 0,header:V("div",{className:`${o}__block-header`,children:typeof xr<"u"?xr:typeof xe<"u"?xe:Lt("div",{className:`${o}__block-label`,children:[pu&&V("span",{className:`${o}__block-number`,children:String(cr+1).padStart(2,"0")}),typeof Cr<"u"?Cr:V(kd,{className:`${o}__block-pill ${o}__block-pill-${S}`,pillStyle:"white",size:"small",children:Ye??S}),!z&&!ee?.admin?.disableBlockName&&V(Ed,{path:"blockName",readOnly:!w}),Fo&&V(gd,{count:qe??0,i18n:xt,withMessage:!0})]})}),isCollapsed:le,onToggle:Ct=>{ur(Ct),Ce(Ct)},...W||{},children:q},0)}),[ve,xe,Ye,o,ee?.admin?.disableBlockName,S,xt,le,ur,w,s,Vt,cr,de,k]),pr=l?.id,{headerActions:fr,submitRef:hr}=br(),gr=Be(()=>()=>V(hd,{children:V(fd,{className:"",headerActions:fr,slug:C,title:de(`lexical:blocks:inlineBlocks:${pr?"edit":"create"}`,{label:Ye??de("lexical:blocks:inlineBlocks:label")}),children:R?Lt("div",{className:"fields-drawer",children:[V(Td,{fields:ee?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:y,permissions:!0,readOnly:!w}),V(kr,{submitRef:hr})]}):null})}),[R,C,pr,Ye,de,w,ee?.fields,y,fr,hr]),uu=Be(()=>R?V("div",{"data-block-drawer-slug":C,style:{display:"contents"},children:V(xd,{beforeSubmit:[async({formState:P})=>await $o({formState:P,submit:!0})],el:"div",fields:ee?.fields??[],initialState:R,onChange:[$o],onSubmit:(P,q)=>{q.blockType=S,N.update(()=>{let U=Xt(s);U&&Me(U)&&U.setFields(q,!0)},{tag:Ko}),k()},submitted:i,uuid:F,children:V(zr,{baseClass:o,BlockDrawer:gr,Collapsible:Oo,CustomBlock:ve,CustomLabel:xe,EditButton:dr,errorCount:v,formSchema:ee?.fields??[],initialState:R,nodeKey:s,RemoveButton:mr})})}):null,[Oo,gr,ve,xe,S,C,mr,dr,o,N,v,k,ee?.fields,F,R,s,$o,i]);return ee?uu:V(Oo,{disableBlockName:!0,fieldHasErrors:!0,children:Lt("div",{className:`${o}-not-found`,children:["Error: Block '",S,"' not found in the config but exists in the lexical data"]})})};var ce=class extends Nt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=Pe(e.fields);return o.setFormat(e.format),o}decorate(...[e,o,n,r]){return Ad(Yr,{cacheBuster:this.getCacheBuster(),className:o.theme.block??"LexicalEditorTheme__block",CustomBlock:n,CustomLabel:r,formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Pe(t){return $d(new ce({fields:{...t,id:t?.id||new Dd.default().toHexString()}}))}function Me(t){return t instanceof ce}import{createHeadlessEditor as Od}from"@lexical/headless";import{$convertToMarkdownString as Fd}from"@lexical/markdown";function Zo(t,e){return({editorState:n})=>{let r=Od({nodes:t});try{r.setEditorState(r.parseEditorState(n))}catch(s){console.error("getLexicalToMarkdown: ERROR parsing editor state",s)}let l="";return r.getEditorState().read(()=>{l=Fd(e)}),l}}import{createHeadlessEditor as u1}from"@lexical/headless";import{$convertFromMarkdownString as ll,$convertToMarkdownString as zd,BOLD_ITALIC_STAR as Kd,BOLD_ITALIC_UNDERSCORE as Jd,BOLD_STAR as Xd,BOLD_UNDERSCORE as Zd,HEADING as Yd,HIGHLIGHT as qd,INLINE_CODE as Qd,ITALIC_STAR as e1,ITALIC_UNDERSCORE as t1,ORDERED_LIST as o1,QUOTE as n1,STRIKETHROUGH as r1,UNORDERED_LIST as l1}from"@lexical/markdown";var qr=/^[\t ]*$/,Bd=/^(\s*)(\d+)\.\s/,Pd=/^(\s*)[-*+]\s/,jd=/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,Qr=/^(#{1,6})\s/,Hd=/^>\s/,Ud=/^[ \t]*(\\`\\`\\`|```)(\w+)?/,el=/[ \t]*(\\`\\`\\`|```)$/,Gd=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,Vd=/^\|(.+)\|\s?$/,Wd=/^(\| ?:?-*:? ?)+\|\s?$/,tl=/^[ \t]*<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i,ol=/^[ \t]*<\/[a-z_][\w-]*\s*>/i;function nl(t){if(t.endsWith("\\"))return[t.slice(0,-1),"\\"];let e=t.match(/^(.*?\S)( {2,})$/);return e?[e[1],e[2]]:null}function rl(t,e){let o=t.split(`
11
- `),n=!1,r=[],l=0;for(let s=0;s<o.length;s++){let i=o[s],u=r[r.length-1],c=s<o.length-1?nl(i):null,d=u!==void 0&&nl(u)!==null;if(Gd.test(i)){r.push(i);continue}if(el.test(i)){l===0&&(n=!0),l===1&&(n=!1),l>0&&l--,r.push(i);continue}if(Ud.test(i)){n=!0,l++,r.push(i);continue}if(n){r.push(i);continue}qr.test(i)||qr.test(u)||!u||Qr.test(u)||Qr.test(i)||Hd.test(i)||Bd.test(i)||Pd.test(i)||jd.test(i)||Vd.test(i)||Wd.test(i)||d||!e||tl.test(i)||ol.test(i)||tl.test(u)||ol.test(u)||el.test(u)?r.push(i):r[r.length-1]=u+" "+(c===null?i.trim():i.trimStart())}return r.join(`
12
- `)}import{BOLD_ITALIC_STAR as r6,BOLD_ITALIC_UNDERSCORE as l6,BOLD_STAR as i6,BOLD_UNDERSCORE as s6,CHECK_LIST as a6,HEADING as c6,HIGHLIGHT as u6,INLINE_CODE as d6,ITALIC_STAR as m6,ITALIC_UNDERSCORE as p6,ORDERED_LIST as f6,QUOTE as h6,registerMarkdownShortcuts as g6,STRIKETHROUGH as x6,UNORDERED_LIST as C6}from"@lexical/markdown";var i1=[Yd,n1,l1,o1],s1=[],a1=[Qd,Kd,Jd,Xd,Zd,qd,e1,t1,r1],c1=[],il=[...i1,...s1,...a1,...c1];function qt(t,e=il,o,n=!1,r=!0){if(n)return ll(t,e,o,!0);let l=rl(t,r);return ll(l,e,o,!1,!1)}function sl(t=il,e,o=!1){return zd(t,e,o)}function Qt(t,e){return({markdown:n})=>{let r=u1({nodes:t});return r.update(()=>{qt(n,e)},{discrete:!0}),r.getEditorState().toJSON()}}function d1(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var ul=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let n of t){let r=cl(n,!1);r&&(o=o.concat(r))}if(e?.length)for(let n of e){let r=cl(n,!0);r&&(o=o.concat(r))}return o};function cl(t,e){if(!t.jsx)return null;let o=d1(t.slug),n=[];return e?(n.push(({allNodes:r,allTransformers:l})=>({type:"text-match",dependencies:[bt],export:s=>{if(!_t(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),u=Zo(r,l),c=t.jsx.export({fields:i,lexicalToMarkdown:u});if(c===!1)return null;if(typeof c=="string")return c;let d=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};return c?.children?.length?`<${i.blockType}${d?" "+St({props:a}):""}>${c.children}</${i.blockType}>`:`<${i.blockType}${d?" "+St({props:a}):""}/>`},getEndIndex:(s,i)=>{let{endlineLastCharIndex:u}=Kt({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:i,trimChildren:!1});return u},importRegExp:t.jsx?.customStartRegex??o.regExpStart,regExp:/___ignoreignoreignore___/g,replace(s,i){let{content:u,propsString:c}=Kt({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:{...i,index:0},trimChildren:!1});if(!t?.jsx?.import)return;let d=Qt(r,l),a=t.jsx.import({children:u,closeMatch:null,htmlToLexical:null,markdownToLexical:d,openMatch:i,props:c?zt({propsString:c}):{}});if(a===!1)return;let m=kt({blockType:t.slug,...a});s.replace(m)}})),n):(n.push(({allNodes:r,allTransformers:l})=>({dependencies:[ce],export:s=>{if(!Me(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),u=Zo(r,l),c=t.jsx.export({fields:i,lexicalToMarkdown:u});if(c===!1)return null;if(typeof c=="string")return c;let d=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};if(c?.children?.length){let m=c.children,p="";if(m.includes(`
8
+ . Start match: `+JSON.stringify(r))}return{afterEndLine:u[_].trim().slice(g),beforeStartLine:p,content:i,endLineIndex:n+_,endlineLastCharIndex:g,propsString:s}}import{jsx as ld}from"react/jsx-runtime";import id from"bson-objectid";import{$applyNodeReplacement as sd}from"lexical";import"react";import{DecoratorBlockNode as Eu}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as Su}from"@lexical/utils";import Nu from"bson-objectid";import{$applyNodeReplacement as Lu}from"lexical";var St=class extends Eu{__cacheBuster;__fields;constructor({cacheBuster:e,fields:o,format:n,key:r}){super(n,r),this.__fields=o,this.__cacheBuster=e||0}static clone(e){return new this({cacheBuster:e.__cacheBuster,fields:e.__fields,format:e.__format,key:e.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=yu(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return Su(o,e?.theme?.block),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div"),o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),type:"block",fields:this.getFields(),version:2}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e,o){let n=this.getWritable();n.__fields=e,o||n.__cacheBuster++}};function yu(t){return Lu(new St({fields:{...t,id:t?.id||new Nu.default().toHexString()}}))}import{jsx as z,jsxs as Nt}from"react/jsx-runtime";import{useLexicalComposerContext as Ou}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Fu}from"@lexical/react/useLexicalEditable";import{getTranslation as Pu}from"@payloadcms/translations";import{Button as Hr,Collapsible as Bu,Drawer as ju,EditDepthProvider as Hu,ErrorPill as Gu,Form as Uu,formatDrawerSlug as zu,MoreIcon as Vu,Pill as Wu,Popup as Ku,PopupList as Ho,RenderFields as Xu,SectionTitle as Ju,useConfig as Zu,useDocumentForm as Yu,useDocumentInfo as Gr,useEditDepth as qu,useFormSubmitted as Qu,useServerFunctions as ed,useTranslation as td,XIcon as od}from"@payloadcms/ui";import{abortAndIgnore as Go}from"@payloadcms/ui/shared";import{$getNodeByKey as Kt,$getRoot as nd,SKIP_DOM_SELECTION_TAG as Uo}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as Xt,reduceFieldsToValues as Ur}from"payload/shared";import Oe,{useCallback as zo,useEffect as Jt,useMemo as Fe,useRef as Vo}from"react";import{v4 as rd}from"uuid";import{c as Ru}from"react/compiler-runtime";import{jsx as Wt,jsxs as vu}from"react/jsx-runtime";import{useLexicalEditable as Iu}from"@lexical/react/useLexicalEditable";import{RenderFields as Mu,useFormSubmitted as Au}from"@payloadcms/ui";import $u,{createContext as Du}from"react";var Pr=Du({baseClass:"LexicalEditorTheme__block",BlockCollapsible:()=>null,BlockDrawer:()=>null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),ae=()=>$u.use(Pr),Br=t=>{let e=Ru(4),{Collapsible:o,CustomBlock:n,CustomLabel:r,...l}=t,{BlockDrawer:s,errorCount:i,formSchema:u}=l,c=Au()&&i>0,a=Iu(),m;e[0]!==o||e[1]!==i||e[2]!==c?(m=p=>{let{children:g,..._}=p;return Wt(o,{errorCount:i,fieldHasErrors:c,..._,children:g})},e[0]=o,e[1]=i,e[2]=c,e[3]=m):m=e[3];let f=m,h={...l,BlockCollapsible:f};return n?vu(Pr,{value:h,children:[n,Wt(s,{})]}):Wt(f,{children:Wt(Mu,{fields:u,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!a})})};function jr({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var zr=t=>{let{cacheBuster:e,className:o,CustomBlock:n,CustomLabel:r,formData:l,nodeKey:s}=t,i=Qu(),{id:u,collectionSlug:d,globalSlug:c}=Gr(),{fieldProps:{featureClientSchemaMap:a,field:m,initialLexicalFormState:f,schemaPath:h},uuid:p}=U(),{fields:g}=Yu(),_=Vo(new AbortController),L=qu(),[v,b]=Oe.useState(0),{config:C}=Zu(),x=zu({slug:`lexical-blocks-create-${p}-${l.id}`,depth:L}),{toggleDrawer:k}=De(x),{getDocPreferences:T,setDocFieldPreferences:I}=Gr(),[N]=Ou(),E=Fu(),S=l.blockType,{getFormState:w}=ed(),R=`${h}.lexical_internal_feature.blocks.lexical_blocks.${S}.fields`,[y,M]=Oe.useState(()=>{let B=f?.[l.id]?.formState;if(!B)return!1;let q=Object.fromEntries(Object.entries(B).map(([G,V])=>[G,G in l?{...V,initialValue:l[G],value:l[G]}:V]));return q.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName},q}),$=Vo(!1),D=Vo(e);Jt(()=>{$.current?(D.current!==e&&M(!1),D.current=e):$.current=!0},[e]);let[F]=Oe.useState(()=>rd()),[P,Y]=Oe.useState(()=>{if(!r)return y?._components?.customComponents?.BlockLabel??void 0}),[X,Ke]=Oe.useState(()=>{if(!n)return y?._components?.customComponents?.Block??void 0}),ye=Fe(()=>n?z(n,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ae}):X,[n,o,l,s,X]),he=Fe(()=>r?z(r,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ae}):P,[r,o,l,s,P]);Jt(()=>{let B=new AbortController;return l&&!y&&(async()=>{let{state:G}=await w({id:u,collectionSlug:d,data:l,docPermissions:{fields:!0},docPreferences:await T(),documentFormState:Xt(g,{excludeFiles:!0}),globalSlug:c,initialBlockData:l,operation:"update",readOnly:!E,renderAllFields:!0,schemaPath:R,signal:B.signal});if(G){G.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName};let V=Ur(Xt(G,{excludeFiles:!0}),!0);N.update(()=>{let W=Kt(s);if(W&&Ie(W)){let ie=V;ie.blockType=S,W.setFields(ie,!0)}},{tag:Uo}),M(G),r||Y(G._components?.customComponents?.BlockLabel??void 0),n||Ke(G._components?.customComponents?.Block??void 0)}})(),()=>{Go(B)}},[w,R,E,u,r,n,l,N,s,y,d,c,T,g,S]);let[le,ge]=Oe.useState(f?.[l.id]?.collapsed??!1),Ht=`${h}.lexical_internal_feature.blocks.lexical_blocks.${S}`,ht=a.blocks?.[Ht]?.[0]?.blocks?.[0],ee=typeof ht=="string"?C.blocksMap[ht]:ht,{i18n:gt,t:de}=td(),Io=zo(async({formState:B,submit:q})=>{Go(_.current);let G=new AbortController;_.current=G;let{state:V}=await w({id:u,collectionSlug:d,docPermissions:{fields:!0},docPreferences:await T(),documentFormState:Xt(g,{excludeFiles:!0}),formState:B,globalSlug:c,initialBlockFormState:B,operation:"update",readOnly:!E,renderAllFields:!!q,schemaPath:R,signal:G.signal});if(!V)return B;B.blockName&&(V.blockName=B.blockName);let W=Ur(jr({fields:Xt(V,{excludeFiles:!0})}),!0);if(setTimeout(()=>{N.update(()=>{let ie=Kt(s);if(ie&&Ie(ie)){let Ze=W;Ze.blockType=S,ie.setFields(Ze,!0)}},{tag:Uo})},0),q){r||Y(V._components?.customComponents?.BlockLabel??void 0),n||Ke(V._components?.customComponents?.Block??void 0);let ie=0;for(let Ze of Object.values(V))Ze?.valid===!1&&ie++;b(ie)}return V},[w,u,d,T,c,R,S,g,E,N,s,n,r]);Jt(()=>()=>{Go(_.current)},[]);let Gt=zo(()=>{N.update(()=>{Kt(s)?.remove()})},[N,s]),[nr,Oc]=Oe.useState(0);Jt(()=>{let B=()=>{N.getEditorState().read(()=>{let G=nd().getChildren(),V=0;for(let W of G)if(Ie(W)){if(W.getKey()===s){Oc(V);return}V++}})};return B(),N.registerUpdateListener(()=>{B()})},[N,s]);let Je=ee?.labels?.singular?Pu(ee.labels.singular,gt):ee?.slug,rr=zo(B=>{T().then(q=>{let V=q?.fields?.[m.name]?.collapsed,W=V&&V?.length?V:[];B?W.includes(l.id)||W.push(l.id):W.includes(l.id)&&W.splice(W.indexOf(l.id),1),I(m.name,{collapsed:W,hello:"hi"})})},[T,m.name,I,l.id]),lr=Fe(()=>()=>z(Hr,{buttonStyle:"ghost",className:`${o}__editButton`,disabled:!E,el:"button",icon:"edit",onClick:B=>(B.preventDefault(),B.stopPropagation(),k(),!1),onMouseDown:B=>{B.preventDefault()},round:!0,size:"medium",tooltip:de("lexical:blocks:inlineBlocks:edit",{label:Je})}),[o,E,de,Je,k]),ir=Fe(()=>()=>z(Hr,{buttonStyle:"ghost",className:`${o}__removeButton`,disabled:!E,icon:"x",onClick:B=>{B.preventDefault(),Gt()},round:!0,tooltip:"Remove Block"}),[o,E,Gt]),Mo=Fe(()=>({Actions:B,children:q,className:G,collapsibleProps:V,disableBlockName:W,editButton:ie,errorCount:Ze,fieldHasErrors:Ao,Label:dr,Pill:mr,removeButton:Pc,showDragHandle:Bc=!0,showRowNumber:jc=!0})=>z("div",{className:`${o}__container ${o}-${S}`,children:z(Bu,{actions:typeof B<"u"?B:E?z(Ku,{button:z(Vu,{}),buttonClassName:`${o}__actions-button`,caret:!1,horizontalAlign:"right",render:({close:Ct})=>Nt(Ho.ButtonGroup,{buttonSize:"medium",children:[(ye&&ie!==!1||!ye&&ie)&&z(Ho.Button,{onClick:()=>{k(),Ct()},children:de("general:edit")}),Pc!==!1&&Nt(Ho.Button,{onClick:()=>{Gt(),Ct()},children:[z(od,{}),de("general:remove")]})]}),size:"large"}):null,className:[`${o}__row`,Ao?`${o}__row--has-errors`:`${o}__row--no-errors`,G].filter(Boolean).join(" "),collapsibleStyle:Ao?"error":"default",dragHandleProps:Bc?{id:s,attributes:{role:"button",tabIndex:0},listeners:{}}:void 0,header:z("div",{className:`${o}__block-header`,children:typeof dr<"u"?dr:typeof he<"u"?he:Nt("div",{className:`${o}__block-label`,children:[jc&&z("span",{className:`${o}__block-number`,children:String(nr+1).padStart(2,"0")}),typeof mr<"u"?mr:z(Wu,{className:`${o}__block-pill ${o}__block-pill-${S}`,pillStyle:"white",size:"small",children:Je??S}),!W&&!ee?.admin?.disableBlockName&&z(Ju,{path:"blockName",readOnly:!E}),Ao&&z(Gu,{count:Ze??0,i18n:gt,withMessage:!0})]})}),isCollapsed:le,onToggle:Ct=>{rr(Ct),ge(Ct)},...V||{},children:q},0)}),[ye,he,Je,o,ee?.admin?.disableBlockName,S,gt,le,rr,E,s,Gt,nr,de,k]),sr=l?.id,{headerActions:ar,submitRef:cr}=fr(),ur=Fe(()=>()=>z(Hu,{children:z(ju,{className:"",headerActions:ar,slug:x,title:de(`lexical:blocks:inlineBlocks:${sr?"edit":"create"}`,{label:Je??de("lexical:blocks:inlineBlocks:label")}),children:y?Nt("div",{className:"fields-drawer",children:[z(Xu,{fields:ee?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:R,permissions:!0,readOnly:!E}),z(pr,{submitRef:cr})]}):null})}),[y,x,sr,Je,de,E,ee?.fields,R,ar,cr]),Fc=Fe(()=>y?z("div",{"data-block-drawer-slug":x,style:{display:"contents"},children:z(Uu,{beforeSubmit:[async({formState:B})=>await Io({formState:B,submit:!0})],el:"div",fields:ee?.fields??[],initialState:y,onChange:[Io],onSubmit:(B,q)=>{q.blockType=S,N.update(()=>{let G=Kt(s);G&&Ie(G)&&G.setFields(q,!0)},{tag:Uo}),k()},submitted:i,uuid:F,children:z(Br,{baseClass:o,BlockDrawer:ur,Collapsible:Mo,CustomBlock:ye,CustomLabel:he,EditButton:lr,errorCount:v,formSchema:ee?.fields??[],initialState:y,nodeKey:s,RemoveButton:ir})})}):null,[Mo,ur,ye,he,S,x,ir,lr,o,N,v,k,ee?.fields,F,y,s,Io,i]);return ee?Fc:z(Mo,{disableBlockName:!0,fieldHasErrors:!0,children:Nt("div",{className:`${o}-not-found`,children:["Error: Block '",S,"' not found in the config but exists in the lexical data"]})})};var ce=class extends St{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=Pe(e.fields);return o.setFormat(e.format),o}decorate(...[e,o,n,r]){return ld(zr,{cacheBuster:this.getCacheBuster(),className:o.theme.block??"LexicalEditorTheme__block",CustomBlock:n,CustomLabel:r,formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Pe(t){return sd(new ce({fields:{...t,id:t?.id||new id.default().toHexString()}}))}function Ie(t){return t instanceof ce}import{createHeadlessEditor as ad}from"@lexical/headless";import{$convertToMarkdownString as cd}from"@lexical/markdown";function Wo(t,e){return({editorState:n})=>{let r=ad({nodes:t});try{r.setEditorState(r.parseEditorState(n))}catch(s){console.error("getLexicalToMarkdown: ERROR parsing editor state",s)}let l="";return r.getEditorState().read(()=>{l=cd(e)}),l}}import{createHeadlessEditor as bd}from"@lexical/headless";import{$convertFromMarkdownString as qr,TRANSFORMERS as xd}from"@lexical/markdown";var Vr=/^[\t ]*$/,ud=/^(\s*)(\d+)\.\s/,dd=/^(\s*)[-*+]\s/,md=/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,Wr=/^(#{1,6})\s/,fd=/^>\s/,pd=/^[ \t]*(\\`\\`\\`|```)(\w+)?/,Kr=/[ \t]*(\\`\\`\\`|```)$/,hd=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,gd=/^\|(.+)\|\s?$/,Cd=/^(\| ?:?-*:? ?)+\|\s?$/,Xr=/^[ \t]*<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i,Jr=/^[ \t]*<\/[a-z_][\w-]*\s*>/i;function Zr(t){if(t.endsWith("\\"))return[t.slice(0,-1),"\\"];let e=t.match(/^(.*?\S)( {2,})$/);return e?[e[1],e[2]]:null}function Yr(t,e){let o=t.split(`
9
+ `),n=!1,r=[],l=0;for(let s=0;s<o.length;s++){let i=o[s],u=r[r.length-1],d=s<o.length-1?Zr(i):null,c=u!==void 0&&Zr(u)!==null;if(hd.test(i)){r.push(i);continue}if(Kr.test(i)){l===0&&(n=!0),l===1&&(n=!1),l>0&&l--,r.push(i);continue}if(pd.test(i)){n=!0,l++,r.push(i);continue}if(n){r.push(i);continue}Vr.test(i)||Vr.test(u)||!u||Wr.test(u)||Wr.test(i)||fd.test(i)||ud.test(i)||dd.test(i)||md.test(i)||gd.test(i)||Cd.test(i)||c||!e||Xr.test(i)||Jr.test(i)||Xr.test(u)||Jr.test(u)||Kr.test(u)?r.push(i):r[r.length-1]=u+" "+(d===null?i.trim():i.trimStart())}return r.join(`
10
+ `)}function Zt(t,e=xd,o,n=!1,r=!1){if(n)return qr(t,e,o,!0);let l=Yr(t,r);return qr(l,e,o,!1,!1)}function Yt(t,e){return({markdown:n})=>{let r=bd({nodes:t});return r.update(()=>{Zt(n,e,void 0,!1,!0)},{discrete:!0}),r.getEditorState().toJSON()}}function kd(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var tl=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let n of t){let r=el(n,!1);r&&(o=o.concat(r))}if(e?.length)for(let n of e){let r=el(n,!0);r&&(o=o.concat(r))}return o};function el(t,e){if(!t.jsx)return null;let o=kd(t.slug),n=[];return e?(n.push(({allNodes:r,allTransformers:l})=>({type:"text-match",dependencies:[xt],export:s=>{if(!kt(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),u=Wo(r,l),d=t.jsx.export({fields:i,lexicalToMarkdown:u});if(d===!1)return null;if(typeof d=="string")return d;let c=d.props&&Object.keys(d.props)?.length>0,a=d.props??{};return d?.children?.length?`<${i.blockType}${c?" "+Et({props:a}):""}>${d.children}</${i.blockType}>`:`<${i.blockType}${c?" "+Et({props:a}):""}/>`},getEndIndex:(s,i)=>{let{endlineLastCharIndex:u}=Vt({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:i,trimChildren:!1});return u},importRegExp:t.jsx?.customStartRegex??o.regExpStart,regExp:/___ignoreignoreignore___/g,replace(s,i){let{content:u,propsString:d}=Vt({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:{...i,index:0},trimChildren:!1});if(!t?.jsx?.import)return;let c=Yt(r,l),a=t.jsx.import({children:u,closeMatch:null,htmlToLexical:null,markdownToLexical:c,openMatch:i,props:d?zt({propsString:d}):{}});if(a===!1)return;let m=bt({blockType:t.slug,...a});s.replace(m)}})),n):(n.push(({allNodes:r,allTransformers:l})=>({dependencies:[ce],export:s=>{if(!Ie(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),u=Wo(r,l),d=t.jsx.export({fields:i,lexicalToMarkdown:u});if(d===!1)return null;if(typeof d=="string")return d;let c=d.props&&Object.keys(d.props)?.length>0,a=d.props??{};if(d?.children?.length){let m=d.children,f="";if(m.includes(`
13
11
  `))for(let h of m.split(`
14
- `)){let f="";!t?.jsx?.doNotTrimChildren&&h!==""&&(f=" "),f+=h+`
15
- `,p+=f}else p=(t?.jsx?.doNotTrimChildren?"":" ")+m+`
16
- `;return`<${i.blockType}${d?" "+St({props:a}):""}>
17
- ${p}</${i.blockType}>`}return`<${i.blockType}${d?" "+St({props:a}):""}/>`},handleImportAfterStartMatch:t.jsx?.customEndRegex?void 0:({lines:s,rootNode:i,startLineIndex:u,startMatch:c,transformer:d})=>{let a=typeof d.regExpEnd=="object"&&"regExp"in d.regExpEnd?d.regExpEnd.regExp:d.regExpEnd,m=d.regExpEnd&&typeof d.regExpEnd=="object"&&"optional"in d.regExpEnd?d.regExpEnd.optional:!d.regExpEnd,{afterEndLine:p,beforeStartLine:h,content:f,endLineIndex:g,propsString:_}=Kt({isEndOptional:m,lines:s,regexpEndRegex:a,startLineIndex:u,startMatch:c,trimChildren:!1}),L="";if(t?.jsx?.doNotTrimChildren)L=f.endsWith(`
18
- `)?f.slice(0,-1):f;else if(f.includes(`
19
- `)){let C=f.split(`
20
- `),k=0;for(let T of C){if(k++,T.startsWith(" "))L+=T.slice(2);else if(T==="")L+=T;else{L=f.endsWith(`
21
- `)?f.slice(0,-1):f;break}L+=k===C.length?"":`
22
- `}}else L=(f.startsWith(" ")?f.slice(2):f)+`
23
- `;if(!t?.jsx?.import)return[!1,u];let v=Qt(r,l),b=t.jsx.import({children:L,closeMatch:null,htmlToLexical:null,markdownToLexical:v,openMatch:c,props:_?zt({propsString:_}):{}});if(b===!1)return[!1,u];let x=Pe({...b,blockType:t.slug});if(x){let C=null,k=null;if(h?.length){C=v({markdown:h})?.root?.children??[];let T=C?.[0];T&&i.append(al(T))}if(i.append(x),p?.length){k=v({markdown:p})?.root?.children;let T=i.getChildren()[i.getChildren().length-1],I=al(k[0])?.getChildren();if(I?.length)for(let N of I)T.append(N)}}return[!0,g]},regExpEnd:t.jsx?.customEndRegex??o.regExpEnd,regExpStart:t.jsx?.customStartRegex??o.regExpStart,type:"multiline-element",replace:(s,i,u,c,d)=>{if(t?.jsx?.import){if(!d){let g="";if(i)for(let _ of i)g+=_.getTextContent();d=[g]}let a="";t?.jsx?.doNotTrimChildren?a=d.join(`
24
- `):a=d.join(`
25
- `).trim();let m=u[1]?.trim(),p=Qt(r,l),h=t.jsx.import({children:a,closeMatch:c,htmlToLexical:null,markdownToLexical:p,openMatch:u,props:m?zt({propsString:m}):{}});if(h===!1)return!1;let f=Pe({...h,blockType:t.slug});f&&s.append(f);return}return!1}})),n)}import{createCommand as dl}from"lexical";var tt=dl("INSERT_BLOCK_COMMAND"),ot=dl("INSERT_INLINE_BLOCK_COMMAND");import{c as m1}from"react/compiler-runtime";import{useLexicalComposerContext as p1}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as f1,$wrapNodeInElement as h1,mergeRegister as g1}from"@lexical/utils";import{formatDrawerSlug as x1,useEditDepth as C1}from"@payloadcms/ui";import{$createParagraphNode as b1,$getNodeByKey as k1,$getPreviousSelection as _1,$getSelection as T1,$insertNodes as E1,$isParagraphNode as w1,$isRangeSelection as S1,$isRootOrShadowRoot as N1,COMMAND_PRIORITY_EDITOR as ml}from"lexical";import{useEffect as L1,useState as R1}from"react";var pl=()=>{let t=m1(12),[e]=p1(),[o,n]=R1(null),{setCreatedInlineBlock:r,uuid:l}=G(),s=C1(),i="lexical-inlineBlocks-create-"+l,u;t[0]!==s||t[1]!==i?(u=x1({slug:i,depth:s}),t[0]=s,t[1]=i,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=Oe(c,!0),a;t[3]!==e||t[4]!==r||t[5]!==o?(a=()=>{if(!e.hasNodes([ce]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return g1(e.registerCommand(tt,p=>(e.update(()=>{let h=T1()||_1();if(S1(h)){let f=Pe(p),{focus:g}=h,_=g.getNode();f1(f),w1(_)&&!_.__first&&_.remove()}}),!0),ml),e.registerCommand(ot,p=>{if(o){let f=k1(o);return!f||!_t(f)?!1:(f.setFields(p),n(null),!0)}let h=kt(p);return r?.(h),E1([h]),N1(h.getParentOrThrow())&&h1(h,b1).selectEnd(),!0},ml))},t[3]=e,t[4]=r,t[5]=o,t[6]=a):a=t[6];let m;return t[7]!==e||t[8]!==r||t[9]!==o||t[10]!==d?(m=[e,r,o,d],t[7]=e,t[8]=r,t[9]=o,t[10]=d,t[11]=m):m=t[11],L1(a,m),null};var y1=A(({config:t,featureClientSchemaMap:e,props:o,schemaPath:n})=>{let r=`${n}.lexical_internal_feature.blocks.lexical_blocks`,l=`${n}.lexical_internal_feature.blocks.lexical_inline_blocks`,s=e.blocks;if(!s)return{};let i=Object.entries(s).filter(([a])=>a.startsWith(r+".")&&!a.replace(r+".","").includes(".")).map(([,a])=>a[0]),u=Object.entries(s).filter(([a])=>a.startsWith(l+".")&&!a.replace(l+".","").includes(".")).map(([,a])=>a[0]),c=i.map(a=>{let m=a.blocks[0];return typeof m=="string"?t.blocksMap[m]:m}).filter(a=>a!==void 0),d=u.map(a=>{let m=a.blocks[0];return typeof m=="string"?t.blocksMap[m]:m}).filter(a=>a!==void 0);return{markdownTransformers:ul({blocks:c,inlineBlocks:d}),nodes:[ce,bt],plugins:[{Component:pl,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[c?.length?{items:c.map(a=>({Icon:Ur(a,Uo),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:m})=>a?.labels?.singular?eo(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(tt,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,d?.length?{items:d.map(a=>({Icon:Go,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:m})=>a?.labels?.singular?eo(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(ot,{blockName:"",blockType:a.slug})}})),key:"inlineBlocks",label:({i18n:a})=>a.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[c.length?{type:"dropdown",ChildComponent:Uo,items:c.map((a,m)=>({isActive:void 0,key:"block-"+a.slug,label:({i18n:p})=>a?.labels?.singular?eo(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(tt,{blockName:"",blockType:a.slug})},order:m})),key:"blocks",order:20}:null,d?.length?{type:"dropdown",ChildComponent:Go,items:d.map((a,m)=>({isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:p})=>a?.labels?.singular?eo(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(ot,{blockName:"",blockType:a.slug})},order:m})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as M1}from"react/compiler-runtime";import{jsx as He,jsxs as en}from"react/jsx-runtime";import{useLexicalComposerContext as A1}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as D1,$createTextNode as $1,$getRoot as O1,getDOMSelection as Yo}from"lexical";import*as Cl from"react";import{useCallback as je,useEffect as qo,useLayoutEffect as hl,useRef as Qo,useState as to}from"react";var v1=se&&"documentMode"in document?document.documentMode:null,fl=se&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),n7=se&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),r7=se&&"InputEvent"in window&&!v1?"getTargetRanges"in new window.InputEvent("input"):!1,l7=se&&/Version\/[\d.].*Safari/.test(navigator.userAgent),i7=se&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,s7=se&&/Android/.test(navigator.userAgent),a7=se&&/Win/.test(navigator.platform),I1=se&&/^(?=.*Chrome).*/i.test(navigator.userAgent),c7=se&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!I1;var F1=t=>{let e=document.createElement("textarea");e.value=t||"",e.style.position="absolute",e.style.opacity="0",document.body?.appendChild(e),e.focus(),e.select();try{let o=document.execCommand("copy");console.log(o)}catch(o){console.error(o)}document.body?.removeChild(e)},B1=(t,e)=>{let o=document.createElement("a");o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e||"")),o.setAttribute("download",t),o.style.display="none",document.body?.appendChild(o),o.click(),document.body?.removeChild(o)},P1=t=>{let o=((n,r)=>{switch(n){case"click":return` await page.mouse.click(${r.x}, ${r.y});`;case"keydown":return` await page.keyboard.keydown('${r}');`;case"keyup":return` await page.keyboard.keyup('${r}');`;case"press":return` await page.keyboard.press('${r}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
12
+ `)){let p="";!t?.jsx?.doNotTrimChildren&&h!==""&&(p=" "),p+=h+`
13
+ `,f+=p}else f=(t?.jsx?.doNotTrimChildren?"":" ")+m+`
14
+ `;return`<${i.blockType}${c?" "+Et({props:a}):""}>
15
+ ${f}</${i.blockType}>`}return`<${i.blockType}${c?" "+Et({props:a}):""}/>`},handleImportAfterStartMatch:t.jsx?.customEndRegex?void 0:({lines:s,rootNode:i,startLineIndex:u,startMatch:d,transformer:c})=>{let a=typeof c.regExpEnd=="object"&&"regExp"in c.regExpEnd?c.regExpEnd.regExp:c.regExpEnd,m=c.regExpEnd&&typeof c.regExpEnd=="object"&&"optional"in c.regExpEnd?c.regExpEnd.optional:!c.regExpEnd,{afterEndLine:f,beforeStartLine:h,content:p,endLineIndex:g,propsString:_}=Vt({isEndOptional:m,lines:s,regexpEndRegex:a,startLineIndex:u,startMatch:d,trimChildren:!1}),L="";if(t?.jsx?.doNotTrimChildren)L=p.endsWith(`
16
+ `)?p.slice(0,-1):p;else if(p.includes(`
17
+ `)){let x=p.split(`
18
+ `),k=0;for(let T of x){if(k++,T.startsWith(" "))L+=T.slice(2);else if(T==="")L+=T;else{L=p.endsWith(`
19
+ `)?p.slice(0,-1):p;break}L+=k===x.length?"":`
20
+ `}}else L=(p.startsWith(" ")?p.slice(2):p)+`
21
+ `;if(!t?.jsx?.import)return[!1,u];let v=Yt(r,l),b=t.jsx.import({children:L,closeMatch:null,htmlToLexical:null,markdownToLexical:v,openMatch:d,props:_?zt({propsString:_}):{}});if(b===!1)return[!1,u];let C=Pe({...b,blockType:t.slug});if(C){let x=null,k=null;if(h?.length){x=v({markdown:h})?.root?.children??[];let T=x?.[0];T&&i.append(Qr(T))}if(i.append(C),f?.length){k=v({markdown:f})?.root?.children;let T=i.getChildren()[i.getChildren().length-1],I=Qr(k[0])?.getChildren();if(I?.length)for(let N of I)T.append(N)}}return[!0,g]},regExpEnd:t.jsx?.customEndRegex??o.regExpEnd,regExpStart:t.jsx?.customStartRegex??o.regExpStart,type:"multiline-element",replace:(s,i,u,d,c)=>{if(t?.jsx?.import){if(!c){let g="";if(i)for(let _ of i)g+=_.getTextContent();c=[g]}let a="";t?.jsx?.doNotTrimChildren?a=c.join(`
22
+ `):a=c.join(`
23
+ `).trim();let m=u[1]?.trim(),f=Yt(r,l),h=t.jsx.import({children:a,closeMatch:d,htmlToLexical:null,markdownToLexical:f,openMatch:u,props:m?zt({propsString:m}):{}});if(h===!1)return!1;let p=Pe({...h,blockType:t.slug});p&&s.append(p);return}return!1}})),n)}import{createCommand as ol}from"lexical";var tt=ol("INSERT_BLOCK_COMMAND"),ot=ol("INSERT_INLINE_BLOCK_COMMAND");import{c as _d}from"react/compiler-runtime";import{useLexicalComposerContext as Td}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as wd,$wrapNodeInElement as Ed,mergeRegister as Sd}from"@lexical/utils";import{formatDrawerSlug as Nd,useEditDepth as Ld}from"@payloadcms/ui";import{$createParagraphNode as yd,$getNodeByKey as Rd,$getPreviousSelection as vd,$getSelection as Id,$insertNodes as Md,$isParagraphNode as Ad,$isRangeSelection as $d,$isRootOrShadowRoot as Dd,COMMAND_PRIORITY_EDITOR as nl}from"lexical";import{useEffect as Od,useState as Fd}from"react";var rl=()=>{let t=_d(12),[e]=Td(),[o,n]=Fd(null),{setCreatedInlineBlock:r,uuid:l}=U(),s=Ld(),i="lexical-inlineBlocks-create-"+l,u;t[0]!==s||t[1]!==i?(u=Nd({slug:i,depth:s}),t[0]=s,t[1]=i,t[2]=u):u=t[2];let d=u,{toggleDrawer:c}=De(d,!0),a;t[3]!==e||t[4]!==r||t[5]!==o?(a=()=>{if(!e.hasNodes([ce]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Sd(e.registerCommand(tt,f=>(e.update(()=>{let h=Id()||vd();if($d(h)){let p=Pe(f),{focus:g}=h,_=g.getNode();wd(p),Ad(_)&&!_.__first&&_.remove()}}),!0),nl),e.registerCommand(ot,f=>{if(o){let p=Rd(o);return!p||!kt(p)?!1:(p.setFields(f),n(null),!0)}let h=bt(f);return r?.(h),Md([h]),Dd(h.getParentOrThrow())&&Ed(h,yd).selectEnd(),!0},nl))},t[3]=e,t[4]=r,t[5]=o,t[6]=a):a=t[6];let m;return t[7]!==e||t[8]!==r||t[9]!==o||t[10]!==c?(m=[e,r,o,c],t[7]=e,t[8]=r,t[9]=o,t[10]=c,t[11]=m):m=t[11],Od(a,m),null};var Pd=A(({config:t,featureClientSchemaMap:e,props:o,schemaPath:n})=>{let r=`${n}.lexical_internal_feature.blocks.lexical_blocks`,l=`${n}.lexical_internal_feature.blocks.lexical_inline_blocks`,s=e.blocks;if(!s)return{};let i=Object.entries(s).filter(([a])=>a.startsWith(r+".")&&!a.replace(r+".","").includes(".")).map(([,a])=>a[0]),u=Object.entries(s).filter(([a])=>a.startsWith(l+".")&&!a.replace(l+".","").includes(".")).map(([,a])=>a[0]),d=i.map(a=>{let m=a.blocks[0];return typeof m=="string"?t.blocksMap[m]:m}).filter(a=>a!==void 0),c=u.map(a=>{let m=a.blocks[0];return typeof m=="string"?t.blocksMap[m]:m}).filter(a=>a!==void 0);return{markdownTransformers:tl({blocks:d,inlineBlocks:c}),nodes:[ce,xt],plugins:[{Component:rl,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[d?.length?{items:d.map(a=>({Icon:Dr(a,Po),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:m})=>a?.labels?.singular?qt(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(tt,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,c?.length?{items:c.map(a=>({Icon:Bo,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:m})=>a?.labels?.singular?qt(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(ot,{blockName:"",blockType:a.slug})}})),key:"inlineBlocks",label:({i18n:a})=>a.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[d.length?{type:"dropdown",ChildComponent:Po,items:d.map((a,m)=>({isActive:void 0,key:"block-"+a.slug,label:({i18n:f})=>a?.labels?.singular?qt(a.labels.singular,f):a?.slug,onSelect:({editor:f})=>{f.dispatchCommand(tt,{blockName:"",blockType:a.slug})},order:m})),key:"blocks",order:20}:null,c?.length?{type:"dropdown",ChildComponent:Bo,items:c.map((a,m)=>({isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:f})=>a?.labels?.singular?qt(a.labels.singular,f):a?.slug,onSelect:({editor:f})=>{f.dispatchCommand(ot,{blockName:"",blockType:a.slug})},order:m})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as Hd}from"react/compiler-runtime";import{jsx as je,jsxs as Zo}from"react/jsx-runtime";import{useLexicalComposerContext as Gd}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Ud,$createTextNode as zd,$getRoot as Vd,getDOMSelection as Ko}from"lexical";import*as cl from"react";import{useCallback as Be,useEffect as Xo,useLayoutEffect as il,useRef as Jo,useState as Qt}from"react";var Bd=se&&"documentMode"in document?document.documentMode:null,ll=se&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),V6=se&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),W6=se&&"InputEvent"in window&&!Bd?"getTargetRanges"in new window.InputEvent("input"):!1,K6=se&&/Version\/[\d.].*Safari/.test(navigator.userAgent),X6=se&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,J6=se&&/Android/.test(navigator.userAgent),Z6=se&&/Win/.test(navigator.platform),jd=se&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Y6=se&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!jd;var Wd=t=>{let e=document.createElement("textarea");e.value=t||"",e.style.position="absolute",e.style.opacity="0",document.body?.appendChild(e),e.focus(),e.select();try{let o=document.execCommand("copy");console.log(o)}catch(o){console.error(o)}document.body?.removeChild(e)},Kd=(t,e)=>{let o=document.createElement("a");o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e||"")),o.setAttribute("download",t),o.style.display="none",document.body?.appendChild(o),o.click(),document.body?.removeChild(o)},Xd=t=>{let o=((n,r)=>{switch(n){case"click":return` await page.mouse.click(${r.x}, ${r.y});`;case"keydown":return` await page.keyboard.keydown('${r}');`;case"keyup":return` await page.keyboard.keyup('${r}');`;case"press":return` await page.keyboard.press('${r}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
26
24
  await assertSelection(page, {
27
25
  anchorPath: [${r.anchorPath.toString()}],
28
26
  anchorOffset: ${r.anchorOffset},
@@ -32,7 +30,7 @@ ${p}</${i.blockType}>`}return`<${i.blockType}${d?" "+St({props:a}):""}/>`},handl
32
30
  `;case"type":return` await page.keyboard.type('${r}');`;default:return""}})(t.name,t.value);switch(t.count){case 1:return o;case 2:return[o,o].join(`
33
31
  `);default:return` await repeat(${t.count}, async () => {
34
32
  ${o}
35
- );`}};function j1(t){return t.key.toLowerCase()==="a"&&(fl?t.metaKey:t.ctrlKey)}function H1(t){let{anchorNode:e,focusNode:o}=t,{anchorOffset:n,focusOffset:r}=t;return n!==0&&n--,r!==0&&r--,{anchorNode:e,anchorOffset:n,focusNode:o,focusOffset:r}}function gl(t,e){let o=t,n=[];for(;o!==e;)o!=null&&n.unshift(Array.from(o?.parentNode?.childNodes??[]).indexOf(o)),o=o?.parentNode;return n}var xl=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function U1(t){let[e,o]=to([]),[n,r]=to(!1),[,l]=to(""),[s,i]=to(""),u=Qo(null),c=Qo(!1),d=Qo(null),a=je(()=>t,[t]),m=je(()=>{let b=t.getRootElement(),x=Yo(t._window);return b==null||x==null||x.anchorNode==null||x.focusNode==null||!b.contains(x.anchorNode)||!b.contains(x.focusNode)?null:`
33
+ );`}};function Jd(t){return t.key.toLowerCase()==="a"&&(ll?t.metaKey:t.ctrlKey)}function Zd(t){let{anchorNode:e,focusNode:o}=t,{anchorOffset:n,focusOffset:r}=t;return n!==0&&n--,r!==0&&r--,{anchorNode:e,anchorOffset:n,focusNode:o,focusOffset:r}}function sl(t,e){let o=t,n=[];for(;o!==e;)o!=null&&n.unshift(Array.from(o?.parentNode?.childNodes??[]).indexOf(o)),o=o?.parentNode;return n}var al=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function Yd(t){let[e,o]=Qt([]),[n,r]=Qt(!1),[,l]=Qt(""),[s,i]=Qt(""),u=Jo(null),d=Jo(!1),c=Jo(null),a=Be(()=>t,[t]),m=Be(()=>{let b=t.getRootElement(),C=Ko(t._window);return b==null||C==null||C.anchorNode==null||C.focusNode==null||!b.contains(C.anchorNode)||!b.contains(C.focusNode)?null:`
36
34
  import {
37
35
  initializeE2E,
38
36
  assertHTMLSnapshot,
@@ -49,20 +47,19 @@ describe('Test case', () => {
49
47
  const {page} = e2e;
50
48
 
51
49
  await page.focus('div[contenteditable="true"]');
52
- ${e.map(P1).join(`
50
+ ${e.map(Xd).join(`
53
51
  `)}
54
52
  });
55
53
  });
56
- `},[t,e]),p=je((b,x)=>{o(C=>{let k=e.length-1,T=e[k];if(T&&T.name===b){if(b==="type")return[...e.slice(0,k),{...T,value:T.value+x}];if(T.value===x)return[...e.slice(0,k),{...T,count:T.count+1}]}return[...C,{name:b,count:1,value:x}]})},[e,o]);hl(()=>{let b=C=>{if(!n)return;let k=C.key;j1(C)?p("selectAll",""):xl.has(k)?p("press",C.key):[...k].length>1?p("keydown",C.key):p("type",C.key)},x=C=>{if(!n)return;let k=C.key;!xl.has(k)&&[...k].length>1&&p("keyup",C.key)};return t.registerRootListener((C,k)=>{k!==null&&(k.removeEventListener("keydown",b),k.removeEventListener("keyup",x)),C!==null&&(C.addEventListener("keydown",b),C.addEventListener("keyup",x))})},[t,n,p]),hl(()=>{d.current&&d.current.scrollTo(0,d.current.scrollHeight)},[m]),qo(()=>{if(e){let b=m();b!==null&&i(b),d.current&&d.current.scrollTo(0,d.current.scrollHeight)}},[m,e]),qo(()=>t.registerUpdateListener(({dirtyElements:x,dirtyLeaves:C,editorState:k})=>{if(!n)return;let T=k._selection,I=u.current,N=c.current;if(I!==T){if(C.size===0&&x.size===0&&!N){let S=Yo(t._window);if(S&&(S.anchorNode==null||S.focusNode==null))return}u.current=T}c.current=!1;let w=m();w!==null&&i(w)}),[t,m,n,p]),qo(()=>n?t.registerUpdateListener(()=>{let x=t.getRootElement();x!==null&&l(x?.innerHTML)}):void 0,[t,n]);let h=je(b=>{n||(b.update(()=>{let x=O1();x.clear();let C=$1();x.append(D1().append(C)),C.select()}),o([])),r(x=>!x)},[n]),f=je(()=>{if(!n)return;let b=Yo(t._window);if(b===null||b.anchorNode==null||b.focusNode==null)return;let{anchorNode:x,anchorOffset:C,focusNode:k,focusOffset:T}=H1(b),I=a().getRootElement(),N;x!==null&&(N=gl(x,I));let w;k!==null&&(w=gl(k,I)),p("snapshot",{anchorNode:x,anchorOffset:C,anchorPath:N,focusNode:k,focusOffset:T,focusPath:w})},[p,n,a]),g=je(()=>{F1(m())},[m]),_=je(()=>{B1("test.js",m())},[m]);return[He("button",{className:`editor-dev-button ${n?"active":""}`,id:"test-recorder-button",onClick:b=>{h(a()),b.preventDefault()},title:n?"Disable test recorder":"Enable test recorder",type:"button",children:n?"Disable test recorder":"Enable test recorder"}),n?en("div",{className:"test-recorder-output",children:[en("div",{className:"test-recorder-toolbar",children:[He("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:b=>{f(),b.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),He("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:b=>{g(),b.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),He("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:b=>{_(),b.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),He("pre",{id:"test-recorder",ref:d,children:s})]}):null]}var bl=()=>{let t=M1(3),[e]=A1(),[o,n]=U1(e),r;return t[0]!==o||t[1]!==n?(r=en(Cl.Fragment,{children:[He("p",{children:"HI"}),o,n,He("p",{children:"DONE"})]}),t[0]=o,t[1]=n,t[2]=r):r=t[2],r};var G1=A({plugins:[{Component:bl,position:"bottom"}]});import{c as V1}from"react/compiler-runtime";import{jsx as W1}from"react/jsx-runtime";import{useLexicalComposerContext as z1}from"@lexical/react/LexicalComposerContext.js";import{TreeView as K1}from"@lexical/react/LexicalTreeView.js";import"react";var kl=()=>{let t=V1(2),[e]=z1(),o;return t[0]!==e?(o=W1(K1,{editor:e,timeTravelButtonClassName:"debug-timetravel-button",timeTravelPanelButtonClassName:"debug-timetravel-panel-button",timeTravelPanelClassName:"debug-timetravel-panel",timeTravelPanelSliderClassName:"debug-timetravel-panel-slider",treeTypeButtonClassName:"debug-treetype-button",viewClassName:"tree-view-output"}),t[0]=e,t[1]=o):o=t[1],o};var J1=A({plugins:[{Component:kl,position:"bottom"}]});import{$isTableSelection as Z1}from"@lexical/table";import{$isRangeSelection as Y1,FORMAT_TEXT_COMMAND as q1}from"lexical";import{jsx as _l}from"react/jsx-runtime";import"react";var X1="M14.5 9.25A1.75 1.75 0 0 1 12.75 11H9.5V7.5h3.25c.966 0 1.75.784 1.75 1.75M8 11V7.5A1.5 1.5 0 0 1 9.5 6h3.25a3.25 3.25 0 0 1 2.418 5.422A3.5 3.5 0 0 1 13.5 18h-4A1.5 1.5 0 0 1 8 16.5zm1.5 1.5v4h4a2 2 0 1 0 0-4z",Tl=({className:t})=>_l("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:_l("path",{clipRule:"evenodd",d:X1,fill:"currentColor",fillRule:"evenodd"})});var Z=t=>({type:"buttons",items:t,key:"format",order:40});var El={type:"text-format",format:["bold","italic"],tag:"***"},wl={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Sl={type:"text-format",format:["bold"],tag:"**"},Nl={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var Ll=[Z([{ChildComponent:Tl,isActive:({selection:t})=>Y1(t)||Z1(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(q1,"bold")},order:1}])],Q1=A(({featureProviderMap:t})=>{let e=[Sl,Nl];return t.get("italic")&&e.push(wl,El),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:Ll},toolbarInline:{groups:Ll}}});import{$isTableSelection as tm}from"@lexical/table";import{$isRangeSelection as om,FORMAT_TEXT_COMMAND as nm}from"lexical";import{jsx as Rl}from"react/jsx-runtime";import"react";var em="M9.64645 8.14645C9.84171 7.95118 10.1582 7.95118 10.3535 8.14645C10.5487 8.34171 10.5487 8.65822 10.3535 8.85348L7.20699 12L10.3535 15.1464C10.5487 15.3417 10.5487 15.6582 10.3535 15.8535C10.1582 16.0487 9.84171 16.0487 9.64645 15.8535L6.14645 12.3535C5.95118 12.1582 5.95118 11.8417 6.14645 11.6464L9.64645 8.14645ZM13.6464 8.14645C13.8417 7.95118 14.1582 7.95118 14.3535 8.14645L17.8535 11.6464C18.0487 11.8417 18.0487 12.1582 17.8535 12.3535L14.3535 15.8535C14.1582 16.0487 13.8417 16.0487 13.6464 15.8535C13.4512 15.6582 13.4512 15.3417 13.6464 15.1464L16.7929 12L13.6464 8.85348C13.4512 8.65822 13.4512 8.34171 13.6464 8.14645Z",yl=({className:t})=>Rl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Rl("path",{clipRule:"evenodd",d:em,fill:"currentColor",fillRule:"evenodd"})});var vl={type:"text-format",format:["code"],tag:"`"};var Il=[Z([{ChildComponent:yl,isActive:({selection:t})=>om(t)||tm(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(nm,"code")},order:7}])],rm=A({enableFormats:["code"],markdownTransformers:[vl],toolbarFixed:{groups:Il},toolbarInline:{groups:Il}});import{$isTableSelection as im}from"@lexical/table";import{$isRangeSelection as sm,FORMAT_TEXT_COMMAND as am}from"lexical";import{jsx as Ml}from"react/jsx-runtime";import"react";var lm="M10 6.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-2.083L11.6 17h1.9a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1h2.083L12.4 7h-1.9a.5.5 0 0 1-.5-.5",Al=({className:t})=>Ml("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ml("path",{clipRule:"evenodd",d:lm,fill:"currentColor",fillRule:"evenodd"})});var Dl={type:"text-format",format:["italic"],tag:"*"},$l={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var Ol=[Z([{ChildComponent:Al,isActive:({selection:t})=>sm(t)||im(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(am,"italic")},order:2}])],cm=A({enableFormats:["italic"],markdownTransformers:[Dl,$l],toolbarFixed:{groups:Ol},toolbarInline:{groups:Ol}});import{$isTableSelection as dm}from"@lexical/table";import{$isRangeSelection as mm,FORMAT_TEXT_COMMAND as pm}from"lexical";import{jsx as Fl}from"react/jsx-runtime";import"react";var um="M15.835 13.5a.27.27 0 0 1 .24.138q.306.554.306 1.316 0 1.01-.543 1.816-.543.8-1.554 1.268-1.01.462-2.409.462-1.323 0-2.295-.419-.972-.424-1.534-1.175a3.2 3.2 0 0 1-.533-1.135c-.082-.326.187-.614.522-.614.299 0 .539.233.625.519q.13.43.415.768.448.524 1.17.8.73.271 1.63.272.996 0 1.764-.32.773-.327 1.215-.906a2.16 2.16 0 0 0 .44-1.348q0-.645-.345-1.09c-.1-.132-.016-.352.15-.352zm-3.846-8q1.215 0 2.142.438.933.43 1.476 1.187.38.518.519 1.134c.07.31-.19.577-.507.577-.286 0-.518-.22-.6-.493q-.22-.738-.875-1.224-.864-.646-2.18-.646-.92 0-1.63.313-.703.308-1.1.85a2.04 2.04 0 0 0-.395 1.237q0 .492.217.874.216.376.588.652.376.278.843.475.474.197.972.338l1.052.288H18.5a.5.5 0 0 1 0 1h-13a.5.5 0 0 1 0-1h3.94a4.4 4.4 0 0 1-.844-.602q-.844-.781-.844-1.982 0-1.009.562-1.778t1.522-1.2q.959-.438 2.153-.438",Bl=({className:t})=>Fl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Fl("path",{d:um,fill:"currentColor"})});var Pl={type:"text-format",format:["strikethrough"],tag:"~~"};var jl=[Z([{ChildComponent:Bl,isActive:({selection:t})=>mm(t)||dm(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(pm,"strikethrough")},order:4}])],fm=A({enableFormats:["strikethrough"],markdownTransformers:[Pl],toolbarFixed:{groups:jl},toolbarInline:{groups:jl}});import{$isTableSelection as gm}from"@lexical/table";import{$isRangeSelection as xm,FORMAT_TEXT_COMMAND as Cm}from"lexical";import{jsx as Hl}from"react/jsx-runtime";import"react";var hm="M7.51 15.65a.523.523 0 1 1-.985-.352l2.377-6.534a.83.83 0 0 1 1.56 0l2.374 6.534a.523.523 0 1 1-.985.351L9.722 9.57a.043.043 0 0 0-.08 0zm.162-2.238c0-.252.204-.456.456-.456h3.1a.456.456 0 0 1 0 .912h-3.1a.456.456 0 0 1-.456-.456m6.652 3.925a.436.436 0 0 1-.287-.765l1.64-1.431q.259-.228.433-.407.175-.178.266-.345a.76.76 0 0 0 .091-.365.61.61 0 0 0-.258-.52q-.255-.195-.63-.195-.4 0-.643.21a.7.7 0 0 0-.133.151c-.127.197-.3.403-.534.403s-.432-.194-.367-.418q.11-.378.434-.642.494-.402 1.257-.403.513 0 .897.183.387.181.604.501.217.316.217.714 0 .316-.13.586-.125.27-.395.555a9 9 0 0 1-.695.634l-.927.798a.023.023 0 0 0 .016.042h1.895a.357.357 0 0 1 0 .714z",Ul=({className:t})=>Hl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Hl("path",{d:hm,fill:"currentColor"})});var Gl=[Z([{ChildComponent:Ul,isActive:({selection:t})=>xm(t)||gm(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Cm,"subscript")},order:5}])],bm=A({enableFormats:["subscript"],toolbarFixed:{groups:Gl},toolbarInline:{groups:Gl}});import{$isTableSelection as _m}from"@lexical/table";import{$isRangeSelection as Tm,FORMAT_TEXT_COMMAND as Em}from"lexical";import{jsx as Vl}from"react/jsx-runtime";import"react";var km="M7.51 15.65a.523.523 0 1 1-.985-.352l2.377-6.534a.83.83 0 0 1 1.56 0l2.374 6.534a.523.523 0 1 1-.985.351L9.722 9.57a.043.043 0 0 0-.08 0zm.162-2.238c0-.252.204-.456.456-.456h3.1a.456.456 0 0 1 0 .912h-3.1a.456.456 0 0 1-.456-.456m6.652-1.303a.436.436 0 0 1-.287-.765l1.64-1.432q.259-.228.433-.406.175-.179.266-.346a.76.76 0 0 0 .091-.365.61.61 0 0 0-.258-.52q-.255-.195-.63-.194-.4 0-.643.209a.7.7 0 0 0-.133.152c-.127.196-.3.403-.534.403s-.432-.194-.367-.419q.11-.378.434-.641.494-.403 1.257-.403.513 0 .897.182.387.183.604.502.217.315.217.714 0 .315-.13.585-.125.27-.395.555a9 9 0 0 1-.695.635l-.927.798a.023.023 0 0 0 .016.041h1.895a.357.357 0 1 1 0 .715z",Wl=({className:t})=>Vl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Vl("path",{d:km,fill:"currentColor"})});var zl=[Z([{ChildComponent:Wl,isActive:({selection:t})=>Tm(t)||_m(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Em,"superscript")},order:6}])],wm=A({enableFormats:["superscript"],toolbarFixed:{groups:zl},toolbarInline:{groups:zl}});import{$isTableSelection as Nm}from"@lexical/table";import{$isRangeSelection as Lm,FORMAT_TEXT_COMMAND as Rm}from"lexical";import{jsx as Kl}from"react/jsx-runtime";import"react";var Sm="M9 7.5a.5.5 0 0 0-1 0V12a4 4 0 0 0 8 0V7.5a.5.5 0 0 0-1 0V12a3 3 0 1 1-6 0zM16.5 19a.5.5 0 0 0 0-1h-9a.5.5 0 0 0 0 1z",Jl=({className:t})=>Kl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Kl("path",{clipRule:"evenodd",d:Sm,fill:"currentColor",fillRule:"evenodd"})});var Xl=[Z([{ChildComponent:Jl,isActive:({selection:t})=>Lm(t)||Nm(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Rm,"underline")},order:3}])],ym=A({enableFormats:["underline"],toolbarFixed:{groups:Xl},toolbarInline:{groups:Xl}});import{jsx as on}from"react/jsx-runtime";import{jsx as vm}from"react/jsx-runtime";function Im(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var oo=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,n])=>[Im(o),n])):{};return vm("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as Mm}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as Am}from"@lexical/selection";import{$getNodeByKey as Dm,$getState as $m,$setState as Om,createState as Fm,TextNode as Bm}from"lexical";import{useEffect as Pm}from"react";function Zl(t){let e=new Map;for(let o in t){let n=t[o],r=Fm(o,{parse:l=>typeof l=="string"&&Object.keys(n).includes(l)?l:void 0});e.set(o,{stateConfig:r,stateValues:n})}return e}function tn(t,e,o,n){t.update(()=>{Am(r=>{let l=e.get(o);if(!l)throw new Error(`State config for ${o} not found`);Om(r,l.stateConfig,n)})})}function Yl({stateMap:t}){let[e]=Mm();return Pm(()=>e.registerMutationListener(Bm,o=>{e.getEditorState().read(()=>{for(let[n,r]of o){if(r==="destroyed")continue;let l=Dm(n),s=e.getElementByKey(n);if(!l||!s)continue;let i=Object.create(null);t.forEach((u,c)=>{let d=$m(l,u.stateConfig);if(!d){delete s.dataset[c];return}s.dataset[c]=d;let a=u.stateValues[d]?.css;a&&Object.assign(i,a)}),s.style.cssText="",Object.assign(s.style,i)}})}),[e]),null}var ql=(t,e)=>{let o=[];for(let r in t.state){let l=t.state[r];for(let s in l){let i=l[s];o.push({ChildComponent:()=>on(oo,{css:i.css}),key:s,label:i.label,onSelect:({editor:u})=>{tn(u,e,r,s)}})}}return[{type:"dropdown",ChildComponent:()=>on(oo,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>on(oo,{}),key:"clear-style",label:({i18n:r})=>r.t("lexical:textState:defaultStyle"),onSelect:({editor:r})=>{for(let l in t.state)tn(r,e,l,void 0)},order:1}],...o],key:"textState",order:30}]},jm=A(({props:t})=>{let e=Zl(t.state);return{plugins:[{Component:()=>Yl({stateMap:e}),position:"normal"}],toolbarFixed:{groups:ql(t,e)},toolbarInline:{groups:ql(t,e)}}});import{c as Zm}from"react/compiler-runtime";import{useLexicalComposerContext as Ym}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as qm,$isHeadingNode as mi,HeadingNode as hi}from"@lexical/rich-text";import{$setBlocksType as Qm}from"@lexical/selection";import{$getSelection as ep,$isRangeSelection as tp}from"lexical";import{useEffect as op}from"react";import{jsx as Ql}from"react/jsx-runtime";import"react";var Hm="M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7zm11 6a.5.5 0 0 0-.777-.416l-1.5 1a.5.5 0 1 0 .554.832l.723-.482V17.5a.5.5 0 0 0 1 0z",ei=({className:t})=>Ql("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ql("path",{d:Hm,fill:"currentColor"})});import{jsx as ti}from"react/jsx-runtime";import"react";var Um="M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7zm9.034 10.952c0 .303.245.548.548.548h2.97a.448.448 0 0 0 0-.896H17.48v-.04l.997-1.038q.562-.555.873-.945.314-.39.438-.711t.124-.653q0-.497-.245-.885a1.7 1.7 0 0 0-.684-.61A2.24 2.24 0 0 0 17.96 12a2.2 2.2 0 0 0-1.017.228 1.71 1.71 0 0 0-.888 1.13c-.064.268.168.495.444.495.275 0 .479-.236.595-.485l.019-.039q.12-.22.333-.338a1 1 0 0 1 .5-.121q.278 0 .495.11a.83.83 0 0 1 .341.312.9.9 0 0 1 .125.48q0 .245-.096.462t-.288.448-.48.529l-1.85 1.854a.55.55 0 0 0-.16.387",oi=({className:t})=>ti("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:ti("path",{d:Um,fill:"currentColor"})});import{jsx as ni}from"react/jsx-runtime";import"react";var Gm="M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",ri=({className:t})=>ni("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:ni("path",{d:Gm,fill:"currentColor"})});import{jsx as li}from"react/jsx-runtime";import"react";var Vm="M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",ii=({className:t})=>li("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:li("path",{d:Vm,fill:"currentColor"})});import{jsx as si}from"react/jsx-runtime";import"react";var Wm="M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.1576 10.269C12.6896 10.269 12.3746 10.494 12.2216 10.737H10.8176L11.1956 7.074H15.2546V8.28H12.3206L12.1856 9.549C12.4016 9.351 12.8516 9.126 13.4636 9.126C14.7866 9.126 15.6596 10.053 15.6596 11.358C15.6596 12.609 14.7326 13.608 13.1756 13.608C11.5826 13.608 10.6556 12.753 10.5566 11.511H12.1136C12.1586 12.06 12.5456 12.465 13.1576 12.465C13.8236 12.465 14.1746 11.97 14.1746 11.376C14.1746 10.764 13.8416 10.269 13.1576 10.269Z",ai=({className:t})=>si("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:si("path",{d:Wm,fill:"currentColor"})});import{jsx as ci}from"react/jsx-runtime";import"react";var zm="M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.3646 8.127C12.5456 8.127 12.0416 8.937 12.0416 9.999C12.3296 9.54 12.8246 9.207 13.5536 9.207C14.8586 9.207 15.8036 10.134 15.8036 11.376C15.8036 12.645 14.8226 13.608 13.3196 13.608C11.7266 13.608 10.6196 12.393 10.6196 10.395C10.6196 8.316 11.7716 6.966 13.4186 6.966C14.7056 6.966 15.5786 7.749 15.7316 8.829H14.3186C14.2016 8.415 13.9226 8.127 13.3646 8.127ZM13.3106 12.51C13.9586 12.51 14.3816 12.042 14.3816 11.385C14.3816 10.737 13.9586 10.278 13.3106 10.278C12.6536 10.278 12.2126 10.737 12.2126 11.385C12.2126 12.042 12.6536 12.51 13.3106 12.51Z",ui=({className:t})=>ci("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:ci("path",{d:zm,fill:"currentColor"})});import{$createHeadingNode as Km,$isHeadingNode as Jm,HeadingNode as Xm}from"@lexical/rich-text";var nn=t=>(e,o,n)=>{let r=t(n);r&&(r.append(...o),e.replace(r),r.select(0,0))};var di=t=>{let o=`^(${t.map(r=>Number(r.slice(1))).map(r=>`#{${r}}`).join("|")})\\s`,n=new RegExp(o);return{type:"element",dependencies:[Xm],export:(r,l)=>{if(!Jm(r))return null;let s=Number(r.getTag().slice(1));return"#".repeat(s)+" "+l(r)},regExp:n,replace:nn(r=>{let l="h"+r[1]?.length;return Km(l)})}};var pi=t=>{let e=ep();Qm(e,()=>qm(t))},fi={h1:ei,h2:oi,h3:ri,h4:ii,h5:ai,h6:ui},np=A(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[te(e.map((n,r)=>({ChildComponent:fi[n],isActive:({selection:l})=>{if(!tp(l))return!1;for(let s of l.getNodes()){if(mi(s)&&s.getTag()===n)continue;let i=s.getParent();if(!(mi(i)&&i.getTag()===n))return!1}return!0},key:n,label:({i18n:l})=>l.t("lexical:heading:label",{headingLevel:n.charAt(1)}),onSelect:({editor:l})=>{l.update(()=>{pi(n)})},order:r+2})))];return{markdownTransformers:[di(e)],nodes:[hi],plugins:[{Component:rp,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[X(e.map(n=>({Icon:fi[n],key:`heading-${n.charAt(1)}`,keywords:["heading",n],label:({i18n:r})=>r.t("lexical:heading:label",{headingLevel:n.charAt(1)}),onSelect:({editor:r})=>{r.update(()=>{pi(n)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),rp=t=>{let e=Zm(9),{clientProps:o}=t,{enabledHeadingSizes:n}=o,r;e[0]!==n?(r=n===void 0?["h1","h2","h3","h4","h5","h6"]:n,e[0]=n,e[1]=r):r=e[1];let l=r,s;e[2]!==l?(s=l.at(-1),e[2]=l,e[3]=s):s=e[3];let i=s,[u]=Ym(),c,d;return e[4]!==u||e[5]!==l||e[6]!==i?(c=()=>{if(!(!i||l.length===6))return u.registerNodeTransform(hi,a=>{l.includes(a.getTag())||a.setTag(i)})},d=[u,l,i],e[4]=u,e[5]=l,e[6]=i,e[7]=c,e[8]=d):(c=e[7],d=e[8]),op(c,d),null};import{$isNodeSelection as Tp}from"lexical";import{jsx as gi}from"react/jsx-runtime";import"react";var lp="M18 12a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1 0-1h11a.5.5 0 0 1 .5.5",rn=({className:t})=>gi("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:gi("path",{d:lp,fill:"currentColor"})});import{jsx as xi}from"react/jsx-runtime";import"react";var ip={16:"M8.5 3.5a.5.5 0 0 0-1 0v4h-4a.5.5 0 0 0 0 1h4v4a.5.5 0 0 0 1 0v-4h4a.5.5 0 0 0 0-1h-4z",24:"M12 6a.5.5 0 0 1 .5.5v5h5a.5.5 0 0 1 0 1h-5v5a.5.5 0 0 1-1 0v-5h-5a.5.5 0 0 1 0-1h5v-5A.5.5 0 0 1 12 6"},Ci=({className:t,size:e=24})=>xi("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:xi("path",{clipRule:"evenodd",d:ip[e],fill:"currentColor",fillRule:"evenodd"})});var _e=t=>({type:"dropdown",ChildComponent:Ci,items:t,key:"add",order:10});import{addClassNamesToElement as sp}from"@lexical/utils";import{$applyNodeReplacement as ap,createCommand as cp,DecoratorNode as up}from"lexical";var yt=cp("INSERT_HORIZONTAL_RULE_COMMAND"),Rt=class extends up{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:dp,priority:0})}}static importJSON(e){return bi()}createDOM(e){let o=document.createElement("hr");return sp(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
57
- `}isInline(){return!1}updateDOM(){return!1}};function dp(){return{node:bi()}}function bi(){return ap(new Rt)}import{$applyNodeReplacement as mp}from"lexical";import"react";var Te=class extends Rt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return nt()}decorate(){return null}exportJSON(){return super.exportJSON()}};function nt(){return mp(new Te)}function Ue(t){return t instanceof Te}var ki={type:"element",dependencies:[Te],export:(t,e)=>Ue(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=nt();e&&t.replace(e)}};import{c as pp}from"react/compiler-runtime";import{useLexicalComposerContext as fp}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as _i,$insertNodeToNearestRoot as hp}from"@lexical/utils";import{$getRoot as gp,$getSelection as Ti,$isRangeSelection as Ei,$isRootOrShadowRoot as wi,COMMAND_PRIORITY_EDITOR as xp}from"lexical";import{useEffect as Cp}from"react";var ln="LexicalEditorTheme__hrSelected",Si=()=>{let t=pp(3),[e]=fp(),o,n;return t[0]!==e?(o=()=>{let r=e.registerCommand(yt,bp,xp),l=e.registerUpdateListener(s=>{let{editorState:i}=s;i.read(()=>{let c=gp().getChildren(),d=Ti(),a=[];for(let b=0;b<c.length;b++){let x=c[b];if(Ue(x)){let C=e.getElementByKey(x.getKey());C&&a.push({element:C,index:b})}}if(a.length===0)return;if(!Ei(d)||d.isCollapsed()){for(let{element:b}of a)b.classList.remove(ln);return}let m=d.anchor.getNode(),p=d.focus.getNode(),h=_i(m,kp)||m,f=_i(p,_p)||p,g=c.indexOf(h),_=c.indexOf(f);if(g===-1||_===-1)return;let L=Math.min(g,_),v=Math.max(g,_);for(let{element:b,index:x}of a)x>=L&&x<=v?b.classList.add(ln):b.classList.remove(ln)})});return()=>{r(),l()}},n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Cp(o,n),null};function bp(t){let e=Ti();if(!Ei(e))return!1;if(e.focus.getNode()!==null){let n=nt();hp(n)}return!0}function kp(t){return wi(t.getParent())}function _p(t){return wi(t.getParent())}var Ep=A({markdownTransformers:[ki],nodes:[Te],plugins:[{Component:Si,position:"normal"}],slashMenu:{groups:[X([{Icon:rn,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(yt,void 0)}}])]},toolbarFixed:{groups:[_e([{ChildComponent:rn,isActive:({selection:t})=>{if(!Tp(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Ue(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(yt,void 0)}}])]}});import{$findMatchingParent as Oi}from"@lexical/utils";import{$isElementNode as Op,INDENT_CONTENT_COMMAND as Fp,OUTDENT_CONTENT_COMMAND as Bp}from"lexical";import{jsx as sn}from"react/jsx-runtime";import"react";var wp="M7.854 6.146a.5.5 0 1 0-.708.708L8.293 8H5.5a.5.5 0 0 0 0 1h2.793l-1.147 1.146a.5.5 0 0 0 .708.708l2-2a.5.5 0 0 0 0-.708zM11.5 8a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1zM5 12.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1z",Ni=({className:t})=>sn("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:sn("g",{transform:"scale(-1, 1) translate(-24, 0)",children:sn("path",{clipRule:"evenodd",d:wp,fill:"currentColor",fillRule:"evenodd"})})});import{jsx as Li}from"react/jsx-runtime";import"react";var Sp="M7.854 6.146a.5.5 0 1 0-.708.708L8.293 8H5.5a.5.5 0 0 0 0 1h2.793l-1.147 1.146a.5.5 0 0 0 .708.708l2-2a.5.5 0 0 0 0-.708zM11.5 8a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1zM5 12.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1z",Ri=({className:t})=>Li("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Li("path",{clipRule:"evenodd",d:Sp,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Np}from"react/jsx-runtime";import{useLexicalComposerContext as Lp}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as Rp}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as yp,mergeRegister as yi}from"@lexical/utils";import{$getSelection as vp,$isElementNode as Ai,$isRangeSelection as Ip,COMMAND_PRIORITY_LOW as vi,INDENT_CONTENT_COMMAND as Ii,KEY_TAB_COMMAND as Mp,OUTDENT_CONTENT_COMMAND as Ap,TabNode as Dp}from"lexical";import{useEffect as Mi}from"react";var Di=({clientProps:t})=>{let[e]=Lp(),{disabledNodes:o,disableTabNode:n}=t;return Mi(()=>{if(!(!e||!o?.length))return yi(e.registerCommand(Ii,()=>$p(r=>{if(!o.includes(r.getType())){let l=r.getIndent();r.setIndent(l+1)}}),vi),e.registerUpdateListener(({dirtyElements:r,editorState:l})=>{e.update(()=>{for(let[s]of r){let i=l._nodeMap.get(s);Ai(i)&&o.includes(i.getType())&&i.getIndent()>0&&i.setIndent(0)}})}))},[e,o]),Mi(()=>{if(!(!e||!n))return yi(e.registerCommand(Mp,r=>(r.preventDefault(),e.dispatchCommand(r.shiftKey?Ap:Ii,void 0)),vi),e.registerNodeTransform(Dp,r=>{r.remove()}))},[e,n]),Np(Rp,{})};function $p(t){let e=vp();if(!Ip(e))return!1;let o=new Set,n=e.getNodes();for(let r=0;r<n.length;r++){let l=n[r],s=l.getKey();if(o.has(s))continue;let i=yp(l,c=>Ai(c)&&!c.isInline());if(i===null)continue;let u=i.getKey();i.canIndent()&&!o.has(u)&&(o.add(u),t(i))}return o.size>0}var $i=t=>({type:"buttons",items:t,key:"indent",order:35});var Fi=({disabledNodes:t})=>[$i([{ChildComponent:Ni,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],n=r=>Bi(r)&&r.getIndent()>0;return o.some(r=>n(r)||!!Oi(r,n))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Bp,void 0)},order:1},{ChildComponent:Ri,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],n=r=>Bi(r)&&!(t??[]).includes(r.getType());return o.some(r=>n(r)||!!Oi(r,n))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Fp,void 0)},order:2}])],Pp=A(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:Di,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:Fi({disabledNodes:e})},toolbarInline:{groups:Fi({disabledNodes:e})}}}),Bi=t=>Op(t)&&t.canIndent();import{$findMatchingParent as n0}from"@lexical/utils";import{$getSelection as Cn,$isRangeSelection as bs}from"lexical";import{jsx as Pi}from"react/jsx-runtime";import"react";var jp={16:"M8.38 6.381a.29.29 0 0 1 .347-.056q.293.161.541.408a2.5 2.5 0 0 1 0 3.535l-2 2a2.5 2.5 0 0 1-3.535-3.535l.571-.573c.25-.249.692-.107.81.224a.46.46 0 0 1-.098.478l-.576.578a1.5 1.5 0 1 0 2.121 2.12l2-2a1.5 1.5 0 0 0 0-2.12c-.23-.23-.493-.509-.358-.805a.9.9 0 0 1 .178-.254m.352-2.648a2.5 2.5 0 1 1 3.535 3.535l-.471.47c-.253.254-.717.082-.819-.261a.44.44 0 0 1 .102-.435l.481-.481A1.5 1.5 0 0 0 9.44 4.44l-2 2a1.5 1.5 0 0 0 0 2.12c.136.138.168.365.031.502l-.182.181c-.154.154-.403.179-.557.025a2.5 2.5 0 0 1 0-3.535z",24:"M12.4436 10.3708C12.6861 10.5041 12.9148 10.6721 13.1204 10.8776C14.2919 12.0492 14.2918 13.9482 13.1204 15.1198L11.1204 17.1198C9.94879 18.2914 8.04975 18.2914 6.87817 17.1198C5.70664 15.9482 5.70661 14.0492 6.87817 12.8776L8.1477 11.6071C8.4098 11.345 8.89329 11.5392 8.97388 11.9011C9.00617 12.0462 8.96861 12.2012 8.86353 12.3063L7.5852 13.5847C6.80417 14.3657 6.80419 15.6317 7.5852 16.4128C8.36625 17.1938 9.63228 17.1938 10.4133 16.4128L12.4133 14.4128C13.1942 13.6317 13.1943 12.3657 12.4133 11.5847C12.4042 11.5755 12.3953 11.5662 12.386 11.5573C12.2925 11.468 12.1984 11.3736 12.1614 11.2497C12.0724 10.9515 12.1448 10.6149 12.3801 10.3796C12.397 10.3628 12.4228 10.3594 12.4436 10.3708ZM12.8782 6.87764C14.0497 5.70615 15.9488 5.70616 17.1204 6.87764C18.2919 8.04919 18.2919 9.94825 17.1204 11.1198L15.8508 12.3903C15.5887 12.6522 15.1053 12.4581 15.0247 12.0964C14.9924 11.9512 15.0308 11.7963 15.136 11.6911L16.4133 10.4128C17.1943 9.63175 17.1943 8.3657 16.4133 7.58467C15.6323 6.80371 14.3662 6.8037 13.5852 7.58467L11.5852 9.58467C10.8046 10.3657 10.8044 11.6319 11.5852 12.4128C11.5943 12.4219 11.6042 12.4303 11.6135 12.4392C11.7064 12.5278 11.7999 12.622 11.8372 12.7448C11.9276 13.044 11.8545 13.3827 11.6184 13.6188C11.6023 13.6347 11.5778 13.6383 11.5579 13.6276C11.3146 13.4942 11.0843 13.3259 10.8782 13.1198C9.7068 11.9484 9.707 10.0492 10.8782 8.87764L12.8782 6.87764Z"},no=({className:t,size:e=24})=>Pi("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Pi("path",{d:jp[e],fill:"currentColor"})});import{$isAtNodeEnd as ji}from"@lexical/selection";function rt(t){let{anchor:e}=t,{focus:o}=t,n=t.anchor.getNode(),r=t.focus.getNode();return n===r?n:t.isBackward()?ji(o)?n:r:ji(e)?n:r}var an=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Qp}from"lexical";function cn(t){let e=/^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi,o=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z\d+/]+=*$/i;return t=String(t).trim(),t.match(e)!=null||t.match(o)!=null?t:"https://"}var Hp=/^(?:[a-zA-Z][a-zA-Z\d+.-]*:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|www\.[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|(?:tel|mailto):[\w+.-]+)(?:\/[+~%/\w-]*)?(?:\?[-;&=%\w]*)?(?:#\w+)?$/,Up=/^(?:\/[\w\-./]*(?:\?[-;&=%\w]*)?(?:#[\w-]+)?|#[\w\-]+)$/;function Hi(t){if(!t||t.includes(" ")||/^[a-z][a-z\d+.-]*:\/[^/]/i.test(t))return!1;if(t==="https://"||Hp.test(t)||Up.test(t))return!0;try{let e=new URL(t);return!(["ftp:","http:","https:"].includes(e.protocol)&&!e.hostname.includes("."))}catch{}return!1}import{addClassNamesToElement as Gp,isHTMLAnchorElement as Vp}from"@lexical/utils";import mn from"bson-objectid";import{$applyNodeReplacement as Wp,$createTextNode as Ui,$getSelection as zp,$isElementNode as Gi,$isRangeSelection as dn,createCommand as Kp,ElementNode as Jp}from"lexical";var Xp=new Set(["http:","https:","mailto:","sms:","tel:"]),oe=class extends Jp{__fields;__id;constructor({id:e,fields:o={linkType:"custom",newTab:!1},key:n}){super(n),this.__fields=o,this.__id=e}static clone(e){return new this({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:Zp,priority:1})}}static importJSON(e){let o=Ee({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new mn.default().toHexString(),e.version=3),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=un(o.rel,"add","noopener")),Gp(o,e.theme.link),o}exportJSON(){let e=this.getFields();e?.linkType==="internal"?delete e.url:e?.linkType==="custom"&&delete e.doc;let o={...super.exportJSON(),type:"link",fields:e,version:3},n=this.getID();return n&&(o.id=n),o}extractWithChild(e,o,n){if(!dn(o))return!1;let r=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(r)&&this.isParentOf(l)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let n=this.getParentOrThrow().insertNewAfter(e,o);if(Gi(n)){let r=Ee({fields:this.__fields});return n.append(r),r}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!Xp.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,n){let r=this.__fields?.url,l=this.__fields?.newTab;return r!=null&&r!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=r),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),l!==e.__fields?.newTab&&(l??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=un(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=un(o.rel,"remove","noopener"))),!1}updateFromJSON(e){let o=e;return super.updateFromJSON(o).setFields(o.fields).setID(o.id)}};function Zp(t){let e=null;if(Vp(t)){let o=t.textContent;o!==null&&o!==""&&(e=Ee({id:new mn.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function Ee({id:t,fields:e}){return Wp(new oe({id:t??new mn.default().toHexString(),fields:e}))}function K(t){return t instanceof oe}var pe=Kp("TOGGLE_LINK_COMMAND");function pn(t){let e=zp();if(!dn(e)&&(t===null||!t.selectedNodes?.length))return;let o=dn(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let s=l.getParent();K(s)&&(s.getChildren().forEach(u=>{s.insertBefore(u)}),s.remove())});return}if(o?.length===1){let l=o[0],s=K(l)?l:Yp(l);if(s!==null){s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(Ui(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}}let n=null,r=null;o?.forEach(l=>{let s=l.getParent();if(!(s===r||s===null||Gi(l)&&!l.isInline())){if(K(s)){r=s,s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(Ui(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}if(s.is(n)||(n=s,r=Ee({fields:t.fields}),K(s)?l.getPreviousSibling()===null?s.insertBefore(r):s.insertAfter(r):l.insertBefore(r)),K(l)){if(l.is(r))return;if(r!==null){let i=l.getChildren();r.append(...i)}l.remove();return}r!==null&&r.append(l)}})}function Yp(t){return qp(t,e=>K(e))}function qp(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function un(t,e,o){let n,r=`${t}`;if(e==="add"){if(r.includes(o)){let l=new RegExp(o,"g");r=r.replace(l,"").trim()}r=r.trim(),n=r.length===0?`${o}`:`${r} ${o}`}else{let l=new RegExp(o,"g");n=r.replace(l,"").trim()}return n}var ef=(t,e)=>{let[,o,n]=e,r=Ee({fields:{doc:null,linkType:"custom",newTab:!1,url:n}}),l=Qp(o);return l.setFormat(t.getFormat()),r.append(l),t.replace(r),l},tf=t=>({type:"text-match",dependencies:[oe],export:(e,o)=>{if(!K(e))return null;let n=e,r=n.getFields(),l;return r.linkType==="internal"?t?.internalDocToHref?l=cn(t.internalDocToHref({linkNode:n.exportJSON()})):(console.warn("Lexical \u2192 Markdown converter: found internal link but internalDocToHref is not provided \u2014 link will have an empty href"),l=""):l=cn(r.url??""),`[${o(n)}](${l})`},importRegExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:ef,trigger:")"}),Vi=tf();import{$applyNodeReplacement as of,$isElementNode as nf}from"lexical";var we=class extends oe{static clone(e){return new this({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=vt({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let n=this.getParentOrThrow().insertNewAfter(e,o);if(nf(n)){let r=vt({fields:this.__fields});return n.append(r),r}return null}updateFromJSON(e){let o=e;return super.updateFromJSON(o).setFields(o.fields)}};function vt({fields:t}){return of(new we({id:"",fields:t}))}function Se(t){return t instanceof we}import{c as rf}from"react/compiler-runtime";import{useLexicalComposerContext as lf}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as sf}from"@lexical/utils";import{$createTextNode as Wi,$getSelection as af,$isElementNode as Ki,$isLineBreakNode as Ji,$isNodeSelection as cf,$isRangeSelection as uf,$isTextNode as It,TextNode as df}from"lexical";import{useEffect as mf}from"react";function zi(t,e=o=>o){return o=>{let n=t.exec(o);return n===null?null:{index:n.index,length:n[0].length,text:n[0],url:e(n[0])}}}function Xi(t,e){for(let o of e){let n=o(t);if(n!=null)return n}return null}var pf=/[.,;\s]/;function lo(t){return t!==void 0&&pf.test(t)}function Zi(t){return lo(t[t.length-1])}function hn(t){return lo(t[0])}function ff(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Yi(t){let e=t.getPreviousSibling();return Ki(e)&&(e=e.getLastDescendant()),e===null||Ji(e)||It(e)&&Zi(e.getTextContent())}function qi(t){let e=t.getNextSibling();return Ki(e)&&(e=e.getFirstDescendant()),e===null||Ji(e)||It(e)&&hn(e.getTextContent())}function hf(t,e,o,n){return(t>0?lo(o[t-1]):Yi(n[0]))?e<o.length?lo(o[e]):qi(n[n.length-1]):!1}function gf(t,e,o){let n=[],r=[],l=[],s=0,i=0,u=[...t];for(;u.length>0;){let c=u[0],a=c.getTextContent().length,m=i;i+a<=e?(n.push(c),s+=a):m>=o?l.push(c):r.push(c),i+=a,u.shift()}return[s,n,r,l]}function xf(t,e,o,n){let r={linkType:"custom",url:n.url,...n.fields},l=vt({fields:r});if(t.length===1){let s=t[0],i;if(e===0?[i]=s.splitText(o):[,i]=s.splitText(e,o),i){let u=Wi(n.text);u.setFormat(i.getFormat()),u.setDetail(i.getDetail()),u.setStyle(i.getStyle()),l.append(u),i.replace(l)}return s}else if(t.length>1){let s=t[0],i=s.getTextContent().length,u;e===0?u=s:[,u]=s.splitText(e);let c=[],d;if(t.forEach(a=>{let p=a.getTextContent().length,h=i,f=i+p;if(h<o)if(f<=o)c.push(a);else{let[g,_]=a.splitText(o-h);g&&c.push(g),d=_}i+=p}),u){let a=af(),m=a?a.getNodes().find(It):void 0,p=Wi(u.getTextContent());return p.setFormat(u.getFormat()),p.setDetail(u.getDetail()),p.setStyle(u.getStyle()),l.append(p,...c),m&&m===u&&(uf(a)?p.select(a.anchor.offset,a.focus.offset):cf(a)&&p.select(0,p.getTextContent().length)),u.replace(l),d}}}function Cf(t,e,o){let n=[...t],r=n.map(u=>u.getTextContent()).join(""),l=r,s,i=0;for(;(s=Xi(l,e))!=null&&s!==null;){let u=s.index,c=s.length,d=u+c;if(hf(i+u,i+d,r,n)){let[m,,p,h]=gf(n,i+u,i+d),f=i+u-m,g=i+d-m,_=xf(p,f,g,s);n=_?[_,...h]:h,o(s.url,null),i=0}else i+=d;l=l.substring(d)}}function fn(t,e,o){let n=t.getChildren(),r=n.length;for(let u=0;u<r;u++){let c=n[u];if(!It(c)||!c.isSimpleText()){ro(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),s=Xi(l,e);if(s===null||s.text!==l){ro(t),o(null,t.getFields()?.url??null);return}if(!Yi(t)||!qi(t)){ro(t),o(null,t.getFields()?.url??null);return}let i=t.getFields()?.url;if(i!==s?.url){let u=t.getFields();u.url=s?.url,t.setFields(u),o(s.url,i??null)}}function bf(t,e,o){let n=t.getPreviousSibling(),r=t.getNextSibling(),l=t.getTextContent();if(Se(n)){let s=n.getFields()?.url?n.getFields()?.url?.startsWith("mailto:")??!1:!1;(!hn(l)||ff(l,s))&&(n.append(t),fn(n,e,o),o(null,n.getFields()?.url??null))}Se(r)&&!Zi(l)&&(ro(r),fn(r,e,o),o(null,r.getFields()?.url??null))}function ro(t){let e=t.getChildren(),o=e.length;for(let n=o-1;n>=0;n--)t.insertAfter(e[n]);return t.remove(),e.map(n=>n.getLatest())}function kf(t){let e=[t],o=t.getNextSibling();for(;o!==null&&It(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function _f(t,e,o){let n=rf(5),r,l;n[0]!==t||n[1]!==e||n[2]!==o?(r=()=>{if(!t.hasNodes([we]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let s=(i,u)=>{o?.(i,u)};return sf(t.registerNodeTransform(df,i=>{let u=i.getParentOrThrow(),c=i.getPreviousSibling();if(Se(u))fn(u,e,s);else if(!K(u)){if(i.isSimpleText()&&(hn(i.getTextContent())||!Se(c))){let d=kf(i);Cf(d,e,s)}bf(i,e,s)}}))},l=[t,e,o],n[0]=t,n[1]=e,n[2]=o,n[3]=r,n[4]=l):(r=n[3],l=n[4]),mf(r,l)}var Tf=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Ef=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,wf=[zi(Tf,t=>t.startsWith("http")?t:`https://${t}`),zi(Ef,t=>`mailto:${t}`)],Qi=()=>{let[t]=lf();return _f(t,wf),null};import{jsx as Sf}from"react/jsx-runtime";import{ClickableLinkPlugin as Nf}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var es=()=>Sf(Nf,{});import{jsx as zf}from"react/jsx-runtime";import"react";import{createPortal as Kf}from"react-dom";import{jsx as ne,jsxs as Ge,Fragment as gn}from"react/jsx-runtime";import{useLexicalComposerContext as yf}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as vf}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as is,mergeRegister as ss}from"@lexical/utils";import{getTranslation as xn}from"@payloadcms/translations";import{ExternalLinkIcon as as,formatDrawerSlug as If,useConfig as Mf,useEditDepth as Af,useLocale as Df,useTranslation as $f,WriteIcon as Of}from"@payloadcms/ui";import{requests as Ff}from"@payloadcms/ui/shared";import{$getSelection as cs,$isLineBreakNode as Bf,$isRangeSelection as us,COMMAND_PRIORITY_HIGH as Pf,COMMAND_PRIORITY_LOW as ds,getDOMSelection as jf,KEY_ESCAPE_COMMAND as Hf,SELECTION_CHANGE_COMMAND as Uf}from"lexical";import{formatAdminURL as Gf}from"payload/shared";import Vf,{useCallback as ms,useEffect as ao,useLayoutEffect as Wf,useRef as ps,useState as Ve}from"react";import{jsx as ts}from"react/jsx-runtime";import"react";var Lf="M12.5 5C12.6326 5 12.7597 5.05272 12.8535 5.14648L16.8535 9.14648C16.9965 9.28948 17.0393 9.50457 16.9619 9.69141C16.8845 9.87821 16.7022 10 16.5 10H12.5C12.2239 10 12 9.77614 12 9.5V6H8.5C8.22386 6 8 6.22386 8 6.5V17.5C8 17.7761 8.22386 18 8.5 18H15.5C15.7761 18 16 17.7761 16 17.5V11.5C16 11.2239 16.2239 11 16.5 11C16.7761 11 17 11.2239 17 11.5V17.5C17 18.3284 16.3284 19 15.5 19H8.5C7.67157 19 7 18.3284 7 17.5V6.5C7 5.67157 7.67157 5 8.5 5H12.5ZM13 9H15.293L13 6.70703V9Z",os=({className:t})=>ts("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:ts("path",{d:Lf,fill:"currentColor"})});import{jsx as ns}from"react/jsx-runtime";import"react";var rs={default:"M6 5a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .496.5h12.008a.5.5 0 0 0 .496-.5v-1A.5.5 0 0 0 18 5zM4.5 6.5a1.5 1.5 0 0 0 1.037 1.427L5.725 10H5a.5.5 0 0 0 0 1h.816l.653 7.181A2 2 0 0 0 8.46 20h7.078a2 2 0 0 0 1.992-1.819L18.184 11H19a.5.5 0 0 0 0-1h-.725l.188-2.073A1.5 1.5 0 0 0 19.5 6.5v-1A1.5 1.5 0 0 0 18 4H6a1.5 1.5 0 0 0-1.5 1.5zm2.965 11.59L6.548 8h10.905l-.918 10.09a1 1 0 0 1-.996.91H8.461a1 1 0 0 1-.996-.91M11 10.5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0zm3 0a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z",small:"M6.5 7a1 1 0 0 1 1-1h9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-.039l-.08 1H17a.5.5 0 0 1 0 1h-.7l-.455 5.62A1.5 1.5 0 0 1 14.35 18h-4.7a1.5 1.5 0 0 1-1.495-1.38L7.7 11H7a.5.5 0 0 1 0-1h.62l-.081-1H7.5a1 1 0 0 1-1-1zm9.494 1h.506V7h-9v1zm-.536 1H8.542l.61 7.54a.5.5 0 0 0 .498.46h4.7a.5.5 0 0 0 .499-.46zM11.5 11.5a.5.5 0 0 0-1 0v3a.5.5 0 0 0 1 0zm2 0a.5.5 0 0 0-1 0v3a.5.5 0 0 0 1 0z"},ls=({className:t,small:e})=>ns("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:ns("path",{clipRule:"evenodd",d:e?rs.small:rs.default,fill:"currentColor",fillRule:"evenodd"})});function io(t,e,o,n=10,r=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let s=o.getBoundingClientRect(),i=l.getBoundingClientRect(),u=t.top-n,c=t.left-r;e.style.width="max-content",e.style.maxWidth="none";let d=e.scrollWidth,a=i.right-c,m=c-i.left,p;if(d<=a)p=e.getBoundingClientRect();else{let h=m+t.width,f=m>a,_=Math.min(d,f?h:a);_<d&&(e.style.width=`${_}px`,e.style.maxWidth=`${_}px`,e.offsetHeight),f&&(c=t.right-_),p=e.getBoundingClientRect()}u<i.top&&(u+=p.height+t.height+n*2),c+p.width>i.right&&(c=i.right-p.width-r),u-=s.top,c-=s.left,e.style.opacity="1",e.style.transform=`translate(${c}px, ${u}px)`}import{createCommand as Rf}from"lexical";var so=Rf("TOGGLE_LINK_WITH_MODAL_COMMAND");function fs(t){t.preventDefault()}function hs({anchorElem:t}){let[e]=yf(),[o,n]=Ve(),r=ps(null),l=ps(null),[s,i]=Ve(null),[u,c]=Ve(null),{fieldProps:{schemaPath:d},uuid:a}=G(),m=vf(),{config:p,getEntityConfig:h}=Mf(),{i18n:f,t:g}=$f(),[_,L]=Ve(),v=Af(),[b,x]=Ve(!1),[C,k]=Ve([]),T=Df(),[I,N]=Ve(!1),w=If({slug:"lexical-rich-text-link-"+a,depth:v}),{toggleDrawer:S}=Oe(w),E=ms(()=>{x(!1),r&&r.current&&(r.current.style.opacity="0",r.current.style.transform="translate(-10000px, -10000px)"),N(!1),i(null),c(null),k([]),L(void 0)},[x,i,c,k]),y=ms(()=>{let R=cs(),M;if(!us(R)||!R){E();return}let D=rt(R);M=e.getElementByKey(D.getKey())?.getBoundingClientRect();let $=is(D,K),F=R.getNodes().filter(le=>!Bf(le)).find(le=>{let Ce=is(le,K);return $&&!$.is(Ce)||Ce&&!Ce.is($)});if($==null||F){E();return}n($);let B=$.getFields(),Y={...B,id:$.getID(),text:$.getTextContent()};if(B?.linkType==="custom")i(B?.url??null),c(null);else{i(`${p.routes.admin==="/"?"":p.routes.admin}/collections/${B?.doc?.relationTo}/${B?.doc?.value}`);let le=B?.doc?.relationTo?h({collectionSlug:B?.doc?.relationTo}):void 0;if(!le)c(B?.label?String(B?.label):null),i(B?.url?String(B?.url):null);else{let Ce=typeof B.doc?.value=="object"?B.doc.value.id:B.doc?.value,Gt=B.doc?.relationTo;if(!Ce||!Gt)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let ar=g("fields:linkedTo",{label:`${xn(le.labels.singular,f)} - ${g("lexical:link:loadingWithEllipsis",f)}`}).replace(/<[^>]*>?/g,"");c(ar),Ff.get(Gf({apiRoute:p.routes.api,path:`/${Gt}/${Ce}`,serverURL:p.serverURL}),{headers:{"Accept-Language":f.language},params:{depth:0,locale:T?.code}}).then(async Ze=>{if(!Ze.ok)throw new Error(`HTTP error! Status: ${Ze.status}`);let gt=await Ze.json(),ee=le?.admin?.useAsTitle||"id",xt=gt[ee],de=g("fields:linkedTo",{label:`${xn(le.labels.singular,f)} - ${xt}`}).replace(/<[^>]*>?/g,"");c(de)}).catch(()=>{let Ze=g("fields:linkedTo",{label:`${xn(le.labels.singular,f)} - ${g("general:untitled",f)} - ID: ${Ce}`}).replace(/<[^>]*>?/g,"");c(Ze)})}}L(Y),x(!0),k(R?R?.getNodes():[]),Se($)?N(!0):N(!1);let J=r.current,Xe=jf(e._window),{activeElement:ve}=document;if(J===null)return;let xe=e.getRootElement();return Xe!==null&&xe!==null&&xe.contains(Xe.anchorNode)?(M||(M=Xe.getRangeAt(0).getBoundingClientRect()),M!=null&&(M.y+=40,l.current=M)):(ve==null||ve.className!=="link-input")&&(xe!==null&&io(null,J,t),i(null),c(null)),!0},[e,E,p.routes.admin,p.routes.api,p.serverURL,h,g,f,T?.code,t]);return ao(()=>ss(e.registerCommand(so,R=>(e.dispatchCommand(pe,R),y(),S(),!0),ds)),[e,y,S,w]),ao(()=>{let R=t.parentElement,M=()=>{e.getEditorState().read(()=>{y()})};return window.addEventListener("resize",M),R?.addEventListener("scroll",M),()=>{window.removeEventListener("resize",M),R?.removeEventListener("scroll",M)}},[t.parentElement,e,y]),ao(()=>ss(e.registerUpdateListener(({editorState:R})=>{R.read(()=>{y()})}),e.registerCommand(Uf,()=>(y(),!0),ds),e.registerCommand(Hf,()=>b?(E(),!0):!1,Pf)),[e,y,b,E]),ao(()=>{e.getEditorState().read(()=>{y()})},[e,y]),Wf(()=>{!b||!r.current||!t||!l.current||io(l.current,r.current,t)},[s,u,b,t,o]),Ge(Vf.Fragment,{children:[ne("div",{className:"link-editor","data-theme":"dark",ref:r,children:Ge("div",{className:"link-input",children:[o?.__fields?.linkType==="custom"?ne(no,{}):ne(os,{}),s&&s.length>0?Ge("a",{className:"link-input__url",href:s,rel:"noopener noreferrer",target:"_blank",children:[u!=null&&u.length>0?u:s,o?.__fields.newTab?Ge(gn,{children:[ne(as,{size:16})," ",ne("div",{className:"link-input__divider"})," "]}):null]}):u!=null&&u.length>0?Ge(gn,{children:[ne("span",{className:"link-input__label-pure",children:u}),o?.__fields.newTab?Ge(gn,{children:[ne(as,{size:16})," ",ne("div",{className:"link-input__divider"})," "]}):null]}):null,m&&Ge("div",{className:"link-input__actions",children:[ne("button",{"aria-label":"Edit link",className:"link-edit",onClick:R=>{R.preventDefault(),S()},onMouseDown:fs,tabIndex:0,type:"button",children:ne(Of,{})}),!I&&ne("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(pe,null)},onMouseDown:fs,tabIndex:0,type:"button",children:ne(ls,{small:!0})})]})]})}),ne(Bo,{className:"lexical-link-edit-drawer",data:_,drawerSlug:w,drawerTitle:g("fields:editLink"),featureKey:"link",handleDrawerSubmit:(R,M)=>{let D=M,$={...D};delete $.text,e.update(()=>{let F=cs(),B=null;if(us(F)?B=rt(F).getParent():C.length&&(B=C[0]?.getParent()??null),B&&Se(B)){let Y=Ee({fields:$});B.replace(Y,!0)}}),e.dispatchCommand(pe,{fields:$,selectedNodes:C,text:D.text})},schemaPath:d,schemaPathSuffix:"fields"})]})}var gs=t=>{let{anchorElem:e=document.body}=t;return Kf(zf(hs,{anchorElem:e}),e)};import{c as Jf}from"react/compiler-runtime";import{useLexicalComposerContext as Xf}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Zf}from"@lexical/utils";import{$getSelection as Yf,$isElementNode as qf,$isRangeSelection as Qf,COMMAND_PRIORITY_LOW as xs,PASTE_COMMAND as e0}from"lexical";import{useEffect as t0}from"react";var Cs=t=>{let e=Jf(5),{clientProps:o}=t,[n]=Xf(),r,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==n?(r=()=>{if(!n.hasNodes([oe]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Zf(n.registerCommand(pe,s=>s===null?(pn(null),!0):(s.fields?.linkType||(s.fields.linkType=o.defaultLinkType),s.fields?.url||(s.fields.url=o.defaultLinkURL),pn(s),!0),xs),n.registerCommand(e0,s=>{let i=Yf();if(!Qf(i)||i.isCollapsed()||!(s instanceof ClipboardEvent)||s.clipboardData==null)return!1;let u=s.clipboardData.getData("text");if(!Hi(u))return!1;if(!i.getNodes().some(o0)){let c={doc:null,linkType:"custom",newTab:!1,url:u};return n.dispatchCommand(pe,{fields:c,text:null}),s.preventDefault(),!0}return!1},xs))},l=[o.defaultLinkType,o.defaultLinkURL,n],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=n,e[3]=r,e[4]=l):(r=e[3],l=e[4]),t0(r,l),null};function o0(t){return qf(t)}var ks=[an([{ChildComponent:no,isActive:({selection:t})=>{if(bs(t)){let e=rt(t);return n0(e,K)!=null}return!1},isEnabled:({selection:t})=>!!(bs(t)&&Cn()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(pe,null);else{let o,n=[];if(t.getEditorState().read(()=>{o=Cn()?.getTextContent(),n=Cn()?.getNodes()??[]}),!o?.length)return;let r={doc:null};t.dispatchCommand(so,{fields:r,selectedNodes:n,text:o})}},order:1}])],r0=A(({props:t})=>({markdownTransformers:[Vi],nodes:[oe,t?.disableAutoLinks===!0?null:we].filter(Boolean),plugins:[{Component:Cs,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:Qi,position:"normal"},{Component:es,position:"normal"},{Component:gs,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:ks},toolbarInline:{groups:ks}}));import{$isListNode as _n,INSERT_CHECK_LIST_COMMAND as Ns,ListItemNode as g0,ListNode as x0}from"@lexical/list";import{$isRangeSelection as C0}from"lexical";import{jsx as _s}from"react/jsx-runtime";import"react";var l0={16:"M5.584 8.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.076l-1-1a.5.5 0 1 1 .708-.707l.568.569zM13 10a.5.5 0 0 1 0 1H8a.5.5 0 0 1 0-1zM5.583 3.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.076l-1-1a.5.5 0 0 1 .708-.707l.568.569zM13 5a.5.5 0 1 1 0 1H8a.5.5 0 0 1 0-1z",24:"M9.084 15.223a.5.5 0 1 1 .832.554l-2 3a.5.5 0 0 1-.77.076l-1-1a.5.5 0 1 1 .708-.707l.568.569zM17.5 17a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1zm-8.416-6.777a.5.5 0 0 1 .832.554l-2 3a.5.5 0 0 1-.77.077l-1-1a.5.5 0 1 1 .708-.707l.568.568zM17.5 12a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1zM9.084 5.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.077l-1-1a.5.5 0 1 1 .708-.708l.568.569zM17.5 7a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1z"},bn=({className:t,size:e=24})=>_s("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:_s("path",{d:l0[e],fill:"currentColor"})});import{jsx as i0}from"react/jsx-runtime";import{ListPlugin as s0}from"@lexical/react/LexicalListPlugin.js";import"react";var lt=()=>i0(s0,{});function co(t,e){return t==="ordered"?!e.has("unorderedList"):t==="checklist"?!e.has("unorderedList")&&!e.has("orderedList"):!1}function it(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as d0,ListItemNode as m0,ListNode as p0}from"@lexical/list";import{$createListItemNode as a0,$createListNode as c0,$isListItemNode as u0,$isListNode as kn}from"@lexical/list";var Ts=4,st=t=>(e,o,n)=>{let r=e.getPreviousSibling(),l=e.getNextSibling(),s=a0(t==="check"?n[3]==="x":void 0);if(kn(l)&&l.getListType()===t){let u=l.getFirstChild();u!==null?u.insertBefore(s):l.append(s),e.remove()}else if(kn(r)&&r.getListType()===t)r.append(s),e.remove();else{let u=c0(t,t==="number"?Number(n[2]):void 0);u.append(s),e.replace(u)}s.append(...o),s.select(0,0);let i=Math.floor(n[1].length/Ts);i&&s.setIndent(i)},We=(t,e,o)=>{let n=[],r=t.getChildren(),l=0;for(let s of r)if(u0(s)){if(s.getChildrenSize()===1){let d=s.getFirstChild();if(kn(d)){n.push(We(d,e,o+1));continue}}let i=" ".repeat(o*Ts),u=t.getListType(),c=u==="number"?`${t.getStart()+l}. `:u==="check"?`- [${s.getChecked()?"x":" "}] `:"- ";n.push(i+c+e(s)),l++}return n.join(`
58
- `)};var Es={type:"element",dependencies:[p0,m0],export:(t,e)=>d0(t)?We(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:st("check")};import{jsx as f0}from"react/jsx-runtime";import{CheckListPlugin as h0}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var ws=()=>f0(h0,{});var Ss=[te([{ChildComponent:bn,isActive:({selection:t})=>{if(!C0(t))return!1;for(let e of t.getNodes()){if(_n(e)&&e.getListType()==="check")continue;let o=e.getParent();if(_n(o)&&o.getListType()==="check")continue;let n=o?.getParent();if(!(_n(n)&&n.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ns,void 0)},order:12}])],b0=A(({featureProviderMap:t})=>{let e=[{Component:ws,position:"normal"}],o=co("checklist",t);return o&&e.push({Component:lt,position:"normal"}),{markdownTransformers:[Es],nodes:o?[x0,g0]:[],plugins:e,slashMenu:{groups:[it([{Icon:bn,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:n})=>n.t("lexical:checklist:label"),onSelect:({editor:n})=>{n.dispatchCommand(Ns,void 0)}}])]},toolbarFixed:{groups:Ss},toolbarInline:{groups:Ss}}});import{$isListNode as En,INSERT_ORDERED_LIST_COMMAND as vs,ListItemNode as w0,ListNode as S0}from"@lexical/list";import{$isRangeSelection as N0}from"lexical";import{jsx as Ls}from"react/jsx-runtime";import"react";var k0={16:"M5.6 9.01a.5.5 0 0 1 .4.49v1a.5.5 0 0 1-.276.447L4 11.81V12h1.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5v-1l.005-.07a.5.5 0 0 1 .271-.377L5 10.19V10H3.5a.5.5 0 0 1 0-1h2zM12.5 12a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1zm0-4.5a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1zM4.6 3.01a.5.5 0 0 1 .4.49v3a.5.5 0 0 1-1 0V4h-.5a.5.5 0 0 1 0-1h1zM12.5 3a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1z",24:"M11 7a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6A.5.5 0 0 1 11 7M6 7a.5.5 0 0 1 .5-.5h1A.5.5 0 0 1 8 7v3.5a.5.5 0 1 1-1 0v-3h-.5A.5.5 0 0 1 6 7m0 6.5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5V15a.5.5 0 0 1-.276.447L7 16.31v.191h1.5a.5.5 0 0 1 0 1h-2A.5.5 0 0 1 6 17v-1a.5.5 0 0 1 .276-.447L8 14.69V14H6.5a.5.5 0 0 1-.5-.5m5.5 3a.5.5 0 1 0 0 1h6a.5.5 0 0 0 0-1zm0-5a.5.5 0 1 0 0 1h6a.5.5 0 0 0 0-1z"},Tn=({className:t,size:e=24})=>Ls("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Ls("path",{clipRule:"evenodd",d:k0[e],fill:"currentColor",fillRule:"evenodd"})});import{$isListNode as _0,ListItemNode as T0,ListNode as E0}from"@lexical/list";var Rs={type:"element",dependencies:[E0,T0],export:(t,e)=>_0(t)?We(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:st("number")};var ys=[te([{ChildComponent:Tn,isActive:({selection:t})=>{if(!N0(t))return!1;for(let e of t.getNodes()){if(En(e)&&e.getListType()==="number")continue;let o=e.getParent();if(En(o)&&o.getListType()==="number")continue;let n=o?.getParent();if(!(En(n)&&n.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(vs,void 0)},order:10}])],L0=A(({featureProviderMap:t})=>{let e=co("ordered",t);return{markdownTransformers:[Rs],nodes:e?[S0,w0]:[],plugins:e?[{Component:lt,position:"normal"}]:[],slashMenu:{groups:[it([{Icon:Tn,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:o})=>o.t("lexical:orderedList:label"),onSelect:({editor:o})=>{o.dispatchCommand(vs,void 0)}}])]},toolbarFixed:{groups:ys},toolbarInline:{groups:ys}}});import{$isListNode as Sn,INSERT_UNORDERED_LIST_COMMAND as Ds,ListItemNode as M0,ListNode as A0}from"@lexical/list";import{$isRangeSelection as D0}from"lexical";import{jsx as Is}from"react/jsx-runtime";import"react";var R0="M7 16C7.55228 16 8 16.4477 8 17C8 17.5523 7.55228 18 7 18C6.44772 18 6 17.5523 6 17C6 16.4477 6.44772 16 7 16ZM17.5 16.5C17.7761 16.5 18 16.7239 18 17C18 17.2761 17.7761 17.5 17.5 17.5H10.5C10.2239 17.5 10 17.2761 10 17C10 16.7239 10.2239 16.5 10.5 16.5H17.5ZM7 11C7.55228 11 8 11.4477 8 12C8 12.5523 7.55228 13 7 13C6.44772 13 6 12.5523 6 12C6 11.4477 6.44772 11 7 11ZM17.5 11.5C17.7761 11.5 18 11.7239 18 12C18 12.2761 17.7761 12.5 17.5 12.5H10.5C10.2239 12.5 10 12.2761 10 12C10 11.7239 10.2239 11.5 10.5 11.5H17.5ZM7 6C7.55228 6 8 6.44772 8 7C8 7.55228 7.55228 8 7 8C6.44772 8 6 7.55228 6 7C6 6.44772 6.44772 6 7 6ZM17.5 6.5C17.7761 6.5 18 6.72386 18 7C18 7.27614 17.7761 7.5 17.5 7.5H10.5C10.2239 7.5 10 7.27614 10 7C10 6.72386 10.2239 6.5 10.5 6.5H17.5Z",wn=({className:t})=>Is("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Is("path",{d:R0,fill:"currentColor"})});import{$isListNode as y0,ListItemNode as v0,ListNode as I0}from"@lexical/list";var Ms={type:"element",dependencies:[I0,v0],export:(t,e)=>y0(t)?We(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:st("bullet")};var As=[te([{ChildComponent:wn,isActive:({selection:t})=>{if(!D0(t))return!1;for(let e of t.getNodes()){if(Sn(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(Sn(o)&&o.getListType()==="bullet")continue;let n=o?.getParent();if(!(Sn(n)&&n.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ds,void 0)},order:11}])],$0=A({markdownTransformers:[Ms],nodes:[A0,M0],plugins:[{Component:lt,position:"normal"}],slashMenu:{groups:[it([{Icon:wn,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ds,void 0)}}])]},toolbarFixed:{groups:As},toolbarInline:{groups:As}});import{$setBlocksType as Fs}from"@lexical/selection";import{$createParagraphNode as Bs,$getSelection as Ps,$isParagraphNode as $s,$isRangeSelection as O0}from"lexical";var Os=[te([{ChildComponent:wt,isActive:({selection:t})=>{if(!O0(t))return!1;for(let e of t.getNodes())if(!$s(e)&&!$s(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=Ps();Fs(e,()=>Bs())})},order:1}])],F0=A({slashMenu:{groups:[X([{Icon:wt,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Ps();Fs(e,()=>Bs())})}}])]},toolbarFixed:{groups:Os},toolbarInline:{groups:Os}});import{c as ih}from"react/compiler-runtime";import{jsx as la}from"react/jsx-runtime";import{useLexicalComposerContext as sh}from"@lexical/react/LexicalComposerContext";import{useEffect as ah,useState as ch}from"react";import{jsx as ra,Fragment as lh}from"react/jsx-runtime";import"react";import{jsx as B0}from"react/jsx-runtime";var js={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return B0("blockquote",{children:o})}};import{jsx as P0}from"react/jsx-runtime";var Hs={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=t.tag;return P0(n,{children:o})}};import{jsx as j0}from"react/jsx-runtime";var Us={horizontalrule:j0("hr",{})};import{jsx as H0}from"react/jsx-runtime";var Gs={linebreak:H0("br",{})};import{jsx as Vs}from"react/jsx-runtime";var Ws=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let n=o({nodes:e.children}),r=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0;return Vs("a",{href:e.fields.url,rel:r,target:l,children:n})},link:({node:e,nodesToJSX:o})=>{let n=o({nodes:e.children}),r=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0,s=e.fields.url??"";return e.fields.linkType==="internal"&&(t?s=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),s="#")),Vs("a",{href:s,rel:r,target:l,children:n})}});import{jsx as at,jsxs as U0,Fragment as G0}from"react/jsx-runtime";import{v4 as V0}from"uuid";var zs={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=t.tag;return at(n,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let n=t.children.some(l=>l.type==="list"),r=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=V0();return at("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${n?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:n?r:U0(G0,{children:[at("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),at("label",{htmlFor:l,children:r}),at("br",{})]})})}else return at("li",{className:`${n?"nestedListItem":""}`,style:n?{listStyleType:"none"}:void 0,value:t?.value,children:r})}};import{jsx as Nn}from"react/jsx-runtime";var Ks={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?Nn("p",{children:o}):Nn("p",{children:Nn("br",{})})}};var Js={tab:" "};import{jsx as Mt}from"react/jsx-runtime";var Xs={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Mt("div",{className:"lexical-table-container",children:Mt("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:Mt("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=t.headerState>0?"th":"td",r=`lexical-table-cell-header-${t.headerState}`,l={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},s=t.colSpan&&t.colSpan>1?t.colSpan:void 0,i=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return Mt(n,{className:`lexical-table-cell ${r}`,colSpan:s,rowSpan:i,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Mt("tr",{className:"lexical-table-row",children:o})}};import{jsx as ze}from"react/jsx-runtime";import"react";var O={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},W0=O.IS_BOLD|O.IS_ITALIC|O.IS_STRIKETHROUGH|O.IS_UNDERLINE|O.IS_CODE|O.IS_SUBSCRIPT|O.IS_SUPERSCRIPT|O.IS_HIGHLIGHT,z0="\xA0",K0=`
54
+ `},[t,e]),f=Be((b,C)=>{o(x=>{let k=e.length-1,T=e[k];if(T&&T.name===b){if(b==="type")return[...e.slice(0,k),{...T,value:T.value+C}];if(T.value===C)return[...e.slice(0,k),{...T,count:T.count+1}]}return[...x,{name:b,count:1,value:C}]})},[e,o]);il(()=>{let b=x=>{if(!n)return;let k=x.key;Jd(x)?f("selectAll",""):al.has(k)?f("press",x.key):[...k].length>1?f("keydown",x.key):f("type",x.key)},C=x=>{if(!n)return;let k=x.key;!al.has(k)&&[...k].length>1&&f("keyup",x.key)};return t.registerRootListener((x,k)=>{k!==null&&(k.removeEventListener("keydown",b),k.removeEventListener("keyup",C)),x!==null&&(x.addEventListener("keydown",b),x.addEventListener("keyup",C))})},[t,n,f]),il(()=>{c.current&&c.current.scrollTo(0,c.current.scrollHeight)},[m]),Xo(()=>{if(e){let b=m();b!==null&&i(b),c.current&&c.current.scrollTo(0,c.current.scrollHeight)}},[m,e]),Xo(()=>t.registerUpdateListener(({dirtyElements:C,dirtyLeaves:x,editorState:k})=>{if(!n)return;let T=k._selection,I=u.current,N=d.current;if(I!==T){if(x.size===0&&C.size===0&&!N){let S=Ko(t._window);if(S&&(S.anchorNode==null||S.focusNode==null))return}u.current=T}d.current=!1;let E=m();E!==null&&i(E)}),[t,m,n,f]),Xo(()=>n?t.registerUpdateListener(()=>{let C=t.getRootElement();C!==null&&l(C?.innerHTML)}):void 0,[t,n]);let h=Be(b=>{n||(b.update(()=>{let C=Vd();C.clear();let x=zd();C.append(Ud().append(x)),x.select()}),o([])),r(C=>!C)},[n]),p=Be(()=>{if(!n)return;let b=Ko(t._window);if(b===null||b.anchorNode==null||b.focusNode==null)return;let{anchorNode:C,anchorOffset:x,focusNode:k,focusOffset:T}=Zd(b),I=a().getRootElement(),N;C!==null&&(N=sl(C,I));let E;k!==null&&(E=sl(k,I)),f("snapshot",{anchorNode:C,anchorOffset:x,anchorPath:N,focusNode:k,focusOffset:T,focusPath:E})},[f,n,a]),g=Be(()=>{Wd(m())},[m]),_=Be(()=>{Kd("test.js",m())},[m]);return[je("button",{className:`editor-dev-button ${n?"active":""}`,id:"test-recorder-button",onClick:b=>{h(a()),b.preventDefault()},title:n?"Disable test recorder":"Enable test recorder",type:"button",children:n?"Disable test recorder":"Enable test recorder"}),n?Zo("div",{className:"test-recorder-output",children:[Zo("div",{className:"test-recorder-toolbar",children:[je("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:b=>{p(),b.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),je("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:b=>{g(),b.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),je("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:b=>{_(),b.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),je("pre",{id:"test-recorder",ref:c,children:s})]}):null]}var ul=()=>{let t=Hd(3),[e]=Gd(),[o,n]=Yd(e),r;return t[0]!==o||t[1]!==n?(r=Zo(cl.Fragment,{children:[je("p",{children:"HI"}),o,n,je("p",{children:"DONE"})]}),t[0]=o,t[1]=n,t[2]=r):r=t[2],r};var qd=A({plugins:[{Component:ul,position:"bottom"}]});import{c as Qd}from"react/compiler-runtime";import{jsx as e1}from"react/jsx-runtime";import{useLexicalComposerContext as t1}from"@lexical/react/LexicalComposerContext.js";import{TreeView as o1}from"@lexical/react/LexicalTreeView.js";import"react";var dl=()=>{let t=Qd(2),[e]=t1(),o;return t[0]!==e?(o=e1(o1,{editor:e,timeTravelButtonClassName:"debug-timetravel-button",timeTravelPanelButtonClassName:"debug-timetravel-panel-button",timeTravelPanelClassName:"debug-timetravel-panel",timeTravelPanelSliderClassName:"debug-timetravel-panel-slider",treeTypeButtonClassName:"debug-treetype-button",viewClassName:"tree-view-output"}),t[0]=e,t[1]=o):o=t[1],o};var n1=A({plugins:[{Component:dl,position:"bottom"}]});import{BOLD_ITALIC_STAR as l1,BOLD_ITALIC_UNDERSCORE as i1,BOLD_STAR as s1,BOLD_UNDERSCORE as a1}from"@lexical/markdown";import{$isTableSelection as c1}from"@lexical/table";import{$isRangeSelection as u1,FORMAT_TEXT_COMMAND as d1}from"lexical";import{jsx as ml}from"react/jsx-runtime";import"react";var r1="M14.5 9.25A1.75 1.75 0 0 1 12.75 11H9.5V7.5h3.25c.966 0 1.75.784 1.75 1.75M8 11V7.5A1.5 1.5 0 0 1 9.5 6h3.25a3.25 3.25 0 0 1 2.418 5.422A3.5 3.5 0 0 1 13.5 18h-4A1.5 1.5 0 0 1 8 16.5zm1.5 1.5v4h4a2 2 0 1 0 0-4z",fl=({className:t})=>ml("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:ml("path",{clipRule:"evenodd",d:r1,fill:"currentColor",fillRule:"evenodd"})});var Z=t=>({type:"buttons",items:t,key:"format",order:40});var pl=[Z([{ChildComponent:fl,isActive:({selection:t})=>u1(t)||c1(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(d1,"bold")},order:1}])],m1=A(({featureProviderMap:t})=>{let e=[s1,a1];return t.get("italic")&&e.push(i1,l1),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:pl},toolbarInline:{groups:pl}}});import{INLINE_CODE as p1}from"@lexical/markdown";import{$isTableSelection as h1}from"@lexical/table";import{$isRangeSelection as g1,FORMAT_TEXT_COMMAND as C1}from"lexical";import{jsx as hl}from"react/jsx-runtime";import"react";var f1="M9.64645 8.14645C9.84171 7.95118 10.1582 7.95118 10.3535 8.14645C10.5487 8.34171 10.5487 8.65822 10.3535 8.85348L7.20699 12L10.3535 15.1464C10.5487 15.3417 10.5487 15.6582 10.3535 15.8535C10.1582 16.0487 9.84171 16.0487 9.64645 15.8535L6.14645 12.3535C5.95118 12.1582 5.95118 11.8417 6.14645 11.6464L9.64645 8.14645ZM13.6464 8.14645C13.8417 7.95118 14.1582 7.95118 14.3535 8.14645L17.8535 11.6464C18.0487 11.8417 18.0487 12.1582 17.8535 12.3535L14.3535 15.8535C14.1582 16.0487 13.8417 16.0487 13.6464 15.8535C13.4512 15.6582 13.4512 15.3417 13.6464 15.1464L16.7929 12L13.6464 8.85348C13.4512 8.65822 13.4512 8.34171 13.6464 8.14645Z",gl=({className:t})=>hl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:hl("path",{clipRule:"evenodd",d:f1,fill:"currentColor",fillRule:"evenodd"})});var Cl=[Z([{ChildComponent:gl,isActive:({selection:t})=>g1(t)||h1(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(C1,"code")},order:7}])],x1=A({enableFormats:["code"],markdownTransformers:[p1],toolbarFixed:{groups:Cl},toolbarInline:{groups:Cl}});import{ITALIC_STAR as k1,ITALIC_UNDERSCORE as _1}from"@lexical/markdown";import{$isTableSelection as T1}from"@lexical/table";import{$isRangeSelection as w1,FORMAT_TEXT_COMMAND as E1}from"lexical";import{jsx as xl}from"react/jsx-runtime";import"react";var b1="M10 6.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-2.083L11.6 17h1.9a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1h2.083L12.4 7h-1.9a.5.5 0 0 1-.5-.5",bl=({className:t})=>xl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:xl("path",{clipRule:"evenodd",d:b1,fill:"currentColor",fillRule:"evenodd"})});var kl=[Z([{ChildComponent:bl,isActive:({selection:t})=>w1(t)||T1(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(E1,"italic")},order:2}])],S1=A({enableFormats:["italic"],markdownTransformers:[k1,_1],toolbarFixed:{groups:kl},toolbarInline:{groups:kl}});import{STRIKETHROUGH as L1}from"@lexical/markdown";import{$isTableSelection as y1}from"@lexical/table";import{$isRangeSelection as R1,FORMAT_TEXT_COMMAND as v1}from"lexical";import{jsx as _l}from"react/jsx-runtime";import"react";var N1="M15.835 13.5a.27.27 0 0 1 .24.138q.306.554.306 1.316 0 1.01-.543 1.816-.543.8-1.554 1.268-1.01.462-2.409.462-1.323 0-2.295-.419-.972-.424-1.534-1.175a3.2 3.2 0 0 1-.533-1.135c-.082-.326.187-.614.522-.614.299 0 .539.233.625.519q.13.43.415.768.448.524 1.17.8.73.271 1.63.272.996 0 1.764-.32.773-.327 1.215-.906a2.16 2.16 0 0 0 .44-1.348q0-.645-.345-1.09c-.1-.132-.016-.352.15-.352zm-3.846-8q1.215 0 2.142.438.933.43 1.476 1.187.38.518.519 1.134c.07.31-.19.577-.507.577-.286 0-.518-.22-.6-.493q-.22-.738-.875-1.224-.864-.646-2.18-.646-.92 0-1.63.313-.703.308-1.1.85a2.04 2.04 0 0 0-.395 1.237q0 .492.217.874.216.376.588.652.376.278.843.475.474.197.972.338l1.052.288H18.5a.5.5 0 0 1 0 1h-13a.5.5 0 0 1 0-1h3.94a4.4 4.4 0 0 1-.844-.602q-.844-.781-.844-1.982 0-1.009.562-1.778t1.522-1.2q.959-.438 2.153-.438",Tl=({className:t})=>_l("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:_l("path",{d:N1,fill:"currentColor"})});var wl=[Z([{ChildComponent:Tl,isActive:({selection:t})=>R1(t)||y1(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(v1,"strikethrough")},order:4}])],I1=A({enableFormats:["strikethrough"],markdownTransformers:[L1],toolbarFixed:{groups:wl},toolbarInline:{groups:wl}});import{$isTableSelection as A1}from"@lexical/table";import{$isRangeSelection as $1,FORMAT_TEXT_COMMAND as D1}from"lexical";import{jsx as El}from"react/jsx-runtime";import"react";var M1="M7.51 15.65a.523.523 0 1 1-.985-.352l2.377-6.534a.83.83 0 0 1 1.56 0l2.374 6.534a.523.523 0 1 1-.985.351L9.722 9.57a.043.043 0 0 0-.08 0zm.162-2.238c0-.252.204-.456.456-.456h3.1a.456.456 0 0 1 0 .912h-3.1a.456.456 0 0 1-.456-.456m6.652 3.925a.436.436 0 0 1-.287-.765l1.64-1.431q.259-.228.433-.407.175-.178.266-.345a.76.76 0 0 0 .091-.365.61.61 0 0 0-.258-.52q-.255-.195-.63-.195-.4 0-.643.21a.7.7 0 0 0-.133.151c-.127.197-.3.403-.534.403s-.432-.194-.367-.418q.11-.378.434-.642.494-.402 1.257-.403.513 0 .897.183.387.181.604.501.217.316.217.714 0 .316-.13.586-.125.27-.395.555a9 9 0 0 1-.695.634l-.927.798a.023.023 0 0 0 .016.042h1.895a.357.357 0 0 1 0 .714z",Sl=({className:t})=>El("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:El("path",{d:M1,fill:"currentColor"})});var Nl=[Z([{ChildComponent:Sl,isActive:({selection:t})=>$1(t)||A1(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(D1,"subscript")},order:5}])],O1=A({enableFormats:["subscript"],toolbarFixed:{groups:Nl},toolbarInline:{groups:Nl}});import{$isTableSelection as P1}from"@lexical/table";import{$isRangeSelection as B1,FORMAT_TEXT_COMMAND as j1}from"lexical";import{jsx as Ll}from"react/jsx-runtime";import"react";var F1="M7.51 15.65a.523.523 0 1 1-.985-.352l2.377-6.534a.83.83 0 0 1 1.56 0l2.374 6.534a.523.523 0 1 1-.985.351L9.722 9.57a.043.043 0 0 0-.08 0zm.162-2.238c0-.252.204-.456.456-.456h3.1a.456.456 0 0 1 0 .912h-3.1a.456.456 0 0 1-.456-.456m6.652-1.303a.436.436 0 0 1-.287-.765l1.64-1.432q.259-.228.433-.406.175-.179.266-.346a.76.76 0 0 0 .091-.365.61.61 0 0 0-.258-.52q-.255-.195-.63-.194-.4 0-.643.209a.7.7 0 0 0-.133.152c-.127.196-.3.403-.534.403s-.432-.194-.367-.419q.11-.378.434-.641.494-.403 1.257-.403.513 0 .897.182.387.183.604.502.217.315.217.714 0 .315-.13.585-.125.27-.395.555a9 9 0 0 1-.695.635l-.927.798a.023.023 0 0 0 .016.041h1.895a.357.357 0 1 1 0 .715z",yl=({className:t})=>Ll("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ll("path",{d:F1,fill:"currentColor"})});var Rl=[Z([{ChildComponent:yl,isActive:({selection:t})=>B1(t)||P1(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(j1,"superscript")},order:6}])],H1=A({enableFormats:["superscript"],toolbarFixed:{groups:Rl},toolbarInline:{groups:Rl}});import{$isTableSelection as U1}from"@lexical/table";import{$isRangeSelection as z1,FORMAT_TEXT_COMMAND as V1}from"lexical";import{jsx as vl}from"react/jsx-runtime";import"react";var G1="M9 7.5a.5.5 0 0 0-1 0V12a4 4 0 0 0 8 0V7.5a.5.5 0 0 0-1 0V12a3 3 0 1 1-6 0zM16.5 19a.5.5 0 0 0 0-1h-9a.5.5 0 0 0 0 1z",Il=({className:t})=>vl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:vl("path",{clipRule:"evenodd",d:G1,fill:"currentColor",fillRule:"evenodd"})});var Ml=[Z([{ChildComponent:Il,isActive:({selection:t})=>z1(t)||U1(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(V1,"underline")},order:3}])],W1=A({enableFormats:["underline"],toolbarFixed:{groups:Ml},toolbarInline:{groups:Ml}});import{jsx as qo}from"react/jsx-runtime";import{jsx as K1}from"react/jsx-runtime";function X1(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var eo=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,n])=>[X1(o),n])):{};return K1("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as J1}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as Z1}from"@lexical/selection";import{$getNodeByKey as Y1,$getState as q1,$setState as Q1,createState as em,TextNode as tm}from"lexical";import{useEffect as om}from"react";function Al(t){let e=new Map;for(let o in t){let n=t[o],r=em(o,{parse:l=>typeof l=="string"&&Object.keys(n).includes(l)?l:void 0});e.set(o,{stateConfig:r,stateValues:n})}return e}function Yo(t,e,o,n){t.update(()=>{Z1(r=>{let l=e.get(o);if(!l)throw new Error(`State config for ${o} not found`);Q1(r,l.stateConfig,n)})})}function $l({stateMap:t}){let[e]=J1();return om(()=>e.registerMutationListener(tm,o=>{e.getEditorState().read(()=>{for(let[n,r]of o){if(r==="destroyed")continue;let l=Y1(n),s=e.getElementByKey(n);if(!l||!s)continue;let i=Object.create(null);t.forEach((u,d)=>{let c=q1(l,u.stateConfig);if(!c){delete s.dataset[d];return}s.dataset[d]=c;let a=u.stateValues[c]?.css;a&&Object.assign(i,a)}),s.style.cssText="",Object.assign(s.style,i)}})}),[e]),null}var Dl=(t,e)=>{let o=[];for(let r in t.state){let l=t.state[r];for(let s in l){let i=l[s];o.push({ChildComponent:()=>qo(eo,{css:i.css}),key:s,label:i.label,onSelect:({editor:u})=>{Yo(u,e,r,s)}})}}return[{type:"dropdown",ChildComponent:()=>qo(eo,{css:{color:"var(--color-icon-secondary)"}}),items:[...[{ChildComponent:()=>qo(eo,{}),key:"clear-style",label:({i18n:r})=>r.t("lexical:textState:defaultStyle"),onSelect:({editor:r})=>{for(let l in t.state)Yo(r,e,l,void 0)},order:1}],...o],key:"textState",order:30}]},nm=A(({props:t})=>{let e=Al(t.state);return{plugins:[{Component:()=>$l({stateMap:e}),position:"normal"}],toolbarFixed:{groups:Dl(t,e)},toolbarInline:{groups:Dl(t,e)}}});import{c as dm}from"react/compiler-runtime";import{useLexicalComposerContext as mm}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as fm,$isHeadingNode as Jl,HeadingNode as ql}from"@lexical/rich-text";import{$setBlocksType as pm}from"@lexical/selection";import{$getSelection as hm,$isRangeSelection as gm}from"lexical";import{useEffect as Cm}from"react";import{jsx as Ol}from"react/jsx-runtime";import"react";var rm="M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7zm11 6a.5.5 0 0 0-.777-.416l-1.5 1a.5.5 0 1 0 .554.832l.723-.482V17.5a.5.5 0 0 0 1 0z",Fl=({className:t})=>Ol("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ol("path",{d:rm,fill:"currentColor"})});import{jsx as Pl}from"react/jsx-runtime";import"react";var lm="M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7zm9.034 10.952c0 .303.245.548.548.548h2.97a.448.448 0 0 0 0-.896H17.48v-.04l.997-1.038q.562-.555.873-.945.314-.39.438-.711t.124-.653q0-.497-.245-.885a1.7 1.7 0 0 0-.684-.61A2.24 2.24 0 0 0 17.96 12a2.2 2.2 0 0 0-1.017.228 1.71 1.71 0 0 0-.888 1.13c-.064.268.168.495.444.495.275 0 .479-.236.595-.485l.019-.039q.12-.22.333-.338a1 1 0 0 1 .5-.121q.278 0 .495.11a.83.83 0 0 1 .341.312.9.9 0 0 1 .125.48q0 .245-.096.462t-.288.448-.48.529l-1.85 1.854a.55.55 0 0 0-.16.387",Bl=({className:t})=>Pl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Pl("path",{d:lm,fill:"currentColor"})});import{jsx as jl}from"react/jsx-runtime";import"react";var im="M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",Hl=({className:t})=>jl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:jl("path",{d:im,fill:"currentColor"})});import{jsx as Gl}from"react/jsx-runtime";import"react";var sm="M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",Ul=({className:t})=>Gl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Gl("path",{d:sm,fill:"currentColor"})});import{jsx as zl}from"react/jsx-runtime";import"react";var am="M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.1576 10.269C12.6896 10.269 12.3746 10.494 12.2216 10.737H10.8176L11.1956 7.074H15.2546V8.28H12.3206L12.1856 9.549C12.4016 9.351 12.8516 9.126 13.4636 9.126C14.7866 9.126 15.6596 10.053 15.6596 11.358C15.6596 12.609 14.7326 13.608 13.1756 13.608C11.5826 13.608 10.6556 12.753 10.5566 11.511H12.1136C12.1586 12.06 12.5456 12.465 13.1576 12.465C13.8236 12.465 14.1746 11.97 14.1746 11.376C14.1746 10.764 13.8416 10.269 13.1576 10.269Z",Vl=({className:t})=>zl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:zl("path",{d:am,fill:"currentColor"})});import{jsx as Wl}from"react/jsx-runtime";import"react";var cm="M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.3646 8.127C12.5456 8.127 12.0416 8.937 12.0416 9.999C12.3296 9.54 12.8246 9.207 13.5536 9.207C14.8586 9.207 15.8036 10.134 15.8036 11.376C15.8036 12.645 14.8226 13.608 13.3196 13.608C11.7266 13.608 10.6196 12.393 10.6196 10.395C10.6196 8.316 11.7716 6.966 13.4186 6.966C14.7056 6.966 15.5786 7.749 15.7316 8.829H14.3186C14.2016 8.415 13.9226 8.127 13.3646 8.127ZM13.3106 12.51C13.9586 12.51 14.3816 12.042 14.3816 11.385C14.3816 10.737 13.9586 10.278 13.3106 10.278C12.6536 10.278 12.2126 10.737 12.2126 11.385C12.2126 12.042 12.6536 12.51 13.3106 12.51Z",Kl=({className:t})=>Wl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Wl("path",{d:cm,fill:"currentColor"})});import{HEADING as um}from"@lexical/markdown";var Xl=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`;return{...um,regExp:new RegExp(o)}};var Zl=t=>{let e=hm();pm(e,()=>fm(t))},Yl={h1:Fl,h2:Bl,h3:Hl,h4:Ul,h5:Vl,h6:Kl},xm=A(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[te(e.map((n,r)=>({ChildComponent:Yl[n],isActive:({selection:l})=>{if(!gm(l))return!1;for(let s of l.getNodes()){if(Jl(s)&&s.getTag()===n)continue;let i=s.getParent();if(!(Jl(i)&&i.getTag()===n))return!1}return!0},key:n,label:({i18n:l})=>l.t("lexical:heading:label",{headingLevel:n.charAt(1)}),onSelect:({editor:l})=>{l.update(()=>{Zl(n)})},order:r+2})))];return{markdownTransformers:[Xl(e)],nodes:[ql],plugins:[{Component:bm,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[J(e.map(n=>({Icon:Yl[n],key:`heading-${n.charAt(1)}`,keywords:["heading",n],label:({i18n:r})=>r.t("lexical:heading:label",{headingLevel:n.charAt(1)}),onSelect:({editor:r})=>{r.update(()=>{Zl(n)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),bm=t=>{let e=dm(9),{clientProps:o}=t,{enabledHeadingSizes:n}=o,r;e[0]!==n?(r=n===void 0?["h1","h2","h3","h4","h5","h6"]:n,e[0]=n,e[1]=r):r=e[1];let l=r,s;e[2]!==l?(s=l.at(-1),e[2]=l,e[3]=s):s=e[3];let i=s,[u]=mm(),d,c;return e[4]!==u||e[5]!==l||e[6]!==i?(d=()=>{if(!(!i||l.length===6))return u.registerNodeTransform(ql,a=>{l.includes(a.getTag())||a.setTag(i)})},c=[u,l,i],e[4]=u,e[5]=l,e[6]=i,e[7]=d,e[8]=c):(d=e[7],c=e[8]),Cm(d,c),null};import{$isNodeSelection as Om}from"lexical";import{jsx as Ql}from"react/jsx-runtime";import"react";var km="M18 12a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1 0-1h11a.5.5 0 0 1 .5.5",Qo=({className:t})=>Ql("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ql("path",{d:km,fill:"currentColor"})});var be=t=>({type:"dropdown",ChildComponent:hr,items:t,key:"add",order:10});import{addClassNamesToElement as _m}from"@lexical/utils";import{$applyNodeReplacement as Tm,createCommand as wm,DecoratorNode as Em}from"lexical";var yt=wm("INSERT_HORIZONTAL_RULE_COMMAND"),Lt=class extends Em{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:Sm,priority:0})}}static importJSON(e){return ei()}createDOM(e){let o=document.createElement("hr");return _m(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
55
+ `}isInline(){return!1}updateDOM(){return!1}};function Sm(){return{node:ei()}}function ei(){return Tm(new Lt)}import{$applyNodeReplacement as Nm}from"lexical";import"react";var ke=class extends Lt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return nt()}decorate(){return null}exportJSON(){return super.exportJSON()}};function nt(){return Nm(new ke)}function He(t){return t instanceof ke}var ti={type:"element",dependencies:[ke],export:(t,e)=>He(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=nt();e&&t.replace(e)}};import{c as Lm}from"react/compiler-runtime";import{useLexicalComposerContext as ym}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as oi,$insertNodeToNearestRoot as Rm}from"@lexical/utils";import{$getRoot as vm,$getSelection as ni,$isRangeSelection as ri,$isRootOrShadowRoot as li,COMMAND_PRIORITY_EDITOR as Im}from"lexical";import{useEffect as Mm}from"react";var en="LexicalEditorTheme__hrSelected",ii=()=>{let t=Lm(3),[e]=ym(),o,n;return t[0]!==e?(o=()=>{let r=e.registerCommand(yt,Am,Im),l=e.registerUpdateListener(s=>{let{editorState:i}=s;i.read(()=>{let d=vm().getChildren(),c=ni(),a=[];for(let b=0;b<d.length;b++){let C=d[b];if(He(C)){let x=e.getElementByKey(C.getKey());x&&a.push({element:x,index:b})}}if(a.length===0)return;if(!ri(c)||c.isCollapsed()){for(let{element:b}of a)b.classList.remove(en);return}let m=c.anchor.getNode(),f=c.focus.getNode(),h=oi(m,$m)||m,p=oi(f,Dm)||f,g=d.indexOf(h),_=d.indexOf(p);if(g===-1||_===-1)return;let L=Math.min(g,_),v=Math.max(g,_);for(let{element:b,index:C}of a)C>=L&&C<=v?b.classList.add(en):b.classList.remove(en)})});return()=>{r(),l()}},n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Mm(o,n),null};function Am(t){let e=ni();if(!ri(e))return!1;if(e.focus.getNode()!==null){let n=nt();Rm(n)}return!0}function $m(t){return li(t.getParent())}function Dm(t){return li(t.getParent())}var Fm=A({markdownTransformers:[ti],nodes:[ke],plugins:[{Component:ii,position:"normal"}],slashMenu:{groups:[J([{Icon:Qo,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(yt,void 0)}}])]},toolbarFixed:{groups:[be([{ChildComponent:Qo,isActive:({selection:t})=>{if(!Om(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return He(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(yt,void 0)}}])]}});import{$findMatchingParent as Ci}from"@lexical/utils";import{$isElementNode as Zm,INDENT_CONTENT_COMMAND as Ym,OUTDENT_CONTENT_COMMAND as qm}from"lexical";import{jsx as tn}from"react/jsx-runtime";import"react";var Pm="M7.854 6.146a.5.5 0 1 0-.708.708L8.293 8H5.5a.5.5 0 0 0 0 1h2.793l-1.147 1.146a.5.5 0 0 0 .708.708l2-2a.5.5 0 0 0 0-.708zM11.5 8a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1zM5 12.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1z",si=({className:t})=>tn("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:tn("g",{transform:"scale(-1, 1) translate(-24, 0)",children:tn("path",{clipRule:"evenodd",d:Pm,fill:"currentColor",fillRule:"evenodd"})})});import{jsx as ai}from"react/jsx-runtime";import"react";var Bm="M7.854 6.146a.5.5 0 1 0-.708.708L8.293 8H5.5a.5.5 0 0 0 0 1h2.793l-1.147 1.146a.5.5 0 0 0 .708.708l2-2a.5.5 0 0 0 0-.708zM11.5 8a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1zM5 12.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1z",ci=({className:t})=>ai("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:ai("path",{clipRule:"evenodd",d:Bm,fill:"currentColor",fillRule:"evenodd"})});import{jsx as jm}from"react/jsx-runtime";import{useLexicalComposerContext as Hm}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as Gm}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as Um,mergeRegister as ui}from"@lexical/utils";import{$getSelection as zm,$isElementNode as pi,$isRangeSelection as Vm,COMMAND_PRIORITY_LOW as di,INDENT_CONTENT_COMMAND as mi,KEY_TAB_COMMAND as Wm,OUTDENT_CONTENT_COMMAND as Km,TabNode as Xm}from"lexical";import{useEffect as fi}from"react";var hi=({clientProps:t})=>{let[e]=Hm(),{disabledNodes:o,disableTabNode:n}=t;return fi(()=>{if(!(!e||!o?.length))return ui(e.registerCommand(mi,()=>Jm(r=>{if(!o.includes(r.getType())){let l=r.getIndent();r.setIndent(l+1)}}),di),e.registerUpdateListener(({dirtyElements:r,editorState:l})=>{e.update(()=>{for(let[s]of r){let i=l._nodeMap.get(s);pi(i)&&o.includes(i.getType())&&i.getIndent()>0&&i.setIndent(0)}})}))},[e,o]),fi(()=>{if(!(!e||!n))return ui(e.registerCommand(Wm,r=>(r.preventDefault(),e.dispatchCommand(r.shiftKey?Km:mi,void 0)),di),e.registerNodeTransform(Xm,r=>{r.remove()}))},[e,n]),jm(Gm,{})};function Jm(t){let e=zm();if(!Vm(e))return!1;let o=new Set,n=e.getNodes();for(let r=0;r<n.length;r++){let l=n[r],s=l.getKey();if(o.has(s))continue;let i=Um(l,d=>pi(d)&&!d.isInline());if(i===null)continue;let u=i.getKey();i.canIndent()&&!o.has(u)&&(o.add(u),t(i))}return o.size>0}var gi=t=>({type:"buttons",items:t,key:"indent",order:35});var xi=({disabledNodes:t})=>[gi([{ChildComponent:si,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],n=r=>bi(r)&&r.getIndent()>0;return o.some(r=>n(r)||!!Ci(r,n))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(qm,void 0)},order:1},{ChildComponent:ci,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],n=r=>bi(r)&&!(t??[]).includes(r.getType());return o.some(r=>n(r)||!!Ci(r,n))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Ym,void 0)},order:2}])],Qm=A(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:hi,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:xi({disabledNodes:e})},toolbarInline:{groups:xi({disabledNodes:e})}}}),bi=t=>Zm(t)&&t.canIndent();import{$findMatchingParent as Cp}from"@lexical/utils";import{$getSelection as fn,$isRangeSelection as es}from"lexical";import{jsx as ki}from"react/jsx-runtime";import"react";var ef={16:"M8.38 6.381a.29.29 0 0 1 .347-.056q.293.161.541.408a2.5 2.5 0 0 1 0 3.535l-2 2a2.5 2.5 0 0 1-3.535-3.535l.571-.573c.25-.249.692-.107.81.224a.46.46 0 0 1-.098.478l-.576.578a1.5 1.5 0 1 0 2.121 2.12l2-2a1.5 1.5 0 0 0 0-2.12c-.23-.23-.493-.509-.358-.805a.9.9 0 0 1 .178-.254m.352-2.648a2.5 2.5 0 1 1 3.535 3.535l-.471.47c-.253.254-.717.082-.819-.261a.44.44 0 0 1 .102-.435l.481-.481A1.5 1.5 0 0 0 9.44 4.44l-2 2a1.5 1.5 0 0 0 0 2.12c.136.138.168.365.031.502l-.182.181c-.154.154-.403.179-.557.025a2.5 2.5 0 0 1 0-3.535z",24:"M12.4436 10.3708C12.6861 10.5041 12.9148 10.6721 13.1204 10.8776C14.2919 12.0492 14.2918 13.9482 13.1204 15.1198L11.1204 17.1198C9.94879 18.2914 8.04975 18.2914 6.87817 17.1198C5.70664 15.9482 5.70661 14.0492 6.87817 12.8776L8.1477 11.6071C8.4098 11.345 8.89329 11.5392 8.97388 11.9011C9.00617 12.0462 8.96861 12.2012 8.86353 12.3063L7.5852 13.5847C6.80417 14.3657 6.80419 15.6317 7.5852 16.4128C8.36625 17.1938 9.63228 17.1938 10.4133 16.4128L12.4133 14.4128C13.1942 13.6317 13.1943 12.3657 12.4133 11.5847C12.4042 11.5755 12.3953 11.5662 12.386 11.5573C12.2925 11.468 12.1984 11.3736 12.1614 11.2497C12.0724 10.9515 12.1448 10.6149 12.3801 10.3796C12.397 10.3628 12.4228 10.3594 12.4436 10.3708ZM12.8782 6.87764C14.0497 5.70615 15.9488 5.70616 17.1204 6.87764C18.2919 8.04919 18.2919 9.94825 17.1204 11.1198L15.8508 12.3903C15.5887 12.6522 15.1053 12.4581 15.0247 12.0964C14.9924 11.9512 15.0308 11.7963 15.136 11.6911L16.4133 10.4128C17.1943 9.63175 17.1943 8.3657 16.4133 7.58467C15.6323 6.80371 14.3662 6.8037 13.5852 7.58467L11.5852 9.58467C10.8046 10.3657 10.8044 11.6319 11.5852 12.4128C11.5943 12.4219 11.6042 12.4303 11.6135 12.4392C11.7064 12.5278 11.7999 12.622 11.8372 12.7448C11.9276 13.044 11.8545 13.3827 11.6184 13.6188C11.6023 13.6347 11.5778 13.6383 11.5579 13.6276C11.3146 13.4942 11.0843 13.3259 10.8782 13.1198C9.7068 11.9484 9.707 10.0492 10.8782 8.87764L12.8782 6.87764Z"},to=({className:t,size:e=24})=>ki("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:ki("path",{d:ef[e],fill:"currentColor"})});import{$isAtNodeEnd as _i}from"@lexical/selection";function rt(t){let{anchor:e}=t,{focus:o}=t,n=t.anchor.getNode(),r=t.focus.getNode();return n===r?n:t.isBackward()?_i(o)?n:r:_i(e)?n:r}var on=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as pf}from"lexical";function nn(t){let e=/^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi,o=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z\d+/]+=*$/i;return t=String(t).trim(),t.match(e)!=null||t.match(o)!=null?t:"https://"}var tf=/^(?:[a-zA-Z][a-zA-Z\d+.-]*:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|www\.[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|(?:tel|mailto):[\w+.-]+)(?:\/[+~%/\w-]*)?(?:\?[-;&=%\w]*)?(?:#\w+)?$/,of=/^(?:\/[\w\-./]*(?:\?[-;&=%\w]*)?(?:#[\w-]+)?|#[\w\-]+)$/;function Ti(t){if(!t||t.includes(" ")||/^[a-z][a-z\d+.-]*:\/[^/]/i.test(t))return!1;if(t==="https://"||tf.test(t)||of.test(t))return!0;try{let e=new URL(t);return!(["ftp:","http:","https:"].includes(e.protocol)&&!e.hostname.includes("."))}catch{}return!1}import{addClassNamesToElement as nf,isHTMLAnchorElement as rf}from"@lexical/utils";import sn from"bson-objectid";import{$applyNodeReplacement as lf,$createTextNode as wi,$getSelection as sf,$isElementNode as Ei,$isRangeSelection as ln,createCommand as af,ElementNode as cf}from"lexical";var uf=new Set(["http:","https:","mailto:","sms:","tel:"]),oe=class extends cf{__fields;__id;constructor({id:e,fields:o={linkType:"custom",newTab:!1},key:n}){super(n),this.__fields=o,this.__id=e}static clone(e){return new this({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:df,priority:1})}}static importJSON(e){let o=_e({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new sn.default().toHexString(),e.version=3),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=rn(o.rel,"add","noopener")),nf(o,e.theme.link),o}exportJSON(){let e=this.getFields();e?.linkType==="internal"?delete e.url:e?.linkType==="custom"&&delete e.doc;let o={...super.exportJSON(),type:"link",fields:e,version:3},n=this.getID();return n&&(o.id=n),o}extractWithChild(e,o,n){if(!ln(o))return!1;let r=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(r)&&this.isParentOf(l)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let n=this.getParentOrThrow().insertNewAfter(e,o);if(Ei(n)){let r=_e({fields:this.__fields});return n.append(r),r}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!uf.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,n){let r=this.__fields?.url,l=this.__fields?.newTab;return r!=null&&r!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=r),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),l!==e.__fields?.newTab&&(l??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=rn(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=rn(o.rel,"remove","noopener"))),!1}updateFromJSON(e){let o=e;return super.updateFromJSON(o).setFields(o.fields).setID(o.id)}};function df(t){let e=null;if(rf(t)){let o=t.textContent;o!==null&&o!==""&&(e=_e({id:new sn.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function _e({id:t,fields:e}){return lf(new oe({id:t??new sn.default().toHexString(),fields:e}))}function K(t){return t instanceof oe}var fe=af("TOGGLE_LINK_COMMAND");function an(t){let e=sf();if(!ln(e)&&(t===null||!t.selectedNodes?.length))return;let o=ln(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let s=l.getParent();K(s)&&(s.getChildren().forEach(u=>{s.insertBefore(u)}),s.remove())});return}if(o?.length===1){let l=o[0],s=K(l)?l:mf(l);if(s!==null){s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(wi(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}}let n=null,r=null;o?.forEach(l=>{let s=l.getParent();if(!(s===r||s===null||Ei(l)&&!l.isInline())){if(K(s)){r=s,s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(wi(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}if(s.is(n)||(n=s,r=_e({fields:t.fields}),K(s)?l.getPreviousSibling()===null?s.insertBefore(r):s.insertAfter(r):l.insertBefore(r)),K(l)){if(l.is(r))return;if(r!==null){let i=l.getChildren();r.append(...i)}l.remove();return}r!==null&&r.append(l)}})}function mf(t){return ff(t,e=>K(e))}function ff(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function rn(t,e,o){let n,r=`${t}`;if(e==="add"){if(r.includes(o)){let l=new RegExp(o,"g");r=r.replace(l,"").trim()}r=r.trim(),n=r.length===0?`${o}`:`${r} ${o}`}else{let l=new RegExp(o,"g");n=r.replace(l,"").trim()}return n}var hf=(t,e)=>{let[,o,n]=e,r=_e({fields:{doc:null,linkType:"custom",newTab:!1,url:n}}),l=pf(o);return l.setFormat(t.getFormat()),r.append(l),t.replace(r),l},gf=t=>({type:"text-match",dependencies:[oe],export:(e,o)=>{if(!K(e))return null;let n=e,r=n.getFields(),l;return r.linkType==="internal"?t?.internalDocToHref?l=nn(t.internalDocToHref({linkNode:n.exportJSON()})):(console.warn("Lexical \u2192 Markdown converter: found internal link but internalDocToHref is not provided \u2014 link will have an empty href"),l=""):l=nn(r.url??""),`[${o(n)}](${l})`},importRegExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:hf,trigger:")"}),Si=gf();import{$applyNodeReplacement as Cf,$isElementNode as xf}from"lexical";var Te=class extends oe{static clone(e){return new this({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=Rt({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let n=this.getParentOrThrow().insertNewAfter(e,o);if(xf(n)){let r=Rt({fields:this.__fields});return n.append(r),r}return null}updateFromJSON(e){let o=e;return super.updateFromJSON(o).setFields(o.fields)}};function Rt({fields:t}){return Cf(new Te({id:"",fields:t}))}function we(t){return t instanceof Te}import{c as bf}from"react/compiler-runtime";import{useLexicalComposerContext as kf}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as _f}from"@lexical/utils";import{$createTextNode as Ni,$getSelection as Tf,$isElementNode as yi,$isLineBreakNode as Ri,$isNodeSelection as wf,$isRangeSelection as Ef,$isTextNode as vt,TextNode as Sf}from"lexical";import{useEffect as Nf}from"react";function Li(t,e=o=>o){return o=>{let n=t.exec(o);return n===null?null:{index:n.index,length:n[0].length,text:n[0],url:e(n[0])}}}function vi(t,e){for(let o of e){let n=o(t);if(n!=null)return n}return null}var Lf=/[.,;\s]/;function no(t){return t!==void 0&&Lf.test(t)}function Ii(t){return no(t[t.length-1])}function un(t){return no(t[0])}function yf(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Mi(t){let e=t.getPreviousSibling();return yi(e)&&(e=e.getLastDescendant()),e===null||Ri(e)||vt(e)&&Ii(e.getTextContent())}function Ai(t){let e=t.getNextSibling();return yi(e)&&(e=e.getFirstDescendant()),e===null||Ri(e)||vt(e)&&un(e.getTextContent())}function Rf(t,e,o,n){return(t>0?no(o[t-1]):Mi(n[0]))?e<o.length?no(o[e]):Ai(n[n.length-1]):!1}function vf(t,e,o){let n=[],r=[],l=[],s=0,i=0,u=[...t];for(;u.length>0;){let d=u[0],a=d.getTextContent().length,m=i;i+a<=e?(n.push(d),s+=a):m>=o?l.push(d):r.push(d),i+=a,u.shift()}return[s,n,r,l]}function If(t,e,o,n){let r={linkType:"custom",url:n.url,...n.fields},l=Rt({fields:r});if(t.length===1){let s=t[0],i;if(e===0?[i]=s.splitText(o):[,i]=s.splitText(e,o),i){let u=Ni(n.text);u.setFormat(i.getFormat()),u.setDetail(i.getDetail()),u.setStyle(i.getStyle()),l.append(u),i.replace(l)}return s}else if(t.length>1){let s=t[0],i=s.getTextContent().length,u;e===0?u=s:[,u]=s.splitText(e);let d=[],c;if(t.forEach(a=>{let f=a.getTextContent().length,h=i,p=i+f;if(h<o)if(p<=o)d.push(a);else{let[g,_]=a.splitText(o-h);g&&d.push(g),c=_}i+=f}),u){let a=Tf(),m=a?a.getNodes().find(vt):void 0,f=Ni(u.getTextContent());return f.setFormat(u.getFormat()),f.setDetail(u.getDetail()),f.setStyle(u.getStyle()),l.append(f,...d),m&&m===u&&(Ef(a)?f.select(a.anchor.offset,a.focus.offset):wf(a)&&f.select(0,f.getTextContent().length)),u.replace(l),c}}}function Mf(t,e,o){let n=[...t],r=n.map(u=>u.getTextContent()).join(""),l=r,s,i=0;for(;(s=vi(l,e))!=null&&s!==null;){let u=s.index,d=s.length,c=u+d;if(Rf(i+u,i+c,r,n)){let[m,,f,h]=vf(n,i+u,i+c),p=i+u-m,g=i+c-m,_=If(f,p,g,s);n=_?[_,...h]:h,o(s.url,null),i=0}else i+=c;l=l.substring(c)}}function cn(t,e,o){let n=t.getChildren(),r=n.length;for(let u=0;u<r;u++){let d=n[u];if(!vt(d)||!d.isSimpleText()){oo(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),s=vi(l,e);if(s===null||s.text!==l){oo(t),o(null,t.getFields()?.url??null);return}if(!Mi(t)||!Ai(t)){oo(t),o(null,t.getFields()?.url??null);return}let i=t.getFields()?.url;if(i!==s?.url){let u=t.getFields();u.url=s?.url,t.setFields(u),o(s.url,i??null)}}function Af(t,e,o){let n=t.getPreviousSibling(),r=t.getNextSibling(),l=t.getTextContent();if(we(n)){let s=n.getFields()?.url?n.getFields()?.url?.startsWith("mailto:")??!1:!1;(!un(l)||yf(l,s))&&(n.append(t),cn(n,e,o),o(null,n.getFields()?.url??null))}we(r)&&!Ii(l)&&(oo(r),cn(r,e,o),o(null,r.getFields()?.url??null))}function oo(t){let e=t.getChildren(),o=e.length;for(let n=o-1;n>=0;n--)t.insertAfter(e[n]);return t.remove(),e.map(n=>n.getLatest())}function $f(t){let e=[t],o=t.getNextSibling();for(;o!==null&&vt(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function Df(t,e,o){let n=bf(5),r,l;n[0]!==t||n[1]!==e||n[2]!==o?(r=()=>{if(!t.hasNodes([Te]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let s=(i,u)=>{o?.(i,u)};return _f(t.registerNodeTransform(Sf,i=>{let u=i.getParentOrThrow(),d=i.getPreviousSibling();if(we(u))cn(u,e,s);else if(!K(u)){if(i.isSimpleText()&&(un(i.getTextContent())||!we(d))){let c=$f(i);Mf(c,e,s)}Af(i,e,s)}}))},l=[t,e,o],n[0]=t,n[1]=e,n[2]=o,n[3]=r,n[4]=l):(r=n[3],l=n[4]),Nf(r,l)}var Of=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Ff=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Pf=[Li(Of,t=>t.startsWith("http")?t:`https://${t}`),Li(Ff,t=>`mailto:${t}`)],$i=()=>{let[t]=kf();return Df(t,Pf),null};import{jsx as Bf}from"react/jsx-runtime";import{ClickableLinkPlugin as jf}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Di=()=>Bf(jf,{});import{jsx as ip}from"react/jsx-runtime";import"react";import{createPortal as sp}from"react-dom";import{jsx as ne,jsxs as Ge,Fragment as dn}from"react/jsx-runtime";import{useLexicalComposerContext as Uf}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as zf}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as Hi,mergeRegister as Gi}from"@lexical/utils";import{getTranslation as mn}from"@payloadcms/translations";import{formatDrawerSlug as Vf,NewTabIcon as Ui,useConfig as Wf,useEditDepth as Kf,useLocale as Xf,useTranslation as Jf,WriteIcon as Zf}from"@payloadcms/ui";import{requests as Yf}from"@payloadcms/ui/shared";import{$getSelection as zi,$isLineBreakNode as qf,$isRangeSelection as Vi,COMMAND_PRIORITY_HIGH as Qf,COMMAND_PRIORITY_LOW as Wi,getDOMSelection as ep,KEY_ESCAPE_COMMAND as tp,SELECTION_CHANGE_COMMAND as op}from"lexical";import{formatAdminURL as np}from"payload/shared";import rp,{useCallback as Ki,useEffect as io,useLayoutEffect as lp,useRef as Xi,useState as Ue}from"react";import{jsx as Oi}from"react/jsx-runtime";import"react";var Hf="M12.5 5C12.6326 5 12.7597 5.05272 12.8535 5.14648L16.8535 9.14648C16.9965 9.28948 17.0393 9.50457 16.9619 9.69141C16.8845 9.87821 16.7022 10 16.5 10H12.5C12.2239 10 12 9.77614 12 9.5V6H8.5C8.22386 6 8 6.22386 8 6.5V17.5C8 17.7761 8.22386 18 8.5 18H15.5C15.7761 18 16 17.7761 16 17.5V11.5C16 11.2239 16.2239 11 16.5 11C16.7761 11 17 11.2239 17 11.5V17.5C17 18.3284 16.3284 19 15.5 19H8.5C7.67157 19 7 18.3284 7 17.5V6.5C7 5.67157 7.67157 5 8.5 5H12.5ZM13 9H15.293L13 6.70703V9Z",Fi=({className:t})=>Oi("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Oi("path",{d:Hf,fill:"currentColor"})});import{jsx as Pi}from"react/jsx-runtime";import"react";var Bi={default:"M6 5a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .496.5h12.008a.5.5 0 0 0 .496-.5v-1A.5.5 0 0 0 18 5zM4.5 6.5a1.5 1.5 0 0 0 1.037 1.427L5.725 10H5a.5.5 0 0 0 0 1h.816l.653 7.181A2 2 0 0 0 8.46 20h7.078a2 2 0 0 0 1.992-1.819L18.184 11H19a.5.5 0 0 0 0-1h-.725l.188-2.073A1.5 1.5 0 0 0 19.5 6.5v-1A1.5 1.5 0 0 0 18 4H6a1.5 1.5 0 0 0-1.5 1.5zm2.965 11.59L6.548 8h10.905l-.918 10.09a1 1 0 0 1-.996.91H8.461a1 1 0 0 1-.996-.91M11 10.5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0zm3 0a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z",small:"M6.5 7a1 1 0 0 1 1-1h9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-.039l-.08 1H17a.5.5 0 0 1 0 1h-.7l-.455 5.62A1.5 1.5 0 0 1 14.35 18h-4.7a1.5 1.5 0 0 1-1.495-1.38L7.7 11H7a.5.5 0 0 1 0-1h.62l-.081-1H7.5a1 1 0 0 1-1-1zm9.494 1h.506V7h-9v1zm-.536 1H8.542l.61 7.54a.5.5 0 0 0 .498.46h4.7a.5.5 0 0 0 .499-.46zM11.5 11.5a.5.5 0 0 0-1 0v3a.5.5 0 0 0 1 0zm2 0a.5.5 0 0 0-1 0v3a.5.5 0 0 0 1 0z"},ji=({className:t,small:e})=>Pi("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Pi("path",{clipRule:"evenodd",d:e?Bi.small:Bi.default,fill:"currentColor",fillRule:"evenodd"})});function ro(t,e,o,n=10,r=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let s=o.getBoundingClientRect(),i=l.getBoundingClientRect(),u=t.top-n,d=t.left-r;e.style.width="max-content",e.style.maxWidth="none";let c=e.scrollWidth,a=i.right-d,m=d-i.left,f;if(c<=a)f=e.getBoundingClientRect();else{let h=m+t.width,p=m>a,_=Math.min(c,p?h:a);_<c&&(e.style.width=`${_}px`,e.style.maxWidth=`${_}px`,e.offsetHeight),p&&(d=t.right-_),f=e.getBoundingClientRect()}u<i.top&&(u+=f.height+t.height+n*2),d+f.width>i.right&&(d=i.right-f.width-r),u-=s.top,d-=s.left,e.style.opacity="1",e.style.transform=`translate(${d}px, ${u}px)`}import{createCommand as Gf}from"lexical";var lo=Gf("TOGGLE_LINK_WITH_MODAL_COMMAND");function Ji(t){t.preventDefault()}function Zi({anchorElem:t}){let[e]=Uf(),[o,n]=Ue(),r=Xi(null),l=Xi(null),[s,i]=Ue(null),[u,d]=Ue(null),{fieldProps:{schemaPath:c},uuid:a}=U(),m=zf(),{config:f,getEntityConfig:h}=Wf(),{i18n:p,t:g}=Jf(),[_,L]=Ue(),v=Kf(),[b,C]=Ue(!1),[x,k]=Ue([]),T=Xf(),[I,N]=Ue(!1),E=Vf({slug:"lexical-rich-text-link-"+a,depth:v}),{toggleDrawer:S}=De(E),w=Ki(()=>{C(!1),r&&r.current&&(r.current.style.opacity="0",r.current.style.transform="translate(-10000px, -10000px)"),N(!1),i(null),d(null),k([]),L(void 0)},[C,i,d,k]),R=Ki(()=>{let y=zi(),M;if(!Vi(y)||!y){w();return}let $=rt(y);M=e.getElementByKey($.getKey())?.getBoundingClientRect();let D=Hi($,K),F=y.getNodes().filter(le=>!qf(le)).find(le=>{let ge=Hi(le,K);return D&&!D.is(ge)||ge&&!ge.is(D)});if(D==null||F){w();return}n(D);let P=D.getFields(),Y={...P,id:D.getID(),text:D.getTextContent()};if(P?.linkType==="custom")i(P?.url??null),d(null);else{i(`${f.routes.admin==="/"?"":f.routes.admin}/collections/${P?.doc?.relationTo}/${P?.doc?.value}`);let le=P?.doc?.relationTo?h({collectionSlug:P?.doc?.relationTo}):void 0;if(!le)d(P?.label?String(P?.label):null),i(P?.url?String(P?.url):null);else{let ge=typeof P.doc?.value=="object"?P.doc.value.id:P.doc?.value,Ht=P.doc?.relationTo;if(!ge||!Ht)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let or=g("fields:linkedTo",{label:`${mn(le.labels.singular,p)} - ${g("lexical:link:loadingWithEllipsis",p)}`}).replace(/<[^>]*>?/g,"");d(or),Yf.get(np({apiRoute:f.routes.api,path:`/${Ht}/${ge}`,serverURL:f.serverURL}),{headers:{"Accept-Language":p.language},params:{depth:0,locale:T?.code}}).then(async Xe=>{if(!Xe.ok)throw new Error(`HTTP error! Status: ${Xe.status}`);let ht=await Xe.json(),ee=le?.admin?.useAsTitle||"id",gt=ht[ee],de=g("fields:linkedTo",{label:`${mn(le.labels.singular,p)} - ${gt}`}).replace(/<[^>]*>?/g,"");d(de)}).catch(()=>{let Xe=g("fields:linkedTo",{label:`${mn(le.labels.singular,p)} - ${g("general:untitled",p)} - ID: ${ge}`}).replace(/<[^>]*>?/g,"");d(Xe)})}}L(Y),C(!0),k(y?y?.getNodes():[]),we(D)?N(!0):N(!1);let X=r.current,Ke=ep(e._window),{activeElement:ye}=document;if(X===null)return;let he=e.getRootElement();return Ke!==null&&he!==null&&he.contains(Ke.anchorNode)?(M||(M=Ke.getRangeAt(0).getBoundingClientRect()),M!=null&&(M.y+=40,l.current=M)):(ye==null||ye.className!=="link-input")&&(he!==null&&ro(null,X,t),i(null),d(null)),!0},[e,w,f.routes.admin,f.routes.api,f.serverURL,h,g,p,T?.code,t]);return io(()=>Gi(e.registerCommand(lo,y=>(e.dispatchCommand(fe,y),R(),S(),!0),Wi)),[e,R,S,E]),io(()=>{let y=t.parentElement,M=()=>{e.getEditorState().read(()=>{R()})};return window.addEventListener("resize",M),y?.addEventListener("scroll",M),()=>{window.removeEventListener("resize",M),y?.removeEventListener("scroll",M)}},[t.parentElement,e,R]),io(()=>Gi(e.registerUpdateListener(({editorState:y})=>{y.read(()=>{R()})}),e.registerCommand(op,()=>(R(),!0),Wi),e.registerCommand(tp,()=>b?(w(),!0):!1,Qf)),[e,R,b,w]),io(()=>{e.getEditorState().read(()=>{R()})},[e,R]),lp(()=>{!b||!r.current||!t||!l.current||ro(l.current,r.current,t)},[s,u,b,t,o]),Ge(rp.Fragment,{children:[ne("div",{className:"link-editor","data-theme":"dark",ref:r,children:Ge("div",{className:"link-input",children:[o?.__fields?.linkType==="custom"?ne(to,{}):ne(Fi,{}),s&&s.length>0?Ge("a",{className:"link-input__url",href:s,rel:"noopener noreferrer",target:"_blank",children:[u!=null&&u.length>0?u:s,o?.__fields.newTab?Ge(dn,{children:[ne(Ui,{size:16})," ",ne("div",{className:"link-input__divider"})," "]}):null]}):u!=null&&u.length>0?Ge(dn,{children:[ne("span",{className:"link-input__label-pure",children:u}),o?.__fields.newTab?Ge(dn,{children:[ne(Ui,{size:16})," ",ne("div",{className:"link-input__divider"})," "]}):null]}):null,m&&Ge("div",{className:"link-input__actions",children:[ne("button",{"aria-label":"Edit link",className:"link-edit",onClick:y=>{y.preventDefault(),S()},onMouseDown:Ji,tabIndex:0,type:"button",children:ne(Zf,{})}),!I&&ne("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(fe,null)},onMouseDown:Ji,tabIndex:0,type:"button",children:ne(ji,{small:!0})})]})]})}),ne($o,{className:"lexical-link-edit-drawer",data:_,drawerSlug:E,drawerTitle:g("fields:editLink"),featureKey:"link",handleDrawerSubmit:(y,M)=>{let $=M,D={...$};delete D.text,e.update(()=>{let F=zi(),P=null;if(Vi(F)?P=rt(F).getParent():x.length&&(P=x[0]?.getParent()??null),P&&we(P)){let Y=_e({fields:D});P.replace(Y,!0)}}),e.dispatchCommand(fe,{fields:D,selectedNodes:x,text:$.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var Yi=t=>{let{anchorElem:e=document.body}=t;return sp(ip(Zi,{anchorElem:e}),e)};import{c as ap}from"react/compiler-runtime";import{useLexicalComposerContext as cp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as up}from"@lexical/utils";import{$getSelection as dp,$isElementNode as mp,$isRangeSelection as fp,COMMAND_PRIORITY_LOW as qi,PASTE_COMMAND as pp}from"lexical";import{useEffect as hp}from"react";var Qi=t=>{let e=ap(5),{clientProps:o}=t,[n]=cp(),r,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==n?(r=()=>{if(!n.hasNodes([oe]))throw new Error("LinkPlugin: LinkNode not registered on editor");return up(n.registerCommand(fe,s=>s===null?(an(null),!0):(s.fields?.linkType||(s.fields.linkType=o.defaultLinkType),s.fields?.url||(s.fields.url=o.defaultLinkURL),an(s),!0),qi),n.registerCommand(pp,s=>{let i=dp();if(!fp(i)||i.isCollapsed()||!(s instanceof ClipboardEvent)||s.clipboardData==null)return!1;let u=s.clipboardData.getData("text");if(!Ti(u))return!1;if(!i.getNodes().some(gp)){let d={doc:null,linkType:"custom",newTab:!1,url:u};return n.dispatchCommand(fe,{fields:d,text:null}),s.preventDefault(),!0}return!1},qi))},l=[o.defaultLinkType,o.defaultLinkURL,n],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=n,e[3]=r,e[4]=l):(r=e[3],l=e[4]),hp(r,l),null};function gp(t){return mp(t)}var ts=[on([{ChildComponent:to,isActive:({selection:t})=>{if(es(t)){let e=rt(t);return Cp(e,K)!=null}return!1},isEnabled:({selection:t})=>!!(es(t)&&fn()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(fe,null);else{let o,n=[];if(t.getEditorState().read(()=>{o=fn()?.getTextContent(),n=fn()?.getNodes()??[]}),!o?.length)return;let r={doc:null};t.dispatchCommand(lo,{fields:r,selectedNodes:n,text:o})}},order:1}])],xp=A(({props:t})=>({markdownTransformers:[Si],nodes:[oe,t?.disableAutoLinks===!0?null:Te].filter(Boolean),plugins:[{Component:Qi,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:$i,position:"normal"},{Component:Di,position:"normal"},{Component:Yi,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:ts},toolbarInline:{groups:ts}}));import{$isListNode as hn,INSERT_CHECK_LIST_COMMAND as ls,ListItemNode as Ep,ListNode as Sp}from"@lexical/list";import{CHECK_LIST as Np}from"@lexical/markdown";import{$isRangeSelection as Lp}from"lexical";import{jsx as os}from"react/jsx-runtime";import"react";var bp={16:"M5.584 8.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.076l-1-1a.5.5 0 1 1 .708-.707l.568.569zM13 10a.5.5 0 0 1 0 1H8a.5.5 0 0 1 0-1zM5.583 3.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.076l-1-1a.5.5 0 0 1 .708-.707l.568.569zM13 5a.5.5 0 1 1 0 1H8a.5.5 0 0 1 0-1z",24:"M9.084 15.223a.5.5 0 1 1 .832.554l-2 3a.5.5 0 0 1-.77.076l-1-1a.5.5 0 1 1 .708-.707l.568.569zM17.5 17a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1zm-8.416-6.777a.5.5 0 0 1 .832.554l-2 3a.5.5 0 0 1-.77.077l-1-1a.5.5 0 1 1 .708-.707l.568.568zM17.5 12a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1zM9.084 5.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.077l-1-1a.5.5 0 1 1 .708-.708l.568.569zM17.5 7a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1z"},pn=({className:t,size:e=24})=>os("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:os("path",{d:bp[e],fill:"currentColor"})});import{jsx as kp}from"react/jsx-runtime";import{ListPlugin as _p}from"@lexical/react/LexicalListPlugin.js";import"react";var lt=()=>kp(_p,{});function so(t,e){return t==="ordered"?!e.has("unorderedList"):t==="checklist"?!e.has("unorderedList")&&!e.has("orderedList"):!1}function it(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{jsx as Tp}from"react/jsx-runtime";import{CheckListPlugin as wp}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var ns=()=>Tp(wp,{});var rs=[te([{ChildComponent:pn,isActive:({selection:t})=>{if(!Lp(t))return!1;for(let e of t.getNodes()){if(hn(e)&&e.getListType()==="check")continue;let o=e.getParent();if(hn(o)&&o.getListType()==="check")continue;let n=o?.getParent();if(!(hn(n)&&n.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(ls,void 0)},order:12}])],yp=A(({featureProviderMap:t})=>{let e=[{Component:ns,position:"normal"}],o=so("checklist",t);return o&&e.push({Component:lt,position:"normal"}),{markdownTransformers:[Np],nodes:o?[Sp,Ep]:[],plugins:e,slashMenu:{groups:[it([{Icon:pn,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:n})=>n.t("lexical:checklist:label"),onSelect:({editor:n})=>{n.dispatchCommand(ls,void 0)}}])]},toolbarFixed:{groups:rs},toolbarInline:{groups:rs}}});import{$isListNode as Cn,INSERT_ORDERED_LIST_COMMAND as as,ListItemNode as vp,ListNode as Ip}from"@lexical/list";import{ORDERED_LIST as Mp}from"@lexical/markdown";import{$isRangeSelection as Ap}from"lexical";import{jsx as is}from"react/jsx-runtime";import"react";var Rp={16:"M5.6 9.01a.5.5 0 0 1 .4.49v1a.5.5 0 0 1-.276.447L4 11.81V12h1.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5v-1l.005-.07a.5.5 0 0 1 .271-.377L5 10.19V10H3.5a.5.5 0 0 1 0-1h2zM12.5 12a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1zm0-4.5a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1zM4.6 3.01a.5.5 0 0 1 .4.49v3a.5.5 0 0 1-1 0V4h-.5a.5.5 0 0 1 0-1h1zM12.5 3a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1z",24:"M11 7a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6A.5.5 0 0 1 11 7M6 7a.5.5 0 0 1 .5-.5h1A.5.5 0 0 1 8 7v3.5a.5.5 0 1 1-1 0v-3h-.5A.5.5 0 0 1 6 7m0 6.5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5V15a.5.5 0 0 1-.276.447L7 16.31v.191h1.5a.5.5 0 0 1 0 1h-2A.5.5 0 0 1 6 17v-1a.5.5 0 0 1 .276-.447L8 14.69V14H6.5a.5.5 0 0 1-.5-.5m5.5 3a.5.5 0 1 0 0 1h6a.5.5 0 0 0 0-1zm0-5a.5.5 0 1 0 0 1h6a.5.5 0 0 0 0-1z"},gn=({className:t,size:e=24})=>is("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:is("path",{clipRule:"evenodd",d:Rp[e],fill:"currentColor",fillRule:"evenodd"})});var ss=[te([{ChildComponent:gn,isActive:({selection:t})=>{if(!Ap(t))return!1;for(let e of t.getNodes()){if(Cn(e)&&e.getListType()==="number")continue;let o=e.getParent();if(Cn(o)&&o.getListType()==="number")continue;let n=o?.getParent();if(!(Cn(n)&&n.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(as,void 0)},order:10}])],$p=A(({featureProviderMap:t})=>{let e=so("ordered",t);return{markdownTransformers:[Mp],nodes:e?[Ip,vp]:[],plugins:e?[{Component:lt,position:"normal"}]:[],slashMenu:{groups:[it([{Icon:gn,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:o})=>o.t("lexical:orderedList:label"),onSelect:({editor:o})=>{o.dispatchCommand(as,void 0)}}])]},toolbarFixed:{groups:ss},toolbarInline:{groups:ss}}});import{$isListNode as bn,INSERT_UNORDERED_LIST_COMMAND as ds,ListItemNode as Op,ListNode as Fp}from"@lexical/list";import{UNORDERED_LIST as Pp}from"@lexical/markdown";import{$isRangeSelection as Bp}from"lexical";import{jsx as cs}from"react/jsx-runtime";import"react";var Dp="M7 16C7.55228 16 8 16.4477 8 17C8 17.5523 7.55228 18 7 18C6.44772 18 6 17.5523 6 17C6 16.4477 6.44772 16 7 16ZM17.5 16.5C17.7761 16.5 18 16.7239 18 17C18 17.2761 17.7761 17.5 17.5 17.5H10.5C10.2239 17.5 10 17.2761 10 17C10 16.7239 10.2239 16.5 10.5 16.5H17.5ZM7 11C7.55228 11 8 11.4477 8 12C8 12.5523 7.55228 13 7 13C6.44772 13 6 12.5523 6 12C6 11.4477 6.44772 11 7 11ZM17.5 11.5C17.7761 11.5 18 11.7239 18 12C18 12.2761 17.7761 12.5 17.5 12.5H10.5C10.2239 12.5 10 12.2761 10 12C10 11.7239 10.2239 11.5 10.5 11.5H17.5ZM7 6C7.55228 6 8 6.44772 8 7C8 7.55228 7.55228 8 7 8C6.44772 8 6 7.55228 6 7C6 6.44772 6.44772 6 7 6ZM17.5 6.5C17.7761 6.5 18 6.72386 18 7C18 7.27614 17.7761 7.5 17.5 7.5H10.5C10.2239 7.5 10 7.27614 10 7C10 6.72386 10.2239 6.5 10.5 6.5H17.5Z",xn=({className:t})=>cs("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:cs("path",{d:Dp,fill:"currentColor"})});var us=[te([{ChildComponent:xn,isActive:({selection:t})=>{if(!Bp(t))return!1;for(let e of t.getNodes()){if(bn(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(bn(o)&&o.getListType()==="bullet")continue;let n=o?.getParent();if(!(bn(n)&&n.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ds,void 0)},order:11}])],jp=A({markdownTransformers:[Pp],nodes:[Fp,Op],plugins:[{Component:lt,position:"normal"}],slashMenu:{groups:[it([{Icon:xn,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ds,void 0)}}])]},toolbarFixed:{groups:us},toolbarInline:{groups:us}});import{$setBlocksType as ps}from"@lexical/selection";import{$createParagraphNode as hs,$getSelection as gs,$isParagraphNode as ms,$isRangeSelection as Hp}from"lexical";var fs=[te([{ChildComponent:wt,isActive:({selection:t})=>{if(!Hp(t))return!1;for(let e of t.getNodes())if(!ms(e)&&!ms(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=gs();ps(e,()=>hs())})},order:1}])],Gp=A({slashMenu:{groups:[J([{Icon:wt,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=gs();ps(e,()=>hs())})}}])]},toolbarFixed:{groups:fs},toolbarInline:{groups:fs}});import{c as d0}from"react/compiler-runtime";import{jsx as Os}from"react/jsx-runtime";import{useLexicalComposerContext as m0}from"@lexical/react/LexicalComposerContext";import{useEffect as f0,useState as p0}from"react";import{jsx as Ds,Fragment as u0}from"react/jsx-runtime";import"react";import{jsx as Up}from"react/jsx-runtime";var Cs={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Up("blockquote",{children:o})}};import{jsx as zp}from"react/jsx-runtime";var xs={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=t.tag;return zp(n,{children:o})}};import{jsx as Vp}from"react/jsx-runtime";var bs={horizontalrule:Vp("hr",{})};import{jsx as Wp}from"react/jsx-runtime";var ks={linebreak:Wp("br",{})};import{jsx as _s}from"react/jsx-runtime";var Ts=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let n=o({nodes:e.children}),r=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0;return _s("a",{href:e.fields.url,rel:r,target:l,children:n})},link:({node:e,nodesToJSX:o})=>{let n=o({nodes:e.children}),r=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0,s=e.fields.url??"";return e.fields.linkType==="internal"&&(t?s=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),s="#")),_s("a",{href:s,rel:r,target:l,children:n})}});import{jsx as st,jsxs as Kp,Fragment as Xp}from"react/jsx-runtime";import{v4 as Jp}from"uuid";var ws={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=t.tag;return st(n,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let n=t.children.some(l=>l.type==="list"),r=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=Jp();return st("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${n?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:n?r:Kp(Xp,{children:[st("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),st("label",{htmlFor:l,children:r}),st("br",{})]})})}else return st("li",{className:`${n?"nestedListItem":""}`,style:n?{listStyleType:"none"}:void 0,value:t?.value,children:r})}};import{jsx as kn}from"react/jsx-runtime";var Es={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?kn("p",{children:o}):kn("p",{children:kn("br",{})})}};var Ss={tab:" "};import{jsx as It}from"react/jsx-runtime";var Ns={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return It("div",{className:"lexical-table-container",children:It("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:It("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=t.headerState>0?"th":"td",r=`lexical-table-cell-header-${t.headerState}`,l={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},s=t.colSpan&&t.colSpan>1?t.colSpan:void 0,i=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return It(n,{className:`lexical-table-cell ${r}`,colSpan:s,rowSpan:i,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return It("tr",{className:"lexical-table-row",children:o})}};import{jsx as ze}from"react/jsx-runtime";import"react";var O={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},Zp=O.IS_BOLD|O.IS_ITALIC|O.IS_STRIKETHROUGH|O.IS_UNDERLINE|O.IS_CODE|O.IS_SUBSCRIPT|O.IS_SUPERSCRIPT|O.IS_HIGHLIGHT,Yp="\xA0",qp=`
59
56
 
60
- `,Zs="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Ys="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",J0=new RegExp("^[^"+Ys+"]*["+Zs+"]"),X0=new RegExp("^[^"+Zs+"]*["+Ys+"]"),Z0={bold:O.IS_BOLD,code:O.IS_CODE,highlight:O.IS_HIGHLIGHT,italic:O.IS_ITALIC,strikethrough:O.IS_STRIKETHROUGH,subscript:O.IS_SUBSCRIPT,superscript:O.IS_SUPERSCRIPT,underline:O.IS_UNDERLINE},Y0={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},q0={center:O.IS_ALIGN_CENTER,end:O.IS_ALIGN_END,justify:O.IS_ALIGN_JUSTIFY,left:O.IS_ALIGN_LEFT,right:O.IS_ALIGN_RIGHT,start:O.IS_ALIGN_START},Q0={[O.IS_ALIGN_CENTER]:"center",[O.IS_ALIGN_END]:"end",[O.IS_ALIGN_JUSTIFY]:"justify",[O.IS_ALIGN_LEFT]:"left",[O.IS_ALIGN_RIGHT]:"right",[O.IS_ALIGN_START]:"start"},eh={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},th={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};var qs={text:({node:t})=>{let e=t.text;return t.format&O.IS_BOLD&&(e=ze("strong",{children:e})),t.format&O.IS_ITALIC&&(e=ze("em",{children:e})),t.format&O.IS_STRIKETHROUGH&&(e=ze("span",{style:{textDecoration:"line-through"},children:e})),t.format&O.IS_UNDERLINE&&(e=ze("span",{style:{textDecoration:"underline"},children:e})),t.format&O.IS_CODE&&(e=ze("code",{children:e})),t.format&O.IS_SUBSCRIPT&&(e=ze("sub",{children:e})),t.format&O.IS_SUPERSCRIPT&&(e=ze("sup",{children:e})),e}};import{jsx as At}from"react/jsx-runtime";var Qs={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,n=e.fields?.alt||o?.alt||"",r=o.url;if(!o.mimeType.startsWith("image"))return At("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return At("img",{alt:n,height:o.height,src:r,width:o.width});let l=[];for(let s in o.sizes){let i=o.sizes[s];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let u=i?.url;l.push(At("source",{media:`(max-width: ${i.width}px)`,srcSet:u,type:i.mimeType},s))}return l.push(At("img",{alt:n,height:o?.height,src:r,width:o?.width},"image")),At("picture",{children:l})}};var ct={...Ks,...qs,...Gs,...js,...Xs,...Hs,...Us,...zs,...Ws({}),...Qs,...Js};import{jsx as mo,Fragment as oh}from"react/jsx-runtime";import uo from"react";function ea(t){if(!!!t?.root?.children?.length)return!1;let o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let n=t?.root?.children[0];if(!n?.children||n?.children?.length===0)o=!0;else if(n?.children?.length===1){let r=n?.children[0];r?.type==="text"&&(r?.text?.length||(o=!0))}}return!o}function nh(t){return e=>{let o={...e,isEditor:!1,isJSXConverter:!0};if(t.Component)return t.Component(o);if(t.html){let n=typeof t.html=="function"?t.html(o):t.html;return mo("span",{dangerouslySetInnerHTML:{__html:n}})}return null}}function ta(t){return e=>{if(t.Component){let o={...e,isEditor:!1,isJSXConverter:!0};return t.Component(o)}if(t.Block){let o=e.node,n={childIndex:e.childIndex,converters:e.converters,formData:o.fields??{},isEditor:!1,isJSXConverter:!0,node:o,nodesToJSX:e.nodesToJSX,parent:e.parent};return uo.createElement(t.Block,n)}if(t.html){let o={...e,isEditor:!1,isJSXConverter:!0},n=typeof t.html=="function"?t.html(o):t.html;return mo("span",{dangerouslySetInnerHTML:{__html:n}})}return null}}function rh(t){let e={};for(let[o,n]of Object.entries(t)){if(!n||typeof n!="object")continue;if(o==="blocks"){e.blocks={};for(let[l,s]of Object.entries(n)){let i=s;(i.Component||i.Block||i.html)&&(e.blocks[l]=ta(i))}continue}if(o==="inlineBlocks"){e.inlineBlocks={};for(let[l,s]of Object.entries(n)){let i=s;(i.Component||i.Block||i.html)&&(e.inlineBlocks[l]=ta(i))}continue}let r=n;(r.Component||r.html)&&(e[o]=nh(r))}return e}function oa({converters:t,data:e,disableIndent:o,disableTextAlign:n,nodeMap:r}){if(ea(e)){let l=r?rh(r):void 0,s=l?{...t,...l,blocks:{...t.blocks,...l.blocks},inlineBlocks:{...t.inlineBlocks,...l.inlineBlocks}}:t;return na({converters:s,disableIndent:o,disableTextAlign:n,nodes:e.root.children,parent:e.root})}return mo(oh,{})}function na({converters:t,disableIndent:e,disableTextAlign:o,nodes:n,parent:r}){let l=t.unknown;return n.map((i,u)=>{let c;i.type==="block"?(c=t?.blocks?.[i?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${i?.fields?.blockType} block, but no converter is provided`)):i.type==="inlineBlock"?(c=t?.inlineBlocks?.[i?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${i?.fields?.blockType} inline block, but no converter is provided`)):c=t[i.type];try{!c&&l&&(c=l);let d;c?d=typeof c=="function"?c({childIndex:u,converters:t,node:i,nodesToJSX:p=>na({converters:p.converters??t,disableIndent:p.disableIndent??e,disableTextAlign:p.disableTextAlign??o,nodes:p.nodes,parent:p.parent??{...i,parent:r}}),parent:r}):c:d=mo("span",{children:"unknown node"},u);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(i.type))&&"format"in i&&i.format)switch(i.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(i.type))&&"indent"in i&&i.indent&&i.type!=="listitem"&&(a.paddingInlineStart=`${Number(i.indent)*40}px`),uo.isValidElement(d)){if(a.textAlign||a.paddingInlineStart){let m={...a,...d?.props?.style??{}};return uo.cloneElement(d,{key:u,style:m})}return uo.cloneElement(d,{key:u})}return d}catch(d){return console.error("Error converting lexical node to JSX:",d,"node:",i),null}}).filter(Boolean)}function Ln({className:t,converters:e,data:o,disableContainer:n,disableIndent:r,disableTextAlign:l,nodeMap:s}){if(!o)return null;let i=e,u={};i?typeof i=="function"?u=i({defaultConverters:ct}):u=i:u=ct;let c=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&oa({converters:u,data:o,disableIndent:r,disableTextAlign:l,nodeMap:s});return n?ra(lh,{children:c}):ra("div",{className:t??"payload-richtext",children:c})}function ia(){let t=ih(7),[e]=sh(),o;t[0]!==e?(o=()=>e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[n,r]=ch(o),l,s;t[2]!==e?(l=()=>e.registerUpdateListener(u=>{let{editorState:c}=u;r(c.toJSON())}),s=[e],t[2]=e,t[3]=l,t[4]=s):(l=t[3],s=t[4]),ah(l,s);let i;return t[5]!==n?(i=la("div",{className:"debug-jsx-converter",children:la(Ln,{converters:ct,data:n})}),t[5]=n,t[6]=i):i=t[6],i}var uh=A({plugins:[{Component:ia,position:"bottom"}]});var H={amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},black:"#000",blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},current:"currentColor",cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},inherit:"inherit",lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},transparent:"transparent",violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},white:"#fff",yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"}},dh={text:{"text-red":{css:{color:`light-dark(${H.red[600]}, ${H.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${H.orange[600]}, ${H.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${H.yellow[700]}, ${H.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${H.green[700]}, ${H.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${H.blue[600]}, ${H.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${H.purple[600]}, ${H.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${H.pink[600]}, ${H.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${H.red[400]}, ${H.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${H.orange[400]}, ${H.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${H.yellow[300]}, ${H.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${H.green[400]}, ${H.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${H.blue[400]}, ${H.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${H.purple[400]}, ${H.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${H.pink[400]}, ${H.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as Qh}from"lexical";import{jsx as sa}from"react/jsx-runtime";import"react";var mh="M9.5 6C9.77614 6 10 6.22386 10 6.5C10 6.77614 9.77614 7 9.5 7H7.5C7.22386 7 7 7.22386 7 7.5V16.5C7 16.7761 7.22386 17 7.5 17H16.5C16.7761 17 17 16.7761 17 16.5V14.5C17 14.2239 17.2239 14 17.5 14C17.7761 14 18 14.2239 18 14.5V16.5C18 17.3284 17.3284 18 16.5 18H7.5C6.67157 18 6 17.3284 6 16.5V7.5C6 6.67157 6.67157 6 7.5 6H9.5ZM17.5 6C17.7761 6 18 6.22386 18 6.5V11.5C18 11.7761 17.7761 12 17.5 12C17.2239 12 17 11.7761 17 11.5V7.70703L12.8535 11.8535C12.6583 12.0488 12.3417 12.0488 12.1465 11.8535C11.9512 11.6583 11.9512 11.3417 12.1465 11.1465L16.293 7H12.5C12.2239 7 12 6.77614 12 6.5C12 6.22386 12.2239 6 12.5 6H17.5Z",Rn=({className:t})=>sa("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:sa("path",{d:mh,fill:"currentColor"})});import{jsx as xh}from"react/jsx-runtime";import{$applyNodeReplacement as Ch}from"lexical";import*as ca from"react";import{DecoratorBlockNode as ph}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as fh}from"@lexical/utils";import{$applyNodeReplacement as hh}from"lexical";function gh(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:aa({relationTo:o,value:e})}:null}var Dt=class extends ph{__data;constructor({data:e,format:o,key:n}){super(o,n),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"relationship"}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:gh,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},n=aa(o);return n.setFormat(e.format),n}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return fh(o,e?.theme?.relationship),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function aa(t){return hh(new Dt({data:t}))}var bh=ca.lazy(()=>import("./RelationshipComponent-YCPAKOL7.js").then(t=>({default:t.RelationshipComponent})));function kh(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Ke({relationTo:o,value:e})}:null}var Ne=class extends Dt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:kh,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},n=Ke(o);return n.setFormat(e.format),n}decorate(e,o){return xh(bh,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ke(t){return Ch(new Ne({data:t}))}function yn(t){return t instanceof Ne}import{c as Hh}from"react/compiler-runtime";import{jsx as Uh}from"react/jsx-runtime";import{useLexicalComposerContext as Gh}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Vh}from"@lexical/utils";import{$getPreviousSelection as Wh,$getSelection as zh,$isParagraphNode as Kh,$isRangeSelection as Jh,COMMAND_PRIORITY_EDITOR as Xh,createCommand as Zh}from"lexical";import{useEffect as Yh}from"react";import{c as ma}from"react/compiler-runtime";import{jsx as vn}from"react/jsx-runtime";import{useLexicalComposerContext as pa}from"@lexical/react/LexicalComposerContext.js";import{toast as Mh}from"@payloadcms/ui";import{$getNodeByKey as Ah,COMMAND_PRIORITY_EDITOR as fa}from"lexical";import{useEffect as ha,useState as Dh}from"react";import{c as _h}from"react/compiler-runtime";import{jsx as Th}from"react/jsx-runtime";import{useLexicalComposerContext as Eh}from"@lexical/react/LexicalComposerContext";import{useListDrawer as wh,useModal as Sh}from"@payloadcms/ui";import{$getNodeByKey as ua,$getPreviousSelection as Nh,$getRoot as Lh,$getSelection as Rh,$isRangeSelection as yh,$setSelection as vh}from"lexical";import{useEffect as Ih,useState as da}from"react";var $t=t=>{let e=_h(23),[o]=Eh(),[n,r]=da(null),[l,s]=da(!1),[i,u,c]=wh(t),{closeDrawer:d,drawerSlug:a,isDrawerOpen:m,openDrawer:p}=c,{modalState:h}=Sh(),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{let N=Rh()??Nh();r(N)},e[0]=f):f=e[0];let g=f,_;e[1]!==o||e[2]!==n?(_=()=>{n&&o.update(()=>{if(yh(n)){let{anchor:N,focus:w}=n;ua(N.key)&&ua(w.key)&&vh(n.clone())}else Lh().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=n,e[3]=_):_=e[3];let L=_,v;e[4]!==d?(v=()=>{d()},e[4]=d,e[5]=v):v=e[5];let b=v,x,C;e[6]!==a||e[7]!==h||e[8]!==L||e[9]!==l?(x=()=>{if(!l)return;let N=h[a];N&&!N?.isOpen&&(s(!1),setTimeout(()=>{L()},1))},C=[h,a,L,l],e[6]=a,e[7]=h,e[8]=L,e[9]=l,e[10]=x,e[11]=C):(x=e[10],C=e[11]),Ih(x,C);let k;e[12]!==u?(k=N=>Th(u,{...N,onClick:()=>{g()}}),e[12]=u,e[13]=k):k=e[13];let T;e[14]!==p?(T=()=>{g(),p(),s(!0)},e[14]=p,e[15]=T):T=e[15];let I;return e[16]!==i||e[17]!==b||e[18]!==m||e[19]!==a||e[20]!==k||e[21]!==T?(I={closeListDrawer:b,isListDrawerOpen:m,ListDrawer:i,listDrawerSlug:a,ListDrawerToggler:k,openListDrawer:T},e[16]=i,e[17]=b,e[18]=m,e[19]=a,e[20]=k,e[21]=T,e[22]=I):I=e[22],I};var $h=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=Ah(o);r&&r.replace(Ke({relationTo:e,value:n}))}):t.dispatchCommand(In,{relationTo:e,value:n})},Oh=t=>{let e=ma(14),{enabledCollectionSlugs:o}=t,[n]=pa(),[r,l]=Dh(null),s=o?.[0],i;e[0]!==o||e[1]!==s?(i={collectionSlugs:o,selectedCollection:s},e[0]=o,e[1]=s,e[2]=i):i=e[2];let{closeListDrawer:u,ListDrawer:c,openListDrawer:d}=$t(i),a,m;e[3]!==n||e[4]!==d?(a=()=>n.registerCommand(Qe,g=>(l(g?.replace?g?.replace.nodeKey:null),d(),!0),fa),m=[n,d],e[3]=n,e[4]=d,e[5]=a,e[6]=m):(a=e[5],m=e[6]),ha(a,m);let p;e[7]!==u||e[8]!==n||e[9]!==r?(p=g=>{let{collectionSlug:_,doc:L}=g;$h({editor:n,relationTo:_,replaceNodeKey:r,value:L.id}),u()},e[7]=u,e[8]=n,e[9]=r,e[10]=p):p=e[10];let h=p,f;return e[11]!==c||e[12]!==h?(f=vn(c,{onSelect:h}),e[11]=c,e[12]=h,e[13]=f):f=e[13],f},Fh=()=>{let t=ma(3),[e]=pa(),o,n;return t[0]!==e?(o=()=>e.registerCommand(Qe,Bh,fa),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),ha(o,n),null},ga=({enabledCollectionSlugs:t})=>t?.length?vn(Oh,{enabledCollectionSlugs:t}):vn(Fh,{});function Bh(){return Mh.error("No relationship collections enabled"),!0}import{useConfig as Ph,useEntityVisibility as jh}from"@payloadcms/ui";import*as Ca from"react";var xa=(t,{disabledCollections:e,enabledCollections:o,uploads:n,visibleSlugs:r})=>{let l=o?.length?new Set(o):null,s=e?.length?new Set(e):null;return t.filter(i=>{let{slug:u,admin:c,upload:d}=i;if(r&&!r.includes(u))return!1;if(n){if(!c?.enableRichTextRelationship||!d)return!1}else if(d||!c?.enableRichTextRelationship)return!1;return!(l&&!l.has(u)||s&&s.has(u))})};var po=t=>{let{collectionSlugsBlacklist:e,collectionSlugsWhitelist:o,uploads:n=!1}=t||{},{config:{collections:r}}=Ph(),{visibleEntities:l}=jh();return Ca.useMemo(()=>{let s=xa(r,{disabledCollections:e,enabledCollections:o,uploads:n,visibleSlugs:l?.collections});return{enabledCollections:s,enabledCollectionSlugs:s.map(i=>i.slug)}},[r,l,n,o,e])};var In=Zh("INSERT_RELATIONSHIP_COMMAND"),ba=t=>{let e=Hh(8),{clientProps:o}=t,[n]=Gh(),r=o?.disabledCollections,l=o?.enabledCollections,s;e[0]!==r||e[1]!==l?(s={collectionSlugsBlacklist:r,collectionSlugsWhitelist:l},e[0]=r,e[1]=l,e[2]=s):s=e[2];let{enabledCollectionSlugs:i}=po(s),u,c;e[3]!==n?(u=()=>{if(!n.hasNodes([Ne]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return n.registerCommand(In,qh,Xh)},c=[n],e[3]=n,e[4]=u,e[5]=c):(u=e[4],c=e[5]),Yh(u,c);let d;return e[6]!==i?(d=Uh(ga,{enabledCollectionSlugs:i}),e[6]=i,e[7]=d):d=e[7],d};function qh(t){let e=zh()||Wh();if(Jh(e)){let o=Ke(t),{focus:n}=e,r=n.getNode();Vh(o),Kh(r)&&!r.__first&&r.remove()}return!0}var e5=A({nodes:[Ne],plugins:[{Component:ba,position:"normal"}],slashMenu:{groups:[X([{Icon:Rn,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Qe,{replace:!1})}}])]},toolbarFixed:{groups:[_e([{ChildComponent:Rn,isActive:({selection:t})=>{if(!Qh(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return yn(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Qe,{replace:!1})}}])]}});import{c as R5}from"react/compiler-runtime";import{jsx as fe,jsxs as y5}from"react/jsx-runtime";import{useLexicalComposerContext as v5}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as ya}from"@lexical/react/useLexicalEditable";import{useScrollInfo as I5,useThrottledEffect as M5,useTranslation as A5}from"@payloadcms/ui";import*as xo from"react";import{useMemo as On}from"react";import{jsx as t5,jsxs as o5}from"react/jsx-runtime";import{Tooltip as n5,useTranslation as r5}from"@payloadcms/ui";import{$addUpdateTag as l5}from"lexical";import{useCallback as ka,useEffect as i5,useMemo as _a,useRef as s5,useState as a5}from"react";var Mn="toolbar-popup__button",Ot=({active:t=!1,children:e,editor:o,enabled:n=!0,item:r})=>{let{i18n:l}=r5(),{fieldProps:{featureClientSchemaMap:s,schemaPath:i}}=G(),[u,c]=a5(!1),d=s5(null);i5(()=>{d.current?.removeAttribute("data-pressing")},[t]);let a=_a(()=>r.label?typeof r.label=="function"?r.label({featureClientSchemaMap:s,i18n:l,schemaPath:i}):r.label:r.key.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,f=>f.toUpperCase()),[s,l,i,r]),m=_a(()=>[Mn,n?"":"disabled",t?"active":"",r.key?`${Mn}-${r.key}`:""].filter(Boolean).join(" "),[t,n,r.key]),p=ka(()=>{n&&o.focus(()=>{o.update(()=>{l5("toolbar")}),r.onSelect?.({editor:o,isActive:t})})},[o,r,t,n]),h=ka(f=>{f.preventDefault(),f.currentTarget.setAttribute("data-pressing","")},[]);return o5("button",{"aria-label":a,className:m,"data-button-key":r.key,disabled:!n,onClick:p,onMouseDown:h,onPointerEnter:()=>c(!0),onPointerLeave:()=>{c(!1),d.current?.removeAttribute("data-pressing")},ref:d,type:"button",children:[t5(n5,{className:`${Mn}__tooltip`,show:u,children:a}),e]})};import{c as h5}from"react/compiler-runtime";import{jsx as ut}from"react/jsx-runtime";import g5,{useMemo as x5}from"react";import{useTranslation as C5}from"@payloadcms/ui";import{jsx as Ae,jsxs as Ta}from"react/jsx-runtime";import{Button as c5}from"@payloadcms/ui";import{$addUpdateTag as u5,isDOMNode as d5}from"lexical";import fo,{useCallback as m5,useEffect as ho,useMemo as wa,useRef as An,useState as Dn}from"react";import{createPortal as p5}from"react-dom";var Ea="toolbar-popup__dropdown-item",Sa=fo.createContext(null);function Na({active:t,children:e,editor:o,enabled:n,Icon:r,item:l,itemKey:s,tooltip:i}){let u=wa(()=>[Ea,n===!1?"disabled":"",t?"active":"",l?.key?`${Ea}-${l.key}`:""].filter(Boolean).join(" "),[n,t,l.key]),c=An(null),d=fo.use(Sa);if(d===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=d;return ho(()=>{c?.current!=null&&a(c)},[c,a]),Ae(c5,{"aria-label":i,buttonStyle:"ghost",className:u,disabled:n===!1,extraButtonProps:{"data-item-key":s},icon:r,iconPosition:"left",onClick:()=>{n!==!1&&o.focus(()=>{o.update(()=>{u5("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:c,tooltip:i,type:"button",children:e})}function f5({children:t,dropdownKey:e,dropDownRef:o,itemsContainerClassNames:n,onClose:r}){let[l,s]=Dn(),[i,u]=Dn(),c=m5(m=>{s(p=>p!=null?[...p,m]:[m])},[s]),d=m=>{if(l==null)return;let{key:p}=m;["ArrowDown","ArrowUp","Escape","Tab"].includes(p)&&m.preventDefault(),p==="Escape"||p==="Tab"?r():p==="ArrowUp"?u(h=>{if(h==null)return l[0];let f=l.indexOf(h)-1;return l[f===-1?l.length-1:f]}):p==="ArrowDown"&&u(h=>h==null?l[0]:l[l.indexOf(h)+1])},a=wa(()=>({registerItem:c}),[c]);return ho(()=>{l!=null&&i==null&&u(l[0]),i!=null&&i?.current!=null&&i.current.focus()},[l,i]),Ae(Sa,{value:a,children:Ae("div",{className:(n??["toolbar-popup__dropdown-items"]).join(" "),"data-dropdown-key":e,"data-theme":"dark",onKeyDown:d,ref:o,children:t})})}function La({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:n=!1,dropdownKey:r,Icon:l,itemsContainerClassNames:s,label:i,stopCloseOnClickSelf:u}){let c=An(null),d=An(null),[a,m]=Dn(!1),p=()=>{m(!1),d?.current!=null&&d.current.focus()};ho(()=>{let f=d.current,g=c.current;if(a&&f!==null&&g!==null){let{left:_,top:L}=f.getBoundingClientRect(),v=window.scrollY||document.documentElement.scrollTop;g.style.top=`${L+v+f.offsetHeight+5}px`,g.style.left=`${Math.min(_-5,window.innerWidth-g.offsetWidth-20)}px`}},[c,d,a]),ho(()=>{let f=d.current;if(f!==null&&a){let g=_=>{let L=_.target;d5(L)&&(u&&c.current&&c.current.contains(L)||f.contains(L)||m(!1))};return document.addEventListener("click",g),()=>{document.removeEventListener("click",g)}}},[c,d,a,u]);let h=p5(Ae(f5,{dropdownKey:r,dropDownRef:c,itemsContainerClassNames:s,onClose:p,children:o}),document.body);return Ta(fo.Fragment,{children:[Ta("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":r,disabled:n,onClick:f=>{f.preventDefault(),m(!a)},onMouseDown:f=>{f.preventDefault()},ref:d,type:"button",children:[l&&Ae(l,{}),i&&Ae("span",{className:"toolbar-popup__dropdown-label",children:i}),Ae("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&Ae(fo.Fragment,{children:h})]})}var $n="toolbar-popup__dropdown",b5=t=>{let e=h5(15),{active:o,anchorElem:n,editor:r,enabled:l,iconOnly:s,item:i}=t,{i18n:u}=C5(),{fieldProps:c}=G(),{featureClientSchemaMap:d,schemaPath:a}=c;if(i.Component){let p;return e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==l||e[4]!==i?(p=i?.Component&&ut(i.Component,{active:o,anchorElem:n,editor:r,enabled:l,item:i},i.key),e[0]=o,e[1]=n,e[2]=r,e[3]=l,e[4]=i,e[5]=p):p=e[5],p}let m;if(e[6]!==o||e[7]!==r||e[8]!==l||e[9]!==d||e[10]!==u||e[11]!==s||e[12]!==i||e[13]!==a){let p=i.key,h;i.label&&(p=typeof i.label=="function"?i.label({featureClientSchemaMap:d,i18n:u,schemaPath:a}):i.label),p.length>25?h=p.substring(0,25)+"...":h=p,m=ut(Na,{active:o,editor:r,enabled:l,Icon:i?.ChildComponent?ut(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:s?p:void 0,children:ut("span",{className:"text",children:h})},i.key),e[6]=o,e[7]=r,e[8]=l,e[9]=d,e[10]=u,e[11]=s,e[12]=i,e[13]=a,e[14]=m}else m=e[14];return m},k5=g5.memo(b5),Ft=({anchorElem:t,classNames:e,editor:o,group:n,groupState:r,Icon:l,itemsContainerClassNames:s,label:i})=>{let{items:u,key:c}=n,d=x5(()=>u?.length?u.map(a=>ut(k5,{active:r.activeItemKeys.includes(a.key),anchorElem:t,editor:o,enabled:r.enabledItemKeys.includes(a.key),iconOnly:n.iconOnly,item:a},a.key)):null,[u,r.activeItemKeys,r.enabledItemKeys,t,o]);return ut(La,{buttonAriaLabel:`${c} dropdown`,buttonClassName:[$n,`${$n}-${c}`,...e||[]].filter(Boolean).join(" "),disabled:!r.enabledGroup,dropdownKey:c,Icon:l,itemsContainerClassNames:[`${$n}-items`,...s||[]],label:i,children:d},c)};import{mergeRegister as _5}from"@lexical/utils";import{$getSelection as T5}from"lexical";import{useCallback as E5,useDeferredValue as w5,useEffect as S5,useRef as Ra,useState as N5}from"react";function L5(t){let e=new Map,o=new Map;if(!t?.length)return{groupStates:o,itemStates:e};for(let n of t){let r=[];for(let l of n.items)e.set(l.key,{active:!1,enabled:!0}),r.push(l.key);o.set(n.key,{activeItemKeys:[],activeItems:[],enabledGroup:!0,enabledItemKeys:r})}return{groupStates:o,itemStates:e}}function go(t,e){let[o,n]=N5(()=>L5(e)),r=w5(o),l=G(),s=Ra(l);s.current=l;let i=Ra(e);i.current=e;let u=_r(),c=E5(()=>{t.getEditorState().read(()=>{let d=T5();if(!d)return;let a=i.current;if(!a?.length)return;let m=s.current,p=new Map,h=new Map;for(let f of a){let g=[],_=[],L=[],v=f.type==="dropdown"?f.maxActiveItems??1:void 0;for(let x of f.items){let C=x.isActive?(!v||g.length<v)&&x.isActive({editor:t,editorConfigContext:m,selection:d}):!1,k=x.isEnabled?x.isEnabled({editor:t,editorConfigContext:m,selection:d}):!0;C&&(g.push(x.key),_.push(x)),k&&L.push(x.key),p.set(x.key,{active:C,enabled:k})}let b=f.type==="dropdown"&&f.isEnabled?f.isEnabled({editor:t,editorConfigContext:m,selection:d}):!0;h.set(f.key,{activeItemKeys:g,activeItems:_,enabledGroup:b,enabledItemKeys:L})}n({groupStates:h,itemStates:p})})},[t]);return S5(()=>{u(c);let d=()=>{u(c)},a=_5(t.registerUpdateListener(d));return document.addEventListener("mouseup",d),()=>{a(),document.removeEventListener("mouseup",d)}},[t,u,c]),r}function D5({active:t,anchorElem:e,editor:o,enabled:n,item:r}){return r.Component?r?.Component&&fe(r.Component,{anchorElem:e,editor:o,item:r},r.key):r.ChildComponent?fe(Ot,{active:t,editor:o,enabled:n,item:r,children:fe(r.ChildComponent,{})},r.key):null}function $5({anchorElem:t,editor:e,editorConfig:o,group:n,index:r,toolbarStates:l}){let{i18n:s}=A5(),{fieldProps:{featureClientSchemaMap:i,schemaPath:u}}=G(),c=l.groupStates.get(n.key),d=On(()=>{if(n.type!=="dropdown")return;let m=c?.activeItems?.[0];return m?m.ChildComponent:n.ChildComponent},[n,c?.activeItems]),a=On(()=>{if(n.type!=="dropdown")return;let m=c?.activeItems;if(!m?.length)return;if(m.length>1)return s.t("lexical:general:toolbarItemsActive",{count:m.length});let p=m[0],h=p.key;return p.label&&(h=typeof p.label=="function"?p.label({featureClientSchemaMap:i,i18n:s,schemaPath:u}):p.label),h.length>25&&(h=h.substring(0,25)+"..."),h},[n,c?.activeItems,s,i,u]);return y5("div",{className:`fixed-toolbar__group fixed-toolbar__group-${n.key}`,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length&&c?fe(Ft,{anchorElem:t,editor:e,group:n,groupState:c,Icon:d,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a}):null,n.type==="buttons"&&n.items.length?n.items.map(m=>{let p=l.itemStates.get(m.key);return fe(D5,{active:p?.active??!1,anchorElem:t,editor:e,enabled:p?.enabled??!0,item:m},m.key)}):null,r<o.features.toolbarFixed?.groups.length-1&&fe("div",{className:"divider"})]},n.key)}function O5({anchorElem:t,clientProps:e,editor:o,editorConfig:n,parentWithFixedToolbar:r}){let l=xo.useRef(null),s=ya(),{y:i}=I5(),u=go(o,n?.features?.toolbarFixed?.groups),c=On(()=>{if(!r||e?.disableIfParentHasFixedToolbar)return null;let a=r.editorContainerRef.current.previousElementSibling;for(;a;){if(a.classList.contains("fixed-toolbar"))return a;a=a.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,r]);return M5(()=>{if(!c)return;let d=l.current;if(!d)return;let a=d.getBoundingClientRect(),m=c.getBoundingClientRect();if(!(a.bottom<m.top||a.top>m.bottom))d.classList.remove("fixed-toolbar"),d.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!d.classList.contains("fixed-toolbar--overlapping"))return;d.classList.remove("fixed-toolbar--overlapping"),d.classList.add("fixed-toolbar"),c.classList.remove("fixed-toolbar--hide"),c.classList.add("fixed-toolbar")}},50,[l,c,i]),fe("div",{className:"fixed-toolbar",onFocus:d=>{d.stopPropagation()},ref:l,children:s&&fe(xo.Fragment,{children:n?.features&&n.features?.toolbarFixed?.groups.map((d,a)=>fe($5,{anchorElem:t,editor:o,editorConfig:n,group:d,index:a,toolbarStates:u},d.key))})})}var va=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return va(t.parentEditor)}return!1},Ia=t=>{let e=R5(6),{clientProps:o}=t,[n]=v5(),r=G();if(!ya())return null;let{editorConfig:s}=r,i=o.applyToFocusedEditor&&r.focusedEditor?.editor||n,u=o.applyToFocusedEditor&&r.focusedEditor?.editorConfig||s,c,d;if(e[0]!==o||e[1]!==i||e[2]!==u||e[3]!==r){d=Symbol.for("react.early_return_sentinel");e:{let a=va(r);if(o?.disableIfParentHasFixedToolbar&&a){d=null;break e}if(!u?.features?.toolbarFixed?.groups?.length){d=null;break e}c=fe(O5,{anchorElem:document.body,clientProps:o,editor:i,editorConfig:u,parentWithFixedToolbar:a})}e[0]=o,e[1]=i,e[2]=u,e[3]=r,e[4]=c,e[5]=d}else c=e[4],d=e[5];return d!==Symbol.for("react.early_return_sentinel")?d:c};var F5=A({plugins:[{Component:Ia,position:"aboveContainer"}]});import{c as B5}from"react/compiler-runtime";import{jsx as Le,jsxs as Da}from"react/jsx-runtime";import{useLexicalComposerContext as P5}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as j5}from"@lexical/react/useLexicalEditable";import{mergeRegister as $a}from"@lexical/utils";import{$getSelection as Oa,$isRangeSelection as Ma,$isTextNode as H5,COMMAND_PRIORITY_LOW as U5,getDOMSelection as Fa,SELECTION_CHANGE_COMMAND as G5}from"lexical";import{useCallback as bo,useEffect as Bt,useMemo as V5,useRef as Aa,useState as W5}from"react";import"react";import{createPortal as z5}from"react-dom";function Fn(t,e){let o=t.getRangeAt(0),n;if(t.anchorNode===e){let r=e;for(;r.firstElementChild!=null;)r=r.firstElementChild;n=r.getBoundingClientRect()}else n=o.getBoundingClientRect();return n}function Co(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:n=0,floatingElem:r,horizontalOffset:l=32,horizontalPosition:s="left",specialHandlingForCaret:i=!1,targetRect:u,verticalGap:c=10}=t,d=o.parentElement;if(u===null||d==null){r.style.opacity="0",r.style.transform="translate(-10000px, -10000px)";return}let a=r.getBoundingClientRect(),m=o.getBoundingClientRect(),p=d.getBoundingClientRect(),h=u.top-a.height-c,f=u.left-l;s==="center"&&(f=u.left+u.width/2-a.width/2);let g=0;return!e&&h<p.top&&!i&&(g=a.height+u.height+c*2,h+=g),s==="center"?f+a.width>p.right?f=p.right-a.width-l:f<p.left&&(f=p.left+l):f+a.width>p.right&&(f=p.right-a.width-l),f-=m.left,r.style.opacity="1",i&&n!==0?(h-=m.bottom-n+a.height-3,r.style.transform=`translate(${f}px, ${h}px) rotate(180deg)`):(h-=m.top,r.style.transform=`translate(${f}px, ${h}px)`),g}function K5({active:t,anchorElem:e,editor:o,enabled:n,item:r}){return r.Component?r?.Component&&Le(r.Component,{anchorElem:e,editor:o,item:r},r.key):r.ChildComponent?Le(Ot,{active:t,editor:o,enabled:n,item:r,children:Le(r.ChildComponent,{})},r.key):null}function J5({anchorElem:t,editor:e,group:o,index:n,toolbarStates:r}){let{editorConfig:l}=G(),s=r.groupStates.get(o.key),i=V5(()=>o.type!=="dropdown"?void 0:s?.activeItems?.[0]?.ChildComponent??o.ChildComponent,[o,s?.activeItems]);return Da("div",{className:`inline-toolbar-popup__group inline-toolbar-popup__group-${o.key}`,"data-toolbar-group-key":o.key,children:[o.type==="dropdown"&&o.items.length&&s?Le(Ft,{anchorElem:t,editor:e,group:o,groupState:s,Icon:i}):null,o.type==="buttons"&&o.items.length?o.items.map(u=>{let c=r.itemStates.get(u.key);return Le(K5,{active:c?.active??!1,anchorElem:t,editor:e,enabled:c?.enabled??!0,item:u},u.key)}):null,n<l.features.toolbarInline?.groups.length-1&&Le("div",{className:"divider"})]},o.key)}function X5({anchorElem:t,editor:e}){let o=Aa(null),n=Aa(null),{editorConfig:r}=G(),l=go(e,r?.features?.toolbarInline?.groups),s=bo(()=>{if(o?.current){let d=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";d||(o.current.style.opacity="0"),a||(o.current.style.pointerEvents="none")}},[o]),i=bo(d=>{if(o?.current&&(d.buttons===1||d.buttons===3)){let a=o.current.style.opacity==="0",m=o.current.style.pointerEvents==="none";if(!a||!m){let p=d.clientX,h=d.clientY,f=document.elementFromPoint(p,h);o.current.contains(f)||s()}}},[s]),u=bo(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Bt(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",u),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",u)}),[o,i,u]);let c=bo(()=>{let d=Oa(),a=Fa(e._window);if(o.current===null)return;let m=t.querySelector(":scope > .link-editor"),p=m!==null&&"style"in m&&m?.style?.opacity==="1",h=e.getRootElement();if(d!==null&&a!==null&&!a.isCollapsed&&h!==null&&h.contains(a.anchorNode)){let f=Fn(a,h),g=Co({alwaysDisplayOnTop:p,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});n.current&&Co({anchorElem:o.current,anchorFlippedOffset:g,floatingElem:n.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else s()},[e,s,t]);return Bt(()=>{let d=t.parentElement,a=()=>{e.getEditorState().read(()=>{c()})};return window.addEventListener("resize",a),d&&d.addEventListener("scroll",a),()=>{window.removeEventListener("resize",a),d&&d.removeEventListener("scroll",a)}},[e,c,t]),Bt(()=>(e.getEditorState().read(()=>{c()}),$a(e.registerUpdateListener(({editorState:d})=>{d.read(()=>{c()})}),e.registerCommand(G5,()=>(c(),!1),U5))),[e,c]),Da("div",{className:"inline-toolbar-popup",ref:o,children:[Le("div",{className:"caret",ref:n}),r?.features&&r.features?.toolbarInline?.groups.map((d,a)=>Le(J5,{anchorElem:t,editor:e,group:d,index:a,toolbarStates:l},d.key))]})}function Z5(t,e){let o=B5(12),[n,r]=W5(!1),l=j5(),s;o[0]!==t?(s=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=Oa(),h=Fa(t._window),f=t.getRootElement();if(h!==null&&(!Ma(p)||f===null||!f.contains(h.anchorNode))){r(!1);return}if(!Ma(p))return;if(p.getTextContent()!==""){let _=p.getNodes(),L=!1;for(let v of _)if(H5(v)){r(!0),L=!0;break}L||r(!1)}else r(!1);let g=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&g===""){r(!1);return}})},o[0]=t,o[1]=s):s=o[1];let i=s,u,c;o[2]!==i?(u=()=>(document.addEventListener("selectionchange",i),document.addEventListener("mouseup",i),()=>{document.removeEventListener("selectionchange",i),document.removeEventListener("mouseup",i)}),c=[i],o[2]=i,o[3]=u,o[4]=c):(u=o[3],c=o[4]),Bt(u,c);let d,a;if(o[5]!==t||o[6]!==i?(d=()=>$a(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&r(!1)})),a=[t,i],o[5]=t,o[6]=i,o[7]=d,o[8]=a):(d=o[7],a=o[8]),Bt(d,a),!n||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=z5(Le(X5,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var Ba=t=>{let{anchorElem:e}=t,[o]=P5();return Z5(o,e)};var Y5=A({plugins:[{Component:Ba,position:"floatingAnchorElem"}]});import{TableCellNode as H2,TableNode as U2,TableRowNode as G2}from"@lexical/table";import{jsx as Pa}from"react/jsx-runtime";import"react";var q5={16:"M7 4h4.5a.5.5 0 0 1 .5.5V6H7zM6 4H4.5a.5.5 0 0 0-.5.5V6h2zm0 3H4v2h2zm0 3H4v1.5a.5.5 0 0 0 .5.5H6zm1 2h4.5a.5.5 0 0 0 .5-.5V10H7zm0-3V7h5v2zM3 4.5A1.5 1.5 0 0 1 4.5 3h7A1.5 1.5 0 0 1 13 4.5v7a1.5 1.5 0 0 1-1.5 1.5h-7A1.5 1.5 0 0 1 3 11.5z",24:"M17.204 6.51A2 2 0 0 1 19 8.5V16l-.011.204a2 2 0 0 1-1.785 1.785L17 18H7l-.204-.01a2 2 0 0 1-1.786-1.786L5 16V8.5a2 2 0 0 1 1.796-1.99L7 6.5h10zM6 16a1 1 0 0 0 1 1h2v-2.5H6zm4-1.5V17h7a1 1 0 0 0 .995-.898L18 16v-1.5zm-4-1h3V11H6zm4-2.5v2.5h8V11zM7 7.5a1 1 0 0 0-.995.897L6 8.5V10h3V7.5zm3 2.5h8V8.5a1 1 0 0 0-1-1h-7z"},Bn=({className:t,size:e=24})=>Pa("svg",{className:["icon",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Pa("path",{clipRule:"evenodd",d:q5[e],fill:"currentColor",fillRule:"evenodd"})});import{$createTableCellNode as Q5,$createTableNode as eg,$createTableRowNode as tg,$isTableCellNode as ja,$isTableNode as Pn,$isTableRowNode as jn,TableCellHeaderStates as ko,TableCellNode as og,TableNode as ng,TableRowNode as rg}from"@lexical/table";import{$isParagraphNode as lg,$isTextNode as ig}from"lexical";var Ua=/^\|(.+)\|\s?$/,sg=/^(\| ?:?-*:? ?)+\|\s?$/,Ga=({allTransformers:t})=>({type:"element",dependencies:[ng,rg,og],export:e=>{if(!Pn(e))return null;let o=[];for(let n of e.getChildren()){let r=[];if(!jn(n))continue;let l=!1;for(let s of n.getChildren())ja(s)&&(r.push(sl(t,s).replace(/\n/g,"\\n").trim()),s.__headerState===ko.ROW&&(l=!0));o.push(`| ${r.join(" | ")} |`),l&&o.push(`| ${r.map(s=>"---").join(" | ")} |`)}return o.join(`
61
- `)},regExp:Ua,replace:(e,o,n)=>{let r=n[0];if(!r)return;if(sg.test(r)){let a=e.getPreviousSibling();if(!a||!Pn(a))return;let m=a.getChildren(),p=m[m.length-1];if(!p||!jn(p))return;p.getChildren().forEach(h=>{ja(h)&&h.setHeaderStyles(ko.ROW,ko.ROW)}),e.remove();return}let l=Ha(r,t);if(l==null)return;let s=[l],i=e.getPreviousSibling(),u=l.length;for(;i&&!(!lg(i)||i.getChildrenSize()!==1);){let a=i.getFirstChild();if(!ig(a))break;let m=Ha(a.getTextContent(),t);if(m==null)break;u=Math.max(u,m.length),s.unshift(m);let p=i.getPreviousSibling();i.remove(),i=p}let c=eg();for(let a of s){let m=tg();c.append(m);for(let p=0;p<u;p++)m.append(p<a.length?a[p]:Va("",t))}let d=e.getPreviousSibling();Pn(d)&&ag(d)===u?(d.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function ag(t){let e=t.getFirstChild();return jn(e)?e.getChildrenSize():0}var Va=(t,e)=>{t=t.replace(/\\n/g,`
62
- `);let o=Q5(ko.NO_STATUS);return qt(t,e,o),o},Ha=(t,e)=>{let o=t.match(Ua);return!o||!o[1]?null:o[1].split("|").map(n=>Va(n,e))};import{c as ug}from"react/compiler-runtime";import{jsx as j,jsxs as Re}from"react/jsx-runtime";import{useLexicalComposerContext as Za}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as dg}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Ka,$deleteTableColumnAtSelection as mg,$deleteTableRowAtSelection as pg,$getNodeTriplet as fg,$getTableCellNodeFromLexicalNode as Ja,$getTableColumnIndexFromTableCellNode as hg,$getTableNodeFromLexicalNodeOrThrow as $e,$getTableRowIndexFromTableCellNode as gg,$insertTableColumnAtSelection as xg,$insertTableRowAtSelection as Cg,$isTableCellNode as Ya,$isTableSelection as Pt,$mergeCells as bg,$unmergeCell as kg,getTableElement as Hn,getTableObserverFromTableElement as Un,TableCellHeaderStates as De,TableCellNode as _g}from"@lexical/table";import{mergeRegister as Tg}from"@lexical/utils";import{useScrollInfo as Eg}from"@payloadcms/ui";import{$getSelection as To,$isElementNode as wg,$isRangeSelection as Gn,$isTextNode as Sg,$setSelection as Ng,COMMAND_PRIORITY_CRITICAL as Lg,getDOMSelection as Rg,isDOMNode as yg,SELECTION_CHANGE_COMMAND as vg}from"lexical";import*as Vn from"react";import{useCallback as ue,useEffect as dt,useRef as _o,useState as mt}from"react";import{createPortal as qa}from"react-dom";import{jsx as Wa}from"react/jsx-runtime";import"react";var cg={16:"M5 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0m4 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 1a1 1 0 1 0 0-2 1 1 0 0 0 0 2",24:"M7.5 12a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m6 0a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m4.5 1.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3"},za=({className:t,size:e=24})=>Wa("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Wa("path",{clipRule:"evenodd",d:cg[e],fill:"currentColor",fillRule:"evenodd"})});function Xa(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function Ig(){let t=To();if(Gn(t)&&!t.isCollapsed()||Pt(t)&&!t.anchor.is(t.focus)||!Gn(t)&&!Pt(t))return!1;let[e]=fg(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Mg(t){let e=t.getLastDescendant();Sg(e)?e.select():wg(e)?e.selectEnd():e!==null&&e.selectNext()}function Ag({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[l]=Za(),s=_o(null),[i,u]=mt(r),[c,d]=mt({columns:1,rows:1}),[a,m]=mt(!1),[p,h]=mt(!1),{y:f}=Eg();dt(()=>l.registerMutationListener(_g,E=>{E.get(i.getKey())==="updated"&&l.getEditorState().read(()=>{u(i.getLatest())})},{skipInitialization:!0}),[l,i]),dt(()=>{l.getEditorState().read(()=>{let E=To();if(Pt(E)){let y=Xa(E);d(Xa(E)),m(y.columns>1||y.rows>1)}h(Ig())})},[l]),dt(()=>{let E=e.current,y=s.current,R=l.getRootElement();if(E!=null&&y!=null&&R!=null){let M=R.getBoundingClientRect(),D=E.getBoundingClientRect();y.style.opacity="1";let $=y.getBoundingClientRect(),F=5,B=D.right+F;if(B+$.width>window.innerWidth||B+$.width>M.right){let J=D.left-$.width-F;B=(J<0?F:J)+window.pageXOffset}y.style.left=`${B+window.pageXOffset}px`;let Y=D.top;if(Y+$.height>window.innerHeight){let J=D.bottom-$.height;Y=J<0?F:J}y.style.top=`${Y}px`}},[e,s,l,f]),dt(()=>{function E(y){s.current!=null&&e.current!=null&&yg(y.target)&&!s.current.contains(y.target)&&!e.current.contains(y.target)&&n(!1)}return window.addEventListener("click",E),()=>window.removeEventListener("click",E)},[n,e]);let g=ue(()=>{l.update(()=>{if(i.isAttached()){let E=$e(i),y=Hn(E,l.getElementByKey(E.getKey()));if(y===null)throw new Error("Expected to find tableElement in DOM");let R=Un(y);R!==null&&R.$clearHighlight(),E.markDirty(),u(i.getLatest())}Ng(null)})},[l,i]),_=()=>{l.update(()=>{let E=To();if(!Pt(E))return;let R=E.getNodes().filter(Ya),M=bg(R);M&&(Mg(M),o())})},L=()=>{l.update(()=>{kg()})},v=ue(E=>{l.update(()=>{for(let y=0;y<c.rows;y++)Cg(E);o()})},[l,o,c.rows]),b=ue(E=>{l.update(()=>{for(let y=0;y<c.columns;y++)xg(E);o()})},[l,o,c.columns]),x=ue(()=>{l.update(()=>{pg(),o()})},[l,o]),C=ue(()=>{l.update(()=>{$e(i).remove(),g(),o()})},[l,i,g,o]),k=ue(()=>{l.update(()=>{mg(),o()})},[l,o]),T=ue(()=>{l.update(()=>{let E=$e(i),y=gg(i),[R]=Ka(E,null,null),M=new Set,D=i.getHeaderStyles()^De.ROW;if(R[y])for(let $=0;$<R[y].length;$++){let F=R[y][$];F?.cell&&(M.has(F.cell)||(M.add(F.cell),F.cell.setHeaderStyles(D,De.ROW)))}g(),o()})},[l,i,g,o]),I=ue(()=>{l.update(()=>{let E=$e(i),y=hg(i),[R]=Ka(E,null,null),M=new Set,D=i.getHeaderStyles()^De.COLUMN;if(R)for(let $=0;$<R.length;$++){let F=R?.[$]?.[y];F?.cell&&(M.has(F.cell)||(M.add(F.cell),F.cell.setHeaderStyles(D,De.COLUMN)))}g(),o()})},[l,i,g,o]),N=ue(()=>{l.update(()=>{if(i.isAttached()){let E=$e(i);E&&E.setRowStriping(!E.getRowStriping())}g(),o()})},[l,i,g,o]),w=ue(()=>{l.update(()=>{if(i.isAttached()){let E=$e(i);E&&E.setFrozenColumns(E.getFrozenColumns()===0?1:0)}g(),o()})},[l,i,g,o]),S=null;return t&&(a?S=j("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>_(),type:"button",children:j("span",{className:"text",children:"Merge cells"})}):p&&(S=j("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>L(),type:"button",children:j("span",{className:"text",children:"Unmerge cells"})}))),qa(Re("div",{className:"table-action-menu-dropdown",onClick:E=>{E.stopPropagation()},ref:s,children:[S?Re(Vn.Fragment,{children:[S,j("hr",{})]}):null,j("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>N(),type:"button",children:j("span",{className:"text",children:"Toggle row striping"})}),j("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>w(),type:"button",children:j("span",{className:"text",children:"Toggle first column freeze"})}),j("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>v(!1),type:"button",children:Re("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),j("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>v(!0),type:"button",children:Re("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>b(!1),type:"button",children:Re("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),j("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>b(!0),type:"button",children:Re("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>k(),type:"button",children:j("span",{className:"text",children:"Delete column"})}),j("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>x(),type:"button",children:j("span",{className:"text",children:"Delete row"})}),j("button",{className:"item","data-test-id":"table-delete",onClick:()=>C(),type:"button",children:j("span",{className:"text",children:"Delete table"})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-row-header",onClick:()=>T(),type:"button",children:Re("span",{className:"text",children:[(i.__headerState&De.ROW)===De.ROW?"Remove":"Add"," ","row header"]})}),j("button",{className:"item","data-test-id":"table-column-header",onClick:()=>I(),type:"button",children:Re("span",{className:"text",children:[(i.__headerState&De.COLUMN)===De.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function Dg({anchorElem:t,cellMerge:e}){let[o]=Za(),n=_o(null),r=_o(null),[l,s]=mt(!1),[i,u]=mt(null),c=ue(()=>{let a=n.current,m=To(),p=Rg(o._window),h=document.activeElement;function f(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),u(null)}if(m==null||a==null)return f();let g=o.getRootElement(),_=null,L=null;if(Gn(m)&&g!==null&&p!==null&&g.contains(p.anchorNode)){let b=Ja(m.anchor.getNode());if(b==null||(L=o.getElementByKey(b.getKey()),L==null||!b.isAttached()))return f();let x=$e(b),C=Hn(x,o.getElementByKey(x.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");_=Un(C),u(b)}else if(Pt(m)){let b=Ja(m.anchor.getNode());if(!Ya(b))throw new Error("TableSelection anchorNode must be a TableCellNode");let x=$e(b),C=Hn(x,o.getElementByKey(x.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");_=Un(C),L=o.getElementByKey(b.getKey())}else if(!h)return f();if(_===null||L===null)return f();let v=!_||!_.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",v),a.classList.toggle("table-cell-action-button-container--inactive",!v),v){let b=L.getBoundingClientRect(),x=t.getBoundingClientRect(),C=b.top-x.top,k=b.right-x.left;a.style.transform=`translate(${k}px, ${C}px)`}},[o,t]);dt(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(c)},p=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return Tg(o.registerUpdateListener(p),o.registerCommand(vg,p,Lg),o.registerRootListener((h,f)=>{f&&f.removeEventListener("pointerup",p),h&&(h.addEventListener("pointerup",p),p())}),()=>clearTimeout(a))});let d=_o(i);return dt(()=>{d.current!==i&&s(!1),d.current=i},[d,i]),j("div",{className:"table-cell-action-button-container",ref:n,children:i!=null&&Re(Vn.Fragment,{children:[j("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),s(!l)},ref:r,type:"button",children:j(za,{})}),l&&j(Ag,{cellMerge:e,contextRef:r,onClose:()=>s(!1),setIsMenuOpen:s,tableCellNode:i})]})})}var Qa=t=>{let e=ug(3),{anchorElem:o}=t,n=dg(),r;return e[0]!==o||e[1]!==n?(r=qa(n?j(Dg,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=n,e[2]=r):r=e[2],r};import{c as $g}from"react/compiler-runtime";import{jsx as wo,jsxs as Og}from"react/jsx-runtime";import{useLexicalComposerContext as Fg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Bg}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Pg,$getTableNodeFromLexicalNodeOrThrow as Wn,$getTableRowIndexFromTableCellNode as jg,$isTableCellNode as ec,$isTableRowNode as Hg,getDOMCellFromTarget as Ug,getTableElement as Gg,TableNode as tc}from"@lexical/table";import{calculateZoomLevel as oc,mergeRegister as Vg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as zn,isHTMLElement as Wg,SKIP_SCROLL_INTO_VIEW_TAG as nc}from"lexical";import*as lc from"react";import{useCallback as jt,useEffect as Kn,useRef as Eo,useState as pt}from"react";import{createPortal as zg}from"react-dom";var Kg=33,rc=92;function Jg({editor:t}){let e=Eo(null),o=Eo(null),n=Eo(null),[r,l]=pt(!1),s=G(),i=Eo(null),[u,c]=pt(null),[d,a]=pt(null),[m,p]=pt(!1),[h,f]=pt(null),g=jt(()=>{a(null),e.current=null,f(null),i.current=null,n.current=null},[]),_=w=>(w.buttons&1)===1;Kn(()=>{let w=new Set;return Vg(t.registerMutationListener(tc,S=>{for(let[E,y]of S)y==="destroyed"?w.delete(E):w.add(E);l(w.size>0)}),t.registerNodeTransform(tc,S=>{if(S.getColWidths())return S;let E=S.getColumnCount(),y=rc;return S.setColWidths(Array(E).fill(y)),S}))},[t]),Kn(()=>{if(!r)return;let w=R=>{let M=R.target;if(Wg(M)){if(h){c({x:R.clientX,y:R.clientY});return}if(p(_(R)),!(o.current&&o.current.contains(M))&&e.current!==M){e.current=M;let D=Ug(M);D&&d!==D?t.getEditorState().read(()=>{let $=zn(D.elem);if(!$)throw new Error("TableCellResizer: Table cell node not found.");let F=Wn($),B=Gg(F,t.getElementByKey(F.getKey()));if(!B)throw new Error("TableCellResizer: Table element not found.");e.current=M,n.current=B.getBoundingClientRect(),a(D)},{editor:t}):D==null&&g()}}},S=R=>{p(!0)},E=R=>{p(!1)},y=t.registerRootListener((R,M)=>{M?.removeEventListener("mousemove",w),M?.removeEventListener("mousedown",S),M?.removeEventListener("mouseup",E),R?.addEventListener("mousemove",w),R?.addEventListener("mousedown",S),R?.addEventListener("mouseup",E)});return()=>{y()}},[d,h,t,r,g]);let L=w=>w==="bottom",v=jt(w=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=zn(d.elem);if(!ec(S))throw new Error("TableCellResizer: Table cell node not found.");let E=Wn(S),y=jg(S),R=E.getChildren(),D=S.getColSpan()===E.getColumnCount()?y:y+S.getRowSpan()-1;if(D>=R.length||D<0)throw new Error("Expected table cell to be inside of table row.");let $=R[D];if(!Hg($))throw new Error("Expected table row");let F=$.getHeight();if(F===void 0){let Y=$.getChildren();F=Math.min(...Y.map(J=>b(J,t)??1/0))}let B=Math.max(F+w,Kg);$.setHeight(B)},{tag:nc})},[d,t]),b=(w,S)=>S.getElementByKey(w.getKey())?.clientHeight,x=(w,S)=>{let E;return S.forEach(y=>{y.forEach((R,M)=>{R.cell===w&&(E=M)})}),E},C=jt(w=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=zn(d.elem);if(!ec(S))throw new Error("TableCellResizer: Table cell node not found.");let E=Wn(S),[y]=Pg(E,null,null),R=x(S,y);if(R===void 0)throw new Error("TableCellResizer: Table column not found.");let M=E.getColWidths();if(!M)return;let D=M[R];if(D===void 0)return;let $=[...M],F=Math.max(D+w,rc);$[R]=F,E.setColWidths($)},{tag:nc})},[d,t]),k=jt(w=>{let S=E=>{if(E.preventDefault(),E.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:y,y:R}=i.current;if(d===null)return;let M=oc(E.target);if(L(w)){let D=(E.clientY-R)/M;v(D)}else{let D=(E.clientX-y)/M;C(D)}g(),document.removeEventListener("mouseup",S)}};return S},[d,g,C,v]),T=jt(w=>S=>{if(S.preventDefault(),S.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");i.current={x:S.clientX,y:S.clientY},c(i.current),f(w),document.addEventListener("mouseup",k(w))},[d,k]),[I,N]=pt({bottom:null,left:null,right:null,top:null});return Kn(()=>{if(d){let{height:w,left:S,top:E,width:y}=d.elem.getBoundingClientRect(),R=oc(d.elem),M=10,D={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${M}px`,left:`${window.scrollX+S}px`,top:`${window.scrollY+E+w-M/2}px`,width:`${y}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${w}px`,left:`${window.scrollX+S+y-M/2}px`,top:`${window.scrollY+E}px`,width:`${M}px`}},$=n.current;h&&u&&$&&(L(h)?(D[h].left=`${window.scrollX+$.left}px`,D[h].top=`${window.scrollY+u.y/R}px`,D[h].height="3px",D[h].width=`${$.width}px`):(D[h].top=`${window.scrollY+$.top}px`,D[h].left=`${window.scrollX+u.x/R}px`,D[h].width="3px",D[h].height=`${$.height}px`),D[h].backgroundColor="#adf"),N(D)}else N({bottom:null,left:null,right:null,top:null})},[d,h,u]),wo("div",{ref:o,children:d!=null&&!m&&Og(lc.Fragment,{children:[wo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("right"),style:I.right||void 0}),wo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("bottom"),style:I.bottom||void 0})]})})}var ic=()=>{let t=$g(3),[e]=Fg(),o=Bg(),n;return t[0]!==e||t[1]!==o?(n=o?zg(wo(Jg,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=n):n=t[2],n};import{c as o2}from"react/compiler-runtime";import{jsx as Jn,jsxs as n2,Fragment as r2}from"react/jsx-runtime";import{useLexicalComposerContext as l2}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as fc}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as i2,$getTableColumnIndexFromTableCellNode as s2,$getTableRowIndexFromTableCellNode as a2,$insertTableColumnAtSelection as c2,$insertTableRowAtSelection as u2,$isTableCellNode as d2,$isTableNode as cc,getTableElement as m2,TableNode as p2}from"@lexical/table";import{$findMatchingParent as f2,mergeRegister as h2}from"@lexical/utils";import{$getNearestNodeFromDOMNode as uc,isHTMLElement as g2}from"lexical";import{useEffect as dc,useMemo as x2,useRef as mc,useState as So}from"react";import"react";import{createPortal as C2}from"react-dom";import{c as Qg}from"react/compiler-runtime";import{useEffect as e2,useRef as t2}from"react";var Xg="Expected a function",Zg=Math.max,Yg=Math.min;function qg(t,e,o){let n,r,l=0,s,i=!1,u=!1,c,d,a,m=!0;if(typeof t!="function")throw new TypeError(Xg);e=e||0,typeof o=="object"&&(i=!!o.leading,u="maxWait"in o,c=u?Zg(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(C){let k=n,T=s;return n=s=void 0,l=C,d=t.apply(T,k),d}function h(C){return l=C,a=setTimeout(_,e),i?p(C):d}function f(C){let k=C-r,T=C-l,I=e-k;return u?Yg(I,c-T):I}function g(C){let k=C-r,T=C-l;return r===void 0||k>=e||k<0||u&&T>=c}function _(){let C=Date.now();if(g(C))return L(C);a=setTimeout(_,f(C))}function L(C){return a=void 0,m&&n?p(C):(n=s=void 0,d)}function v(){a!==void 0&&clearTimeout(a),l=0,n=r=s=a=void 0}function b(){return a===void 0?d:L(Date.now())}function x(){let C=Date.now(),k=g(C);if(n=arguments,s=this,r=C,k){if(a===void 0)return h(r);if(u)return clearTimeout(a),a=setTimeout(_,e),p(r)}return a===void 0&&(a=setTimeout(_,e)),d}return x.cancel=v,x.flush=b,x}var sc=qg;function ac(t,e,o){let n=Qg(6),r=t2(null),l,s;n[0]!==t||n[1]!==o||n[2]!==e?(l=()=>(r.current=sc(t,e,{maxWait:o}),()=>{r.current?.cancel()}),s=[t,e,o],n[0]=t,n[1]=o,n[2]=e,n[3]=l,n[4]=s):(l=n[3],s=n[4]),e2(l,s);let i;return n[5]===Symbol.for("react.memo_cache_sentinel")?(i=(...c)=>{let d=c;r.current&&r.current(...d)},n[5]=i):i=n[5],i}var pc=16;function b2({anchorElem:t}){let[e]=l2(),o=fc(),n=G(),[r,l]=So(!1),[s,i]=So(!1),[u,c]=So(!1),[d,a]=So({}),m=mc(new Set),p=mc(null),h=ac(_=>{let{isOutside:L,tableDOMNode:v}=k2(_,n.editorConfig?.lexical);if(L){l(!1),i(!1);return}if(!v)return;p.current=v;let b=null,x=null,C=null;if(e.getEditorState().read(()=>{let D=uc(v);if(d2(D)){let $=f2(D,F=>cc(F));if(!cc($))return;if(C=m2($,e.getElementByKey($.getKey())),C){let F=$.getChildrenSize(),B=$.getChildAtIndex(0)?.getChildrenSize(),Y=a2(D),J=s2(D);Y===F-1?b=D:J===B-1&&(x=D)}}},{editor:e}),!C)return;let k=C.parentElement;if(!k)return;let{bottom:T,height:I,left:N,right:w,width:S,y:E}=C.getBoundingClientRect(),y=!1;k&&k.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(y=k.scrollWidth>k.clientWidth);let{left:R,y:M}=t.getBoundingClientRect();b?(i(!1),l(!0),a({height:pc,left:y&&k?k.offsetLeft:N-R,top:T-M+5,width:y&&k?k.offsetWidth:S})):x&&(i(!0),l(!1),a({height:I,left:w-R+5,top:E-M,width:pc}))},50,250),f=x2(()=>new ResizeObserver(()=>{l(!1),i(!1)}),[]);dc(()=>{if(u)return document.addEventListener("mousemove",h),()=>{l(!1),i(!1),document.removeEventListener("mousemove",h)}},[u,h]),dc(()=>h2(e.registerMutationListener(p2,_=>{e.getEditorState().read(()=>{let L=!1;for(let[v,b]of _)switch(b){case"created":{m.current.add(v),L=!0;break}case"destroyed":{m.current.delete(v),L=!0;break}default:break}if(L){f.disconnect();for(let v of m.current){let{tableElement:b}=i2(v);f.observe(b)}c(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let g=_=>{e.update(()=>{p.current&&(uc(p.current)?.selectEnd(),_?(u2(),l(!1)):(c2(),i(!1)))})};return o?n2(r2,{children:[r&&Jn("button",{"aria-label":"Add Row",className:n.editorConfig.lexical.theme.tableAddRows,onClick:()=>g(!0),style:{...d},type:"button"}),s&&Jn("button",{"aria-label":"Add Column",className:n.editorConfig.lexical.theme.tableAddColumns,onClick:()=>g(!1),style:{...d},type:"button"})]}):null}function k2(t,e){let o=t.target;if(g2(o)){let n=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(n||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:n}}else return{isOutside:!0,tableDOMNode:null}}function hc(t){let e=o2(2),{anchorElem:o}=t,n=o===void 0?document.body:o;if(!fc())return null;let l;return e[0]!==n?(l=C2(Jn(b2,{anchorElem:n}),n),e[0]=n,e[1]=l):l=e[1],l}import{jsx as Yn,jsxs as w2}from"react/jsx-runtime";import{useLexicalComposerContext as S2}from"@lexical/react/LexicalComposerContext";import{TablePlugin as N2}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as L2,TableCellNode as R2,TableNode as y2,TableRowNode as v2}from"@lexical/table";import{mergeRegister as I2}from"@lexical/utils";import{$getSelection as M2,$isRangeSelection as A2,$setSelection as D2,COMMAND_PRIORITY_EDITOR as $2,createCommand as O2}from"lexical";import{createContext as F2,use as B2,useCallback as _c,useEffect as Tc,useMemo as P2,useRef as j2,useState as No}from"react";import*as Ec from"react";import{jsx as Q,jsxs as ye}from"react/jsx-runtime";import{useCallback as Xn,useEffect as gc,useRef as Zn,useState as Ht}from"react";import*as bc from"react";import{createPortal as _2}from"react-dom";var xc=10,Cc=7;function T2(){return ye("svg",{fill:"none",height:"12",viewBox:"0 0 12 12",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[Q("rect",{height:"9",rx:"1",stroke:"currentColor",width:"3",x:"1.5",y:"1.5"}),Q("rect",{height:"9",rx:"1",stroke:"currentColor",width:"3",x:"7.5",y:"1.5"})]})}function E2(){return ye("svg",{fill:"none",height:"12",viewBox:"0 0 12 12",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[Q("rect",{height:"3",rx:"1",stroke:"currentColor",width:"9",x:"1.5",y:"1.5"}),Q("rect",{height:"3",rx:"1",stroke:"currentColor",width:"9",x:"1.5",y:"7.5"})]})}function kc({anchorElem:t,editor:e,isOpen:o,onClose:n,onInsert:r,position:l}){let[s,i]=Ht(0),[u,c]=Ht(0),[d,a]=Ht(""),[m,p]=Ht(""),[h,f]=Ht(null),g=Zn(null),_=Zn(null),L=Zn(null),v=s>0?s:d?parseInt(d,10)||0:5,b=u>0?u:m?parseInt(m,10)||0:5;gc(()=>{o||(i(0),c(0),a(""),p(""),f(null))},[o]),gc(()=>{if(!o)return;let N=w=>{if(w.key==="Escape"&&(w.preventDefault(),w.stopPropagation(),n()),w.key==="Enter"&&h){w.preventDefault();let S=parseInt(d,10),E=parseInt(m,10);S>0&&E>0&&r(S,E)}};return document.addEventListener("keydown",N,!0),()=>document.removeEventListener("keydown",N,!0)},[o,n,r,h,d,m]);let x=Xn((N,w)=>{N>0&&w>0&&r(N,w)},[r]),C=Xn((N,w)=>{i(N),c(w)},[]),k=Xn(()=>{i(0),c(0)},[]);if(!o||!l||!t)return null;let T=[];for(let N=1;N<=Cc;N++)for(let w=1;w<=xc;w++){let S=w<=v&&N<=b,E=w<=s&&N<=u,y="table-grid-popup__cell";S&&E?y+=" table-grid-popup__cell--hover":S&&(y+=" table-grid-popup__cell--selected"),T.push(Q("div",{"aria-label":`${w} columns, ${N} rows`,className:y,onClick:()=>x(w,N),onKeyDown:R=>{(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),x(w,N))},onMouseEnter:()=>C(w,N),role:"button",tabIndex:-1},`${N}-${w}`))}let I=s>0&&u>0;return _2(ye(bc.Fragment,{children:[Q("div",{className:"table-grid-popup__backdrop",onClick:n}),Q("div",{className:"table-grid-popup",ref:g,style:{transform:`translate(${l.left}px, ${l.top}px)`},children:ye("div",{className:"table-grid-popup__content",children:[ye("div",{className:"table-grid-popup__header",children:[ye("div",{className:`table-grid-popup__input-group${h==="cols"?" table-grid-popup__input-group--focused":""}`,children:[Q("div",{className:"table-grid-popup__input-icon",children:Q(T2,{})}),Q("input",{"aria-label":"Columns",className:"table-grid-popup__input",min:1,onBlur:()=>f(null),onChange:N=>a(N.target.value),onFocus:()=>f("cols"),placeholder:s>0?String(s):"5",ref:_,type:"number",value:d})]}),Q("span",{className:"table-grid-popup__separator",children:"\xD7"}),ye("div",{className:`table-grid-popup__input-group${h==="rows"?" table-grid-popup__input-group--focused":""}`,children:[Q("div",{className:"table-grid-popup__input-icon",children:Q(E2,{})}),Q("input",{"aria-label":"Rows",className:"table-grid-popup__input",min:1,onBlur:()=>f(null),onChange:N=>p(N.target.value),onFocus:()=>f("rows"),placeholder:u>0?String(u):"5",ref:L,type:"number",value:m})]})]}),ye("div",{className:"table-grid-popup__grid",onMouseLeave:k,children:[T,I&&ye("div",{className:"table-grid-popup__tooltip",style:{left:`calc(${(s-.5)/xc*100}%)`,top:`calc(${(u-1)/Cc*100}%)`},children:[v," \xD7 ",b]})]})]})})]}),t)}var Lo=O2("OPEN_EMBED_DRAWER_COMMAND"),wc=F2({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Sc({children:t}){let[e,o]=No({cellEditorConfig:null,cellEditorPlugins:null});return Yn(wc,{value:P2(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(n,r)=>{o({cellEditorConfig:n,cellEditorPlugins:r})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Nc=()=>{let[t]=S2(),e=B2(wc),[o,n]=No(!1),[r,l]=No(null),s=j2(null),[i,u]=No(null);Tc(()=>{let a=t.getRootElement();if(a){let m=a.closest(".editor")??null;u(m??a.parentElement)}},[t]),Tc(()=>{if(!t.hasNodes([y2,v2,R2]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return I2(t.registerCommand(Lo,()=>{let a=i;if(!a)return!0;let m=a.getBoundingClientRect(),p=null;t.getEditorState().read(()=>{let f=M2();if(A2(f)){s.current=f.clone();let g=f.anchor.getNode(),_=t.getElementByKey(g.getKey());if(_){let L=_.getBoundingClientRect();L.height>0&&(p={left:L.left-m.left,top:L.bottom-m.top+8})}}});let h=window.getSelection();if(h&&h.rangeCount>0){let g=h.getRangeAt(0).getBoundingClientRect();g.height>0&&(p={left:g.left-m.left,top:g.bottom-m.top+8})}return p||(p={left:0,top:40}),l(p),n(!0),!0},$2))},[e,t,i]);let c=_c(()=>{n(!1)},[]),d=_c((a,m)=>{n(!1),t.focus(),t.update(()=>{s.current&&D2(s.current.clone())},{discrete:!0,skipTransforms:!0}),setTimeout(()=>{t.dispatchCommand(L2,{columns:String(a),rows:String(m)})},1)},[t]);return w2(Ec.Fragment,{children:[Yn(kc,{anchorElem:i,editor:t,isOpen:o,onClose:c,onInsert:d,position:r}),Yn(N2,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]})};var V2=A({markdownTransformers:[Ga],nodes:[U2,H2,G2],plugins:[{Component:Nc,position:"normal"},{Component:ic,position:"normal"},{Component:Qa,position:"floatingAnchorElem"},{Component:hc,position:"floatingAnchorElem"}],providers:[Sc],slashMenu:{groups:[X([{Icon:Bn,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Lo,{})}}])]},toolbarFixed:{groups:[_e([{ChildComponent:Bn,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Lo,{})}}])]}});import{$isNodeSelection as Nx}from"lexical";import{jsx as Lc}from"react/jsx-runtime";import"react";var W2="M16.2041 6.01074C17.2128 6.113 18 6.96435 18 8V16L17.9893 16.2041C17.8938 17.1457 17.1457 17.8938 16.2041 17.9893L16 18H8C6.96435 18 6.113 17.2128 6.01074 16.2041L6 16V8C6 6.89543 6.89543 6 8 6H16L16.2041 6.01074ZM8 7C7.44772 7 7 7.44772 7 8V16C7 16.5523 7.44772 17 8 17H16C16.5523 17 17 16.5523 17 16V8C17 7.44772 16.5523 7 16 7H8ZM9.72461 11.582C9.91869 11.4539 10.1827 11.4756 10.3535 11.6465L13.8535 15.1465C14.0488 15.3417 14.0488 15.6583 13.8535 15.8535C13.6583 16.0488 13.3417 16.0488 13.1465 15.8535L10 12.707L8.85352 13.8535C8.65825 14.0488 8.34175 14.0488 8.14648 13.8535C7.95122 13.6583 7.95122 13.3417 8.14648 13.1465L9.64648 11.6465L9.72461 11.582ZM14 8C15.1046 8 16 8.89543 16 10C16 11.1046 15.1046 12 14 12C12.8954 12 12 11.1046 12 10C12 8.89543 12.8954 8 14 8ZM14 9C13.4477 9 13 9.44772 13 10C13 10.5523 13.4477 11 14 11C14.5523 11 15 10.5523 15 10C15 9.44772 14.5523 9 14 9Z",qn=({className:t})=>Lc("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Lc("path",{clipRule:"evenodd",d:W2,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Mc}from"react/jsx-runtime";import Ac from"bson-objectid";import{$applyNodeReplacement as Y2}from"lexical";import*as Dc from"react";import z2 from"bson-objectid";function Ro(t,e){if(t.hasAttribute("data-lexical-pending-upload-form-id")){let n=t.getAttribute("data-lexical-pending-upload-form-id");if(n!=null)return{node:e({data:{pending:{formID:n,src:t.getAttribute("src")||""}}})}}if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let n=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(n!=null&&r!=null)return{node:e({data:{fields:{},relationTo:r,value:n}})}}return{node:e({data:{pending:{formID:new z2.default().toHexString(),src:t.getAttribute("src")||""}}})}}import{DecoratorBlockNode as K2}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as J2}from"@lexical/utils";import yc from"bson-objectid";import{$applyNodeReplacement as X2}from"lexical";var Ut=class extends K2{__data;constructor({data:e,format:o,key:n}){super(o,n),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"upload"}static importDOM(){return{img:e=>({conversion:o=>Ro(o,Rc),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new yc.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},n=Rc({data:o});return n.setFormat(e.format),n}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return J2(o,e?.theme?.upload),o}decorate(){return null}exportDOM(){let e=document.createElement("img"),o=this.__data;return o.pending?(e.setAttribute("data-lexical-pending-upload-form-id",String(o?.pending?.formID)),e.setAttribute("src",o?.pending?.src||"")):(e.setAttribute("data-lexical-upload-id",String(o?.value)),e.setAttribute("data-lexical-upload-relation-to",o?.relationTo)),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"upload",version:3}}getData(){return this.getLatest().__data}setData(e){let o=this.getWritable();o.__data=e}updateDOM(){return!1}};function Rc({data:t}){return t?.id||(t.id=new yc.default().toHexString()),X2(new Ut({data:t}))}import{jsx as vc}from"react/jsx-runtime";import{ShimmerEffect as Z2}from"@payloadcms/ui";var Ic=()=>vc("div",{className:"lexical-upload",children:vc(Z2,{height:"95px",width:"203px"})});var q2=Dc.lazy(()=>import("./component-PHZQBOJE.js").then(t=>({default:t.UploadComponent}))),he=class extends Ut{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:o=>Ro(o,ge),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Ac.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},n=ge({data:o});return n.setFormat(e.format),n}decorate(e,o){return this.__data.pending?Mc(Ic,{}):Mc(q2,{className:o?.theme?.upload??"LexicalEditorTheme__upload",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function ge({data:t}){return t?.id||(t.id=new Ac.default().toHexString()),Y2(new he({data:t}))}function ft(t){return t instanceof he}import{c as ix}from"react/compiler-runtime";import{jsx as sx}from"react/jsx-runtime";import{useLexicalComposerContext as ax}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as Wc,$insertNodeToNearestRoot as tr,mergeRegister as cx}from"@lexical/utils";import{useBulkUpload as ux,useEffectEvent as dx,useModal as mx}from"@payloadcms/ui";import or from"bson-objectid";import{$createRangeSelection as px,$getPreviousSelection as jc,$getSelection as Hc,$isParagraphNode as nr,$isRangeSelection as Uc,$setSelection as fx,COMMAND_PRIORITY_EDITOR as hx,COMMAND_PRIORITY_LOW as Gc,createCommand as gx,DROP_COMMAND as xx,getDOMSelectionFromTarget as Cx,isHTMLElement as Vc,PASTE_COMMAND as bx}from"lexical";import{useEffect as kx}from"react";import{c as $c}from"react/compiler-runtime";import{jsx as Qn}from"react/jsx-runtime";import{useLexicalComposerContext as Oc}from"@lexical/react/LexicalComposerContext.js";import{toast as Q2}from"@payloadcms/ui";import{$getNodeByKey as ex,COMMAND_PRIORITY_EDITOR as Fc}from"lexical";import{useEffect as Bc,useState as tx}from"react";var ox=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=ex(o);r&&r.replace(ge({data:{fields:null,relationTo:e,value:n}}))}):t.dispatchCommand(er,{fields:null,relationTo:e,value:n})},nx=t=>{let e=$c(13),{enabledCollectionSlugs:o}=t,[n]=Oc(),[r,l]=tx(null),s;e[0]!==o?(s={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=s):s=e[1];let{closeListDrawer:i,ListDrawer:u,openListDrawer:c}=$t(s),d,a;e[2]!==n||e[3]!==c?(d=()=>n.registerCommand(et,f=>(l(f?.replace?f?.replace.nodeKey:null),c(),!0),Fc),a=[n,c],e[2]=n,e[3]=c,e[4]=d,e[5]=a):(d=e[4],a=e[5]),Bc(d,a);let m;e[6]!==i||e[7]!==n||e[8]!==r?(m=f=>{let{collectionSlug:g,doc:_}=f;i(),ox({editor:n,relationTo:g,replaceNodeKey:r,value:_.id})},e[6]=i,e[7]=n,e[8]=r,e[9]=m):m=e[9];let p=m,h;return e[10]!==u||e[11]!==p?(h=Qn(u,{onSelect:p}),e[10]=u,e[11]=p,e[12]=h):h=e[12],h},rx=()=>{let t=$c(3),[e]=Oc(),o,n;return t[0]!==e?(o=()=>e.registerCommand(et,lx,Fc),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Bc(o,n),null},Pc=({enabledCollectionSlugs:t})=>t?.length?Qn(nx,{enabledCollectionSlugs:t}):Qn(rx,{});function lx(){return Q2.error("No upload collections enabled"),!0}function _x(t){let e=t.target;return!!(Vc(e)&&!e.closest("code, span.editor-image")&&Vc(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function Tx(t){let e,o=Cx(t.target);if(document.caretRangeFromPoint)e=document.caretRangeFromPoint(t.clientX,t.clientY);else if(t.rangeParent&&o!==null)o.collapse(t.rangeParent,t.rangeOffset||0),e=o.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return e}var er=gx("INSERT_UPLOAD_COMMAND"),zc=t=>{let e=ix(21),{clientProps:o}=t,[n]=ax(),r=o?.disabledCollections,l=o?.enabledCollections,s;e[0]!==r||e[1]!==l?(s={collectionSlugsBlacklist:r,collectionSlugsWhitelist:l,uploads:!0},e[0]=r,e[1]=l,e[2]=s):s=e[2];let{enabledCollectionSlugs:i}=po(s),{drawerSlug:u,setCollectionSlug:c,setInitialForms:d,setOnCancel:a,setOnSuccess:m,setSelectableCollections:p}=ux(),{isModalOpen:h,openModal:f}=mx(),g;e[3]!==u||e[4]!==n||e[5]!==i||e[6]!==h||e[7]!==f||e[8]!==c||e[9]!==d||e[10]!==a||e[11]!==m||e[12]!==p?(g=x=>{let{files:C}=x;if(C?.length!==0&&(d(k=>[...k??[],...C.map(Ex)]),!h(u))){if(!i.length||!i[0])return;c(i[0]),p(i),a(()=>{n.update(wx)}),m(k=>{let T=new Map(k.map(Sx));n.update(()=>{for(let I of Wc()){let N=I.node;if(ft(N)){let w=N.getData();if(w?.pending){let S=T.get(w.pending?.formID);S&&N.replace(ge({data:{id:new or.default().toHexString(),fields:{},relationTo:S.collectionSlug,value:S.doc.id}}))}}}})}),f(u)}},e[3]=u,e[4]=n,e[5]=i,e[6]=h,e[7]=f,e[8]=c,e[9]=d,e[10]=a,e[11]=m,e[12]=p,e[13]=g):g=e[13];let _=dx(g),L;e[14]!==n||e[15]!==_?(L=()=>{if(!n.hasNodes([he]))throw new Error("UploadPlugin: UploadNode not registered on editor");return cx(n.registerNodeTransform(he,x=>{let C=x.getData();if(!C?.pending)return;(async function(){let I=null,N=C?.pending?.src,w=C?.pending?.formID;if(N?.startsWith("data:")){let S=N.match(/data:(image\/[a-zA-Z]+);base64,/),E=S?S[1]:"image/png",y=N.replace(/^data:image\/[a-zA-Z]+;base64,/,""),R=atob(y),M=new Array(R.length);for(let F=0;F<R.length;F++)M[F]=R.charCodeAt(F);let D=new Uint8Array(M);I={alt:void 0,file:new File([D],"pasted-image."+E?.split("/",2)[1],{type:E}),formID:w}}else if(N?.startsWith("http")||N?.startsWith("https")){let E=await(await fetch(N)).blob(),y=N.split("/").pop()||"pasted-image"+E.type.split("/",2)[1];I={alt:void 0,file:new File([E],y,{type:E.type}),formID:w}}I&&_({files:[I]})})()}),n.registerCommand(er,x=>(n.update(()=>{let C=Hc()||jc();if(Uc(C)){let k=ge({data:{id:x.id,fields:x.fields,relationTo:x.relationTo,value:x.value}}),{focus:T}=C,I=T.getNode();tr(k),nr(I)&&!I.__first&&I.remove()}}),!0),hx),n.registerCommand(bx,x=>{if(!(x instanceof ClipboardEvent))return!1;let C=x.clipboardData;if(!C?.types?.length||C?.types?.includes("text/html"))return!1;let k=[];return C?.files?.length&&Array.from(C.files).forEach(T=>{k.push({alt:"",file:T,formID:new or.default().toHexString()})}),k.length?(n.update(()=>{let T=Hc()||jc();if(Uc(T))for(let I of k){let N=ge({data:{pending:{formID:I.formID,src:URL.createObjectURL(I.file)}}}),{focus:w}=T,S=w.getNode();tr(N),nr(S)&&!S.__first&&S.remove()}}),_({files:k}),!0):!1},Gc),n.registerCommand(xx,x=>{if(!(x instanceof DragEvent))return!1;let C=x.dataTransfer;if(!C?.types?.length)return!1;let k=[];return C?.files?.length&&Array.from(C.files).forEach(T=>{k.push({alt:"",file:T,formID:new or.default().toHexString()})}),k.length?(x.preventDefault(),x.stopPropagation(),n.update(()=>{if(_x(x)){let T=Tx(x),I=px();T!=null&&I.applyDOMRange(T),fx(I);for(let N of k){let w=ge({data:{pending:{formID:N.formID,src:URL.createObjectURL(N.file)}}}),{focus:S}=I,E=S.getNode();tr(w),nr(E)&&!E.__first&&E.remove()}}}),_({files:k}),!0):!1},Gc))},e[14]=n,e[15]=_,e[16]=L):L=e[16];let v;e[17]!==n?(v=[n],e[17]=n,e[18]=v):v=e[18],kx(L,v);let b;return e[19]!==i?(b=sx(Pc,{enabledCollectionSlugs:i}),e[19]=i,e[20]=b):b=e[20],b};function Ex(t){return{file:t.file,formID:t.formID}}function wx(){for(let t of Wc()){let e=t.node;ft(e)&&e.getData()?.pending&&e.remove()}}function Sx(t){return[t.formID,t]}var Lx=A({nodes:[he],plugins:[{Component:zc,position:"normal"}],slashMenu:{groups:[X([{Icon:qn,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(et,{replace:!1})}}])]},toolbarFixed:{groups:[_e([{ChildComponent:qn,isActive:({selection:t})=>{if(!Nx(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return ft(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(et,{replace:!1})}}])]}});import{c as yx}from"react/compiler-runtime";import{jsx as yo}from"react/jsx-runtime";import{createElement as vx}from"react";import{ShimmerEffect as Ix,useConfig as Mx}from"@payloadcms/ui";import{lazy as Ax,Suspense as Dx,useEffect as $x,useState as Ox}from"react";var Kc={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",inlineBlock:"LexicalEditorTheme__inlineBlock",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",hrSelected:"LexicalEditorTheme__hrSelected",indent:"LexicalEditorTheme__indent",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",placeholder:"LexicalEditorTheme__placeholder",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",root:"LexicalEditorTheme",rtl:"LexicalEditorTheme__rtl",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"LexicalEditorTheme__upload"};var rr={namespace:"lexical",theme:Kc};function Jc({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:n,schemaPath:r,unSanitizedEditorConfig:l}){let s=new Map;for(let c of l.features){if(!c?.clientFeatureProps?.featureKey||c?.clientFeatureProps?.order===void 0||c?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");s.set(c.clientFeatureProps.featureKey,c)}l.features=l.features.sort((c,d)=>c.clientFeatureProps.order-d.clientFeatureProps.order);let i=new Map,u=0;for(let c of l.features){let d=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:s,field:n,resolvedFeatures:i,schemaPath:r,unSanitizedEditorConfig:l}):c.feature;d.key=c.clientFeatureProps.featureKey,d.order=u,i.set(c.clientFeatureProps.featureKey,d),u++}return i}import{deepMerge as Rx}from"payload/shared";var Xc=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(n=>{n.key==="toolbarFixed"&&n.sanitizedClientFeatureProps?.customGroups&&(o={...o,...n.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(n=>{if(n.providers?.length&&(e.providers=e.providers.concat(n.providers)),n.enableFormats?.length&&e.enabledFormats.push(...n.enableFormats),n.nodes?.length)for(let r of n.nodes)e.nodes.push(r);if(n.plugins?.length&&n.plugins.forEach((r,l)=>{e.plugins?.push({clientProps:n.sanitizedClientFeatureProps,Component:r.Component,key:n.key+l,position:r.position})}),n.toolbarInline?.groups?.length)for(let r of n.toolbarInline.groups){let l=e.toolbarInline.groups.find(s=>s.key===r.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.toolbarInline?.groups.push(l)}if(n.toolbarFixed?.groups?.length)for(let r of n.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(s=>s.key===r.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.toolbarFixed?.groups.push(l)}if(n.slashMenu?.groups){n.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(n.slashMenu.dynamicGroups));for(let r of n.slashMenu.groups){let l=e.slashMenu.groups.find(s=>s.key===r.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.slashMenu.groups.push(l)}}if(n.markdownTransformers?.length)for(let r of n.markdownTransformers)typeof r=="function"?e.markdownTransformers.push(r({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(r);e.enabledFeatures.push(n.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(n=>{let r=o[n.key];return r?Rx(n,r):n})),e.toolbarInline.groups.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0),e.toolbarFixed.groups.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);for(let n of e.toolbarInline.groups)n.items.sort((r,l)=>r.order&&l.order?r.order-l.order:r.order?-1:l.order?1:0);for(let n of e.toolbarFixed.groups)n.items.sort((r,l)=>r.order&&l.order?r.order-l.order:r.order?-1:l.order?1:0);return e};function lr(t,e,o,n){return{admin:o,features:Xc(t),lexical:e,resolvedFeatureMap:t,view:n}}var Fx=Ax(()=>import("./Field-VQX3RNMF.js").then(t=>({default:t.RichText}))),Bx=t=>yo(Po,{inheritable:!0,views:t.views,children:yo(Px,{...t})}),Px=t=>{let e=yx(23),{admin:o,clientFeatures:n,featureClientImportMap:r,featureClientSchemaMap:l,field:s,lexicalEditorConfig:i,schemaPath:u,views:c}=t,d;e[0]!==o?(d=o===void 0?{}:o,e[0]=o,e[1]=d):d=e[1];let a=d,m;e[2]!==r?(m=r===void 0?{}:r,e[2]=r,e[3]=m):m=e[3];let p=m,h=i===void 0?rr:i,{currentView:f}=jo(),g=c?.[f]?.admin??a,_=c?.[f]?.lexical,L;e[4]!==h||e[5]!==_?(L=typeof _=="function"?_(h):_??h,e[4]=h,e[5]=_,e[6]=L):L=e[6];let v=L,{config:b}=Mx(),[x,C]=Ox(null),k,T;e[7]!==n||e[8]!==b||e[9]!==f||e[10]!==g||e[11]!==v||e[12]!==p||e[13]!==l||e[14]!==s||e[15]!==x||e[16]!==u||e[17]!==c?(k=()=>{if(x&&x.view===f)return;let N=c?.[f],w=N?.filterFeatures?N.filterFeatures(n):n,S=[];for(let y of Object.values(w))y.clientFeatureProvider&&S.push(y.clientFeatureProvider(y.clientFeatureProps));let E=Jc({config:b,featureClientImportMap:p,featureClientSchemaMap:l,field:s,schemaPath:u??s.name,unSanitizedEditorConfig:{features:S,lexical:v}});C(lr(E,v,g,f))},T=[g,n,b,p,l,s,x,v,u,f,c],e[7]=n,e[8]=b,e[9]=f,e[10]=g,e[11]=v,e[12]=p,e[13]=l,e[14]=s,e[15]=x,e[16]=u,e[17]=c,e[18]=k,e[19]=T):(k=e[18],T=e[19]),$x(k,T);let I;return e[20]!==x||e[21]!==t?(I=yo(Dx,{fallback:yo(Ix,{height:"35vh"}),children:x&&vx(Fx,{...t,editorConfig:x,key:x.view})}),e[20]=x,e[21]=t,e[22]=I):I=e[22],I};function jx(t){return t instanceof HTMLElement}function Hx(...t){return t.filter(Boolean).join(" ")}var vo=new WeakMap;function Zc(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Io(t,e){let o=vo.get(t);if(o===void 0){let n=new Set,r=s=>{o!==void 0&&(o.start=Zc(s))},l=s=>{if(o===void 0)return;let{start:i}=o;if(i===null)return;let u=Zc(s);for(let c of n)u!==null&&c([u[0]-i[0],u[1]-i[1]],s)};t.addEventListener("touchstart",r),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:r,listeners:n,start:null},vo.set(t,o)}return o.listeners.add(e),()=>{Ux(t,e)}}function Ux(t,e){let o=vo.get(t);if(o===void 0)return;let{listeners:n}=o;n.delete(e),n.size===0&&(vo.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Gx(t,e){return Io(t,(o,n)=>{let[r,l]=o;r<0&&-r>Math.abs(l)&&e(r,n)})}function Vx(t,e){return Io(t,(o,n)=>{let[r,l]=o;r>0&&r>Math.abs(l)&&e(r,n)})}function Wx(t,e){return Io(t,(o,n)=>{let[r,l]=o;l<0&&-l>Math.abs(r)&&e(r,n)})}function zx(t,e){return Io(t,(o,n)=>{let[r,l]=o;l>0&&l>Math.abs(r)&&e(r,n)})}import{c as Kx}from"react/compiler-runtime";import{jsx as Jx}from"react/jsx-runtime";import"react";var Xx=()=>{let t=Kx(2),{EditButton:e}=be(),o;return t[0]!==e?(o=e?Jx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Zx}from"react/compiler-runtime";import{jsx as Yx}from"react/jsx-runtime";import"react";var qx=()=>{let t=Zx(2),{RemoveButton:e}=be(),o;return t[0]!==e?(o=e?Yx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Qx}from"react/compiler-runtime";import{jsx as eC}from"react/jsx-runtime";import"react";var tC=()=>{let t=Qx(2),{Label:e}=be(),o;return t[0]!==e?(o=e?eC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as oC}from"react/compiler-runtime";import{jsx as nC}from"react/jsx-runtime";import"react";var rC=t=>{let e=oC(3),{children:o}=t,{InlineBlockContainer:n}=be(),r;return e[0]!==n||e[1]!==o?(r=n?nC(n,{children:o}):null,e[0]=n,e[1]=o,e[2]=r):r=e[2],r};import{jsx as lC}from"react/jsx-runtime";import"react";var iC=t=>{let{children:e,...o}=t,{BlockCollapsible:n}=ae();return n?lC(n,{...o,children:e}):null};import{c as sC}from"react/compiler-runtime";import{jsx as aC}from"react/jsx-runtime";import"react";var cC=()=>{let t=sC(2),{EditButton:e}=ae(),o;return t[0]!==e?(o=e?aC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as uC}from"react/compiler-runtime";import{jsx as dC}from"react/jsx-runtime";import"react";var mC=()=>{let t=uC(2),{RemoveButton:e}=ae(),o;return t[0]!==e?(o=e?dC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as pC}from"qs-esm";var fC=({apiURL:t,depth:e,draft:o,locale:n})=>async({id:l,collectionSlug:s,select:i})=>{let u=pC({depth:e??0,draft:o??!1,locale:n,select:i},{addQueryPrefix:!0});return await fetch(`${t}/${s}/${l}${u}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(d=>d.json())};var Yc={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
57
+ `,Ls="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",ys="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Qp=new RegExp("^[^"+ys+"]*["+Ls+"]"),e0=new RegExp("^[^"+Ls+"]*["+ys+"]"),t0={bold:O.IS_BOLD,code:O.IS_CODE,highlight:O.IS_HIGHLIGHT,italic:O.IS_ITALIC,strikethrough:O.IS_STRIKETHROUGH,subscript:O.IS_SUBSCRIPT,superscript:O.IS_SUPERSCRIPT,underline:O.IS_UNDERLINE},o0={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},n0={center:O.IS_ALIGN_CENTER,end:O.IS_ALIGN_END,justify:O.IS_ALIGN_JUSTIFY,left:O.IS_ALIGN_LEFT,right:O.IS_ALIGN_RIGHT,start:O.IS_ALIGN_START},r0={[O.IS_ALIGN_CENTER]:"center",[O.IS_ALIGN_END]:"end",[O.IS_ALIGN_JUSTIFY]:"justify",[O.IS_ALIGN_LEFT]:"left",[O.IS_ALIGN_RIGHT]:"right",[O.IS_ALIGN_START]:"start"},l0={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},i0={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};var Rs={text:({node:t})=>{let e=t.text;return t.format&O.IS_BOLD&&(e=ze("strong",{children:e})),t.format&O.IS_ITALIC&&(e=ze("em",{children:e})),t.format&O.IS_STRIKETHROUGH&&(e=ze("span",{style:{textDecoration:"line-through"},children:e})),t.format&O.IS_UNDERLINE&&(e=ze("span",{style:{textDecoration:"underline"},children:e})),t.format&O.IS_CODE&&(e=ze("code",{children:e})),t.format&O.IS_SUBSCRIPT&&(e=ze("sub",{children:e})),t.format&O.IS_SUPERSCRIPT&&(e=ze("sup",{children:e})),e}};import{jsx as Mt}from"react/jsx-runtime";var vs={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,n=e.fields?.alt||o?.alt||"",r=o.url;if(!o.mimeType.startsWith("image"))return Mt("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return Mt("img",{alt:n,height:o.height,src:r,width:o.width});let l=[];for(let s in o.sizes){let i=o.sizes[s];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let u=i?.url;l.push(Mt("source",{media:`(max-width: ${i.width}px)`,srcSet:u,type:i.mimeType},s))}return l.push(Mt("img",{alt:n,height:o?.height,src:r,width:o?.width},"image")),Mt("picture",{children:l})}};var at={...Es,...Rs,...ks,...Cs,...Ns,...xs,...bs,...ws,...Ts({}),...vs,...Ss};import{jsx as co,Fragment as s0}from"react/jsx-runtime";import ao from"react";function Is(t){if(!!!t?.root?.children?.length)return!1;let o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let n=t?.root?.children[0];if(!n?.children||n?.children?.length===0)o=!0;else if(n?.children?.length===1){let r=n?.children[0];r?.type==="text"&&(r?.text?.length||(o=!0))}}return!o}function a0(t){return e=>{let o={...e,isEditor:!1,isJSXConverter:!0};if(t.Component)return t.Component(o);if(t.html){let n=typeof t.html=="function"?t.html(o):t.html;return co("span",{dangerouslySetInnerHTML:{__html:n}})}return null}}function Ms(t){return e=>{if(t.Component){let o={...e,isEditor:!1,isJSXConverter:!0};return t.Component(o)}if(t.Block){let o=e.node,n={childIndex:e.childIndex,converters:e.converters,formData:o.fields??{},isEditor:!1,isJSXConverter:!0,node:o,nodesToJSX:e.nodesToJSX,parent:e.parent};return ao.createElement(t.Block,n)}if(t.html){let o={...e,isEditor:!1,isJSXConverter:!0},n=typeof t.html=="function"?t.html(o):t.html;return co("span",{dangerouslySetInnerHTML:{__html:n}})}return null}}function c0(t){let e={};for(let[o,n]of Object.entries(t)){if(!n||typeof n!="object")continue;if(o==="blocks"){e.blocks={};for(let[l,s]of Object.entries(n)){let i=s;(i.Component||i.Block||i.html)&&(e.blocks[l]=Ms(i))}continue}if(o==="inlineBlocks"){e.inlineBlocks={};for(let[l,s]of Object.entries(n)){let i=s;(i.Component||i.Block||i.html)&&(e.inlineBlocks[l]=Ms(i))}continue}let r=n;(r.Component||r.html)&&(e[o]=a0(r))}return e}function As({converters:t,data:e,disableIndent:o,disableTextAlign:n,nodeMap:r}){if(Is(e)){let l=r?c0(r):void 0,s=l?{...t,...l,blocks:{...t.blocks,...l.blocks},inlineBlocks:{...t.inlineBlocks,...l.inlineBlocks}}:t;return $s({converters:s,disableIndent:o,disableTextAlign:n,nodes:e.root.children,parent:e.root})}return co(s0,{})}function $s({converters:t,disableIndent:e,disableTextAlign:o,nodes:n,parent:r}){let l=t.unknown;return n.map((i,u)=>{let d;i.type==="block"?(d=t?.blocks?.[i?.fields?.blockType],!d&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${i?.fields?.blockType} block, but no converter is provided`)):i.type==="inlineBlock"?(d=t?.inlineBlocks?.[i?.fields?.blockType],!d&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${i?.fields?.blockType} inline block, but no converter is provided`)):d=t[i.type];try{!d&&l&&(d=l);let c;d?c=typeof d=="function"?d({childIndex:u,converters:t,node:i,nodesToJSX:f=>$s({converters:f.converters??t,disableIndent:f.disableIndent??e,disableTextAlign:f.disableTextAlign??o,nodes:f.nodes,parent:f.parent??{...i,parent:r}}),parent:r}):d:c=co("span",{children:"unknown node"},u);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(i.type))&&"format"in i&&i.format)switch(i.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(i.type))&&"indent"in i&&i.indent&&i.type!=="listitem"&&(a.paddingInlineStart=`${Number(i.indent)*40}px`),ao.isValidElement(c)){if(a.textAlign||a.paddingInlineStart){let m={...a,...c?.props?.style??{}};return ao.cloneElement(c,{key:u,style:m})}return ao.cloneElement(c,{key:u})}return c}catch(c){return console.error("Error converting lexical node to JSX:",c,"node:",i),null}}).filter(Boolean)}function _n({className:t,converters:e,data:o,disableContainer:n,disableIndent:r,disableTextAlign:l,nodeMap:s}){if(!o)return null;let i=e,u={};i?typeof i=="function"?u=i({defaultConverters:at}):u=i:u=at;let d=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&As({converters:u,data:o,disableIndent:r,disableTextAlign:l,nodeMap:s});return n?Ds(u0,{children:d}):Ds("div",{className:t??"payload-richtext",children:d})}function Fs(){let t=d0(7),[e]=m0(),o;t[0]!==e?(o=()=>e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[n,r]=p0(o),l,s;t[2]!==e?(l=()=>e.registerUpdateListener(u=>{let{editorState:d}=u;r(d.toJSON())}),s=[e],t[2]=e,t[3]=l,t[4]=s):(l=t[3],s=t[4]),f0(l,s);let i;return t[5]!==n?(i=Os("div",{className:"debug-jsx-converter",children:Os(_n,{converters:at,data:n})}),t[5]=n,t[6]=i):i=t[6],i}var h0=A({plugins:[{Component:Fs,position:"bottom"}]});var H={amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},black:"#000",blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},current:"currentColor",cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},inherit:"inherit",lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},transparent:"transparent",violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},white:"#fff",yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"}},g0={text:{"text-red":{css:{color:`light-dark(${H.red[600]}, ${H.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${H.orange[600]}, ${H.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${H.yellow[700]}, ${H.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${H.green[700]}, ${H.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${H.blue[600]}, ${H.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${H.purple[600]}, ${H.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${H.pink[600]}, ${H.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${H.red[400]}, ${H.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${H.orange[400]}, ${H.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${H.yellow[300]}, ${H.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${H.green[400]}, ${H.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${H.blue[400]}, ${H.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${H.purple[400]}, ${H.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${H.pink[400]}, ${H.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as rh}from"lexical";import{jsx as Ps}from"react/jsx-runtime";import"react";var C0="M9.5 6C9.77614 6 10 6.22386 10 6.5C10 6.77614 9.77614 7 9.5 7H7.5C7.22386 7 7 7.22386 7 7.5V16.5C7 16.7761 7.22386 17 7.5 17H16.5C16.7761 17 17 16.7761 17 16.5V14.5C17 14.2239 17.2239 14 17.5 14C17.7761 14 18 14.2239 18 14.5V16.5C18 17.3284 17.3284 18 16.5 18H7.5C6.67157 18 6 17.3284 6 16.5V7.5C6 6.67157 6.67157 6 7.5 6H9.5ZM17.5 6C17.7761 6 18 6.22386 18 6.5V11.5C18 11.7761 17.7761 12 17.5 12C17.2239 12 17 11.7761 17 11.5V7.70703L12.8535 11.8535C12.6583 12.0488 12.3417 12.0488 12.1465 11.8535C11.9512 11.6583 11.9512 11.3417 12.1465 11.1465L16.293 7H12.5C12.2239 7 12 6.77614 12 6.5C12 6.22386 12.2239 6 12.5 6H17.5Z",Tn=({className:t})=>Ps("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ps("path",{d:C0,fill:"currentColor"})});import{jsx as T0}from"react/jsx-runtime";import{$applyNodeReplacement as w0}from"lexical";import*as js from"react";import{DecoratorBlockNode as x0}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as b0}from"@lexical/utils";import{$applyNodeReplacement as k0}from"lexical";function _0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Bs({relationTo:o,value:e})}:null}var At=class extends x0{__data;constructor({data:e,format:o,key:n}){super(o,n),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"relationship"}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:_0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},n=Bs(o);return n.setFormat(e.format),n}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return b0(o,e?.theme?.relationship),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function Bs(t){return k0(new At({data:t}))}var E0=js.lazy(()=>import("./RelationshipComponent-YCPAKOL7.js").then(t=>({default:t.RelationshipComponent})));function S0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Ve({relationTo:o,value:e})}:null}var Ee=class extends At{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:S0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},n=Ve(o);return n.setFormat(e.format),n}decorate(e,o){return T0(E0,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ve(t){return w0(new Ee({data:t}))}function wn(t){return t instanceof Ee}import{c as W0}from"react/compiler-runtime";import{jsx as K0}from"react/jsx-runtime";import{useLexicalComposerContext as X0}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as J0}from"@lexical/utils";import{$getPreviousSelection as Z0,$getSelection as Y0,$isParagraphNode as q0,$isRangeSelection as Q0,COMMAND_PRIORITY_EDITOR as eh,createCommand as th}from"lexical";import{useEffect as oh}from"react";import{c as Us}from"react/compiler-runtime";import{jsx as En}from"react/jsx-runtime";import{useLexicalComposerContext as zs}from"@lexical/react/LexicalComposerContext.js";import{toast as F0}from"@payloadcms/ui";import{$getNodeByKey as P0,COMMAND_PRIORITY_EDITOR as Vs}from"lexical";import{useEffect as Ws,useState as B0}from"react";import{c as N0}from"react/compiler-runtime";import{jsx as L0}from"react/jsx-runtime";import{useLexicalComposerContext as y0}from"@lexical/react/LexicalComposerContext";import{useListDrawer as R0,useModal as v0}from"@payloadcms/ui";import{$getNodeByKey as Hs,$getPreviousSelection as I0,$getRoot as M0,$getSelection as A0,$isRangeSelection as $0,$setSelection as D0}from"lexical";import{useEffect as O0,useState as Gs}from"react";var $t=t=>{let e=N0(23),[o]=y0(),[n,r]=Gs(null),[l,s]=Gs(!1),[i,u,d]=R0(t),{closeDrawer:c,drawerSlug:a,isDrawerOpen:m,openDrawer:f}=d,{modalState:h}=v0(),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{let N=A0()??I0();r(N)},e[0]=p):p=e[0];let g=p,_;e[1]!==o||e[2]!==n?(_=()=>{n&&o.update(()=>{if($0(n)){let{anchor:N,focus:E}=n;Hs(N.key)&&Hs(E.key)&&D0(n.clone())}else M0().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=n,e[3]=_):_=e[3];let L=_,v;e[4]!==c?(v=()=>{c()},e[4]=c,e[5]=v):v=e[5];let b=v,C,x;e[6]!==a||e[7]!==h||e[8]!==L||e[9]!==l?(C=()=>{if(!l)return;let N=h[a];N&&!N?.isOpen&&(s(!1),setTimeout(()=>{L()},1))},x=[h,a,L,l],e[6]=a,e[7]=h,e[8]=L,e[9]=l,e[10]=C,e[11]=x):(C=e[10],x=e[11]),O0(C,x);let k;e[12]!==u?(k=N=>L0(u,{...N,onClick:()=>{g()}}),e[12]=u,e[13]=k):k=e[13];let T;e[14]!==f?(T=()=>{g(),f(),s(!0)},e[14]=f,e[15]=T):T=e[15];let I;return e[16]!==i||e[17]!==b||e[18]!==m||e[19]!==a||e[20]!==k||e[21]!==T?(I={closeListDrawer:b,isListDrawerOpen:m,ListDrawer:i,listDrawerSlug:a,ListDrawerToggler:k,openListDrawer:T},e[16]=i,e[17]=b,e[18]=m,e[19]=a,e[20]=k,e[21]=T,e[22]=I):I=e[22],I};var j0=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=P0(o);r&&r.replace(Ve({relationTo:e,value:n}))}):t.dispatchCommand(Sn,{relationTo:e,value:n})},H0=t=>{let e=Us(14),{enabledCollectionSlugs:o}=t,[n]=zs(),[r,l]=B0(null),s=o?.[0],i;e[0]!==o||e[1]!==s?(i={collectionSlugs:o,selectedCollection:s},e[0]=o,e[1]=s,e[2]=i):i=e[2];let{closeListDrawer:u,ListDrawer:d,openListDrawer:c}=$t(i),a,m;e[3]!==n||e[4]!==c?(a=()=>n.registerCommand(Ye,g=>(l(g?.replace?g?.replace.nodeKey:null),c(),!0),Vs),m=[n,c],e[3]=n,e[4]=c,e[5]=a,e[6]=m):(a=e[5],m=e[6]),Ws(a,m);let f;e[7]!==u||e[8]!==n||e[9]!==r?(f=g=>{let{collectionSlug:_,doc:L}=g;j0({editor:n,relationTo:_,replaceNodeKey:r,value:L.id}),u()},e[7]=u,e[8]=n,e[9]=r,e[10]=f):f=e[10];let h=f,p;return e[11]!==d||e[12]!==h?(p=En(d,{onSelect:h}),e[11]=d,e[12]=h,e[13]=p):p=e[13],p},G0=()=>{let t=Us(3),[e]=zs(),o,n;return t[0]!==e?(o=()=>e.registerCommand(Ye,U0,Vs),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Ws(o,n),null},Ks=({enabledCollectionSlugs:t})=>t?.length?En(H0,{enabledCollectionSlugs:t}):En(G0,{});function U0(){return F0.error("No relationship collections enabled"),!0}import{useConfig as z0,useEntityVisibility as V0}from"@payloadcms/ui";import*as Js from"react";var Xs=(t,{disabledCollections:e,enabledCollections:o,uploads:n,visibleSlugs:r})=>{let l=o?.length?new Set(o):null,s=e?.length?new Set(e):null;return t.filter(i=>{let{slug:u,admin:d,upload:c}=i;if(r&&!r.includes(u))return!1;if(n){if(!d?.enableRichTextRelationship||!c)return!1}else if(c||!d?.enableRichTextRelationship)return!1;return!(l&&!l.has(u)||s&&s.has(u))})};var uo=t=>{let{collectionSlugsBlacklist:e,collectionSlugsWhitelist:o,uploads:n=!1}=t||{},{config:{collections:r}}=z0(),{visibleEntities:l}=V0();return Js.useMemo(()=>{let s=Xs(r,{disabledCollections:e,enabledCollections:o,uploads:n,visibleSlugs:l?.collections});return{enabledCollections:s,enabledCollectionSlugs:s.map(i=>i.slug)}},[r,l,n,o,e])};var Sn=th("INSERT_RELATIONSHIP_COMMAND"),Zs=t=>{let e=W0(8),{clientProps:o}=t,[n]=X0(),r=o?.disabledCollections,l=o?.enabledCollections,s;e[0]!==r||e[1]!==l?(s={collectionSlugsBlacklist:r,collectionSlugsWhitelist:l},e[0]=r,e[1]=l,e[2]=s):s=e[2];let{enabledCollectionSlugs:i}=uo(s),u,d;e[3]!==n?(u=()=>{if(!n.hasNodes([Ee]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return n.registerCommand(Sn,nh,eh)},d=[n],e[3]=n,e[4]=u,e[5]=d):(u=e[4],d=e[5]),oh(u,d);let c;return e[6]!==i?(c=K0(Ks,{enabledCollectionSlugs:i}),e[6]=i,e[7]=c):c=e[7],c};function nh(t){let e=Y0()||Z0();if(Q0(e)){let o=Ve(t),{focus:n}=e,r=n.getNode();J0(o),q0(r)&&!r.__first&&r.remove()}return!0}var lh=A({nodes:[Ee],plugins:[{Component:Zs,position:"normal"}],slashMenu:{groups:[J([{Icon:Tn,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ye,{replace:!1})}}])]},toolbarFixed:{groups:[be([{ChildComponent:Tn,isActive:({selection:t})=>{if(!rh(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return wn(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ye,{replace:!1})}}])]}});import{c as jh}from"react/compiler-runtime";import{jsx as pe,jsxs as Hh}from"react/jsx-runtime";import{useLexicalComposerContext as Gh}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as aa}from"@lexical/react/useLexicalEditable";import{useScrollInfo as Uh,useThrottledEffect as zh,useTranslation as Vh}from"@payloadcms/ui";import*as ca from"react";import{useMemo as vn}from"react";import{jsx as ih,jsxs as sh}from"react/jsx-runtime";import{Tooltip as ah,useTranslation as ch}from"@payloadcms/ui";import{$addUpdateTag as uh}from"lexical";import{useCallback as Ys,useEffect as dh,useMemo as qs,useRef as mh,useState as fh}from"react";var Nn="toolbar-popup__button",Dt=({active:t=!1,children:e,editor:o,enabled:n=!0,item:r})=>{let{i18n:l}=ch(),{fieldProps:{featureClientSchemaMap:s,schemaPath:i}}=U(),[u,d]=fh(!1),c=mh(null);dh(()=>{c.current?.removeAttribute("data-pressing")},[t]);let a=qs(()=>r.label?typeof r.label=="function"?r.label({featureClientSchemaMap:s,i18n:l,schemaPath:i}):r.label:r.key.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,p=>p.toUpperCase()),[s,l,i,r]),m=qs(()=>[Nn,n?"":"disabled",t?"active":"",r.key?`${Nn}-${r.key}`:""].filter(Boolean).join(" "),[t,n,r.key]),f=Ys(()=>{n&&o.focus(()=>{o.update(()=>{uh("toolbar")}),r.onSelect?.({editor:o,isActive:t})})},[o,r,t,n]),h=Ys(p=>{p.preventDefault(),p.currentTarget.setAttribute("data-pressing","")},[]);return sh("button",{"aria-label":a,className:m,"data-button-key":r.key,disabled:!n,onClick:f,onMouseDown:h,onPointerEnter:()=>d(!0),onPointerLeave:()=>{d(!1),c.current?.removeAttribute("data-pressing")},ref:c,type:"button",children:[ih(ah,{className:`${Nn}__tooltip`,show:u,children:a}),e]})};import{c as kh}from"react/compiler-runtime";import{jsx as ct}from"react/jsx-runtime";import _h,{useMemo as Th}from"react";import{useTranslation as wh}from"@payloadcms/ui";import{jsx as Me,jsxs as Qs}from"react/jsx-runtime";import{Button as ph}from"@payloadcms/ui";import{$addUpdateTag as hh,isDOMNode as gh}from"lexical";import mo,{useCallback as Ch,useEffect as fo,useMemo as ta,useRef as Ln,useState as yn}from"react";import{createPortal as xh}from"react-dom";var ea="toolbar-popup__dropdown-item",oa=mo.createContext(null);function na({active:t,children:e,editor:o,enabled:n,Icon:r,item:l,itemKey:s,tooltip:i}){let u=ta(()=>[ea,n===!1?"disabled":"",t?"active":"",l?.key?`${ea}-${l.key}`:""].filter(Boolean).join(" "),[n,t,l.key]),d=Ln(null),c=mo.use(oa);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=c;return fo(()=>{d?.current!=null&&a(d)},[d,a]),Me(ph,{"aria-label":i,buttonStyle:"ghost",className:u,disabled:n===!1,extraButtonProps:{"data-item-key":s},icon:r,iconPosition:"left",onClick:()=>{n!==!1&&o.focus(()=>{o.update(()=>{hh("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:d,tooltip:i,type:"button",children:e})}function bh({children:t,dropdownKey:e,dropDownRef:o,itemsContainerClassNames:n,onClose:r}){let[l,s]=yn(),[i,u]=yn(),d=Ch(m=>{s(f=>f!=null?[...f,m]:[m])},[s]),c=m=>{if(l==null)return;let{key:f}=m;["ArrowDown","ArrowUp","Escape","Tab"].includes(f)&&m.preventDefault(),f==="Escape"||f==="Tab"?r():f==="ArrowUp"?u(h=>{if(h==null)return l[0];let p=l.indexOf(h)-1;return l[p===-1?l.length-1:p]}):f==="ArrowDown"&&u(h=>h==null?l[0]:l[l.indexOf(h)+1])},a=ta(()=>({registerItem:d}),[d]);return fo(()=>{l!=null&&i==null&&u(l[0]),i!=null&&i?.current!=null&&i.current.focus()},[l,i]),Me(oa,{value:a,children:Me("div",{className:(n??["toolbar-popup__dropdown-items"]).join(" "),"data-dropdown-key":e,"data-theme":"dark",onKeyDown:c,ref:o,children:t})})}function ra({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:n=!1,dropdownKey:r,Icon:l,itemsContainerClassNames:s,label:i,stopCloseOnClickSelf:u}){let d=Ln(null),c=Ln(null),[a,m]=yn(!1),f=()=>{m(!1),c?.current!=null&&c.current.focus()};fo(()=>{let p=c.current,g=d.current;if(a&&p!==null&&g!==null){let{left:_,top:L}=p.getBoundingClientRect(),v=window.scrollY||document.documentElement.scrollTop;g.style.top=`${L+v+p.offsetHeight+5}px`,g.style.left=`${Math.min(_-5,window.innerWidth-g.offsetWidth-20)}px`}},[d,c,a]),fo(()=>{let p=c.current;if(p!==null&&a){let g=_=>{let L=_.target;gh(L)&&(u&&d.current&&d.current.contains(L)||p.contains(L)||m(!1))};return document.addEventListener("click",g),()=>{document.removeEventListener("click",g)}}},[d,c,a,u]);let h=xh(Me(bh,{dropdownKey:r,dropDownRef:d,itemsContainerClassNames:s,onClose:f,children:o}),document.body);return Qs(mo.Fragment,{children:[Qs("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":r,disabled:n,onClick:p=>{p.preventDefault(),m(!a)},onMouseDown:p=>{p.preventDefault()},ref:c,type:"button",children:[l&&Me(l,{}),i&&Me("span",{className:"toolbar-popup__dropdown-label",children:i}),Me("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&Me(mo.Fragment,{children:h})]})}var Rn="toolbar-popup__dropdown",Eh=t=>{let e=kh(15),{active:o,anchorElem:n,editor:r,enabled:l,iconOnly:s,item:i}=t,{i18n:u}=wh(),{fieldProps:d}=U(),{featureClientSchemaMap:c,schemaPath:a}=d;if(i.Component){let f;return e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==l||e[4]!==i?(f=i?.Component&&ct(i.Component,{active:o,anchorElem:n,editor:r,enabled:l,item:i},i.key),e[0]=o,e[1]=n,e[2]=r,e[3]=l,e[4]=i,e[5]=f):f=e[5],f}let m;if(e[6]!==o||e[7]!==r||e[8]!==l||e[9]!==c||e[10]!==u||e[11]!==s||e[12]!==i||e[13]!==a){let f=i.key,h;i.label&&(f=typeof i.label=="function"?i.label({featureClientSchemaMap:c,i18n:u,schemaPath:a}):i.label),f.length>25?h=f.substring(0,25)+"...":h=f,m=ct(na,{active:o,editor:r,enabled:l,Icon:i?.ChildComponent?ct(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:s?f:void 0,children:ct("span",{className:"text",children:h})},i.key),e[6]=o,e[7]=r,e[8]=l,e[9]=c,e[10]=u,e[11]=s,e[12]=i,e[13]=a,e[14]=m}else m=e[14];return m},Sh=_h.memo(Eh),Ot=({anchorElem:t,classNames:e,editor:o,group:n,groupState:r,Icon:l,itemsContainerClassNames:s,label:i})=>{let{items:u,key:d}=n,c=Th(()=>u?.length?u.map(a=>ct(Sh,{active:r.activeItemKeys.includes(a.key),anchorElem:t,editor:o,enabled:r.enabledItemKeys.includes(a.key),iconOnly:n.iconOnly,item:a},a.key)):null,[u,r.activeItemKeys,r.enabledItemKeys,t,o]);return ct(ra,{buttonAriaLabel:`${d} dropdown`,buttonClassName:[Rn,`${Rn}-${d}`,...e||[]].filter(Boolean).join(" "),disabled:!r.enabledGroup,dropdownKey:d,Icon:l,itemsContainerClassNames:[`${Rn}-items`,...s||[]],label:i,children:c},d)};import{mergeRegister as Nh}from"@lexical/utils";import{$getSelection as Lh}from"lexical";import{useCallback as yh,useDeferredValue as Rh,useEffect as vh,useRef as la,useState as Ih}from"react";function Mh(t){let e=new Map,o=new Map;if(!t?.length)return{groupStates:o,itemStates:e};for(let n of t){let r=[];for(let l of n.items)e.set(l.key,{active:!1,enabled:!0}),r.push(l.key);o.set(n.key,{activeItemKeys:[],activeItems:[],enabledGroup:!0,enabledItemKeys:r})}return{groupStates:o,itemStates:e}}function po(t,e){let[o,n]=Ih(()=>Mh(e)),r=Rh(o),l=U(),s=la(l);s.current=l;let i=la(e);i.current=e;let u=gr(),d=yh(()=>{t.getEditorState().read(()=>{let c=Lh();if(!c)return;let a=i.current;if(!a?.length)return;let m=s.current,f=new Map,h=new Map;for(let p of a){let g=[],_=[],L=[],v=p.type==="dropdown"?p.maxActiveItems??1:void 0;for(let C of p.items){let x=C.isActive?(!v||g.length<v)&&C.isActive({editor:t,editorConfigContext:m,selection:c}):!1,k=C.isEnabled?C.isEnabled({editor:t,editorConfigContext:m,selection:c}):!0;x&&(g.push(C.key),_.push(C)),k&&L.push(C.key),f.set(C.key,{active:x,enabled:k})}let b=p.type==="dropdown"&&p.isEnabled?p.isEnabled({editor:t,editorConfigContext:m,selection:c}):!0;h.set(p.key,{activeItemKeys:g,activeItems:_,enabledGroup:b,enabledItemKeys:L})}n({groupStates:h,itemStates:f})})},[t]);return vh(()=>{u(d);let c=()=>{u(d)},a=Nh(t.registerUpdateListener(c));return document.addEventListener("mouseup",c),()=>{a(),document.removeEventListener("mouseup",c)}},[t,u,d]),r}import{c as Ah}from"react/compiler-runtime";import{useEffect as $h}from"react";var Dh=".fixed-toolbar__scroll",Oh=40;function Fh({clientWidth:t,deltaMode:e,deltaY:o,isRightToLeft:n}){let r=e===1?o*Oh:e===2?o*t:o;return n?-r:r}function ia(t){if(!(Math.abs(t.deltaY)>Math.abs(t.deltaX)))return;let o=t.target;if(!(o instanceof Element))return;let n=o.closest(Dh);!n||!(n.scrollWidth>n.clientWidth)||(t.preventDefault(),n.scrollLeft+=Fh({clientWidth:n.clientWidth,deltaMode:t.deltaMode,deltaY:t.deltaY,isRightToLeft:getComputedStyle(n).direction==="rtl"}))}var ut=0;function sa(){let t=Ah(1),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0],$h(Ph,e)}function Ph(){return ut===0&&document.addEventListener("wheel",ia,{passive:!1}),ut=ut+1,Bh}function Bh(){ut=ut-1,ut===0&&document.removeEventListener("wheel",ia)}function Wh({active:t,anchorElem:e,editor:o,enabled:n,item:r}){return r.Component?r?.Component&&pe(r.Component,{anchorElem:e,editor:o,item:r},r.key):r.ChildComponent?pe(Dt,{active:t,editor:o,enabled:n,item:r,children:pe(r.ChildComponent,{})},r.key):null}function Kh({anchorElem:t,editor:e,editorConfig:o,group:n,index:r,toolbarStates:l}){let{i18n:s}=Vh(),{fieldProps:{featureClientSchemaMap:i,schemaPath:u}}=U(),d=l.groupStates.get(n.key),c=vn(()=>{if(n.type!=="dropdown")return;let m=d?.activeItems?.[0];return m?m.ChildComponent:n.ChildComponent},[n,d?.activeItems]),a=vn(()=>{if(n.type!=="dropdown")return;let m=d?.activeItems;if(!m?.length)return;if(m.length>1)return s.t("lexical:general:toolbarItemsActive",{count:m.length});let f=m[0],h=f.key;return f.label&&(h=typeof f.label=="function"?f.label({featureClientSchemaMap:i,i18n:s,schemaPath:u}):f.label),h.length>25&&(h=h.substring(0,25)+"..."),h},[n,d?.activeItems,s,i,u]);return Hh("div",{className:`fixed-toolbar__group fixed-toolbar__group-${n.key}`,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length&&d?pe(Ot,{anchorElem:t,editor:e,group:n,groupState:d,Icon:c,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a}):null,n.type==="buttons"&&n.items.length?n.items.map(m=>{let f=l.itemStates.get(m.key);return pe(Wh,{active:f?.active??!1,anchorElem:t,editor:e,enabled:f?.enabled??!0,item:m},m.key)}):null,r<o.features.toolbarFixed?.groups.length-1&&pe("div",{className:"divider"})]},n.key)}function Xh({anchorElem:t,clientProps:e,editor:o,editorConfig:n,parentWithFixedToolbar:r}){let l=ca.useRef(null),s=aa(),{y:i}=Uh();sa();let u=po(o,n?.features?.toolbarFixed?.groups),d=vn(()=>{if(!r||e?.disableIfParentHasFixedToolbar)return null;let a=r.editorContainerRef.current.previousElementSibling;for(;a;){if(a.classList.contains("fixed-toolbar"))return a;a=a.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,r]);return zh(()=>{if(!d)return;let c=l.current;if(!c)return;let a=c.getBoundingClientRect(),m=d.getBoundingClientRect();if(!(a.bottom<m.top||a.top>m.bottom))c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),d.classList.remove("fixed-toolbar"),d.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!c.classList.contains("fixed-toolbar--overlapping"))return;c.classList.remove("fixed-toolbar--overlapping"),c.classList.add("fixed-toolbar"),d.classList.remove("fixed-toolbar--hide"),d.classList.add("fixed-toolbar")}},50,[l,d,i]),pe("div",{className:"fixed-toolbar",onFocus:c=>{c.stopPropagation()},ref:l,children:s&&pe("div",{className:"fixed-toolbar__scroll",children:n?.features&&n.features?.toolbarFixed?.groups.map((c,a)=>pe(Kh,{anchorElem:t,editor:o,editorConfig:n,group:c,index:a,toolbarStates:u},c.key))})})}var ua=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return ua(t.parentEditor)}return!1},da=t=>{let e=jh(6),{clientProps:o}=t,[n]=Gh(),r=U();if(!aa())return null;let{editorConfig:s}=r,i=o.applyToFocusedEditor&&r.focusedEditor?.editor||n,u=o.applyToFocusedEditor&&r.focusedEditor?.editorConfig||s,d,c;if(e[0]!==o||e[1]!==i||e[2]!==u||e[3]!==r){c=Symbol.for("react.early_return_sentinel");e:{let a=ua(r);if(o?.disableIfParentHasFixedToolbar&&a){c=null;break e}if(!u?.features?.toolbarFixed?.groups?.length){c=null;break e}d=pe(Xh,{anchorElem:document.body,clientProps:o,editor:i,editorConfig:u,parentWithFixedToolbar:a})}e[0]=o,e[1]=i,e[2]=u,e[3]=r,e[4]=d,e[5]=c}else d=e[4],c=e[5];return c!==Symbol.for("react.early_return_sentinel")?c:d};var Jh=A({plugins:[{Component:da,position:"aboveContainer"}]});import{c as Zh}from"react/compiler-runtime";import{jsx as Se,jsxs as pa}from"react/jsx-runtime";import{useLexicalComposerContext as Yh}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as qh}from"@lexical/react/useLexicalEditable";import{mergeRegister as ha}from"@lexical/utils";import{$getSelection as ga,$isRangeSelection as ma,$isTextNode as Qh,COMMAND_PRIORITY_LOW as e5,getDOMSelection as Ca,SELECTION_CHANGE_COMMAND as t5}from"lexical";import{useCallback as go,useEffect as Ft,useMemo as o5,useRef as fa,useState as n5}from"react";import"react";import{createPortal as r5}from"react-dom";function In(t,e){let o=t.getRangeAt(0),n;if(t.anchorNode===e){let r=e;for(;r.firstElementChild!=null;)r=r.firstElementChild;n=r.getBoundingClientRect()}else n=o.getBoundingClientRect();return n}function ho(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:n=0,floatingElem:r,horizontalOffset:l=32,horizontalPosition:s="left",specialHandlingForCaret:i=!1,targetRect:u,verticalGap:d=10}=t,c=o.parentElement;if(u===null||c==null){r.style.opacity="0",r.style.transform="translate(-10000px, -10000px)";return}let a=r.getBoundingClientRect(),m=o.getBoundingClientRect(),f=c.getBoundingClientRect(),h=u.top-a.height-d,p=u.left-l;s==="center"&&(p=u.left+u.width/2-a.width/2);let g=0;return!e&&h<f.top&&!i&&(g=a.height+u.height+d*2,h+=g),s==="center"?p+a.width>f.right?p=f.right-a.width-l:p<f.left&&(p=f.left+l):p+a.width>f.right&&(p=f.right-a.width-l),p-=m.left,r.style.opacity="1",i&&n!==0?(h-=m.bottom-n+a.height-3,r.style.transform=`translate(${p}px, ${h}px) rotate(180deg)`):(h-=m.top,r.style.transform=`translate(${p}px, ${h}px)`),g}function l5({active:t,anchorElem:e,editor:o,enabled:n,item:r}){return r.Component?r?.Component&&Se(r.Component,{anchorElem:e,editor:o,item:r},r.key):r.ChildComponent?Se(Dt,{active:t,editor:o,enabled:n,item:r,children:Se(r.ChildComponent,{})},r.key):null}function i5({anchorElem:t,editor:e,group:o,index:n,toolbarStates:r}){let{editorConfig:l}=U(),s=r.groupStates.get(o.key),i=o5(()=>o.type!=="dropdown"?void 0:s?.activeItems?.[0]?.ChildComponent??o.ChildComponent,[o,s?.activeItems]);return pa("div",{className:`inline-toolbar-popup__group inline-toolbar-popup__group-${o.key}`,"data-toolbar-group-key":o.key,children:[o.type==="dropdown"&&o.items.length&&s?Se(Ot,{anchorElem:t,editor:e,group:o,groupState:s,Icon:i}):null,o.type==="buttons"&&o.items.length?o.items.map(u=>{let d=r.itemStates.get(u.key);return Se(l5,{active:d?.active??!1,anchorElem:t,editor:e,enabled:d?.enabled??!0,item:u},u.key)}):null,n<l.features.toolbarInline?.groups.length-1&&Se("div",{className:"divider"})]},o.key)}function s5({anchorElem:t,editor:e}){let o=fa(null),n=fa(null),{editorConfig:r}=U(),l=po(e,r?.features?.toolbarInline?.groups),s=go(()=>{if(o?.current){let c=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),a||(o.current.style.pointerEvents="none")}},[o]),i=go(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let a=o.current.style.opacity==="0",m=o.current.style.pointerEvents==="none";if(!a||!m){let f=c.clientX,h=c.clientY,p=document.elementFromPoint(f,h);o.current.contains(p)||s()}}},[s]),u=go(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Ft(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",u),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",u)}),[o,i,u]);let d=go(()=>{let c=ga(),a=Ca(e._window);if(o.current===null)return;let m=t.querySelector(":scope > .link-editor"),f=m!==null&&"style"in m&&m?.style?.opacity==="1",h=e.getRootElement();if(c!==null&&a!==null&&!a.isCollapsed&&h!==null&&h.contains(a.anchorNode)){let p=In(a,h),g=ho({alwaysDisplayOnTop:f,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:p});n.current&&ho({anchorElem:o.current,anchorFlippedOffset:g,floatingElem:n.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:p,verticalGap:8})}else s()},[e,s,t]);return Ft(()=>{let c=t.parentElement,a=()=>{e.getEditorState().read(()=>{d()})};return window.addEventListener("resize",a),c&&c.addEventListener("scroll",a),()=>{window.removeEventListener("resize",a),c&&c.removeEventListener("scroll",a)}},[e,d,t]),Ft(()=>(e.getEditorState().read(()=>{d()}),ha(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{d()})}),e.registerCommand(t5,()=>(d(),!1),e5))),[e,d]),pa("div",{className:"inline-toolbar-popup",ref:o,children:[Se("div",{className:"caret",ref:n}),r?.features&&r.features?.toolbarInline?.groups.map((c,a)=>Se(i5,{anchorElem:t,editor:e,group:c,index:a,toolbarStates:l},c.key))]})}function a5(t,e){let o=Zh(12),[n,r]=n5(!1),l=qh(),s;o[0]!==t?(s=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let f=ga(),h=Ca(t._window),p=t.getRootElement();if(h!==null&&(!ma(f)||p===null||!p.contains(h.anchorNode))){r(!1);return}if(!ma(f))return;if(f.getTextContent()!==""){let _=f.getNodes(),L=!1;for(let v of _)if(Qh(v)){r(!0),L=!0;break}L||r(!1)}else r(!1);let g=f.getTextContent().replace(/\n/g,"");if(!f.isCollapsed()&&g===""){r(!1);return}})},o[0]=t,o[1]=s):s=o[1];let i=s,u,d;o[2]!==i?(u=()=>(document.addEventListener("selectionchange",i),document.addEventListener("mouseup",i),()=>{document.removeEventListener("selectionchange",i),document.removeEventListener("mouseup",i)}),d=[i],o[2]=i,o[3]=u,o[4]=d):(u=o[3],d=o[4]),Ft(u,d);let c,a;if(o[5]!==t||o[6]!==i?(c=()=>ha(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&r(!1)})),a=[t,i],o[5]=t,o[6]=i,o[7]=c,o[8]=a):(c=o[7],a=o[8]),Ft(c,a),!n||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=r5(Se(s5,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var xa=t=>{let{anchorElem:e}=t,[o]=Yh();return a5(o,e)};var c5=A({plugins:[{Component:xa,position:"floatingAnchorElem"}]});import{TableCellNode as e2,TableNode as t2,TableRowNode as o2}from"@lexical/table";import{jsx as ba}from"react/jsx-runtime";import"react";var u5={16:"M7 4h4.5a.5.5 0 0 1 .5.5V6H7zM6 4H4.5a.5.5 0 0 0-.5.5V6h2zm0 3H4v2h2zm0 3H4v1.5a.5.5 0 0 0 .5.5H6zm1 2h4.5a.5.5 0 0 0 .5-.5V10H7zm0-3V7h5v2zM3 4.5A1.5 1.5 0 0 1 4.5 3h7A1.5 1.5 0 0 1 13 4.5v7a1.5 1.5 0 0 1-1.5 1.5h-7A1.5 1.5 0 0 1 3 11.5z",24:"M17.204 6.51A2 2 0 0 1 19 8.5V16l-.011.204a2 2 0 0 1-1.785 1.785L17 18H7l-.204-.01a2 2 0 0 1-1.786-1.786L5 16V8.5a2 2 0 0 1 1.796-1.99L7 6.5h10zM6 16a1 1 0 0 0 1 1h2v-2.5H6zm4-1.5V17h7a1 1 0 0 0 .995-.898L18 16v-1.5zm-4-1h3V11H6zm4-2.5v2.5h8V11zM7 7.5a1 1 0 0 0-.995.897L6 8.5V10h3V7.5zm3 2.5h8V8.5a1 1 0 0 0-1-1h-7z"},Mn=({className:t,size:e=24})=>ba("svg",{className:["icon",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:ba("path",{clipRule:"evenodd",d:u5[e],fill:"currentColor",fillRule:"evenodd"})});import{$convertToMarkdownString as d5}from"@lexical/markdown";import{$createTableCellNode as m5,$createTableNode as f5,$createTableRowNode as p5,$isTableCellNode as ka,$isTableNode as An,$isTableRowNode as $n,TableCellHeaderStates as Co,TableCellNode as h5,TableNode as g5,TableRowNode as C5}from"@lexical/table";import{$isParagraphNode as x5,$isTextNode as b5}from"lexical";var Ta=/^\|(.+)\|\s?$/,k5=/^(\| ?:?-*:? ?)+\|\s?$/,wa=({allTransformers:t})=>({type:"element",dependencies:[g5,C5,h5],export:e=>{if(!An(e))return null;let o=[];for(let n of e.getChildren()){let r=[];if(!$n(n))continue;let l=!1;for(let s of n.getChildren())ka(s)&&(r.push(d5(t,s).replace(/\n/g,"\\n").trim()),s.__headerState===Co.ROW&&(l=!0));o.push(`| ${r.join(" | ")} |`),l&&o.push(`| ${r.map(s=>"---").join(" | ")} |`)}return o.join(`
58
+ `)},regExp:Ta,replace:(e,o,n)=>{let r=n[0];if(!r)return;if(k5.test(r)){let a=e.getPreviousSibling();if(!a||!An(a))return;let m=a.getChildren(),f=m[m.length-1];if(!f||!$n(f))return;f.getChildren().forEach(h=>{ka(h)&&h.setHeaderStyles(Co.ROW,Co.ROW)}),e.remove();return}let l=_a(r,t);if(l==null)return;let s=[l],i=e.getPreviousSibling(),u=l.length;for(;i&&!(!x5(i)||i.getChildrenSize()!==1);){let a=i.getFirstChild();if(!b5(a))break;let m=_a(a.getTextContent(),t);if(m==null)break;u=Math.max(u,m.length),s.unshift(m);let f=i.getPreviousSibling();i.remove(),i=f}let d=f5();for(let a of s){let m=p5();d.append(m);for(let f=0;f<u;f++)m.append(f<a.length?a[f]:Ea("",t))}let c=e.getPreviousSibling();An(c)&&_5(c)===u?(c.append(...d.getChildren()),e.remove()):e.replace(d),d.selectEnd()}});function _5(t){let e=t.getFirstChild();return $n(e)?e.getChildrenSize():0}var Ea=(t,e)=>{t=t.replace(/\\n/g,`
59
+ `);let o=m5(Co.NO_STATUS);return Zt(t,e,o,!1,!0),o},_a=(t,e)=>{let o=t.match(Ta);return!o||!o[1]?null:o[1].split("|").map(n=>Ea(n,e))};import{c as w5}from"react/compiler-runtime";import{jsx as j,jsxs as Ne}from"react/jsx-runtime";import{useLexicalComposerContext as va}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as E5}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as La,$deleteTableColumnAtSelection as S5,$deleteTableRowAtSelection as N5,$getNodeTriplet as L5,$getTableCellNodeFromLexicalNode as ya,$getTableColumnIndexFromTableCellNode as y5,$getTableNodeFromLexicalNodeOrThrow as $e,$getTableRowIndexFromTableCellNode as R5,$insertTableColumnAtSelection as v5,$insertTableRowAtSelection as I5,$isTableCellNode as Ia,$isTableSelection as Pt,$mergeCells as M5,$unmergeCell as A5,getTableElement as Dn,getTableObserverFromTableElement as On,TableCellHeaderStates as Ae,TableCellNode as $5}from"@lexical/table";import{mergeRegister as D5}from"@lexical/utils";import{useScrollInfo as O5}from"@payloadcms/ui";import{$getSelection as bo,$isElementNode as F5,$isRangeSelection as Fn,$isTextNode as P5,$setSelection as B5,COMMAND_PRIORITY_CRITICAL as j5,getDOMSelection as H5,isDOMNode as G5,SELECTION_CHANGE_COMMAND as U5}from"lexical";import*as Pn from"react";import{useCallback as ue,useEffect as dt,useRef as xo,useState as mt}from"react";import{createPortal as Ma}from"react-dom";import{jsx as Sa}from"react/jsx-runtime";import"react";var T5={16:"M5 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0m4 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 1a1 1 0 1 0 0-2 1 1 0 0 0 0 2",24:"M7.5 12a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m6 0a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m4.5 1.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3"},Na=({className:t,size:e=24})=>Sa("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Sa("path",{clipRule:"evenodd",d:T5[e],fill:"currentColor",fillRule:"evenodd"})});function Ra(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function z5(){let t=bo();if(Fn(t)&&!t.isCollapsed()||Pt(t)&&!t.anchor.is(t.focus)||!Fn(t)&&!Pt(t))return!1;let[e]=L5(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function V5(t){let e=t.getLastDescendant();P5(e)?e.select():F5(e)?e.selectEnd():e!==null&&e.selectNext()}function W5({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[l]=va(),s=xo(null),[i,u]=mt(r),[d,c]=mt({columns:1,rows:1}),[a,m]=mt(!1),[f,h]=mt(!1),{y:p}=O5();dt(()=>l.registerMutationListener($5,w=>{w.get(i.getKey())==="updated"&&l.getEditorState().read(()=>{u(i.getLatest())})},{skipInitialization:!0}),[l,i]),dt(()=>{l.getEditorState().read(()=>{let w=bo();if(Pt(w)){let R=Ra(w);c(Ra(w)),m(R.columns>1||R.rows>1)}h(z5())})},[l]),dt(()=>{let w=e.current,R=s.current,y=l.getRootElement();if(w!=null&&R!=null&&y!=null){let M=y.getBoundingClientRect(),$=w.getBoundingClientRect();R.style.opacity="1";let D=R.getBoundingClientRect(),F=5,P=$.right+F;if(P+D.width>window.innerWidth||P+D.width>M.right){let X=$.left-D.width-F;P=(X<0?F:X)+window.pageXOffset}R.style.left=`${P+window.pageXOffset}px`;let Y=$.top;if(Y+D.height>window.innerHeight){let X=$.bottom-D.height;Y=X<0?F:X}R.style.top=`${Y}px`}},[e,s,l,p]),dt(()=>{function w(R){s.current!=null&&e.current!=null&&G5(R.target)&&!s.current.contains(R.target)&&!e.current.contains(R.target)&&n(!1)}return window.addEventListener("click",w),()=>window.removeEventListener("click",w)},[n,e]);let g=ue(()=>{l.update(()=>{if(i.isAttached()){let w=$e(i),R=Dn(w,l.getElementByKey(w.getKey()));if(R===null)throw new Error("Expected to find tableElement in DOM");let y=On(R);y!==null&&y.$clearHighlight(),w.markDirty(),u(i.getLatest())}B5(null)})},[l,i]),_=()=>{l.update(()=>{let w=bo();if(!Pt(w))return;let y=w.getNodes().filter(Ia),M=M5(y);M&&(V5(M),o())})},L=()=>{l.update(()=>{A5()})},v=ue(w=>{l.update(()=>{for(let R=0;R<d.rows;R++)I5(w);o()})},[l,o,d.rows]),b=ue(w=>{l.update(()=>{for(let R=0;R<d.columns;R++)v5(w);o()})},[l,o,d.columns]),C=ue(()=>{l.update(()=>{N5(),o()})},[l,o]),x=ue(()=>{l.update(()=>{$e(i).remove(),g(),o()})},[l,i,g,o]),k=ue(()=>{l.update(()=>{S5(),o()})},[l,o]),T=ue(()=>{l.update(()=>{let w=$e(i),R=R5(i),[y]=La(w,null,null),M=new Set,$=i.getHeaderStyles()^Ae.ROW;if(y[R])for(let D=0;D<y[R].length;D++){let F=y[R][D];F?.cell&&(M.has(F.cell)||(M.add(F.cell),F.cell.setHeaderStyles($,Ae.ROW)))}g(),o()})},[l,i,g,o]),I=ue(()=>{l.update(()=>{let w=$e(i),R=y5(i),[y]=La(w,null,null),M=new Set,$=i.getHeaderStyles()^Ae.COLUMN;if(y)for(let D=0;D<y.length;D++){let F=y?.[D]?.[R];F?.cell&&(M.has(F.cell)||(M.add(F.cell),F.cell.setHeaderStyles($,Ae.COLUMN)))}g(),o()})},[l,i,g,o]),N=ue(()=>{l.update(()=>{if(i.isAttached()){let w=$e(i);w&&w.setRowStriping(!w.getRowStriping())}g(),o()})},[l,i,g,o]),E=ue(()=>{l.update(()=>{if(i.isAttached()){let w=$e(i);w&&w.setFrozenColumns(w.getFrozenColumns()===0?1:0)}g(),o()})},[l,i,g,o]),S=null;return t&&(a?S=j("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>_(),type:"button",children:j("span",{className:"text",children:"Merge cells"})}):f&&(S=j("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>L(),type:"button",children:j("span",{className:"text",children:"Unmerge cells"})}))),Ma(Ne("div",{className:"table-action-menu-dropdown",onClick:w=>{w.stopPropagation()},ref:s,children:[S?Ne(Pn.Fragment,{children:[S,j("hr",{})]}):null,j("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>N(),type:"button",children:j("span",{className:"text",children:"Toggle row striping"})}),j("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>E(),type:"button",children:j("span",{className:"text",children:"Toggle first column freeze"})}),j("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>v(!1),type:"button",children:Ne("span",{className:"text",children:["Insert ",d.rows===1?"row":`${d.rows} rows`," above"]})}),j("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>v(!0),type:"button",children:Ne("span",{className:"text",children:["Insert ",d.rows===1?"row":`${d.rows} rows`," below"]})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>b(!1),type:"button",children:Ne("span",{className:"text",children:["Insert ",d.columns===1?"column":`${d.columns} columns`," ","left"]})}),j("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>b(!0),type:"button",children:Ne("span",{className:"text",children:["Insert ",d.columns===1?"column":`${d.columns} columns`," ","right"]})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>k(),type:"button",children:j("span",{className:"text",children:"Delete column"})}),j("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>C(),type:"button",children:j("span",{className:"text",children:"Delete row"})}),j("button",{className:"item","data-test-id":"table-delete",onClick:()=>x(),type:"button",children:j("span",{className:"text",children:"Delete table"})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-row-header",onClick:()=>T(),type:"button",children:Ne("span",{className:"text",children:[(i.__headerState&Ae.ROW)===Ae.ROW?"Remove":"Add"," ","row header"]})}),j("button",{className:"item","data-test-id":"table-column-header",onClick:()=>I(),type:"button",children:Ne("span",{className:"text",children:[(i.__headerState&Ae.COLUMN)===Ae.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function K5({anchorElem:t,cellMerge:e}){let[o]=va(),n=xo(null),r=xo(null),[l,s]=mt(!1),[i,u]=mt(null),d=ue(()=>{let a=n.current,m=bo(),f=H5(o._window),h=document.activeElement;function p(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),u(null)}if(m==null||a==null)return p();let g=o.getRootElement(),_=null,L=null;if(Fn(m)&&g!==null&&f!==null&&g.contains(f.anchorNode)){let b=ya(m.anchor.getNode());if(b==null||(L=o.getElementByKey(b.getKey()),L==null||!b.isAttached()))return p();let C=$e(b),x=Dn(C,o.getElementByKey(C.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");_=On(x),u(b)}else if(Pt(m)){let b=ya(m.anchor.getNode());if(!Ia(b))throw new Error("TableSelection anchorNode must be a TableCellNode");let C=$e(b),x=Dn(C,o.getElementByKey(C.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");_=On(x),L=o.getElementByKey(b.getKey())}else if(!h)return p();if(_===null||L===null)return p();let v=!_||!_.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",v),a.classList.toggle("table-cell-action-button-container--inactive",!v),v){let b=L.getBoundingClientRect(),C=t.getBoundingClientRect(),x=b.top-C.top,k=b.right-C.left;a.style.transform=`translate(${k}px, ${x}px)`}},[o,t]);dt(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(d)},f=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return D5(o.registerUpdateListener(f),o.registerCommand(U5,f,j5),o.registerRootListener((h,p)=>{p&&p.removeEventListener("pointerup",f),h&&(h.addEventListener("pointerup",f),f())}),()=>clearTimeout(a))});let c=xo(i);return dt(()=>{c.current!==i&&s(!1),c.current=i},[c,i]),j("div",{className:"table-cell-action-button-container",ref:n,children:i!=null&&Ne(Pn.Fragment,{children:[j("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),s(!l)},ref:r,type:"button",children:j(Na,{})}),l&&j(W5,{cellMerge:e,contextRef:r,onClose:()=>s(!1),setIsMenuOpen:s,tableCellNode:i})]})})}var Aa=t=>{let e=w5(3),{anchorElem:o}=t,n=E5(),r;return e[0]!==o||e[1]!==n?(r=Ma(n?j(K5,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=n,e[2]=r):r=e[2],r};import{c as X5}from"react/compiler-runtime";import{jsx as _o,jsxs as J5}from"react/jsx-runtime";import{useLexicalComposerContext as Z5}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Y5}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as q5,$getTableNodeFromLexicalNodeOrThrow as Bn,$getTableRowIndexFromTableCellNode as Q5,$isTableCellNode as $a,$isTableRowNode as eg,getDOMCellFromTarget as tg,getTableElement as og,TableNode as Da}from"@lexical/table";import{calculateZoomLevel as Oa,mergeRegister as ng}from"@lexical/utils";import{$getNearestNodeFromDOMNode as jn,isHTMLElement as rg,SKIP_SCROLL_INTO_VIEW_TAG as Fa}from"lexical";import*as Ba from"react";import{useCallback as Bt,useEffect as Hn,useRef as ko,useState as ft}from"react";import{createPortal as lg}from"react-dom";var ig=33,Pa=92;function sg({editor:t}){let e=ko(null),o=ko(null),n=ko(null),[r,l]=ft(!1),s=U(),i=ko(null),[u,d]=ft(null),[c,a]=ft(null),[m,f]=ft(!1),[h,p]=ft(null),g=Bt(()=>{a(null),e.current=null,p(null),i.current=null,n.current=null},[]),_=E=>(E.buttons&1)===1;Hn(()=>{let E=new Set;return ng(t.registerMutationListener(Da,S=>{for(let[w,R]of S)R==="destroyed"?E.delete(w):E.add(w);l(E.size>0)}),t.registerNodeTransform(Da,S=>{if(S.getColWidths())return S;let w=S.getColumnCount(),R=Pa;return S.setColWidths(Array(w).fill(R)),S}))},[t]),Hn(()=>{if(!r)return;let E=y=>{let M=y.target;if(rg(M)){if(h){d({x:y.clientX,y:y.clientY});return}if(f(_(y)),!(o.current&&o.current.contains(M))&&e.current!==M){e.current=M;let $=tg(M);$&&c!==$?t.getEditorState().read(()=>{let D=jn($.elem);if(!D)throw new Error("TableCellResizer: Table cell node not found.");let F=Bn(D),P=og(F,t.getElementByKey(F.getKey()));if(!P)throw new Error("TableCellResizer: Table element not found.");e.current=M,n.current=P.getBoundingClientRect(),a($)},{editor:t}):$==null&&g()}}},S=y=>{f(!0)},w=y=>{f(!1)},R=t.registerRootListener((y,M)=>{M?.removeEventListener("mousemove",E),M?.removeEventListener("mousedown",S),M?.removeEventListener("mouseup",w),y?.addEventListener("mousemove",E),y?.addEventListener("mousedown",S),y?.addEventListener("mouseup",w)});return()=>{R()}},[c,h,t,r,g]);let L=E=>E==="bottom",v=Bt(E=>{if(!c)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=jn(c.elem);if(!$a(S))throw new Error("TableCellResizer: Table cell node not found.");let w=Bn(S),R=Q5(S),y=w.getChildren(),$=S.getColSpan()===w.getColumnCount()?R:R+S.getRowSpan()-1;if($>=y.length||$<0)throw new Error("Expected table cell to be inside of table row.");let D=y[$];if(!eg(D))throw new Error("Expected table row");let F=D.getHeight();if(F===void 0){let Y=D.getChildren();F=Math.min(...Y.map(X=>b(X,t)??1/0))}let P=Math.max(F+E,ig);D.setHeight(P)},{tag:Fa})},[c,t]),b=(E,S)=>S.getElementByKey(E.getKey())?.clientHeight,C=(E,S)=>{let w;return S.forEach(R=>{R.forEach((y,M)=>{y.cell===E&&(w=M)})}),w},x=Bt(E=>{if(!c)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=jn(c.elem);if(!$a(S))throw new Error("TableCellResizer: Table cell node not found.");let w=Bn(S),[R]=q5(w,null,null),y=C(S,R);if(y===void 0)throw new Error("TableCellResizer: Table column not found.");let M=w.getColWidths();if(!M)return;let $=M[y];if($===void 0)return;let D=[...M],F=Math.max($+E,Pa);D[y]=F,w.setColWidths(D)},{tag:Fa})},[c,t]),k=Bt(E=>{let S=w=>{if(w.preventDefault(),w.stopPropagation(),!c)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:R,y}=i.current;if(c===null)return;let M=Oa(w.target);if(L(E)){let $=(w.clientY-y)/M;v($)}else{let $=(w.clientX-R)/M;x($)}g(),document.removeEventListener("mouseup",S)}};return S},[c,g,x,v]),T=Bt(E=>S=>{if(S.preventDefault(),S.stopPropagation(),!c)throw new Error("TableCellResizer: Expected active cell.");i.current={x:S.clientX,y:S.clientY},d(i.current),p(E),document.addEventListener("mouseup",k(E))},[c,k]),[I,N]=ft({bottom:null,left:null,right:null,top:null});return Hn(()=>{if(c){let{height:E,left:S,top:w,width:R}=c.elem.getBoundingClientRect(),y=Oa(c.elem),M=10,$={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${M}px`,left:`${window.scrollX+S}px`,top:`${window.scrollY+w+E-M/2}px`,width:`${R}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${E}px`,left:`${window.scrollX+S+R-M/2}px`,top:`${window.scrollY+w}px`,width:`${M}px`}},D=n.current;h&&u&&D&&(L(h)?($[h].left=`${window.scrollX+D.left}px`,$[h].top=`${window.scrollY+u.y/y}px`,$[h].height="3px",$[h].width=`${D.width}px`):($[h].top=`${window.scrollY+D.top}px`,$[h].left=`${window.scrollX+u.x/y}px`,$[h].width="3px",$[h].height=`${D.height}px`),$[h].backgroundColor="#adf"),N($)}else N({bottom:null,left:null,right:null,top:null})},[c,h,u]),_o("div",{ref:o,children:c!=null&&!m&&J5(Ba.Fragment,{children:[_o("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("right"),style:I.right||void 0}),_o("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("bottom"),style:I.bottom||void 0})]})})}var ja=()=>{let t=X5(3),[e]=Z5(),o=Y5(),n;return t[0]!==e||t[1]!==o?(n=o?lg(_o(sg,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=n):n=t[2],n};import{c as hg}from"react/compiler-runtime";import{jsx as Gn,jsxs as gg,Fragment as Cg}from"react/jsx-runtime";import{useLexicalComposerContext as xg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Xa}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as bg,$getTableColumnIndexFromTableCellNode as kg,$getTableRowIndexFromTableCellNode as _g,$insertTableColumnAtSelection as Tg,$insertTableRowAtSelection as wg,$isTableCellNode as Eg,$isTableNode as Ua,getTableElement as Sg,TableNode as Ng}from"@lexical/table";import{$findMatchingParent as Lg,mergeRegister as yg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as za,isHTMLElement as Rg}from"lexical";import{useEffect as Va,useMemo as vg,useRef as Wa,useState as To}from"react";import"react";import{createPortal as Ig}from"react-dom";import{c as mg}from"react/compiler-runtime";import{useEffect as fg,useRef as pg}from"react";var ag="Expected a function",cg=Math.max,ug=Math.min;function dg(t,e,o){let n,r,l=0,s,i=!1,u=!1,d,c,a,m=!0;if(typeof t!="function")throw new TypeError(ag);e=e||0,typeof o=="object"&&(i=!!o.leading,u="maxWait"in o,d=u?cg(o.maxWait||0,e):d,m="trailing"in o?!!o.trailing:m);function f(x){let k=n,T=s;return n=s=void 0,l=x,c=t.apply(T,k),c}function h(x){return l=x,a=setTimeout(_,e),i?f(x):c}function p(x){let k=x-r,T=x-l,I=e-k;return u?ug(I,d-T):I}function g(x){let k=x-r,T=x-l;return r===void 0||k>=e||k<0||u&&T>=d}function _(){let x=Date.now();if(g(x))return L(x);a=setTimeout(_,p(x))}function L(x){return a=void 0,m&&n?f(x):(n=s=void 0,c)}function v(){a!==void 0&&clearTimeout(a),l=0,n=r=s=a=void 0}function b(){return a===void 0?c:L(Date.now())}function C(){let x=Date.now(),k=g(x);if(n=arguments,s=this,r=x,k){if(a===void 0)return h(r);if(u)return clearTimeout(a),a=setTimeout(_,e),f(r)}return a===void 0&&(a=setTimeout(_,e)),c}return C.cancel=v,C.flush=b,C}var Ha=dg;function Ga(t,e,o){let n=mg(6),r=pg(null),l,s;n[0]!==t||n[1]!==o||n[2]!==e?(l=()=>(r.current=Ha(t,e,{maxWait:o}),()=>{r.current?.cancel()}),s=[t,e,o],n[0]=t,n[1]=o,n[2]=e,n[3]=l,n[4]=s):(l=n[3],s=n[4]),fg(l,s);let i;return n[5]===Symbol.for("react.memo_cache_sentinel")?(i=(...d)=>{let c=d;r.current&&r.current(...c)},n[5]=i):i=n[5],i}var Ka=16;function Mg({anchorElem:t}){let[e]=xg(),o=Xa(),n=U(),[r,l]=To(!1),[s,i]=To(!1),[u,d]=To(!1),[c,a]=To({}),m=Wa(new Set),f=Wa(null),h=Ga(_=>{let{isOutside:L,tableDOMNode:v}=Ag(_,n.editorConfig?.lexical);if(L){l(!1),i(!1);return}if(!v)return;f.current=v;let b=null,C=null,x=null;if(e.getEditorState().read(()=>{let $=za(v);if(Eg($)){let D=Lg($,F=>Ua(F));if(!Ua(D))return;if(x=Sg(D,e.getElementByKey(D.getKey())),x){let F=D.getChildrenSize(),P=D.getChildAtIndex(0)?.getChildrenSize(),Y=_g($),X=kg($);Y===F-1?b=$:X===P-1&&(C=$)}}},{editor:e}),!x)return;let k=x.parentElement;if(!k)return;let{bottom:T,height:I,left:N,right:E,width:S,y:w}=x.getBoundingClientRect(),R=!1;k&&k.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(R=k.scrollWidth>k.clientWidth);let{left:y,y:M}=t.getBoundingClientRect();b?(i(!1),l(!0),a({height:Ka,left:R&&k?k.offsetLeft:N-y,top:T-M+5,width:R&&k?k.offsetWidth:S})):C&&(i(!0),l(!1),a({height:I,left:E-y+5,top:w-M,width:Ka}))},50,250),p=vg(()=>new ResizeObserver(()=>{l(!1),i(!1)}),[]);Va(()=>{if(u)return document.addEventListener("mousemove",h),()=>{l(!1),i(!1),document.removeEventListener("mousemove",h)}},[u,h]),Va(()=>yg(e.registerMutationListener(Ng,_=>{e.getEditorState().read(()=>{let L=!1;for(let[v,b]of _)switch(b){case"created":{m.current.add(v),L=!0;break}case"destroyed":{m.current.delete(v),L=!0;break}default:break}if(L){p.disconnect();for(let v of m.current){let{tableElement:b}=bg(v);p.observe(b)}d(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,p]);let g=_=>{e.update(()=>{f.current&&(za(f.current)?.selectEnd(),_?(wg(),l(!1)):(Tg(),i(!1)))})};return o?gg(Cg,{children:[r&&Gn("button",{"aria-label":"Add Row",className:n.editorConfig.lexical.theme.tableAddRows,onClick:()=>g(!0),style:{...c},type:"button"}),s&&Gn("button",{"aria-label":"Add Column",className:n.editorConfig.lexical.theme.tableAddColumns,onClick:()=>g(!1),style:{...c},type:"button"})]}):null}function Ag(t,e){let o=t.target;if(Rg(o)){let n=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(n||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:n}}else return{isOutside:!0,tableDOMNode:null}}function Ja(t){let e=hg(2),{anchorElem:o}=t,n=o===void 0?document.body:o;if(!Xa())return null;let l;return e[0]!==n?(l=Ig(Gn(Mg,{anchorElem:n}),n),e[0]=n,e[1]=l):l=e[1],l}import{jsx as Vn,jsxs as Fg}from"react/jsx-runtime";import{useLexicalComposerContext as Pg}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Bg}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as jg,TableCellNode as Hg,TableNode as Gg,TableRowNode as Ug}from"@lexical/table";import{mergeRegister as zg}from"@lexical/utils";import{$getSelection as Vg,$isRangeSelection as Wg,$setSelection as Kg,COMMAND_PRIORITY_EDITOR as Xg,createCommand as Jg}from"lexical";import{createContext as Zg,use as Yg,useCallback as tc,useEffect as oc,useMemo as qg,useRef as Qg,useState as wo}from"react";import*as nc from"react";import{jsx as Q,jsxs as Le}from"react/jsx-runtime";import{useCallback as Un,useEffect as Za,useRef as zn,useState as jt}from"react";import*as Qa from"react";import{createPortal as $g}from"react-dom";var Ya=10,qa=7;function Dg(){return Le("svg",{fill:"none",height:"12",viewBox:"0 0 12 12",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[Q("rect",{height:"9",rx:"1",stroke:"currentColor",width:"3",x:"1.5",y:"1.5"}),Q("rect",{height:"9",rx:"1",stroke:"currentColor",width:"3",x:"7.5",y:"1.5"})]})}function Og(){return Le("svg",{fill:"none",height:"12",viewBox:"0 0 12 12",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[Q("rect",{height:"3",rx:"1",stroke:"currentColor",width:"9",x:"1.5",y:"1.5"}),Q("rect",{height:"3",rx:"1",stroke:"currentColor",width:"9",x:"1.5",y:"7.5"})]})}function ec({anchorElem:t,editor:e,isOpen:o,onClose:n,onInsert:r,position:l}){let[s,i]=jt(0),[u,d]=jt(0),[c,a]=jt(""),[m,f]=jt(""),[h,p]=jt(null),g=zn(null),_=zn(null),L=zn(null),v=s>0?s:c?parseInt(c,10)||0:5,b=u>0?u:m?parseInt(m,10)||0:5;Za(()=>{o||(i(0),d(0),a(""),f(""),p(null))},[o]),Za(()=>{if(!o)return;let N=E=>{if(E.key==="Escape"&&(E.preventDefault(),E.stopPropagation(),n()),E.key==="Enter"&&h){E.preventDefault();let S=parseInt(c,10),w=parseInt(m,10);S>0&&w>0&&r(S,w)}};return document.addEventListener("keydown",N,!0),()=>document.removeEventListener("keydown",N,!0)},[o,n,r,h,c,m]);let C=Un((N,E)=>{N>0&&E>0&&r(N,E)},[r]),x=Un((N,E)=>{i(N),d(E)},[]),k=Un(()=>{i(0),d(0)},[]);if(!o||!l||!t)return null;let T=[];for(let N=1;N<=qa;N++)for(let E=1;E<=Ya;E++){let S=E<=v&&N<=b,w=E<=s&&N<=u,R="table-grid-popup__cell";S&&w?R+=" table-grid-popup__cell--hover":S&&(R+=" table-grid-popup__cell--selected"),T.push(Q("div",{"aria-label":`${E} columns, ${N} rows`,className:R,onClick:()=>C(E,N),onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),C(E,N))},onMouseEnter:()=>x(E,N),role:"button",tabIndex:-1},`${N}-${E}`))}let I=s>0&&u>0;return $g(Le(Qa.Fragment,{children:[Q("div",{className:"table-grid-popup__backdrop",onClick:n}),Q("div",{className:"table-grid-popup",ref:g,style:{transform:`translate(${l.left}px, ${l.top}px)`},children:Le("div",{className:"table-grid-popup__content",children:[Le("div",{className:"table-grid-popup__header",children:[Le("div",{className:`table-grid-popup__input-group${h==="cols"?" table-grid-popup__input-group--focused":""}`,children:[Q("div",{className:"table-grid-popup__input-icon",children:Q(Dg,{})}),Q("input",{"aria-label":"Columns",className:"table-grid-popup__input",min:1,onBlur:()=>p(null),onChange:N=>a(N.target.value),onFocus:()=>p("cols"),placeholder:s>0?String(s):"5",ref:_,type:"number",value:c})]}),Q("span",{className:"table-grid-popup__separator",children:"\xD7"}),Le("div",{className:`table-grid-popup__input-group${h==="rows"?" table-grid-popup__input-group--focused":""}`,children:[Q("div",{className:"table-grid-popup__input-icon",children:Q(Og,{})}),Q("input",{"aria-label":"Rows",className:"table-grid-popup__input",min:1,onBlur:()=>p(null),onChange:N=>f(N.target.value),onFocus:()=>p("rows"),placeholder:u>0?String(u):"5",ref:L,type:"number",value:m})]})]}),Le("div",{className:"table-grid-popup__grid",onMouseLeave:k,children:[T,I&&Le("div",{className:"table-grid-popup__tooltip",style:{left:`calc(${(s-.5)/Ya*100}%)`,top:`calc(${(u-1)/qa*100}%)`},children:[v," \xD7 ",b]})]})]})})]}),t)}var Eo=Jg("OPEN_EMBED_DRAWER_COMMAND"),rc=Zg({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function lc({children:t}){let[e,o]=wo({cellEditorConfig:null,cellEditorPlugins:null});return Vn(rc,{value:qg(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(n,r)=>{o({cellEditorConfig:n,cellEditorPlugins:r})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var ic=()=>{let[t]=Pg(),e=Yg(rc),[o,n]=wo(!1),[r,l]=wo(null),s=Qg(null),[i,u]=wo(null);oc(()=>{let a=t.getRootElement();if(a){let m=a.closest(".editor")??null;u(m??a.parentElement)}},[t]),oc(()=>{if(!t.hasNodes([Gg,Ug,Hg]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return zg(t.registerCommand(Eo,()=>{let a=i;if(!a)return!0;let m=a.getBoundingClientRect(),f=null;t.getEditorState().read(()=>{let p=Vg();if(Wg(p)){s.current=p.clone();let g=p.anchor.getNode(),_=t.getElementByKey(g.getKey());if(_){let L=_.getBoundingClientRect();L.height>0&&(f={left:L.left-m.left,top:L.bottom-m.top+8})}}});let h=window.getSelection();if(h&&h.rangeCount>0){let g=h.getRangeAt(0).getBoundingClientRect();g.height>0&&(f={left:g.left-m.left,top:g.bottom-m.top+8})}return f||(f={left:0,top:40}),l(f),n(!0),!0},Xg))},[e,t,i]);let d=tc(()=>{n(!1)},[]),c=tc((a,m)=>{n(!1),t.focus(),t.update(()=>{s.current&&Kg(s.current.clone())},{discrete:!0,skipTransforms:!0}),setTimeout(()=>{t.dispatchCommand(jg,{columns:String(a),rows:String(m)})},1)},[t]);return Fg(nc.Fragment,{children:[Vn(ec,{anchorElem:i,editor:t,isOpen:o,onClose:d,onInsert:c,position:r}),Vn(Bg,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]})};var n2=A({markdownTransformers:[wa],nodes:[t2,e2,o2],plugins:[{Component:ic,position:"normal"},{Component:ja,position:"normal"},{Component:Aa,position:"floatingAnchorElem"},{Component:Ja,position:"floatingAnchorElem"}],providers:[lc],slashMenu:{groups:[J([{Icon:Mn,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Eo,{})}}])]},toolbarFixed:{groups:[be([{ChildComponent:Mn,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Eo,{})}}])]}});import{$isNodeSelection as M2}from"lexical";import{jsx as sc}from"react/jsx-runtime";import"react";var r2="M16.2041 6.01074C17.2128 6.113 18 6.96435 18 8V16L17.9893 16.2041C17.8938 17.1457 17.1457 17.8938 16.2041 17.9893L16 18H8C6.96435 18 6.113 17.2128 6.01074 16.2041L6 16V8C6 6.89543 6.89543 6 8 6H16L16.2041 6.01074ZM8 7C7.44772 7 7 7.44772 7 8V16C7 16.5523 7.44772 17 8 17H16C16.5523 17 17 16.5523 17 16V8C17 7.44772 16.5523 7 16 7H8ZM9.72461 11.582C9.91869 11.4539 10.1827 11.4756 10.3535 11.6465L13.8535 15.1465C14.0488 15.3417 14.0488 15.6583 13.8535 15.8535C13.6583 16.0488 13.3417 16.0488 13.1465 15.8535L10 12.707L8.85352 13.8535C8.65825 14.0488 8.34175 14.0488 8.14648 13.8535C7.95122 13.6583 7.95122 13.3417 8.14648 13.1465L9.64648 11.6465L9.72461 11.582ZM14 8C15.1046 8 16 8.89543 16 10C16 11.1046 15.1046 12 14 12C12.8954 12 12 11.1046 12 10C12 8.89543 12.8954 8 14 8ZM14 9C13.4477 9 13 9.44772 13 10C13 10.5523 13.4477 11 14 11C14.5523 11 15 10.5523 15 10C15 9.44772 14.5523 9 14 9Z",Wn=({className:t})=>sc("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:sc("path",{clipRule:"evenodd",d:r2,fill:"currentColor",fillRule:"evenodd"})});import{c as m2}from"react/compiler-runtime";import{jsx as f2}from"react/jsx-runtime";import{useLexicalComposerContext as p2}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as xc,$insertNodeToNearestRoot as Jn,mergeRegister as h2}from"@lexical/utils";import{useBulkUpload as g2,useEffectEvent as C2,useModal as x2}from"@payloadcms/ui";import Zn from"bson-objectid";import{$createRangeSelection as b2,$getPreviousSelection as fc,$getSelection as pc,$isParagraphNode as Yn,$isRangeSelection as hc,$setSelection as k2,COMMAND_PRIORITY_EDITOR as _2,COMMAND_PRIORITY_LOW as gc,createCommand as T2,DROP_COMMAND as w2,getDOMSelectionFromTarget as E2,isHTMLElement as Cc,PASTE_COMMAND as S2}from"lexical";import{useEffect as N2}from"react";import{c as ac}from"react/compiler-runtime";import{jsx as Kn}from"react/jsx-runtime";import{useLexicalComposerContext as cc}from"@lexical/react/LexicalComposerContext.js";import{toast as l2}from"@payloadcms/ui";import{$getNodeByKey as i2,COMMAND_PRIORITY_EDITOR as uc}from"lexical";import{useEffect as dc,useState as s2}from"react";var a2=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=i2(o);r&&r.replace(Re({data:{fields:null,relationTo:e,value:n}}))}):t.dispatchCommand(Xn,{fields:null,relationTo:e,value:n})},c2=t=>{let e=ac(13),{enabledCollectionSlugs:o}=t,[n]=cc(),[r,l]=s2(null),s;e[0]!==o?(s={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=s):s=e[1];let{closeListDrawer:i,ListDrawer:u,openListDrawer:d}=$t(s),c,a;e[2]!==n||e[3]!==d?(c=()=>n.registerCommand(qe,p=>(l(p?.replace?p?.replace.nodeKey:null),d(),!0),uc),a=[n,d],e[2]=n,e[3]=d,e[4]=c,e[5]=a):(c=e[4],a=e[5]),dc(c,a);let m;e[6]!==i||e[7]!==n||e[8]!==r?(m=p=>{let{collectionSlug:g,doc:_}=p;i(),a2({editor:n,relationTo:g,replaceNodeKey:r,value:_.id})},e[6]=i,e[7]=n,e[8]=r,e[9]=m):m=e[9];let f=m,h;return e[10]!==u||e[11]!==f?(h=Kn(u,{onSelect:f}),e[10]=u,e[11]=f,e[12]=h):h=e[12],h},u2=()=>{let t=ac(3),[e]=cc(),o,n;return t[0]!==e?(o=()=>e.registerCommand(qe,d2,uc),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),dc(o,n),null},mc=({enabledCollectionSlugs:t})=>t?.length?Kn(c2,{enabledCollectionSlugs:t}):Kn(u2,{});function d2(){return l2.error("No upload collections enabled"),!0}function L2(t){let e=t.target;return!!(Cc(e)&&!e.closest("code, span.editor-image")&&Cc(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function y2(t){let e,o=E2(t.target);if(document.caretRangeFromPoint)e=document.caretRangeFromPoint(t.clientX,t.clientY);else if(t.rangeParent&&o!==null)o.collapse(t.rangeParent,t.rangeOffset||0),e=o.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return e}var Xn=T2("INSERT_UPLOAD_COMMAND"),bc=t=>{let e=m2(21),{clientProps:o}=t,[n]=p2(),r=o?.disabledCollections,l=o?.enabledCollections,s;e[0]!==r||e[1]!==l?(s={collectionSlugsBlacklist:r,collectionSlugsWhitelist:l,uploads:!0},e[0]=r,e[1]=l,e[2]=s):s=e[2];let{enabledCollectionSlugs:i}=uo(s),{modalSlug:u,setCollectionSlug:d,setInitialForms:c,setOnCancel:a,setOnSuccess:m,setSelectableCollections:f}=g2(),{isModalOpen:h,openModal:p}=x2(),g;e[3]!==u||e[4]!==n||e[5]!==i||e[6]!==h||e[7]!==p||e[8]!==d||e[9]!==c||e[10]!==a||e[11]!==m||e[12]!==f?(g=C=>{let{files:x}=C;if(x?.length!==0&&(c(k=>[...k??[],...x.map(R2)]),!h(u))){if(!i.length||!i[0])return;d(i[0]),f(i),a(()=>{n.update(v2)}),m(k=>{let T=new Map(k.map(I2));n.update(()=>{for(let I of xc()){let N=I.node;if(et(N)){let E=N.getData();if(E?.pending){let S=T.get(E.pending?.formID);S&&N.replace(Re({data:{id:new Zn.default().toHexString(),fields:{},relationTo:S.collectionSlug,value:S.doc.id}}))}}}})}),p(u)}},e[3]=u,e[4]=n,e[5]=i,e[6]=h,e[7]=p,e[8]=d,e[9]=c,e[10]=a,e[11]=m,e[12]=f,e[13]=g):g=e[13];let _=C2(g),L;e[14]!==n||e[15]!==_?(L=()=>{if(!n.hasNodes([Qe]))throw new Error("UploadPlugin: UploadNode not registered on editor");return h2(n.registerNodeTransform(Qe,C=>{let x=C.getData();if(!x?.pending)return;(async function(){let I=null,N=x?.pending?.src,E=x?.pending?.formID;if(N?.startsWith("data:")){let S=N.match(/data:(image\/[a-zA-Z]+);base64,/),w=S?S[1]:"image/png",R=N.replace(/^data:image\/[a-zA-Z]+;base64,/,""),y=atob(R),M=new Array(y.length);for(let F=0;F<y.length;F++)M[F]=y.charCodeAt(F);let $=new Uint8Array(M);I={alt:void 0,file:new File([$],"pasted-image."+w?.split("/",2)[1],{type:w}),formID:E}}else if(N?.startsWith("http")||N?.startsWith("https")){let w=await(await fetch(N)).blob(),R=N.split("/").pop()||"pasted-image"+w.type.split("/",2)[1];I={alt:void 0,file:new File([w],R,{type:w.type}),formID:E}}I&&_({files:[I]})})()}),n.registerCommand(Xn,C=>(n.update(()=>{let x=pc()||fc();if(hc(x)){let k=Re({data:{id:C.id,fields:C.fields,relationTo:C.relationTo,value:C.value}}),{focus:T}=x,I=T.getNode();Jn(k),Yn(I)&&!I.__first&&I.remove()}}),!0),_2),n.registerCommand(S2,C=>{if(!(C instanceof ClipboardEvent))return!1;let x=C.clipboardData;if(!x?.types?.length||x?.types?.includes("text/html"))return!1;let k=[];return x?.files?.length&&Array.from(x.files).forEach(T=>{k.push({alt:"",file:T,formID:new Zn.default().toHexString()})}),k.length?(n.update(()=>{let T=pc()||fc();if(hc(T))for(let I of k){let N=Re({data:{pending:{formID:I.formID,src:URL.createObjectURL(I.file)}}}),{focus:E}=T,S=E.getNode();Jn(N),Yn(S)&&!S.__first&&S.remove()}}),_({files:k}),!0):!1},gc),n.registerCommand(w2,C=>{if(!(C instanceof DragEvent))return!1;let x=C.dataTransfer;if(!x?.types?.length)return!1;let k=[];return x?.files?.length&&Array.from(x.files).forEach(T=>{k.push({alt:"",file:T,formID:new Zn.default().toHexString()})}),k.length?(C.preventDefault(),C.stopPropagation(),n.update(()=>{if(L2(C)){let T=y2(C),I=b2();T!=null&&I.applyDOMRange(T),k2(I);for(let N of k){let E=Re({data:{pending:{formID:N.formID,src:URL.createObjectURL(N.file)}}}),{focus:S}=I,w=S.getNode();Jn(E),Yn(w)&&!w.__first&&w.remove()}}}),_({files:k}),!0):!1},gc))},e[14]=n,e[15]=_,e[16]=L):L=e[16];let v;e[17]!==n?(v=[n],e[17]=n,e[18]=v):v=e[18],N2(L,v);let b;return e[19]!==i?(b=f2(mc,{enabledCollectionSlugs:i}),e[19]=i,e[20]=b):b=e[20],b};function R2(t){return{file:t.file,formID:t.formID}}function v2(){for(let t of xc()){let e=t.node;et(e)&&e.getData()?.pending&&e.remove()}}function I2(t){return[t.formID,t]}var A2=A({nodes:[Qe],plugins:[{Component:bc,position:"normal"}],slashMenu:{groups:[J([{Icon:Wn,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(qe,{replace:!1})}}])]},toolbarFixed:{groups:[be([{ChildComponent:Wn,isActive:({selection:t})=>{if(!M2(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return et(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(qe,{replace:!1})}}])]}});import{c as D2}from"react/compiler-runtime";import{jsx as So}from"react/jsx-runtime";import{createElement as O2}from"react";import{ShimmerEffect as F2,useConfig as P2}from"@payloadcms/ui";import{lazy as B2,Suspense as j2,useEffect as H2,useState as G2}from"react";var kc={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",inlineBlock:"LexicalEditorTheme__inlineBlock",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",hrSelected:"LexicalEditorTheme__hrSelected",indent:"LexicalEditorTheme__indent",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",placeholder:"LexicalEditorTheme__placeholder",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",root:"LexicalEditorTheme",rtl:"LexicalEditorTheme__rtl",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"LexicalEditorTheme__upload"};var qn={namespace:"lexical",theme:kc};function _c({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:n,schemaPath:r,unSanitizedEditorConfig:l}){let s=new Map,i=[];for(let c of l.features){if(!c?.clientFeatureProps?.featureKey||c?.clientFeatureProps?.order===void 0||c?.clientFeatureProps?.order===null){console.warn("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected. Skipping feature.");continue}s.set(c.clientFeatureProps.featureKey,c),i.push(c)}l.features=i,l.features=l.features.sort((c,a)=>c.clientFeatureProps.order-a.clientFeatureProps.order);let u=new Map,d=0;for(let c of l.features){let a=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:s,field:n,resolvedFeatures:u,schemaPath:r,unSanitizedEditorConfig:l}):c.feature;a.key=c.clientFeatureProps.featureKey,a.order=d,u.set(c.clientFeatureProps.featureKey,a),d++}return u}import{deepMerge as $2}from"payload/shared";var Tc=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(n=>{n.key==="toolbarFixed"&&n.sanitizedClientFeatureProps?.customGroups&&(o={...o,...n.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(n=>{if(n.providers?.length&&(e.providers=e.providers.concat(n.providers)),n.enableFormats?.length&&e.enabledFormats.push(...n.enableFormats),n.nodes?.length)for(let r of n.nodes)e.nodes.push(r);if(n.plugins?.length&&n.plugins.forEach((r,l)=>{e.plugins?.push({clientProps:n.sanitizedClientFeatureProps,Component:r.Component,key:n.key+l,position:r.position})}),n.toolbarInline?.groups?.length)for(let r of n.toolbarInline.groups){let l=e.toolbarInline.groups.find(s=>s.key===r.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.toolbarInline?.groups.push(l)}if(n.toolbarFixed?.groups?.length)for(let r of n.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(s=>s.key===r.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.toolbarFixed?.groups.push(l)}if(n.slashMenu?.groups){n.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(n.slashMenu.dynamicGroups));for(let r of n.slashMenu.groups){let l=e.slashMenu.groups.find(s=>s.key===r.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.slashMenu.groups.push(l)}}if(n.markdownTransformers?.length)for(let r of n.markdownTransformers)typeof r=="function"?e.markdownTransformers.push(r({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(r);e.enabledFeatures.push(n.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(n=>{let r=o[n.key];return r?$2(n,r):n})),e.toolbarInline.groups.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0),e.toolbarFixed.groups.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);for(let n of e.toolbarInline.groups)n.items.sort((r,l)=>r.order&&l.order?r.order-l.order:r.order?-1:l.order?1:0);for(let n of e.toolbarFixed.groups)n.items.sort((r,l)=>r.order&&l.order?r.order-l.order:r.order?-1:l.order?1:0);return e};function Qn(t,e,o,n){return{admin:o,features:Tc(t),lexical:e,resolvedFeatureMap:t,view:n}}var U2=B2(()=>import("./Field-F22V5L4V.js").then(t=>({default:t.RichText}))),z2=t=>So(Do,{inheritable:!0,views:t.views,children:So(V2,{...t})}),V2=t=>{let e=D2(23),{admin:o,clientFeatures:n,featureClientImportMap:r,featureClientSchemaMap:l,field:s,lexicalEditorConfig:i,schemaPath:u,views:d}=t,c;e[0]!==o?(c=o===void 0?{}:o,e[0]=o,e[1]=c):c=e[1];let a=c,m;e[2]!==r?(m=r===void 0?{}:r,e[2]=r,e[3]=m):m=e[3];let f=m,h=i===void 0?qn:i,{currentView:p}=Oo(),g=d?.[p]?.admin??a,_=d?.[p]?.lexical,L;e[4]!==h||e[5]!==_?(L=typeof _=="function"?_(h):_??h,e[4]=h,e[5]=_,e[6]=L):L=e[6];let v=L,{config:b}=P2(),[C,x]=G2(null),k,T;e[7]!==n||e[8]!==b||e[9]!==p||e[10]!==g||e[11]!==v||e[12]!==f||e[13]!==l||e[14]!==s||e[15]!==C||e[16]!==u||e[17]!==d?(k=()=>{if(C&&C.view===p)return;let N=d?.[p],E=N?.filterFeatures?N.filterFeatures(n):n,S=[];for(let R of Object.values(E))!R.clientFeatureProvider||!R.clientFeatureProps||S.push(R.clientFeatureProvider(R.clientFeatureProps));let w=_c({config:b,featureClientImportMap:f,featureClientSchemaMap:l,field:s,schemaPath:u??s.name,unSanitizedEditorConfig:{features:S,lexical:v}});x(Qn(w,v,g,p))},T=[g,n,b,f,l,s,C,v,u,p,d],e[7]=n,e[8]=b,e[9]=p,e[10]=g,e[11]=v,e[12]=f,e[13]=l,e[14]=s,e[15]=C,e[16]=u,e[17]=d,e[18]=k,e[19]=T):(k=e[18],T=e[19]),H2(k,T);let I;return e[20]!==C||e[21]!==t?(I=So(j2,{fallback:So(F2,{height:"35vh"}),children:C&&O2(U2,{...t,editorConfig:C,key:C.view})}),e[20]=C,e[21]=t,e[22]=I):I=e[22],I};function W2(...t){return t.filter(Boolean).join(" ")}var K2=t=>(e,o,n)=>{let r=t(n);r&&(r.append(...o),e.replace(r),r.select(0,0))};var No=new WeakMap;function wc(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Lo(t,e){let o=No.get(t);if(o===void 0){let n=new Set,r=s=>{o!==void 0&&(o.start=wc(s))},l=s=>{if(o===void 0)return;let{start:i}=o;if(i===null)return;let u=wc(s);for(let d of n)u!==null&&d([u[0]-i[0],u[1]-i[1]],s)};t.addEventListener("touchstart",r),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:r,listeners:n,start:null},No.set(t,o)}return o.listeners.add(e),()=>{X2(t,e)}}function X2(t,e){let o=No.get(t);if(o===void 0)return;let{listeners:n}=o;n.delete(e),n.size===0&&(No.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function J2(t,e){return Lo(t,(o,n)=>{let[r,l]=o;r<0&&-r>Math.abs(l)&&e(r,n)})}function Z2(t,e){return Lo(t,(o,n)=>{let[r,l]=o;r>0&&r>Math.abs(l)&&e(r,n)})}function Y2(t,e){return Lo(t,(o,n)=>{let[r,l]=o;l<0&&-l>Math.abs(r)&&e(r,n)})}function q2(t,e){return Lo(t,(o,n)=>{let[r,l]=o;l>0&&l>Math.abs(r)&&e(r,n)})}import{c as Q2}from"react/compiler-runtime";import{jsx as eC}from"react/jsx-runtime";import"react";var tC=()=>{let t=Q2(2),{EditButton:e}=Ce(),o;return t[0]!==e?(o=e?eC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as oC}from"react/compiler-runtime";import{jsx as nC}from"react/jsx-runtime";import"react";var rC=()=>{let t=oC(2),{RemoveButton:e}=Ce(),o;return t[0]!==e?(o=e?nC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as lC}from"react/compiler-runtime";import{jsx as iC}from"react/jsx-runtime";import"react";var sC=()=>{let t=lC(2),{Label:e}=Ce(),o;return t[0]!==e?(o=e?iC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as aC}from"react/compiler-runtime";import{jsx as cC}from"react/jsx-runtime";import"react";var uC=t=>{let e=aC(3),{children:o}=t,{InlineBlockContainer:n}=Ce(),r;return e[0]!==n||e[1]!==o?(r=n?cC(n,{children:o}):null,e[0]=n,e[1]=o,e[2]=r):r=e[2],r};import{jsx as dC}from"react/jsx-runtime";import"react";var mC=t=>{let{children:e,...o}=t,{BlockCollapsible:n}=ae();return n?dC(n,{...o,children:e}):null};import{c as fC}from"react/compiler-runtime";import{jsx as pC}from"react/jsx-runtime";import"react";var hC=()=>{let t=fC(2),{EditButton:e}=ae(),o;return t[0]!==e?(o=e?pC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as gC}from"react/compiler-runtime";import{jsx as CC}from"react/jsx-runtime";import"react";var xC=()=>{let t=gC(2),{RemoveButton:e}=ae(),o;return t[0]!==e?(o=e?CC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as bC}from"qs-esm";var kC=({apiURL:t,depth:e,draft:o,locale:n})=>async({id:l,collectionSlug:s,select:i})=>{let u=bC({depth:e??0,draft:o??!1,locale:n,select:i},{addQueryPrefix:!0});return await fetch(`${t}/${s}/${l}${u}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(c=>c.json())};var Ec={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
63
60
  `)&&!t.language?.length?"```"+t.code+"```":"```"+(t.language||"")+(t.code?`
64
61
  `+t.code:"")+"\n```",import:({children:t,closeMatch:e,openMatch:o})=>{let n=o?.[1];return t.startsWith(`
65
62
  `)&&(t=t.slice(1)),t.endsWith(`
66
63
  `)&&(t=t.slice(0,-1)),!!e&&!t.includes(`
67
- `)&&o?.input?.trim()!=="```"+n?{code:n+(t?.length?t:""),language:""}:{code:t,language:n}}};import{jsx as hC}from"react/jsx-runtime";import{CodeField as gC,useFormFields as xC}from"@payloadcms/ui";import{useId as CC,useMemo as bC}from"react";var Mo={abap:"ABAP",apex:"Apex",azcli:"Azure CLI",bat:"Batch",bicep:"Bicep",cameligo:"CameLIGO",clojure:"Clojure",coffee:"CoffeeScript",cpp:"C++",csharp:"C#",csp:"CSP",css:"CSS",cypher:"Cypher",dart:"Dart",dockerfile:"Dockerfile",ecl:"ECL",elixir:"Elixir",flow9:"Flow9",freemarker2:"FreeMarker 2",fsharp:"F#",go:"Go",graphql:"GraphQL",handlebars:"Handlebars",hcl:"HCL",html:"HTML",ini:"INI",java:"Java",javascript:"JavaScript",julia:"Julia",kotlin:"Kotlin",less:"Less",lexon:"Lexon",liquid:"Liquid",lua:"Lua",m3:"M3",markdown:"Markdown",mdx:"MDX",mips:"MIPS",msdax:"DAX",mysql:"MySQL","objective-c":"Objective-C",pascal:"Pascal",pascaligo:"PascaLIGO",perl:"Perl",pgsql:"PostgreSQL",php:"PHP",pla:"PLA",plaintext:"Plain Text",postiats:"Postiats",powerquery:"Power Query",powershell:"PowerShell",protobuf:"Protobuf",pug:"Pug",python:"Python",qsharp:"Q#",r:"R",razor:"Razor",redis:"Redis",redshift:"Amazon Redshift",restructuredtext:"reStructuredText",ruby:"Ruby",rust:"Rust",sb:"Small Basic",scala:"Scala",scheme:"Scheme",scss:"SCSS",shell:"Shell",solidity:"Solidity",sophia:"Sophia",sparql:"SPARQL",sql:"SQL",st:"Structured Text",swift:"Swift",systemverilog:"SystemVerilog",tcl:"Tcl",twig:"Twig",typescript:"TypeScript",typespec:"TypeSpec",vb:"Visual Basic",wgsl:"WGSL",xml:"XML",yaml:"YAML"};var kC=({autoComplete:t,field:e,forceRender:o,languages:n=Mo,path:r,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:u,typescript:c,validate:d})=>{let a=xC(([_])=>_.language),m=a?.value||a?.initialValue||"typescript",p=CC(),h=n[m],f=bC(()=>({...e,type:"code",admin:{...e.admin,editorOptions:{},editorProps:{defaultPath:m==="ts"?`file-${e.name}-${p}.tsx`:void 0},language:m}}),[e,m,p]),g=`${e.name}-${m}-${h}`;return f&&hC(gC,{autoComplete:t,field:f,forceRender:o,onMount:(_,L)=>{L.editor.defineTheme("vs-dark",{base:"vs-dark",colors:{"editor.background":"#222222"},inherit:!0,rules:[]}),L.editor.defineTheme("vs",{base:"vs",colors:{"editor.background":"#f5f5f5"},inherit:!0,rules:[]}),L.languages.typescript.typescriptDefaults.setCompilerOptions({allowNonTsExtensions:!0,allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,jsx:L.languages.typescript.JsxEmit.React,moduleResolution:L.languages.typescript.ModuleResolutionKind.NodeJs,noEmit:!0,paths:c?.paths,reactNamespace:"React",target:L.languages.typescript.ScriptTarget[c?.target??"ESNext"],typeRoots:c?.typeRoots??["node_modules/@types"]}),L.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!c?.enableSemanticValidation,noSyntaxValidation:!1}),(async()=>c?.fetchTypes&&Array.isArray(c.fetchTypes)&&c.fetchTypes.length>0&&await Promise.all(c.fetchTypes.map(async b=>{let C=await(await fetch(b.url)).text();L.languages.typescript.typescriptDefaults.addExtraLib(C,b.filePath)})))()},path:r,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:u,validate:d},g)};import{jsx as re,jsxs as ru}from"react/jsx-runtime";import{useLexicalEditable as vC}from"@lexical/react/useLexicalEditable";import{ChevronIcon as IC,Combobox as MC,CopyToClipboard as AC,PopupList as DC,RenderFields as $C,useForm as OC,useFormFields as lu,useTranslation as FC}from"@payloadcms/ui";import BC from"react";import{jsx as qc}from"react/jsx-runtime";import"react";var _C={16:"M6.646 6.146a.5.5 0 1 0 .708.708l1.5-1.5a.5.5 0 0 0 0-.708l-1.5-1.5a.5.5 0 1 0-.708.708L7.793 5zm-1.292-3a.5.5 0 0 1 0 .708L4.207 5l1.147 1.146a.5.5 0 1 1-.708.708l-1.5-1.5a.5.5 0 0 1 0-.708l1.5-1.5a.5.5 0 0 1 .708 0M10.5 3h1A1.5 1.5 0 0 1 13 4.5v7a1.5 1.5 0 0 1-1.5 1.5h-7A1.5 1.5 0 0 1 3 11.5v-3a.5.5 0 0 1 1 0v3a.5.5 0 0 0 .5.5h7a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 1 0-1",24:"M16.5 6C17.3284 6 18 6.67157 18 7.5V16.5C18 17.3284 17.3284 18 16.5 18H7.5C6.67157 18 6 17.3284 6 16.5V12.5C6 12.2239 6.22386 12 6.5 12C6.77614 12 7 12.2239 7 12.5V16.5C7 16.7761 7.22386 17 7.5 17H16.5C16.7761 17 17 16.7761 17 16.5V7.5C17 7.22386 16.7761 7 16.5 7H15.5C15.2239 7 15 6.77614 15 6.5C15 6.22386 15.2239 6 15.5 6H16.5ZM8.14648 6.14648C8.34175 5.95122 8.65825 5.95122 8.85352 6.14648C9.04878 6.34175 9.04878 6.65825 8.85352 6.85352L7.20703 8.5L8.85352 10.1465C9.04878 10.3417 9.04878 10.6583 8.85352 10.8535C8.65825 11.0488 8.34175 11.0488 8.14648 10.8535L6.14648 8.85352C5.95122 8.65825 5.95122 8.34175 6.14648 8.14648L8.14648 6.14648ZM11.1465 6.14648C11.3417 5.95122 11.6583 5.95122 11.8535 6.14648L13.8535 8.14648C14.0488 8.34175 14.0488 8.65825 13.8535 8.85352L11.8535 10.8535C11.6583 11.0488 11.3417 11.0488 11.1465 10.8535C10.9512 10.6583 10.9512 10.3417 11.1465 10.1465L12.793 8.5L11.1465 6.85352C10.9512 6.65825 10.9512 6.34175 11.1465 6.14648Z"},Qc=({className:t,size:e=24})=>qc("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:qc("path",{clipRule:"evenodd",d:_C[e],fill:"currentColor",fillRule:"evenodd"})});import{jsx as ir}from"react/jsx-runtime";import"react";import{useCollapsible as SC}from"@payloadcms/ui";import{jsx as eu}from"react/jsx-runtime";import"react";var TC="M11.4999 13C11.6325 13 11.7597 13.0527 11.8535 13.1464L14.8535 16.1464C15.0487 16.3417 15.0487 16.6582 14.8535 16.8535C14.6582 17.0487 14.3417 17.0487 14.1464 16.8535L11.4999 14.207L8.85346 16.8535C8.6582 17.0487 8.34169 17.0487 8.14643 16.8535C7.95119 16.6582 7.95119 16.3417 8.14643 16.1464L11.1464 13.1464C11.2402 13.0527 11.3674 13 11.4999 13ZM14.1464 7.14644C14.3417 6.95119 14.6582 6.95118 14.8535 7.14644C15.0487 7.3417 15.0487 7.65821 14.8535 7.85347L11.8535 10.8535C11.7597 10.9472 11.6325 10.9999 11.4999 11C11.3674 10.9999 11.2402 10.9472 11.1464 10.8535L8.14643 7.85347C7.95119 7.65821 7.95119 7.3417 8.14643 7.14644C8.34169 6.9512 8.6582 6.9512 8.85346 7.14644L11.4999 9.79292L14.1464 7.14644Z",Ao=({className:t})=>eu("svg",{className:t,fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:eu("path",{d:TC,fill:"currentColor"})});import{jsx as tu}from"react/jsx-runtime";import"react";var EC="M11.5 6C11.6326 6 11.7597 6.05272 11.8535 6.14648L14.8535 9.14648C15.0487 9.34175 15.0487 9.65825 14.8535 9.85352C14.6582 10.0488 14.3417 10.0488 14.1464 9.85352L12 7.70703V16.293L14.1464 14.1465C14.3417 13.9512 14.6582 13.9512 14.8535 14.1465C15.0487 14.3417 15.0487 14.6583 14.8535 14.8535L11.8535 17.8535C11.6582 18.0488 11.3417 18.0488 11.1464 17.8535L8.14645 14.8535C7.95119 14.6583 7.95119 14.3417 8.14645 14.1465C8.34171 13.9512 8.65822 13.9512 8.85348 14.1465L11 16.293V7.70703L8.85348 9.85352C8.65822 10.0488 8.34171 10.0488 8.14645 9.85352C7.95118 9.65825 7.95118 9.34175 8.14645 9.14648L11.1464 6.14648C11.2402 6.05272 11.3674 6 11.5 6Z",Do=({className:t})=>tu("svg",{className:t,fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:tu("path",{clipRule:"evenodd",d:EC,fill:"currentColor",fillRule:"evenodd"})});var wC="code-block-collapse-button",ou=()=>{let{isCollapsed:t,toggle:e}=SC();return ir("button",{className:wC,onClick:e,type:"button",children:t?ir(Do,{}):ir(Ao,{})})};import{jsx as sr,jsxs as NC}from"react/jsx-runtime";import{useCollapsible as LC,useTranslation as RC}from"@payloadcms/ui";import"react";var yC="code-block-floating-collapse-button",nu=()=>{let{isCollapsed:t,toggle:e}=LC(),{t:o}=RC();return NC("button",{className:yC,onClick:e,type:"button",children:[t?sr(Do,{}):sr(Ao,{}),sr("span",{children:o(t?"general:expand":"general:collapse")})]})};var Je="payload-richtext-code-block",PC=t=>{let{languages:e}=t,o=e||Mo,{BlockCollapsible:n,formSchema:r,RemoveButton:l}=ae(),{setModified:s}=OC(),{t:i}=FC(),{codeField:u}=lu(([h])=>({codeField:h?.code})),{selectedLanguageField:c,setSelectedLanguage:d}=lu(([h,f])=>({selectedLanguageField:h?.language,setSelectedLanguage:g=>{f({type:"UPDATE",path:"language",value:g}),s(!0)}})),a=o[c?.value],m=vC(),p=BC.useMemo(()=>Object.entries(o).map(([h,f])=>({name:`${h} ${f}`,Component:re(DC.Button,{active:!1,disabled:!1,onClick:()=>{d(h)},children:re("span",{className:`${Je}__language-code`,"data-language":h,children:f})})})),[o,d]);return re(n,{Actions:ru("div",{className:`${Je}__actions`,children:[re(MC,{"aria-label":i("general:language"),button:ru("div",{className:`${Je}__language-selector-button`,"data-selected-language":c?.value,children:[re("span",{children:a}),re(IC,{className:`${Je}__chevron`})]}),buttonType:"custom",className:`${Je}__language-selector`,disabled:!m,entries:p,horizontalAlign:"right",minEntriesForSearch:8,searchPlaceholder:i("fields:searchForLanguage"),showScrollbar:!0,size:"large"}),re(AC,{value:u?.value??""}),re(ou,{}),m&&re(l,{})]}),className:Je,collapsibleProps:{AfterCollapsible:re(nu,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:re("div",{className:`${Je}__pill`,children:re(Qc,{})}),showDragHandle:!1,showRowNumber:!1,children:re($C,{fields:r,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!m})})};import{c as jC}from"react/compiler-runtime";import{jsx as ht}from"react/jsx-runtime";import{FieldContext as HC,FieldPathContext as iu,ServerFunctionsContext as su,ShimmerEffect as UC,useServerFunctions as GC}from"@payloadcms/ui";import VC,{useEffect as WC,useRef as zC}from"react";var KC=t=>{let e=jC(9),{field:o,initialValue:n,Loading:r,path:l,schemaPath:s,setValue:i,value:u}=t,[c,d]=VC.useState(null),a=GC(),{_internal_renderField:m}=a,[p,h]=s.split(".",2),f=l??(o&&"name"in o?o?.name:"")??"",g;e[0]!==m||e[1]!==o||e[2]!==n||e[3]!==l||e[4]!==s?(g=()=>{(async function(){let{Field:I}=await m({field:{...o||{},type:"richText",admin:{...o?.admin||{},hidden:!1}},initialValue:n??void 0,path:l,schemaPath:s});d(I)})()},e[0]=m,e[1]=o,e[2]=n,e[3]=l,e[4]=s,e[5]=g):g=e[5];let _=g,L=zC(!1),v,b;if(e[6]!==_?(v=()=>{L.current||(L.current=!0,_())},b=[_],e[6]=_,e[7]=v,e[8]=b):(v=e[7],b=e[8]),WC(v,b),!c)return typeof r<"u"?r:ht(UC,{});let x={...a,getFormState:async k=>a.getFormState({...k,collectionSlug:p==="collection"?h:void 0,globalSlug:p==="global"?h:void 0})};if(typeof u>"u"&&!i)return ht(su,{value:{...x},children:ht(iu,{value:f,children:c},f)});let C={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:u,path:f,setValue:i??JC,showError:!1,value:u};return ht(su,{value:{...x},children:ht(iu,{value:f,children:ht(HC,{value:C,children:c})},f)})};function JC(){}function au({nodes:t,text:e}){let o={root:{type:"root",children:[],direction:"ltr",format:"",indent:0,version:1}};return e&&o.root.children.push({type:"paragraph",children:[{type:"text",detail:0,format:0,mode:"normal",style:"",text:e,version:1}],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),t?.length&&o.root.children.push(...t),o.root.children.length===0&&o.root.children.push({type:"paragraph",children:[],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),o}var XC=au;export{vt as $createAutoLinkNode,Pe as $createBlockNode,nt as $createHorizontalRuleNode,kt as $createInlineBlockNode,Ee as $createLinkNode,Ke as $createRelationshipNode,ge as $createUploadNode,Se as $isAutoLinkNode,Me as $isBlockNode,Ue as $isHorizontalRuleNode,_t as $isInlineBlockNode,K as $isLinkNode,yn as $isRelationshipNode,ft as $isUploadNode,Au as AlignFeatureClient,we as AutoLinkNode,iC as BlockCollapsible,cC as BlockEditButton,ce as BlockNode,mC as BlockRemoveButton,Uu as BlockquoteFeatureClient,y1 as BlocksFeatureClient,Q1 as BoldFeatureClient,se as CAN_USE_DOM,b0 as ChecklistFeatureClient,PC as CodeBlockBlockComponent,kC as CodeComponent,Y0 as DETAIL_TYPE_TO_DETAIL,K0 as DOUBLE_LINE_BREAK,uh as DebugJsxConverterFeatureClient,Q0 as ELEMENT_FORMAT_TO_TYPE,q0 as ELEMENT_TYPE_TO_FORMAT,Cu as ENABLE_SLASH_MENU_COMMAND,fu as EditorConfigProvider,Bo as FieldsDrawer,F5 as FixedToolbarFeatureClient,np as HeadingFeatureClient,Ep as HorizontalRuleFeatureClient,Te as HorizontalRuleNode,tt as INSERT_BLOCK_COMMAND,ot as INSERT_INLINE_BLOCK_COMMAND,W0 as IS_ALL_FORMATTING,Pp as IndentFeatureClient,rC as InlineBlockContainer,Xx as InlineBlockEditButton,tC as InlineBlockLabel,bt as InlineBlockNode,qx as InlineBlockRemoveButton,rm as InlineCodeFeatureClient,Y5 as InlineToolbarFeatureClient,cm as ItalicFeatureClient,X0 as LTR_REGEX,r0 as LinkFeatureClient,oe as LinkNode,z0 as NON_BREAKING_SPACE,O as NodeFormat,L0 as OrderedListFeatureClient,F0 as ParagraphFeatureClient,gu as Point,J0 as RTL_REGEX,bu as Rect,e5 as RelationshipFeatureClient,Ne as RelationshipNode,KC as RenderLexical,Bx as RichTextField,Po as RichTextViewProvider,fm as StrikethroughFeatureClient,bm as SubscriptFeatureClient,wm as SuperscriptFeatureClient,eh as TEXT_MODE_TO_TYPE,Z0 as TEXT_TYPE_TO_FORMAT,th as TEXT_TYPE_TO_MODE,pe as TOGGLE_LINK_COMMAND,V2 as TableFeatureClient,G1 as TestRecorderFeatureClient,jm as TextStateFeatureClient,Ot as ToolbarButton,Ft as ToolbarDropdown,J1 as TreeViewFeatureClient,ym as UnderlineFeatureClient,$0 as UnorderedListFeatureClient,Lx as UploadFeatureClient,he as UploadNode,zx as addSwipeDownListener,Gx as addSwipeLeftListener,Vx as addSwipeRightListener,Wx as addSwipeUpListener,XC as buildDefaultEditorState,au as buildEditorState,Yc as codeConverterClient,nn as createBlockNode,A as createClientFeature,dh as defaultColors,rr as defaultEditorLexicalConfig,Fn as getDOMRangeRect,ku as getEnabledNodes,fC as getRestPopulateFn,rt as getSelectedNode,jx as isHTMLElement,xu as isPoint,Hx as joinClasses,lr as sanitizeClientEditorConfig,Xc as sanitizeClientFeatures,Co as setFloatingElemPosition,io as setFloatingElemPositionForLinkEditor,X as slashMenuBasicGroupWithItems,_e as toolbarAddDropdownGroupWithItems,an as toolbarFeatureButtonsGroupWithItems,Z as toolbarFormatGroupWithItems,te as toolbarTextDropdownGroupWithItems,ae as useBlockComponentContext,G as useEditorConfigContext,be as useInlineBlockComponentContext,hu as useLexicalDocumentDrawer,Oe as useLexicalDrawer,$t as useLexicalListDrawer,jo as useRichTextView};
64
+ `)&&o?.input?.trim()!=="```"+n?{code:n+(t?.length?t:""),language:""}:{code:t,language:n}}};import{jsx as _C}from"react/jsx-runtime";import{CodeField as TC,useFormFields as wC}from"@payloadcms/ui";import{useId as EC,useMemo as SC}from"react";var yo={abap:"ABAP",apex:"Apex",azcli:"Azure CLI",bat:"Batch",bicep:"Bicep",cameligo:"CameLIGO",clojure:"Clojure",coffee:"CoffeeScript",cpp:"C++",csharp:"C#",csp:"CSP",css:"CSS",cypher:"Cypher",dart:"Dart",dockerfile:"Dockerfile",ecl:"ECL",elixir:"Elixir",flow9:"Flow9",freemarker2:"FreeMarker 2",fsharp:"F#",go:"Go",graphql:"GraphQL",handlebars:"Handlebars",hcl:"HCL",html:"HTML",ini:"INI",java:"Java",javascript:"JavaScript",julia:"Julia",kotlin:"Kotlin",less:"Less",lexon:"Lexon",liquid:"Liquid",lua:"Lua",m3:"M3",markdown:"Markdown",mdx:"MDX",mips:"MIPS",msdax:"DAX",mysql:"MySQL","objective-c":"Objective-C",pascal:"Pascal",pascaligo:"PascaLIGO",perl:"Perl",pgsql:"PostgreSQL",php:"PHP",pla:"PLA",plaintext:"Plain Text",postiats:"Postiats",powerquery:"Power Query",powershell:"PowerShell",protobuf:"Protobuf",pug:"Pug",python:"Python",qsharp:"Q#",r:"R",razor:"Razor",redis:"Redis",redshift:"Amazon Redshift",restructuredtext:"reStructuredText",ruby:"Ruby",rust:"Rust",sb:"Small Basic",scala:"Scala",scheme:"Scheme",scss:"SCSS",shell:"Shell",solidity:"Solidity",sophia:"Sophia",sparql:"SPARQL",sql:"SQL",st:"Structured Text",swift:"Swift",systemverilog:"SystemVerilog",tcl:"Tcl",twig:"Twig",typescript:"TypeScript",typespec:"TypeSpec",vb:"Visual Basic",wgsl:"WGSL",xml:"XML",yaml:"YAML"};var NC=({autoComplete:t,field:e,forceRender:o,languages:n=yo,path:r,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:u,typescript:d,validate:c})=>{let a=wC(([_])=>_.language),m=a?.value||a?.initialValue||"typescript",f=EC(),h=n[m],p=SC(()=>({...e,type:"code",admin:{...e.admin,editorOptions:{},editorProps:{defaultPath:m==="ts"?`file-${e.name}-${f}.tsx`:void 0},language:m}}),[e,m,f]),g=`${e.name}-${m}-${h}`;return p&&_C(TC,{autoComplete:t,field:p,forceRender:o,onMount:(_,L)=>{L.editor.defineTheme("vs-dark",{base:"vs-dark",colors:{"editor.background":"#222222"},inherit:!0,rules:[]}),L.editor.defineTheme("vs",{base:"vs",colors:{"editor.background":"#f5f5f5"},inherit:!0,rules:[]}),L.languages.typescript.typescriptDefaults.setCompilerOptions({allowNonTsExtensions:!0,allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,jsx:L.languages.typescript.JsxEmit.React,moduleResolution:L.languages.typescript.ModuleResolutionKind.NodeJs,noEmit:!0,paths:d?.paths,reactNamespace:"React",target:L.languages.typescript.ScriptTarget[d?.target??"ESNext"],typeRoots:d?.typeRoots??["node_modules/@types"]}),L.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!d?.enableSemanticValidation,noSyntaxValidation:!1}),(async()=>d?.fetchTypes&&Array.isArray(d.fetchTypes)&&d.fetchTypes.length>0&&await Promise.all(d.fetchTypes.map(async b=>{let x=await(await fetch(b.url)).text();L.languages.typescript.typescriptDefaults.addExtraLib(x,b.filePath)})))()},path:r,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:u,validate:c},g)};import{jsx as re,jsxs as Ic}from"react/jsx-runtime";import{useLexicalEditable as OC}from"@lexical/react/useLexicalEditable";import{ChevronIcon as FC,Combobox as PC,CopyToClipboard as BC,PopupList as jC,RenderFields as HC,useForm as GC,useFormFields as Mc,useTranslation as UC}from"@payloadcms/ui";import zC from"react";import{jsx as Sc}from"react/jsx-runtime";import"react";var LC={16:"M6.646 6.146a.5.5 0 1 0 .708.708l1.5-1.5a.5.5 0 0 0 0-.708l-1.5-1.5a.5.5 0 1 0-.708.708L7.793 5zm-1.292-3a.5.5 0 0 1 0 .708L4.207 5l1.147 1.146a.5.5 0 1 1-.708.708l-1.5-1.5a.5.5 0 0 1 0-.708l1.5-1.5a.5.5 0 0 1 .708 0M10.5 3h1A1.5 1.5 0 0 1 13 4.5v7a1.5 1.5 0 0 1-1.5 1.5h-7A1.5 1.5 0 0 1 3 11.5v-3a.5.5 0 0 1 1 0v3a.5.5 0 0 0 .5.5h7a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 1 0-1",24:"M16.5 6C17.3284 6 18 6.67157 18 7.5V16.5C18 17.3284 17.3284 18 16.5 18H7.5C6.67157 18 6 17.3284 6 16.5V12.5C6 12.2239 6.22386 12 6.5 12C6.77614 12 7 12.2239 7 12.5V16.5C7 16.7761 7.22386 17 7.5 17H16.5C16.7761 17 17 16.7761 17 16.5V7.5C17 7.22386 16.7761 7 16.5 7H15.5C15.2239 7 15 6.77614 15 6.5C15 6.22386 15.2239 6 15.5 6H16.5ZM8.14648 6.14648C8.34175 5.95122 8.65825 5.95122 8.85352 6.14648C9.04878 6.34175 9.04878 6.65825 8.85352 6.85352L7.20703 8.5L8.85352 10.1465C9.04878 10.3417 9.04878 10.6583 8.85352 10.8535C8.65825 11.0488 8.34175 11.0488 8.14648 10.8535L6.14648 8.85352C5.95122 8.65825 5.95122 8.34175 6.14648 8.14648L8.14648 6.14648ZM11.1465 6.14648C11.3417 5.95122 11.6583 5.95122 11.8535 6.14648L13.8535 8.14648C14.0488 8.34175 14.0488 8.65825 13.8535 8.85352L11.8535 10.8535C11.6583 11.0488 11.3417 11.0488 11.1465 10.8535C10.9512 10.6583 10.9512 10.3417 11.1465 10.1465L12.793 8.5L11.1465 6.85352C10.9512 6.65825 10.9512 6.34175 11.1465 6.14648Z"},Nc=({className:t,size:e=24})=>Sc("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Sc("path",{clipRule:"evenodd",d:LC[e],fill:"currentColor",fillRule:"evenodd"})});import{jsx as er}from"react/jsx-runtime";import"react";import{useCollapsible as IC}from"@payloadcms/ui";import{jsx as Lc}from"react/jsx-runtime";import"react";var yC="M11.4999 13C11.6325 13 11.7597 13.0527 11.8535 13.1464L14.8535 16.1464C15.0487 16.3417 15.0487 16.6582 14.8535 16.8535C14.6582 17.0487 14.3417 17.0487 14.1464 16.8535L11.4999 14.207L8.85346 16.8535C8.6582 17.0487 8.34169 17.0487 8.14643 16.8535C7.95119 16.6582 7.95119 16.3417 8.14643 16.1464L11.1464 13.1464C11.2402 13.0527 11.3674 13 11.4999 13ZM14.1464 7.14644C14.3417 6.95119 14.6582 6.95118 14.8535 7.14644C15.0487 7.3417 15.0487 7.65821 14.8535 7.85347L11.8535 10.8535C11.7597 10.9472 11.6325 10.9999 11.4999 11C11.3674 10.9999 11.2402 10.9472 11.1464 10.8535L8.14643 7.85347C7.95119 7.65821 7.95119 7.3417 8.14643 7.14644C8.34169 6.9512 8.6582 6.9512 8.85346 7.14644L11.4999 9.79292L14.1464 7.14644Z",Ro=({className:t})=>Lc("svg",{className:t,fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Lc("path",{d:yC,fill:"currentColor"})});import{jsx as yc}from"react/jsx-runtime";import"react";var RC="M11.5 6C11.6326 6 11.7597 6.05272 11.8535 6.14648L14.8535 9.14648C15.0487 9.34175 15.0487 9.65825 14.8535 9.85352C14.6582 10.0488 14.3417 10.0488 14.1464 9.85352L12 7.70703V16.293L14.1464 14.1465C14.3417 13.9512 14.6582 13.9512 14.8535 14.1465C15.0487 14.3417 15.0487 14.6583 14.8535 14.8535L11.8535 17.8535C11.6582 18.0488 11.3417 18.0488 11.1464 17.8535L8.14645 14.8535C7.95119 14.6583 7.95119 14.3417 8.14645 14.1465C8.34171 13.9512 8.65822 13.9512 8.85348 14.1465L11 16.293V7.70703L8.85348 9.85352C8.65822 10.0488 8.34171 10.0488 8.14645 9.85352C7.95118 9.65825 7.95118 9.34175 8.14645 9.14648L11.1464 6.14648C11.2402 6.05272 11.3674 6 11.5 6Z",vo=({className:t})=>yc("svg",{className:t,fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:yc("path",{clipRule:"evenodd",d:RC,fill:"currentColor",fillRule:"evenodd"})});var vC="code-block-collapse-button",Rc=()=>{let{isCollapsed:t,toggle:e}=IC();return er("button",{className:vC,onClick:e,type:"button",children:t?er(vo,{}):er(Ro,{})})};import{jsx as tr,jsxs as MC}from"react/jsx-runtime";import{useCollapsible as AC,useTranslation as $C}from"@payloadcms/ui";import"react";var DC="code-block-floating-collapse-button",vc=()=>{let{isCollapsed:t,toggle:e}=AC(),{t:o}=$C();return MC("button",{className:DC,onClick:e,type:"button",children:[t?tr(vo,{}):tr(Ro,{}),tr("span",{children:o(t?"general:expand":"general:collapse")})]})};var We="payload-richtext-code-block",VC=t=>{let{languages:e}=t,o=e||yo,{BlockCollapsible:n,formSchema:r,RemoveButton:l}=ae(),{setModified:s}=GC(),{t:i}=UC(),{codeField:u}=Mc(([h])=>({codeField:h?.code})),{selectedLanguageField:d,setSelectedLanguage:c}=Mc(([h,p])=>({selectedLanguageField:h?.language,setSelectedLanguage:g=>{p({type:"UPDATE",path:"language",value:g}),s(!0)}})),a=o[d?.value],m=OC(),f=zC.useMemo(()=>Object.entries(o).map(([h,p])=>({name:`${h} ${p}`,Component:re(jC.Button,{active:!1,disabled:!1,onClick:()=>{c(h)},children:re("span",{className:`${We}__language-code`,"data-language":h,children:p})})})),[o,c]);return re(n,{Actions:Ic("div",{className:`${We}__actions`,children:[re(PC,{"aria-label":i("general:language"),button:Ic("div",{className:`${We}__language-selector-button`,"data-selected-language":d?.value,children:[re("span",{children:a}),re(FC,{className:`${We}__chevron`})]}),buttonType:"custom",className:`${We}__language-selector`,disabled:!m,entries:f,horizontalAlign:"right",minEntriesForSearch:8,searchPlaceholder:i("fields:searchForLanguage"),showScrollbar:!0,size:"large"}),re(BC,{value:u?.value??""}),re(Rc,{}),m&&re(l,{})]}),className:We,collapsibleProps:{AfterCollapsible:re(vc,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:re("div",{className:`${We}__pill`,children:re(Nc,{})}),showDragHandle:!1,showRowNumber:!1,children:re(HC,{fields:r,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!m})})};import{c as WC}from"react/compiler-runtime";import{jsx as pt}from"react/jsx-runtime";import{FieldContext as KC,FieldPathContext as Ac,ServerFunctionsContext as $c,ShimmerEffect as XC,useServerFunctions as JC}from"@payloadcms/ui";import ZC,{useEffect as YC,useRef as qC}from"react";var QC=t=>{let e=WC(9),{field:o,initialValue:n,Loading:r,path:l,schemaPath:s,setValue:i,value:u}=t,[d,c]=ZC.useState(null),a=JC(),{_internal_renderField:m}=a,[f,h]=s.split(".",2),p=l??(o&&"name"in o?o?.name:"")??"",g;e[0]!==m||e[1]!==o||e[2]!==n||e[3]!==l||e[4]!==s?(g=()=>{(async function(){let{Field:I}=await m({field:{...o||{},type:"richText",admin:{...o?.admin||{},hidden:!1}},initialValue:n??void 0,path:l,schemaPath:s});c(I)})()},e[0]=m,e[1]=o,e[2]=n,e[3]=l,e[4]=s,e[5]=g):g=e[5];let _=g,L=qC(!1),v,b;if(e[6]!==_?(v=()=>{L.current||(L.current=!0,_())},b=[_],e[6]=_,e[7]=v,e[8]=b):(v=e[7],b=e[8]),YC(v,b),!d)return typeof r<"u"?r:pt(XC,{});let C={...a,getFormState:async k=>a.getFormState({...k,collectionSlug:f==="collection"?h:void 0,globalSlug:f==="global"?h:void 0})};if(typeof u>"u"&&!i)return pt($c,{value:{...C},children:pt(Ac,{value:p,children:d},p)});let x={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:u,path:p,setValue:i??e4,showError:!1,value:u};return pt($c,{value:{...C},children:pt(Ac,{value:p,children:pt(KC,{value:x,children:d})},p)})};function e4(){}function Dc({nodes:t,text:e}){let o={root:{type:"root",children:[],direction:"ltr",format:"",indent:0,version:1}};return e&&o.root.children.push({type:"paragraph",children:[{type:"text",detail:0,format:0,mode:"normal",style:"",text:e,version:1}],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),t?.length&&o.root.children.push(...t),o.root.children.length===0&&o.root.children.push({type:"paragraph",children:[],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),o}var t4=Dc;export{Rt as $createAutoLinkNode,Pe as $createBlockNode,nt as $createHorizontalRuleNode,bt as $createInlineBlockNode,_e as $createLinkNode,Ve as $createRelationshipNode,Re as $createUploadNode,we as $isAutoLinkNode,Ie as $isBlockNode,He as $isHorizontalRuleNode,kt as $isInlineBlockNode,K as $isLinkNode,wn as $isRelationshipNode,et as $isUploadNode,iu as AlignFeatureClient,Te as AutoLinkNode,mC as BlockCollapsible,hC as BlockEditButton,ce as BlockNode,xC as BlockRemoveButton,pu as BlockquoteFeatureClient,Pd as BlocksFeatureClient,m1 as BoldFeatureClient,se as CAN_USE_DOM,yp as ChecklistFeatureClient,VC as CodeBlockBlockComponent,NC as CodeComponent,o0 as DETAIL_TYPE_TO_DETAIL,qp as DOUBLE_LINE_BREAK,h0 as DebugJsxConverterFeatureClient,r0 as ELEMENT_FORMAT_TO_TYPE,n0 as ELEMENT_TYPE_TO_FORMAT,Vc as ENABLE_SLASH_MENU_COMMAND,Hc as EditorConfigProvider,$o as FieldsDrawer,Jh as FixedToolbarFeatureClient,xm as HeadingFeatureClient,Fm as HorizontalRuleFeatureClient,ke as HorizontalRuleNode,tt as INSERT_BLOCK_COMMAND,ot as INSERT_INLINE_BLOCK_COMMAND,Zp as IS_ALL_FORMATTING,Qm as IndentFeatureClient,uC as InlineBlockContainer,tC as InlineBlockEditButton,sC as InlineBlockLabel,xt as InlineBlockNode,rC as InlineBlockRemoveButton,x1 as InlineCodeFeatureClient,c5 as InlineToolbarFeatureClient,S1 as ItalicFeatureClient,e0 as LTR_REGEX,xp as LinkFeatureClient,oe as LinkNode,Yp as NON_BREAKING_SPACE,O as NodeFormat,$p as OrderedListFeatureClient,Gp as ParagraphFeatureClient,Uc as Point,Qp as RTL_REGEX,Wc as Rect,lh as RelationshipFeatureClient,Ee as RelationshipNode,QC as RenderLexical,z2 as RichTextField,Do as RichTextViewProvider,I1 as StrikethroughFeatureClient,O1 as SubscriptFeatureClient,H1 as SuperscriptFeatureClient,l0 as TEXT_MODE_TO_TYPE,t0 as TEXT_TYPE_TO_FORMAT,i0 as TEXT_TYPE_TO_MODE,fe as TOGGLE_LINK_COMMAND,n2 as TableFeatureClient,qd as TestRecorderFeatureClient,nm as TextStateFeatureClient,Dt as ToolbarButton,Ot as ToolbarDropdown,n1 as TreeViewFeatureClient,W1 as UnderlineFeatureClient,jp as UnorderedListFeatureClient,A2 as UploadFeatureClient,Qe as UploadNode,q2 as addSwipeDownListener,J2 as addSwipeLeftListener,Z2 as addSwipeRightListener,Y2 as addSwipeUpListener,t4 as buildDefaultEditorState,Dc as buildEditorState,Ec as codeConverterClient,K2 as createBlockNode,A as createClientFeature,g0 as defaultColors,qn as defaultEditorLexicalConfig,In as getDOMRangeRect,Kc as getEnabledNodes,kC as getRestPopulateFn,rt as getSelectedNode,zc as isPoint,W2 as joinClasses,Qn as sanitizeClientEditorConfig,Tc as sanitizeClientFeatures,ho as setFloatingElemPosition,ro as setFloatingElemPositionForLinkEditor,J as slashMenuBasicGroupWithItems,be as toolbarAddDropdownGroupWithItems,on as toolbarFeatureButtonsGroupWithItems,Z as toolbarFormatGroupWithItems,te as toolbarTextDropdownGroupWithItems,ae as useBlockComponentContext,U as useEditorConfigContext,Ce as useInlineBlockComponentContext,Gc as useLexicalDocumentDrawer,De as useLexicalDrawer,$t as useLexicalListDrawer,Oo as useRichTextView};
68
65
  //# sourceMappingURL=index.js.map